Add Prater config (#8613)

* Add Prater config

* Register flag everywhere

* gofmt

* Apply suggestions from code review

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* Update shared/params/testnet_prater_config.go

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
This commit is contained in:
Preston Van Loon
2021-03-17 09:14:07 -05:00
committed by GitHub
parent 7b16601399
commit 034a28710e
8 changed files with 64 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {
@@ -64,6 +65,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {
@@ -95,6 +97,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {
@@ -123,6 +126,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {
@@ -157,6 +161,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {

View File

@@ -42,6 +42,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {

View File

@@ -36,6 +36,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {
@@ -66,6 +67,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {
@@ -95,6 +97,7 @@ var Commands = &cli.Command{
featureconfig.Mainnet,
featureconfig.PyrmontTestnet,
featureconfig.ToledoTestnet,
featureconfig.PraterTestnet,
cmd.AcceptTosFlag,
}),
Before: func(cliCtx *cli.Context) error {

View File

@@ -121,6 +121,12 @@ func configureTestnet(ctx *cli.Context, cfg *Flags) {
params.UsePyrmontConfig()
params.UsePyrmontNetworkConfig()
cfg.PyrmontTestnet = true
} else if ctx.Bool(PraterTestnet.Name) {
log.Warn("Running on the Prater Testnet")
params.UsePraterConfig()
params.UsePraterNetworkConfig()
// TODO(8612): Define bootstrap nodes.
log.Error("No bootnodes are defined by default for Prater")
} else {
log.Warn("Running on ETH2 Mainnet")
params.UseMainnetConfig()

View File

@@ -17,6 +17,11 @@ var (
Name: "pyrmont",
Usage: "This defines the flag through which we can run on the Pyrmont Multiclient Testnet",
}
// PraterTestnet flag for the multiclient eth2 testnet.
PraterTestnet = &cli.BoolFlag{
Name: "prater",
Usage: "Run Prysm configured for the Prater test network",
}
// Mainnet flag for easier tooling, no-op
Mainnet = &cli.BoolFlag{
Value: true,
@@ -131,6 +136,7 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
disableAttestingHistoryDBCache,
ToledoTestnet,
PyrmontTestnet,
PraterTestnet,
Mainnet,
disableAccountsV2,
disableBlst,
@@ -143,6 +149,7 @@ var SlasherFlags = append(deprecatedFlags, []cli.Flag{
disableLookbackFlag,
ToledoTestnet,
PyrmontTestnet,
PraterTestnet,
Mainnet,
}...)
@@ -158,6 +165,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
attestationAggregationStrategy,
ToledoTestnet,
PyrmontTestnet,
PraterTestnet,
Mainnet,
disableBlst,
enablePeerScorer,

View File

@@ -13,6 +13,7 @@ go_library(
"minimal_config.go",
"network_config.go",
"testnet_e2e_config.go",
"testnet_prater_config.go",
"testnet_pyrmont_config.go",
"testnet_toledo_config.go",
"testutils.go",
@@ -22,6 +23,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//shared/bytesutil:go_default_library",
"@com_github_ethereum_go_ethereum//params:go_default_library",
"@com_github_mohae_deepcopy//:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",

View File

@@ -0,0 +1,37 @@
package params
import (
eth1Params "github.com/ethereum/go-ethereum/params"
)
// UsePraterNetworkConfig uses the Prater specific
// network config.
func UsePraterNetworkConfig() {
cfg := BeaconNetworkConfig().Copy()
cfg.ContractDeploymentBlock = 4367322
cfg.BootstrapNodes = []string{
// TODO(8612): Define bootstrap nodes.
}
OverrideBeaconNetworkConfig(cfg)
}
// UsePraterConfig sets the main beacon chain
// config for Prater.
func UsePraterConfig() {
beaconConfig = PraterConfig()
}
// PraterConfig defines the config for the
// Prater testnet.
func PraterConfig() *BeaconChainConfig {
cfg := MainnetConfig().Copy()
cfg.MinGenesisTime = 1614588812
cfg.GenesisDelay = 1919188
cfg.ConfigName = ConfigNames[Prater]
cfg.GenesisForkVersion = []byte{0x00, 0x00, 0x10, 0x20}
cfg.SecondsPerETH1Block = 14
cfg.DepositChainID = eth1Params.GoerliChainConfig.ChainID.Uint64()
cfg.DepositNetworkID = eth1Params.GoerliChainConfig.ChainID.Uint64()
cfg.DepositContractAddress = "0xff50ed3d0ec03ac01d4c79aad74928bff48a7b2b"
return cfg
}

View File

@@ -5,6 +5,7 @@ const (
EndToEnd
Pyrmont
Toledo
Prater
)
// ConfigNames provides network configuration names.
@@ -13,6 +14,7 @@ var ConfigNames = map[configName]string{
EndToEnd: "end-to-end",
Pyrmont: "pyrmont",
Toledo: "toledo",
Prater: "prater",
}
type configName = int