From 415cb9ff8dfa64cf48f8694bd4c91e96f3f11503 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Thu, 23 Jul 2020 20:56:39 +0100 Subject: [PATCH] Add medalla testnet configuration. (#6700) --- shared/featureconfig/config.go | 15 +++++++++++++- shared/featureconfig/flags.go | 6 ++++++ shared/params/BUILD.bazel | 1 + shared/params/testnet_medalla_config.go | 27 +++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 shared/params/testnet_medalla_config.go diff --git a/shared/featureconfig/config.go b/shared/featureconfig/config.go index 6fd936460..c3c4aa162 100644 --- a/shared/featureconfig/config.go +++ b/shared/featureconfig/config.go @@ -33,7 +33,8 @@ type Flags struct { // State locks NewBeaconStateLocks bool // NewStateLocks for updated beacon state locking. // Testnet Flags. - AltonaTestnet bool // AltonaTestnet defines the flag through which we can enable the node to run on the altona testnet. + AltonaTestnet bool // AltonaTestnet defines the flag through which we can enable the node to run on the altona testnet. + MedallaTestnet bool // MedallaTestnet defines the flag through which we can enable the node to run on the medalla testnet. // Feature related flags. WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory. InitSyncNoVerify bool // InitSyncNoVerify when initial syncing w/o verifying block's contents. @@ -120,6 +121,12 @@ func ConfigureBeaconChain(ctx *cli.Context) { params.UseAltonaNetworkConfig() cfg.AltonaTestnet = true } + if ctx.Bool(medallaTestnet.Name) { + log.Warn("Running Node on Medalla Testnet") + params.UseMedallaConfig() + params.UseMedallaNetworkConfig() + cfg.MedallaTestnet = true + } if ctx.Bool(writeSSZStateTransitionsFlag.Name) { log.Warn("Writing SSZ states and blocks after state transitions") cfg.WriteSSZStateTransitions = true @@ -263,6 +270,12 @@ func ConfigureValidator(ctx *cli.Context) { params.UseAltonaNetworkConfig() cfg.AltonaTestnet = true } + if ctx.Bool(medallaTestnet.Name) { + log.Warn("Running Validator on Medalla Testnet") + params.UseMedallaConfig() + params.UseMedallaNetworkConfig() + cfg.MedallaTestnet = true + } if ctx.Bool(enableLocalProtectionFlag.Name) { cfg.LocalProtection = true } else { diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index 67cd2a198..3ac825555 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -140,6 +140,10 @@ var ( Name: "altona", Usage: "This defines the flag through which we can run on the Altona Multiclient Testnet", } + medallaTestnet = &cli.BoolFlag{ + Name: "medalla", + Usage: "This defines the flag through which we can run on the Medalla Multiclient Testnet", + } enableAccountsV2 = &cli.BoolFlag{ Name: "enable-accounts-v2", Usage: "Enables usage of v2 for Prysm validator accounts", @@ -566,6 +570,7 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{ disableDomainDataCacheFlag, waitForSyncedFlag, altonaTestnet, + medallaTestnet, enableAccountsV2, }...) @@ -608,6 +613,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ newBeaconStateLocks, forceMaxCoverAttestationAggregation, altonaTestnet, + medallaTestnet, batchBlockVerify, initSyncVerbose, enableFinalizedDepositsCache, diff --git a/shared/params/BUILD.bazel b/shared/params/BUILD.bazel index 07378c799..8402aa6c5 100644 --- a/shared/params/BUILD.bazel +++ b/shared/params/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "network_config.go", "testnet_altona_config.go", "testnet_e2e_config.go", + "testnet_medalla_config.go", "testnet_onyx_config.go", "testutils.go", ], diff --git a/shared/params/testnet_medalla_config.go b/shared/params/testnet_medalla_config.go new file mode 100644 index 000000000..7266f568d --- /dev/null +++ b/shared/params/testnet_medalla_config.go @@ -0,0 +1,27 @@ +package params + +// UseMedallaNetworkConfig uses the Medalla specific +// network config. +func UseMedallaNetworkConfig() { + cfg := BeaconNetworkConfig().Copy() + cfg.ContractDeploymentBlock = 3085928 + cfg.DepositContractAddress = "0x07b39F4fDE4A38bACe212b546dAc87C58DfE3fDC" + cfg.BootstrapNodes = []string{} + + OverrideBeaconNetworkConfig(cfg) +} + +// UseMedallaConfig sets the main beacon chain +// config for medalla. +func UseMedallaConfig() { + beaconConfig = MedallaConfig() +} + +// MedallaConfig defines the config for the +// medalla testnet. +func MedallaConfig() *BeaconChainConfig { + cfg := MainnetConfig().Copy() + cfg.MinGenesisTime = 1596546000 + cfg.GenesisForkVersion = []byte{0x00, 0x00, 0x00, 0x01} + return cfg +}