Skip to content

Commit

Permalink
Add Zinken config (prysmaticlabs#7391)
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain authored Sep 30, 2020
1 parent db92d90 commit e07b71b
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 4 deletions.
25 changes: 22 additions & 3 deletions shared/featureconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +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.
SpadinaTestnet bool // Spadina defines the flag through which we can enable the node to run on the spadina 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 // SpadinaTestnet defines the flag through which we can enable the node to run on the Spadina testnet.
ZinkenTestnet bool // ZinkenTestnet defines the flag through which we can enable the node to run on the Zinken testnet.

// Feature related flags.
WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory.
Expand Down Expand Up @@ -142,6 +143,12 @@ func ConfigureBeaconChain(ctx *cli.Context) {
params.UseSpadinaNetworkConfig()
cfg.SpadinaTestnet = true
}
if ctx.Bool(ZinkenTestnet.Name) {
log.Warn("Running Node on Zinken Testnet")
params.UseZinkenConfig()
params.UseZinkenNetworkConfig()
cfg.ZinkenTestnet = true
}
if ctx.Bool(writeSSZStateTransitionsFlag.Name) {
log.Warn("Writing SSZ states and blocks after state transitions")
cfg.WriteSSZStateTransitions = true
Expand Down Expand Up @@ -299,6 +306,12 @@ func ConfigureSlasher(ctx *cli.Context) {
params.UseSpadinaNetworkConfig()
cfg.SpadinaTestnet = true
}
if ctx.Bool(ZinkenTestnet.Name) {
log.Warn("Running Node on Zinken Testnet")
params.UseZinkenConfig()
params.UseZinkenNetworkConfig()
cfg.ZinkenTestnet = true
}
if ctx.Bool(disableLookbackFlag.Name) {
log.Warn("Disabling slasher lookback")
cfg.DisableLookback = true
Expand Down Expand Up @@ -332,6 +345,12 @@ func ConfigureValidator(ctx *cli.Context) {
params.UseSpadinaNetworkConfig()
cfg.SpadinaTestnet = true
}
if ctx.Bool(ZinkenTestnet.Name) {
log.Warn("Running Node on Zinken Testnet")
params.UseZinkenConfig()
params.UseZinkenNetworkConfig()
cfg.ZinkenTestnet = true
}
if ctx.Bool(enableLocalProtectionFlag.Name) {
cfg.LocalProtection = true
} else {
Expand Down
9 changes: 8 additions & 1 deletion shared/featureconfig/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ var (
Name: "onyx",
Usage: "This defines the flag through which we can run on the Onyx Prysm Testnet",
}
// SpadinaTestnet flag for the multiclient eth2 devnet.
// SpadinaTestnet flag for the multiclient eth2 testnet.
SpadinaTestnet = &cli.BoolFlag{
Name: "spadina",
Usage: "This defines the flag through which we can run on the Spadina Multiclient Testnet",
}
// ZinkenTestnet flag for the multiclient eth2 testnet.
ZinkenTestnet = &cli.BoolFlag{
Name: "zinken",
Usage: "This defines the flag through which we can run on the Zinken Multiclient Testnet",
}
devModeFlag = &cli.BoolFlag{
Name: "dev",
Usage: "Enable experimental features still in development. These features may not be stable.",
Expand Down Expand Up @@ -653,6 +658,7 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
AltonaTestnet,
OnyxTestnet,
SpadinaTestnet,
ZinkenTestnet,
disableAccountsV2,
enableBlst,
}...)
Expand Down Expand Up @@ -697,6 +703,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
AltonaTestnet,
OnyxTestnet,
SpadinaTestnet,
ZinkenTestnet,
disableBatchBlockVerify,
initSyncVerbose,
disableFinalizedDepositsCache,
Expand Down
1 change: 1 addition & 0 deletions shared/params/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ go_library(
"testnet_medalla_config.go",
"testnet_onyx_config.go",
"testnet_spadina_config.go",
"testnet_zinken_config.go",
"testutils.go",
],
importpath = "github.com/prysmaticlabs/prysm/shared/params",
Expand Down
32 changes: 32 additions & 0 deletions shared/params/testnet_zinken_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package params

// UseZinkenNetworkConfig uses the Zinken specific
// network config.
func UseZinkenNetworkConfig() {
cfg := BeaconNetworkConfig().Copy()
cfg.ContractDeploymentBlock = 3384340
cfg.ChainID = 5
cfg.NetworkID = 5
cfg.DepositContractAddress = "0x99F0Ec06548b086E46Cb0019C78D0b9b9F36cD53"
// TODO(7390): Add Zinken bootnodes.
cfg.BootstrapNodes = []string{}
OverrideBeaconNetworkConfig(cfg)
}

// UseZinkenConfig sets the main beacon chain
// config for Zinken.
func UseZinkenConfig() {
beaconConfig = ZinkenConfig()
}

// ZinkenConfig defines the config for the
// Zinken testnet.
func ZinkenConfig() *BeaconChainConfig {
cfg := MainnetConfig().Copy()
cfg.MinGenesisTime = 1601899200
cfg.GenesisDelay = 345600
cfg.GenesisForkVersion = []byte{0x00, 0x00, 0x00, 0x03}
cfg.NetworkName = "zinken"
cfg.MinGenesisActiveValidatorCount = 1024
return cfg
}
6 changes: 6 additions & 0 deletions validator/accounts/v2/cmd_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ this command outputs a deposit data string which is required to become a validat
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
Expand All @@ -50,6 +51,7 @@ this command outputs a deposit data string which is required to become a validat
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
Expand All @@ -69,6 +71,7 @@ this command outputs a deposit data string which is required to become a validat
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
Expand All @@ -94,6 +97,7 @@ this command outputs a deposit data string which is required to become a validat
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
Expand All @@ -115,6 +119,7 @@ this command outputs a deposit data string which is required to become a validat
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
Expand Down Expand Up @@ -142,6 +147,7 @@ this command outputs a deposit data string which is required to become a validat
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
Expand Down
3 changes: 3 additions & 0 deletions validator/accounts/v2/cmd_wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var WalletCommands = &cli.Command{
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
Expand All @@ -49,6 +50,7 @@ var WalletCommands = &cli.Command{
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
Expand All @@ -70,6 +72,7 @@ var WalletCommands = &cli.Command{
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
featureconfig.SpadinaTestnet,
featureconfig.ZinkenTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
Expand Down

0 comments on commit e07b71b

Please sign in to comment.