Add Sepolia config (#10868)

This commit is contained in:
terencechain 2022-06-14 07:50:05 -07:00 committed by GitHub
parent 54624569bf
commit 434018a4b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 6 deletions

View File

@ -123,13 +123,15 @@ func configureTestnet(ctx *cli.Context) error {
if err := params.SetActive(params.RopstenConfig().Copy()); err != nil { if err := params.SetActive(params.RopstenConfig().Copy()); err != nil {
return err return err
} }
if err := ctx.Set(enableVecHTR.Names()[0], "true"); err != nil { applyRopstenFeatureFlags(ctx)
log.WithError(err).Debug("error enabling vectorized HTR flag")
}
if err := ctx.Set(enableForkChoiceDoublyLinkedTree.Names()[0], "true"); err != nil {
log.WithError(err).Debug("error enabling doubly linked tree forkchoice flag")
}
params.UseRopstenNetworkConfig() params.UseRopstenNetworkConfig()
} else if ctx.Bool(SepoliaTestnet.Name) {
log.Warn("Running on the Sepolia Beacon Chain Testnet")
if err := params.SetActive(params.SepoliaConfig().Copy()); err != nil {
return err
}
applySepoliaFeatureFlags(ctx)
params.UseSepoliaNetworkConfig()
} else { } else {
if ctx.IsSet(cmd.ChainConfigFileFlag.Name) { if ctx.IsSet(cmd.ChainConfigFileFlag.Name) {
log.Warn("Running on custom Ethereum network specified in a chain configuration yaml file") log.Warn("Running on custom Ethereum network specified in a chain configuration yaml file")
@ -143,6 +145,26 @@ func configureTestnet(ctx *cli.Context) error {
return nil return nil
} }
// Insert feature flags within the function to be enabled for Ropsten testnet.
func applyRopstenFeatureFlags(ctx *cli.Context) {
if err := ctx.Set(enableVecHTR.Names()[0], "true"); err != nil {
log.WithError(err).Debug("error enabling vectorized HTR flag")
}
if err := ctx.Set(enableForkChoiceDoublyLinkedTree.Names()[0], "true"); err != nil {
log.WithError(err).Debug("error enabling doubly linked tree forkchoice flag")
}
}
// Insert feature flags within the function to be enabled for Sepolia testnet.
func applySepoliaFeatureFlags(ctx *cli.Context) {
if err := ctx.Set(enableVecHTR.Names()[0], "true"); err != nil {
log.WithError(err).Debug("error enabling vectorized HTR flag")
}
if err := ctx.Set(enableForkChoiceDoublyLinkedTree.Names()[0], "true"); err != nil {
log.WithError(err).Debug("error enabling doubly linked tree forkchoice flag")
}
}
// ConfigureBeaconChain sets the global config based // ConfigureBeaconChain sets the global config based
// on what flags are enabled for the beacon-chain client. // on what flags are enabled for the beacon-chain client.
func ConfigureBeaconChain(ctx *cli.Context) error { func ConfigureBeaconChain(ctx *cli.Context) error {

View File

@ -17,6 +17,11 @@ var (
Name: "ropsten", Name: "ropsten",
Usage: "Run Prysm configured for the Ropsten beacon chain test network", Usage: "Run Prysm configured for the Ropsten beacon chain test network",
} }
// SepoliaTestnet flag for the multiclient Ethereum consensus testnet.
SepoliaTestnet = &cli.BoolFlag{
Name: "sepolia",
Usage: "Run Prysm configured for the Sepolia beacon chain test network",
}
// Mainnet flag for easier tooling, no-op // Mainnet flag for easier tooling, no-op
Mainnet = &cli.BoolFlag{ Mainnet = &cli.BoolFlag{
Value: true, Value: true,

View File

@ -17,6 +17,7 @@ go_library(
"testnet_e2e_config.go", "testnet_e2e_config.go",
"testnet_prater_config.go", "testnet_prater_config.go",
"testnet_ropsten_config.go", "testnet_ropsten_config.go",
"testnet_sepolia_config.go",
"testutils.go", "testutils.go",
"values.go", "values.go",
], ],

View File

@ -0,0 +1,37 @@
package params
import (
eth1Params "github.com/ethereum/go-ethereum/params"
)
// UseSepoliaNetworkConfig uses the Sepolia beacon chain specific network config.
func UseSepoliaNetworkConfig() {
cfg := BeaconNetworkConfig().Copy()
cfg.ContractDeploymentBlock = 1273020
cfg.BootstrapNodes = []string{
// EF boot node
"enr:-Iq4QMCTfIMXnow27baRUb35Q8iiFHSIDBJh6hQM5Axohhf4b6Kr_cOCu0htQ5WvVqKvFgY28893DHAg8gnBAXsAVqmGAX53x8JggmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk",
}
OverrideBeaconNetworkConfig(cfg)
}
// SepoliaConfig defines the config for the Sepolia beacon chain testnet.
func SepoliaConfig() *BeaconChainConfig {
cfg := MainnetConfig().Copy()
cfg.MinGenesisTime = 1655647200
cfg.GenesisDelay = 86400
cfg.MinGenesisActiveValidatorCount = 1300
cfg.ConfigName = SepoliaName
cfg.GenesisForkVersion = []byte{0x90, 0x00, 0x00, 0x69}
cfg.SecondsPerETH1Block = 14
cfg.DepositChainID = eth1Params.SepoliaChainConfig.ChainID.Uint64()
cfg.DepositNetworkID = eth1Params.SepoliaChainConfig.ChainID.Uint64()
cfg.AltairForkEpoch = 50
cfg.AltairForkVersion = []byte{0x90, 0x00, 0x00, 0x70}
cfg.BellatrixForkEpoch = 100
cfg.BellatrixForkVersion = []byte{0x90, 0x00, 0x00, 0x71}
cfg.TerminalTotalDifficulty = "100000000000000000000000"
cfg.DepositContractAddress = "0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D"
cfg.InitializeForkSchedule()
return cfg
}

View File

@ -10,4 +10,5 @@ const (
MinimalName = "minimal" MinimalName = "minimal"
PraterName = "prater" PraterName = "prater"
RopstenName = "ropsten" RopstenName = "ropsten"
SepoliaName = "sepolia"
) )