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
|
2022-11-04 11:08:57 +00:00
|
|
|
genesisTime uint64
|
|
|
|
genesisValidatorsRoot [32]byte
|
|
|
|
slot eth2types.Slot
|
|
|
|
fork *ethpb.Fork
|
|
|
|
latestBlockHeader *ethpb.BeaconBlockHeader
|
|
|
|
blockRoots *customtypes.BlockRoots
|
|
|
|
stateRoots *customtypes.StateRoots
|
|
|
|
historicalRoots customtypes.HistoricalRoots
|
|
|
|
eth1Data *ethpb.Eth1Data
|
|
|
|
eth1DataVotes []*ethpb.Eth1Data
|
|
|
|
eth1DepositIndex uint64
|
|
|
|
validators []*ethpb.Validator
|
|
|
|
balances []uint64
|
|
|
|
randaoMixes *customtypes.RandaoMixes
|
|
|
|
slashings []uint64
|
|
|
|
previousEpochAttestations []*ethpb.PendingAttestation
|
|
|
|
currentEpochAttestations []*ethpb.PendingAttestation
|
|
|
|
previousEpochParticipation []byte
|
|
|
|
currentEpochParticipation []byte
|
|
|
|
justificationBits bitfield.Bitvector4
|
|
|
|
previousJustifiedCheckpoint *ethpb.Checkpoint
|
|
|
|
currentJustifiedCheckpoint *ethpb.Checkpoint
|
|
|
|
finalizedCheckpoint *ethpb.Checkpoint
|
|
|
|
inactivityScores []uint64
|
|
|
|
currentSyncCommittee *ethpb.SyncCommittee
|
|
|
|
nextSyncCommittee *ethpb.SyncCommittee
|
|
|
|
latestExecutionPayloadHeader *enginev1.ExecutionPayloadHeader
|
|
|
|
latestExecutionPayloadHeaderCapella *enginev1.ExecutionPayloadHeaderCapella
|
|
|
|
nextWithdrawalIndex uint64
|
2022-11-12 18:38:21 +00:00
|
|
|
nextWithdrawalValidatorIndex eth2types.ValidatorIndex
|
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
|
|
|
}
|