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

make deployment phase configurable #4231

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions beacon_chain/conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down
9 changes: 0 additions & 9 deletions beacon_chain/networking/network_metadata.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down