Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP feat/rocketpool #27

Open
wants to merge 38 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7517e6d
feat(packages/clients/consensus/nimbus-eth2): Init package at 23.3.2.dev
MartinNikov Apr 26, 2023
c9f02d7
feat(modules/nimbus-eth2): Init `Nimbus Beacon Node` Module
MartinNikov May 2, 2023
a4fd378
feat(modules/nimbus-eth2): Add `trusted-node-url` argument
MartinNikov May 31, 2023
9f72eb0
feat(modules/nimbus-eth2): Add `backfill` argument
MartinNikov May 31, 2023
a994a31
update(packages/nimbus-eth2): Update `nimbus-eth2` to the newest version
MartinNikov Jun 21, 2023
cdefc2a
config(modules/nimbus-eth2): Fix problem with trustedNodeSync
MartinNikov Jun 22, 2023
21aa676
build(erigon-portable): Add variant that compiles BLST in portable mode
PetarKirov Jun 26, 2023
059d0c7
update(packages/nimbus-eth2): Update `nimbus-eth2` to v23.6.1
PetarKirov Jul 10, 2023
e0693d5
(modules/{nimbus-eth2,erigon}): Use DynamicUser and LoadCredential fo…
MartinNikov Aug 25, 2023
3203203
config(modules/nimbus-eth2): Set (again) the systemd unit user name (#9)
MartinNikov Aug 25, 2023
1524305
update(packages/nimbus-eth2): Update `nimbus-eth2` to v23.8.0
MartinNikov Aug 28, 2023
fc9d89b
config(modules/nimbus-eth2): Check if `/var/lib/private/nimbus-eth2/d…
MartinNikov Sep 19, 2023
c2d067e
config(modules/geth): Add `ipcEnable` option
MartinNikov Oct 25, 2023
af139d5
update(packages/nimbus-eth2): Update `nimbus-eth2` to v23.10.0
MartinNikov Oct 25, 2023
7dc3dab
fix(modules/nimbus-eth2): Fix `ExecStartPre` command-line
PetarKirov Oct 26, 2023
0a089f4
fix(modules/geth): Add `ipcEnable` to specialArgs
PetarKirov Oct 26, 2023
fccdd06
config(modules/nethermind): Set `MemoryDenyWriteExecute` to false
MartinNikov Oct 27, 2023
020b1f6
feat(modules/nimbus-eth2): Add `payload-builder` option
MartinNikov Oct 30, 2023
9375c8d
feat(modules/geth): Add influxdb options
MartinNikov Nov 24, 2023
9be5c9c
feat(modules): Add `holesky` network to `nimbus-eth` and `mev-boost`
MartinNikov Nov 29, 2023
919c877
config(packages): Update `mev-boost` packages
MartinNikov Nov 29, 2023
0b41809
config(packages): Update `nimbus-eth2` package
MartinNikov Nov 29, 2023
8e39931
refactor(packages/clients/consensus/nimbus-eth2): Print nim version i…
MartinNikov Nov 30, 2023
c416ce5
feat(modules/nimbus-eth2): Add `keymanager` options
MartinNikov Dec 1, 2023
b4226c1
build(packages/clients/consensus/nimbus-eth2): Ensure Nim 1.6 is used
PetarKirov Dec 13, 2023
2539fd5
update(packages/nimbus-eth2): Update `nimbus-eth2` to v24.1.1
MartinNikov Jan 12, 2024
22e3a1b
fix(packages/mev-boost): Hash mismatch
MartinNikov Jan 12, 2024
1a87786
feat(modules/nimbus-eth2): Add `web3-signer-url` option
MartinNikov Jan 12, 2024
9f497c4
config(modules/geth): Add `snapshot` option
MartinNikov Jan 12, 2024
b7d60bb
update(web3signer): version 24.1.0
zah Jan 13, 2024
b68b57f
config(modules/geth): Set `ProcSubset` to `all`
MartinNikov Jan 15, 2024
bc188c8
config(modules/geth): Change default influxdb settings value to `null`
MartinNikov Jan 16, 2024
be8233e
feat(modules/geth): Add `discovery.port` option
MartinNikov Jan 17, 2024
c80fc15
build(pkgs/geth): Enable on `x86_64-darwin` and `aarch64-darwin` plat…
PetarKirov Jan 18, 2024
cc458b5
config(modules/baseServiceConfig): Revert ProcSubset=pid (default is …
MartinNikov Jan 18, 2024
cab50ad
update(nethermind): 1.19.3 -> 1.25.1
monyarm Jan 22, 2024
fba79f7
config(modules/nethermind): Use new executable
MartinNikov Jan 23, 2024
98be43b
feat(modules): Add initial `rocketpool` module
MartinNikov Feb 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
./prysm-beacon
./prysm-validator
./restore
./nimbus-eth2
./rocketpool-service
];
};
}
25 changes: 22 additions & 3 deletions modules/erigon/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
pkgs,
...
}: let
inherit (lib.lists) optionals;
inherit (lib.lists) findFirst optionals;
inherit (lib.strings) hasPrefix;
inherit
(lib)
concatStringsSep
Expand Down Expand Up @@ -68,6 +69,11 @@ in {
serviceName = "erigon-${erigonName}";
in
cfg: let
jwtsecret =
if cfg.args.authrpc.jwtsecret != null
then ''--authrpc.jwtsecret=''${CREDENTIALS_DIRECTORY}/jwtsecret''
else "";

scriptArgs = let
# replace enable flags like --http.enable with just --http
pathReducer = path: let
Expand All @@ -86,11 +92,21 @@ in {
if cfg.args.datadir != null
then "--datadir ${cfg.args.datadir}"
else "--datadir %S/${serviceName}";

specialArgs = ["--authrpc.jwtsecret"];
isNormalArg = name: (findFirst (arg: hasPrefix arg name) null specialArgs) == null;
filteredArgs = builtins.filter isNormalArg args;
in ''
${datadir} \
${concatStringsSep " \\\n" args} \
${jwtsecret} \
${concatStringsSep " \\\n" filteredArgs} \
${lib.escapeShellArgs cfg.extraArgs}
'';

package =
if cfg.blst-portable
then pkgs.erigon-blst-portable
else cfg.package;
in
nameValuePair serviceName (mkIf cfg.enable {
description = "Erigon Ethereum node (${erigonName})";
Expand All @@ -106,8 +122,11 @@ in {
ExecStartPre = mkIf cfg.subVolume (mkBefore [
"+${scripts.setupSubVolume} /var/lib/private/${serviceName}"
]);
ExecStart = "${cfg.package}/bin/erigon ${scriptArgs}";
ExecStart = "${package}/bin/erigon ${scriptArgs}";
}
(mkIf (cfg.args.authrpc.jwtsecret != null) {
LoadCredential = ["jwtsecret:${cfg.args.authrpc.jwtsecret}"];
})
];
})
)
Expand Down
6 changes: 6 additions & 0 deletions modules/erigon/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
default = [];
};

blst-portable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc "Make blst library used by erigon build in portable mode. When this option is enabled, the package option is ignored.";
};

package = mkOption {
type = types.package;
default = pkgs.erigon;
Expand Down
41 changes: 41 additions & 0 deletions modules/geth/args.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@ with lib; {
default = 6060;
description = mdDoc "Port number of Go Ethereum metrics service.";
};

influxdb = {
enable = mkEnableOption (mdDoc "Enable metrics export/push to an external InfluxDB database");
endpoint = mkOption {
type = types.nullOr types.str;
default = null;
description = mdDoc "InfluxDB API endpoint to report metrics to.";
};

username = mkOption {
type = types.nullOr types.str;
default = null;
description = mdDoc "Username to authorize access to the database.";
};

password = mkOption {
type = types.nullOr types.str;
default = null;
description = mdDoc "Password to authorize access to the database.";
};
};
};

network = mkOption {
Expand Down Expand Up @@ -179,4 +200,24 @@ with lib; {
default = null;
description = mdDoc "Data directory for Geth. Defaults to '%S/geth-\<name\>', which generally resolves to /var/lib/geth-\<name\>.";
};

ipcEnable = mkOption {
type = types.bool;
default = false;
description = mdDoc "Enable the IPC-RPC server";
};

snapshot = mkOption {
type = types.bool;
default = true;
description = mdDoc "Enables snapshot-database mode";
};

discovery = {
port = mkOption {
type = types.port;
default = 30303;
description = mdDoc "Use a custom UDP port for P2P discovery.";
};
};
}
9 changes: 7 additions & 2 deletions modules/geth/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ in {
};

# filter out certain args which need to be treated differently
specialArgs = ["--network" "--authrpc.jwtsecret"];
specialArgs = ["--network" "--authrpc.jwtsecret" "--ipcEnable"];
isNormalArg = name: (findFirst (arg: hasPrefix arg name) null specialArgs) == null;

filteredArgs = builtins.filter isNormalArg args;
Expand All @@ -100,9 +100,14 @@ in {
if cfg.args.datadir != null
then "--datadir ${cfg.args.datadir}"
else "--datadir %S/${serviceName}";

ipc =
if cfg.args.ipcEnable
then ""
else "--ipcdisable";
in ''
${ipc} ${network} ${jwtSecret} \
${datadir} \
--ipcdisable ${network} ${jwtSecret} \
${concatStringsSep " \\\n" filteredArgs} \
${lib.escapeShellArgs cfg.extraArgs}
'';
Expand Down
2 changes: 1 addition & 1 deletion modules/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ lib: let
};
in {
inherit baseServiceConfig;
inherit mkArg mkArgs defaultPathReducer dotPathReducer;
inherit mkArg mkArgs defaultPathReducer defaultArgReducer defaultArgFormatter dotPathReducer;

findEnabled = with lib;
tree: let
Expand Down
2 changes: 1 addition & 1 deletion modules/mev-boost/args.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
lib:
with lib; {
network = mkOption {
type = types.nullOr (types.enum ["mainnet" "goerli" "sepolia" "zhejiang"]);
type = types.nullOr (types.enum ["mainnet" "goerli" "sepolia" "zhejiang" "holesky"]);
default = null;
description = mdDoc "The network to connect to. Mainnet (null) is the default ethereum network.";
};
Expand Down
4 changes: 3 additions & 1 deletion modules/nethermind/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ in {
{
User = serviceName;
StateDirectory = serviceName;
ExecStart = "${cfg.package}/bin/Nethermind.Runner ${scriptArgs}";
ExecStart = "${cfg.package}/bin/nethermind ${scriptArgs}";

MemoryDenyWriteExecute = false;
}
(mkIf (cfg.args.modules.JsonRpc.JwtSecretFile != null) {
LoadCredential = ["jwtsecret:${cfg.args.modules.JsonRpc.JwtSecretFile}"];
Expand Down
172 changes: 172 additions & 0 deletions modules/nimbus-eth2/args.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
lib:
with lib; {
network = mkOption {
type = types.nullOr (types.enum ["goerli" "prater" "ropsten" "sepolia" "holesky"]);
default = null;
description = mdDoc "The network to connect to. Mainnet (null) is the default ethereum network.";
};

jwt-secret = mkOption {
type = types.path;
default = null;
example = "/var/run/nimbus/jwtsecret";
description = mdDoc ''
Path of file with 32 bytes long JWT secret for Auth RPC endpoint.
Can be generated using 'openssl rand -hex 32'.
'';
};

udp-port = mkOption {
type = types.port;
default = 12000;
description = mdDoc "The port used by discv5.";
};

tcp-port = mkOption {
type = types.port;
default = 13000;
description = mdDoc "The port used by libp2p.";
};

subscribe-all-subnets = mkOption {
type = types.bool;
default = false;
description = mdDoc "Subscribe to all attestation subnet topics.";
};

doppelganger-detection = mkOption {
type = types.bool;
default = true;
description = mdDoc ''
Protection against slashing due to double-voting.
Means you will miss two attestations when restarting.
'';
};

suggested-fee-recipient = mkOption {
type = types.nullOr types.str;
default = null;
description = mdDoc ''
Wallet address where transaction fee tips - priority fees,
unburnt portion of gas fees - will be sent.
'';
};

nat = mkOption {
type = types.str;
default = "any";
example = "extip:12.34.56.78";
description = mdDoc ''
Method for determining public address. (any, none, upnp, pmp, extip:IP)
'';
};

metrics = {
enable = lib.mkEnableOption (mdDoc "Nimbus beacon node metrics endpoint");
address = mkOption {
type = types.str;
default = "127.0.0.1";
description = mdDoc "Metrics address for beacon node.";
};
port = mkOption {
type = types.port;
default = 8008;
description = mdDoc "Metrics port for beacon node.";
};
};

rest = {
enable = lib.mkEnableOption (mdDoc "Nimbus beacon node REST API");
address = mkOption {
type = types.str;
default = "127.0.0.1";
description = mdDoc "Listening address of the REST API server.";
};

port = mkOption {
type = types.port;
default = 5052;
description = mdDoc "Port for the REST API server.";
};
};

log = {
level = mkOption {
type = types.enum ["trace" "debug" "info" "notice" "warn" "error" "fatal" "none"];
default = "info";
example = "debug";
description = mdDoc "Logging level.";
};

format = mkOption {
type = types.enum ["auto" "colors" "nocolors" "json"];
default = "auto";
example = "json";
description = mdDoc "Logging formatting.";
};
};

web3-signer-url = mkOption {
type = types.nullOr types.str;
default = null;
example = "http://localhost:9000/";
description = mdDoc "Remote Web3Signer URL that will be used as a source of validators.";
};

web3-urls = mkOption {
type = types.listOf types.str;
default = [];
example = ["http://localhost:8551/"];
description = mdDoc "Mandatory URL(s) for the Web3 RPC endpoints.";
};

trusted-node-url = mkOption {
type = types.nullOr types.str;
default = null;
example = "http://localhost:5052/";
description = mdDoc "URL for Trusted Node Sync.";
};

backfill = mkOption {
type = types.nullOr types.bool;
default = true;
description = mdDoc "History backfill.";
};

payload-builder = {
enable = lib.mkEnableOption (mdDoc "Enable external payload builder.");
url = mkOption {
type = types.nullOr types.str;
default = null;
example = "http://localhost:18550/";
description = mdDoc "Payload builder URL.";
};
};

keymanager = {
enable = lib.mkEnableOption (mdDoc "Enable the REST keymanager API");
address = mkOption {
type = types.str;
default = "127.0.0.1";
description = mdDoc "Listening port for the REST keymanager API.";
};

port = mkOption {
type = types.port;
default = 5052;
description = mdDoc "Listening port for the REST keymanager API.";
};

allow-origin = mkOption {
type = types.nullOr types.str;
default = null;
description = mdDoc "Limit the access to the Keymanager API to a particular hostname (for CORS-enabled clients such as browsers).";
};

token-file = mkOption {
type = types.nullOr types.path;
default = null;
description = mdDoc "A file specifying the authorization token required for accessing the keymanager API.";
};
};
}
Loading