diff --git a/beacon-chain/state/BUILD.bazel b/beacon-chain/state/BUILD.bazel index 295cfa2110d5..24bad8e86794 100644 --- a/beacon-chain/state/BUILD.bazel +++ b/beacon-chain/state/BUILD.bazel @@ -5,6 +5,7 @@ go_library( srcs = [ "error.go", "interfaces.go", + "interfaces_epbs.go", "prometheus.go", ], importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/state", diff --git a/beacon-chain/state/interfaces.go b/beacon-chain/state/interfaces.go index 39f2a476d24b..24dbba79107c 100644 --- a/beacon-chain/state/interfaces.go +++ b/beacon-chain/state/interfaces.go @@ -60,6 +60,7 @@ type ReadOnlyBeaconState interface { ReadOnlySyncCommittee ReadOnlyDeposits ReadOnlyConsolidations + ReadOnlyEpbsFields ToProtoUnsafe() interface{} ToProto() interface{} GenesisTime() uint64 @@ -94,6 +95,7 @@ type WriteOnlyBeaconState interface { WriteOnlyConsolidations WriteOnlyWithdrawals WriteOnlyDeposits + WriteOnlyEpbsFields SetGenesisTime(val uint64) error SetGenesisValidatorsRoot(val []byte) error SetSlot(val primitives.Slot) error diff --git a/beacon-chain/state/interfaces_epbs.go b/beacon-chain/state/interfaces_epbs.go new file mode 100644 index 000000000000..5f5edfcb98a1 --- /dev/null +++ b/beacon-chain/state/interfaces_epbs.go @@ -0,0 +1,28 @@ +package state + +import ( + "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +type ReadOnlyEpbsFields interface { + PreviousInclusionListSlot() primitives.Slot + PreviousInclusionListProposer() primitives.ValidatorIndex + LatestInclusionListSlot() primitives.Slot + LatestInclusionListProposer() primitives.ValidatorIndex + IsParentBlockFull() bool + ExecutionPayloadHeader() *enginev1.ExecutionPayloadHeaderEPBS + LatestBlockHash() []byte + LatestFullSlot() primitives.Slot + LastWithdrawalsRoot() []byte +} + +type WriteOnlyEpbsFields interface { + SetExecutionPayloadHeader(val *enginev1.ExecutionPayloadHeaderEPBS) + UpdatePreviousInclusionListData() + SetLatestInclusionListSlot(val primitives.Slot) + SetLatestInclusionListProposer(val primitives.ValidatorIndex) + SetLatestBlockHash(val []byte) + SetLatestFullSlot(val primitives.Slot) + SetLastWithdrawalsRoot(val []byte) +} diff --git a/beacon-chain/state/state-native/BUILD.bazel b/beacon-chain/state/state-native/BUILD.bazel index da2f397025f1..1267358424ba 100644 --- a/beacon-chain/state/state-native/BUILD.bazel +++ b/beacon-chain/state/state-native/BUILD.bazel @@ -13,11 +13,13 @@ go_library( "getters_checkpoint.go", "getters_consolidation.go", "getters_deposit_requests.go", + "getters_epbs.go", "getters_eth1.go", "getters_exit.go", "getters_misc.go", "getters_participation.go", "getters_payload_header.go", + "getters_payload_header_epbs.go", "getters_randao.go", "getters_state.go", "getters_sync_committee.go", @@ -34,6 +36,7 @@ go_library( "setters_churn.go", "setters_consolidation.go", "setters_deposit_requests.go", + "setters_epbs.go", "setters_eth1.go", "setters_misc.go", "setters_participation.go", @@ -46,6 +49,7 @@ go_library( "spec_parameters.go", "ssz.go", "state_trie.go", + "state_trie_epbs.go", "types.go", "validator_index_cache.go", ], @@ -98,6 +102,7 @@ go_test( "getters_deposit_requests_test.go", "getters_exit_test.go", "getters_participation_test.go", + "getters_setters_epbs_test.go", "getters_test.go", "getters_validator_test.go", "getters_withdrawal_test.go", @@ -119,6 +124,7 @@ go_test( "setters_withdrawal_test.go", "state_fuzz_test.go", "state_test.go", + "state_trie_epbs_test.go", "state_trie_test.go", "types_test.go", "validator_index_cache_test.go", @@ -152,6 +158,7 @@ go_test( "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", + "//testing/util/random:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_golang_snappy//:go_default_library", diff --git a/beacon-chain/state/state-native/beacon_state_mainnet.go b/beacon-chain/state/state-native/beacon_state_mainnet.go index 922f870989d0..15ecd1a623ef 100644 --- a/beacon-chain/state/state-native/beacon_state_mainnet.go +++ b/beacon-chain/state/state-native/beacon_state_mainnet.go @@ -60,6 +60,15 @@ type BeaconState struct { latestExecutionPayloadHeaderElectra *enginev1.ExecutionPayloadHeaderElectra nextWithdrawalIndex uint64 nextWithdrawalValidatorIndex primitives.ValidatorIndex + // ePBS fields + previousInclusionListProposer primitives.ValidatorIndex + previousInclusionListSlot primitives.Slot + latestInclusionListProposer primitives.ValidatorIndex + latestInclusionListSlot primitives.Slot + latestBlockHash [32]byte + latestFullSlot primitives.Slot + executionPayloadHeader *enginev1.ExecutionPayloadHeaderEPBS + lastWithdrawalsRoot [32]byte // Electra fields depositRequestsStartIndex uint64 diff --git a/beacon-chain/state/state-native/beacon_state_minimal.go b/beacon-chain/state/state-native/beacon_state_minimal.go index ad5a51d9349f..88005277c0b2 100644 --- a/beacon-chain/state/state-native/beacon_state_minimal.go +++ b/beacon-chain/state/state-native/beacon_state_minimal.go @@ -60,6 +60,15 @@ type BeaconState struct { latestExecutionPayloadHeaderElectra *enginev1.ExecutionPayloadHeaderElectra nextWithdrawalIndex uint64 nextWithdrawalValidatorIndex primitives.ValidatorIndex + // ePBS fields + previousInclusionListProposer primitives.ValidatorIndex + previousInclusionListSlot primitives.Slot + latestInclusionListProposer primitives.ValidatorIndex + latestInclusionListSlot primitives.Slot + latestBlockHash [32]byte + latestFullSlot primitives.Slot + executionPayloadHeader *enginev1.ExecutionPayloadHeaderEPBS + lastWithdrawalsRoot [32]byte // Electra fields depositRequestsStartIndex uint64 diff --git a/beacon-chain/state/state-native/getters_epbs.go b/beacon-chain/state/state-native/getters_epbs.go new file mode 100644 index 000000000000..b5677c8a17a9 --- /dev/null +++ b/beacon-chain/state/state-native/getters_epbs.go @@ -0,0 +1,83 @@ +package state_native + +import ( + "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" + enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +// ExecutionPayloadHeader retrieves a copy of the execution payload header. +// It returns an error if the operation is not supported for the beacon state's version. +func (b *BeaconState) ExecutionPayloadHeader() *enginev1.ExecutionPayloadHeaderEPBS { + b.lock.RLock() + defer b.lock.RUnlock() + + return b.executionPayloadHeaderVal() +} + +// IsParentBlockFull checks if the last committed payload header was fulfilled. +// Returns true if both the beacon block and payload were present. +// Call this function on a beacon state before processing the execution payload header. +func (b *BeaconState) IsParentBlockFull() bool { + b.lock.RLock() + defer b.lock.RUnlock() + + headerBlockHash := bytesutil.ToBytes32(b.executionPayloadHeader.BlockHash) + return headerBlockHash == b.latestBlockHash +} + +// LatestInclusionListProposer returns the proposer index from the latest inclusion list. +func (b *BeaconState) LatestInclusionListProposer() primitives.ValidatorIndex { + b.lock.RLock() + defer b.lock.RUnlock() + + return b.latestInclusionListProposer +} + +// LatestInclusionListSlot returns the slot from the latest inclusion list. +func (b *BeaconState) LatestInclusionListSlot() primitives.Slot { + b.lock.RLock() + defer b.lock.RUnlock() + + return b.latestInclusionListSlot +} + +// PreviousInclusionListProposer returns the proposer index from the previous inclusion list. +func (b *BeaconState) PreviousInclusionListProposer() primitives.ValidatorIndex { + b.lock.RLock() + defer b.lock.RUnlock() + + return b.previousInclusionListProposer +} + +// PreviousInclusionListSlot returns the slot from the previous inclusion list. +func (b *BeaconState) PreviousInclusionListSlot() primitives.Slot { + b.lock.RLock() + defer b.lock.RUnlock() + + return b.previousInclusionListSlot +} + +// LatestBlockHash returns the latest block hash. +func (b *BeaconState) LatestBlockHash() []byte { + b.lock.RLock() + defer b.lock.RUnlock() + + return b.latestBlockHash[:] +} + +// LatestFullSlot returns the slot of the latest full block. +func (b *BeaconState) LatestFullSlot() primitives.Slot { + b.lock.RLock() + defer b.lock.RUnlock() + + return b.latestFullSlot +} + +// LastWithdrawalsRoot returns the latest withdrawal root. +func (b *BeaconState) LastWithdrawalsRoot() []byte { + b.lock.RLock() + defer b.lock.RUnlock() + + return b.lastWithdrawalsRoot[:] +} diff --git a/beacon-chain/state/state-native/getters_payload_header_epbs.go b/beacon-chain/state/state-native/getters_payload_header_epbs.go new file mode 100644 index 000000000000..280336260ec3 --- /dev/null +++ b/beacon-chain/state/state-native/getters_payload_header_epbs.go @@ -0,0 +1,10 @@ +package state_native + +import ( + enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" + eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" +) + +func (b *BeaconState) executionPayloadHeaderVal() *enginev1.ExecutionPayloadHeaderEPBS { + return eth.CopyExecutionPayloadHeaderEPBS(b.executionPayloadHeader) +} diff --git a/beacon-chain/state/state-native/getters_setters_epbs_test.go b/beacon-chain/state/state-native/getters_setters_epbs_test.go new file mode 100644 index 000000000000..17980dc54eed --- /dev/null +++ b/beacon-chain/state/state-native/getters_setters_epbs_test.go @@ -0,0 +1,104 @@ +package state_native + +import ( + "crypto/rand" + "testing" + + "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native/types" + fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" + "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + "github.com/prysmaticlabs/prysm/v5/runtime/version" + "github.com/prysmaticlabs/prysm/v5/testing/require" + "github.com/prysmaticlabs/prysm/v5/testing/util/random" +) + +func Test_LatestExecutionPayloadHeader(t *testing.T) { + s := &BeaconState{version: version.EPBS} + _, err := s.LatestExecutionPayloadHeader() + require.ErrorContains(t, "unsupported version (epbs) for latest execution payload header", err) +} + +func Test_SetLatestExecutionPayloadHeader(t *testing.T) { + s := &BeaconState{version: version.EPBS} + require.ErrorContains(t, "SetLatestExecutionPayloadHeader is not supported for epbs", s.SetLatestExecutionPayloadHeader(nil)) +} + +func Test_SetExecutionPayloadHeader(t *testing.T) { + s := &BeaconState{version: version.EPBS, dirtyFields: make(map[types.FieldIndex]bool)} + header := random.ExecutionPayloadHeader(t) + s.SetExecutionPayloadHeader(header) + require.Equal(t, true, s.dirtyFields[types.ExecutionPayloadHeader]) + + got := s.ExecutionPayloadHeader() + require.DeepEqual(t, got, header) +} + +func Test_UpdatePreviousInclusionListData(t *testing.T) { + s := &BeaconState{version: version.EPBS, dirtyFields: make(map[types.FieldIndex]bool)} + p := s.PreviousInclusionListProposer() + require.Equal(t, primitives.ValidatorIndex(0), p) + ss := s.PreviousInclusionListSlot() + require.Equal(t, primitives.Slot(0), ss) + + s.SetLatestInclusionListProposer(1) + s.SetLatestInclusionListSlot(2) + s.UpdatePreviousInclusionListData() + require.Equal(t, true, s.dirtyFields[types.PreviousInclusionListProposer]) + require.Equal(t, true, s.dirtyFields[types.PreviousInclusionListSlot]) + + p = s.PreviousInclusionListProposer() + require.Equal(t, primitives.ValidatorIndex(1), p) + ss = s.PreviousInclusionListSlot() + require.Equal(t, primitives.Slot(2), ss) +} + +func Test_SetLatestInclusionListProposer(t *testing.T) { + s := &BeaconState{version: version.EPBS, dirtyFields: make(map[types.FieldIndex]bool)} + s.SetLatestInclusionListProposer(1) + require.Equal(t, true, s.dirtyFields[types.LatestInclusionListProposer]) + + got := s.LatestInclusionListProposer() + require.Equal(t, primitives.ValidatorIndex(1), got) +} + +func Test_SetLatestInclusionListSlot(t *testing.T) { + s := &BeaconState{version: version.EPBS, dirtyFields: make(map[types.FieldIndex]bool)} + s.SetLatestInclusionListSlot(2) + require.Equal(t, true, s.dirtyFields[types.LatestInclusionListSlot]) + + got := s.LatestInclusionListSlot() + require.Equal(t, primitives.Slot(2), got) +} + +func Test_SetLatestBlockHash(t *testing.T) { + s := &BeaconState{version: version.EPBS, dirtyFields: make(map[types.FieldIndex]bool)} + b := make([]byte, fieldparams.RootLength) + _, err := rand.Read(b) + require.NoError(t, err) + s.SetLatestBlockHash(b) + require.Equal(t, true, s.dirtyFields[types.LatestBlockHash]) + + got := s.LatestBlockHash() + require.DeepEqual(t, got, b) +} + +func Test_SetLatestFullSlot(t *testing.T) { + s := &BeaconState{version: version.EPBS, dirtyFields: make(map[types.FieldIndex]bool)} + s.SetLatestFullSlot(3) + require.Equal(t, true, s.dirtyFields[types.LatestFullSlot]) + + got := s.LatestFullSlot() + require.Equal(t, primitives.Slot(3), got) +} + +func Test_SetLastWithdrawalsRoot(t *testing.T) { + s := &BeaconState{version: version.EPBS, dirtyFields: make(map[types.FieldIndex]bool)} + b := make([]byte, fieldparams.RootLength) + _, err := rand.Read(b) + require.NoError(t, err) + s.SetLastWithdrawalsRoot(b) + require.Equal(t, true, s.dirtyFields[types.LastWithdrawalsRoot]) + + got := s.LastWithdrawalsRoot() + require.DeepEqual(t, got, b) +} diff --git a/beacon-chain/state/state-native/getters_state.go b/beacon-chain/state/state-native/getters_state.go index 65cae0787134..b4ee04dae4aa 100644 --- a/beacon-chain/state/state-native/getters_state.go +++ b/beacon-chain/state/state-native/getters_state.go @@ -212,6 +212,53 @@ func (b *BeaconState) ToProtoUnsafe() interface{} { PendingPartialWithdrawals: b.pendingPartialWithdrawals, PendingConsolidations: b.pendingConsolidations, } + case version.EPBS: + return ðpb.BeaconStateEPBS{ + GenesisTime: b.genesisTime, + GenesisValidatorsRoot: gvrCopy[:], + Slot: b.slot, + Fork: b.fork, + LatestBlockHeader: b.latestBlockHeader, + BlockRoots: br, + StateRoots: sr, + HistoricalRoots: b.historicalRoots.Slice(), + Eth1Data: b.eth1Data, + Eth1DataVotes: b.eth1DataVotes, + Eth1DepositIndex: b.eth1DepositIndex, + Validators: vals, + Balances: bals, + RandaoMixes: rm, + Slashings: b.slashings, + PreviousEpochParticipation: b.previousEpochParticipation, + CurrentEpochParticipation: b.currentEpochParticipation, + JustificationBits: b.justificationBits, + PreviousJustifiedCheckpoint: b.previousJustifiedCheckpoint, + CurrentJustifiedCheckpoint: b.currentJustifiedCheckpoint, + FinalizedCheckpoint: b.finalizedCheckpoint, + InactivityScores: b.inactivityScoresVal(), + CurrentSyncCommittee: b.currentSyncCommittee, + NextSyncCommittee: b.nextSyncCommittee, + NextWithdrawalIndex: b.nextWithdrawalIndex, + NextWithdrawalValidatorIndex: b.nextWithdrawalValidatorIndex, + HistoricalSummaries: b.historicalSummaries, + DepositRequestsStartIndex: b.depositRequestsStartIndex, + DepositBalanceToConsume: b.depositBalanceToConsume, + ExitBalanceToConsume: b.exitBalanceToConsume, + EarliestExitEpoch: b.earliestExitEpoch, + ConsolidationBalanceToConsume: b.consolidationBalanceToConsume, + EarliestConsolidationEpoch: b.earliestConsolidationEpoch, + PendingBalanceDeposits: b.pendingBalanceDeposits, + PendingPartialWithdrawals: b.pendingPartialWithdrawals, + PendingConsolidations: b.pendingConsolidations, + PreviousInclusionListProposer: b.previousInclusionListProposer, + PreviousInclusionListSlot: b.previousInclusionListSlot, + LatestInclusionListProposer: b.latestInclusionListProposer, + LatestInclusionListSlot: b.latestInclusionListSlot, + LatestBlockHash: b.latestBlockHash[:], + LatestFullSlot: b.latestFullSlot, + ExecutionPayloadHeader: b.executionPayloadHeader, + LastWithdrawalsRoot: b.lastWithdrawalsRoot[:], + } default: return nil } @@ -236,6 +283,9 @@ func (b *BeaconState) ToProto() interface{} { inactivityScores = b.inactivityScoresVal() } + LatestBlockHashCopy := b.latestBlockHash + lastWithdrawalsRootCopy := b.lastWithdrawalsRoot + switch b.version { case version.Phase0: return ðpb.BeaconState{ @@ -418,6 +468,53 @@ func (b *BeaconState) ToProto() interface{} { PendingPartialWithdrawals: b.pendingPartialWithdrawalsVal(), PendingConsolidations: b.pendingConsolidationsVal(), } + case version.EPBS: + return ðpb.BeaconStateEPBS{ + GenesisTime: b.genesisTime, + GenesisValidatorsRoot: gvrCopy[:], + Slot: b.slot, + Fork: b.forkVal(), + LatestBlockHeader: b.latestBlockHeaderVal(), + BlockRoots: br, + StateRoots: sr, + HistoricalRoots: b.historicalRoots.Slice(), + Eth1Data: b.eth1DataVal(), + Eth1DataVotes: b.eth1DataVotesVal(), + Eth1DepositIndex: b.eth1DepositIndex, + Validators: b.validatorsVal(), + Balances: b.balancesVal(), + RandaoMixes: rm, + Slashings: b.slashingsVal(), + PreviousEpochParticipation: b.previousEpochParticipationVal(), + CurrentEpochParticipation: b.currentEpochParticipationVal(), + JustificationBits: b.justificationBitsVal(), + PreviousJustifiedCheckpoint: b.previousJustifiedCheckpointVal(), + CurrentJustifiedCheckpoint: b.currentJustifiedCheckpointVal(), + FinalizedCheckpoint: b.finalizedCheckpointVal(), + InactivityScores: b.inactivityScoresVal(), + CurrentSyncCommittee: b.currentSyncCommitteeVal(), + NextSyncCommittee: b.nextSyncCommitteeVal(), + NextWithdrawalIndex: b.nextWithdrawalIndex, + NextWithdrawalValidatorIndex: b.nextWithdrawalValidatorIndex, + HistoricalSummaries: b.historicalSummariesVal(), + DepositRequestsStartIndex: b.depositRequestsStartIndex, + DepositBalanceToConsume: b.depositBalanceToConsume, + ExitBalanceToConsume: b.exitBalanceToConsume, + EarliestExitEpoch: b.earliestExitEpoch, + ConsolidationBalanceToConsume: b.consolidationBalanceToConsume, + EarliestConsolidationEpoch: b.earliestConsolidationEpoch, + PendingBalanceDeposits: b.pendingBalanceDepositsVal(), + PendingPartialWithdrawals: b.pendingPartialWithdrawalsVal(), + PendingConsolidations: b.pendingConsolidationsVal(), + PreviousInclusionListProposer: b.previousInclusionListProposer, + PreviousInclusionListSlot: b.previousInclusionListSlot, + LatestInclusionListProposer: b.latestInclusionListProposer, + LatestInclusionListSlot: b.latestInclusionListSlot, + LatestBlockHash: LatestBlockHashCopy[:], + LatestFullSlot: b.latestFullSlot, + ExecutionPayloadHeader: b.executionPayloadHeaderVal(), + LastWithdrawalsRoot: lastWithdrawalsRootCopy[:], + } default: return nil } diff --git a/beacon-chain/state/state-native/hasher.go b/beacon-chain/state/state-native/hasher.go index c4e3254c49df..87c44e67bbde 100644 --- a/beacon-chain/state/state-native/hasher.go +++ b/beacon-chain/state/state-native/hasher.go @@ -41,6 +41,8 @@ func ComputeFieldRootsWithHasher(ctx context.Context, state *BeaconState) ([][]b fieldRoots = make([][]byte, params.BeaconConfig().BeaconStateDenebFieldCount) case version.Electra: fieldRoots = make([][]byte, params.BeaconConfig().BeaconStateElectraFieldCount) + case version.EPBS: + fieldRoots = make([][]byte, params.BeaconConfig().BeaconStateEpbsFieldCount) default: return nil, fmt.Errorf("unknown state version %s", version.String(state.version)) } @@ -260,6 +262,14 @@ func ComputeFieldRootsWithHasher(ctx context.Context, state *BeaconState) ([][]b } fieldRoots[types.LatestExecutionPayloadHeaderElectra.RealPosition()] = executionPayloadRoot[:] } + if state.version == version.EPBS { + // Execution payload header root. + executionPayloadRoot, err := state.executionPayloadHeader.HashTreeRoot() + if err != nil { + return nil, err + } + fieldRoots[types.ExecutionPayloadHeader.RealPosition()] = executionPayloadRoot[:] + } if state.version >= version.Capella { // Next withdrawal index root. @@ -327,5 +337,35 @@ func ComputeFieldRootsWithHasher(ctx context.Context, state *BeaconState) ([][]b fieldRoots[types.PendingConsolidations.RealPosition()] = pcRoot[:] } + if state.version >= version.EPBS { + // Previous inclusion list proposer root. + prevInclusionListProposerRoot := ssz.Uint64Root(uint64(state.previousInclusionListProposer)) + fieldRoots[types.PreviousInclusionListProposer.RealPosition()] = prevInclusionListProposerRoot[:] + + // Previous inclusion list slot root. + prevInclusionListSlotRoot := ssz.Uint64Root(uint64(state.previousInclusionListSlot)) + fieldRoots[types.PreviousInclusionListSlot.RealPosition()] = prevInclusionListSlotRoot[:] + + // Latest inclusion list proposer root. + latestInclusionListProposerRoot := ssz.Uint64Root(uint64(state.latestInclusionListProposer)) + fieldRoots[types.LatestInclusionListProposer.RealPosition()] = latestInclusionListProposerRoot[:] + + // Latest inclusion list slot root. + latestInclusionListSlotRoot := ssz.Uint64Root(uint64(state.latestInclusionListSlot)) + fieldRoots[types.LatestInclusionListSlot.RealPosition()] = latestInclusionListSlotRoot[:] + + // Latest block hash root. + latestBlockHashRoot := state.latestBlockHash[:] + fieldRoots[types.LatestBlockHash.RealPosition()] = latestBlockHashRoot + + // Latest full slot root. + latestFullSlotRoot := ssz.Uint64Root(uint64(state.latestFullSlot)) + fieldRoots[types.LatestFullSlot.RealPosition()] = latestFullSlotRoot[:] + + // Last withdrawals root. + lastWithdrawalsRoot := state.lastWithdrawalsRoot[:] + fieldRoots[types.LastWithdrawalsRoot.RealPosition()] = lastWithdrawalsRoot + } + return fieldRoots, nil } diff --git a/beacon-chain/state/state-native/setters_epbs.go b/beacon-chain/state/state-native/setters_epbs.go new file mode 100644 index 000000000000..0a522dedef38 --- /dev/null +++ b/beacon-chain/state/state-native/setters_epbs.go @@ -0,0 +1,73 @@ +package state_native + +import ( + "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native/types" + "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" + enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +// SetExecutionPayloadHeader sets the execution payload header for the beacon state. +func (b *BeaconState) SetExecutionPayloadHeader(h *enginev1.ExecutionPayloadHeaderEPBS) { + b.lock.Lock() + defer b.lock.Unlock() + + b.executionPayloadHeader = h + b.markFieldAsDirty(types.ExecutionPayloadHeader) +} + +// UpdatePreviousInclusionListData updates the data of previous inclusion list with latest values. +func (b *BeaconState) UpdatePreviousInclusionListData() { + b.lock.Lock() + defer b.lock.Unlock() + + b.previousInclusionListProposer = b.latestInclusionListProposer + b.previousInclusionListSlot = b.latestInclusionListSlot + b.markFieldAsDirty(types.PreviousInclusionListProposer) + b.markFieldAsDirty(types.PreviousInclusionListSlot) +} + +// SetLatestInclusionListProposer sets the latest inclusion list proposer for the beacon state. +func (b *BeaconState) SetLatestInclusionListProposer(i primitives.ValidatorIndex) { + b.lock.Lock() + defer b.lock.Unlock() + + b.latestInclusionListProposer = i + b.markFieldAsDirty(types.LatestInclusionListProposer) +} + +// SetLatestInclusionListSlot sets the latest inclusion list slot for the beacon state. +func (b *BeaconState) SetLatestInclusionListSlot(s primitives.Slot) { + b.lock.Lock() + defer b.lock.Unlock() + + b.latestInclusionListSlot = s + b.markFieldAsDirty(types.LatestInclusionListSlot) +} + +// SetLatestBlockHash sets the latest block hash for the beacon state. +func (b *BeaconState) SetLatestBlockHash(h []byte) { + b.lock.Lock() + defer b.lock.Unlock() + + b.latestBlockHash = bytesutil.ToBytes32(h) + b.markFieldAsDirty(types.LatestBlockHash) +} + +// SetLatestFullSlot sets the latest full slot for the beacon state. +func (b *BeaconState) SetLatestFullSlot(s primitives.Slot) { + b.lock.Lock() + defer b.lock.Unlock() + + b.latestFullSlot = s + b.markFieldAsDirty(types.LatestFullSlot) +} + +// SetLastWithdrawalsRoot sets the latest withdrawals root for the beacon state. +func (b *BeaconState) SetLastWithdrawalsRoot(r []byte) { + b.lock.Lock() + defer b.lock.Unlock() + + b.lastWithdrawalsRoot = bytesutil.ToBytes32(r) + b.markFieldAsDirty(types.LastWithdrawalsRoot) +} diff --git a/beacon-chain/state/state-native/setters_payload_header.go b/beacon-chain/state/state-native/setters_payload_header.go index 9187aec5ba0c..c5ca20459cac 100644 --- a/beacon-chain/state/state-native/setters_payload_header.go +++ b/beacon-chain/state/state-native/setters_payload_header.go @@ -17,7 +17,7 @@ func (b *BeaconState) SetLatestExecutionPayloadHeader(val interfaces.ExecutionDa b.lock.Lock() defer b.lock.Unlock() - if b.version < version.Bellatrix { + if b.version < version.Bellatrix || b.version >= version.EPBS { return errNotSupported("SetLatestExecutionPayloadHeader", b.version) } diff --git a/beacon-chain/state/state-native/spec_parameters.go b/beacon-chain/state/state-native/spec_parameters.go index 1612a71efbdf..d3436eac0267 100644 --- a/beacon-chain/state/state-native/spec_parameters.go +++ b/beacon-chain/state/state-native/spec_parameters.go @@ -7,7 +7,7 @@ import ( func (b *BeaconState) ProportionalSlashingMultiplier() (uint64, error) { switch b.version { - case version.Bellatrix, version.Capella, version.Deneb, version.Electra: + case version.Bellatrix, version.Capella, version.Deneb, version.Electra, version.EPBS: return params.BeaconConfig().ProportionalSlashingMultiplierBellatrix, nil case version.Altair: return params.BeaconConfig().ProportionalSlashingMultiplierAltair, nil @@ -19,7 +19,7 @@ func (b *BeaconState) ProportionalSlashingMultiplier() (uint64, error) { func (b *BeaconState) InactivityPenaltyQuotient() (uint64, error) { switch b.version { - case version.Bellatrix, version.Capella, version.Deneb, version.Electra: + case version.Bellatrix, version.Capella, version.Deneb, version.Electra, version.EPBS: return params.BeaconConfig().InactivityPenaltyQuotientBellatrix, nil case version.Altair: return params.BeaconConfig().InactivityPenaltyQuotientAltair, nil diff --git a/beacon-chain/state/state-native/state_trie.go b/beacon-chain/state/state-native/state_trie.go index 095fd9e52817..790e42c2bd0c 100644 --- a/beacon-chain/state/state-native/state_trie.go +++ b/beacon-chain/state/state-native/state_trie.go @@ -111,6 +111,31 @@ var electraFields = append( types.PendingConsolidations, ) +var epbsFields = append( + altairFields, + types.NextWithdrawalIndex, + types.NextWithdrawalValidatorIndex, + types.HistoricalSummaries, + types.ExecutionPayloadHeader, // new in ePBS + types.DepositRequestsStartIndex, // electra fields start here + types.DepositBalanceToConsume, + types.ExitBalanceToConsume, + types.EarliestExitEpoch, + types.ConsolidationBalanceToConsume, + types.EarliestConsolidationEpoch, + types.PendingBalanceDeposits, + types.PendingPartialWithdrawals, + types.PendingConsolidations, + types.PreviousInclusionListProposer, // ePBS fields start here + types.PreviousInclusionListSlot, + types.LatestInclusionListProposer, + types.LatestInclusionListSlot, + types.LatestBlockHash, + types.LatestFullSlot, + types.ExecutionPayloadHeader, + types.LastWithdrawalsRoot, +) + const ( phase0SharedFieldRefCount = 10 altairSharedFieldRefCount = 11 @@ -118,12 +143,14 @@ const ( capellaSharedFieldRefCount = 14 denebSharedFieldRefCount = 14 electraSharedFieldRefCount = 17 + epbsSharedFieldRefCount = 17 experimentalStatePhase0SharedFieldRefCount = 5 experimentalStateAltairSharedFieldRefCount = 5 experimentalStateBellatrixSharedFieldRefCount = 6 experimentalStateCapellaSharedFieldRefCount = 8 experimentalStateDenebSharedFieldRefCount = 8 experimentalStateElectraSharedFieldRefCount = 11 + experimentalStateEpbsSharedFieldRefCount = 11 ) // InitializeFromProtoPhase0 the beacon state from a protobuf representation. @@ -155,6 +182,11 @@ func InitializeFromProtoElectra(st *ethpb.BeaconStateElectra) (state.BeaconState return InitializeFromProtoUnsafeElectra(proto.Clone(st).(*ethpb.BeaconStateElectra)) } +// InitializeFromProtoEpbs initializes the beacon state from its protobuf representation. +func InitializeFromProtoEpbs(st *ethpb.BeaconStateEPBS) (state.BeaconState, error) { + return InitializeFromProtoUnsafeEpbs(proto.Clone(st).(*ethpb.BeaconStateEPBS)) +} + // InitializeFromProtoUnsafePhase0 directly uses the beacon state protobuf fields // and sets them as fields of the BeaconState type. func InitializeFromProtoUnsafePhase0(st *ethpb.BeaconState) (state.BeaconState, error) { @@ -851,6 +883,8 @@ func (b *BeaconState) Copy() state.BeaconState { fieldCount = params.BeaconConfig().BeaconStateDenebFieldCount case version.Electra: fieldCount = params.BeaconConfig().BeaconStateElectraFieldCount + case version.EPBS: + fieldCount = params.BeaconConfig().BeaconStateEpbsFieldCount } dst := &BeaconState{ @@ -868,6 +902,13 @@ func (b *BeaconState) Copy() state.BeaconState { earliestExitEpoch: b.earliestExitEpoch, consolidationBalanceToConsume: b.consolidationBalanceToConsume, earliestConsolidationEpoch: b.earliestConsolidationEpoch, + previousInclusionListProposer: b.previousInclusionListProposer, + previousInclusionListSlot: b.previousInclusionListSlot, + latestInclusionListProposer: b.latestInclusionListProposer, + latestInclusionListSlot: b.latestInclusionListSlot, + latestBlockHash: b.latestBlockHash, + latestFullSlot: b.latestFullSlot, + lastWithdrawalsRoot: b.lastWithdrawalsRoot, // Large arrays, infrequently changed, constant size. blockRoots: b.blockRoots, @@ -911,6 +952,7 @@ func (b *BeaconState) Copy() state.BeaconState { latestExecutionPayloadHeaderCapella: b.latestExecutionPayloadHeaderCapellaVal(), latestExecutionPayloadHeaderDeneb: b.latestExecutionPayloadHeaderDenebVal(), latestExecutionPayloadHeaderElectra: b.latestExecutionPayloadHeaderElectraVal(), + executionPayloadHeader: b.executionPayloadHeaderVal(), id: types.Enumerator.Inc(), @@ -949,6 +991,8 @@ func (b *BeaconState) Copy() state.BeaconState { dst.sharedFieldReferences = make(map[types.FieldIndex]*stateutil.Reference, experimentalStateDenebSharedFieldRefCount) case version.Electra: dst.sharedFieldReferences = make(map[types.FieldIndex]*stateutil.Reference, experimentalStateElectraSharedFieldRefCount) + case version.EPBS: + dst.sharedFieldReferences = make(map[types.FieldIndex]*stateutil.Reference, experimentalStateEpbsSharedFieldRefCount) } } else { switch b.version { @@ -964,6 +1008,8 @@ func (b *BeaconState) Copy() state.BeaconState { dst.sharedFieldReferences = make(map[types.FieldIndex]*stateutil.Reference, denebSharedFieldRefCount) case version.Electra: dst.sharedFieldReferences = make(map[types.FieldIndex]*stateutil.Reference, electraSharedFieldRefCount) + case version.EPBS: + dst.sharedFieldReferences = make(map[types.FieldIndex]*stateutil.Reference, epbsSharedFieldRefCount) } } @@ -1058,6 +1104,8 @@ func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { b.dirtyFields = make(map[types.FieldIndex]bool, params.BeaconConfig().BeaconStateDenebFieldCount) case version.Electra: b.dirtyFields = make(map[types.FieldIndex]bool, params.BeaconConfig().BeaconStateElectraFieldCount) + case version.EPBS: + b.dirtyFields = make(map[types.FieldIndex]bool, params.BeaconConfig().BeaconStateEpbsFieldCount) default: return fmt.Errorf("unknown state version (%s) when computing dirty fields in merklization", version.String(b.version)) } @@ -1304,6 +1352,22 @@ func (b *BeaconState) rootSelector(ctx context.Context, field types.FieldIndex) return stateutil.PendingPartialWithdrawalsRoot(b.pendingPartialWithdrawals) case types.PendingConsolidations: return stateutil.PendingConsolidationsRoot(b.pendingConsolidations) + case types.PreviousInclusionListProposer: + return ssz.Uint64Root(uint64(b.previousInclusionListProposer)), nil + case types.PreviousInclusionListSlot: + return ssz.Uint64Root(uint64(b.previousInclusionListSlot)), nil + case types.LatestInclusionListProposer: + return ssz.Uint64Root(uint64(b.latestInclusionListProposer)), nil + case types.LatestInclusionListSlot: + return ssz.Uint64Root(uint64(b.latestInclusionListSlot)), nil + case types.LatestBlockHash: + return b.latestBlockHash, nil + case types.LatestFullSlot: + return ssz.Uint64Root(uint64(b.latestFullSlot)), nil + case types.ExecutionPayloadHeader: + return b.executionPayloadHeader.HashTreeRoot() + case types.LastWithdrawalsRoot: + return b.lastWithdrawalsRoot, nil } return [32]byte{}, errors.New("invalid field index provided") } diff --git a/beacon-chain/state/state-native/state_trie_epbs.go b/beacon-chain/state/state-native/state_trie_epbs.go new file mode 100644 index 000000000000..3c811fd8e9e6 --- /dev/null +++ b/beacon-chain/state/state-native/state_trie_epbs.go @@ -0,0 +1,151 @@ +package state_native + +import ( + "runtime" + + "github.com/pkg/errors" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/state" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/fieldtrie" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native/types" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/stateutil" + "github.com/prysmaticlabs/prysm/v5/config/features" + fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" + "github.com/prysmaticlabs/prysm/v5/config/params" + "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" + ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" + "github.com/prysmaticlabs/prysm/v5/runtime/version" +) + +// InitializeFromProtoUnsafeEpbs constructs a BeaconState from its protobuf representation. +func InitializeFromProtoUnsafeEpbs(st *ethpb.BeaconStateEPBS) (*BeaconState, error) { + if st == nil { + return nil, errors.New("received nil state") + } + + // Process historical roots. + hRoots := make([][32]byte, len(st.HistoricalRoots)) + for i, root := range st.HistoricalRoots { + hRoots[i] = bytesutil.ToBytes32(root) + } + + // Define the number of fields to track changes. + fieldCount := params.BeaconConfig().BeaconStateEpbsFieldCount + b := &BeaconState{ + version: version.EPBS, + genesisTime: st.GenesisTime, + genesisValidatorsRoot: bytesutil.ToBytes32(st.GenesisValidatorsRoot), + slot: st.Slot, + fork: st.Fork, + latestBlockHeader: st.LatestBlockHeader, + historicalRoots: hRoots, + eth1Data: st.Eth1Data, + eth1DataVotes: st.Eth1DataVotes, + eth1DepositIndex: st.Eth1DepositIndex, + slashings: st.Slashings, + previousEpochParticipation: st.PreviousEpochParticipation, + currentEpochParticipation: st.CurrentEpochParticipation, + justificationBits: st.JustificationBits, + previousJustifiedCheckpoint: st.PreviousJustifiedCheckpoint, + currentJustifiedCheckpoint: st.CurrentJustifiedCheckpoint, + finalizedCheckpoint: st.FinalizedCheckpoint, + currentSyncCommittee: st.CurrentSyncCommittee, + nextSyncCommittee: st.NextSyncCommittee, + nextWithdrawalIndex: st.NextWithdrawalIndex, + nextWithdrawalValidatorIndex: st.NextWithdrawalValidatorIndex, + historicalSummaries: st.HistoricalSummaries, + depositRequestsStartIndex: st.DepositRequestsStartIndex, + depositBalanceToConsume: st.DepositBalanceToConsume, + exitBalanceToConsume: st.ExitBalanceToConsume, + earliestExitEpoch: st.EarliestExitEpoch, + consolidationBalanceToConsume: st.ConsolidationBalanceToConsume, + earliestConsolidationEpoch: st.EarliestConsolidationEpoch, + pendingBalanceDeposits: st.PendingBalanceDeposits, + pendingPartialWithdrawals: st.PendingPartialWithdrawals, + pendingConsolidations: st.PendingConsolidations, + + // ePBS fields + previousInclusionListProposer: st.PreviousInclusionListProposer, + previousInclusionListSlot: st.PreviousInclusionListSlot, + latestInclusionListProposer: st.LatestInclusionListProposer, + latestInclusionListSlot: st.LatestInclusionListSlot, + latestBlockHash: bytesutil.ToBytes32(st.LatestBlockHash), + latestFullSlot: st.LatestFullSlot, + executionPayloadHeader: st.ExecutionPayloadHeader, + lastWithdrawalsRoot: bytesutil.ToBytes32(st.LastWithdrawalsRoot), + + dirtyFields: make(map[types.FieldIndex]bool, fieldCount), + dirtyIndices: make(map[types.FieldIndex][]uint64, fieldCount), + stateFieldLeaves: make(map[types.FieldIndex]*fieldtrie.FieldTrie, fieldCount), + rebuildTrie: make(map[types.FieldIndex]bool, fieldCount), + valMapHandler: stateutil.NewValMapHandler(st.Validators), + } + + if features.Get().EnableExperimentalState { + b.blockRootsMultiValue = NewMultiValueBlockRoots(st.BlockRoots) + b.stateRootsMultiValue = NewMultiValueStateRoots(st.StateRoots) + b.randaoMixesMultiValue = NewMultiValueRandaoMixes(st.RandaoMixes) + b.balancesMultiValue = NewMultiValueBalances(st.Balances) + b.validatorsMultiValue = NewMultiValueValidators(st.Validators) + b.inactivityScoresMultiValue = NewMultiValueInactivityScores(st.InactivityScores) + b.sharedFieldReferences = make(map[types.FieldIndex]*stateutil.Reference, experimentalStateEpbsSharedFieldRefCount) + } else { + bRoots := make([][32]byte, fieldparams.BlockRootsLength) + for i, r := range st.BlockRoots { + bRoots[i] = bytesutil.ToBytes32(r) + } + b.blockRoots = bRoots + + sRoots := make([][32]byte, fieldparams.StateRootsLength) + for i, r := range st.StateRoots { + sRoots[i] = bytesutil.ToBytes32(r) + } + b.stateRoots = sRoots + + mixes := make([][32]byte, fieldparams.RandaoMixesLength) + for i, m := range st.RandaoMixes { + mixes[i] = bytesutil.ToBytes32(m) + } + b.randaoMixes = mixes + + b.balances = st.Balances + b.validators = st.Validators + b.inactivityScores = st.InactivityScores + + b.sharedFieldReferences = make(map[types.FieldIndex]*stateutil.Reference, epbsSharedFieldRefCount) + } + + for _, f := range epbsFields { + b.dirtyFields[f] = true + b.rebuildTrie[f] = true + b.dirtyIndices[f] = []uint64{} + trie, err := fieldtrie.NewFieldTrie(f, types.BasicArray, nil, 0) + if err != nil { + return nil, err + } + b.stateFieldLeaves[f] = trie + } + + // Initialize field reference tracking for shared data. + b.sharedFieldReferences[types.HistoricalRoots] = stateutil.NewRef(1) + b.sharedFieldReferences[types.Eth1DataVotes] = stateutil.NewRef(1) + b.sharedFieldReferences[types.Slashings] = stateutil.NewRef(1) + b.sharedFieldReferences[types.PreviousEpochParticipationBits] = stateutil.NewRef(1) + b.sharedFieldReferences[types.CurrentEpochParticipationBits] = stateutil.NewRef(1) + b.sharedFieldReferences[types.HistoricalSummaries] = stateutil.NewRef(1) + b.sharedFieldReferences[types.PendingBalanceDeposits] = stateutil.NewRef(1) + b.sharedFieldReferences[types.PendingPartialWithdrawals] = stateutil.NewRef(1) + b.sharedFieldReferences[types.PendingConsolidations] = stateutil.NewRef(1) + if !features.Get().EnableExperimentalState { + b.sharedFieldReferences[types.BlockRoots] = stateutil.NewRef(1) + b.sharedFieldReferences[types.StateRoots] = stateutil.NewRef(1) + b.sharedFieldReferences[types.RandaoMixes] = stateutil.NewRef(1) + b.sharedFieldReferences[types.Balances] = stateutil.NewRef(1) + b.sharedFieldReferences[types.Validators] = stateutil.NewRef(1) + b.sharedFieldReferences[types.InactivityScores] = stateutil.NewRef(1) + } + + state.Count.Inc() + // Finalizer runs when dst is being destroyed in garbage collection. + runtime.SetFinalizer(b, finalizerCleanup) + return b, nil +} diff --git a/beacon-chain/state/state-native/state_trie_epbs_test.go b/beacon-chain/state/state-native/state_trie_epbs_test.go new file mode 100644 index 000000000000..97577eade066 --- /dev/null +++ b/beacon-chain/state/state-native/state_trie_epbs_test.go @@ -0,0 +1,77 @@ +package state_native + +import ( + "context" + "testing" + + "github.com/prysmaticlabs/prysm/v5/testing/require" + "github.com/prysmaticlabs/prysm/v5/testing/util/random" +) + +func Test_InitializeFromProtoEpbs(t *testing.T) { + st := random.BeaconState(t) + + // Cache initial values to check against after initialization. + prevInclusionListProposer := st.PreviousInclusionListProposer + prevInclusionListSlot := st.PreviousInclusionListSlot + latestInclusionListProposer := st.LatestInclusionListProposer + latestInclusionListSlot := st.LatestInclusionListSlot + latestBlockHash := st.LatestBlockHash + latestFullSlot := st.LatestFullSlot + header := st.ExecutionPayloadHeader + lastWithdrawalsRoot := st.LastWithdrawalsRoot + + s, err := InitializeFromProtoEpbs(st) + require.NoError(t, err) + + // Assert that initial values match those in the new state. + gotPrevInclusionListProposer := s.PreviousInclusionListProposer() + require.Equal(t, prevInclusionListProposer, gotPrevInclusionListProposer) + gotPrevInclusionListSlot := s.PreviousInclusionListSlot() + require.Equal(t, prevInclusionListSlot, gotPrevInclusionListSlot) + gotLatestInclusionListProposer := s.LatestInclusionListProposer() + require.Equal(t, latestInclusionListProposer, gotLatestInclusionListProposer) + gotLatestInclusionListSlot := s.LatestInclusionListSlot() + require.Equal(t, latestInclusionListSlot, gotLatestInclusionListSlot) + gotLatestBlockHash := s.LatestBlockHash() + require.DeepEqual(t, latestBlockHash, gotLatestBlockHash) + gotLatestFullSlot := s.LatestFullSlot() + require.Equal(t, latestFullSlot, gotLatestFullSlot) + gotHeader := s.ExecutionPayloadHeader() + require.DeepEqual(t, header, gotHeader) + gotLastWithdrawalsRoot := s.LastWithdrawalsRoot() + require.DeepEqual(t, lastWithdrawalsRoot, gotLastWithdrawalsRoot) +} + +func Test_CopyEpbs(t *testing.T) { + st := random.BeaconState(t) + s, err := InitializeFromProtoUnsafeEpbs(st) + require.NoError(t, err) + + // Test shallow copy. + sNoCopy := s + require.DeepEqual(t, s.executionPayloadHeader, sNoCopy.executionPayloadHeader) + + // Modify a field to check if it reflects in the shallow copy. + s.executionPayloadHeader.Slot = 100 + require.Equal(t, s.executionPayloadHeader, sNoCopy.executionPayloadHeader) + + // Copy the state + sCopy := s.Copy() + require.NoError(t, err) + header := sCopy.ExecutionPayloadHeader() + require.DeepEqual(t, s.executionPayloadHeader, header) + + // Modify the original to check if the copied state is independent. + s.executionPayloadHeader.Slot = 200 + require.DeepNotEqual(t, s.executionPayloadHeader, header) +} + +func Test_HashTreeRootEpbs(t *testing.T) { + st := random.BeaconState(t) + s, err := InitializeFromProtoUnsafeEpbs(st) + require.NoError(t, err) + + _, err = s.HashTreeRoot(context.Background()) + require.NoError(t, err) +} diff --git a/beacon-chain/state/state-native/types/types.go b/beacon-chain/state/state-native/types/types.go index 43cb57c6a76a..2d9a769215be 100644 --- a/beacon-chain/state/state-native/types/types.go +++ b/beacon-chain/state/state-native/types/types.go @@ -114,6 +114,22 @@ func (f FieldIndex) String() string { return "pendingPartialWithdrawals" case PendingConsolidations: return "pendingConsolidations" + case PreviousInclusionListProposer: // ePBS fields start here + return "PreviousInclusionListProposer" + case PreviousInclusionListSlot: + return "PreviousInclusionListSlot" + case LatestInclusionListProposer: + return "LatestInclusionListProposer" + case LatestInclusionListSlot: + return "LatestInclusionListSlot" + case LatestBlockHash: + return "LatestBlockHash" + case LatestFullSlot: + return "LatestFullSlot" + case ExecutionPayloadHeader: + return "ExecutionPayloadHeader" + case LastWithdrawalsRoot: + return "LastWithdrawalsRoot" default: return fmt.Sprintf("unknown field index number: %d", f) } @@ -171,7 +187,8 @@ func (f FieldIndex) RealPosition() int { return 22 case NextSyncCommittee: return 23 - case LatestExecutionPayloadHeader, LatestExecutionPayloadHeaderCapella, LatestExecutionPayloadHeaderDeneb, LatestExecutionPayloadHeaderElectra: + // ExecutionPayloadHeader is from ePBS. + case LatestExecutionPayloadHeader, LatestExecutionPayloadHeaderCapella, LatestExecutionPayloadHeaderDeneb, LatestExecutionPayloadHeaderElectra, ExecutionPayloadHeader: return 24 case NextWithdrawalIndex: return 25 @@ -197,6 +214,20 @@ func (f FieldIndex) RealPosition() int { return 35 case PendingConsolidations: return 36 + case PreviousInclusionListProposer: // ePBS fields start here + return 37 + case PreviousInclusionListSlot: + return 38 + case LatestInclusionListProposer: + return 39 + case LatestInclusionListSlot: + return 40 + case LatestBlockHash: + return 41 + case LatestFullSlot: + return 42 + case LastWithdrawalsRoot: + return 43 default: return -1 } @@ -262,6 +293,14 @@ const ( PendingBalanceDeposits // Electra: EIP-7251 PendingPartialWithdrawals // Electra: EIP-7251 PendingConsolidations // Electra: EIP-7251 + PreviousInclusionListProposer // ePBS fields start here + PreviousInclusionListSlot + LatestInclusionListProposer + LatestInclusionListSlot + LatestBlockHash + LatestFullSlot + ExecutionPayloadHeader + LastWithdrawalsRoot ) // Enumerator keeps track of the number of states created since the node's start. diff --git a/config/params/config.go b/config/params/config.go index 5b964cd48d92..86d783aba913 100644 --- a/config/params/config.go +++ b/config/params/config.go @@ -148,6 +148,7 @@ type BeaconChainConfig struct { BeaconStateCapellaFieldCount int // BeaconStateCapellaFieldCount defines how many fields are in beacon state post upgrade to Capella. BeaconStateDenebFieldCount int // BeaconStateDenebFieldCount defines how many fields are in beacon state post upgrade to Deneb. BeaconStateElectraFieldCount int // BeaconStateElectraFieldCount defines how many fields are in beacon state post upgrade to Electra. + BeaconStateEpbsFieldCount int // BeaconStateEpbsFieldCount defines how many fields are in beacon state post upgrade to ePBS. // Slasher constants. WeakSubjectivityPeriod primitives.Epoch // WeakSubjectivityPeriod defines the time period expressed in number of epochs were proof of stake network should validate block headers and attestations for slashable events. diff --git a/config/params/mainnet_config.go b/config/params/mainnet_config.go index 6fcda9defb8b..78954dd85eef 100644 --- a/config/params/mainnet_config.go +++ b/config/params/mainnet_config.go @@ -196,6 +196,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{ BeaconStateCapellaFieldCount: 28, BeaconStateDenebFieldCount: 28, BeaconStateElectraFieldCount: 37, + BeaconStateEpbsFieldCount: 44, // Slasher related values. WeakSubjectivityPeriod: 54000, diff --git a/proto/prysm/v1alpha1/beacon_state.pb.go b/proto/prysm/v1alpha1/beacon_state.pb.go index bb4fce0471ef..219883c066ef 100755 --- a/proto/prysm/v1alpha1/beacon_state.pb.go +++ b/proto/prysm/v1alpha1/beacon_state.pb.go @@ -2201,6 +2201,15 @@ type BeaconStateEPBS struct { NextWithdrawalIndex uint64 `protobuf:"varint,11001,opt,name=next_withdrawal_index,json=nextWithdrawalIndex,proto3" json:"next_withdrawal_index,omitempty"` NextWithdrawalValidatorIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,11002,opt,name=next_withdrawal_validator_index,json=nextWithdrawalValidatorIndex,proto3" json:"next_withdrawal_validator_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"` HistoricalSummaries []*HistoricalSummary `protobuf:"bytes,11003,rep,name=historical_summaries,json=historicalSummaries,proto3" json:"historical_summaries,omitempty" ssz-max:"16777216"` + DepositRequestsStartIndex uint64 `protobuf:"varint,12001,opt,name=deposit_requests_start_index,json=depositRequestsStartIndex,proto3" json:"deposit_requests_start_index,omitempty"` + DepositBalanceToConsume github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei `protobuf:"varint,12002,opt,name=deposit_balance_to_consume,json=depositBalanceToConsume,proto3" json:"deposit_balance_to_consume,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"` + ExitBalanceToConsume github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei `protobuf:"varint,12003,opt,name=exit_balance_to_consume,json=exitBalanceToConsume,proto3" json:"exit_balance_to_consume,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"` + EarliestExitEpoch github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch `protobuf:"varint,12004,opt,name=earliest_exit_epoch,json=earliestExitEpoch,proto3" json:"earliest_exit_epoch,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"` + ConsolidationBalanceToConsume github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei `protobuf:"varint,12005,opt,name=consolidation_balance_to_consume,json=consolidationBalanceToConsume,proto3" json:"consolidation_balance_to_consume,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"` + EarliestConsolidationEpoch github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch `protobuf:"varint,12006,opt,name=earliest_consolidation_epoch,json=earliestConsolidationEpoch,proto3" json:"earliest_consolidation_epoch,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"` + PendingBalanceDeposits []*PendingBalanceDeposit `protobuf:"bytes,12007,rep,name=pending_balance_deposits,json=pendingBalanceDeposits,proto3" json:"pending_balance_deposits,omitempty" ssz-max:"134217728"` + PendingPartialWithdrawals []*PendingPartialWithdrawal `protobuf:"bytes,12008,rep,name=pending_partial_withdrawals,json=pendingPartialWithdrawals,proto3" json:"pending_partial_withdrawals,omitempty" ssz-max:"134217728"` + PendingConsolidations []*PendingConsolidation `protobuf:"bytes,12009,rep,name=pending_consolidations,json=pendingConsolidations,proto3" json:"pending_consolidations,omitempty" ssz-max:"262144"` PreviousInclusionListProposer github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,13001,opt,name=previous_inclusion_list_proposer,json=previousInclusionListProposer,proto3" json:"previous_inclusion_list_proposer,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"` PreviousInclusionListSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,13002,opt,name=previous_inclusion_list_slot,json=previousInclusionListSlot,proto3" json:"previous_inclusion_list_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` LatestInclusionListProposer github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,13003,opt,name=latest_inclusion_list_proposer,json=latestInclusionListProposer,proto3" json:"latest_inclusion_list_proposer,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"` @@ -2208,7 +2217,7 @@ type BeaconStateEPBS struct { LatestBlockHash []byte `protobuf:"bytes,13005,opt,name=latest_block_hash,json=latestBlockHash,proto3" json:"latest_block_hash,omitempty" ssz-size:"32"` LatestFullSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,13006,opt,name=latest_full_slot,json=latestFullSlot,proto3" json:"latest_full_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` ExecutionPayloadHeader *v1.ExecutionPayloadHeaderEPBS `protobuf:"bytes,13007,opt,name=execution_payload_header,json=executionPayloadHeader,proto3" json:"execution_payload_header,omitempty"` - LatestWithdrawalsRoot []byte `protobuf:"bytes,13008,opt,name=latest_withdrawals_root,json=latestWithdrawalsRoot,proto3" json:"latest_withdrawals_root,omitempty" ssz-size:"32"` + LastWithdrawalsRoot []byte `protobuf:"bytes,13008,opt,name=last_withdrawals_root,json=lastWithdrawalsRoot,proto3" json:"last_withdrawals_root,omitempty" ssz-size:"32"` } func (x *BeaconStateEPBS) Reset() { @@ -2432,6 +2441,69 @@ func (x *BeaconStateEPBS) GetHistoricalSummaries() []*HistoricalSummary { return nil } +func (x *BeaconStateEPBS) GetDepositRequestsStartIndex() uint64 { + if x != nil { + return x.DepositRequestsStartIndex + } + return 0 +} + +func (x *BeaconStateEPBS) GetDepositBalanceToConsume() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei { + if x != nil { + return x.DepositBalanceToConsume + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(0) +} + +func (x *BeaconStateEPBS) GetExitBalanceToConsume() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei { + if x != nil { + return x.ExitBalanceToConsume + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(0) +} + +func (x *BeaconStateEPBS) GetEarliestExitEpoch() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch { + if x != nil { + return x.EarliestExitEpoch + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(0) +} + +func (x *BeaconStateEPBS) GetConsolidationBalanceToConsume() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei { + if x != nil { + return x.ConsolidationBalanceToConsume + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(0) +} + +func (x *BeaconStateEPBS) GetEarliestConsolidationEpoch() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch { + if x != nil { + return x.EarliestConsolidationEpoch + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(0) +} + +func (x *BeaconStateEPBS) GetPendingBalanceDeposits() []*PendingBalanceDeposit { + if x != nil { + return x.PendingBalanceDeposits + } + return nil +} + +func (x *BeaconStateEPBS) GetPendingPartialWithdrawals() []*PendingPartialWithdrawal { + if x != nil { + return x.PendingPartialWithdrawals + } + return nil +} + +func (x *BeaconStateEPBS) GetPendingConsolidations() []*PendingConsolidation { + if x != nil { + return x.PendingConsolidations + } + return nil +} + func (x *BeaconStateEPBS) GetPreviousInclusionListProposer() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex { if x != nil { return x.PreviousInclusionListProposer @@ -2481,9 +2553,9 @@ func (x *BeaconStateEPBS) GetExecutionPayloadHeader() *v1.ExecutionPayloadHeader return nil } -func (x *BeaconStateEPBS) GetLatestWithdrawalsRoot() []byte { +func (x *BeaconStateEPBS) GetLastWithdrawalsRoot() []byte { if x != nil { - return x.LatestWithdrawalsRoot + return x.LastWithdrawalsRoot } return nil } @@ -3536,7 +3608,7 @@ var file_proto_prysm_v1alpha1_beacon_state_proto_rawDesc = []byte{ 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x92, 0xb5, 0x18, 0x06, 0x32, 0x36, 0x32, 0x31, 0x34, 0x34, 0x52, 0x15, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa2, 0x17, 0x0a, 0x0f, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x53, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe6, 0x1f, 0x0a, 0x0f, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x50, 0x42, 0x53, 0x12, 0x22, 0x0a, 0x0c, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x17, @@ -3665,91 +3737,160 @@ var file_proto_prysm_v1alpha1_beacon_state_proto_rawDesc = []byte{ 0x73, 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x42, 0x0c, 0x92, 0xb5, 0x18, 0x08, 0x31, 0x36, 0x37, 0x37, 0x37, 0x32, 0x31, 0x36, 0x52, 0x13, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x69, - 0x65, 0x73, 0x12, 0x99, 0x01, 0x0a, 0x20, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, - 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, 0xc9, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, - 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, + 0x65, 0x73, 0x12, 0x40, 0x0a, 0x1c, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0xe1, 0x5d, 0x20, 0x01, 0x28, 0x04, 0x52, 0x19, 0x64, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x49, + 0x6e, 0x64, 0x65, 0x78, 0x12, 0x83, 0x01, 0x0a, 0x1a, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x18, 0xe2, 0x5d, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, + 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x47, 0x77, 0x65, + 0x69, 0x52, 0x17, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, + 0x65, 0x54, 0x6f, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x12, 0x7d, 0x0a, 0x17, 0x65, 0x78, + 0x69, 0x74, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x63, 0x6f, + 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x18, 0xe3, 0x5d, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, + 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, + 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x47, + 0x77, 0x65, 0x69, 0x52, 0x14, 0x65, 0x78, 0x69, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x54, 0x6f, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x12, 0x77, 0x0a, 0x13, 0x65, 0x61, 0x72, + 0x6c, 0x69, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x18, 0xe4, 0x5d, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, + 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, + 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, + 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, + 0x11, 0x65, 0x61, 0x72, 0x6c, 0x69, 0x65, 0x73, 0x74, 0x45, 0x78, 0x69, 0x74, 0x45, 0x70, 0x6f, + 0x63, 0x68, 0x12, 0x8f, 0x01, 0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x6f, 0x5f, + 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x18, 0xe5, 0x5d, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, + 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, - 0x1d, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, - 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x12, 0x87, - 0x01, 0x0a, 0x1c, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x69, 0x6e, 0x63, 0x6c, - 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, - 0xca, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, + 0x2e, 0x47, 0x77, 0x65, 0x69, 0x52, 0x1d, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x6f, 0x43, 0x6f, 0x6e, + 0x73, 0x75, 0x6d, 0x65, 0x12, 0x89, 0x01, 0x0a, 0x1c, 0x65, 0x61, 0x72, 0x6c, 0x69, 0x65, 0x73, + 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0xe6, 0x5d, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, + 0x18, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, + 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, + 0x70, 0x6f, 0x63, 0x68, 0x52, 0x1a, 0x65, 0x61, 0x72, 0x6c, 0x69, 0x65, 0x73, 0x74, 0x43, 0x6f, + 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, + 0x12, 0x76, 0x0a, 0x18, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x61, 0x6c, 0x61, + 0x6e, 0x63, 0x65, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x73, 0x18, 0xe7, 0x5d, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, + 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x65, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x42, 0x0d, 0x92, 0xb5, 0x18, 0x09, 0x31, 0x33, 0x34, 0x32, 0x31, 0x37, 0x37, 0x32, 0x38, + 0x52, 0x16, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x73, 0x12, 0x7f, 0x0a, 0x1b, 0x70, 0x65, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x77, 0x69, 0x74, 0x68, + 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x73, 0x18, 0xe8, 0x5d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, + 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, + 0x72, 0x74, 0x69, 0x61, 0x6c, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x42, + 0x0d, 0x92, 0xb5, 0x18, 0x09, 0x31, 0x33, 0x34, 0x32, 0x31, 0x37, 0x37, 0x32, 0x38, 0x52, 0x19, + 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x57, 0x69, + 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x73, 0x12, 0x6f, 0x0a, 0x16, 0x70, 0x65, 0x6e, + 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0xe9, 0x5d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x92, 0xb5, 0x18, 0x06, 0x32, 0x36, 0x32, + 0x31, 0x34, 0x34, 0x52, 0x15, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x73, + 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x99, 0x01, 0x0a, 0x20, 0x70, + 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, + 0xc9, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, - 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x19, 0x70, - 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, - 0x4c, 0x69, 0x73, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x95, 0x01, 0x0a, 0x1e, 0x6c, 0x61, 0x74, + 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x1d, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, + 0x73, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x12, 0x87, 0x01, 0x0a, 0x1c, 0x70, 0x72, 0x65, 0x76, 0x69, + 0x6f, 0x75, 0x73, 0x5f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, + 0x73, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0xca, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, + 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, + 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, + 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, + 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x19, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x49, + 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x6c, 0x6f, 0x74, + 0x12, 0x95, 0x01, 0x0a, 0x1e, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x63, 0x6c, + 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x65, 0x72, 0x18, 0xcb, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, + 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x1b, 0x6c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, + 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x12, 0x83, 0x01, 0x0a, 0x1a, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, - 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, 0xcb, 0x65, 0x20, 0x01, - 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, - 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x52, 0x1b, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x63, 0x6c, 0x75, - 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, - 0x12, 0x83, 0x01, 0x0a, 0x1a, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x63, 0x6c, - 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, - 0xcc, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, - 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, - 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, - 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x17, 0x6c, - 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, - 0x73, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x33, 0x0a, 0x11, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, - 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0xcd, 0x65, 0x20, 0x01, - 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x6c, 0x61, 0x74, 0x65, - 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x70, 0x0a, 0x10, 0x6c, - 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, - 0xce, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, - 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, - 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, - 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0e, 0x6c, - 0x61, 0x74, 0x65, 0x73, 0x74, 0x46, 0x75, 0x6c, 0x6c, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x69, 0x0a, - 0x18, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0xcf, 0x65, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2e, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, - 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x50, 0x42, 0x53, - 0x52, 0x16, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x17, 0x6c, 0x61, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x73, 0x5f, 0x72, - 0x6f, 0x6f, 0x74, 0x18, 0xd0, 0x65, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, - 0x33, 0x32, 0x52, 0x15, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, - 0x61, 0x77, 0x61, 0x6c, 0x73, 0x52, 0x6f, 0x6f, 0x74, 0x22, 0x8d, 0x01, 0x0a, 0x08, 0x50, 0x6f, - 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x25, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, - 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, - 0x33, 0x32, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x27, 0x0a, - 0x0b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x31, 0x0a, 0x10, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, - 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x44, - 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x22, 0x7f, 0x0a, 0x11, 0x48, 0x69, 0x73, - 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x34, - 0x0a, 0x12, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, - 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, - 0x33, 0x32, 0x52, 0x10, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, - 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x34, 0x0a, 0x12, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x10, 0x73, 0x74, 0x61, 0x74, 0x65, 0x53, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x6f, 0x6f, 0x74, 0x42, 0x9b, 0x01, 0x0a, 0x19, 0x6f, - 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, - 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, - 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x41, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0xcc, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, + 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, + 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, + 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, + 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x17, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x63, + 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x33, + 0x0a, 0x11, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, + 0x61, 0x73, 0x68, 0x18, 0xcd, 0x65, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, + 0x33, 0x32, 0x52, 0x0f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x70, 0x0a, 0x10, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x66, 0x75, + 0x6c, 0x6c, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0xce, 0x65, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, + 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, + 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, + 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, + 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0e, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x46, 0x75, 0x6c, + 0x6c, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x69, 0x0a, 0x18, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0xcf, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x45, 0x50, 0x42, 0x53, 0x52, 0x16, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x3b, 0x0a, 0x15, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, + 0x77, 0x61, 0x6c, 0x73, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0xd0, 0x65, 0x20, 0x01, 0x28, 0x0c, + 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x13, 0x6c, 0x61, 0x73, 0x74, 0x57, 0x69, + 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x73, 0x52, 0x6f, 0x6f, 0x74, 0x22, 0x8d, 0x01, + 0x0a, 0x08, 0x50, 0x6f, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x25, 0x0a, 0x0a, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, + 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, + 0x68, 0x12, 0x27, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0a, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x31, 0x0a, 0x10, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x22, 0x7f, 0x0a, + 0x11, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x12, 0x34, 0x0a, 0x12, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x75, 0x6d, 0x6d, + 0x61, 0x72, 0x79, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, + 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x10, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x6d, + 0x6d, 0x61, 0x72, 0x79, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x34, 0x0a, 0x12, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x10, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x6f, 0x6f, 0x74, 0x42, 0x9b, + 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, + 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x42, 0x65, + 0x61, 0x63, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, + 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x41, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, + 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3883,12 +4024,15 @@ var file_proto_prysm_v1alpha1_beacon_state_proto_depIdxs = []int32{ 10, // 80: ethereum.eth.v1alpha1.BeaconStateEPBS.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 10, // 81: ethereum.eth.v1alpha1.BeaconStateEPBS.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 18, // 82: ethereum.eth.v1alpha1.BeaconStateEPBS.historical_summaries:type_name -> ethereum.eth.v1alpha1.HistoricalSummary - 31, // 83: ethereum.eth.v1alpha1.BeaconStateEPBS.execution_payload_header:type_name -> ethereum.engine.v1.ExecutionPayloadHeaderEPBS - 84, // [84:84] is the sub-list for method output_type - 84, // [84:84] is the sub-list for method input_type - 84, // [84:84] is the sub-list for extension type_name - 84, // [84:84] is the sub-list for extension extendee - 0, // [0:84] is the sub-list for field type_name + 28, // 83: ethereum.eth.v1alpha1.BeaconStateEPBS.pending_balance_deposits:type_name -> ethereum.eth.v1alpha1.PendingBalanceDeposit + 29, // 84: ethereum.eth.v1alpha1.BeaconStateEPBS.pending_partial_withdrawals:type_name -> ethereum.eth.v1alpha1.PendingPartialWithdrawal + 30, // 85: ethereum.eth.v1alpha1.BeaconStateEPBS.pending_consolidations:type_name -> ethereum.eth.v1alpha1.PendingConsolidation + 31, // 86: ethereum.eth.v1alpha1.BeaconStateEPBS.execution_payload_header:type_name -> ethereum.engine.v1.ExecutionPayloadHeaderEPBS + 87, // [87:87] is the sub-list for method output_type + 87, // [87:87] is the sub-list for method input_type + 87, // [87:87] is the sub-list for extension type_name + 87, // [87:87] is the sub-list for extension extendee + 0, // [0:87] is the sub-list for field type_name } func init() { file_proto_prysm_v1alpha1_beacon_state_proto_init() } diff --git a/proto/prysm/v1alpha1/beacon_state.proto b/proto/prysm/v1alpha1/beacon_state.proto index c9e09b9c26ad..3d1cd75608db 100644 --- a/proto/prysm/v1alpha1/beacon_state.proto +++ b/proto/prysm/v1alpha1/beacon_state.proto @@ -460,6 +460,18 @@ message BeaconStateEPBS { uint64 next_withdrawal_validator_index = 11002 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; repeated HistoricalSummary historical_summaries = 11003 [(ethereum.eth.ext.ssz_max) = "16777216"]; + // Fields introduced in Electra fork [12001-13000] + uint64 deposit_requests_start_index = 12001; + uint64 deposit_balance_to_consume = 12002 [(ethereum.eth.ext.cast_type) = +"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"]; + uint64 exit_balance_to_consume = 12003 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"]; + uint64 earliest_exit_epoch = 12004 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"]; + uint64 consolidation_balance_to_consume = 12005 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"]; + uint64 earliest_consolidation_epoch = 12006 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"]; + repeated PendingBalanceDeposit pending_balance_deposits = 12007 [(ethereum.eth.ext.ssz_max) = "pending_balance_deposits_limit"]; + repeated PendingPartialWithdrawal pending_partial_withdrawals = 12008 [(ethereum.eth.ext.ssz_max) = "pending_partial_withdrawals_limit"]; + repeated PendingConsolidation pending_consolidations = 12009 [(ethereum.eth.ext.ssz_max) = "pending_consolidations_limit"]; + // Fields introduced in ePBS fork [13001-14000] uint64 previous_inclusion_list_proposer = 13001 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; uint64 previous_inclusion_list_slot = 13002 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; @@ -468,7 +480,7 @@ message BeaconStateEPBS { bytes latest_block_hash = 13005 [(ethereum.eth.ext.ssz_size) = "32"]; uint64 latest_full_slot = 13006 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; ethereum.engine.v1.ExecutionPayloadHeaderEPBS execution_payload_header = 13007; - bytes latest_withdrawals_root = 13008 [(ethereum.eth.ext.ssz_size) = "32"]; + bytes last_withdrawals_root = 13008 [(ethereum.eth.ext.ssz_size) = "32"]; } diff --git a/proto/prysm/v1alpha1/generated.ssz.go b/proto/prysm/v1alpha1/generated.ssz.go index 8b5287bdc398..df58f061907b 100644 --- a/proto/prysm/v1alpha1/generated.ssz.go +++ b/proto/prysm/v1alpha1/generated.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 6d4d64999bdb99ed147e3ac5088f6ea550718311bbace9097827092f63a2feb7 +// Hash: 7ad11ee48b62a6ac97f56ed03ddf5c35e7b357817545820404363091b05c0b4b package eth import ( diff --git a/testing/util/random/BUILD.bazel b/testing/util/random/BUILD.bazel index c3d7b9595a4b..79cb163017a2 100644 --- a/testing/util/random/BUILD.bazel +++ b/testing/util/random/BUILD.bazel @@ -8,6 +8,7 @@ go_library( deps = [ "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", + "//math:go_default_library", "//proto/engine/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/testing/util/random/epbs.go b/testing/util/random/epbs.go index 4a26b75ac63f..d09c132c5c8a 100644 --- a/testing/util/random/epbs.go +++ b/testing/util/random/epbs.go @@ -230,6 +230,31 @@ func BeaconState(t *testing.T) *ethpb.BeaconStateEPBS { BlockSummaryRoot: randomBytes(32, t), StateSummaryRoot: randomBytes(32, t), }}, + DepositRequestsStartIndex: randomUint64(t), + DepositBalanceToConsume: primitives.Gwei(randomUint64(t)), + ExitBalanceToConsume: primitives.Gwei(randomUint64(t)), + EarliestExitEpoch: primitives.Epoch(randomUint64(t)), + ConsolidationBalanceToConsume: primitives.Gwei(randomUint64(t)), + EarliestConsolidationEpoch: primitives.Epoch(randomUint64(t)), + PendingBalanceDeposits: []*ethpb.PendingBalanceDeposit{ + { + Index: primitives.ValidatorIndex(randomUint64(t)), + Amount: randomUint64(t), + }, + }, + PendingPartialWithdrawals: []*ethpb.PendingPartialWithdrawal{ + { + Index: primitives.ValidatorIndex(randomUint64(t)), + Amount: randomUint64(t), + WithdrawableEpoch: primitives.Epoch(randomUint64(t)), + }, + }, + PendingConsolidations: []*ethpb.PendingConsolidation{ + { + SourceIndex: primitives.ValidatorIndex(randomUint64(t)), + TargetIndex: primitives.ValidatorIndex(randomUint64(t)), + }, + }, PreviousInclusionListProposer: primitives.ValidatorIndex(randomUint64(t)), PreviousInclusionListSlot: primitives.Slot(randomUint64(t)), LatestInclusionListProposer: primitives.ValidatorIndex(randomUint64(t)), @@ -245,7 +270,7 @@ func BeaconState(t *testing.T) *ethpb.BeaconStateEPBS { Value: randomUint64(t), BlobKzgCommitmentsRoot: randomBytes(32, t), }, - LatestWithdrawalsRoot: randomBytes(32, t), + LastWithdrawalsRoot: randomBytes(32, t), } }