From f31e8efe95c529225d1428b30cbebe937eb6e1ca Mon Sep 17 00:00:00 2001 From: Potuz Date: Mon, 14 Oct 2024 09:19:38 -0300 Subject: [PATCH] Remove inclusion list from epbs (#14188) --- beacon-chain/state/interfaces_epbs.go | 7 - .../state/state-native/beacon_state.go | 12 +- .../state/state-native/getters_epbs.go | 32 - .../state-native/getters_setters_epbs_test.go | 37 - .../state/state-native/getters_state.go | 12 +- beacon-chain/state/state-native/hasher.go | 16 - .../state/state-native/setters_epbs.go | 29 - beacon-chain/state/state-native/state_trie.go | 18 +- .../state/state-native/state_trie_epbs.go | 12 +- .../state-native/state_trie_epbs_test.go | 14 +- .../state/state-native/types/types.go | 32 +- config/fieldparams/mainnet.go | 1 - config/fieldparams/minimal.go | 1 - consensus-types/blocks/getters_epbs_test.go | 1 + consensus-types/blocks/proto_test.go | 1 + consensus-types/blocks/setters_test.go | 1 + proto/engine/v1/BUILD.bazel | 5 - proto/engine/v1/epbs.proto | 53 +- proto/prysm/v1alpha1/BUILD.bazel | 4 +- proto/prysm/v1alpha1/beacon_state.proto | 12 +- .../v1alpha1/blind_payload_envelope.proto | 3 - proto/prysm/v1alpha1/cloners.go | 1 + proto/prysm/v1alpha1/generated.ssz.go | 23493 ---------------- testing/util/random/epbs.go | 107 +- 24 files changed, 88 insertions(+), 23816 deletions(-) delete mode 100644 proto/prysm/v1alpha1/generated.ssz.go diff --git a/beacon-chain/state/interfaces_epbs.go b/beacon-chain/state/interfaces_epbs.go index 5f5edfcb98a1..9b73985fd727 100644 --- a/beacon-chain/state/interfaces_epbs.go +++ b/beacon-chain/state/interfaces_epbs.go @@ -6,10 +6,6 @@ import ( ) type ReadOnlyEpbsFields interface { - PreviousInclusionListSlot() primitives.Slot - PreviousInclusionListProposer() primitives.ValidatorIndex - LatestInclusionListSlot() primitives.Slot - LatestInclusionListProposer() primitives.ValidatorIndex IsParentBlockFull() bool ExecutionPayloadHeader() *enginev1.ExecutionPayloadHeaderEPBS LatestBlockHash() []byte @@ -19,9 +15,6 @@ type ReadOnlyEpbsFields interface { 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/beacon_state.go b/beacon-chain/state/state-native/beacon_state.go index ed0887342065..b3c8f3397816 100644 --- a/beacon-chain/state/state-native/beacon_state.go +++ b/beacon-chain/state/state-native/beacon_state.go @@ -60,14 +60,10 @@ type BeaconState struct { nextWithdrawalValidatorIndex primitives.ValidatorIndex historicalSummaries []*ethpb.HistoricalSummary // 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 + 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 index b5677c8a17a9..e2697422f97a 100644 --- a/beacon-chain/state/state-native/getters_epbs.go +++ b/beacon-chain/state/state-native/getters_epbs.go @@ -26,38 +26,6 @@ func (b *BeaconState) IsParentBlockFull() bool { 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() diff --git a/beacon-chain/state/state-native/getters_setters_epbs_test.go b/beacon-chain/state/state-native/getters_setters_epbs_test.go index 17980dc54eed..e60c87b28d56 100644 --- a/beacon-chain/state/state-native/getters_setters_epbs_test.go +++ b/beacon-chain/state/state-native/getters_setters_epbs_test.go @@ -33,43 +33,6 @@ func Test_SetExecutionPayloadHeader(t *testing.T) { 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) diff --git a/beacon-chain/state/state-native/getters_state.go b/beacon-chain/state/state-native/getters_state.go index 0d7596556d0f..8dd36a64f7c7 100644 --- a/beacon-chain/state/state-native/getters_state.go +++ b/beacon-chain/state/state-native/getters_state.go @@ -260,13 +260,9 @@ func (b *BeaconState) ToProtoUnsafe() interface{} { 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, + LatestExecutionPayloadHeader: b.executionPayloadHeader, LastWithdrawalsRoot: b.lastWithdrawalsRoot[:], } default: @@ -516,13 +512,9 @@ func (b *BeaconState) ToProto() interface{} { 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(), + LatestExecutionPayloadHeader: b.executionPayloadHeaderVal(), LastWithdrawalsRoot: lastWithdrawalsRootCopy[:], } default: diff --git a/beacon-chain/state/state-native/hasher.go b/beacon-chain/state/state-native/hasher.go index 07e8aa77a2fa..9df501906692 100644 --- a/beacon-chain/state/state-native/hasher.go +++ b/beacon-chain/state/state-native/hasher.go @@ -330,22 +330,6 @@ func ComputeFieldRootsWithHasher(ctx context.Context, state *BeaconState) ([][]b } 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 diff --git a/beacon-chain/state/state-native/setters_epbs.go b/beacon-chain/state/state-native/setters_epbs.go index 0a522dedef38..e986b8821764 100644 --- a/beacon-chain/state/state-native/setters_epbs.go +++ b/beacon-chain/state/state-native/setters_epbs.go @@ -16,35 +16,6 @@ func (b *BeaconState) SetExecutionPayloadHeader(h *enginev1.ExecutionPayloadHead 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() diff --git a/beacon-chain/state/state-native/state_trie.go b/beacon-chain/state/state-native/state_trie.go index 5d43e81ebb19..b24c20ff60a9 100644 --- a/beacon-chain/state/state-native/state_trie.go +++ b/beacon-chain/state/state-native/state_trie.go @@ -126,11 +126,7 @@ var epbsFields = append( types.PendingBalanceDeposits, types.PendingPartialWithdrawals, types.PendingConsolidations, - types.PreviousInclusionListProposer, // ePBS fields start here - types.PreviousInclusionListSlot, - types.LatestInclusionListProposer, - types.LatestInclusionListSlot, - types.LatestBlockHash, + types.LatestBlockHash, // ePBS fields start here types.LatestFullSlot, types.ExecutionPayloadHeader, types.LastWithdrawalsRoot, @@ -902,10 +898,6 @@ 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, @@ -1348,14 +1340,6 @@ 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: diff --git a/beacon-chain/state/state-native/state_trie_epbs.go b/beacon-chain/state/state-native/state_trie_epbs.go index 3c811fd8e9e6..5e9b4d867de2 100644 --- a/beacon-chain/state/state-native/state_trie_epbs.go +++ b/beacon-chain/state/state-native/state_trie_epbs.go @@ -64,14 +64,10 @@ func InitializeFromProtoUnsafeEpbs(st *ethpb.BeaconStateEPBS) (*BeaconState, err 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), + latestBlockHash: bytesutil.ToBytes32(st.LatestBlockHash), + latestFullSlot: st.LatestFullSlot, + executionPayloadHeader: st.LatestExecutionPayloadHeader, + lastWithdrawalsRoot: bytesutil.ToBytes32(st.LastWithdrawalsRoot), dirtyFields: make(map[types.FieldIndex]bool, fieldCount), dirtyIndices: make(map[types.FieldIndex][]uint64, fieldCount), diff --git a/beacon-chain/state/state-native/state_trie_epbs_test.go b/beacon-chain/state/state-native/state_trie_epbs_test.go index 97577eade066..71dc1ea3528b 100644 --- a/beacon-chain/state/state-native/state_trie_epbs_test.go +++ b/beacon-chain/state/state-native/state_trie_epbs_test.go @@ -12,27 +12,15 @@ 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 + header := st.LatestExecutionPayloadHeader 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() diff --git a/beacon-chain/state/state-native/types/types.go b/beacon-chain/state/state-native/types/types.go index 3841352c8207..7aaaceec33af 100644 --- a/beacon-chain/state/state-native/types/types.go +++ b/beacon-chain/state/state-native/types/types.go @@ -112,15 +112,7 @@ 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: + case LatestBlockHash: // ePBS fields start here return "LatestBlockHash" case LatestFullSlot: return "LatestFullSlot" @@ -211,15 +203,7 @@ 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: + case LatestBlockHash: // ePBS fields start here return 41 case LatestFullSlot: return 42 @@ -277,6 +261,11 @@ const ( LatestExecutionPayloadHeader LatestExecutionPayloadHeaderCapella LatestExecutionPayloadHeaderDeneb +<<<<<<< HEAD +======= + LatestExecutionPayloadHeaderElectra + ExecutionPayloadHeader +>>>>>>> 666b5c4cdb (Remove inclusion list from epbs (#14188)) NextWithdrawalIndex NextWithdrawalValidatorIndex HistoricalSummaries @@ -289,13 +278,8 @@ const ( PendingDeposits // Electra: EIP-7251 PendingPartialWithdrawals // Electra: EIP-7251 PendingConsolidations // Electra: EIP-7251 - PreviousInclusionListProposer // ePBS fields start here - PreviousInclusionListSlot - LatestInclusionListProposer - LatestInclusionListSlot - LatestBlockHash + LatestBlockHash // ePBS fields start here LatestFullSlot - ExecutionPayloadHeader LastWithdrawalsRoot ) diff --git a/config/fieldparams/mainnet.go b/config/fieldparams/mainnet.go index 798e462ba282..9f4bb72e2588 100644 --- a/config/fieldparams/mainnet.go +++ b/config/fieldparams/mainnet.go @@ -30,7 +30,6 @@ const ( MaxBlobsPerBlock = 6 // MaxBlobsPerBlock defines the maximum number of blobs with respect to consensus rule can be included in a block. MaxBlobCommitmentsPerBlock = 4096 // MaxBlobCommitmentsPerBlock defines the theoretical limit of blobs can be included in a block. MaxPayloadAttestationsPerBlock = 4 // MAX_PAYLOAD_ATTESTATIONS [New in ePBS] - MaxTransactionsPerInclusionList = 1024 // MAX_TRANSACTIONS_PER_INCLUSION_LIST [New in ePBS] LogMaxBlobCommitments = 12 // Log_2 of MaxBlobCommitmentsPerBlock BlobLength = 131072 // BlobLength defines the byte length of a blob. BlobSize = 131072 // defined to match blob.size in bazel ssz codegen diff --git a/config/fieldparams/minimal.go b/config/fieldparams/minimal.go index 19c0bbf1827e..f74b38431eb1 100644 --- a/config/fieldparams/minimal.go +++ b/config/fieldparams/minimal.go @@ -30,7 +30,6 @@ const ( MaxBlobsPerBlock = 6 // MaxBlobsPerBlock defines the maximum number of blobs with respect to consensus rule can be included in a block. MaxBlobCommitmentsPerBlock = 16 // MaxBlobCommitmentsPerBlock defines the theoretical limit of blobs can be included in a block. MaxPayloadAttestationsPerBlock = 4 // MAX_PAYLOAD_ATTESTATIONS [New in ePBS] - MaxTransactionsPerInclusionList = 16 // MAX_TRANSACTIONS_PER_INCLUSION_LIST [New in ePBS] LogMaxBlobCommitments = 4 // Log_2 of MaxBlobCommitmentsPerBlock BlobLength = 131072 // BlobLength defines the byte length of a blob. BlobSize = 131072 // defined to match blob.size in bazel ssz codegen diff --git a/consensus-types/blocks/getters_epbs_test.go b/consensus-types/blocks/getters_epbs_test.go index ccc8601191af..c2d75f4b1314 100644 --- a/consensus-types/blocks/getters_epbs_test.go +++ b/consensus-types/blocks/getters_epbs_test.go @@ -23,6 +23,7 @@ func Test_EpbsBlock_Copy(t *testing.T) { Slot: 2, Value: 3, BlobKzgCommitmentsRoot: bytesutil.PadTo([]byte("blobkzgcommitmentsroot"), fieldparams.RootLength), + GasLimit: 4, }, Signature: bytesutil.PadTo([]byte("signature"), fieldparams.BLSSignatureLength), } diff --git a/consensus-types/blocks/proto_test.go b/consensus-types/blocks/proto_test.go index 060e1564a908..e35333a8542c 100644 --- a/consensus-types/blocks/proto_test.go +++ b/consensus-types/blocks/proto_test.go @@ -1771,6 +1771,7 @@ func getFields() fields { Slot: 2, Value: 3, BlobKzgCommitmentsRoot: bytesutil.PadTo([]byte("blobkzgcommitmentsroot"), fieldparams.RootLength), + GasLimit: 4, }, Signature: bytesutil.PadTo([]byte("signature"), fieldparams.BLSSignatureLength), } diff --git a/consensus-types/blocks/setters_test.go b/consensus-types/blocks/setters_test.go index 40418106d2fa..961d165288dc 100644 --- a/consensus-types/blocks/setters_test.go +++ b/consensus-types/blocks/setters_test.go @@ -62,6 +62,7 @@ func Test_EpbsBlock_SetSignedExecutionPayloadHeader(t *testing.T) { Slot: 2, Value: 3, BlobKzgCommitmentsRoot: []byte("blobKzgCommitmentsRoot"), + GasLimit: 4, }, Signature: []byte("signature"), } diff --git a/proto/engine/v1/BUILD.bazel b/proto/engine/v1/BUILD.bazel index 830dd3853e80..8f78189ad372 100644 --- a/proto/engine/v1/BUILD.bazel +++ b/proto/engine/v1/BUILD.bazel @@ -45,12 +45,7 @@ ssz_gen_marshal( "PayloadAttestationData", "PayloadAttestation", "PayloadAttestationMessage", - "InclusionListSummaryEntry", - "InclusionListSummary", - "SignedInclusionListSummary", - "InclusionList", "ExecutionPayloadHeaderEPBS", - "ExecutionPayloadEPBS", "ExecutionPayloadEnvelope", "SignedExecutionPayloadHeader", "SignedExecutionPayloadEnvelope", diff --git a/proto/engine/v1/epbs.proto b/proto/engine/v1/epbs.proto index 42f0fcd62af9..3918d4fa8b77 100644 --- a/proto/engine/v1/epbs.proto +++ b/proto/engine/v1/epbs.proto @@ -25,53 +25,15 @@ option java_outer_classname = "ExecutionEngineProto"; option java_package = "org.ethereum.engine.v1"; option php_namespace = "Ethereum\\Engine\\v1"; -message InclusionListSummary { - uint64 proposer_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; - uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; - repeated bytes summary = 3 [(ethereum.eth.ext.ssz_size) = "?,20", (ethereum.eth.ext.ssz_max) = "max_inclusion_list.size"]; -} - -message SignedInclusionListSummary { - InclusionListSummary message = 1; - bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"]; -} - -message InclusionList { - SignedInclusionListSummary signed_summary = 1; - bytes parent_block_hash = 2 [(ethereum.eth.ext.ssz_size) = "32"]; - repeated bytes transactions = 3 [(ethereum.eth.ext.ssz_size) = "?,?", (ethereum.eth.ext.ssz_max) = "max_inclusion_list.size,1073741824"]; -} - message ExecutionPayloadHeaderEPBS { bytes parent_block_hash = 1 [(ethereum.eth.ext.ssz_size) = "32"]; bytes parent_block_root = 2 [(ethereum.eth.ext.ssz_size) = "32"]; bytes block_hash = 3 [(ethereum.eth.ext.ssz_size) = "32"]; - uint64 builder_index = 4 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; - uint64 slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; - uint64 value = 6; - bytes blob_kzg_commitments_root = 7 [(ethereum.eth.ext.ssz_size) = "32"]; -} - -message ExecutionPayloadEPBS { - bytes parent_hash = 1 [(ethereum.eth.ext.ssz_size) = "32"]; - bytes fee_recipient = 2 [(ethereum.eth.ext.ssz_size) = "20"]; - bytes state_root = 3 [(ethereum.eth.ext.ssz_size) = "32"]; - bytes receipts_root = 4 [(ethereum.eth.ext.ssz_size) = "32"]; - bytes logs_bloom = 5 [(ethereum.eth.ext.ssz_size) = "logs_bloom.size"]; - bytes prev_randao = 6 [(ethereum.eth.ext.ssz_size) = "32"]; - uint64 block_number = 7; - uint64 gas_limit = 8; - uint64 gas_used = 9; - uint64 timestamp = 10; - bytes extra_data = 11 [(ethereum.eth.ext.ssz_max) = "extra_data.size"]; - bytes base_fee_per_gas = 12 [(ethereum.eth.ext.ssz_size) = "32"]; - bytes block_hash = 13 [(ethereum.eth.ext.ssz_size) = "32"]; - repeated bytes transactions = 14 [(ethereum.eth.ext.ssz_size) = "?,?", (ethereum.eth.ext.ssz_max) = "1048576,1073741824"]; - repeated Withdrawal withdrawals = 15 [(ethereum.eth.ext.ssz_max) = "withdrawal.size"]; - uint64 blob_gas_used = 16; - uint64 excess_blob_gas = 17; - repeated bytes inclusion_list_summary = 18 [(ethereum.eth.ext.ssz_size) -= "?,20", (ethereum.eth.ext.ssz_max) = "max_inclusion_list.size"]; + uint64 gas_limit = 4; + uint64 builder_index = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; + uint64 slot = 6 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; + uint64 value = 7; + bytes blob_kzg_commitments_root = 8 [(ethereum.eth.ext.ssz_size) = "32"]; } message SignedExecutionPayloadHeader{ @@ -80,13 +42,10 @@ message SignedExecutionPayloadHeader{ } message ExecutionPayloadEnvelope { - ExecutionPayloadEPBS payload = 1; + ExecutionPayloadElectra payload = 1; uint64 builder_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; bytes beacon_block_root = 3 [(ethereum.eth.ext.ssz_size) = "32"]; repeated bytes blob_kzg_commitments = 4 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "max_blob_commitments.size"]; - uint64 inclusion_list_proposer_index = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; - uint64 inclusion_list_slot = 6 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; - bytes inclusion_list_signature = 7 [(ethereum.eth.ext.ssz_size) = "96"]; bool payload_withheld = 8; bytes state_root = 9 [(ethereum.eth.ext.ssz_size) = "32"]; } diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 491bf554699d..75e8bb97d96c 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -186,8 +186,6 @@ ssz_epbs_objs = [ "PayloadAttestationData", "PayloadAttestation", "PayloadAttestationMessage", - "BuilderBid", - "DepositSnapshot", "SignedBlindPayloadEnvelope", "BlindPayloadEnvelope", ] @@ -313,6 +311,8 @@ ssz_gen_marshal( "MetaDataV2", "SignedValidatorRegistrationV1", "ValidatorRegistrationV1", + "BuilderBid", + "DepositSnapshot", ], ) diff --git a/proto/prysm/v1alpha1/beacon_state.proto b/proto/prysm/v1alpha1/beacon_state.proto index 5ad94643d33c..f4fb357b90fa 100644 --- a/proto/prysm/v1alpha1/beacon_state.proto +++ b/proto/prysm/v1alpha1/beacon_state.proto @@ -454,6 +454,7 @@ message BeaconStateEPBS { // Fields introduced in Bellatrix fork [10001-11000] // ethereum.engine.v1.ExecutionPayloadHeaderDeneb latest_execution_payload_header = 10001; [Removed in ePBS] + ethereum.engine.v1.ExecutionPayloadHeaderEPBS latest_execution_payload_header = 10001; // Fields introduced in Capella fork [11001-12000] uint64 next_withdrawal_index = 11001; @@ -473,14 +474,9 @@ message BeaconStateEPBS { 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"]; - uint64 latest_inclusion_list_proposer = 13003 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; - uint64 latest_inclusion_list_slot = 13004 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; - 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 last_withdrawals_root = 13008 [(ethereum.eth.ext.ssz_size) = "32"]; + bytes latest_block_hash = 13001 [(ethereum.eth.ext.ssz_size) = "32"]; + uint64 latest_full_slot = 13002 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; + bytes last_withdrawals_root = 13003 [(ethereum.eth.ext.ssz_size) = "32"]; } diff --git a/proto/prysm/v1alpha1/blind_payload_envelope.proto b/proto/prysm/v1alpha1/blind_payload_envelope.proto index 0af31d5ac36f..c1d4bb91346b 100644 --- a/proto/prysm/v1alpha1/blind_payload_envelope.proto +++ b/proto/prysm/v1alpha1/blind_payload_envelope.proto @@ -34,9 +34,6 @@ message BlindPayloadEnvelope { uint64 builder_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; bytes beacon_block_root = 3 [(ethereum.eth.ext.ssz_size) = "32"]; repeated bytes blob_kzg_commitments = 4 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "max_blob_commitments.size"]; - uint64 inclusion_list_proposer_index = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"]; - uint64 inclusion_list_slot = 6 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; - bytes inclusion_list_signature = 7 [(ethereum.eth.ext.ssz_size) = "96"]; bool payload_withheld = 8; bytes state_root = 9 [(ethereum.eth.ext.ssz_size) = "32"]; } diff --git a/proto/prysm/v1alpha1/cloners.go b/proto/prysm/v1alpha1/cloners.go index cab06adbaa59..9cfeb6396616 100644 --- a/proto/prysm/v1alpha1/cloners.go +++ b/proto/prysm/v1alpha1/cloners.go @@ -133,6 +133,7 @@ func CopyExecutionPayloadHeaderEPBS(payload *enginev1.ExecutionPayloadHeaderEPBS Slot: payload.Slot, Value: payload.Value, BlobKzgCommitmentsRoot: bytesutil.SafeCopyBytes(payload.BlobKzgCommitmentsRoot), + GasLimit: payload.GasLimit, } } diff --git a/proto/prysm/v1alpha1/generated.ssz.go b/proto/prysm/v1alpha1/generated.ssz.go deleted file mode 100644 index 29781e6da263..000000000000 --- a/proto/prysm/v1alpha1/generated.ssz.go +++ /dev/null @@ -1,23493 +0,0 @@ -// Code generated by fastssz. DO NOT EDIT. -// Hash: 6032ce00da94bec6155432e7b3b1834f1559d4d51ee0e30104552bc89106e344 -package eth - -import ( - ssz "github.com/prysmaticlabs/fastssz" - github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" - v1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" -) - -// MarshalSSZ ssz marshals the Attestation object -func (a *Attestation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the Attestation object to a target array -func (a *Attestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(228) - - // Offset (0) 'AggregationBits' - dst = ssz.WriteOffset(dst, offset) - offset += len(a.AggregationBits) - - // Field (1) 'Data' - if a.Data == nil { - a.Data = new(AttestationData) - } - if dst, err = a.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(a.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, a.Signature...) - - // Field (0) 'AggregationBits' - if size := len(a.AggregationBits); size > 2048 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 2048) - return - } - dst = append(dst, a.AggregationBits...) - - return -} - -// UnmarshalSSZ ssz unmarshals the Attestation object -func (a *Attestation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 228 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AggregationBits' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 228 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if a.Data == nil { - a.Data = new(AttestationData) - } - if err = a.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'Signature' - if cap(a.Signature) == 0 { - a.Signature = make([]byte, 0, len(buf[132:228])) - } - a.Signature = append(a.Signature, buf[132:228]...) - - // Field (0) 'AggregationBits' - { - buf = tail[o0:] - if err = ssz.ValidateBitlist(buf, 2048); err != nil { - return err - } - if cap(a.AggregationBits) == 0 { - a.AggregationBits = make([]byte, 0, len(buf)) - } - a.AggregationBits = append(a.AggregationBits, buf...) - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Attestation object -func (a *Attestation) SizeSSZ() (size int) { - size = 228 - - // Field (0) 'AggregationBits' - size += len(a.AggregationBits) - - return -} - -// HashTreeRoot ssz hashes the Attestation object -func (a *Attestation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the Attestation object with a hasher -func (a *Attestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregationBits' - if len(a.AggregationBits) == 0 { - err = ssz.ErrEmptyBitlist - return - } - hh.PutBitlist(a.AggregationBits, 2048) - - // Field (1) 'Data' - if err = a.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(a.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(a.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AttestationElectra object -func (a *AttestationElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AttestationElectra object to a target array -func (a *AttestationElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(236) - - // Offset (0) 'AggregationBits' - dst = ssz.WriteOffset(dst, offset) - offset += len(a.AggregationBits) - - // Field (1) 'Data' - if a.Data == nil { - a.Data = new(AttestationData) - } - if dst, err = a.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'CommitteeBits' - if size := len(a.CommitteeBits); size != 8 { - err = ssz.ErrBytesLengthFn("--.CommitteeBits", size, 8) - return - } - dst = append(dst, a.CommitteeBits...) - - // Field (3) 'Signature' - if size := len(a.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, a.Signature...) - - // Field (0) 'AggregationBits' - if size := len(a.AggregationBits); size > 131072 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 131072) - return - } - dst = append(dst, a.AggregationBits...) - - return -} - -// UnmarshalSSZ ssz unmarshals the AttestationElectra object -func (a *AttestationElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 236 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AggregationBits' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 236 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if a.Data == nil { - a.Data = new(AttestationData) - } - if err = a.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'CommitteeBits' - if cap(a.CommitteeBits) == 0 { - a.CommitteeBits = make([]byte, 0, len(buf[132:140])) - } - a.CommitteeBits = append(a.CommitteeBits, buf[132:140]...) - - // Field (3) 'Signature' - if cap(a.Signature) == 0 { - a.Signature = make([]byte, 0, len(buf[140:236])) - } - a.Signature = append(a.Signature, buf[140:236]...) - - // Field (0) 'AggregationBits' - { - buf = tail[o0:] - if err = ssz.ValidateBitlist(buf, 131072); err != nil { - return err - } - if cap(a.AggregationBits) == 0 { - a.AggregationBits = make([]byte, 0, len(buf)) - } - a.AggregationBits = append(a.AggregationBits, buf...) - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AttestationElectra object -func (a *AttestationElectra) SizeSSZ() (size int) { - size = 236 - - // Field (0) 'AggregationBits' - size += len(a.AggregationBits) - - return -} - -// HashTreeRoot ssz hashes the AttestationElectra object -func (a *AttestationElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AttestationElectra object with a hasher -func (a *AttestationElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregationBits' - if len(a.AggregationBits) == 0 { - err = ssz.ErrEmptyBitlist - return - } - hh.PutBitlist(a.AggregationBits, 131072) - - // Field (1) 'Data' - if err = a.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'CommitteeBits' - if size := len(a.CommitteeBits); size != 8 { - err = ssz.ErrBytesLengthFn("--.CommitteeBits", size, 8) - return - } - hh.PutBytes(a.CommitteeBits) - - // Field (3) 'Signature' - if size := len(a.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(a.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AggregateAttestationAndProof object -func (a *AggregateAttestationAndProof) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AggregateAttestationAndProof object to a target array -func (a *AggregateAttestationAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(108) - - // Field (0) 'AggregatorIndex' - dst = ssz.MarshalUint64(dst, uint64(a.AggregatorIndex)) - - // Offset (1) 'Aggregate' - dst = ssz.WriteOffset(dst, offset) - if a.Aggregate == nil { - a.Aggregate = new(Attestation) - } - offset += a.Aggregate.SizeSSZ() - - // Field (2) 'SelectionProof' - if size := len(a.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - dst = append(dst, a.SelectionProof...) - - // Field (1) 'Aggregate' - if dst, err = a.Aggregate.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AggregateAttestationAndProof object -func (a *AggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 108 { - return ssz.ErrSize - } - - tail := buf - var o1 uint64 - - // Field (0) 'AggregatorIndex' - a.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Offset (1) 'Aggregate' - if o1 = ssz.ReadOffset(buf[8:12]); o1 > size { - return ssz.ErrOffset - } - - if o1 < 108 { - return ssz.ErrInvalidVariableOffset - } - - // Field (2) 'SelectionProof' - if cap(a.SelectionProof) == 0 { - a.SelectionProof = make([]byte, 0, len(buf[12:108])) - } - a.SelectionProof = append(a.SelectionProof, buf[12:108]...) - - // Field (1) 'Aggregate' - { - buf = tail[o1:] - if a.Aggregate == nil { - a.Aggregate = new(Attestation) - } - if err = a.Aggregate.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AggregateAttestationAndProof object -func (a *AggregateAttestationAndProof) SizeSSZ() (size int) { - size = 108 - - // Field (1) 'Aggregate' - if a.Aggregate == nil { - a.Aggregate = new(Attestation) - } - size += a.Aggregate.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the AggregateAttestationAndProof object -func (a *AggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AggregateAttestationAndProof object with a hasher -func (a *AggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregatorIndex' - hh.PutUint64(uint64(a.AggregatorIndex)) - - // Field (1) 'Aggregate' - if err = a.Aggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'SelectionProof' - if size := len(a.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - hh.PutBytes(a.SelectionProof) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AggregateAttestationAndProofElectra object -func (a *AggregateAttestationAndProofElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AggregateAttestationAndProofElectra object to a target array -func (a *AggregateAttestationAndProofElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(108) - - // Field (0) 'AggregatorIndex' - dst = ssz.MarshalUint64(dst, uint64(a.AggregatorIndex)) - - // Offset (1) 'Aggregate' - dst = ssz.WriteOffset(dst, offset) - if a.Aggregate == nil { - a.Aggregate = new(AttestationElectra) - } - offset += a.Aggregate.SizeSSZ() - - // Field (2) 'SelectionProof' - if size := len(a.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - dst = append(dst, a.SelectionProof...) - - // Field (1) 'Aggregate' - if dst, err = a.Aggregate.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AggregateAttestationAndProofElectra object -func (a *AggregateAttestationAndProofElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 108 { - return ssz.ErrSize - } - - tail := buf - var o1 uint64 - - // Field (0) 'AggregatorIndex' - a.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Offset (1) 'Aggregate' - if o1 = ssz.ReadOffset(buf[8:12]); o1 > size { - return ssz.ErrOffset - } - - if o1 < 108 { - return ssz.ErrInvalidVariableOffset - } - - // Field (2) 'SelectionProof' - if cap(a.SelectionProof) == 0 { - a.SelectionProof = make([]byte, 0, len(buf[12:108])) - } - a.SelectionProof = append(a.SelectionProof, buf[12:108]...) - - // Field (1) 'Aggregate' - { - buf = tail[o1:] - if a.Aggregate == nil { - a.Aggregate = new(AttestationElectra) - } - if err = a.Aggregate.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AggregateAttestationAndProofElectra object -func (a *AggregateAttestationAndProofElectra) SizeSSZ() (size int) { - size = 108 - - // Field (1) 'Aggregate' - if a.Aggregate == nil { - a.Aggregate = new(AttestationElectra) - } - size += a.Aggregate.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the AggregateAttestationAndProofElectra object -func (a *AggregateAttestationAndProofElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AggregateAttestationAndProofElectra object with a hasher -func (a *AggregateAttestationAndProofElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregatorIndex' - hh.PutUint64(uint64(a.AggregatorIndex)) - - // Field (1) 'Aggregate' - if err = a.Aggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'SelectionProof' - if size := len(a.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - hh.PutBytes(a.SelectionProof) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedAggregateAttestationAndProof object -func (s *SignedAggregateAttestationAndProof) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedAggregateAttestationAndProof object to a target array -func (s *SignedAggregateAttestationAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(AggregateAttestationAndProof) - } - offset += s.Message.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedAggregateAttestationAndProof object -func (s *SignedAggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(AggregateAttestationAndProof) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedAggregateAttestationAndProof object -func (s *SignedAggregateAttestationAndProof) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(AggregateAttestationAndProof) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedAggregateAttestationAndProof object -func (s *SignedAggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedAggregateAttestationAndProof object with a hasher -func (s *SignedAggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedAggregateAttestationAndProofElectra object -func (s *SignedAggregateAttestationAndProofElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedAggregateAttestationAndProofElectra object to a target array -func (s *SignedAggregateAttestationAndProofElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(AggregateAttestationAndProofElectra) - } - offset += s.Message.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedAggregateAttestationAndProofElectra object -func (s *SignedAggregateAttestationAndProofElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(AggregateAttestationAndProofElectra) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedAggregateAttestationAndProofElectra object -func (s *SignedAggregateAttestationAndProofElectra) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(AggregateAttestationAndProofElectra) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedAggregateAttestationAndProofElectra object -func (s *SignedAggregateAttestationAndProofElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedAggregateAttestationAndProofElectra object with a hasher -func (s *SignedAggregateAttestationAndProofElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AttestationData object -func (a *AttestationData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AttestationData object to a target array -func (a *AttestationData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(a.Slot)) - - // Field (1) 'CommitteeIndex' - dst = ssz.MarshalUint64(dst, uint64(a.CommitteeIndex)) - - // Field (2) 'BeaconBlockRoot' - if size := len(a.BeaconBlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) - return - } - dst = append(dst, a.BeaconBlockRoot...) - - // Field (3) 'Source' - if a.Source == nil { - a.Source = new(Checkpoint) - } - if dst, err = a.Source.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'Target' - if a.Target == nil { - a.Target = new(Checkpoint) - } - if dst, err = a.Target.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AttestationData object -func (a *AttestationData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 128 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - a.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'CommitteeIndex' - a.CommitteeIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.CommitteeIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'BeaconBlockRoot' - if cap(a.BeaconBlockRoot) == 0 { - a.BeaconBlockRoot = make([]byte, 0, len(buf[16:48])) - } - a.BeaconBlockRoot = append(a.BeaconBlockRoot, buf[16:48]...) - - // Field (3) 'Source' - if a.Source == nil { - a.Source = new(Checkpoint) - } - if err = a.Source.UnmarshalSSZ(buf[48:88]); err != nil { - return err - } - - // Field (4) 'Target' - if a.Target == nil { - a.Target = new(Checkpoint) - } - if err = a.Target.UnmarshalSSZ(buf[88:128]); err != nil { - return err - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AttestationData object -func (a *AttestationData) SizeSSZ() (size int) { - size = 128 - return -} - -// HashTreeRoot ssz hashes the AttestationData object -func (a *AttestationData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AttestationData object with a hasher -func (a *AttestationData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(a.Slot)) - - // Field (1) 'CommitteeIndex' - hh.PutUint64(uint64(a.CommitteeIndex)) - - // Field (2) 'BeaconBlockRoot' - if size := len(a.BeaconBlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) - return - } - hh.PutBytes(a.BeaconBlockRoot) - - // Field (3) 'Source' - if err = a.Source.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'Target' - if err = a.Target.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Checkpoint object -func (c *Checkpoint) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(c) -} - -// MarshalSSZTo ssz marshals the Checkpoint object to a target array -func (c *Checkpoint) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Epoch' - dst = ssz.MarshalUint64(dst, uint64(c.Epoch)) - - // Field (1) 'Root' - if size := len(c.Root); size != 32 { - err = ssz.ErrBytesLengthFn("--.Root", size, 32) - return - } - dst = append(dst, c.Root...) - - return -} - -// UnmarshalSSZ ssz unmarshals the Checkpoint object -func (c *Checkpoint) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 40 { - return ssz.ErrSize - } - - // Field (0) 'Epoch' - c.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Root' - if cap(c.Root) == 0 { - c.Root = make([]byte, 0, len(buf[8:40])) - } - c.Root = append(c.Root, buf[8:40]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Checkpoint object -func (c *Checkpoint) SizeSSZ() (size int) { - size = 40 - return -} - -// HashTreeRoot ssz hashes the Checkpoint object -func (c *Checkpoint) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(c) -} - -// HashTreeRootWith ssz hashes the Checkpoint object with a hasher -func (c *Checkpoint) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Epoch' - hh.PutUint64(uint64(c.Epoch)) - - // Field (1) 'Root' - if size := len(c.Root); size != 32 { - err = ssz.ErrBytesLengthFn("--.Root", size, 32) - return - } - hh.PutBytes(c.Root) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlock object -func (b *BeaconBlock) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlock object to a target array -func (b *BeaconBlock) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BeaconBlockBody) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlock object -func (b *BeaconBlock) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BeaconBlockBody) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlock object -func (b *BeaconBlock) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBody) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlock object -func (b *BeaconBlock) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlock object with a hasher -func (b *BeaconBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlock object -func (s *SignedBeaconBlock) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlock object to a target array -func (s *SignedBeaconBlock) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BeaconBlock) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlock object -func (s *SignedBeaconBlock) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BeaconBlock) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlock object -func (s *SignedBeaconBlock) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlock) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlock object -func (s *SignedBeaconBlock) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlock object with a hasher -func (s *SignedBeaconBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockAltair object -func (b *BeaconBlockAltair) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockAltair object to a target array -func (b *BeaconBlockAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BeaconBlockBodyAltair) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockAltair object -func (b *BeaconBlockAltair) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BeaconBlockBodyAltair) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockAltair object -func (b *BeaconBlockAltair) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyAltair) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockAltair object -func (b *BeaconBlockAltair) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockAltair object with a hasher -func (b *BeaconBlockAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockAltair object -func (s *SignedBeaconBlockAltair) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockAltair object to a target array -func (s *SignedBeaconBlockAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BeaconBlockAltair) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockAltair object -func (s *SignedBeaconBlockAltair) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BeaconBlockAltair) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockAltair object -func (s *SignedBeaconBlockAltair) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockAltair) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockAltair object -func (s *SignedBeaconBlockAltair) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockAltair object with a hasher -func (s *SignedBeaconBlockAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBody object -func (b *BeaconBlockBody) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBody object to a target array -func (b *BeaconBlockBody) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(220) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBody object -func (b *BeaconBlockBody) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 220 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 220 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBody object -func (b *BeaconBlockBody) SizeSSZ() (size int) { - size = 220 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBody object -func (b *BeaconBlockBody) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBody object with a hasher -func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBodyAltair object -func (b *BeaconBlockBodyAltair) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyAltair object to a target array -func (b *BeaconBlockBodyAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(380) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyAltair object -func (b *BeaconBlockBodyAltair) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 380 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 380 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyAltair object -func (b *BeaconBlockBodyAltair) SizeSSZ() (size int) { - size = 380 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyAltair object -func (b *BeaconBlockBodyAltair) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyAltair object with a hasher -func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ProposerSlashing object -func (p *ProposerSlashing) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the ProposerSlashing object to a target array -func (p *ProposerSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Header_1' - if p.Header_1 == nil { - p.Header_1 = new(SignedBeaconBlockHeader) - } - if dst, err = p.Header_1.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Header_2' - if p.Header_2 == nil { - p.Header_2 = new(SignedBeaconBlockHeader) - } - if dst, err = p.Header_2.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the ProposerSlashing object -func (p *ProposerSlashing) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 416 { - return ssz.ErrSize - } - - // Field (0) 'Header_1' - if p.Header_1 == nil { - p.Header_1 = new(SignedBeaconBlockHeader) - } - if err = p.Header_1.UnmarshalSSZ(buf[0:208]); err != nil { - return err - } - - // Field (1) 'Header_2' - if p.Header_2 == nil { - p.Header_2 = new(SignedBeaconBlockHeader) - } - if err = p.Header_2.UnmarshalSSZ(buf[208:416]); err != nil { - return err - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ProposerSlashing object -func (p *ProposerSlashing) SizeSSZ() (size int) { - size = 416 - return -} - -// HashTreeRoot ssz hashes the ProposerSlashing object -func (p *ProposerSlashing) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the ProposerSlashing object with a hasher -func (p *ProposerSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header_1' - if err = p.Header_1.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Header_2' - if err = p.Header_2.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AttesterSlashing object -func (a *AttesterSlashing) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AttesterSlashing object to a target array -func (a *AttesterSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(8) - - // Offset (0) 'Attestation_1' - dst = ssz.WriteOffset(dst, offset) - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestation) - } - offset += a.Attestation_1.SizeSSZ() - - // Offset (1) 'Attestation_2' - dst = ssz.WriteOffset(dst, offset) - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestation) - } - offset += a.Attestation_2.SizeSSZ() - - // Field (0) 'Attestation_1' - if dst, err = a.Attestation_1.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Attestation_2' - if dst, err = a.Attestation_2.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AttesterSlashing object -func (a *AttesterSlashing) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 8 { - return ssz.ErrSize - } - - tail := buf - var o0, o1 uint64 - - // Offset (0) 'Attestation_1' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 8 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'Attestation_2' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Field (0) 'Attestation_1' - { - buf = tail[o0:o1] - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestation) - } - if err = a.Attestation_1.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'Attestation_2' - { - buf = tail[o1:] - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestation) - } - if err = a.Attestation_2.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AttesterSlashing object -func (a *AttesterSlashing) SizeSSZ() (size int) { - size = 8 - - // Field (0) 'Attestation_1' - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestation) - } - size += a.Attestation_1.SizeSSZ() - - // Field (1) 'Attestation_2' - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestation) - } - size += a.Attestation_2.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the AttesterSlashing object -func (a *AttesterSlashing) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AttesterSlashing object with a hasher -func (a *AttesterSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Attestation_1' - if err = a.Attestation_1.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Attestation_2' - if err = a.Attestation_2.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AttesterSlashingElectra object -func (a *AttesterSlashingElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AttesterSlashingElectra object to a target array -func (a *AttesterSlashingElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(8) - - // Offset (0) 'Attestation_1' - dst = ssz.WriteOffset(dst, offset) - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestationElectra) - } - offset += a.Attestation_1.SizeSSZ() - - // Offset (1) 'Attestation_2' - dst = ssz.WriteOffset(dst, offset) - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestationElectra) - } - offset += a.Attestation_2.SizeSSZ() - - // Field (0) 'Attestation_1' - if dst, err = a.Attestation_1.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Attestation_2' - if dst, err = a.Attestation_2.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AttesterSlashingElectra object -func (a *AttesterSlashingElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 8 { - return ssz.ErrSize - } - - tail := buf - var o0, o1 uint64 - - // Offset (0) 'Attestation_1' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 8 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'Attestation_2' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Field (0) 'Attestation_1' - { - buf = tail[o0:o1] - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestationElectra) - } - if err = a.Attestation_1.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'Attestation_2' - { - buf = tail[o1:] - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestationElectra) - } - if err = a.Attestation_2.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AttesterSlashingElectra object -func (a *AttesterSlashingElectra) SizeSSZ() (size int) { - size = 8 - - // Field (0) 'Attestation_1' - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestationElectra) - } - size += a.Attestation_1.SizeSSZ() - - // Field (1) 'Attestation_2' - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestationElectra) - } - size += a.Attestation_2.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the AttesterSlashingElectra object -func (a *AttesterSlashingElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AttesterSlashingElectra object with a hasher -func (a *AttesterSlashingElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Attestation_1' - if err = a.Attestation_1.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Attestation_2' - if err = a.Attestation_2.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Deposit object -func (d *Deposit) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(d) -} - -// MarshalSSZTo ssz marshals the Deposit object to a target array -func (d *Deposit) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Proof' - if size := len(d.Proof); size != 33 { - err = ssz.ErrVectorLengthFn("--.Proof", size, 33) - return - } - for ii := 0; ii < 33; ii++ { - if size := len(d.Proof[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.Proof[ii]", size, 32) - return - } - dst = append(dst, d.Proof[ii]...) - } - - // Field (1) 'Data' - if d.Data == nil { - d.Data = new(Deposit_Data) - } - if dst, err = d.Data.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the Deposit object -func (d *Deposit) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 1240 { - return ssz.ErrSize - } - - // Field (0) 'Proof' - d.Proof = make([][]byte, 33) - for ii := 0; ii < 33; ii++ { - if cap(d.Proof[ii]) == 0 { - d.Proof[ii] = make([]byte, 0, len(buf[0:1056][ii*32:(ii+1)*32])) - } - d.Proof[ii] = append(d.Proof[ii], buf[0:1056][ii*32:(ii+1)*32]...) - } - - // Field (1) 'Data' - if d.Data == nil { - d.Data = new(Deposit_Data) - } - if err = d.Data.UnmarshalSSZ(buf[1056:1240]); err != nil { - return err - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Deposit object -func (d *Deposit) SizeSSZ() (size int) { - size = 1240 - return -} - -// HashTreeRoot ssz hashes the Deposit object -func (d *Deposit) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(d) -} - -// HashTreeRootWith ssz hashes the Deposit object with a hasher -func (d *Deposit) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Proof' - { - if size := len(d.Proof); size != 33 { - err = ssz.ErrVectorLengthFn("--.Proof", size, 33) - return - } - subIndx := hh.Index() - for _, i := range d.Proof { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (1) 'Data' - if err = d.Data.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the VoluntaryExit object -func (v *VoluntaryExit) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(v) -} - -// MarshalSSZTo ssz marshals the VoluntaryExit object to a target array -func (v *VoluntaryExit) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Epoch' - dst = ssz.MarshalUint64(dst, uint64(v.Epoch)) - - // Field (1) 'ValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(v.ValidatorIndex)) - - return -} - -// UnmarshalSSZ ssz unmarshals the VoluntaryExit object -func (v *VoluntaryExit) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'Epoch' - v.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ValidatorIndex' - v.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the VoluntaryExit object -func (v *VoluntaryExit) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the VoluntaryExit object -func (v *VoluntaryExit) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(v) -} - -// HashTreeRootWith ssz hashes the VoluntaryExit object with a hasher -func (v *VoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Epoch' - hh.PutUint64(uint64(v.Epoch)) - - // Field (1) 'ValidatorIndex' - hh.PutUint64(uint64(v.ValidatorIndex)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedVoluntaryExit object -func (s *SignedVoluntaryExit) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedVoluntaryExit object to a target array -func (s *SignedVoluntaryExit) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Exit' - if s.Exit == nil { - s.Exit = new(VoluntaryExit) - } - if dst, err = s.Exit.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedVoluntaryExit object -func (s *SignedVoluntaryExit) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 112 { - return ssz.ErrSize - } - - // Field (0) 'Exit' - if s.Exit == nil { - s.Exit = new(VoluntaryExit) - } - if err = s.Exit.UnmarshalSSZ(buf[0:16]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[16:112])) - } - s.Signature = append(s.Signature, buf[16:112]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedVoluntaryExit object -func (s *SignedVoluntaryExit) SizeSSZ() (size int) { - size = 112 - return -} - -// HashTreeRoot ssz hashes the SignedVoluntaryExit object -func (s *SignedVoluntaryExit) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedVoluntaryExit object with a hasher -func (s *SignedVoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Exit' - if err = s.Exit.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Eth1Data object -func (e *Eth1Data) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(e) -} - -// MarshalSSZTo ssz marshals the Eth1Data object to a target array -func (e *Eth1Data) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'DepositRoot' - if size := len(e.DepositRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) - return - } - dst = append(dst, e.DepositRoot...) - - // Field (1) 'DepositCount' - dst = ssz.MarshalUint64(dst, e.DepositCount) - - // Field (2) 'BlockHash' - if size := len(e.BlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) - return - } - dst = append(dst, e.BlockHash...) - - return -} - -// UnmarshalSSZ ssz unmarshals the Eth1Data object -func (e *Eth1Data) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 72 { - return ssz.ErrSize - } - - // Field (0) 'DepositRoot' - if cap(e.DepositRoot) == 0 { - e.DepositRoot = make([]byte, 0, len(buf[0:32])) - } - e.DepositRoot = append(e.DepositRoot, buf[0:32]...) - - // Field (1) 'DepositCount' - e.DepositCount = ssz.UnmarshallUint64(buf[32:40]) - - // Field (2) 'BlockHash' - if cap(e.BlockHash) == 0 { - e.BlockHash = make([]byte, 0, len(buf[40:72])) - } - e.BlockHash = append(e.BlockHash, buf[40:72]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Eth1Data object -func (e *Eth1Data) SizeSSZ() (size int) { - size = 72 - return -} - -// HashTreeRoot ssz hashes the Eth1Data object -func (e *Eth1Data) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(e) -} - -// HashTreeRootWith ssz hashes the Eth1Data object with a hasher -func (e *Eth1Data) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'DepositRoot' - if size := len(e.DepositRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) - return - } - hh.PutBytes(e.DepositRoot) - - // Field (1) 'DepositCount' - hh.PutUint64(e.DepositCount) - - // Field (2) 'BlockHash' - if size := len(e.BlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) - return - } - hh.PutBytes(e.BlockHash) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockHeader object -func (b *BeaconBlockHeader) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockHeader object to a target array -func (b *BeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Field (4) 'BodyRoot' - if size := len(b.BodyRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BodyRoot", size, 32) - return - } - dst = append(dst, b.BodyRoot...) - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockHeader object -func (b *BeaconBlockHeader) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 112 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Field (4) 'BodyRoot' - if cap(b.BodyRoot) == 0 { - b.BodyRoot = make([]byte, 0, len(buf[80:112])) - } - b.BodyRoot = append(b.BodyRoot, buf[80:112]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockHeader object -func (b *BeaconBlockHeader) SizeSSZ() (size int) { - size = 112 - return -} - -// HashTreeRoot ssz hashes the BeaconBlockHeader object -func (b *BeaconBlockHeader) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockHeader object with a hasher -func (b *BeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'BodyRoot' - if size := len(b.BodyRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BodyRoot", size, 32) - return - } - hh.PutBytes(b.BodyRoot) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockHeader object -func (s *SignedBeaconBlockHeader) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockHeader object to a target array -func (s *SignedBeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Header' - if s.Header == nil { - s.Header = new(BeaconBlockHeader) - } - if dst, err = s.Header.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockHeader object -func (s *SignedBeaconBlockHeader) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 208 { - return ssz.ErrSize - } - - // Field (0) 'Header' - if s.Header == nil { - s.Header = new(BeaconBlockHeader) - } - if err = s.Header.UnmarshalSSZ(buf[0:112]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[112:208])) - } - s.Signature = append(s.Signature, buf[112:208]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockHeader object -func (s *SignedBeaconBlockHeader) SizeSSZ() (size int) { - size = 208 - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockHeader object -func (s *SignedBeaconBlockHeader) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockHeader object with a hasher -func (s *SignedBeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header' - if err = s.Header.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the IndexedAttestation object -func (i *IndexedAttestation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(i) -} - -// MarshalSSZTo ssz marshals the IndexedAttestation object to a target array -func (i *IndexedAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(228) - - // Offset (0) 'AttestingIndices' - dst = ssz.WriteOffset(dst, offset) - offset += len(i.AttestingIndices) * 8 - - // Field (1) 'Data' - if i.Data == nil { - i.Data = new(AttestationData) - } - if dst, err = i.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(i.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, i.Signature...) - - // Field (0) 'AttestingIndices' - if size := len(i.AttestingIndices); size > 2048 { - err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 2048) - return - } - for ii := 0; ii < len(i.AttestingIndices); ii++ { - dst = ssz.MarshalUint64(dst, i.AttestingIndices[ii]) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the IndexedAttestation object -func (i *IndexedAttestation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 228 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AttestingIndices' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 228 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if i.Data == nil { - i.Data = new(AttestationData) - } - if err = i.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'Signature' - if cap(i.Signature) == 0 { - i.Signature = make([]byte, 0, len(buf[132:228])) - } - i.Signature = append(i.Signature, buf[132:228]...) - - // Field (0) 'AttestingIndices' - { - buf = tail[o0:] - num, err := ssz.DivideInt2(len(buf), 8, 2048) - if err != nil { - return err - } - i.AttestingIndices = ssz.ExtendUint64(i.AttestingIndices, num) - for ii := 0; ii < num; ii++ { - i.AttestingIndices[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the IndexedAttestation object -func (i *IndexedAttestation) SizeSSZ() (size int) { - size = 228 - - // Field (0) 'AttestingIndices' - size += len(i.AttestingIndices) * 8 - - return -} - -// HashTreeRoot ssz hashes the IndexedAttestation object -func (i *IndexedAttestation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(i) -} - -// HashTreeRootWith ssz hashes the IndexedAttestation object with a hasher -func (i *IndexedAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AttestingIndices' - { - if size := len(i.AttestingIndices); size > 2048 { - err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 2048) - return - } - subIndx := hh.Index() - for _, i := range i.AttestingIndices { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(i.AttestingIndices)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8)) - } - } - - // Field (1) 'Data' - if err = i.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(i.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(i.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the IndexedAttestationElectra object -func (i *IndexedAttestationElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(i) -} - -// MarshalSSZTo ssz marshals the IndexedAttestationElectra object to a target array -func (i *IndexedAttestationElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(228) - - // Offset (0) 'AttestingIndices' - dst = ssz.WriteOffset(dst, offset) - offset += len(i.AttestingIndices) * 8 - - // Field (1) 'Data' - if i.Data == nil { - i.Data = new(AttestationData) - } - if dst, err = i.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(i.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, i.Signature...) - - // Field (0) 'AttestingIndices' - if size := len(i.AttestingIndices); size > 131072 { - err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 131072) - return - } - for ii := 0; ii < len(i.AttestingIndices); ii++ { - dst = ssz.MarshalUint64(dst, i.AttestingIndices[ii]) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the IndexedAttestationElectra object -func (i *IndexedAttestationElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 228 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AttestingIndices' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 228 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if i.Data == nil { - i.Data = new(AttestationData) - } - if err = i.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'Signature' - if cap(i.Signature) == 0 { - i.Signature = make([]byte, 0, len(buf[132:228])) - } - i.Signature = append(i.Signature, buf[132:228]...) - - // Field (0) 'AttestingIndices' - { - buf = tail[o0:] - num, err := ssz.DivideInt2(len(buf), 8, 131072) - if err != nil { - return err - } - i.AttestingIndices = ssz.ExtendUint64(i.AttestingIndices, num) - for ii := 0; ii < num; ii++ { - i.AttestingIndices[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the IndexedAttestationElectra object -func (i *IndexedAttestationElectra) SizeSSZ() (size int) { - size = 228 - - // Field (0) 'AttestingIndices' - size += len(i.AttestingIndices) * 8 - - return -} - -// HashTreeRoot ssz hashes the IndexedAttestationElectra object -func (i *IndexedAttestationElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(i) -} - -// HashTreeRootWith ssz hashes the IndexedAttestationElectra object with a hasher -func (i *IndexedAttestationElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AttestingIndices' - { - if size := len(i.AttestingIndices); size > 131072 { - err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 131072) - return - } - subIndx := hh.Index() - for _, i := range i.AttestingIndices { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(i.AttestingIndices)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(131072, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(131072, numItems, 8)) - } - } - - // Field (1) 'Data' - if err = i.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(i.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(i.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncAggregate object -func (s *SyncAggregate) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncAggregate object to a target array -func (s *SyncAggregate) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SyncCommitteeBits' - if size := len(s.SyncCommitteeBits); size != 64 { - err = ssz.ErrBytesLengthFn("--.SyncCommitteeBits", size, 64) - return - } - dst = append(dst, s.SyncCommitteeBits...) - - // Field (1) 'SyncCommitteeSignature' - if size := len(s.SyncCommitteeSignature); size != 96 { - err = ssz.ErrBytesLengthFn("--.SyncCommitteeSignature", size, 96) - return - } - dst = append(dst, s.SyncCommitteeSignature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncAggregate object -func (s *SyncAggregate) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 160 { - return ssz.ErrSize - } - - // Field (0) 'SyncCommitteeBits' - if cap(s.SyncCommitteeBits) == 0 { - s.SyncCommitteeBits = make([]byte, 0, len(buf[0:64])) - } - s.SyncCommitteeBits = append(s.SyncCommitteeBits, buf[0:64]...) - - // Field (1) 'SyncCommitteeSignature' - if cap(s.SyncCommitteeSignature) == 0 { - s.SyncCommitteeSignature = make([]byte, 0, len(buf[64:160])) - } - s.SyncCommitteeSignature = append(s.SyncCommitteeSignature, buf[64:160]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncAggregate object -func (s *SyncAggregate) SizeSSZ() (size int) { - size = 160 - return -} - -// HashTreeRoot ssz hashes the SyncAggregate object -func (s *SyncAggregate) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncAggregate object with a hasher -func (s *SyncAggregate) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SyncCommitteeBits' - if size := len(s.SyncCommitteeBits); size != 64 { - err = ssz.ErrBytesLengthFn("--.SyncCommitteeBits", size, 64) - return - } - hh.PutBytes(s.SyncCommitteeBits) - - // Field (1) 'SyncCommitteeSignature' - if size := len(s.SyncCommitteeSignature); size != 96 { - err = ssz.ErrBytesLengthFn("--.SyncCommitteeSignature", size, 96) - return - } - hh.PutBytes(s.SyncCommitteeSignature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockBellatrix object -func (s *SignedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockBellatrix object to a target array -func (s *SignedBeaconBlockBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BeaconBlockBellatrix) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockBellatrix object -func (s *SignedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BeaconBlockBellatrix) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockBellatrix object -func (s *SignedBeaconBlockBellatrix) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockBellatrix) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockBellatrix object -func (s *SignedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockBellatrix object with a hasher -func (s *SignedBeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBellatrix object -func (b *BeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBellatrix object to a target array -func (b *BeaconBlockBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BeaconBlockBodyBellatrix) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBellatrix object -func (b *BeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BeaconBlockBodyBellatrix) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBellatrix object -func (b *BeaconBlockBellatrix) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyBellatrix) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBellatrix object -func (b *BeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBellatrix object with a hasher -func (b *BeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBodyBellatrix object -func (b *BeaconBlockBodyBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyBellatrix object to a target array -func (b *BeaconBlockBodyBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(384) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'ExecutionPayload' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayload) - } - offset += b.ExecutionPayload.SizeSSZ() - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'ExecutionPayload' - if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyBellatrix object -func (b *BeaconBlockBodyBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 384 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 384 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'ExecutionPayload' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'ExecutionPayload' - { - buf = tail[o9:] - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayload) - } - if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyBellatrix object -func (b *BeaconBlockBodyBellatrix) SizeSSZ() (size int) { - size = 384 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'ExecutionPayload' - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayload) - } - size += b.ExecutionPayload.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyBellatrix object -func (b *BeaconBlockBodyBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyBellatrix object with a hasher -func (b *BeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'ExecutionPayload' - if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockBellatrix object -func (s *SignedBlindedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockBellatrix object to a target array -func (s *SignedBlindedBeaconBlockBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BlindedBeaconBlockBellatrix) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBlindedBeaconBlockBellatrix object -func (s *SignedBlindedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BlindedBeaconBlockBellatrix) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockBellatrix object -func (s *SignedBlindedBeaconBlockBellatrix) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BlindedBeaconBlockBellatrix) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockBellatrix object -func (s *SignedBlindedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockBellatrix object with a hasher -func (s *SignedBlindedBeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindedBeaconBlockBellatrix object -func (b *BlindedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBellatrix object to a target array -func (b *BlindedBeaconBlockBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyBellatrix) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBellatrix object -func (b *BlindedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyBellatrix) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBellatrix object -func (b *BlindedBeaconBlockBellatrix) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyBellatrix) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBellatrix object -func (b *BlindedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBellatrix object with a hasher -func (b *BlindedBeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindedBeaconBlockBodyBellatrix object -func (b *BlindedBeaconBlockBodyBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyBellatrix object to a target array -func (b *BlindedBeaconBlockBodyBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(384) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'ExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - offset += b.ExecutionPayloadHeader.SizeSSZ() - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'ExecutionPayloadHeader' - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyBellatrix object -func (b *BlindedBeaconBlockBodyBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 384 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 384 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'ExecutionPayloadHeader' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'ExecutionPayloadHeader' - { - buf = tail[o9:] - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyBellatrix object -func (b *BlindedBeaconBlockBodyBellatrix) SizeSSZ() (size int) { - size = 384 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - size += b.ExecutionPayloadHeader.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyBellatrix object -func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyBellatrix object with a hasher -func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockContentsDeneb object -func (s *SignedBeaconBlockContentsDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockContentsDeneb object to a target array -func (s *SignedBeaconBlockContentsDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(12) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(SignedBeaconBlockDeneb) - } - offset += s.Block.SizeSSZ() - - // Offset (1) 'KzgProofs' - dst = ssz.WriteOffset(dst, offset) - offset += len(s.KzgProofs) * 48 - - // Offset (2) 'Blobs' - dst = ssz.WriteOffset(dst, offset) - offset += len(s.Blobs) * 131072 - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'KzgProofs' - if size := len(s.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - for ii := 0; ii < len(s.KzgProofs); ii++ { - if size := len(s.KzgProofs[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProofs[ii]", size, 48) - return - } - dst = append(dst, s.KzgProofs[ii]...) - } - - // Field (2) 'Blobs' - if size := len(s.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - for ii := 0; ii < len(s.Blobs); ii++ { - if size := len(s.Blobs[ii]); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) - return - } - dst = append(dst, s.Blobs[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockContentsDeneb object -func (s *SignedBeaconBlockContentsDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 12 { - return ssz.ErrSize - } - - tail := buf - var o0, o1, o2 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 12 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'KzgProofs' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Offset (2) 'Blobs' - if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { - return ssz.ErrOffset - } - - // Field (0) 'Block' - { - buf = tail[o0:o1] - if s.Block == nil { - s.Block = new(SignedBeaconBlockDeneb) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'KzgProofs' - { - buf = tail[o1:o2] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - s.KzgProofs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(s.KzgProofs[ii]) == 0 { - s.KzgProofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - s.KzgProofs[ii] = append(s.KzgProofs[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (2) 'Blobs' - { - buf = tail[o2:] - num, err := ssz.DivideInt2(len(buf), 131072, 4096) - if err != nil { - return err - } - s.Blobs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(s.Blobs[ii]) == 0 { - s.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) - } - s.Blobs[ii] = append(s.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockContentsDeneb object -func (s *SignedBeaconBlockContentsDeneb) SizeSSZ() (size int) { - size = 12 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(SignedBeaconBlockDeneb) - } - size += s.Block.SizeSSZ() - - // Field (1) 'KzgProofs' - size += len(s.KzgProofs) * 48 - - // Field (2) 'Blobs' - size += len(s.Blobs) * 131072 - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockContentsDeneb object -func (s *SignedBeaconBlockContentsDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockContentsDeneb object with a hasher -func (s *SignedBeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'KzgProofs' - { - if size := len(s.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range s.KzgProofs { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(s.KzgProofs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (2) 'Blobs' - { - if size := len(s.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range s.Blobs { - if len(i) != 131072 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(s.Blobs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockContentsDeneb object -func (b *BeaconBlockContentsDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockContentsDeneb object to a target array -func (b *BeaconBlockContentsDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(12) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if b.Block == nil { - b.Block = new(BeaconBlockDeneb) - } - offset += b.Block.SizeSSZ() - - // Offset (1) 'KzgProofs' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.KzgProofs) * 48 - - // Offset (2) 'Blobs' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Blobs) * 131072 - - // Field (0) 'Block' - if dst, err = b.Block.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'KzgProofs' - if size := len(b.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - for ii := 0; ii < len(b.KzgProofs); ii++ { - if size := len(b.KzgProofs[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProofs[ii]", size, 48) - return - } - dst = append(dst, b.KzgProofs[ii]...) - } - - // Field (2) 'Blobs' - if size := len(b.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - for ii := 0; ii < len(b.Blobs); ii++ { - if size := len(b.Blobs[ii]); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) - return - } - dst = append(dst, b.Blobs[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockContentsDeneb object -func (b *BeaconBlockContentsDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 12 { - return ssz.ErrSize - } - - tail := buf - var o0, o1, o2 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 12 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'KzgProofs' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Offset (2) 'Blobs' - if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { - return ssz.ErrOffset - } - - // Field (0) 'Block' - { - buf = tail[o0:o1] - if b.Block == nil { - b.Block = new(BeaconBlockDeneb) - } - if err = b.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'KzgProofs' - { - buf = tail[o1:o2] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.KzgProofs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.KzgProofs[ii]) == 0 { - b.KzgProofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.KzgProofs[ii] = append(b.KzgProofs[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (2) 'Blobs' - { - buf = tail[o2:] - num, err := ssz.DivideInt2(len(buf), 131072, 4096) - if err != nil { - return err - } - b.Blobs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.Blobs[ii]) == 0 { - b.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) - } - b.Blobs[ii] = append(b.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockContentsDeneb object -func (b *BeaconBlockContentsDeneb) SizeSSZ() (size int) { - size = 12 - - // Field (0) 'Block' - if b.Block == nil { - b.Block = new(BeaconBlockDeneb) - } - size += b.Block.SizeSSZ() - - // Field (1) 'KzgProofs' - size += len(b.KzgProofs) * 48 - - // Field (2) 'Blobs' - size += len(b.Blobs) * 131072 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockContentsDeneb object -func (b *BeaconBlockContentsDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockContentsDeneb object with a hasher -func (b *BeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = b.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'KzgProofs' - { - if size := len(b.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.KzgProofs { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.KzgProofs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (2) 'Blobs' - { - if size := len(b.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.Blobs { - if len(i) != 131072 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.Blobs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockDeneb object -func (s *SignedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockDeneb object to a target array -func (s *SignedBeaconBlockDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BeaconBlockDeneb) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockDeneb object -func (s *SignedBeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BeaconBlockDeneb) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockDeneb object -func (s *SignedBeaconBlockDeneb) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockDeneb) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockDeneb object -func (s *SignedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockDeneb object with a hasher -func (s *SignedBeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockDeneb object -func (b *BeaconBlockDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockDeneb object to a target array -func (b *BeaconBlockDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BeaconBlockBodyDeneb) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockDeneb object -func (b *BeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BeaconBlockBodyDeneb) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockDeneb object -func (b *BeaconBlockDeneb) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyDeneb) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockDeneb object -func (b *BeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockDeneb object with a hasher -func (b *BeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBodyDeneb object -func (b *BeaconBlockBodyDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyDeneb object to a target array -func (b *BeaconBlockBodyDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(392) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'ExecutionPayload' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) - } - offset += b.ExecutionPayload.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Offset (11) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'ExecutionPayload' - if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - if size := len(b.BlsToExecutionChanges); size > 16 { - err = ssz.ErrListTooBigFn("--.BlsToExecutionChanges", size, 16) - return - } - for ii := 0; ii < len(b.BlsToExecutionChanges); ii++ { - if dst, err = b.BlsToExecutionChanges[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyDeneb object -func (b *BeaconBlockBodyDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 392 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10, o11 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 392 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'ExecutionPayload' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Offset (11) 'BlobKzgCommitments' - if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'ExecutionPayload' - { - buf = tail[o9:o10] - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) - } - if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:o11] - num, err := ssz.DivideInt2(len(buf), 172, 16) - if err != nil { - return err - } - b.BlsToExecutionChanges = make([]*SignedBLSToExecutionChange, num) - for ii := 0; ii < num; ii++ { - if b.BlsToExecutionChanges[ii] == nil { - b.BlsToExecutionChanges[ii] = new(SignedBLSToExecutionChange) - } - if err = b.BlsToExecutionChanges[ii].UnmarshalSSZ(buf[ii*172 : (ii+1)*172]); err != nil { - return err - } - } - } - - // Field (11) 'BlobKzgCommitments' - { - buf = tail[o11:] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyDeneb object -func (b *BeaconBlockBodyDeneb) SizeSSZ() (size int) { - size = 392 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'ExecutionPayload' - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) - } - size += b.ExecutionPayload.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyDeneb object -func (b *BeaconBlockBodyDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyDeneb object with a hasher -func (b *BeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'ExecutionPayload' - if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - { - subIndx := hh.Index() - num := uint64(len(b.BlsToExecutionChanges)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.BlsToExecutionChanges { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (11) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockCapella object -func (s *SignedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockCapella object to a target array -func (s *SignedBeaconBlockCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BeaconBlockCapella) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockCapella object -func (s *SignedBeaconBlockCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BeaconBlockCapella) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockCapella object -func (s *SignedBeaconBlockCapella) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockCapella) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockCapella object -func (s *SignedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockCapella object with a hasher -func (s *SignedBeaconBlockCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockCapella object -func (b *BeaconBlockCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockCapella object to a target array -func (b *BeaconBlockCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BeaconBlockBodyCapella) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockCapella object -func (b *BeaconBlockCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BeaconBlockBodyCapella) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockCapella object -func (b *BeaconBlockCapella) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyCapella) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockCapella object -func (b *BeaconBlockCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockCapella object with a hasher -func (b *BeaconBlockCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBodyCapella object -func (b *BeaconBlockBodyCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyCapella object to a target array -func (b *BeaconBlockBodyCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(388) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'ExecutionPayload' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadCapella) - } - offset += b.ExecutionPayload.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'ExecutionPayload' - if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - if size := len(b.BlsToExecutionChanges); size > 16 { - err = ssz.ErrListTooBigFn("--.BlsToExecutionChanges", size, 16) - return - } - for ii := 0; ii < len(b.BlsToExecutionChanges); ii++ { - if dst, err = b.BlsToExecutionChanges[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyCapella object -func (b *BeaconBlockBodyCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 388 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 388 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'ExecutionPayload' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'ExecutionPayload' - { - buf = tail[o9:o10] - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadCapella) - } - if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:] - num, err := ssz.DivideInt2(len(buf), 172, 16) - if err != nil { - return err - } - b.BlsToExecutionChanges = make([]*SignedBLSToExecutionChange, num) - for ii := 0; ii < num; ii++ { - if b.BlsToExecutionChanges[ii] == nil { - b.BlsToExecutionChanges[ii] = new(SignedBLSToExecutionChange) - } - if err = b.BlsToExecutionChanges[ii].UnmarshalSSZ(buf[ii*172 : (ii+1)*172]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyCapella object -func (b *BeaconBlockBodyCapella) SizeSSZ() (size int) { - size = 388 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'ExecutionPayload' - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadCapella) - } - size += b.ExecutionPayload.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyCapella object -func (b *BeaconBlockBodyCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyCapella object with a hasher -func (b *BeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'ExecutionPayload' - if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - { - subIndx := hh.Index() - num := uint64(len(b.BlsToExecutionChanges)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.BlsToExecutionChanges { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockCapella object -func (s *SignedBlindedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockCapella object to a target array -func (s *SignedBlindedBeaconBlockCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BlindedBeaconBlockCapella) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBlindedBeaconBlockCapella object -func (s *SignedBlindedBeaconBlockCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BlindedBeaconBlockCapella) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockCapella object -func (s *SignedBlindedBeaconBlockCapella) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BlindedBeaconBlockCapella) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockCapella object -func (s *SignedBlindedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockCapella object with a hasher -func (s *SignedBlindedBeaconBlockCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindedBeaconBlockCapella object -func (b *BlindedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockCapella object to a target array -func (b *BlindedBeaconBlockCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyCapella) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockCapella object -func (b *BlindedBeaconBlockCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyCapella) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockCapella object -func (b *BlindedBeaconBlockCapella) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyCapella) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockCapella object -func (b *BlindedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockCapella object with a hasher -func (b *BlindedBeaconBlockCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindedBeaconBlockBodyCapella object -func (b *BlindedBeaconBlockBodyCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyCapella object to a target array -func (b *BlindedBeaconBlockBodyCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(388) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'ExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - offset += b.ExecutionPayloadHeader.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'ExecutionPayloadHeader' - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - if size := len(b.BlsToExecutionChanges); size > 16 { - err = ssz.ErrListTooBigFn("--.BlsToExecutionChanges", size, 16) - return - } - for ii := 0; ii < len(b.BlsToExecutionChanges); ii++ { - if dst, err = b.BlsToExecutionChanges[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyCapella object -func (b *BlindedBeaconBlockBodyCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 388 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 388 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'ExecutionPayloadHeader' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'ExecutionPayloadHeader' - { - buf = tail[o9:o10] - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:] - num, err := ssz.DivideInt2(len(buf), 172, 16) - if err != nil { - return err - } - b.BlsToExecutionChanges = make([]*SignedBLSToExecutionChange, num) - for ii := 0; ii < num; ii++ { - if b.BlsToExecutionChanges[ii] == nil { - b.BlsToExecutionChanges[ii] = new(SignedBLSToExecutionChange) - } - if err = b.BlsToExecutionChanges[ii].UnmarshalSSZ(buf[ii*172 : (ii+1)*172]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyCapella object -func (b *BlindedBeaconBlockBodyCapella) SizeSSZ() (size int) { - size = 388 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - size += b.ExecutionPayloadHeader.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyCapella object -func (b *BlindedBeaconBlockBodyCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyCapella object with a hasher -func (b *BlindedBeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - { - subIndx := hh.Index() - num := uint64(len(b.BlsToExecutionChanges)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.BlsToExecutionChanges { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockDeneb object -func (s *SignedBlindedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockDeneb object to a target array -func (s *SignedBlindedBeaconBlockDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(BlindedBeaconBlockDeneb) - } - offset += s.Message.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBlindedBeaconBlockDeneb object -func (s *SignedBlindedBeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(BlindedBeaconBlockDeneb) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockDeneb object -func (s *SignedBlindedBeaconBlockDeneb) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BlindedBeaconBlockDeneb) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockDeneb object -func (s *SignedBlindedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockDeneb object with a hasher -func (s *SignedBlindedBeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindedBeaconBlockDeneb object -func (b *BlindedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockDeneb object to a target array -func (b *BlindedBeaconBlockDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyDeneb) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockDeneb object -func (b *BlindedBeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyDeneb) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockDeneb object -func (b *BlindedBeaconBlockDeneb) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyDeneb) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockDeneb object -func (b *BlindedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockDeneb object with a hasher -func (b *BlindedBeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindedBeaconBlockBodyDeneb object -func (b *BlindedBeaconBlockBodyDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyDeneb object to a target array -func (b *BlindedBeaconBlockBodyDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(392) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'ExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - offset += b.ExecutionPayloadHeader.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Offset (11) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'ExecutionPayloadHeader' - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - if size := len(b.BlsToExecutionChanges); size > 16 { - err = ssz.ErrListTooBigFn("--.BlsToExecutionChanges", size, 16) - return - } - for ii := 0; ii < len(b.BlsToExecutionChanges); ii++ { - if dst, err = b.BlsToExecutionChanges[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyDeneb object -func (b *BlindedBeaconBlockBodyDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 392 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10, o11 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 392 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'ExecutionPayloadHeader' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Offset (11) 'BlobKzgCommitments' - if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'ExecutionPayloadHeader' - { - buf = tail[o9:o10] - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:o11] - num, err := ssz.DivideInt2(len(buf), 172, 16) - if err != nil { - return err - } - b.BlsToExecutionChanges = make([]*SignedBLSToExecutionChange, num) - for ii := 0; ii < num; ii++ { - if b.BlsToExecutionChanges[ii] == nil { - b.BlsToExecutionChanges[ii] = new(SignedBLSToExecutionChange) - } - if err = b.BlsToExecutionChanges[ii].UnmarshalSSZ(buf[ii*172 : (ii+1)*172]); err != nil { - return err - } - } - } - - // Field (11) 'BlobKzgCommitments' - { - buf = tail[o11:] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyDeneb object -func (b *BlindedBeaconBlockBodyDeneb) SizeSSZ() (size int) { - size = 392 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - size += b.ExecutionPayloadHeader.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyDeneb object -func (b *BlindedBeaconBlockBodyDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyDeneb object with a hasher -func (b *BlindedBeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - { - subIndx := hh.Index() - num := uint64(len(b.BlsToExecutionChanges)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.BlsToExecutionChanges { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (11) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockElectra object -func (s *SignedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockElectra object to a target array -func (s *SignedBeaconBlockElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BeaconBlockElectra) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockElectra object -func (s *SignedBeaconBlockElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BeaconBlockElectra) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockElectra object -func (s *SignedBeaconBlockElectra) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockElectra) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockElectra object -func (s *SignedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockElectra object with a hasher -func (s *SignedBeaconBlockElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockElectra object -func (b *BeaconBlockElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockElectra object to a target array -func (b *BeaconBlockElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BeaconBlockBodyElectra) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockElectra object -func (b *BeaconBlockElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BeaconBlockBodyElectra) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockElectra object -func (b *BeaconBlockElectra) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyElectra) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockElectra object -func (b *BeaconBlockElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockElectra object with a hasher -func (b *BeaconBlockElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBodyElectra object -func (b *BeaconBlockBodyElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyElectra object to a target array -func (b *BeaconBlockBodyElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(396) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'ExecutionPayload' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadElectra) - } - offset += b.ExecutionPayload.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Offset (11) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Offset (12) 'Consolidations' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Consolidations) * 120 - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 1 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 1) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 8 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 8) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'ExecutionPayload' - if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - if size := len(b.BlsToExecutionChanges); size > 16 { - err = ssz.ErrListTooBigFn("--.BlsToExecutionChanges", size, 16) - return - } - for ii := 0; ii < len(b.BlsToExecutionChanges); ii++ { - if dst, err = b.BlsToExecutionChanges[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - // Field (12) 'Consolidations' - if size := len(b.Consolidations); size > 1 { - err = ssz.ErrListTooBigFn("--.Consolidations", size, 1) - return - } - for ii := 0; ii < len(b.Consolidations); ii++ { - if dst, err = b.Consolidations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyElectra object -func (b *BeaconBlockBodyElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 396 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10, o11, o12 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 396 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'ExecutionPayload' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Offset (11) 'BlobKzgCommitments' - if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Consolidations' - if o12 = ssz.ReadOffset(buf[392:396]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 1) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashingElectra, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashingElectra) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 8) - if err != nil { - return err - } - b.Attestations = make([]*AttestationElectra, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(AttestationElectra) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'ExecutionPayload' - { - buf = tail[o9:o10] - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadElectra) - } - if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:o11] - num, err := ssz.DivideInt2(len(buf), 172, 16) - if err != nil { - return err - } - b.BlsToExecutionChanges = make([]*SignedBLSToExecutionChange, num) - for ii := 0; ii < num; ii++ { - if b.BlsToExecutionChanges[ii] == nil { - b.BlsToExecutionChanges[ii] = new(SignedBLSToExecutionChange) - } - if err = b.BlsToExecutionChanges[ii].UnmarshalSSZ(buf[ii*172 : (ii+1)*172]); err != nil { - return err - } - } - } - - // Field (11) 'BlobKzgCommitments' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (12) 'Consolidations' - { - buf = tail[o12:] - num, err := ssz.DivideInt2(len(buf), 120, 1) - if err != nil { - return err - } - b.Consolidations = make([]*SignedConsolidation, num) - for ii := 0; ii < num; ii++ { - if b.Consolidations[ii] == nil { - b.Consolidations[ii] = new(SignedConsolidation) - } - if err = b.Consolidations[ii].UnmarshalSSZ(buf[ii*120 : (ii+1)*120]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyElectra object -func (b *BeaconBlockBodyElectra) SizeSSZ() (size int) { - size = 396 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'ExecutionPayload' - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadElectra) - } - size += b.ExecutionPayload.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - // Field (12) 'Consolidations' - size += len(b.Consolidations) * 120 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyElectra object -func (b *BeaconBlockBodyElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyElectra object with a hasher -func (b *BeaconBlockBodyElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 1 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 8 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 8) - } else { - hh.MerkleizeWithMixin(subIndx, num, 8) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'ExecutionPayload' - if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - { - subIndx := hh.Index() - num := uint64(len(b.BlsToExecutionChanges)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.BlsToExecutionChanges { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (11) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (12) 'Consolidations' - { - subIndx := hh.Index() - num := uint64(len(b.Consolidations)) - if num > 1 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Consolidations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockElectra object -func (s *SignedBlindedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockElectra object to a target array -func (s *SignedBlindedBeaconBlockElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(BlindedBeaconBlockElectra) - } - offset += s.Message.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBlindedBeaconBlockElectra object -func (s *SignedBlindedBeaconBlockElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(BlindedBeaconBlockElectra) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockElectra object -func (s *SignedBlindedBeaconBlockElectra) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BlindedBeaconBlockElectra) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockElectra object -func (s *SignedBlindedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockElectra object with a hasher -func (s *SignedBlindedBeaconBlockElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindedBeaconBlockElectra object -func (b *BlindedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockElectra object to a target array -func (b *BlindedBeaconBlockElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyElectra) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockElectra object -func (b *BlindedBeaconBlockElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyElectra) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockElectra object -func (b *BlindedBeaconBlockElectra) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyElectra) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockElectra object -func (b *BlindedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockElectra object with a hasher -func (b *BlindedBeaconBlockElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindedBeaconBlockBodyElectra object -func (b *BlindedBeaconBlockBodyElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyElectra object to a target array -func (b *BlindedBeaconBlockBodyElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(396) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'ExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - offset += b.ExecutionPayloadHeader.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Offset (11) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Offset (12) 'Consolidations' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Consolidations) * 120 - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 1 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 1) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 8 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 8) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'ExecutionPayloadHeader' - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - if size := len(b.BlsToExecutionChanges); size > 16 { - err = ssz.ErrListTooBigFn("--.BlsToExecutionChanges", size, 16) - return - } - for ii := 0; ii < len(b.BlsToExecutionChanges); ii++ { - if dst, err = b.BlsToExecutionChanges[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - // Field (12) 'Consolidations' - if size := len(b.Consolidations); size > 1 { - err = ssz.ErrListTooBigFn("--.Consolidations", size, 1) - return - } - for ii := 0; ii < len(b.Consolidations); ii++ { - if dst, err = b.Consolidations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyElectra object -func (b *BlindedBeaconBlockBodyElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 396 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10, o11, o12 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 396 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'ExecutionPayloadHeader' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Offset (11) 'BlobKzgCommitments' - if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Consolidations' - if o12 = ssz.ReadOffset(buf[392:396]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 1) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashingElectra, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashingElectra) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 8) - if err != nil { - return err - } - b.Attestations = make([]*AttestationElectra, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(AttestationElectra) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'ExecutionPayloadHeader' - { - buf = tail[o9:o10] - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:o11] - num, err := ssz.DivideInt2(len(buf), 172, 16) - if err != nil { - return err - } - b.BlsToExecutionChanges = make([]*SignedBLSToExecutionChange, num) - for ii := 0; ii < num; ii++ { - if b.BlsToExecutionChanges[ii] == nil { - b.BlsToExecutionChanges[ii] = new(SignedBLSToExecutionChange) - } - if err = b.BlsToExecutionChanges[ii].UnmarshalSSZ(buf[ii*172 : (ii+1)*172]); err != nil { - return err - } - } - } - - // Field (11) 'BlobKzgCommitments' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (12) 'Consolidations' - { - buf = tail[o12:] - num, err := ssz.DivideInt2(len(buf), 120, 1) - if err != nil { - return err - } - b.Consolidations = make([]*SignedConsolidation, num) - for ii := 0; ii < num; ii++ { - if b.Consolidations[ii] == nil { - b.Consolidations[ii] = new(SignedConsolidation) - } - if err = b.Consolidations[ii].UnmarshalSSZ(buf[ii*120 : (ii+1)*120]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyElectra object -func (b *BlindedBeaconBlockBodyElectra) SizeSSZ() (size int) { - size = 396 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - size += b.ExecutionPayloadHeader.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - // Field (12) 'Consolidations' - size += len(b.Consolidations) * 120 - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyElectra object -func (b *BlindedBeaconBlockBodyElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyElectra object with a hasher -func (b *BlindedBeaconBlockBodyElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 1 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 8 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 8) - } else { - hh.MerkleizeWithMixin(subIndx, num, 8) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) 'BlsToExecutionChanges' - { - subIndx := hh.Index() - num := uint64(len(b.BlsToExecutionChanges)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.BlsToExecutionChanges { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (11) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (12) 'Consolidations' - { - subIndx := hh.Index() - num := uint64(len(b.Consolidations)) - if num > 1 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Consolidations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ValidatorRegistrationV1 object -func (v *ValidatorRegistrationV1) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(v) -} - -// MarshalSSZTo ssz marshals the ValidatorRegistrationV1 object to a target array -func (v *ValidatorRegistrationV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'FeeRecipient' - if size := len(v.FeeRecipient); size != 20 { - err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) - return - } - dst = append(dst, v.FeeRecipient...) - - // Field (1) 'GasLimit' - dst = ssz.MarshalUint64(dst, v.GasLimit) - - // Field (2) 'Timestamp' - dst = ssz.MarshalUint64(dst, v.Timestamp) - - // Field (3) 'Pubkey' - if size := len(v.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - dst = append(dst, v.Pubkey...) - - return -} - -// UnmarshalSSZ ssz unmarshals the ValidatorRegistrationV1 object -func (v *ValidatorRegistrationV1) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 84 { - return ssz.ErrSize - } - - // Field (0) 'FeeRecipient' - if cap(v.FeeRecipient) == 0 { - v.FeeRecipient = make([]byte, 0, len(buf[0:20])) - } - v.FeeRecipient = append(v.FeeRecipient, buf[0:20]...) - - // Field (1) 'GasLimit' - v.GasLimit = ssz.UnmarshallUint64(buf[20:28]) - - // Field (2) 'Timestamp' - v.Timestamp = ssz.UnmarshallUint64(buf[28:36]) - - // Field (3) 'Pubkey' - if cap(v.Pubkey) == 0 { - v.Pubkey = make([]byte, 0, len(buf[36:84])) - } - v.Pubkey = append(v.Pubkey, buf[36:84]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ValidatorRegistrationV1 object -func (v *ValidatorRegistrationV1) SizeSSZ() (size int) { - size = 84 - return -} - -// HashTreeRoot ssz hashes the ValidatorRegistrationV1 object -func (v *ValidatorRegistrationV1) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(v) -} - -// HashTreeRootWith ssz hashes the ValidatorRegistrationV1 object with a hasher -func (v *ValidatorRegistrationV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'FeeRecipient' - if size := len(v.FeeRecipient); size != 20 { - err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) - return - } - hh.PutBytes(v.FeeRecipient) - - // Field (1) 'GasLimit' - hh.PutUint64(v.GasLimit) - - // Field (2) 'Timestamp' - hh.PutUint64(v.Timestamp) - - // Field (3) 'Pubkey' - if size := len(v.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - hh.PutBytes(v.Pubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedValidatorRegistrationV1 object -func (s *SignedValidatorRegistrationV1) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedValidatorRegistrationV1 object to a target array -func (s *SignedValidatorRegistrationV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(ValidatorRegistrationV1) - } - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedValidatorRegistrationV1 object -func (s *SignedValidatorRegistrationV1) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 180 { - return ssz.ErrSize - } - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(ValidatorRegistrationV1) - } - if err = s.Message.UnmarshalSSZ(buf[0:84]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[84:180])) - } - s.Signature = append(s.Signature, buf[84:180]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedValidatorRegistrationV1 object -func (s *SignedValidatorRegistrationV1) SizeSSZ() (size int) { - size = 180 - return -} - -// HashTreeRoot ssz hashes the SignedValidatorRegistrationV1 object -func (s *SignedValidatorRegistrationV1) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedValidatorRegistrationV1 object with a hasher -func (s *SignedValidatorRegistrationV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BuilderBid object -func (b *BuilderBid) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BuilderBid object to a target array -func (b *BuilderBid) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Offset (0) 'Header' - dst = ssz.WriteOffset(dst, offset) - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeader) - } - offset += b.Header.SizeSSZ() - - // Field (1) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - dst = append(dst, b.Value...) - - // Field (2) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - dst = append(dst, b.Pubkey...) - - // Field (0) 'Header' - if dst, err = b.Header.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BuilderBid object -func (b *BuilderBid) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Header' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Value' - if cap(b.Value) == 0 { - b.Value = make([]byte, 0, len(buf[4:36])) - } - b.Value = append(b.Value, buf[4:36]...) - - // Field (2) 'Pubkey' - if cap(b.Pubkey) == 0 { - b.Pubkey = make([]byte, 0, len(buf[36:84])) - } - b.Pubkey = append(b.Pubkey, buf[36:84]...) - - // Field (0) 'Header' - { - buf = tail[o0:] - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeader) - } - if err = b.Header.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BuilderBid object -func (b *BuilderBid) SizeSSZ() (size int) { - size = 84 - - // Field (0) 'Header' - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeader) - } - size += b.Header.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BuilderBid object -func (b *BuilderBid) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BuilderBid object with a hasher -func (b *BuilderBid) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header' - if err = b.Header.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - hh.PutBytes(b.Value) - - // Field (2) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - hh.PutBytes(b.Pubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BuilderBidCapella object -func (b *BuilderBidCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BuilderBidCapella object to a target array -func (b *BuilderBidCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Offset (0) 'Header' - dst = ssz.WriteOffset(dst, offset) - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderCapella) - } - offset += b.Header.SizeSSZ() - - // Field (1) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - dst = append(dst, b.Value...) - - // Field (2) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - dst = append(dst, b.Pubkey...) - - // Field (0) 'Header' - if dst, err = b.Header.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BuilderBidCapella object -func (b *BuilderBidCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Header' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Value' - if cap(b.Value) == 0 { - b.Value = make([]byte, 0, len(buf[4:36])) - } - b.Value = append(b.Value, buf[4:36]...) - - // Field (2) 'Pubkey' - if cap(b.Pubkey) == 0 { - b.Pubkey = make([]byte, 0, len(buf[36:84])) - } - b.Pubkey = append(b.Pubkey, buf[36:84]...) - - // Field (0) 'Header' - { - buf = tail[o0:] - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderCapella) - } - if err = b.Header.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BuilderBidCapella object -func (b *BuilderBidCapella) SizeSSZ() (size int) { - size = 84 - - // Field (0) 'Header' - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderCapella) - } - size += b.Header.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BuilderBidCapella object -func (b *BuilderBidCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BuilderBidCapella object with a hasher -func (b *BuilderBidCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header' - if err = b.Header.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - hh.PutBytes(b.Value) - - // Field (2) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - hh.PutBytes(b.Pubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BuilderBidDeneb object -func (b *BuilderBidDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BuilderBidDeneb object to a target array -func (b *BuilderBidDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(88) - - // Offset (0) 'Header' - dst = ssz.WriteOffset(dst, offset) - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderDeneb) - } - offset += b.Header.SizeSSZ() - - // Offset (1) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Field (2) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - dst = append(dst, b.Value...) - - // Field (3) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - dst = append(dst, b.Pubkey...) - - // Field (0) 'Header' - if dst, err = b.Header.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BuilderBidDeneb object -func (b *BuilderBidDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 88 { - return ssz.ErrSize - } - - tail := buf - var o0, o1 uint64 - - // Offset (0) 'Header' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 88 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'BlobKzgCommitments' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Field (2) 'Value' - if cap(b.Value) == 0 { - b.Value = make([]byte, 0, len(buf[8:40])) - } - b.Value = append(b.Value, buf[8:40]...) - - // Field (3) 'Pubkey' - if cap(b.Pubkey) == 0 { - b.Pubkey = make([]byte, 0, len(buf[40:88])) - } - b.Pubkey = append(b.Pubkey, buf[40:88]...) - - // Field (0) 'Header' - { - buf = tail[o0:o1] - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderDeneb) - } - if err = b.Header.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'BlobKzgCommitments' - { - buf = tail[o1:] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BuilderBidDeneb object -func (b *BuilderBidDeneb) SizeSSZ() (size int) { - size = 88 - - // Field (0) 'Header' - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderDeneb) - } - size += b.Header.SizeSSZ() - - // Field (1) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - return -} - -// HashTreeRoot ssz hashes the BuilderBidDeneb object -func (b *BuilderBidDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BuilderBidDeneb object with a hasher -func (b *BuilderBidDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header' - if err = b.Header.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (2) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - hh.PutBytes(b.Value) - - // Field (3) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - hh.PutBytes(b.Pubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlobSidecar object -func (b *BlobSidecar) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlobSidecar object to a target array -func (b *BlobSidecar) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Index' - dst = ssz.MarshalUint64(dst, b.Index) - - // Field (1) 'Blob' - if size := len(b.Blob); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blob", size, 131072) - return - } - dst = append(dst, b.Blob...) - - // Field (2) 'KzgCommitment' - if size := len(b.KzgCommitment); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgCommitment", size, 48) - return - } - dst = append(dst, b.KzgCommitment...) - - // Field (3) 'KzgProof' - if size := len(b.KzgProof); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProof", size, 48) - return - } - dst = append(dst, b.KzgProof...) - - // Field (4) 'SignedBlockHeader' - if b.SignedBlockHeader == nil { - b.SignedBlockHeader = new(SignedBeaconBlockHeader) - } - if dst, err = b.SignedBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'CommitmentInclusionProof' - if size := len(b.CommitmentInclusionProof); size != 17 { - err = ssz.ErrVectorLengthFn("--.CommitmentInclusionProof", size, 17) - return - } - for ii := 0; ii < 17; ii++ { - if size := len(b.CommitmentInclusionProof[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.CommitmentInclusionProof[ii]", size, 32) - return - } - dst = append(dst, b.CommitmentInclusionProof[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlobSidecar object -func (b *BlobSidecar) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 131928 { - return ssz.ErrSize - } - - // Field (0) 'Index' - b.Index = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'Blob' - if cap(b.Blob) == 0 { - b.Blob = make([]byte, 0, len(buf[8:131080])) - } - b.Blob = append(b.Blob, buf[8:131080]...) - - // Field (2) 'KzgCommitment' - if cap(b.KzgCommitment) == 0 { - b.KzgCommitment = make([]byte, 0, len(buf[131080:131128])) - } - b.KzgCommitment = append(b.KzgCommitment, buf[131080:131128]...) - - // Field (3) 'KzgProof' - if cap(b.KzgProof) == 0 { - b.KzgProof = make([]byte, 0, len(buf[131128:131176])) - } - b.KzgProof = append(b.KzgProof, buf[131128:131176]...) - - // Field (4) 'SignedBlockHeader' - if b.SignedBlockHeader == nil { - b.SignedBlockHeader = new(SignedBeaconBlockHeader) - } - if err = b.SignedBlockHeader.UnmarshalSSZ(buf[131176:131384]); err != nil { - return err - } - - // Field (5) 'CommitmentInclusionProof' - b.CommitmentInclusionProof = make([][]byte, 17) - for ii := 0; ii < 17; ii++ { - if cap(b.CommitmentInclusionProof[ii]) == 0 { - b.CommitmentInclusionProof[ii] = make([]byte, 0, len(buf[131384:131928][ii*32:(ii+1)*32])) - } - b.CommitmentInclusionProof[ii] = append(b.CommitmentInclusionProof[ii], buf[131384:131928][ii*32:(ii+1)*32]...) - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecar object -func (b *BlobSidecar) SizeSSZ() (size int) { - size = 131928 - return -} - -// HashTreeRoot ssz hashes the BlobSidecar object -func (b *BlobSidecar) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlobSidecar object with a hasher -func (b *BlobSidecar) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Index' - hh.PutUint64(b.Index) - - // Field (1) 'Blob' - if size := len(b.Blob); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blob", size, 131072) - return - } - hh.PutBytes(b.Blob) - - // Field (2) 'KzgCommitment' - if size := len(b.KzgCommitment); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgCommitment", size, 48) - return - } - hh.PutBytes(b.KzgCommitment) - - // Field (3) 'KzgProof' - if size := len(b.KzgProof); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProof", size, 48) - return - } - hh.PutBytes(b.KzgProof) - - // Field (4) 'SignedBlockHeader' - if err = b.SignedBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'CommitmentInclusionProof' - { - if size := len(b.CommitmentInclusionProof); size != 17 { - err = ssz.ErrVectorLengthFn("--.CommitmentInclusionProof", size, 17) - return - } - subIndx := hh.Index() - for _, i := range b.CommitmentInclusionProof { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlobSidecars object -func (b *BlobSidecars) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlobSidecars object to a target array -func (b *BlobSidecars) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(4) - - // Offset (0) 'Sidecars' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Sidecars) * 131928 - - // Field (0) 'Sidecars' - if size := len(b.Sidecars); size > 6 { - err = ssz.ErrListTooBigFn("--.Sidecars", size, 6) - return - } - for ii := 0; ii < len(b.Sidecars); ii++ { - if dst, err = b.Sidecars[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlobSidecars object -func (b *BlobSidecars) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 4 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Sidecars' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 4 { - return ssz.ErrInvalidVariableOffset - } - - // Field (0) 'Sidecars' - { - buf = tail[o0:] - num, err := ssz.DivideInt2(len(buf), 131928, 6) - if err != nil { - return err - } - b.Sidecars = make([]*BlobSidecar, num) - for ii := 0; ii < num; ii++ { - if b.Sidecars[ii] == nil { - b.Sidecars[ii] = new(BlobSidecar) - } - if err = b.Sidecars[ii].UnmarshalSSZ(buf[ii*131928 : (ii+1)*131928]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecars object -func (b *BlobSidecars) SizeSSZ() (size int) { - size = 4 - - // Field (0) 'Sidecars' - size += len(b.Sidecars) * 131928 - - return -} - -// HashTreeRoot ssz hashes the BlobSidecars object -func (b *BlobSidecars) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlobSidecars object with a hasher -func (b *BlobSidecars) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Sidecars' - { - subIndx := hh.Index() - num := uint64(len(b.Sidecars)) - if num > 6 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Sidecars { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 6) - } else { - hh.MerkleizeWithMixin(subIndx, num, 6) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockEpbs object -func (b *BeaconBlockEpbs) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockEpbs object to a target array -func (b *BeaconBlockEpbs) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - dst = append(dst, b.ParentRoot...) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Offset (4) 'Body' - dst = ssz.WriteOffset(dst, offset) - if b.Body == nil { - b.Body = new(BeaconBlockBodyEpbs) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockEpbs object -func (b *BeaconBlockEpbs) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o4 uint64 - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'ParentRoot' - if cap(b.ParentRoot) == 0 { - b.ParentRoot = make([]byte, 0, len(buf[16:48])) - } - b.ParentRoot = append(b.ParentRoot, buf[16:48]...) - - // Field (3) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[48:80])) - } - b.StateRoot = append(b.StateRoot, buf[48:80]...) - - // Offset (4) 'Body' - if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { - return ssz.ErrOffset - } - - if o4 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'Body' - { - buf = tail[o4:] - if b.Body == nil { - b.Body = new(BeaconBlockBodyEpbs) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockEpbs object -func (b *BeaconBlockEpbs) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyEpbs) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockEpbs object -func (b *BeaconBlockEpbs) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockEpbs object with a hasher -func (b *BeaconBlockEpbs) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (1) 'ProposerIndex' - hh.PutUint64(uint64(b.ProposerIndex)) - - // Field (2) 'ParentRoot' - if size := len(b.ParentRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32) - return - } - hh.PutBytes(b.ParentRoot) - - // Field (3) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - // Field (4) 'Body' - if err = b.Body.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBodyEpbs object -func (b *BeaconBlockBodyEpbs) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyEpbs object to a target array -func (b *BeaconBlockBodyEpbs) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(636) - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - dst = append(dst, b.RandaoReveal...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - dst = append(dst, b.Graffiti...) - - // Offset (3) 'ProposerSlashings' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.ProposerSlashings) * 416 - - // Offset (4) 'AttesterSlashings' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - offset += 4 - offset += b.AttesterSlashings[ii].SizeSSZ() - } - - // Offset (5) 'Attestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.Attestations); ii++ { - offset += 4 - offset += b.Attestations[ii].SizeSSZ() - } - - // Offset (6) 'Deposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Deposits) * 1240 - - // Offset (7) 'VoluntaryExits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.VoluntaryExits) * 112 - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Field (10) 'SignedExecutionPayloadHeader' - if b.SignedExecutionPayloadHeader == nil { - b.SignedExecutionPayloadHeader = new(v1.SignedExecutionPayloadHeader) - } - if dst, err = b.SignedExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (11) 'PayloadAttestations' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PayloadAttestations) * 208 - - // Field (3) 'ProposerSlashings' - if size := len(b.ProposerSlashings); size > 16 { - err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16) - return - } - for ii := 0; ii < len(b.ProposerSlashings); ii++ { - if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (4) 'AttesterSlashings' - if size := len(b.AttesterSlashings); size > 2 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2) - return - } - { - offset = 4 * len(b.AttesterSlashings) - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.AttesterSlashings[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (5) 'Attestations' - if size := len(b.Attestations); size > 128 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 128) - return - } - { - offset = 4 * len(b.Attestations) - for ii := 0; ii < len(b.Attestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.Attestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.Attestations); ii++ { - if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (6) 'Deposits' - if size := len(b.Deposits); size > 16 { - err = ssz.ErrListTooBigFn("--.Deposits", size, 16) - return - } - for ii := 0; ii < len(b.Deposits); ii++ { - if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (7) 'VoluntaryExits' - if size := len(b.VoluntaryExits); size > 16 { - err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16) - return - } - for ii := 0; ii < len(b.VoluntaryExits); ii++ { - if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (9) 'BlsToExecutionChanges' - if size := len(b.BlsToExecutionChanges); size > 16 { - err = ssz.ErrListTooBigFn("--.BlsToExecutionChanges", size, 16) - return - } - for ii := 0; ii < len(b.BlsToExecutionChanges); ii++ { - if dst, err = b.BlsToExecutionChanges[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'PayloadAttestations' - if size := len(b.PayloadAttestations); size > 4 { - err = ssz.ErrListTooBigFn("--.PayloadAttestations", size, 4) - return - } - for ii := 0; ii < len(b.PayloadAttestations); ii++ { - if dst, err = b.PayloadAttestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyEpbs object -func (b *BeaconBlockBodyEpbs) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 636 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o11 uint64 - - // Field (0) 'RandaoReveal' - if cap(b.RandaoReveal) == 0 { - b.RandaoReveal = make([]byte, 0, len(buf[0:96])) - } - b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) - - // Field (1) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { - return err - } - - // Field (2) 'Graffiti' - if cap(b.Graffiti) == 0 { - b.Graffiti = make([]byte, 0, len(buf[168:200])) - } - b.Graffiti = append(b.Graffiti, buf[168:200]...) - - // Offset (3) 'ProposerSlashings' - if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 636 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (4) 'AttesterSlashings' - if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { - return ssz.ErrOffset - } - - // Offset (5) 'Attestations' - if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { - return ssz.ErrOffset - } - - // Offset (6) 'Deposits' - if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { - return ssz.ErrOffset - } - - // Offset (7) 'VoluntaryExits' - if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { - return ssz.ErrOffset - } - - // Field (8) 'SyncAggregate' - if b.SyncAggregate == nil { - b.SyncAggregate = new(SyncAggregate) - } - if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { - return err - } - - // Offset (9) 'BlsToExecutionChanges' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'SignedExecutionPayloadHeader' - if b.SignedExecutionPayloadHeader == nil { - b.SignedExecutionPayloadHeader = new(v1.SignedExecutionPayloadHeader) - } - if err = b.SignedExecutionPayloadHeader.UnmarshalSSZ(buf[384:632]); err != nil { - return err - } - - // Offset (11) 'PayloadAttestations' - if o11 = ssz.ReadOffset(buf[632:636]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Field (3) 'ProposerSlashings' - { - buf = tail[o3:o4] - num, err := ssz.DivideInt2(len(buf), 416, 16) - if err != nil { - return err - } - b.ProposerSlashings = make([]*ProposerSlashing, num) - for ii := 0; ii < num; ii++ { - if b.ProposerSlashings[ii] == nil { - b.ProposerSlashings[ii] = new(ProposerSlashing) - } - if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { - return err - } - } - } - - // Field (4) 'AttesterSlashings' - { - buf = tail[o4:o5] - num, err := ssz.DecodeDynamicLength(buf, 2) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashing, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashing) - } - if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (5) 'Attestations' - { - buf = tail[o5:o6] - num, err := ssz.DecodeDynamicLength(buf, 128) - if err != nil { - return err - } - b.Attestations = make([]*Attestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(Attestation) - } - if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (6) 'Deposits' - { - buf = tail[o6:o7] - num, err := ssz.DivideInt2(len(buf), 1240, 16) - if err != nil { - return err - } - b.Deposits = make([]*Deposit, num) - for ii := 0; ii < num; ii++ { - if b.Deposits[ii] == nil { - b.Deposits[ii] = new(Deposit) - } - if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { - return err - } - } - } - - // Field (7) 'VoluntaryExits' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 112, 16) - if err != nil { - return err - } - b.VoluntaryExits = make([]*SignedVoluntaryExit, num) - for ii := 0; ii < num; ii++ { - if b.VoluntaryExits[ii] == nil { - b.VoluntaryExits[ii] = new(SignedVoluntaryExit) - } - if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { - return err - } - } - } - - // Field (9) 'BlsToExecutionChanges' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 172, 16) - if err != nil { - return err - } - b.BlsToExecutionChanges = make([]*SignedBLSToExecutionChange, num) - for ii := 0; ii < num; ii++ { - if b.BlsToExecutionChanges[ii] == nil { - b.BlsToExecutionChanges[ii] = new(SignedBLSToExecutionChange) - } - if err = b.BlsToExecutionChanges[ii].UnmarshalSSZ(buf[ii*172 : (ii+1)*172]); err != nil { - return err - } - } - } - - // Field (11) 'PayloadAttestations' - { - buf = tail[o11:] - num, err := ssz.DivideInt2(len(buf), 208, 4) - if err != nil { - return err - } - b.PayloadAttestations = make([]*PayloadAttestation, num) - for ii := 0; ii < num; ii++ { - if b.PayloadAttestations[ii] == nil { - b.PayloadAttestations[ii] = new(PayloadAttestation) - } - if err = b.PayloadAttestations[ii].UnmarshalSSZ(buf[ii*208 : (ii+1)*208]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyEpbs object -func (b *BeaconBlockBodyEpbs) SizeSSZ() (size int) { - size = 636 - - // Field (3) 'ProposerSlashings' - size += len(b.ProposerSlashings) * 416 - - // Field (4) 'AttesterSlashings' - for ii := 0; ii < len(b.AttesterSlashings); ii++ { - size += 4 - size += b.AttesterSlashings[ii].SizeSSZ() - } - - // Field (5) 'Attestations' - for ii := 0; ii < len(b.Attestations); ii++ { - size += 4 - size += b.Attestations[ii].SizeSSZ() - } - - // Field (6) 'Deposits' - size += len(b.Deposits) * 1240 - - // Field (7) 'VoluntaryExits' - size += len(b.VoluntaryExits) * 112 - - // Field (9) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'PayloadAttestations' - size += len(b.PayloadAttestations) * 208 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyEpbs object -func (b *BeaconBlockBodyEpbs) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyEpbs object with a hasher -func (b *BeaconBlockBodyEpbs) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'RandaoReveal' - if size := len(b.RandaoReveal); size != 96 { - err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96) - return - } - hh.PutBytes(b.RandaoReveal) - - // Field (1) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Graffiti' - if size := len(b.Graffiti); size != 32 { - err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32) - return - } - hh.PutBytes(b.Graffiti) - - // Field (3) 'ProposerSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.ProposerSlashings)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.ProposerSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (4) 'AttesterSlashings' - { - subIndx := hh.Index() - num := uint64(len(b.AttesterSlashings)) - if num > 2 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 128 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } - } - - // Field (6) 'Deposits' - { - subIndx := hh.Index() - num := uint64(len(b.Deposits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Deposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (7) 'VoluntaryExits' - { - subIndx := hh.Index() - num := uint64(len(b.VoluntaryExits)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.VoluntaryExits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (8) 'SyncAggregate' - if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'BlsToExecutionChanges' - { - subIndx := hh.Index() - num := uint64(len(b.BlsToExecutionChanges)) - if num > 16 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.BlsToExecutionChanges { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } - } - - // Field (10) 'SignedExecutionPayloadHeader' - if err = b.SignedExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (11) 'PayloadAttestations' - { - subIndx := hh.Index() - num := uint64(len(b.PayloadAttestations)) - if num > 4 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PayloadAttestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 4) - } else { - hh.MerkleizeWithMixin(subIndx, num, 4) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockEpbs object -func (s *SignedBeaconBlockEpbs) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockEpbs object to a target array -func (s *SignedBeaconBlockEpbs) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(BeaconBlockEpbs) - } - offset += s.Block.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockEpbs object -func (s *SignedBeaconBlockEpbs) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Block' - { - buf = tail[o0:] - if s.Block == nil { - s.Block = new(BeaconBlockEpbs) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockEpbs object -func (s *SignedBeaconBlockEpbs) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockEpbs) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockEpbs object -func (s *SignedBeaconBlockEpbs) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockEpbs object with a hasher -func (s *SignedBeaconBlockEpbs) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Deposit_Data object -func (d *Deposit_Data) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(d) -} - -// MarshalSSZTo ssz marshals the Deposit_Data object to a target array -func (d *Deposit_Data) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'PublicKey' - if size := len(d.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - dst = append(dst, d.PublicKey...) - - // Field (1) 'WithdrawalCredentials' - if size := len(d.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - dst = append(dst, d.WithdrawalCredentials...) - - // Field (2) 'Amount' - dst = ssz.MarshalUint64(dst, d.Amount) - - // Field (3) 'Signature' - if size := len(d.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, d.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the Deposit_Data object -func (d *Deposit_Data) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 184 { - return ssz.ErrSize - } - - // Field (0) 'PublicKey' - if cap(d.PublicKey) == 0 { - d.PublicKey = make([]byte, 0, len(buf[0:48])) - } - d.PublicKey = append(d.PublicKey, buf[0:48]...) - - // Field (1) 'WithdrawalCredentials' - if cap(d.WithdrawalCredentials) == 0 { - d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) - } - d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...) - - // Field (2) 'Amount' - d.Amount = ssz.UnmarshallUint64(buf[80:88]) - - // Field (3) 'Signature' - if cap(d.Signature) == 0 { - d.Signature = make([]byte, 0, len(buf[88:184])) - } - d.Signature = append(d.Signature, buf[88:184]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Deposit_Data object -func (d *Deposit_Data) SizeSSZ() (size int) { - size = 184 - return -} - -// HashTreeRoot ssz hashes the Deposit_Data object -func (d *Deposit_Data) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(d) -} - -// HashTreeRootWith ssz hashes the Deposit_Data object with a hasher -func (d *Deposit_Data) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PublicKey' - if size := len(d.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - hh.PutBytes(d.PublicKey) - - // Field (1) 'WithdrawalCredentials' - if size := len(d.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - hh.PutBytes(d.WithdrawalCredentials) - - // Field (2) 'Amount' - hh.PutUint64(d.Amount) - - // Field (3) 'Signature' - if size := len(d.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(d.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconState object -func (b *BeaconState) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconState object to a target array -func (b *BeaconState) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2687377) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochAttestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { - offset += 4 - offset += b.PreviousEpochAttestations[ii].SizeSSZ() - } - - // Offset (16) 'CurrentEpochAttestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { - offset += 4 - offset += b.CurrentEpochAttestations[ii].SizeSSZ() - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochAttestations' - if size := len(b.PreviousEpochAttestations); size > 4096 { - err = ssz.ErrListTooBigFn("--.PreviousEpochAttestations", size, 4096) - return - } - { - offset = 4 * len(b.PreviousEpochAttestations) - for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.PreviousEpochAttestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { - if dst, err = b.PreviousEpochAttestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (16) 'CurrentEpochAttestations' - if size := len(b.CurrentEpochAttestations); size > 4096 { - err = ssz.ErrListTooBigFn("--.CurrentEpochAttestations", size, 4096) - return - } - { - offset = 4 * len(b.CurrentEpochAttestations) - for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.CurrentEpochAttestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { - if dst, err = b.CurrentEpochAttestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconState object -func (b *BeaconState) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2687377 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2687377 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochAttestations' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochAttestations' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochAttestations' - { - buf = tail[o15:o16] - num, err := ssz.DecodeDynamicLength(buf, 4096) - if err != nil { - return err - } - b.PreviousEpochAttestations = make([]*PendingAttestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.PreviousEpochAttestations[indx] == nil { - b.PreviousEpochAttestations[indx] = new(PendingAttestation) - } - if err = b.PreviousEpochAttestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (16) 'CurrentEpochAttestations' - { - buf = tail[o16:] - num, err := ssz.DecodeDynamicLength(buf, 4096) - if err != nil { - return err - } - b.CurrentEpochAttestations = make([]*PendingAttestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.CurrentEpochAttestations[indx] == nil { - b.CurrentEpochAttestations[indx] = new(PendingAttestation) - } - if err = b.CurrentEpochAttestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconState object -func (b *BeaconState) SizeSSZ() (size int) { - size = 2687377 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochAttestations' - for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { - size += 4 - size += b.PreviousEpochAttestations[ii].SizeSSZ() - } - - // Field (16) 'CurrentEpochAttestations' - for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { - size += 4 - size += b.CurrentEpochAttestations[ii].SizeSSZ() - } - - return -} - -// HashTreeRoot ssz hashes the BeaconState object -func (b *BeaconState) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconState object with a hasher -func (b *BeaconState) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochAttestations' - { - subIndx := hh.Index() - num := uint64(len(b.PreviousEpochAttestations)) - if num > 4096 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PreviousEpochAttestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, num, 4096) - } - } - - // Field (16) 'CurrentEpochAttestations' - { - subIndx := hh.Index() - num := uint64(len(b.CurrentEpochAttestations)) - if num > 4096 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.CurrentEpochAttestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, num, 4096) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateAltair object -func (b *BeaconStateAltair) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateAltair object to a target array -func (b *BeaconStateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736629) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateAltair object -func (b *BeaconStateAltair) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736629 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736629 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateAltair object -func (b *BeaconStateAltair) SizeSSZ() (size int) { - size = 2736629 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateAltair object -func (b *BeaconStateAltair) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateAltair object with a hasher -func (b *BeaconStateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Fork object -func (f *Fork) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(f) -} - -// MarshalSSZTo ssz marshals the Fork object to a target array -func (f *Fork) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'PreviousVersion' - if size := len(f.PreviousVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.PreviousVersion", size, 4) - return - } - dst = append(dst, f.PreviousVersion...) - - // Field (1) 'CurrentVersion' - if size := len(f.CurrentVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) - return - } - dst = append(dst, f.CurrentVersion...) - - // Field (2) 'Epoch' - dst = ssz.MarshalUint64(dst, uint64(f.Epoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the Fork object -func (f *Fork) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'PreviousVersion' - if cap(f.PreviousVersion) == 0 { - f.PreviousVersion = make([]byte, 0, len(buf[0:4])) - } - f.PreviousVersion = append(f.PreviousVersion, buf[0:4]...) - - // Field (1) 'CurrentVersion' - if cap(f.CurrentVersion) == 0 { - f.CurrentVersion = make([]byte, 0, len(buf[4:8])) - } - f.CurrentVersion = append(f.CurrentVersion, buf[4:8]...) - - // Field (2) 'Epoch' - f.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[8:16])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Fork object -func (f *Fork) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the Fork object -func (f *Fork) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(f) -} - -// HashTreeRootWith ssz hashes the Fork object with a hasher -func (f *Fork) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PreviousVersion' - if size := len(f.PreviousVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.PreviousVersion", size, 4) - return - } - hh.PutBytes(f.PreviousVersion) - - // Field (1) 'CurrentVersion' - if size := len(f.CurrentVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) - return - } - hh.PutBytes(f.CurrentVersion) - - // Field (2) 'Epoch' - hh.PutUint64(uint64(f.Epoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PendingAttestation object -func (p *PendingAttestation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PendingAttestation object to a target array -func (p *PendingAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(148) - - // Offset (0) 'AggregationBits' - dst = ssz.WriteOffset(dst, offset) - offset += len(p.AggregationBits) - - // Field (1) 'Data' - if p.Data == nil { - p.Data = new(AttestationData) - } - if dst, err = p.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'InclusionDelay' - dst = ssz.MarshalUint64(dst, uint64(p.InclusionDelay)) - - // Field (3) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(p.ProposerIndex)) - - // Field (0) 'AggregationBits' - if size := len(p.AggregationBits); size > 2048 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 2048) - return - } - dst = append(dst, p.AggregationBits...) - - return -} - -// UnmarshalSSZ ssz unmarshals the PendingAttestation object -func (p *PendingAttestation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 148 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AggregationBits' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 148 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if p.Data == nil { - p.Data = new(AttestationData) - } - if err = p.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'InclusionDelay' - p.InclusionDelay = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[132:140])) - - // Field (3) 'ProposerIndex' - p.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[140:148])) - - // Field (0) 'AggregationBits' - { - buf = tail[o0:] - if err = ssz.ValidateBitlist(buf, 2048); err != nil { - return err - } - if cap(p.AggregationBits) == 0 { - p.AggregationBits = make([]byte, 0, len(buf)) - } - p.AggregationBits = append(p.AggregationBits, buf...) - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PendingAttestation object -func (p *PendingAttestation) SizeSSZ() (size int) { - size = 148 - - // Field (0) 'AggregationBits' - size += len(p.AggregationBits) - - return -} - -// HashTreeRoot ssz hashes the PendingAttestation object -func (p *PendingAttestation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PendingAttestation object with a hasher -func (p *PendingAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregationBits' - if len(p.AggregationBits) == 0 { - err = ssz.ErrEmptyBitlist - return - } - hh.PutBitlist(p.AggregationBits, 2048) - - // Field (1) 'Data' - if err = p.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'InclusionDelay' - hh.PutUint64(uint64(p.InclusionDelay)) - - // Field (3) 'ProposerIndex' - hh.PutUint64(uint64(p.ProposerIndex)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the HistoricalBatch object -func (h *HistoricalBatch) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(h) -} - -// MarshalSSZTo ssz marshals the HistoricalBatch object to a target array -func (h *HistoricalBatch) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BlockRoots' - if size := len(h.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(h.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, h.BlockRoots[ii]...) - } - - // Field (1) 'StateRoots' - if size := len(h.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(h.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, h.StateRoots[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the HistoricalBatch object -func (h *HistoricalBatch) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 524288 { - return ssz.ErrSize - } - - // Field (0) 'BlockRoots' - h.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(h.BlockRoots[ii]) == 0 { - h.BlockRoots[ii] = make([]byte, 0, len(buf[0:262144][ii*32:(ii+1)*32])) - } - h.BlockRoots[ii] = append(h.BlockRoots[ii], buf[0:262144][ii*32:(ii+1)*32]...) - } - - // Field (1) 'StateRoots' - h.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(h.StateRoots[ii]) == 0 { - h.StateRoots[ii] = make([]byte, 0, len(buf[262144:524288][ii*32:(ii+1)*32])) - } - h.StateRoots[ii] = append(h.StateRoots[ii], buf[262144:524288][ii*32:(ii+1)*32]...) - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the HistoricalBatch object -func (h *HistoricalBatch) SizeSSZ() (size int) { - size = 524288 - return -} - -// HashTreeRoot ssz hashes the HistoricalBatch object -func (h *HistoricalBatch) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(h) -} - -// HashTreeRootWith ssz hashes the HistoricalBatch object with a hasher -func (h *HistoricalBatch) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BlockRoots' - { - if size := len(h.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range h.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (1) 'StateRoots' - { - if size := len(h.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range h.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SigningData object -func (s *SigningData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SigningData object to a target array -func (s *SigningData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'ObjectRoot' - if size := len(s.ObjectRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ObjectRoot", size, 32) - return - } - dst = append(dst, s.ObjectRoot...) - - // Field (1) 'Domain' - if size := len(s.Domain); size != 32 { - err = ssz.ErrBytesLengthFn("--.Domain", size, 32) - return - } - dst = append(dst, s.Domain...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SigningData object -func (s *SigningData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 64 { - return ssz.ErrSize - } - - // Field (0) 'ObjectRoot' - if cap(s.ObjectRoot) == 0 { - s.ObjectRoot = make([]byte, 0, len(buf[0:32])) - } - s.ObjectRoot = append(s.ObjectRoot, buf[0:32]...) - - // Field (1) 'Domain' - if cap(s.Domain) == 0 { - s.Domain = make([]byte, 0, len(buf[32:64])) - } - s.Domain = append(s.Domain, buf[32:64]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SigningData object -func (s *SigningData) SizeSSZ() (size int) { - size = 64 - return -} - -// HashTreeRoot ssz hashes the SigningData object -func (s *SigningData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SigningData object with a hasher -func (s *SigningData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'ObjectRoot' - if size := len(s.ObjectRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ObjectRoot", size, 32) - return - } - hh.PutBytes(s.ObjectRoot) - - // Field (1) 'Domain' - if size := len(s.Domain); size != 32 { - err = ssz.ErrBytesLengthFn("--.Domain", size, 32) - return - } - hh.PutBytes(s.Domain) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ForkData object -func (f *ForkData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(f) -} - -// MarshalSSZTo ssz marshals the ForkData object to a target array -func (f *ForkData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'CurrentVersion' - if size := len(f.CurrentVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) - return - } - dst = append(dst, f.CurrentVersion...) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(f.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, f.GenesisValidatorsRoot...) - - return -} - -// UnmarshalSSZ ssz unmarshals the ForkData object -func (f *ForkData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 36 { - return ssz.ErrSize - } - - // Field (0) 'CurrentVersion' - if cap(f.CurrentVersion) == 0 { - f.CurrentVersion = make([]byte, 0, len(buf[0:4])) - } - f.CurrentVersion = append(f.CurrentVersion, buf[0:4]...) - - // Field (1) 'GenesisValidatorsRoot' - if cap(f.GenesisValidatorsRoot) == 0 { - f.GenesisValidatorsRoot = make([]byte, 0, len(buf[4:36])) - } - f.GenesisValidatorsRoot = append(f.GenesisValidatorsRoot, buf[4:36]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ForkData object -func (f *ForkData) SizeSSZ() (size int) { - size = 36 - return -} - -// HashTreeRoot ssz hashes the ForkData object -func (f *ForkData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(f) -} - -// HashTreeRootWith ssz hashes the ForkData object with a hasher -func (f *ForkData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'CurrentVersion' - if size := len(f.CurrentVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) - return - } - hh.PutBytes(f.CurrentVersion) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(f.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(f.GenesisValidatorsRoot) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the DepositMessage object -func (d *DepositMessage) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(d) -} - -// MarshalSSZTo ssz marshals the DepositMessage object to a target array -func (d *DepositMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'PublicKey' - if size := len(d.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - dst = append(dst, d.PublicKey...) - - // Field (1) 'WithdrawalCredentials' - if size := len(d.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - dst = append(dst, d.WithdrawalCredentials...) - - // Field (2) 'Amount' - dst = ssz.MarshalUint64(dst, d.Amount) - - return -} - -// UnmarshalSSZ ssz unmarshals the DepositMessage object -func (d *DepositMessage) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 88 { - return ssz.ErrSize - } - - // Field (0) 'PublicKey' - if cap(d.PublicKey) == 0 { - d.PublicKey = make([]byte, 0, len(buf[0:48])) - } - d.PublicKey = append(d.PublicKey, buf[0:48]...) - - // Field (1) 'WithdrawalCredentials' - if cap(d.WithdrawalCredentials) == 0 { - d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) - } - d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...) - - // Field (2) 'Amount' - d.Amount = ssz.UnmarshallUint64(buf[80:88]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the DepositMessage object -func (d *DepositMessage) SizeSSZ() (size int) { - size = 88 - return -} - -// HashTreeRoot ssz hashes the DepositMessage object -func (d *DepositMessage) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(d) -} - -// HashTreeRootWith ssz hashes the DepositMessage object with a hasher -func (d *DepositMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PublicKey' - if size := len(d.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - hh.PutBytes(d.PublicKey) - - // Field (1) 'WithdrawalCredentials' - if size := len(d.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - hh.PutBytes(d.WithdrawalCredentials) - - // Field (2) 'Amount' - hh.PutUint64(d.Amount) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncCommittee object -func (s *SyncCommittee) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncCommittee object to a target array -func (s *SyncCommittee) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Pubkeys' - if size := len(s.Pubkeys); size != 512 { - err = ssz.ErrVectorLengthFn("--.Pubkeys", size, 512) - return - } - for ii := 0; ii < 512; ii++ { - if size := len(s.Pubkeys[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkeys[ii]", size, 48) - return - } - dst = append(dst, s.Pubkeys[ii]...) - } - - // Field (1) 'AggregatePubkey' - if size := len(s.AggregatePubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.AggregatePubkey", size, 48) - return - } - dst = append(dst, s.AggregatePubkey...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncCommittee object -func (s *SyncCommittee) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 24624 { - return ssz.ErrSize - } - - // Field (0) 'Pubkeys' - s.Pubkeys = make([][]byte, 512) - for ii := 0; ii < 512; ii++ { - if cap(s.Pubkeys[ii]) == 0 { - s.Pubkeys[ii] = make([]byte, 0, len(buf[0:24576][ii*48:(ii+1)*48])) - } - s.Pubkeys[ii] = append(s.Pubkeys[ii], buf[0:24576][ii*48:(ii+1)*48]...) - } - - // Field (1) 'AggregatePubkey' - if cap(s.AggregatePubkey) == 0 { - s.AggregatePubkey = make([]byte, 0, len(buf[24576:24624])) - } - s.AggregatePubkey = append(s.AggregatePubkey, buf[24576:24624]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncCommittee object -func (s *SyncCommittee) SizeSSZ() (size int) { - size = 24624 - return -} - -// HashTreeRoot ssz hashes the SyncCommittee object -func (s *SyncCommittee) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncCommittee object with a hasher -func (s *SyncCommittee) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Pubkeys' - { - if size := len(s.Pubkeys); size != 512 { - err = ssz.ErrVectorLengthFn("--.Pubkeys", size, 512) - return - } - subIndx := hh.Index() - for _, i := range s.Pubkeys { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (1) 'AggregatePubkey' - if size := len(s.AggregatePubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.AggregatePubkey", size, 48) - return - } - hh.PutBytes(s.AggregatePubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncAggregatorSelectionData object -func (s *SyncAggregatorSelectionData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncAggregatorSelectionData object to a target array -func (s *SyncAggregatorSelectionData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(s.Slot)) - - // Field (1) 'SubcommitteeIndex' - dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncAggregatorSelectionData object -func (s *SyncAggregatorSelectionData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'SubcommitteeIndex' - s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[8:16]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncAggregatorSelectionData object -func (s *SyncAggregatorSelectionData) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the SyncAggregatorSelectionData object -func (s *SyncAggregatorSelectionData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncAggregatorSelectionData object with a hasher -func (s *SyncAggregatorSelectionData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(s.Slot)) - - // Field (1) 'SubcommitteeIndex' - hh.PutUint64(s.SubcommitteeIndex) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateBellatrix object -func (b *BeaconStateBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateBellatrix object to a target array -func (b *BeaconStateBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736633) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (24) 'LatestExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - offset += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (24) 'LatestExecutionPayloadHeader' - if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateBellatrix object -func (b *BeaconStateBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736633 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o24 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736633 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Offset (24) 'LatestExecutionPayloadHeader' - if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { - return ssz.ErrOffset - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o24] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (24) 'LatestExecutionPayloadHeader' - { - buf = tail[o24:] - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateBellatrix object -func (b *BeaconStateBellatrix) SizeSSZ() (size int) { - size = 2736633 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (24) 'LatestExecutionPayloadHeader' - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - size += b.LatestExecutionPayloadHeader.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconStateBellatrix object -func (b *BeaconStateBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateBellatrix object with a hasher -func (b *BeaconStateBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'LatestExecutionPayloadHeader' - if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateCapella object -func (b *BeaconStateCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateCapella object to a target array -func (b *BeaconStateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736653) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (24) 'LatestExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - offset += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (25) 'NextWithdrawalIndex' - dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) - - // Offset (27) 'HistoricalSummaries' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalSummaries) * 64 - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (24) 'LatestExecutionPayloadHeader' - if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (27) 'HistoricalSummaries' - if size := len(b.HistoricalSummaries); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalSummaries); ii++ { - if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateCapella object -func (b *BeaconStateCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736653 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o24, o27 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736653 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Offset (24) 'LatestExecutionPayloadHeader' - if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { - return ssz.ErrOffset - } - - // Field (25) 'NextWithdrawalIndex' - b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) - - // Field (26) 'NextWithdrawalValidatorIndex' - b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) - - // Offset (27) 'HistoricalSummaries' - if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { - return ssz.ErrOffset - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o24] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (24) 'LatestExecutionPayloadHeader' - { - buf = tail[o24:o27] - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (27) 'HistoricalSummaries' - { - buf = tail[o27:] - num, err := ssz.DivideInt2(len(buf), 64, 16777216) - if err != nil { - return err - } - b.HistoricalSummaries = make([]*HistoricalSummary, num) - for ii := 0; ii < num; ii++ { - if b.HistoricalSummaries[ii] == nil { - b.HistoricalSummaries[ii] = new(HistoricalSummary) - } - if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateCapella object -func (b *BeaconStateCapella) SizeSSZ() (size int) { - size = 2736653 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (24) 'LatestExecutionPayloadHeader' - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - size += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (27) 'HistoricalSummaries' - size += len(b.HistoricalSummaries) * 64 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateCapella object -func (b *BeaconStateCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateCapella object with a hasher -func (b *BeaconStateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'LatestExecutionPayloadHeader' - if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (25) 'NextWithdrawalIndex' - hh.PutUint64(b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) - - // Field (27) 'HistoricalSummaries' - { - subIndx := hh.Index() - num := uint64(len(b.HistoricalSummaries)) - if num > 16777216 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.HistoricalSummaries { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16777216) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateDeneb object -func (b *BeaconStateDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateDeneb object to a target array -func (b *BeaconStateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736653) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (24) 'LatestExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - offset += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (25) 'NextWithdrawalIndex' - dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) - - // Offset (27) 'HistoricalSummaries' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalSummaries) * 64 - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (24) 'LatestExecutionPayloadHeader' - if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (27) 'HistoricalSummaries' - if size := len(b.HistoricalSummaries); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalSummaries); ii++ { - if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateDeneb object -func (b *BeaconStateDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736653 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o24, o27 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736653 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Offset (24) 'LatestExecutionPayloadHeader' - if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { - return ssz.ErrOffset - } - - // Field (25) 'NextWithdrawalIndex' - b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) - - // Field (26) 'NextWithdrawalValidatorIndex' - b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) - - // Offset (27) 'HistoricalSummaries' - if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { - return ssz.ErrOffset - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o24] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (24) 'LatestExecutionPayloadHeader' - { - buf = tail[o24:o27] - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (27) 'HistoricalSummaries' - { - buf = tail[o27:] - num, err := ssz.DivideInt2(len(buf), 64, 16777216) - if err != nil { - return err - } - b.HistoricalSummaries = make([]*HistoricalSummary, num) - for ii := 0; ii < num; ii++ { - if b.HistoricalSummaries[ii] == nil { - b.HistoricalSummaries[ii] = new(HistoricalSummary) - } - if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateDeneb object -func (b *BeaconStateDeneb) SizeSSZ() (size int) { - size = 2736653 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (24) 'LatestExecutionPayloadHeader' - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - size += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (27) 'HistoricalSummaries' - size += len(b.HistoricalSummaries) * 64 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateDeneb object -func (b *BeaconStateDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateDeneb object with a hasher -func (b *BeaconStateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'LatestExecutionPayloadHeader' - if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (25) 'NextWithdrawalIndex' - hh.PutUint64(b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) - - // Field (27) 'HistoricalSummaries' - { - subIndx := hh.Index() - num := uint64(len(b.HistoricalSummaries)) - if num > 16777216 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.HistoricalSummaries { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16777216) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateElectra object -func (b *BeaconStateElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateElectra object to a target array -func (b *BeaconStateElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736713) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (24) 'LatestExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - offset += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (25) 'NextWithdrawalIndex' - dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) - - // Offset (27) 'HistoricalSummaries' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalSummaries) * 64 - - // Field (28) 'DepositReceiptsStartIndex' - dst = ssz.MarshalUint64(dst, b.DepositReceiptsStartIndex) - - // Field (29) 'DepositBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.DepositBalanceToConsume)) - - // Field (30) 'ExitBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.ExitBalanceToConsume)) - - // Field (31) 'EarliestExitEpoch' - dst = ssz.MarshalUint64(dst, uint64(b.EarliestExitEpoch)) - - // Field (32) 'ConsolidationBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.ConsolidationBalanceToConsume)) - - // Field (33) 'EarliestConsolidationEpoch' - dst = ssz.MarshalUint64(dst, uint64(b.EarliestConsolidationEpoch)) - - // Offset (34) 'PendingBalanceDeposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingBalanceDeposits) * 16 - - // Offset (35) 'PendingPartialWithdrawals' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingPartialWithdrawals) * 24 - - // Offset (36) 'PendingConsolidations' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingConsolidations) * 16 - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (24) 'LatestExecutionPayloadHeader' - if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (27) 'HistoricalSummaries' - if size := len(b.HistoricalSummaries); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalSummaries); ii++ { - if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (34) 'PendingBalanceDeposits' - if size := len(b.PendingBalanceDeposits); size > 134217728 { - err = ssz.ErrListTooBigFn("--.PendingBalanceDeposits", size, 134217728) - return - } - for ii := 0; ii < len(b.PendingBalanceDeposits); ii++ { - if dst, err = b.PendingBalanceDeposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (35) 'PendingPartialWithdrawals' - if size := len(b.PendingPartialWithdrawals); size > 134217728 { - err = ssz.ErrListTooBigFn("--.PendingPartialWithdrawals", size, 134217728) - return - } - for ii := 0; ii < len(b.PendingPartialWithdrawals); ii++ { - if dst, err = b.PendingPartialWithdrawals[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (36) 'PendingConsolidations' - if size := len(b.PendingConsolidations); size > 262144 { - err = ssz.ErrListTooBigFn("--.PendingConsolidations", size, 262144) - return - } - for ii := 0; ii < len(b.PendingConsolidations); ii++ { - if dst, err = b.PendingConsolidations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateElectra object -func (b *BeaconStateElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736713 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o24, o27, o34, o35, o36 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736713 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Offset (24) 'LatestExecutionPayloadHeader' - if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { - return ssz.ErrOffset - } - - // Field (25) 'NextWithdrawalIndex' - b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) - - // Field (26) 'NextWithdrawalValidatorIndex' - b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) - - // Offset (27) 'HistoricalSummaries' - if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { - return ssz.ErrOffset - } - - // Field (28) 'DepositReceiptsStartIndex' - b.DepositReceiptsStartIndex = ssz.UnmarshallUint64(buf[2736653:2736661]) - - // Field (29) 'DepositBalanceToConsume' - b.DepositBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736661:2736669])) - - // Field (30) 'ExitBalanceToConsume' - b.ExitBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736669:2736677])) - - // Field (31) 'EarliestExitEpoch' - b.EarliestExitEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[2736677:2736685])) - - // Field (32) 'ConsolidationBalanceToConsume' - b.ConsolidationBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736685:2736693])) - - // Field (33) 'EarliestConsolidationEpoch' - b.EarliestConsolidationEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[2736693:2736701])) - - // Offset (34) 'PendingBalanceDeposits' - if o34 = ssz.ReadOffset(buf[2736701:2736705]); o34 > size || o27 > o34 { - return ssz.ErrOffset - } - - // Offset (35) 'PendingPartialWithdrawals' - if o35 = ssz.ReadOffset(buf[2736705:2736709]); o35 > size || o34 > o35 { - return ssz.ErrOffset - } - - // Offset (36) 'PendingConsolidations' - if o36 = ssz.ReadOffset(buf[2736709:2736713]); o36 > size || o35 > o36 { - return ssz.ErrOffset - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o24] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (24) 'LatestExecutionPayloadHeader' - { - buf = tail[o24:o27] - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (27) 'HistoricalSummaries' - { - buf = tail[o27:o34] - num, err := ssz.DivideInt2(len(buf), 64, 16777216) - if err != nil { - return err - } - b.HistoricalSummaries = make([]*HistoricalSummary, num) - for ii := 0; ii < num; ii++ { - if b.HistoricalSummaries[ii] == nil { - b.HistoricalSummaries[ii] = new(HistoricalSummary) - } - if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { - return err - } - } - } - - // Field (34) 'PendingBalanceDeposits' - { - buf = tail[o34:o35] - num, err := ssz.DivideInt2(len(buf), 16, 134217728) - if err != nil { - return err - } - b.PendingBalanceDeposits = make([]*PendingBalanceDeposit, num) - for ii := 0; ii < num; ii++ { - if b.PendingBalanceDeposits[ii] == nil { - b.PendingBalanceDeposits[ii] = new(PendingBalanceDeposit) - } - if err = b.PendingBalanceDeposits[ii].UnmarshalSSZ(buf[ii*16 : (ii+1)*16]); err != nil { - return err - } - } - } - - // Field (35) 'PendingPartialWithdrawals' - { - buf = tail[o35:o36] - num, err := ssz.DivideInt2(len(buf), 24, 134217728) - if err != nil { - return err - } - b.PendingPartialWithdrawals = make([]*PendingPartialWithdrawal, num) - for ii := 0; ii < num; ii++ { - if b.PendingPartialWithdrawals[ii] == nil { - b.PendingPartialWithdrawals[ii] = new(PendingPartialWithdrawal) - } - if err = b.PendingPartialWithdrawals[ii].UnmarshalSSZ(buf[ii*24 : (ii+1)*24]); err != nil { - return err - } - } - } - - // Field (36) 'PendingConsolidations' - { - buf = tail[o36:] - num, err := ssz.DivideInt2(len(buf), 16, 262144) - if err != nil { - return err - } - b.PendingConsolidations = make([]*PendingConsolidation, num) - for ii := 0; ii < num; ii++ { - if b.PendingConsolidations[ii] == nil { - b.PendingConsolidations[ii] = new(PendingConsolidation) - } - if err = b.PendingConsolidations[ii].UnmarshalSSZ(buf[ii*16 : (ii+1)*16]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateElectra object -func (b *BeaconStateElectra) SizeSSZ() (size int) { - size = 2736713 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (24) 'LatestExecutionPayloadHeader' - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - size += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (27) 'HistoricalSummaries' - size += len(b.HistoricalSummaries) * 64 - - // Field (34) 'PendingBalanceDeposits' - size += len(b.PendingBalanceDeposits) * 16 - - // Field (35) 'PendingPartialWithdrawals' - size += len(b.PendingPartialWithdrawals) * 24 - - // Field (36) 'PendingConsolidations' - size += len(b.PendingConsolidations) * 16 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateElectra object -func (b *BeaconStateElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateElectra object with a hasher -func (b *BeaconStateElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'LatestExecutionPayloadHeader' - if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (25) 'NextWithdrawalIndex' - hh.PutUint64(b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) - - // Field (27) 'HistoricalSummaries' - { - subIndx := hh.Index() - num := uint64(len(b.HistoricalSummaries)) - if num > 16777216 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.HistoricalSummaries { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16777216) - } - } - - // Field (28) 'DepositReceiptsStartIndex' - hh.PutUint64(b.DepositReceiptsStartIndex) - - // Field (29) 'DepositBalanceToConsume' - hh.PutUint64(uint64(b.DepositBalanceToConsume)) - - // Field (30) 'ExitBalanceToConsume' - hh.PutUint64(uint64(b.ExitBalanceToConsume)) - - // Field (31) 'EarliestExitEpoch' - hh.PutUint64(uint64(b.EarliestExitEpoch)) - - // Field (32) 'ConsolidationBalanceToConsume' - hh.PutUint64(uint64(b.ConsolidationBalanceToConsume)) - - // Field (33) 'EarliestConsolidationEpoch' - hh.PutUint64(uint64(b.EarliestConsolidationEpoch)) - - // Field (34) 'PendingBalanceDeposits' - { - subIndx := hh.Index() - num := uint64(len(b.PendingBalanceDeposits)) - if num > 134217728 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingBalanceDeposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 134217728) - } else { - hh.MerkleizeWithMixin(subIndx, num, 134217728) - } - } - - // Field (35) 'PendingPartialWithdrawals' - { - subIndx := hh.Index() - num := uint64(len(b.PendingPartialWithdrawals)) - if num > 134217728 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingPartialWithdrawals { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 134217728) - } else { - hh.MerkleizeWithMixin(subIndx, num, 134217728) - } - } - - // Field (36) 'PendingConsolidations' - { - subIndx := hh.Index() - num := uint64(len(b.PendingConsolidations)) - if num > 262144 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingConsolidations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 262144) - } else { - hh.MerkleizeWithMixin(subIndx, num, 262144) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateEPBS object -func (b *BeaconStateEPBS) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateEPBS object to a target array -func (b *BeaconStateEPBS) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736965) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (24) 'NextWithdrawalIndex' - dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) - - // Field (25) 'NextWithdrawalValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) - - // Offset (26) 'HistoricalSummaries' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalSummaries) * 64 - - // Field (27) 'DepositReceiptsStartIndex' - dst = ssz.MarshalUint64(dst, b.DepositReceiptsStartIndex) - - // Field (28) 'DepositBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.DepositBalanceToConsume)) - - // Field (29) 'ExitBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.ExitBalanceToConsume)) - - // Field (30) 'EarliestExitEpoch' - dst = ssz.MarshalUint64(dst, uint64(b.EarliestExitEpoch)) - - // Field (31) 'ConsolidationBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.ConsolidationBalanceToConsume)) - - // Field (32) 'EarliestConsolidationEpoch' - dst = ssz.MarshalUint64(dst, uint64(b.EarliestConsolidationEpoch)) - - // Offset (33) 'PendingBalanceDeposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingBalanceDeposits) * 16 - - // Offset (34) 'PendingPartialWithdrawals' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingPartialWithdrawals) * 24 - - // Offset (35) 'PendingConsolidations' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingConsolidations) * 16 - - // Field (36) 'PreviousInclusionListProposer' - dst = ssz.MarshalUint64(dst, uint64(b.PreviousInclusionListProposer)) - - // Field (37) 'PreviousInclusionListSlot' - dst = ssz.MarshalUint64(dst, uint64(b.PreviousInclusionListSlot)) - - // Field (38) 'LatestInclusionListProposer' - dst = ssz.MarshalUint64(dst, uint64(b.LatestInclusionListProposer)) - - // Field (39) 'LatestInclusionListSlot' - dst = ssz.MarshalUint64(dst, uint64(b.LatestInclusionListSlot)) - - // Field (40) 'LatestBlockHash' - if size := len(b.LatestBlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.LatestBlockHash", size, 32) - return - } - dst = append(dst, b.LatestBlockHash...) - - // Field (41) 'LatestFullSlot' - dst = ssz.MarshalUint64(dst, uint64(b.LatestFullSlot)) - - // Field (42) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderEPBS) - } - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (43) 'LastWithdrawalsRoot' - if size := len(b.LastWithdrawalsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.LastWithdrawalsRoot", size, 32) - return - } - dst = append(dst, b.LastWithdrawalsRoot...) - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (26) 'HistoricalSummaries' - if size := len(b.HistoricalSummaries); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalSummaries); ii++ { - if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (33) 'PendingBalanceDeposits' - if size := len(b.PendingBalanceDeposits); size > 134217728 { - err = ssz.ErrListTooBigFn("--.PendingBalanceDeposits", size, 134217728) - return - } - for ii := 0; ii < len(b.PendingBalanceDeposits); ii++ { - if dst, err = b.PendingBalanceDeposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (34) 'PendingPartialWithdrawals' - if size := len(b.PendingPartialWithdrawals); size > 134217728 { - err = ssz.ErrListTooBigFn("--.PendingPartialWithdrawals", size, 134217728) - return - } - for ii := 0; ii < len(b.PendingPartialWithdrawals); ii++ { - if dst, err = b.PendingPartialWithdrawals[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (35) 'PendingConsolidations' - if size := len(b.PendingConsolidations); size > 262144 { - err = ssz.ErrListTooBigFn("--.PendingConsolidations", size, 262144) - return - } - for ii := 0; ii < len(b.PendingConsolidations); ii++ { - if dst, err = b.PendingConsolidations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateEPBS object -func (b *BeaconStateEPBS) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736965 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o26, o33, o34, o35 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736965 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Field (24) 'NextWithdrawalIndex' - b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736629:2736637]) - - // Field (25) 'NextWithdrawalValidatorIndex' - b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736637:2736645])) - - // Offset (26) 'HistoricalSummaries' - if o26 = ssz.ReadOffset(buf[2736645:2736649]); o26 > size || o21 > o26 { - return ssz.ErrOffset - } - - // Field (27) 'DepositReceiptsStartIndex' - b.DepositReceiptsStartIndex = ssz.UnmarshallUint64(buf[2736649:2736657]) - - // Field (28) 'DepositBalanceToConsume' - b.DepositBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736657:2736665])) - - // Field (29) 'ExitBalanceToConsume' - b.ExitBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736665:2736673])) - - // Field (30) 'EarliestExitEpoch' - b.EarliestExitEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[2736673:2736681])) - - // Field (31) 'ConsolidationBalanceToConsume' - b.ConsolidationBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736681:2736689])) - - // Field (32) 'EarliestConsolidationEpoch' - b.EarliestConsolidationEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[2736689:2736697])) - - // Offset (33) 'PendingBalanceDeposits' - if o33 = ssz.ReadOffset(buf[2736697:2736701]); o33 > size || o26 > o33 { - return ssz.ErrOffset - } - - // Offset (34) 'PendingPartialWithdrawals' - if o34 = ssz.ReadOffset(buf[2736701:2736705]); o34 > size || o33 > o34 { - return ssz.ErrOffset - } - - // Offset (35) 'PendingConsolidations' - if o35 = ssz.ReadOffset(buf[2736705:2736709]); o35 > size || o34 > o35 { - return ssz.ErrOffset - } - - // Field (36) 'PreviousInclusionListProposer' - b.PreviousInclusionListProposer = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736709:2736717])) - - // Field (37) 'PreviousInclusionListSlot' - b.PreviousInclusionListSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[2736717:2736725])) - - // Field (38) 'LatestInclusionListProposer' - b.LatestInclusionListProposer = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736725:2736733])) - - // Field (39) 'LatestInclusionListSlot' - b.LatestInclusionListSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[2736733:2736741])) - - // Field (40) 'LatestBlockHash' - if cap(b.LatestBlockHash) == 0 { - b.LatestBlockHash = make([]byte, 0, len(buf[2736741:2736773])) - } - b.LatestBlockHash = append(b.LatestBlockHash, buf[2736741:2736773]...) - - // Field (41) 'LatestFullSlot' - b.LatestFullSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[2736773:2736781])) - - // Field (42) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderEPBS) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf[2736781:2736933]); err != nil { - return err - } - - // Field (43) 'LastWithdrawalsRoot' - if cap(b.LastWithdrawalsRoot) == 0 { - b.LastWithdrawalsRoot = make([]byte, 0, len(buf[2736933:2736965])) - } - b.LastWithdrawalsRoot = append(b.LastWithdrawalsRoot, buf[2736933:2736965]...) - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o26] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (26) 'HistoricalSummaries' - { - buf = tail[o26:o33] - num, err := ssz.DivideInt2(len(buf), 64, 16777216) - if err != nil { - return err - } - b.HistoricalSummaries = make([]*HistoricalSummary, num) - for ii := 0; ii < num; ii++ { - if b.HistoricalSummaries[ii] == nil { - b.HistoricalSummaries[ii] = new(HistoricalSummary) - } - if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { - return err - } - } - } - - // Field (33) 'PendingBalanceDeposits' - { - buf = tail[o33:o34] - num, err := ssz.DivideInt2(len(buf), 16, 134217728) - if err != nil { - return err - } - b.PendingBalanceDeposits = make([]*PendingBalanceDeposit, num) - for ii := 0; ii < num; ii++ { - if b.PendingBalanceDeposits[ii] == nil { - b.PendingBalanceDeposits[ii] = new(PendingBalanceDeposit) - } - if err = b.PendingBalanceDeposits[ii].UnmarshalSSZ(buf[ii*16 : (ii+1)*16]); err != nil { - return err - } - } - } - - // Field (34) 'PendingPartialWithdrawals' - { - buf = tail[o34:o35] - num, err := ssz.DivideInt2(len(buf), 24, 134217728) - if err != nil { - return err - } - b.PendingPartialWithdrawals = make([]*PendingPartialWithdrawal, num) - for ii := 0; ii < num; ii++ { - if b.PendingPartialWithdrawals[ii] == nil { - b.PendingPartialWithdrawals[ii] = new(PendingPartialWithdrawal) - } - if err = b.PendingPartialWithdrawals[ii].UnmarshalSSZ(buf[ii*24 : (ii+1)*24]); err != nil { - return err - } - } - } - - // Field (35) 'PendingConsolidations' - { - buf = tail[o35:] - num, err := ssz.DivideInt2(len(buf), 16, 262144) - if err != nil { - return err - } - b.PendingConsolidations = make([]*PendingConsolidation, num) - for ii := 0; ii < num; ii++ { - if b.PendingConsolidations[ii] == nil { - b.PendingConsolidations[ii] = new(PendingConsolidation) - } - if err = b.PendingConsolidations[ii].UnmarshalSSZ(buf[ii*16 : (ii+1)*16]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateEPBS object -func (b *BeaconStateEPBS) SizeSSZ() (size int) { - size = 2736965 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (26) 'HistoricalSummaries' - size += len(b.HistoricalSummaries) * 64 - - // Field (33) 'PendingBalanceDeposits' - size += len(b.PendingBalanceDeposits) * 16 - - // Field (34) 'PendingPartialWithdrawals' - size += len(b.PendingPartialWithdrawals) * 24 - - // Field (35) 'PendingConsolidations' - size += len(b.PendingConsolidations) * 16 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateEPBS object -func (b *BeaconStateEPBS) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateEPBS object with a hasher -func (b *BeaconStateEPBS) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'NextWithdrawalIndex' - hh.PutUint64(b.NextWithdrawalIndex) - - // Field (25) 'NextWithdrawalValidatorIndex' - hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) - - // Field (26) 'HistoricalSummaries' - { - subIndx := hh.Index() - num := uint64(len(b.HistoricalSummaries)) - if num > 16777216 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.HistoricalSummaries { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16777216) - } - } - - // Field (27) 'DepositReceiptsStartIndex' - hh.PutUint64(b.DepositReceiptsStartIndex) - - // Field (28) 'DepositBalanceToConsume' - hh.PutUint64(uint64(b.DepositBalanceToConsume)) - - // Field (29) 'ExitBalanceToConsume' - hh.PutUint64(uint64(b.ExitBalanceToConsume)) - - // Field (30) 'EarliestExitEpoch' - hh.PutUint64(uint64(b.EarliestExitEpoch)) - - // Field (31) 'ConsolidationBalanceToConsume' - hh.PutUint64(uint64(b.ConsolidationBalanceToConsume)) - - // Field (32) 'EarliestConsolidationEpoch' - hh.PutUint64(uint64(b.EarliestConsolidationEpoch)) - - // Field (33) 'PendingBalanceDeposits' - { - subIndx := hh.Index() - num := uint64(len(b.PendingBalanceDeposits)) - if num > 134217728 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingBalanceDeposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 134217728) - } else { - hh.MerkleizeWithMixin(subIndx, num, 134217728) - } - } - - // Field (34) 'PendingPartialWithdrawals' - { - subIndx := hh.Index() - num := uint64(len(b.PendingPartialWithdrawals)) - if num > 134217728 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingPartialWithdrawals { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 134217728) - } else { - hh.MerkleizeWithMixin(subIndx, num, 134217728) - } - } - - // Field (35) 'PendingConsolidations' - { - subIndx := hh.Index() - num := uint64(len(b.PendingConsolidations)) - if num > 262144 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingConsolidations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 262144) - } else { - hh.MerkleizeWithMixin(subIndx, num, 262144) - } - } - - // Field (36) 'PreviousInclusionListProposer' - hh.PutUint64(uint64(b.PreviousInclusionListProposer)) - - // Field (37) 'PreviousInclusionListSlot' - hh.PutUint64(uint64(b.PreviousInclusionListSlot)) - - // Field (38) 'LatestInclusionListProposer' - hh.PutUint64(uint64(b.LatestInclusionListProposer)) - - // Field (39) 'LatestInclusionListSlot' - hh.PutUint64(uint64(b.LatestInclusionListSlot)) - - // Field (40) 'LatestBlockHash' - if size := len(b.LatestBlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.LatestBlockHash", size, 32) - return - } - hh.PutBytes(b.LatestBlockHash) - - // Field (41) 'LatestFullSlot' - hh.PutUint64(uint64(b.LatestFullSlot)) - - // Field (42) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (43) 'LastWithdrawalsRoot' - if size := len(b.LastWithdrawalsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.LastWithdrawalsRoot", size, 32) - return - } - hh.PutBytes(b.LastWithdrawalsRoot) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PowBlock object -func (p *PowBlock) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PowBlock object to a target array -func (p *PowBlock) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BlockHash' - if size := len(p.BlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) - return - } - dst = append(dst, p.BlockHash...) - - // Field (1) 'ParentHash' - if size := len(p.ParentHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) - return - } - dst = append(dst, p.ParentHash...) - - // Field (2) 'TotalDifficulty' - if size := len(p.TotalDifficulty); size != 32 { - err = ssz.ErrBytesLengthFn("--.TotalDifficulty", size, 32) - return - } - dst = append(dst, p.TotalDifficulty...) - - return -} - -// UnmarshalSSZ ssz unmarshals the PowBlock object -func (p *PowBlock) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 96 { - return ssz.ErrSize - } - - // Field (0) 'BlockHash' - if cap(p.BlockHash) == 0 { - p.BlockHash = make([]byte, 0, len(buf[0:32])) - } - p.BlockHash = append(p.BlockHash, buf[0:32]...) - - // Field (1) 'ParentHash' - if cap(p.ParentHash) == 0 { - p.ParentHash = make([]byte, 0, len(buf[32:64])) - } - p.ParentHash = append(p.ParentHash, buf[32:64]...) - - // Field (2) 'TotalDifficulty' - if cap(p.TotalDifficulty) == 0 { - p.TotalDifficulty = make([]byte, 0, len(buf[64:96])) - } - p.TotalDifficulty = append(p.TotalDifficulty, buf[64:96]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PowBlock object -func (p *PowBlock) SizeSSZ() (size int) { - size = 96 - return -} - -// HashTreeRoot ssz hashes the PowBlock object -func (p *PowBlock) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PowBlock object with a hasher -func (p *PowBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BlockHash' - if size := len(p.BlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) - return - } - hh.PutBytes(p.BlockHash) - - // Field (1) 'ParentHash' - if size := len(p.ParentHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) - return - } - hh.PutBytes(p.ParentHash) - - // Field (2) 'TotalDifficulty' - if size := len(p.TotalDifficulty); size != 32 { - err = ssz.ErrBytesLengthFn("--.TotalDifficulty", size, 32) - return - } - hh.PutBytes(p.TotalDifficulty) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the HistoricalSummary object -func (h *HistoricalSummary) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(h) -} - -// MarshalSSZTo ssz marshals the HistoricalSummary object to a target array -func (h *HistoricalSummary) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BlockSummaryRoot' - if size := len(h.BlockSummaryRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockSummaryRoot", size, 32) - return - } - dst = append(dst, h.BlockSummaryRoot...) - - // Field (1) 'StateSummaryRoot' - if size := len(h.StateSummaryRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateSummaryRoot", size, 32) - return - } - dst = append(dst, h.StateSummaryRoot...) - - return -} - -// UnmarshalSSZ ssz unmarshals the HistoricalSummary object -func (h *HistoricalSummary) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 64 { - return ssz.ErrSize - } - - // Field (0) 'BlockSummaryRoot' - if cap(h.BlockSummaryRoot) == 0 { - h.BlockSummaryRoot = make([]byte, 0, len(buf[0:32])) - } - h.BlockSummaryRoot = append(h.BlockSummaryRoot, buf[0:32]...) - - // Field (1) 'StateSummaryRoot' - if cap(h.StateSummaryRoot) == 0 { - h.StateSummaryRoot = make([]byte, 0, len(buf[32:64])) - } - h.StateSummaryRoot = append(h.StateSummaryRoot, buf[32:64]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the HistoricalSummary object -func (h *HistoricalSummary) SizeSSZ() (size int) { - size = 64 - return -} - -// HashTreeRoot ssz hashes the HistoricalSummary object -func (h *HistoricalSummary) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(h) -} - -// HashTreeRootWith ssz hashes the HistoricalSummary object with a hasher -func (h *HistoricalSummary) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BlockSummaryRoot' - if size := len(h.BlockSummaryRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockSummaryRoot", size, 32) - return - } - hh.PutBytes(h.BlockSummaryRoot) - - // Field (1) 'StateSummaryRoot' - if size := len(h.StateSummaryRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateSummaryRoot", size, 32) - return - } - hh.PutBytes(h.StateSummaryRoot) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindPayloadEnvelope object -func (s *SignedBlindPayloadEnvelope) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindPayloadEnvelope object to a target array -func (s *SignedBlindPayloadEnvelope) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(BlindPayloadEnvelope) - } - offset += s.Message.SizeSSZ() - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - // Field (0) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBlindPayloadEnvelope object -func (s *SignedBlindPayloadEnvelope) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 100 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[4:100])) - } - s.Signature = append(s.Signature, buf[4:100]...) - - // Field (0) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(BlindPayloadEnvelope) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindPayloadEnvelope object -func (s *SignedBlindPayloadEnvelope) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BlindPayloadEnvelope) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindPayloadEnvelope object -func (s *SignedBlindPayloadEnvelope) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindPayloadEnvelope object with a hasher -func (s *SignedBlindPayloadEnvelope) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlindPayloadEnvelope object -func (b *BlindPayloadEnvelope) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindPayloadEnvelope object to a target array -func (b *BlindPayloadEnvelope) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(221) - - // Field (0) 'PayloadRoot' - if size := len(b.PayloadRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.PayloadRoot", size, 32) - return - } - dst = append(dst, b.PayloadRoot...) - - // Field (1) 'BuilderIndex' - dst = ssz.MarshalUint64(dst, uint64(b.BuilderIndex)) - - // Field (2) 'BeaconBlockRoot' - if size := len(b.BeaconBlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) - return - } - dst = append(dst, b.BeaconBlockRoot...) - - // Offset (3) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Field (4) 'InclusionListProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(b.InclusionListProposerIndex)) - - // Field (5) 'InclusionListSlot' - dst = ssz.MarshalUint64(dst, uint64(b.InclusionListSlot)) - - // Field (6) 'InclusionListSignature' - if size := len(b.InclusionListSignature); size != 96 { - err = ssz.ErrBytesLengthFn("--.InclusionListSignature", size, 96) - return - } - dst = append(dst, b.InclusionListSignature...) - - // Field (7) 'PayloadWithheld' - dst = ssz.MarshalBool(dst, b.PayloadWithheld) - - // Field (8) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - dst = append(dst, b.StateRoot...) - - // Field (3) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindPayloadEnvelope object -func (b *BlindPayloadEnvelope) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 221 { - return ssz.ErrSize - } - - tail := buf - var o3 uint64 - - // Field (0) 'PayloadRoot' - if cap(b.PayloadRoot) == 0 { - b.PayloadRoot = make([]byte, 0, len(buf[0:32])) - } - b.PayloadRoot = append(b.PayloadRoot, buf[0:32]...) - - // Field (1) 'BuilderIndex' - b.BuilderIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[32:40])) - - // Field (2) 'BeaconBlockRoot' - if cap(b.BeaconBlockRoot) == 0 { - b.BeaconBlockRoot = make([]byte, 0, len(buf[40:72])) - } - b.BeaconBlockRoot = append(b.BeaconBlockRoot, buf[40:72]...) - - // Offset (3) 'BlobKzgCommitments' - if o3 = ssz.ReadOffset(buf[72:76]); o3 > size { - return ssz.ErrOffset - } - - if o3 < 221 { - return ssz.ErrInvalidVariableOffset - } - - // Field (4) 'InclusionListProposerIndex' - b.InclusionListProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[76:84])) - - // Field (5) 'InclusionListSlot' - b.InclusionListSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[84:92])) - - // Field (6) 'InclusionListSignature' - if cap(b.InclusionListSignature) == 0 { - b.InclusionListSignature = make([]byte, 0, len(buf[92:188])) - } - b.InclusionListSignature = append(b.InclusionListSignature, buf[92:188]...) - - // Field (7) 'PayloadWithheld' - b.PayloadWithheld = ssz.UnmarshalBool(buf[188:189]) - - // Field (8) 'StateRoot' - if cap(b.StateRoot) == 0 { - b.StateRoot = make([]byte, 0, len(buf[189:221])) - } - b.StateRoot = append(b.StateRoot, buf[189:221]...) - - // Field (3) 'BlobKzgCommitments' - { - buf = tail[o3:] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindPayloadEnvelope object -func (b *BlindPayloadEnvelope) SizeSSZ() (size int) { - size = 221 - - // Field (3) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - return -} - -// HashTreeRoot ssz hashes the BlindPayloadEnvelope object -func (b *BlindPayloadEnvelope) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindPayloadEnvelope object with a hasher -func (b *BlindPayloadEnvelope) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PayloadRoot' - if size := len(b.PayloadRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.PayloadRoot", size, 32) - return - } - hh.PutBytes(b.PayloadRoot) - - // Field (1) 'BuilderIndex' - hh.PutUint64(uint64(b.BuilderIndex)) - - // Field (2) 'BeaconBlockRoot' - if size := len(b.BeaconBlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) - return - } - hh.PutBytes(b.BeaconBlockRoot) - - // Field (3) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (4) 'InclusionListProposerIndex' - hh.PutUint64(uint64(b.InclusionListProposerIndex)) - - // Field (5) 'InclusionListSlot' - hh.PutUint64(uint64(b.InclusionListSlot)) - - // Field (6) 'InclusionListSignature' - if size := len(b.InclusionListSignature); size != 96 { - err = ssz.ErrBytesLengthFn("--.InclusionListSignature", size, 96) - return - } - hh.PutBytes(b.InclusionListSignature) - - // Field (7) 'PayloadWithheld' - hh.PutBool(b.PayloadWithheld) - - // Field (8) 'StateRoot' - if size := len(b.StateRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) - return - } - hh.PutBytes(b.StateRoot) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlobIdentifier object -func (b *BlobIdentifier) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlobIdentifier object to a target array -func (b *BlobIdentifier) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BlockRoot' - if size := len(b.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - dst = append(dst, b.BlockRoot...) - - // Field (1) 'Index' - dst = ssz.MarshalUint64(dst, b.Index) - - return -} - -// UnmarshalSSZ ssz unmarshals the BlobIdentifier object -func (b *BlobIdentifier) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 40 { - return ssz.ErrSize - } - - // Field (0) 'BlockRoot' - if cap(b.BlockRoot) == 0 { - b.BlockRoot = make([]byte, 0, len(buf[0:32])) - } - b.BlockRoot = append(b.BlockRoot, buf[0:32]...) - - // Field (1) 'Index' - b.Index = ssz.UnmarshallUint64(buf[32:40]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlobIdentifier object -func (b *BlobIdentifier) SizeSSZ() (size int) { - size = 40 - return -} - -// HashTreeRoot ssz hashes the BlobIdentifier object -func (b *BlobIdentifier) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlobIdentifier object with a hasher -func (b *BlobIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BlockRoot' - if size := len(b.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - hh.PutBytes(b.BlockRoot) - - // Field (1) 'Index' - hh.PutUint64(b.Index) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PendingBalanceDeposit object -func (p *PendingBalanceDeposit) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PendingBalanceDeposit object to a target array -func (p *PendingBalanceDeposit) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Index' - dst = ssz.MarshalUint64(dst, uint64(p.Index)) - - // Field (1) 'Amount' - dst = ssz.MarshalUint64(dst, p.Amount) - - return -} - -// UnmarshalSSZ ssz unmarshals the PendingBalanceDeposit object -func (p *PendingBalanceDeposit) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'Index' - p.Index = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Amount' - p.Amount = ssz.UnmarshallUint64(buf[8:16]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PendingBalanceDeposit object -func (p *PendingBalanceDeposit) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the PendingBalanceDeposit object -func (p *PendingBalanceDeposit) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PendingBalanceDeposit object with a hasher -func (p *PendingBalanceDeposit) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Index' - hh.PutUint64(uint64(p.Index)) - - // Field (1) 'Amount' - hh.PutUint64(p.Amount) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PendingPartialWithdrawal object -func (p *PendingPartialWithdrawal) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PendingPartialWithdrawal object to a target array -func (p *PendingPartialWithdrawal) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Index' - dst = ssz.MarshalUint64(dst, uint64(p.Index)) - - // Field (1) 'Amount' - dst = ssz.MarshalUint64(dst, p.Amount) - - // Field (2) 'WithdrawableEpoch' - dst = ssz.MarshalUint64(dst, uint64(p.WithdrawableEpoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the PendingPartialWithdrawal object -func (p *PendingPartialWithdrawal) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 24 { - return ssz.ErrSize - } - - // Field (0) 'Index' - p.Index = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Amount' - p.Amount = ssz.UnmarshallUint64(buf[8:16]) - - // Field (2) 'WithdrawableEpoch' - p.WithdrawableEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[16:24])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PendingPartialWithdrawal object -func (p *PendingPartialWithdrawal) SizeSSZ() (size int) { - size = 24 - return -} - -// HashTreeRoot ssz hashes the PendingPartialWithdrawal object -func (p *PendingPartialWithdrawal) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PendingPartialWithdrawal object with a hasher -func (p *PendingPartialWithdrawal) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Index' - hh.PutUint64(uint64(p.Index)) - - // Field (1) 'Amount' - hh.PutUint64(p.Amount) - - // Field (2) 'WithdrawableEpoch' - hh.PutUint64(uint64(p.WithdrawableEpoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Consolidation object -func (c *Consolidation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(c) -} - -// MarshalSSZTo ssz marshals the Consolidation object to a target array -func (c *Consolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SourceIndex' - dst = ssz.MarshalUint64(dst, uint64(c.SourceIndex)) - - // Field (1) 'TargetIndex' - dst = ssz.MarshalUint64(dst, uint64(c.TargetIndex)) - - // Field (2) 'Epoch' - dst = ssz.MarshalUint64(dst, uint64(c.Epoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the Consolidation object -func (c *Consolidation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 24 { - return ssz.ErrSize - } - - // Field (0) 'SourceIndex' - c.SourceIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'TargetIndex' - c.TargetIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'Epoch' - c.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[16:24])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Consolidation object -func (c *Consolidation) SizeSSZ() (size int) { - size = 24 - return -} - -// HashTreeRoot ssz hashes the Consolidation object -func (c *Consolidation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(c) -} - -// HashTreeRootWith ssz hashes the Consolidation object with a hasher -func (c *Consolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SourceIndex' - hh.PutUint64(uint64(c.SourceIndex)) - - // Field (1) 'TargetIndex' - hh.PutUint64(uint64(c.TargetIndex)) - - // Field (2) 'Epoch' - hh.PutUint64(uint64(c.Epoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedConsolidation object -func (s *SignedConsolidation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedConsolidation object to a target array -func (s *SignedConsolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(Consolidation) - } - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedConsolidation object -func (s *SignedConsolidation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 120 { - return ssz.ErrSize - } - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(Consolidation) - } - if err = s.Message.UnmarshalSSZ(buf[0:24]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[24:120])) - } - s.Signature = append(s.Signature, buf[24:120]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedConsolidation object -func (s *SignedConsolidation) SizeSSZ() (size int) { - size = 120 - return -} - -// HashTreeRoot ssz hashes the SignedConsolidation object -func (s *SignedConsolidation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedConsolidation object with a hasher -func (s *SignedConsolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PendingConsolidation object -func (p *PendingConsolidation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PendingConsolidation object to a target array -func (p *PendingConsolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SourceIndex' - dst = ssz.MarshalUint64(dst, uint64(p.SourceIndex)) - - // Field (1) 'TargetIndex' - dst = ssz.MarshalUint64(dst, uint64(p.TargetIndex)) - - return -} - -// UnmarshalSSZ ssz unmarshals the PendingConsolidation object -func (p *PendingConsolidation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'SourceIndex' - p.SourceIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'TargetIndex' - p.TargetIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PendingConsolidation object -func (p *PendingConsolidation) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the PendingConsolidation object -func (p *PendingConsolidation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PendingConsolidation object with a hasher -func (p *PendingConsolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SourceIndex' - hh.PutUint64(uint64(p.SourceIndex)) - - // Field (1) 'TargetIndex' - hh.PutUint64(uint64(p.TargetIndex)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Status object -func (s *Status) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the Status object to a target array -func (s *Status) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'ForkDigest' - if size := len(s.ForkDigest); size != 4 { - err = ssz.ErrBytesLengthFn("--.ForkDigest", size, 4) - return - } - dst = append(dst, s.ForkDigest...) - - // Field (1) 'FinalizedRoot' - if size := len(s.FinalizedRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.FinalizedRoot", size, 32) - return - } - dst = append(dst, s.FinalizedRoot...) - - // Field (2) 'FinalizedEpoch' - dst = ssz.MarshalUint64(dst, uint64(s.FinalizedEpoch)) - - // Field (3) 'HeadRoot' - if size := len(s.HeadRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.HeadRoot", size, 32) - return - } - dst = append(dst, s.HeadRoot...) - - // Field (4) 'HeadSlot' - dst = ssz.MarshalUint64(dst, uint64(s.HeadSlot)) - - return -} - -// UnmarshalSSZ ssz unmarshals the Status object -func (s *Status) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 84 { - return ssz.ErrSize - } - - // Field (0) 'ForkDigest' - if cap(s.ForkDigest) == 0 { - s.ForkDigest = make([]byte, 0, len(buf[0:4])) - } - s.ForkDigest = append(s.ForkDigest, buf[0:4]...) - - // Field (1) 'FinalizedRoot' - if cap(s.FinalizedRoot) == 0 { - s.FinalizedRoot = make([]byte, 0, len(buf[4:36])) - } - s.FinalizedRoot = append(s.FinalizedRoot, buf[4:36]...) - - // Field (2) 'FinalizedEpoch' - s.FinalizedEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[36:44])) - - // Field (3) 'HeadRoot' - if cap(s.HeadRoot) == 0 { - s.HeadRoot = make([]byte, 0, len(buf[44:76])) - } - s.HeadRoot = append(s.HeadRoot, buf[44:76]...) - - // Field (4) 'HeadSlot' - s.HeadSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[76:84])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Status object -func (s *Status) SizeSSZ() (size int) { - size = 84 - return -} - -// HashTreeRoot ssz hashes the Status object -func (s *Status) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the Status object with a hasher -func (s *Status) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'ForkDigest' - if size := len(s.ForkDigest); size != 4 { - err = ssz.ErrBytesLengthFn("--.ForkDigest", size, 4) - return - } - hh.PutBytes(s.ForkDigest) - - // Field (1) 'FinalizedRoot' - if size := len(s.FinalizedRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.FinalizedRoot", size, 32) - return - } - hh.PutBytes(s.FinalizedRoot) - - // Field (2) 'FinalizedEpoch' - hh.PutUint64(uint64(s.FinalizedEpoch)) - - // Field (3) 'HeadRoot' - if size := len(s.HeadRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.HeadRoot", size, 32) - return - } - hh.PutBytes(s.HeadRoot) - - // Field (4) 'HeadSlot' - hh.PutUint64(uint64(s.HeadSlot)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlocksByRangeRequest object -func (b *BeaconBlocksByRangeRequest) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlocksByRangeRequest object to a target array -func (b *BeaconBlocksByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'StartSlot' - dst = ssz.MarshalUint64(dst, uint64(b.StartSlot)) - - // Field (1) 'Count' - dst = ssz.MarshalUint64(dst, b.Count) - - // Field (2) 'Step' - dst = ssz.MarshalUint64(dst, b.Step) - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlocksByRangeRequest object -func (b *BeaconBlocksByRangeRequest) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 24 { - return ssz.ErrSize - } - - // Field (0) 'StartSlot' - b.StartSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Count' - b.Count = ssz.UnmarshallUint64(buf[8:16]) - - // Field (2) 'Step' - b.Step = ssz.UnmarshallUint64(buf[16:24]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlocksByRangeRequest object -func (b *BeaconBlocksByRangeRequest) SizeSSZ() (size int) { - size = 24 - return -} - -// HashTreeRoot ssz hashes the BeaconBlocksByRangeRequest object -func (b *BeaconBlocksByRangeRequest) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlocksByRangeRequest object with a hasher -func (b *BeaconBlocksByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'StartSlot' - hh.PutUint64(uint64(b.StartSlot)) - - // Field (1) 'Count' - hh.PutUint64(b.Count) - - // Field (2) 'Step' - hh.PutUint64(b.Step) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ENRForkID object -func (e *ENRForkID) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(e) -} - -// MarshalSSZTo ssz marshals the ENRForkID object to a target array -func (e *ENRForkID) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'CurrentForkDigest' - if size := len(e.CurrentForkDigest); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentForkDigest", size, 4) - return - } - dst = append(dst, e.CurrentForkDigest...) - - // Field (1) 'NextForkVersion' - if size := len(e.NextForkVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.NextForkVersion", size, 4) - return - } - dst = append(dst, e.NextForkVersion...) - - // Field (2) 'NextForkEpoch' - dst = ssz.MarshalUint64(dst, uint64(e.NextForkEpoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the ENRForkID object -func (e *ENRForkID) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'CurrentForkDigest' - if cap(e.CurrentForkDigest) == 0 { - e.CurrentForkDigest = make([]byte, 0, len(buf[0:4])) - } - e.CurrentForkDigest = append(e.CurrentForkDigest, buf[0:4]...) - - // Field (1) 'NextForkVersion' - if cap(e.NextForkVersion) == 0 { - e.NextForkVersion = make([]byte, 0, len(buf[4:8])) - } - e.NextForkVersion = append(e.NextForkVersion, buf[4:8]...) - - // Field (2) 'NextForkEpoch' - e.NextForkEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[8:16])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ENRForkID object -func (e *ENRForkID) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the ENRForkID object -func (e *ENRForkID) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(e) -} - -// HashTreeRootWith ssz hashes the ENRForkID object with a hasher -func (e *ENRForkID) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'CurrentForkDigest' - if size := len(e.CurrentForkDigest); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentForkDigest", size, 4) - return - } - hh.PutBytes(e.CurrentForkDigest) - - // Field (1) 'NextForkVersion' - if size := len(e.NextForkVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.NextForkVersion", size, 4) - return - } - hh.PutBytes(e.NextForkVersion) - - // Field (2) 'NextForkEpoch' - hh.PutUint64(uint64(e.NextForkEpoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the MetaDataV0 object -func (m *MetaDataV0) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(m) -} - -// MarshalSSZTo ssz marshals the MetaDataV0 object to a target array -func (m *MetaDataV0) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SeqNumber' - dst = ssz.MarshalUint64(dst, m.SeqNumber) - - // Field (1) 'Attnets' - if size := len(m.Attnets); size != 8 { - err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) - return - } - dst = append(dst, m.Attnets...) - - return -} - -// UnmarshalSSZ ssz unmarshals the MetaDataV0 object -func (m *MetaDataV0) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'SeqNumber' - m.SeqNumber = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'Attnets' - if cap(m.Attnets) == 0 { - m.Attnets = make([]byte, 0, len(buf[8:16])) - } - m.Attnets = append(m.Attnets, buf[8:16]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV0 object -func (m *MetaDataV0) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the MetaDataV0 object -func (m *MetaDataV0) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(m) -} - -// HashTreeRootWith ssz hashes the MetaDataV0 object with a hasher -func (m *MetaDataV0) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SeqNumber' - hh.PutUint64(m.SeqNumber) - - // Field (1) 'Attnets' - if size := len(m.Attnets); size != 8 { - err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) - return - } - hh.PutBytes(m.Attnets) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the MetaDataV1 object -func (m *MetaDataV1) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(m) -} - -// MarshalSSZTo ssz marshals the MetaDataV1 object to a target array -func (m *MetaDataV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SeqNumber' - dst = ssz.MarshalUint64(dst, m.SeqNumber) - - // Field (1) 'Attnets' - if size := len(m.Attnets); size != 8 { - err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) - return - } - dst = append(dst, m.Attnets...) - - // Field (2) 'Syncnets' - if size := len(m.Syncnets); size != 1 { - err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1) - return - } - dst = append(dst, m.Syncnets...) - - return -} - -// UnmarshalSSZ ssz unmarshals the MetaDataV1 object -func (m *MetaDataV1) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 17 { - return ssz.ErrSize - } - - // Field (0) 'SeqNumber' - m.SeqNumber = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'Attnets' - if cap(m.Attnets) == 0 { - m.Attnets = make([]byte, 0, len(buf[8:16])) - } - m.Attnets = append(m.Attnets, buf[8:16]...) - - // Field (2) 'Syncnets' - if cap(m.Syncnets) == 0 { - m.Syncnets = make([]byte, 0, len(buf[16:17])) - } - m.Syncnets = append(m.Syncnets, buf[16:17]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV1 object -func (m *MetaDataV1) SizeSSZ() (size int) { - size = 17 - return -} - -// HashTreeRoot ssz hashes the MetaDataV1 object -func (m *MetaDataV1) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(m) -} - -// HashTreeRootWith ssz hashes the MetaDataV1 object with a hasher -func (m *MetaDataV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SeqNumber' - hh.PutUint64(m.SeqNumber) - - // Field (1) 'Attnets' - if size := len(m.Attnets); size != 8 { - err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) - return - } - hh.PutBytes(m.Attnets) - - // Field (2) 'Syncnets' - if size := len(m.Syncnets); size != 1 { - err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1) - return - } - hh.PutBytes(m.Syncnets) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlobSidecarsByRangeRequest object -func (b *BlobSidecarsByRangeRequest) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlobSidecarsByRangeRequest object to a target array -func (b *BlobSidecarsByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'StartSlot' - dst = ssz.MarshalUint64(dst, uint64(b.StartSlot)) - - // Field (1) 'Count' - dst = ssz.MarshalUint64(dst, b.Count) - - return -} - -// UnmarshalSSZ ssz unmarshals the BlobSidecarsByRangeRequest object -func (b *BlobSidecarsByRangeRequest) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'StartSlot' - b.StartSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Count' - b.Count = ssz.UnmarshallUint64(buf[8:16]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecarsByRangeRequest object -func (b *BlobSidecarsByRangeRequest) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the BlobSidecarsByRangeRequest object -func (b *BlobSidecarsByRangeRequest) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlobSidecarsByRangeRequest object with a hasher -func (b *BlobSidecarsByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'StartSlot' - hh.PutUint64(uint64(b.StartSlot)) - - // Field (1) 'Count' - hh.PutUint64(b.Count) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PayloadAttestationData object -func (p *PayloadAttestationData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PayloadAttestationData object to a target array -func (p *PayloadAttestationData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BeaconBlockRoot' - if size := len(p.BeaconBlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) - return - } - dst = append(dst, p.BeaconBlockRoot...) - - // Field (1) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(p.Slot)) - - // Field (2) 'PayloadStatus' - dst = ssz.MarshalUint64(dst, uint64(p.PayloadStatus)) - - return -} - -// UnmarshalSSZ ssz unmarshals the PayloadAttestationData object -func (p *PayloadAttestationData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 48 { - return ssz.ErrSize - } - - // Field (0) 'BeaconBlockRoot' - if cap(p.BeaconBlockRoot) == 0 { - p.BeaconBlockRoot = make([]byte, 0, len(buf[0:32])) - } - p.BeaconBlockRoot = append(p.BeaconBlockRoot, buf[0:32]...) - - // Field (1) 'Slot' - p.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[32:40])) - - // Field (2) 'PayloadStatus' - p.PayloadStatus = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.PTCStatus(ssz.UnmarshallUint64(buf[40:48])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PayloadAttestationData object -func (p *PayloadAttestationData) SizeSSZ() (size int) { - size = 48 - return -} - -// HashTreeRoot ssz hashes the PayloadAttestationData object -func (p *PayloadAttestationData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PayloadAttestationData object with a hasher -func (p *PayloadAttestationData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BeaconBlockRoot' - if size := len(p.BeaconBlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) - return - } - hh.PutBytes(p.BeaconBlockRoot) - - // Field (1) 'Slot' - hh.PutUint64(uint64(p.Slot)) - - // Field (2) 'PayloadStatus' - hh.PutUint64(uint64(p.PayloadStatus)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PayloadAttestation object -func (p *PayloadAttestation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PayloadAttestation object to a target array -func (p *PayloadAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'AggregationBits' - if size := len(p.AggregationBits); size != 64 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 64) - return - } - dst = append(dst, p.AggregationBits...) - - // Field (1) 'Data' - if p.Data == nil { - p.Data = new(PayloadAttestationData) - } - if dst, err = p.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(p.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, p.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the PayloadAttestation object -func (p *PayloadAttestation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 208 { - return ssz.ErrSize - } - - // Field (0) 'AggregationBits' - if cap(p.AggregationBits) == 0 { - p.AggregationBits = make([]byte, 0, len(buf[0:64])) - } - p.AggregationBits = append(p.AggregationBits, buf[0:64]...) - - // Field (1) 'Data' - if p.Data == nil { - p.Data = new(PayloadAttestationData) - } - if err = p.Data.UnmarshalSSZ(buf[64:112]); err != nil { - return err - } - - // Field (2) 'Signature' - if cap(p.Signature) == 0 { - p.Signature = make([]byte, 0, len(buf[112:208])) - } - p.Signature = append(p.Signature, buf[112:208]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PayloadAttestation object -func (p *PayloadAttestation) SizeSSZ() (size int) { - size = 208 - return -} - -// HashTreeRoot ssz hashes the PayloadAttestation object -func (p *PayloadAttestation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PayloadAttestation object with a hasher -func (p *PayloadAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregationBits' - if size := len(p.AggregationBits); size != 64 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 64) - return - } - hh.PutBytes(p.AggregationBits) - - // Field (1) 'Data' - if err = p.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(p.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(p.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PayloadAttestationMessage object -func (p *PayloadAttestationMessage) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PayloadAttestationMessage object to a target array -func (p *PayloadAttestationMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'ValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(p.ValidatorIndex)) - - // Field (1) 'Data' - if p.Data == nil { - p.Data = new(PayloadAttestationData) - } - if dst, err = p.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(p.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, p.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the PayloadAttestationMessage object -func (p *PayloadAttestationMessage) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 152 { - return ssz.ErrSize - } - - // Field (0) 'ValidatorIndex' - p.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Data' - if p.Data == nil { - p.Data = new(PayloadAttestationData) - } - if err = p.Data.UnmarshalSSZ(buf[8:56]); err != nil { - return err - } - - // Field (2) 'Signature' - if cap(p.Signature) == 0 { - p.Signature = make([]byte, 0, len(buf[56:152])) - } - p.Signature = append(p.Signature, buf[56:152]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PayloadAttestationMessage object -func (p *PayloadAttestationMessage) SizeSSZ() (size int) { - size = 152 - return -} - -// HashTreeRoot ssz hashes the PayloadAttestationMessage object -func (p *PayloadAttestationMessage) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PayloadAttestationMessage object with a hasher -func (p *PayloadAttestationMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'ValidatorIndex' - hh.PutUint64(uint64(p.ValidatorIndex)) - - // Field (1) 'Data' - if err = p.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(p.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(p.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the DepositSnapshot object -func (d *DepositSnapshot) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(d) -} - -// MarshalSSZTo ssz marshals the DepositSnapshot object to a target array -func (d *DepositSnapshot) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Offset (0) 'Finalized' - dst = ssz.WriteOffset(dst, offset) - offset += len(d.Finalized) * 32 - - // Field (1) 'DepositRoot' - if size := len(d.DepositRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) - return - } - dst = append(dst, d.DepositRoot...) - - // Field (2) 'DepositCount' - dst = ssz.MarshalUint64(dst, d.DepositCount) - - // Field (3) 'ExecutionHash' - if size := len(d.ExecutionHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.ExecutionHash", size, 32) - return - } - dst = append(dst, d.ExecutionHash...) - - // Field (4) 'ExecutionDepth' - dst = ssz.MarshalUint64(dst, d.ExecutionDepth) - - // Field (0) 'Finalized' - if size := len(d.Finalized); size > 32 { - err = ssz.ErrListTooBigFn("--.Finalized", size, 32) - return - } - for ii := 0; ii < len(d.Finalized); ii++ { - if size := len(d.Finalized[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.Finalized[ii]", size, 32) - return - } - dst = append(dst, d.Finalized[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the DepositSnapshot object -func (d *DepositSnapshot) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Finalized' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'DepositRoot' - if cap(d.DepositRoot) == 0 { - d.DepositRoot = make([]byte, 0, len(buf[4:36])) - } - d.DepositRoot = append(d.DepositRoot, buf[4:36]...) - - // Field (2) 'DepositCount' - d.DepositCount = ssz.UnmarshallUint64(buf[36:44]) - - // Field (3) 'ExecutionHash' - if cap(d.ExecutionHash) == 0 { - d.ExecutionHash = make([]byte, 0, len(buf[44:76])) - } - d.ExecutionHash = append(d.ExecutionHash, buf[44:76]...) - - // Field (4) 'ExecutionDepth' - d.ExecutionDepth = ssz.UnmarshallUint64(buf[76:84]) - - // Field (0) 'Finalized' - { - buf = tail[o0:] - num, err := ssz.DivideInt2(len(buf), 32, 32) - if err != nil { - return err - } - d.Finalized = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(d.Finalized[ii]) == 0 { - d.Finalized[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - d.Finalized[ii] = append(d.Finalized[ii], buf[ii*32:(ii+1)*32]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the DepositSnapshot object -func (d *DepositSnapshot) SizeSSZ() (size int) { - size = 84 - - // Field (0) 'Finalized' - size += len(d.Finalized) * 32 - - return -} - -// HashTreeRoot ssz hashes the DepositSnapshot object -func (d *DepositSnapshot) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(d) -} - -// HashTreeRootWith ssz hashes the DepositSnapshot object with a hasher -func (d *DepositSnapshot) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Finalized' - { - if size := len(d.Finalized); size > 32 { - err = ssz.ErrListTooBigFn("--.Finalized", size, 32) - return - } - subIndx := hh.Index() - for _, i := range d.Finalized { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(d.Finalized)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 32) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 32) - } - } - - // Field (1) 'DepositRoot' - if size := len(d.DepositRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) - return - } - hh.PutBytes(d.DepositRoot) - - // Field (2) 'DepositCount' - hh.PutUint64(d.DepositCount) - - // Field (3) 'ExecutionHash' - if size := len(d.ExecutionHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.ExecutionHash", size, 32) - return - } - hh.PutBytes(d.ExecutionHash) - - // Field (4) 'ExecutionDepth' - hh.PutUint64(d.ExecutionDepth) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncCommitteeMessage object -func (s *SyncCommitteeMessage) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncCommitteeMessage object to a target array -func (s *SyncCommitteeMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(s.Slot)) - - // Field (1) 'BlockRoot' - if size := len(s.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - dst = append(dst, s.BlockRoot...) - - // Field (2) 'ValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(s.ValidatorIndex)) - - // Field (3) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncCommitteeMessage object -func (s *SyncCommitteeMessage) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 144 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'BlockRoot' - if cap(s.BlockRoot) == 0 { - s.BlockRoot = make([]byte, 0, len(buf[8:40])) - } - s.BlockRoot = append(s.BlockRoot, buf[8:40]...) - - // Field (2) 'ValidatorIndex' - s.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[48:144])) - } - s.Signature = append(s.Signature, buf[48:144]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeMessage object -func (s *SyncCommitteeMessage) SizeSSZ() (size int) { - size = 144 - return -} - -// HashTreeRoot ssz hashes the SyncCommitteeMessage object -func (s *SyncCommitteeMessage) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncCommitteeMessage object with a hasher -func (s *SyncCommitteeMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(s.Slot)) - - // Field (1) 'BlockRoot' - if size := len(s.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - hh.PutBytes(s.BlockRoot) - - // Field (2) 'ValidatorIndex' - hh.PutUint64(uint64(s.ValidatorIndex)) - - // Field (3) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncCommitteeContribution object -func (s *SyncCommitteeContribution) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncCommitteeContribution object to a target array -func (s *SyncCommitteeContribution) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(s.Slot)) - - // Field (1) 'BlockRoot' - if size := len(s.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - dst = append(dst, s.BlockRoot...) - - // Field (2) 'SubcommitteeIndex' - dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex) - - // Field (3) 'AggregationBits' - if size := len(s.AggregationBits); size != 16 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 16) - return - } - dst = append(dst, s.AggregationBits...) - - // Field (4) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncCommitteeContribution object -func (s *SyncCommitteeContribution) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 160 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'BlockRoot' - if cap(s.BlockRoot) == 0 { - s.BlockRoot = make([]byte, 0, len(buf[8:40])) - } - s.BlockRoot = append(s.BlockRoot, buf[8:40]...) - - // Field (2) 'SubcommitteeIndex' - s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[40:48]) - - // Field (3) 'AggregationBits' - if cap(s.AggregationBits) == 0 { - s.AggregationBits = make([]byte, 0, len(buf[48:64])) - } - s.AggregationBits = append(s.AggregationBits, buf[48:64]...) - - // Field (4) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[64:160])) - } - s.Signature = append(s.Signature, buf[64:160]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeContribution object -func (s *SyncCommitteeContribution) SizeSSZ() (size int) { - size = 160 - return -} - -// HashTreeRoot ssz hashes the SyncCommitteeContribution object -func (s *SyncCommitteeContribution) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncCommitteeContribution object with a hasher -func (s *SyncCommitteeContribution) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(s.Slot)) - - // Field (1) 'BlockRoot' - if size := len(s.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - hh.PutBytes(s.BlockRoot) - - // Field (2) 'SubcommitteeIndex' - hh.PutUint64(s.SubcommitteeIndex) - - // Field (3) 'AggregationBits' - if size := len(s.AggregationBits); size != 16 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 16) - return - } - hh.PutBytes(s.AggregationBits) - - // Field (4) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ContributionAndProof object -func (c *ContributionAndProof) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(c) -} - -// MarshalSSZTo ssz marshals the ContributionAndProof object to a target array -func (c *ContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'AggregatorIndex' - dst = ssz.MarshalUint64(dst, uint64(c.AggregatorIndex)) - - // Field (1) 'Contribution' - if c.Contribution == nil { - c.Contribution = new(SyncCommitteeContribution) - } - if dst, err = c.Contribution.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'SelectionProof' - if size := len(c.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - dst = append(dst, c.SelectionProof...) - - return -} - -// UnmarshalSSZ ssz unmarshals the ContributionAndProof object -func (c *ContributionAndProof) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 264 { - return ssz.ErrSize - } - - // Field (0) 'AggregatorIndex' - c.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Contribution' - if c.Contribution == nil { - c.Contribution = new(SyncCommitteeContribution) - } - if err = c.Contribution.UnmarshalSSZ(buf[8:168]); err != nil { - return err - } - - // Field (2) 'SelectionProof' - if cap(c.SelectionProof) == 0 { - c.SelectionProof = make([]byte, 0, len(buf[168:264])) - } - c.SelectionProof = append(c.SelectionProof, buf[168:264]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ContributionAndProof object -func (c *ContributionAndProof) SizeSSZ() (size int) { - size = 264 - return -} - -// HashTreeRoot ssz hashes the ContributionAndProof object -func (c *ContributionAndProof) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(c) -} - -// HashTreeRootWith ssz hashes the ContributionAndProof object with a hasher -func (c *ContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregatorIndex' - hh.PutUint64(uint64(c.AggregatorIndex)) - - // Field (1) 'Contribution' - if err = c.Contribution.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'SelectionProof' - if size := len(c.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - hh.PutBytes(c.SelectionProof) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedContributionAndProof object -func (s *SignedContributionAndProof) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedContributionAndProof object to a target array -func (s *SignedContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(ContributionAndProof) - } - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedContributionAndProof object -func (s *SignedContributionAndProof) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 360 { - return ssz.ErrSize - } - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(ContributionAndProof) - } - if err = s.Message.UnmarshalSSZ(buf[0:264]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[264:360])) - } - s.Signature = append(s.Signature, buf[264:360]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedContributionAndProof object -func (s *SignedContributionAndProof) SizeSSZ() (size int) { - size = 360 - return -} - -// HashTreeRoot ssz hashes the SignedContributionAndProof object -func (s *SignedContributionAndProof) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedContributionAndProof object with a hasher -func (s *SignedContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Validator object -func (v *Validator) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(v) -} - -// MarshalSSZTo ssz marshals the Validator object to a target array -func (v *Validator) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'PublicKey' - if size := len(v.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - dst = append(dst, v.PublicKey...) - - // Field (1) 'WithdrawalCredentials' - if size := len(v.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - dst = append(dst, v.WithdrawalCredentials...) - - // Field (2) 'EffectiveBalance' - dst = ssz.MarshalUint64(dst, v.EffectiveBalance) - - // Field (3) 'Slashed' - dst = ssz.MarshalBool(dst, v.Slashed) - - // Field (4) 'ActivationEligibilityEpoch' - dst = ssz.MarshalUint64(dst, uint64(v.ActivationEligibilityEpoch)) - - // Field (5) 'ActivationEpoch' - dst = ssz.MarshalUint64(dst, uint64(v.ActivationEpoch)) - - // Field (6) 'ExitEpoch' - dst = ssz.MarshalUint64(dst, uint64(v.ExitEpoch)) - - // Field (7) 'WithdrawableEpoch' - dst = ssz.MarshalUint64(dst, uint64(v.WithdrawableEpoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the Validator object -func (v *Validator) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 121 { - return ssz.ErrSize - } - - // Field (0) 'PublicKey' - if cap(v.PublicKey) == 0 { - v.PublicKey = make([]byte, 0, len(buf[0:48])) - } - v.PublicKey = append(v.PublicKey, buf[0:48]...) - - // Field (1) 'WithdrawalCredentials' - if cap(v.WithdrawalCredentials) == 0 { - v.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) - } - v.WithdrawalCredentials = append(v.WithdrawalCredentials, buf[48:80]...) - - // Field (2) 'EffectiveBalance' - v.EffectiveBalance = ssz.UnmarshallUint64(buf[80:88]) - - // Field (3) 'Slashed' - v.Slashed = ssz.UnmarshalBool(buf[88:89]) - - // Field (4) 'ActivationEligibilityEpoch' - v.ActivationEligibilityEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[89:97])) - - // Field (5) 'ActivationEpoch' - v.ActivationEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[97:105])) - - // Field (6) 'ExitEpoch' - v.ExitEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[105:113])) - - // Field (7) 'WithdrawableEpoch' - v.WithdrawableEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[113:121])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Validator object -func (v *Validator) SizeSSZ() (size int) { - size = 121 - return -} - -// HashTreeRoot ssz hashes the Validator object -func (v *Validator) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(v) -} - -// HashTreeRootWith ssz hashes the Validator object with a hasher -func (v *Validator) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PublicKey' - if size := len(v.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - hh.PutBytes(v.PublicKey) - - // Field (1) 'WithdrawalCredentials' - if size := len(v.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - hh.PutBytes(v.WithdrawalCredentials) - - // Field (2) 'EffectiveBalance' - hh.PutUint64(v.EffectiveBalance) - - // Field (3) 'Slashed' - hh.PutBool(v.Slashed) - - // Field (4) 'ActivationEligibilityEpoch' - hh.PutUint64(uint64(v.ActivationEligibilityEpoch)) - - // Field (5) 'ActivationEpoch' - hh.PutUint64(uint64(v.ActivationEpoch)) - - // Field (6) 'ExitEpoch' - hh.PutUint64(uint64(v.ExitEpoch)) - - // Field (7) 'WithdrawableEpoch' - hh.PutUint64(uint64(v.WithdrawableEpoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BLSToExecutionChange object -func (b *BLSToExecutionChange) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BLSToExecutionChange object to a target array -func (b *BLSToExecutionChange) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'ValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ValidatorIndex)) - - // Field (1) 'FromBlsPubkey' - if size := len(b.FromBlsPubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.FromBlsPubkey", size, 48) - return - } - dst = append(dst, b.FromBlsPubkey...) - - // Field (2) 'ToExecutionAddress' - if size := len(b.ToExecutionAddress); size != 20 { - err = ssz.ErrBytesLengthFn("--.ToExecutionAddress", size, 20) - return - } - dst = append(dst, b.ToExecutionAddress...) - - return -} - -// UnmarshalSSZ ssz unmarshals the BLSToExecutionChange object -func (b *BLSToExecutionChange) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 76 { - return ssz.ErrSize - } - - // Field (0) 'ValidatorIndex' - b.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'FromBlsPubkey' - if cap(b.FromBlsPubkey) == 0 { - b.FromBlsPubkey = make([]byte, 0, len(buf[8:56])) - } - b.FromBlsPubkey = append(b.FromBlsPubkey, buf[8:56]...) - - // Field (2) 'ToExecutionAddress' - if cap(b.ToExecutionAddress) == 0 { - b.ToExecutionAddress = make([]byte, 0, len(buf[56:76])) - } - b.ToExecutionAddress = append(b.ToExecutionAddress, buf[56:76]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BLSToExecutionChange object -func (b *BLSToExecutionChange) SizeSSZ() (size int) { - size = 76 - return -} - -// HashTreeRoot ssz hashes the BLSToExecutionChange object -func (b *BLSToExecutionChange) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BLSToExecutionChange object with a hasher -func (b *BLSToExecutionChange) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'ValidatorIndex' - hh.PutUint64(uint64(b.ValidatorIndex)) - - // Field (1) 'FromBlsPubkey' - if size := len(b.FromBlsPubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.FromBlsPubkey", size, 48) - return - } - hh.PutBytes(b.FromBlsPubkey) - - // Field (2) 'ToExecutionAddress' - if size := len(b.ToExecutionAddress); size != 20 { - err = ssz.ErrBytesLengthFn("--.ToExecutionAddress", size, 20) - return - } - hh.PutBytes(b.ToExecutionAddress) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBLSToExecutionChange object -func (s *SignedBLSToExecutionChange) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBLSToExecutionChange object to a target array -func (s *SignedBLSToExecutionChange) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BLSToExecutionChange) - } - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBLSToExecutionChange object -func (s *SignedBLSToExecutionChange) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 172 { - return ssz.ErrSize - } - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BLSToExecutionChange) - } - if err = s.Message.UnmarshalSSZ(buf[0:76]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[76:172])) - } - s.Signature = append(s.Signature, buf[76:172]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBLSToExecutionChange object -func (s *SignedBLSToExecutionChange) SizeSSZ() (size int) { - size = 172 - return -} - -// HashTreeRoot ssz hashes the SignedBLSToExecutionChange object -func (s *SignedBLSToExecutionChange) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBLSToExecutionChange object with a hasher -func (s *SignedBLSToExecutionChange) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(s.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} diff --git a/testing/util/random/epbs.go b/testing/util/random/epbs.go index 9cea93bc644d..5a72fcc5dbc8 100644 --- a/testing/util/random/epbs.go +++ b/testing/util/random/epbs.go @@ -265,13 +265,9 @@ func BeaconState(t *testing.T) *ethpb.BeaconStateEPBS { TargetIndex: primitives.ValidatorIndex(randomUint64(t)), }, }, - PreviousInclusionListProposer: primitives.ValidatorIndex(randomUint64(t)), - PreviousInclusionListSlot: primitives.Slot(randomUint64(t)), - LatestInclusionListProposer: primitives.ValidatorIndex(randomUint64(t)), - LatestInclusionListSlot: primitives.Slot(randomUint64(t)), - LatestBlockHash: randomBytes(32, t), - LatestFullSlot: primitives.Slot(randomUint64(t)), - ExecutionPayloadHeader: &enginev1.ExecutionPayloadHeaderEPBS{ + LatestBlockHash: randomBytes(32, t), + LatestFullSlot: primitives.Slot(randomUint64(t)), + LatestExecutionPayloadHeader: &enginev1.ExecutionPayloadHeaderEPBS{ ParentBlockHash: randomBytes(32, t), ParentBlockRoot: randomBytes(32, t), BlockHash: randomBytes(32, t), @@ -279,6 +275,7 @@ func BeaconState(t *testing.T) *ethpb.BeaconStateEPBS { Slot: primitives.Slot(randomUint64(t)), Value: randomUint64(t), BlobKzgCommitmentsRoot: randomBytes(32, t), + GasLimit: randomUint64(t), }, LastWithdrawalsRoot: randomBytes(32, t), } @@ -302,6 +299,7 @@ func ExecutionPayloadHeader(t *testing.T) *enginev1.ExecutionPayloadHeaderEPBS { Slot: primitives.Slot(randomUint64(t)), Value: randomUint64(t), BlobKzgCommitmentsRoot: randomBytes(32, t), + GasLimit: randomUint64(t), } } @@ -363,21 +361,18 @@ func SignedExecutionPayloadEnvelope(t *testing.T) *enginev1.SignedExecutionPaylo func ExecutionPayloadEnvelope(t *testing.T) *enginev1.ExecutionPayloadEnvelope { withheld := randomUint64(t)%2 == 0 return &enginev1.ExecutionPayloadEnvelope{ - Payload: ExecutionPayload(t), - BuilderIndex: primitives.ValidatorIndex(randomUint64(t)), - BeaconBlockRoot: randomBytes(32, t), - BlobKzgCommitments: [][]byte{randomBytes(48, t), randomBytes(48, t), randomBytes(48, t)}, - InclusionListProposerIndex: primitives.ValidatorIndex(randomUint64(t)), - InclusionListSlot: primitives.Slot(randomUint64(t)), - InclusionListSignature: randomBytes(96, t), - PayloadWithheld: withheld, - StateRoot: randomBytes(32, t), + Payload: ExecutionPayload(t), + BuilderIndex: primitives.ValidatorIndex(randomUint64(t)), + BeaconBlockRoot: randomBytes(32, t), + BlobKzgCommitments: [][]byte{randomBytes(48, t), randomBytes(48, t), randomBytes(48, t)}, + PayloadWithheld: withheld, + StateRoot: randomBytes(32, t), } } // ExecutionPayload creates a random ExecutionPayloadEPBS for testing purposes. -func ExecutionPayload(t *testing.T) *enginev1.ExecutionPayloadEPBS { - return &enginev1.ExecutionPayloadEPBS{ +func ExecutionPayload(t *testing.T) *enginev1.ExecutionPayloadElectra { + return &enginev1.ExecutionPayloadElectra{ ParentHash: randomBytes(32, t), FeeRecipient: randomBytes(20, t), StateRoot: randomBytes(32, t), @@ -400,40 +395,45 @@ func ExecutionPayload(t *testing.T) *enginev1.ExecutionPayloadEPBS { Amount: randomUint64(t), }, }, - BlobGasUsed: randomUint64(t), - ExcessBlobGas: randomUint64(t), - InclusionListSummary: [][]byte{randomBytes(20, t), randomBytes(20, t), randomBytes(20, t)}, + BlobGasUsed: randomUint64(t), + ExcessBlobGas: randomUint64(t), + DepositRequests: []*enginev1.DepositRequest{DepositRequest(t), DepositRequest(t), DepositRequest(t), DepositRequest(t)}, + WithdrawalRequests: WithdrawalRequests(t), + ConsolidationRequests: []*enginev1.ConsolidationRequest{ConsolidationRequest(t)}, } } -// InclusionList creates a random InclusionList for testing purposes. -func InclusionList(t *testing.T) *enginev1.InclusionList { - return &enginev1.InclusionList{ - SignedSummary: &enginev1.SignedInclusionListSummary{ - Message: InclusionSummary(t), - Signature: randomBytes(96, t), - }, - ParentBlockHash: randomBytes(32, t), - Transactions: [][]byte{ - randomBytes(123, t), - randomBytes(456, t), - randomBytes(789, t), - randomBytes(1011, t), - }, +func DepositRequest(t *testing.T) *enginev1.DepositRequest { + return &enginev1.DepositRequest{ + Pubkey: randomBytes(48, t), + WithdrawalCredentials: randomBytes(32, t), + Amount: randomUint64(t), + Signature: randomBytes(96, t), + Index: randomUint64(t), } } -// InclusionSummary creates a random InclusionListSummary for testing purposes. -func InclusionSummary(t *testing.T) *enginev1.InclusionListSummary { - return &enginev1.InclusionListSummary{ - ProposerIndex: primitives.ValidatorIndex(randomUint64(t)), - Slot: primitives.Slot(randomUint64(t)), - Summary: [][]byte{ - randomBytes(20, t), - randomBytes(20, t), - randomBytes(20, t), - randomBytes(20, t), - }, +func WithdrawalRequests(t *testing.T) []*enginev1.WithdrawalRequest { + requests := make([]*enginev1.WithdrawalRequest, fieldparams.MaxWithdrawalRequestsPerPayload) + for i := range requests { + requests[i] = WithdrawalRequest(t) + } + return requests +} + +func WithdrawalRequest(t *testing.T) *enginev1.WithdrawalRequest { + return &enginev1.WithdrawalRequest{ + SourceAddress: randomBytes(20, t), + ValidatorPubkey: randomBytes(48, t), + Amount: randomUint64(t), + } +} + +func ConsolidationRequest(t *testing.T) *enginev1.ConsolidationRequest { + return &enginev1.ConsolidationRequest{ + SourceAddress: randomBytes(20, t), + SourcePubkey: randomBytes(20, t), + TargetPubkey: randomBytes(48, t), } } @@ -449,15 +449,12 @@ func SignedBlindPayloadEnvelope(t *testing.T) *ethpb.SignedBlindPayloadEnvelope func BlindPayloadEnvelope(t *testing.T) *ethpb.BlindPayloadEnvelope { withheld := randomUint64(t)%2 == 0 return ðpb.BlindPayloadEnvelope{ - PayloadRoot: randomBytes(32, t), - BuilderIndex: primitives.ValidatorIndex(randomUint64(t)), - BeaconBlockRoot: randomBytes(32, t), - BlobKzgCommitments: [][]byte{randomBytes(48, t), randomBytes(48, t), randomBytes(48, t)}, - InclusionListProposerIndex: primitives.ValidatorIndex(randomUint64(t)), - InclusionListSlot: primitives.Slot(randomUint64(t)), - InclusionListSignature: randomBytes(96, t), - PayloadWithheld: withheld, - StateRoot: randomBytes(32, t), + PayloadRoot: randomBytes(32, t), + BuilderIndex: primitives.ValidatorIndex(randomUint64(t)), + BeaconBlockRoot: randomBytes(32, t), + BlobKzgCommitments: [][]byte{randomBytes(48, t), randomBytes(48, t), randomBytes(48, t)}, + PayloadWithheld: withheld, + StateRoot: randomBytes(32, t), } }