Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
Nishant Das
2021-07-08 00:03:16 +08:00
committed by GitHub
parent 2bb3da1ba3
commit 773b259cd5
3 changed files with 15 additions and 0 deletions

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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
}