From 36c921c601d62cd9681dadbfc4ffa76cbaba76f9 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Mon, 14 Sep 2020 21:21:46 -0700 Subject: [PATCH] Add spadina config (#7235) --- shared/featureconfig/config.go | 18 +++++++++++++-- shared/featureconfig/flags.go | 6 +++++ shared/params/BUILD.bazel | 1 + shared/params/testnet_spadina_config.go | 30 +++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 shared/params/testnet_spadina_config.go diff --git a/shared/featureconfig/config.go b/shared/featureconfig/config.go index a93a629786..4cddc6d377 100644 --- a/shared/featureconfig/config.go +++ b/shared/featureconfig/config.go @@ -33,8 +33,10 @@ 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. - OnyxTestnet bool // OnyxTestnet defines the flag through which we can enable the node to run on the onyx testnet. + AltonaTestnet bool // AltonaTestnet defines the flag through which we can enable the node to run on the altona testnet. + OnyxTestnet bool // OnyxTestnet defines the flag through which we can enable the node to run on the onyx testnet. + SpadinaTestnet bool // Spadina defines the flag through which we can enable the node to run on the spadina testnet. + // Feature related flags. WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory. InitSyncNoVerify bool // InitSyncNoVerify when initial syncing w/o verifying block's contents. @@ -134,6 +136,12 @@ func ConfigureBeaconChain(ctx *cli.Context) { params.UseOnyxNetworkConfig() cfg.OnyxTestnet = true } + if ctx.Bool(spadinaTestnet.Name) { + log.Warn("Running Node on Spadina Testnet") + params.UseSpadinaConfig() + params.UseSpadinaNetworkConfig() + cfg.SpadinaTestnet = true + } if ctx.Bool(writeSSZStateTransitionsFlag.Name) { log.Warn("Writing SSZ states and blocks after state transitions") cfg.WriteSSZStateTransitions = true @@ -299,6 +307,12 @@ func ConfigureValidator(ctx *cli.Context) { params.UseOnyxNetworkConfig() cfg.OnyxTestnet = true } + if ctx.Bool(spadinaTestnet.Name) { + log.Warn("Running Node on Spadina Testnet") + params.UseSpadinaConfig() + params.UseSpadinaNetworkConfig() + cfg.SpadinaTestnet = true + } if ctx.Bool(enableLocalProtectionFlag.Name) { cfg.LocalProtection = true } else { diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index 3bc0661194..36260206c6 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -15,6 +15,10 @@ var ( Name: "onyx", Usage: "This defines the flag through which we can run on the Onyx Prysm Testnet", } + spadinaTestnet = &cli.BoolFlag{ + Name: "spadina", + Usage: "This defines the flag through which we can run on the Spadina Multiclient Testnet", + } devModeFlag = &cli.BoolFlag{ Name: "dev", Usage: "Enable experimental features still in development. These features may not be stable.", @@ -636,6 +640,7 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{ waitForSyncedFlag, AltonaTestnet, OnyxTestnet, + spadinaTestnet, disableAccountsV2, }...) @@ -675,6 +680,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ disableNewBeaconStateLocks, AltonaTestnet, OnyxTestnet, + spadinaTestnet, batchBlockVerify, initSyncVerbose, disableFinalizedDepositsCache, diff --git a/shared/params/BUILD.bazel b/shared/params/BUILD.bazel index bf199f9a42..4e39589ce2 100644 --- a/shared/params/BUILD.bazel +++ b/shared/params/BUILD.bazel @@ -14,6 +14,7 @@ go_library( "testnet_e2e_config.go", "testnet_medalla_config.go", "testnet_onyx_config.go", + "testnet_spadina_config.go", "testutils.go", ], importpath = "github.com/prysmaticlabs/prysm/shared/params", diff --git a/shared/params/testnet_spadina_config.go b/shared/params/testnet_spadina_config.go new file mode 100644 index 0000000000..c6e7a45ef5 --- /dev/null +++ b/shared/params/testnet_spadina_config.go @@ -0,0 +1,30 @@ +package params + +// UseSpadinaNetworkConfig uses the Spadina specific +// network config. +func UseSpadinaNetworkConfig() { + cfg := BeaconNetworkConfig().Copy() + cfg.ContractDeploymentBlock = 3384340 + cfg.ChainID = 5 + cfg.NetworkID = 5 + cfg.DepositContractAddress = "0x48B597F4b53C21B48AD95c7256B49D1779Bd5890" + cfg.BootstrapNodes = []string{} + + OverrideBeaconNetworkConfig(cfg) +} + +// UseSpadinaConfig sets the main beacon chain +// config for Spadina. +func UseSpadinaConfig() { + beaconConfig = SpadinaConfig() +} + +// SpadinaConfig defines the config for the +// Spadina testnet. +func SpadinaConfig() *BeaconChainConfig { + cfg := MainnetConfig().Copy() + cfg.MinGenesisTime = 1601380800 + cfg.GenesisForkVersion = []byte{0x00, 0x00, 0x00, 0x00} + cfg.MinGenesisActiveValidatorCount = 1024 + return cfg +}