Add PulseChain network flags

This commit is contained in:
Shane Bammel 2023-01-30 19:09:40 -06:00
parent fd231a618a
commit e9aca9bd6a
11 changed files with 120 additions and 12 deletions

View File

@ -27,7 +27,9 @@ var Commands = &cli.Command{
flags.WalletPasswordFileFlag,
flags.DeletePublicKeysFlag,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
cmd.AcceptTosFlag,
@ -63,7 +65,9 @@ var Commands = &cli.Command{
flags.GrpcRetriesFlag,
flags.GrpcRetryDelayFlag,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
cmd.AcceptTosFlag,
@ -97,7 +101,9 @@ var Commands = &cli.Command{
flags.BackupPublicKeysFlag,
flags.BackupPasswordFile,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
cmd.AcceptTosFlag,
@ -128,7 +134,9 @@ var Commands = &cli.Command{
flags.AccountPasswordFileFlag,
flags.ImportPrivateKeyFileFlag,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
cmd.AcceptTosFlag,
@ -171,7 +179,9 @@ var Commands = &cli.Command{
flags.ForceExitFlag,
flags.VoluntaryExitJSONOutputPath,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
cmd.AcceptTosFlag,

View File

@ -22,7 +22,9 @@ var Commands = &cli.Command{
cmd.DataDirFlag,
flags.SlashingProtectionExportDirFlag,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
features.EnableMinimalSlashingProtection,
@ -51,7 +53,9 @@ var Commands = &cli.Command{
cmd.DataDirFlag,
flags.SlashingProtectionJSONFileFlag,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
features.EnableMinimalSlashingProtection,

View File

@ -31,7 +31,9 @@ var Commands = &cli.Command{
flags.Mnemonic25thWordFileFlag,
flags.SkipMnemonic25thWordCheckFlag,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
cmd.AcceptTosFlag,
@ -63,7 +65,9 @@ var Commands = &cli.Command{
flags.Mnemonic25thWordFileFlag,
flags.SkipMnemonic25thWordCheckFlag,
features.Mainnet,
features.PulseChain,
features.PraterTestnet,
features.PulseChainTestnet,
features.SepoliaTestnet,
features.HoleskyTestnet,
cmd.AcceptTosFlag,

View File

@ -130,6 +130,20 @@ func configureTestnet(ctx *cli.Context) error {
}
applyPraterFeatureFlags(ctx)
params.UsePraterNetworkConfig()
} else if ctx.Bool(PulseChain.Name) {
log.Warn("Running on PulseChain Mainnet")
if err := params.SetActive(params.PulseChainConfig().Copy()); err != nil {
return err
}
applyPulseChainFeatureFlags(ctx)
params.UsePulseChainNetworkConfig()
} else if ctx.Bool(PulseChainTestnet.Name) {
log.Warn("Running on PulseChain Testnet")
if err := params.SetActive(params.PulseChainTestnetConfig().Copy()); err != nil {
return err
}
applyPulseChainTestnetFeatureFlags(ctx)
params.UsePulseChainTestnetNetworkConfig()
} else if ctx.Bool(SepoliaTestnet.Name) {
log.Info("Running on the Sepolia Beacon Chain Testnet")
if err := params.SetActive(params.SepoliaConfig().Copy()); err != nil {
@ -161,6 +175,14 @@ func configureTestnet(ctx *cli.Context) error {
func applyPraterFeatureFlags(ctx *cli.Context) {
}
// Insert feature flags within the function to be enabled for PulseChain mainnet.
func applyPulseChainFeatureFlags(ctx *cli.Context) {
}
// Insert feature flags within the function to be enabled for PulseChain testnet.
func applyPulseChainTestnetFeatureFlags(ctx *cli.Context) {
}
// Insert feature flags within the function to be enabled for Sepolia testnet.
func applySepoliaFeatureFlags(ctx *cli.Context) {
}

View File

@ -14,6 +14,11 @@ var (
Usage: "Runs Prysm configured for the Prater / Goerli test network.",
Aliases: []string{"goerli"},
}
// PulseChainTestnet flag for the multiclient Ethereum consensus testnet.
PulseChainTestnet = &cli.BoolFlag{
Name: "pulsechain-testnet",
Usage: "Run Prysm configured for the PulseChain beacon chain test network",
}
// SepoliaTestnet flag for the multiclient Ethereum consensus testnet.
SepoliaTestnet = &cli.BoolFlag{
Name: "sepolia",
@ -30,6 +35,11 @@ var (
Name: "mainnet",
Usage: "Runs on Ethereum main network. This is the default and can be omitted.",
}
// PulseChain flag for the multiclient Ethereum consensus mainnet.
PulseChain = &cli.BoolFlag{
Name: "pulsechain",
Usage: "Run Prysm configured for the PulseChain beacon chain mainnnet",
}
devModeFlag = &cli.BoolFlag{
Name: "dev",
Usage: "Enables experimental features still in development. These features may not be stable.",
@ -184,8 +194,10 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
writeWalletPasswordOnWebOnboarding,
HoleskyTestnet,
PraterTestnet,
PulseChainTestnet,
SepoliaTestnet,
Mainnet,
PulseChain,
dynamicKeyReloadDebounceInterval,
attestTimely,
enableSlashingProtectionPruning,
@ -209,8 +221,10 @@ var BeaconChainFlags = append(deprecatedBeaconFlags, append(deprecatedFlags, []c
disableGRPCConnectionLogging,
HoleskyTestnet,
PraterTestnet,
PulseChainTestnet,
SepoliaTestnet,
Mainnet,
PulseChain,
disablePeerScorer,
disableBroadcastSlashingFlag,
enableSlasherFlag,
@ -239,7 +253,9 @@ var E2EBeaconChainFlags = []string{
// NetworkFlags contains a list of network flags.
var NetworkFlags = []cli.Flag{
Mainnet,
PulseChain,
PraterTestnet,
PulseChainTestnet,
SepoliaTestnet,
HoleskyTestnet,
}

View File

@ -12,11 +12,13 @@ go_library(
"io_config.go",
"loader.go",
"mainnet_config.go",
"mainnet_pulsechain_config.go",
"minimal_config.go",
"network_config.go",
"testnet_e2e_config.go",
"testnet_holesky_config.go",
"testnet_prater_config.go",
"testnet_pulsechain_config.go",
"testnet_sepolia_config.go",
"testutils.go",
"testutils_develop.go", # keep

View File

@ -0,0 +1,13 @@
package params
// UsePulseChainNetworkConfig uses the PulseChain beacon chain mainnet network config.
func UsePulseChainNetworkConfig() {
// TODO
UsePulseChainTestnetNetworkConfig()
}
// PulseChainConfig defines the config for the PulseChain beacon chain mainnet.
func PulseChainConfig() *BeaconChainConfig {
// TODO
return PulseChainTestnetConfig()
}

View File

@ -0,0 +1,34 @@
package params
// UsePulseChainTestnetNetworkConfig uses the PulseChain beacon chain testnet network config.
func UsePulseChainTestnetNetworkConfig() {
cfg := BeaconNetworkConfig().Copy()
cfg.ContractDeploymentBlock = 16492700
cfg.BootstrapNodes = []string{
// TODO: Add bootnode ENRs
}
OverrideBeaconNetworkConfig(cfg)
}
// PulseChainTestnetConfig defines the config for the PulseChain beacon chain testnet.
func PulseChainTestnetConfig() *BeaconChainConfig {
cfg := MainnetConfig().Copy()
cfg.ConfigName = PulseChainTestnetName
cfg.TerminalTotalDifficulty = "58750003716598352947541"
cfg.MinGenesisActiveValidatorCount = 5000
cfg.MinGenesisTime = 1674864000
cfg.GenesisForkVersion = []byte{0x00, 0x00, 0x09, 0x42}
cfg.GenesisDelay = 300
cfg.AltairForkVersion = []byte{0x00, 0x00, 0x09, 0x43}
cfg.AltairForkEpoch = 1
cfg.BellatrixForkVersion = []byte{0x00, 0x00, 0x09, 0x44}
cfg.BellatrixForkEpoch = 2
cfg.SecondsPerSlot = 10
cfg.MaxEffectiveBalance = 32 * 1e15
cfg.EjectionBalance = 16 * 1e15
cfg.DepositChainID = 942
cfg.DepositNetworkID = 942
cfg.DepositContractAddress = "0x3693693693693693693693693693693693693693"
cfg.InitializeForkSchedule()
return cfg
}

View File

@ -6,10 +6,12 @@ const (
EndToEndMainnetName = "end-to-end-mainnet"
InteropName = "interop"
MainnetName = "mainnet"
PulseChainName = "pulsechain-mainnet"
MainnetTestName = "mainnet-test"
MinimalName = "minimal"
PraterName = "prater"
GoerliName = "goerli"
SepoliaName = "sepolia"
HoleskyName = "holesky"
PulseChainTestnetName = "pulsechain-testnet-v3"
)

View File

@ -45,5 +45,5 @@ func BuildData() string {
gitCommit = strings.TrimRight(string(commit), "\r\n")
}
}
return fmt.Sprintf("Prysm/%s/%s", gitTag, gitCommit)
return fmt.Sprintf("Prysm-Pulse/%s/%s", gitTag, gitCommit)
}

View File

@ -171,6 +171,7 @@ func displayExitInfo(rawExitedKeys [][]byte, trimmedExitedKeys []string) {
}
func formatBeaconChaURL(key []byte) string {
// TODO: Add URLs for PulseChain explorer.
baseURL := "https://%sbeaconcha.in/validator/%s"
keyWithout0x := hexutil.Encode(key)[2:]