diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index 3fd656a19e..a0601908f1 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -97,6 +97,9 @@ func New(cliCtx *cli.Context) (*BeaconNode, error) { configureNetwork(cliCtx) configureInteropConfig(cliCtx) + // Initializes any forks here. + params.BeaconConfig().InitializeForkSchedule() + registry := shared.NewServiceRegistry() ctx, cancel := context.WithCancel(cliCtx.Context) diff --git a/shared/params/config.go b/shared/params/config.go index b41f2042cb..5848003e1e 100644 --- a/shared/params/config.go +++ b/shared/params/config.go @@ -5,6 +5,7 @@ import ( "time" types "github.com/prysmaticlabs/eth2-types" + "github.com/prysmaticlabs/prysm/shared/bytesutil" ) // BeaconChainConfig contains constant configs for node to participate in beacon chain. @@ -166,3 +167,11 @@ type BeaconChainConfig struct { MinSlashingPenaltyQuotientAltair uint64 `yaml:"MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR" spec:"true"` // MinSlashingPenaltyQuotientAltair for slashing penalties. ProportionalSlashingMultiplierAltair uint64 `yaml:"PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR" spec:"true"` // ProportionalSlashingMultiplierAltair for slashing penalties multiplier. } + +// InitializeForkSchedule initializes the schedules forks baked into the config. +func (b *BeaconChainConfig) InitializeForkSchedule() { + // Set Genesis fork data. + b.ForkVersionSchedule[bytesutil.ToBytes4(b.GenesisForkVersion)] = b.GenesisEpoch + // Set Altair fork data. + b.ForkVersionSchedule[bytesutil.ToBytes4(b.AltairForkVersion)] = b.AltairForkEpoch +} diff --git a/validator/node/node.go b/validator/node/node.go index 37068cae9c..275c31f74f 100644 --- a/validator/node/node.go +++ b/validator/node/node.go @@ -117,6 +117,9 @@ func NewValidatorClient(cliCtx *cli.Context) (*ValidatorClient, error) { params.LoadChainConfigFile(chainConfigFileName) } + // Initializes any forks here. + params.BeaconConfig().InitializeForkSchedule() + if err := validatorClient.initializeFromCLI(cliCtx); err != nil { return nil, err }