Simplify next Fork boilerplate creation. (#14761)

* Simplify next Fork boilerplate creation.

* Update beacon-chain/blockchain/execution_engine.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/blockchain/execution_engine.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/blockchain/execution_engine.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/state/state-native/spec_parameters.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/state/state-native/spec_parameters.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/state/state-native/spec_parameters.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/state/state-native/spec_parameters.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Fix Radek's comments.

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
Manu NALEPA
2025-01-03 15:39:08 +01:00
committed by GitHub
parent 8cff9356f1
commit 8a439a6f5d
49 changed files with 2542 additions and 2358 deletions

View File

@@ -25,90 +25,88 @@ import (
"google.golang.org/protobuf/proto"
)
var phase0Fields = []types.FieldIndex{
types.GenesisTime,
types.GenesisValidatorsRoot,
types.Slot,
types.Fork,
types.LatestBlockHeader,
types.BlockRoots,
types.StateRoots,
types.HistoricalRoots,
types.Eth1Data,
types.Eth1DataVotes,
types.Eth1DepositIndex,
types.Validators,
types.Balances,
types.RandaoMixes,
types.Slashings,
types.PreviousEpochAttestations,
types.CurrentEpochAttestations,
types.JustificationBits,
types.PreviousJustifiedCheckpoint,
types.CurrentJustifiedCheckpoint,
types.FinalizedCheckpoint,
}
var (
phase0Fields = []types.FieldIndex{
types.GenesisTime,
types.GenesisValidatorsRoot,
types.Slot,
types.Fork,
types.LatestBlockHeader,
types.BlockRoots,
types.StateRoots,
types.HistoricalRoots,
types.Eth1Data,
types.Eth1DataVotes,
types.Eth1DepositIndex,
types.Validators,
types.Balances,
types.RandaoMixes,
types.Slashings,
types.PreviousEpochAttestations,
types.CurrentEpochAttestations,
types.JustificationBits,
types.PreviousJustifiedCheckpoint,
types.CurrentJustifiedCheckpoint,
types.FinalizedCheckpoint,
}
var altairFields = []types.FieldIndex{
types.GenesisTime,
types.GenesisValidatorsRoot,
types.Slot,
types.Fork,
types.LatestBlockHeader,
types.BlockRoots,
types.StateRoots,
types.HistoricalRoots,
types.Eth1Data,
types.Eth1DataVotes,
types.Eth1DepositIndex,
types.Validators,
types.Balances,
types.RandaoMixes,
types.Slashings,
types.PreviousEpochParticipationBits,
types.CurrentEpochParticipationBits,
types.JustificationBits,
types.PreviousJustifiedCheckpoint,
types.CurrentJustifiedCheckpoint,
types.FinalizedCheckpoint,
types.InactivityScores,
types.CurrentSyncCommittee,
types.NextSyncCommittee,
}
altairFields = []types.FieldIndex{
types.GenesisTime,
types.GenesisValidatorsRoot,
types.Slot,
types.Fork,
types.LatestBlockHeader,
types.BlockRoots,
types.StateRoots,
types.HistoricalRoots,
types.Eth1Data,
types.Eth1DataVotes,
types.Eth1DepositIndex,
types.Validators,
types.Balances,
types.RandaoMixes,
types.Slashings,
types.PreviousEpochParticipationBits,
types.CurrentEpochParticipationBits,
types.JustificationBits,
types.PreviousJustifiedCheckpoint,
types.CurrentJustifiedCheckpoint,
types.FinalizedCheckpoint,
types.InactivityScores,
types.CurrentSyncCommittee,
types.NextSyncCommittee,
}
var bellatrixFields = append(altairFields, types.LatestExecutionPayloadHeader)
bellatrixFields = append(altairFields, types.LatestExecutionPayloadHeader)
var capellaFields = append(
altairFields,
types.LatestExecutionPayloadHeaderCapella,
types.NextWithdrawalIndex,
types.NextWithdrawalValidatorIndex,
types.HistoricalSummaries,
)
capellaFields = append(
altairFields,
types.LatestExecutionPayloadHeaderCapella,
types.NextWithdrawalIndex,
types.NextWithdrawalValidatorIndex,
types.HistoricalSummaries,
)
var denebFields = append(
altairFields,
types.LatestExecutionPayloadHeaderDeneb,
types.NextWithdrawalIndex,
types.NextWithdrawalValidatorIndex,
types.HistoricalSummaries,
)
denebFields = append(
altairFields,
types.LatestExecutionPayloadHeaderDeneb,
types.NextWithdrawalIndex,
types.NextWithdrawalValidatorIndex,
types.HistoricalSummaries,
)
var electraFields = append(
altairFields,
types.LatestExecutionPayloadHeaderDeneb,
types.NextWithdrawalIndex,
types.NextWithdrawalValidatorIndex,
types.HistoricalSummaries,
types.DepositRequestsStartIndex,
types.DepositBalanceToConsume,
types.ExitBalanceToConsume,
types.EarliestExitEpoch,
types.ConsolidationBalanceToConsume,
types.EarliestConsolidationEpoch,
types.PendingDeposits,
types.PendingPartialWithdrawals,
types.PendingConsolidations,
electraFields = append(
denebFields,
types.DepositRequestsStartIndex,
types.DepositBalanceToConsume,
types.ExitBalanceToConsume,
types.EarliestExitEpoch,
types.ConsolidationBalanceToConsume,
types.EarliestConsolidationEpoch,
types.PendingDeposits,
types.PendingPartialWithdrawals,
types.PendingConsolidations,
)
)
const (