2022-03-14 20:58:13 +00:00
|
|
|
//go:build !minimal
|
2022-02-01 00:32:39 +00:00
|
|
|
|
2022-05-09 13:02:34 +00:00
|
|
|
package state_native
|
2022-02-01 00:32:39 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
|
|
|
|
"github.com/prysmaticlabs/go-bitfield"
|
2022-08-16 12:20:13 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state/fieldtrie"
|
|
|
|
customtypes "github.com/prysmaticlabs/prysm/v3/beacon-chain/state/state-native/custom-types"
|
|
|
|
nativetypes "github.com/prysmaticlabs/prysm/v3/beacon-chain/state/state-native/types"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state/stateutil"
|
|
|
|
eth2types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
|
|
|
|
enginev1 "github.com/prysmaticlabs/prysm/v3/proto/engine/v1"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
|
2022-02-01 00:32:39 +00:00
|
|
|
)
|
|
|
|
|
2022-05-09 13:02:34 +00:00
|
|
|
// BeaconState defines a struct containing utilities for the Ethereum Beacon Chain state, defining
|
2022-02-01 00:32:39 +00:00
|
|
|
// getters and setters for its respective values and helpful functions such as HashTreeRoot().
|
|
|
|
type BeaconState struct {
|
2022-10-12 16:39:19 +00:00
|
|
|
version int
|
|
|
|
genesisTime uint64 `ssz-gen:"true"`
|
2022-10-19 14:37:45 +00:00
|
|
|
genesisValidatorsRoot [32]byte `ssz-gen:"true" ssz-size:"32"`
|
2022-10-12 16:39:19 +00:00
|
|
|
slot eth2types.Slot `ssz-gen:"true"`
|
|
|
|
fork *ethpb.Fork `ssz-gen:"true"`
|
|
|
|
latestBlockHeader *ethpb.BeaconBlockHeader `ssz-gen:"true"`
|
|
|
|
blockRoots *customtypes.BlockRoots `ssz-gen:"true" ssz-size:"8192,32"`
|
|
|
|
stateRoots *customtypes.StateRoots `ssz-gen:"true" ssz-size:"8192,32"`
|
|
|
|
historicalRoots customtypes.HistoricalRoots `ssz-gen:"true" ssz-size:"?,32" ssz-max:"16777216"`
|
|
|
|
eth1Data *ethpb.Eth1Data `ssz-gen:"true"`
|
|
|
|
eth1DataVotes []*ethpb.Eth1Data `ssz-gen:"true" ssz-max:"2048"`
|
|
|
|
eth1DepositIndex uint64 `ssz-gen:"true"`
|
|
|
|
validators []*ethpb.Validator `ssz-gen:"true" ssz-max:"1099511627776"`
|
|
|
|
balances []uint64 `ssz-gen:"true" ssz-max:"1099511627776"`
|
|
|
|
randaoMixes *customtypes.RandaoMixes `ssz-gen:"true" ssz-size:"65536,32"`
|
|
|
|
slashings []uint64 `ssz-gen:"true" ssz-size:"8192"`
|
|
|
|
previousEpochAttestations []*ethpb.PendingAttestation `ssz-gen:"true" ssz-max:"4096"`
|
|
|
|
currentEpochAttestations []*ethpb.PendingAttestation `ssz-gen:"true" ssz-max:"4096"`
|
|
|
|
previousEpochParticipation []byte `ssz-gen:"true" ssz-max:"1099511627776"`
|
|
|
|
currentEpochParticipation []byte `ssz-gen:"true" ssz-max:"1099511627776"`
|
|
|
|
justificationBits bitfield.Bitvector4 `ssz-gen:"true" ssz-size:"1"`
|
|
|
|
previousJustifiedCheckpoint *ethpb.Checkpoint `ssz-gen:"true"`
|
|
|
|
currentJustifiedCheckpoint *ethpb.Checkpoint `ssz-gen:"true"`
|
|
|
|
finalizedCheckpoint *ethpb.Checkpoint `ssz-gen:"true"`
|
|
|
|
inactivityScores []uint64 `ssz-gen:"true" ssz-max:"1099511627776"`
|
|
|
|
currentSyncCommittee *ethpb.SyncCommittee `ssz-gen:"true"`
|
|
|
|
nextSyncCommittee *ethpb.SyncCommittee `ssz-gen:"true"`
|
|
|
|
latestExecutionPayloadHeader *enginev1.ExecutionPayloadHeader `ssz-gen:"true"`
|
|
|
|
latestExecutionPayloadHeaderCapella *enginev1.ExecutionPayloadHeaderCapella `ssz-gen:"true"`
|
|
|
|
withdrawalQueue []*enginev1.Withdrawal `ssz-gen:"true" ssz-max:"1099511627776"`
|
|
|
|
nextWithdrawalIndex uint64 `ssz-gen:"true"`
|
|
|
|
nextPartialWithdrawalValidatorIndex eth2types.ValidatorIndex `ssz-gen:"true"`
|
2022-02-01 00:32:39 +00:00
|
|
|
|
|
|
|
lock sync.RWMutex
|
2022-05-09 13:02:34 +00:00
|
|
|
dirtyFields map[nativetypes.FieldIndex]bool
|
|
|
|
dirtyIndices map[nativetypes.FieldIndex][]uint64
|
|
|
|
stateFieldLeaves map[nativetypes.FieldIndex]*fieldtrie.FieldTrie
|
|
|
|
rebuildTrie map[nativetypes.FieldIndex]bool
|
2022-02-01 00:32:39 +00:00
|
|
|
valMapHandler *stateutil.ValidatorMapHandler
|
|
|
|
merkleLayers [][][]byte
|
2022-05-09 13:02:34 +00:00
|
|
|
sharedFieldReferences map[nativetypes.FieldIndex]*stateutil.Reference
|
2022-02-01 00:32:39 +00:00
|
|
|
}
|