Skip to content

Commit

Permalink
Fix nimbus dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolmin committed Oct 31, 2024
1 parent e8639be commit e16366b
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 43 deletions.
4 changes: 0 additions & 4 deletions commands/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ func InitializeDirectory(ctx *cli.Context) error {

installClientConfigFiles(false)

log.Info("⬇️ Downloading nimbus (eth2) configuration files...")
_ = installConfigGroup(configs.Nimbus2ConfigDependencies, false)
log.Info("✅ Nimbus (eth2) configuration files downloaded!\n\n")

err := utils.CreateJwtSecret(jwtSecretPath)
if err != nil {
return utils.Exit(fmt.Sprintf("❌ There was an error while creating JWT secret file: %v", err), 1)
Expand Down
6 changes: 6 additions & 0 deletions commands/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func updateValues(ctx *cli.Context, config networkConfig) (err error) {
validatorYamlPath = config.configPath + "/" + configs.ValidatorYamlPath
tekuYamlPath = config.configPath + "/" + configs.TekuYamlPath
tekuValidatorYamlPath = config.configPath + "/" + configs.TekuValidatorYamlPath
nimbus2Path = config.configPath + "/" + configs.Nimbus2Path
nimbus2TomlPath = config.configPath + "/" + configs.Nimbus2TomlPath
nimbus2ValidatorTomlPath = config.configPath + "/" + configs.Nimbus2ValidatorTomlPath
gethGenesisPath = config.configPath + "/" + configs.GenesisJsonPath
Expand All @@ -121,6 +122,10 @@ func updateValues(ctx *cli.Context, config networkConfig) (err error) {
flags.PrysmDatadirFlag: config.consensusDatadirPath,
flags.ValidatorDatadirFlag: config.validatorDatadirPath,
flags.LighthouseDatadirFlag: config.consensusDatadirPath,
flags.NethermindDatadirFlag: config.executionDatadirPath,
flags.Nimbus2DatadirFlag: config.consensusDatadirPath,
flags.BesuDatadirFlag: config.executionDatadirPath,
flags.TekuDatadirFlag: config.consensusDatadirPath,
flags.LogFolderFlag: config.logPath,
flags.ValidatorKeysFlag: config.keysPath,
flags.GethConfigFileFlag: gethTomlPath,
Expand All @@ -133,6 +138,7 @@ func updateValues(ctx *cli.Context, config networkConfig) (err error) {
flags.ValidatorConfigFileFlag: validatorYamlPath,
flags.TekuConfigFileFlag: tekuYamlPath,
flags.TekuValidatorConfigFileFlag: tekuValidatorYamlPath,
flags.Nimbus2NetworkFlag: nimbus2Path,
flags.Nimbus2ConfigFileFlag: nimbus2TomlPath,
flags.Nimbus2ValidatorConfigFileFlag: nimbus2ValidatorTomlPath,
flags.GenesisJsonFlag: gethGenesisPath,
Expand Down
2 changes: 1 addition & 1 deletion commands/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func installClientConfigFiles(override bool) {
_ = installConfigGroup(configs.TekuConfigDependencies, override)
log.Info("✅ Teku configuration files downloaded!\n\n")

log.Info("⬇️ Downloading nimbus configuration files...")
log.Info("⬇️ Downloading nimbus (eth2) configuration files...")
_ = installConfigGroup(configs.Nimbus2ConfigDependencies, override)
log.Info("✅ Nimbus configuration files downloaded!\n\n")
}
2 changes: 2 additions & 0 deletions dependencies/clients/nimbus2.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ func (n *Nimbus2Client) Start(ctx *cli.Context, arguments []string) (err error)
args := []string{
"trustedNodeSync",
fmt.Sprintf("--trusted-node-url=%s", checkpointURL),
fmt.Sprintf("--data-dir=%s", ctx.String(flags.Nimbus2DatadirFlag)),
fmt.Sprintf("--network=%s", ctx.String(flags.Nimbus2NetworkFlag)),
}

syncCommand := exec.Command(fmt.Sprintf("./%s/build/nimbus_beacon_node", n.FilePath()), args...)
Expand Down
38 changes: 24 additions & 14 deletions dependencies/configs/nimbus2.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,42 @@ var Nimbus2ConfigDependencies = map[string]ClientConfigDependency{
filePath: TestnetConfig + "/" + Nimbus2ChainConfigYamlPath,
},
nimbus2MainnetConfigDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/mainnet/nimbus2/nimbus2.yaml",
name: nimbus2MainnetChainConfigDependencyName,
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/mainnet/nimbus2/nimbus2.toml",
name: nimbus2MainnetConfigDependencyName,
filePath: MainnetConfig + "/" + Nimbus2TomlPath,
},
nimbus2TestnetConfigDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/testnet/nimbus2/nimbus2.yaml",
name: nimbus2TestnetChainConfigDependencyName,
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/testnet/nimbus2/nimbus2.toml",
name: nimbus2TestnetConfigDependencyName,
filePath: TestnetConfig + "/" + Nimbus2TomlPath,
},
nimbus2MainnetDepositBlockHashDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/mainnet/nimbus2/nimbus2.yaml",
name: nimbus2MainnetDepositBlockHashDependencyName,
filePath: MainnetConfig + "/" + Nimbus2DepositContractHashPath,
nimbus2MainnetDepositContractBlockHashDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/mainnet/nimbus2/deposit_contract_block_hash.txt",
name: nimbus2MainnetDepositContractBlockHashDependencyName,
filePath: MainnetConfig + "/" + Nimbus2DepositContractBlockHashPath,
},
nimbus2TestnetDepositContractBlockHashDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/testnet/nimbus2/deposit_contract_block_hash.txt",
name: nimbus2TestnetDepositContractBlockHashDependencyName,
filePath: TestnetConfig + "/" + Nimbus2DepositContractBlockHashPath,
},
nimbus2MainnetDeployBlockDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/mainnet/nimbus2/deploy_block.txt",
name: nimbus2MainnetDeployBlockDependencyName,
filePath: MainnetConfig + "/" + Nimbus2DeployBlockPath,
},
nimbus2TestnetDepositBlockHashDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/testnet/nimbus2/nimbus2.yaml",
name: nimbus2TestnetDepositBlockHashDependencyName,
filePath: TestnetConfig + "/" + Nimbus2DepositContractHashPath,
nimbus2TestnetDeployBlockDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/testnet/nimbus2/deploy_block.txt",
name: nimbus2TestnetDeployBlockDependencyName,
filePath: TestnetConfig + "/" + Nimbus2DeployBlockPath,
},
nimbus2ValidatorMainnetConfigDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/mainnet/prysm/validator.yaml",
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/mainnet/nimbus2/validator.toml",
name: nimbus2ValidatorMainnetConfigDependencyName,
filePath: MainnetConfig + "/" + Nimbus2ValidatorTomlPath,
},
nimbus2ValidatorTestnetConfigDependencyName: &clientConfig{
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/testnet/prysm/validator.yaml",
url: "https://raw.githubusercontent.com/lukso-network/network-configs/main/testnet/nimbus2/validator.toml",
name: nimbus2ValidatorTestnetConfigDependencyName,
filePath: TestnetConfig + "/" + Nimbus2ValidatorTomlPath,
},
Expand Down
52 changes: 28 additions & 24 deletions dependencies/configs/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ const (
tekuMainnetChainConfigDependencyName = "teku mainnet chain config"
tekuTestnetChainConfigDependencyName = "teku testnet chain config"

nimbus2MainnetConfigDependencyName = "nimbus2 mainnet config"
nimbus2TestnetConfigDependencyName = "nimbus2 testnet config"
nimbus2MainnetChainConfigDependencyName = "nimbus2 mainnet chain config"
nimbus2TestnetChainConfigDependencyName = "nimbus2 testnet chain config"
nimbus2MainnetDepositBlockHashDependencyName = "nimbus2 mainnet deposit block hash"
nimbus2TestnetDepositBlockHashDependencyName = "nimbus2 testnet deposity block hash"
nimbus2MainnetConfigDependencyName = "nimbus2 mainnet config"
nimbus2TestnetConfigDependencyName = "nimbus2 testnet config"
nimbus2MainnetChainConfigDependencyName = "nimbus2 mainnet chain config"
nimbus2TestnetChainConfigDependencyName = "nimbus2 testnet chain config"
nimbus2MainnetDepositContractBlockHashDependencyName = "nimbus2 mainnet deposit contract block hash"
nimbus2TestnetDepositContractBlockHashDependencyName = "nimbus2 testnet deposit contract block hash"
nimbus2MainnetDeployBlockDependencyName = "nimbus2 mainnet deploy block "
nimbus2TestnetDeployBlockDependencyName = "nimbus2 testnet deploy block "

validatorMainnetConfigDependencyName = "validator mainnet config"
validatorTestnetConfigDependencyName = "validator testnet config"
Expand Down Expand Up @@ -124,24 +126,26 @@ const (
ValidatorMainnetDatadir = MainnetDatadir + "/validator"
ValidatorTestnetDatadir = TestnetDatadir + "/validator"

ChainConfigYamlPath = "shared/config.yaml"
DeployBlockPath = "shared/deploy_block.txt"
DepositContractBlockPath = "shared/deposit_contract_block.txt"
GethTomlPath = "geth/geth.toml"
ErigonTomlPath = "erigon/erigon.toml"
NethermindCfgPath = "nethermind/nethermind.cfg"
BesuTomlPath = "besu/besu.toml"
PrysmYamlPath = "prysm/prysm.yaml"
ValidatorYamlPath = "prysm/validator.yaml"
LighthouseTomlPath = "lighthouse/lighthouse.toml"
LighthouseValidatorTomlPath = "lighthouse/validator.toml"
TekuYamlPath = "teku/teku.yaml"
TekuValidatorYamlPath = "teku/validator.yaml"
TekuChainConfigYamlPath = "teku/config.yaml"
Nimbus2TomlPath = "nimbus2/nimbus.toml"
Nimbus2ValidatorTomlPath = "nimbus2/validator.toml"
Nimbus2ChainConfigYamlPath = "nimbus2/config.yaml"
Nimbus2DepositContractHashPath = "nimbus2/deposit_contract_hash.txt"
ChainConfigYamlPath = "shared/config.yaml"
DeployBlockPath = "shared/deploy_block.txt"
DepositContractBlockPath = "shared/deposit_contract_block.txt"
GethTomlPath = "geth/geth.toml"
ErigonTomlPath = "erigon/erigon.toml"
NethermindCfgPath = "nethermind/nethermind.cfg"
BesuTomlPath = "besu/besu.toml"
PrysmYamlPath = "prysm/prysm.yaml"
ValidatorYamlPath = "prysm/validator.yaml"
LighthouseTomlPath = "lighthouse/lighthouse.toml"
LighthouseValidatorTomlPath = "lighthouse/validator.toml"
TekuYamlPath = "teku/teku.yaml"
TekuValidatorYamlPath = "teku/validator.yaml"
TekuChainConfigYamlPath = "teku/config.yaml"
Nimbus2Path = "nimbus2" // useful when the path to the nimbus configs is needed, e.g. in --network flag
Nimbus2TomlPath = "nimbus2/nimbus.toml"
Nimbus2ValidatorTomlPath = "nimbus2/validator.toml"
Nimbus2ChainConfigYamlPath = "nimbus2/config.yaml"
Nimbus2DeployBlockPath = "nimbus2/deploy_block.txt"
Nimbus2DepositContractBlockHashPath = "nimbus2/deposit_contract_block_hash.txt"
)

var (
Expand Down
3 changes: 3 additions & 0 deletions flags/flag_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ const (
ValidatorChainConfigFileFlag = "validator-chain-config"

TekuTagFlag = "teku-tag"
TekuDatadirFlag = "teku-datadir"
TekuConfigFileFlag = "teku-config"
TekuValidatorConfigFileFlag = "teku-validator-config"

Nimbus2TagFlag = "nimbus2-tag"
Nimbus2CommitHashFlag = "nimbus2-commit-hash"
Nimbus2NetworkFlag = "nimbus2-network"
Nimbus2DatadirFlag = "nimbus2-datadir"
Nimbus2ConfigFileFlag = "nimbus2-config-file"
Nimbus2ValidatorConfigFileFlag = "nimbus2-validator-config-file"

Expand Down
16 changes: 16 additions & 0 deletions flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ var (
Hidden: true,
},
}

TekuDownloadFlags = []cli.Flag{
&cli.StringFlag{
Name: TekuTagFlag,
Expand All @@ -476,6 +477,11 @@ var (
Usage: "Path to validator.yaml config file",
Value: configs.MainnetConfig + "/" + configs.TekuValidatorYamlPath,
},
&cli.StringFlag{
Name: TekuDatadirFlag,
Usage: "Path to teku datadir",
Value: configs.MainnetDatadir,
},
}

Nimbus2DownloadFlags = []cli.Flag{
Expand All @@ -501,5 +507,15 @@ var (
Usage: "Path to validator.toml config file",
Value: configs.MainnetConfig + "/" + configs.Nimbus2ValidatorTomlPath,
},
&cli.StringFlag{
Name: Nimbus2DatadirFlag,
Usage: "Path to nimbus2 datadir",
Value: configs.MainnetDatadir,
},
&cli.StringFlag{
Name: Nimbus2NetworkFlag,
Usage: "Path to nimbus2 config directory, useful when using the --network nimbus flag",
Value: configs.MainnetConfig + "/" + configs.Nimbus2Path,
},
}
)

0 comments on commit e16366b

Please sign in to comment.