mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-22 12:30:08 +00:00
make deployment phase configurable (#4231)
Allow config of deployment phase via config instead of attempting to derive from genesis content (when running relevant testnets), so that we don't have to keep maintaining the list inside the binary.
This commit is contained in:
parent
2b531b6653
commit
10215dbc14
@ -113,6 +113,12 @@ type
|
||||
# migrateAll = "Export and remove the whole validator slashing protection DB."
|
||||
# migrate = "Export and remove specified validators from Nimbus."
|
||||
|
||||
DeploymentPhase* {.pure.} = enum
|
||||
Devnet = "devnet"
|
||||
Testnet = "testnet"
|
||||
Mainnet = "mainnet"
|
||||
None = "none"
|
||||
|
||||
BeaconNodeConf* = object
|
||||
configFile* {.
|
||||
desc: "Loads the configuration from a TOML file"
|
||||
@ -515,6 +521,13 @@ type
|
||||
defaultValueDesc: "50"
|
||||
name: "sync-horizon" .}: uint64
|
||||
|
||||
deploymentPhase* {.
|
||||
hidden
|
||||
desc: "Configures the deployment phase"
|
||||
defaultValue: DeploymentPhase.Mainnet
|
||||
defaultValueDesc: $DeploymentPhase.Mainnet
|
||||
name: "deployment-phase" .}: DeploymentPhase
|
||||
|
||||
# TODO nim-confutils on 32-bit platforms overflows decoding integers
|
||||
# requiring 64-bit representations and doesn't build when specifying
|
||||
# UInt256 directly, so pass this through for decoding elsewhere.
|
||||
|
@ -79,15 +79,6 @@ type
|
||||
else:
|
||||
incompatibilityDesc*: string
|
||||
|
||||
type DeploymentPhase* {.pure.} = enum
|
||||
None,
|
||||
Devnet,
|
||||
Testnet,
|
||||
Mainnet
|
||||
|
||||
func deploymentPhase*(genesisData: string): DeploymentPhase =
|
||||
DeploymentPhase.Devnet
|
||||
|
||||
const
|
||||
eth2NetworksDir = currentSourcePath.parentDir.replace('\\', '/') & "/../../vendor/eth2-networks"
|
||||
mergeTestnetsDir = currentSourcePath.parentDir.replace('\\', '/') & "/../../vendor/merge-testnets"
|
||||
|
@ -624,7 +624,7 @@ proc init*(T: type BeaconNode,
|
||||
dag = loadChainDag(
|
||||
config, cfg, db, eventBus,
|
||||
validatorMonitor, networkGenesisValidatorsRoot,
|
||||
genesisStateContents.deploymentPhase <= DeploymentPhase.Testnet)
|
||||
config.deploymentPhase <= DeploymentPhase.Testnet)
|
||||
genesisTime = getStateField(dag.headState, genesis_time)
|
||||
beaconClock = BeaconClock.init(genesisTime)
|
||||
getBeaconTime = beaconClock.getBeaconTimeFn()
|
||||
|
Loading…
x
Reference in New Issue
Block a user