From a162cdcd5b8944aff37496d30edf7ae2fb99dffa Mon Sep 17 00:00:00 2001 From: terence Date: Tue, 14 May 2024 02:29:41 -0700 Subject: [PATCH] Add ePBS to db (#13971) * Add ePBS to db --- beacon-chain/db/iface/interface.go | 2 + beacon-chain/db/kv/BUILD.bazel | 3 + beacon-chain/db/kv/blind_payload_envelope.go | 45 + .../db/kv/blind_payload_envelope_test.go | 23 + beacon-chain/db/kv/blocks.go | 7 + beacon-chain/db/kv/blocks_test.go | 34 +- beacon-chain/db/kv/encoding.go | 2 + beacon-chain/db/kv/key.go | 7 + beacon-chain/db/kv/kv.go | 3 + beacon-chain/db/kv/schema.go | 20 +- beacon-chain/db/kv/state.go | 48 + beacon-chain/db/kv/state_test.go | 32 + proto/engine/v1/generated.ssz.go | 2 +- proto/prysm/v1alpha1/BUILD.bazel | 4 + .../v1alpha1/blind_payload_envelope.pb.go | 345 ++++ .../v1alpha1/blind_payload_envelope.pb.gw.go | 4 + .../v1alpha1/blind_payload_envelope.proto | 42 + proto/prysm/v1alpha1/generated.ssz.go | 1613 ++++++++++++++++- testing/util/random/BUILD.bazel | 1 + testing/util/random/epbs.go | 42 +- 20 files changed, 2253 insertions(+), 26 deletions(-) create mode 100644 beacon-chain/db/kv/blind_payload_envelope.go create mode 100644 beacon-chain/db/kv/blind_payload_envelope_test.go create mode 100755 proto/prysm/v1alpha1/blind_payload_envelope.pb.go create mode 100755 proto/prysm/v1alpha1/blind_payload_envelope.pb.gw.go create mode 100644 proto/prysm/v1alpha1/blind_payload_envelope.proto diff --git a/beacon-chain/db/iface/interface.go b/beacon-chain/db/iface/interface.go index 9f56e24446a2..48961e2b9c8f 100644 --- a/beacon-chain/db/iface/interface.go +++ b/beacon-chain/db/iface/interface.go @@ -53,6 +53,7 @@ type ReadOnlyDatabase interface { DepositContractAddress(ctx context.Context) ([]byte, error) // ExecutionChainData operations. ExecutionChainData(ctx context.Context) (*ethpb.ETH1ChainData, error) + SignedBlindPayloadEnvelope(ctx context.Context, blockRoot []byte) (*ethpb.SignedBlindPayloadEnvelope, error) // Fee recipients operations. FeeRecipientByValidatorID(ctx context.Context, id primitives.ValidatorIndex) (common.Address, error) RegistrationByValidatorID(ctx context.Context, id primitives.ValidatorIndex) (*ethpb.ValidatorRegistrationV1, error) @@ -87,6 +88,7 @@ type NoHeadAccessDatabase interface { SaveDepositContractAddress(ctx context.Context, addr common.Address) error // SaveExecutionChainData operations. SaveExecutionChainData(ctx context.Context, data *ethpb.ETH1ChainData) error + SaveBlindPayloadEnvelope(ctx context.Context, envelope *ethpb.SignedBlindPayloadEnvelope) error // Run any required database migrations. RunMigrations(ctx context.Context) error // Fee recipients operations. diff --git a/beacon-chain/db/kv/BUILD.bazel b/beacon-chain/db/kv/BUILD.bazel index 464a6c82e196..498ea8330881 100644 --- a/beacon-chain/db/kv/BUILD.bazel +++ b/beacon-chain/db/kv/BUILD.bazel @@ -6,6 +6,7 @@ go_library( "archived_point.go", "backfill.go", "backup.go", + "blind_payload_envelope.go", "blocks.go", "checkpoint.go", "deposit_contract.go", @@ -78,6 +79,7 @@ go_test( "archived_point_test.go", "backfill_test.go", "backup_test.go", + "blind_payload_envelope_test.go", "blocks_test.go", "checkpoint_test.go", "deposit_contract_test.go", @@ -119,6 +121,7 @@ go_test( "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", + "//testing/util/random:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_golang_snappy//:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/db/kv/blind_payload_envelope.go b/beacon-chain/db/kv/blind_payload_envelope.go new file mode 100644 index 000000000000..867abf2ba316 --- /dev/null +++ b/beacon-chain/db/kv/blind_payload_envelope.go @@ -0,0 +1,45 @@ +package kv + +import ( + "context" + + ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" + bolt "go.etcd.io/bbolt" + "go.opencensus.io/trace" +) + +// SaveBlindPayloadEnvelope saves a signed execution payload envelope blind in the database. +func (s *Store) SaveBlindPayloadEnvelope(ctx context.Context, env *ethpb.SignedBlindPayloadEnvelope) error { + ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveBlindPayloadEnvelope") + defer span.End() + + enc, err := encode(ctx, env) + if err != nil { + return err + } + + r := env.Message.BeaconBlockRoot + err = s.db.Update(func(tx *bolt.Tx) error { + bucket := tx.Bucket(executionPayloadEnvelopeBucket) + return bucket.Put(r, enc) + }) + + return err +} + +// SignedBlindPayloadEnvelope retrieves a signed execution payload envelope blind from the database. +func (s *Store) SignedBlindPayloadEnvelope(ctx context.Context, blockRoot []byte) (*ethpb.SignedBlindPayloadEnvelope, error) { + ctx, span := trace.StartSpan(ctx, "BeaconDB.SignedBlindPayloadEnvelope") + defer span.End() + + env := ðpb.SignedBlindPayloadEnvelope{} + err := s.db.View(func(tx *bolt.Tx) error { + bkt := tx.Bucket(executionPayloadEnvelopeBucket) + enc := bkt.Get(blockRoot) + if enc == nil { + return ErrNotFound + } + return decode(ctx, enc, env) + }) + return env, err +} diff --git a/beacon-chain/db/kv/blind_payload_envelope_test.go b/beacon-chain/db/kv/blind_payload_envelope_test.go new file mode 100644 index 000000000000..8c73cd262b70 --- /dev/null +++ b/beacon-chain/db/kv/blind_payload_envelope_test.go @@ -0,0 +1,23 @@ +package kv + +import ( + "context" + "testing" + + "github.com/prysmaticlabs/prysm/v5/testing/require" + "github.com/prysmaticlabs/prysm/v5/testing/util/random" +) + +func TestStore_SignedBlindPayloadEnvelope(t *testing.T) { + db := setupDB(t) + ctx := context.Background() + _, err := db.SignedBlindPayloadEnvelope(ctx, []byte("test")) + require.ErrorIs(t, err, ErrNotFound) + + env := random.SignedBlindPayloadEnvelope(t) + err = db.SaveBlindPayloadEnvelope(ctx, env) + require.NoError(t, err) + got, err := db.SignedBlindPayloadEnvelope(ctx, env.Message.BeaconBlockRoot) + require.NoError(t, err) + require.DeepEqual(t, got, env) +} diff --git a/beacon-chain/db/kv/blocks.go b/beacon-chain/db/kv/blocks.go index 466afb3f6789..7f54b0e1dc1b 100644 --- a/beacon-chain/db/kv/blocks.go +++ b/beacon-chain/db/kv/blocks.go @@ -823,6 +823,11 @@ func unmarshalBlock(_ context.Context, enc []byte) (interfaces.ReadOnlySignedBea if err := rawBlock.UnmarshalSSZ(enc[len(electraBlindKey):]); err != nil { return nil, errors.Wrap(err, "could not unmarshal blinded Electra block") } + case hasEpbsKey(enc): + rawBlock = ðpb.SignedBeaconBlockEpbs{} + if err := rawBlock.UnmarshalSSZ(enc[len(epbsKey):]); err != nil { + return nil, errors.Wrap(err, "could not unmarshal EPBS block") + } default: // Marshal block bytes to phase 0 beacon block. rawBlock = ðpb.SignedBeaconBlock{} @@ -852,6 +857,8 @@ func encodeBlock(blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) { func keyForBlock(blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) { switch blk.Version() { + case version.EPBS: + return epbsKey, nil case version.Electra: if blk.IsBlinded() { return electraBlindKey, nil diff --git a/beacon-chain/db/kv/blocks_test.go b/beacon-chain/db/kv/blocks_test.go index 801c175b4f30..7777e6fd5b61 100644 --- a/beacon-chain/db/kv/blocks_test.go +++ b/beacon-chain/db/kv/blocks_test.go @@ -18,6 +18,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/testing/assert" "github.com/prysmaticlabs/prysm/v5/testing/require" "github.com/prysmaticlabs/prysm/v5/testing/util" + "github.com/prysmaticlabs/prysm/v5/testing/util/random" "google.golang.org/protobuf/proto" ) @@ -166,6 +167,17 @@ var blockTests = []struct { } return blocks.NewSignedBeaconBlock(b) }}, + { + name: "epbs", + newBlock: func(slot primitives.Slot, root []byte) (interfaces.ReadOnlySignedBeaconBlock, error) { + b := random.SignedBeaconBlock(&testing.T{}) + b.Block.Slot = slot + if root != nil { + b.Block.ParentRoot = root + } + return blocks.NewSignedBeaconBlock(b) + }, + }, } func TestStore_SaveBlock_NoDuplicates(t *testing.T) { @@ -222,7 +234,7 @@ func TestStore_BlocksCRUD(t *testing.T) { retrievedBlock, err = db.Block(ctx, blockRoot) require.NoError(t, err) wanted := retrievedBlock - if retrievedBlock.Version() >= version.Bellatrix { + if retrievedBlock.Version() >= version.Bellatrix && retrievedBlock.Version() < version.EPBS { wanted, err = retrievedBlock.ToBlinded() require.NoError(t, err) } @@ -410,7 +422,7 @@ func TestStore_BlocksCRUD_NoCache(t *testing.T) { require.NoError(t, err) wanted := blk - if blk.Version() >= version.Bellatrix { + if blk.Version() >= version.Bellatrix && blk.Version() < version.EPBS { wanted, err = blk.ToBlinded() require.NoError(t, err) } @@ -629,7 +641,7 @@ func TestStore_SaveBlock_CanGetHighestAt(t *testing.T) { b, err := db.Block(ctx, root) require.NoError(t, err) wanted := block1 - if block1.Version() >= version.Bellatrix { + if block1.Version() >= version.Bellatrix && block1.Version() < version.EPBS { wanted, err = wanted.ToBlinded() require.NoError(t, err) } @@ -647,7 +659,7 @@ func TestStore_SaveBlock_CanGetHighestAt(t *testing.T) { b, err = db.Block(ctx, root) require.NoError(t, err) wanted2 := block2 - if block2.Version() >= version.Bellatrix { + if block2.Version() >= version.Bellatrix && block2.Version() < version.EPBS { wanted2, err = block2.ToBlinded() require.NoError(t, err) } @@ -665,7 +677,7 @@ func TestStore_SaveBlock_CanGetHighestAt(t *testing.T) { b, err = db.Block(ctx, root) require.NoError(t, err) wanted = block3 - if block3.Version() >= version.Bellatrix { + if block3.Version() >= version.Bellatrix && block3.Version() < version.EPBS { wanted, err = wanted.ToBlinded() require.NoError(t, err) } @@ -701,7 +713,7 @@ func TestStore_GenesisBlock_CanGetHighestAt(t *testing.T) { b, err := db.Block(ctx, root) require.NoError(t, err) wanted := block1 - if block1.Version() >= version.Bellatrix { + if block1.Version() >= version.Bellatrix && block1.Version() < version.EPBS { wanted, err = block1.ToBlinded() require.NoError(t, err) } @@ -718,7 +730,7 @@ func TestStore_GenesisBlock_CanGetHighestAt(t *testing.T) { b, err = db.Block(ctx, root) require.NoError(t, err) wanted = genesisBlock - if genesisBlock.Version() >= version.Bellatrix { + if genesisBlock.Version() >= version.Bellatrix && genesisBlock.Version() < version.EPBS { wanted, err = genesisBlock.ToBlinded() require.NoError(t, err) } @@ -735,7 +747,7 @@ func TestStore_GenesisBlock_CanGetHighestAt(t *testing.T) { b, err = db.Block(ctx, root) require.NoError(t, err) wanted = genesisBlock - if genesisBlock.Version() >= version.Bellatrix { + if genesisBlock.Version() >= version.Bellatrix && genesisBlock.Version() < version.EPBS { wanted, err = genesisBlock.ToBlinded() require.NoError(t, err) } @@ -831,7 +843,7 @@ func TestStore_BlocksBySlot_BlockRootsBySlot(t *testing.T) { require.NoError(t, err) wanted := b1 - if b1.Version() >= version.Bellatrix { + if b1.Version() >= version.Bellatrix && b1.Version() < version.EPBS { wanted, err = b1.ToBlinded() require.NoError(t, err) } @@ -847,7 +859,7 @@ func TestStore_BlocksBySlot_BlockRootsBySlot(t *testing.T) { t.Fatalf("Expected 2 blocks, received %d blocks", len(retrievedBlocks)) } wanted = b2 - if b2.Version() >= version.Bellatrix { + if b2.Version() >= version.Bellatrix && b2.Version() < version.EPBS { wanted, err = b2.ToBlinded() require.NoError(t, err) } @@ -857,7 +869,7 @@ func TestStore_BlocksBySlot_BlockRootsBySlot(t *testing.T) { require.NoError(t, err) assert.Equal(t, true, proto.Equal(wantedPb, retrieved0Pb), "Wanted: %v, received: %v", retrievedBlocks[0], wanted) wanted = b3 - if b3.Version() >= version.Bellatrix { + if b3.Version() >= version.Bellatrix && b3.Version() < version.EPBS { wanted, err = b3.ToBlinded() require.NoError(t, err) } diff --git a/beacon-chain/db/kv/encoding.go b/beacon-chain/db/kv/encoding.go index 1a2e01fc2b77..dad885354653 100644 --- a/beacon-chain/db/kv/encoding.go +++ b/beacon-chain/db/kv/encoding.go @@ -78,6 +78,8 @@ func isSSZStorageFormat(obj interface{}) bool { return true case *ethpb.VoluntaryExit: return true + case *ethpb.SignedBlindPayloadEnvelope: + return true case *ethpb.ValidatorRegistrationV1: return true default: diff --git a/beacon-chain/db/kv/key.go b/beacon-chain/db/kv/key.go index 60fa9052d3d6..1075492b0690 100644 --- a/beacon-chain/db/kv/key.go +++ b/beacon-chain/db/kv/key.go @@ -65,3 +65,10 @@ func hasElectraBlindKey(enc []byte) bool { } return bytes.Equal(enc[:len(electraBlindKey)], electraBlindKey) } + +func hasEpbsKey(enc []byte) bool { + if len(epbsKey) >= len(enc) { + return false + } + return bytes.Equal(enc[:len(epbsKey)], epbsKey) +} diff --git a/beacon-chain/db/kv/kv.go b/beacon-chain/db/kv/kv.go index 90f01a63dffa..14bec53c5afc 100644 --- a/beacon-chain/db/kv/kv.go +++ b/beacon-chain/db/kv/kv.go @@ -118,6 +118,9 @@ var Buckets = [][]byte{ feeRecipientBucket, registrationBucket, + + // ePBS + executionPayloadEnvelopeBucket, } // KVStoreOption is a functional option that modifies a kv.Store. diff --git a/beacon-chain/db/kv/schema.go b/beacon-chain/db/kv/schema.go index 108849e9f652..e45cc33930cd 100644 --- a/beacon-chain/db/kv/schema.go +++ b/beacon-chain/db/kv/schema.go @@ -7,15 +7,16 @@ package kv // it easy to scan for keys that have a certain shard number as a prefix and return those // corresponding attestations. var ( - blocksBucket = []byte("blocks") - stateBucket = []byte("state") - stateSummaryBucket = []byte("state-summary") - chainMetadataBucket = []byte("chain-metadata") - checkpointBucket = []byte("check-point") - powchainBucket = []byte("powchain") - stateValidatorsBucket = []byte("state-validators") - feeRecipientBucket = []byte("fee-recipient") - registrationBucket = []byte("registration") + blocksBucket = []byte("blocks") + stateBucket = []byte("state") + stateSummaryBucket = []byte("state-summary") + chainMetadataBucket = []byte("chain-metadata") + checkpointBucket = []byte("check-point") + powchainBucket = []byte("powchain") + stateValidatorsBucket = []byte("state-validators") + feeRecipientBucket = []byte("fee-recipient") + registrationBucket = []byte("registration") + executionPayloadEnvelopeBucket = []byte("execution-payload-envelope") // Deprecated: This bucket was migrated in PR 6461. Do not use, except for migrations. slotsHasObjectBucket = []byte("slots-has-objects") @@ -50,6 +51,7 @@ var ( denebBlindKey = []byte("blind-deneb") electraKey = []byte("electra") electraBlindKey = []byte("blind-electra") + epbsKey = []byte("epbs") // block root included in the beacon state used by weak subjectivity initial sync originCheckpointBlockRootKey = []byte("origin-checkpoint-block-root") diff --git a/beacon-chain/db/kv/state.go b/beacon-chain/db/kv/state.go index 05ae8b978ecf..7dd7697d868a 100644 --- a/beacon-chain/db/kv/state.go +++ b/beacon-chain/db/kv/state.go @@ -252,6 +252,10 @@ func (s *Store) saveStatesEfficientInternal(ctx context.Context, tx *bolt.Tx, bl if err := s.processElectra(ctx, rawType, rt[:], bucket, valIdxBkt, validatorKeys[i]); err != nil { return err } + case *ethpb.BeaconStateEPBS: + if err := s.processEPBS(ctx, rawType, rt[:], bucket, valIdxBkt, validatorKeys[i]); err != nil { + return err + } default: return errors.New("invalid state type") } @@ -367,6 +371,24 @@ func (s *Store) processElectra(ctx context.Context, pbState *ethpb.BeaconStateEl return nil } +func (s *Store) processEPBS(ctx context.Context, pbState *ethpb.BeaconStateEPBS, rootHash []byte, bucket, valIdxBkt *bolt.Bucket, validatorKey []byte) error { + valEntries := pbState.Validators + pbState.Validators = make([]*ethpb.Validator, 0) + rawObj, err := pbState.MarshalSSZ() + if err != nil { + return err + } + encodedState := snappy.Encode(nil, append(epbsKey, rawObj...)) + if err := bucket.Put(rootHash, encodedState); err != nil { + return err + } + pbState.Validators = valEntries + if err := valIdxBkt.Put(rootHash, validatorKey); err != nil { + return err + } + return nil +} + func (s *Store) storeValidatorEntriesSeparately(ctx context.Context, tx *bolt.Tx, validatorsEntries map[string]*ethpb.Validator) error { valBkt := tx.Bucket(stateValidatorsBucket) for hashStr, validatorEntry := range validatorsEntries { @@ -516,6 +538,19 @@ func (s *Store) unmarshalState(_ context.Context, enc []byte, validatorEntries [ } switch { + case hasEpbsKey(enc): + protoState := ðpb.BeaconStateEPBS{} + if err := protoState.UnmarshalSSZ(enc[len(epbsKey):]); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal encoding for EPBS") + } + ok, err := s.isStateValidatorMigrationOver() + if err != nil { + return nil, err + } + if ok { + protoState.Validators = validatorEntries + } + return statenative.InitializeFromProtoEpbs(protoState) case hasElectraKey(enc): protoState := ðpb.BeaconStateElectra{} if err := protoState.UnmarshalSSZ(enc[len(electraKey):]); err != nil { @@ -675,6 +710,19 @@ func marshalState(ctx context.Context, st state.ReadOnlyBeaconState) ([]byte, er return nil, err } return snappy.Encode(nil, append(electraKey, rawObj...)), nil + case *ethpb.BeaconStateEPBS: + rState, ok := st.ToProtoUnsafe().(*ethpb.BeaconStateEPBS) + if !ok { + return nil, errors.New("non valid inner state") + } + if rState == nil { + return nil, errors.New("nil state") + } + rawObj, err := rState.MarshalSSZ() + if err != nil { + return nil, err + } + return snappy.Encode(nil, append(epbsKey, rawObj...)), nil default: return nil, errors.New("invalid inner state") } diff --git a/beacon-chain/db/kv/state_test.go b/beacon-chain/db/kv/state_test.go index 6ca53a5e23e3..cec2efd4a9a3 100644 --- a/beacon-chain/db/kv/state_test.go +++ b/beacon-chain/db/kv/state_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/prysmaticlabs/prysm/v5/beacon-chain/state" + statenative "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native" "github.com/prysmaticlabs/prysm/v5/config/features" "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" @@ -21,6 +22,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/testing/assert" "github.com/prysmaticlabs/prysm/v5/testing/require" "github.com/prysmaticlabs/prysm/v5/testing/util" + "github.com/prysmaticlabs/prysm/v5/testing/util/random" bolt "go.etcd.io/bbolt" ) @@ -159,6 +161,16 @@ func TestState_CanSaveRetrieve(t *testing.T) { }, rootSeed: 'E', }, + { + name: "epbs", + s: func() state.BeaconState { + stPb := random.BeaconState(t) + st, err := statenative.InitializeFromProtoUnsafeEpbs(stPb) + require.NoError(t, err) + return st + }, + rootSeed: 'F', + }, } db := setupDB(t) @@ -1113,6 +1125,26 @@ func TestDenebState_CanDelete(t *testing.T) { require.Equal(t, state.ReadOnlyBeaconState(nil), savedS, "Unsaved state should've been nil") } +func TestEpbsState_CanDelete(t *testing.T) { + db := setupDB(t) + + r := [32]byte{'A'} + + require.Equal(t, false, db.HasState(context.Background(), r)) + + s := random.BeaconState(t) + st, err := statenative.InitializeFromProtoUnsafeEpbs(s) + require.NoError(t, err) + + require.NoError(t, db.SaveState(context.Background(), st, r)) + require.Equal(t, true, db.HasState(context.Background(), r)) + + require.NoError(t, db.DeleteState(context.Background(), r)) + savedS, err := db.State(context.Background(), r) + require.NoError(t, err) + require.Equal(t, state.ReadOnlyBeaconState(nil), savedS, "Unsaved state should've been nil") +} + func TestStateDeneb_CanSaveRetrieveValidatorEntries(t *testing.T) { db := setupDB(t) diff --git a/proto/engine/v1/generated.ssz.go b/proto/engine/v1/generated.ssz.go index 9844d667f597..542f2888d1d4 100644 --- a/proto/engine/v1/generated.ssz.go +++ b/proto/engine/v1/generated.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 88fdbdfda4571603e11174a57e65c25e06780ff2cbd795c8ae2a4709da24d9a9 +// Hash: 3d8372b29262b45e4ea813e1758fbd2290450bac17685441c9306ff653bb991c package enginev1 import ( diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 863702c87fcc..2674d285a7d8 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -131,6 +131,7 @@ ssz_gen_marshal( "BeaconStateCapella", "BeaconStateDeneb", "BeaconStateElectra", + "BeaconStateEPBS", "SigningData", "SyncCommittee", "SyncAggregatorSelectionData", @@ -155,6 +156,8 @@ ssz_gen_marshal( "PayloadAttestationData", "PayloadAttestation", "PayloadAttestationMessage", + "SignedBlindPayloadEnvelope", + "BlindPayloadEnvelope", ], ) @@ -259,6 +262,7 @@ ssz_proto_files( "beacon_state.proto", "blobs.proto", "payload_attestation.proto", + "blind_payload_envelope.proto", "sync_committee.proto", "withdrawals.proto", ], diff --git a/proto/prysm/v1alpha1/blind_payload_envelope.pb.go b/proto/prysm/v1alpha1/blind_payload_envelope.pb.go new file mode 100755 index 000000000000..543c64868fd3 --- /dev/null +++ b/proto/prysm/v1alpha1/blind_payload_envelope.pb.go @@ -0,0 +1,345 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: proto/prysm/v1alpha1/blind_payload_envelope.proto + +package eth + +import ( + reflect "reflect" + sync "sync" + + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + _ "github.com/prysmaticlabs/prysm/v5/proto/eth/ext" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SignedBlindPayloadEnvelope struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message *BlindPayloadEnvelope `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty" ssz-size:"96"` +} + +func (x *SignedBlindPayloadEnvelope) Reset() { + *x = SignedBlindPayloadEnvelope{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_prysm_v1alpha1_blind_payload_envelope_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignedBlindPayloadEnvelope) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignedBlindPayloadEnvelope) ProtoMessage() {} + +func (x *SignedBlindPayloadEnvelope) ProtoReflect() protoreflect.Message { + mi := &file_proto_prysm_v1alpha1_blind_payload_envelope_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignedBlindPayloadEnvelope.ProtoReflect.Descriptor instead. +func (*SignedBlindPayloadEnvelope) Descriptor() ([]byte, []int) { + return file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescGZIP(), []int{0} +} + +func (x *SignedBlindPayloadEnvelope) GetMessage() *BlindPayloadEnvelope { + if x != nil { + return x.Message + } + return nil +} + +func (x *SignedBlindPayloadEnvelope) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +type BlindPayloadEnvelope struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PayloadRoot []byte `protobuf:"bytes,1,opt,name=payload_root,json=payloadRoot,proto3" json:"payload_root,omitempty" ssz-size:"32"` + BuilderIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,2,opt,name=builder_index,json=builderIndex,proto3" json:"builder_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"` + BeaconBlockRoot []byte `protobuf:"bytes,3,opt,name=beacon_block_root,json=beaconBlockRoot,proto3" json:"beacon_block_root,omitempty" ssz-size:"32"` + BlobKzgCommitments [][]byte `protobuf:"bytes,4,rep,name=blob_kzg_commitments,json=blobKzgCommitments,proto3" json:"blob_kzg_commitments,omitempty" ssz-max:"4096" ssz-size:"?,48"` + InclusionListProposerIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,5,opt,name=inclusion_list_proposer_index,json=inclusionListProposerIndex,proto3" json:"inclusion_list_proposer_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"` + InclusionListSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,6,opt,name=inclusion_list_slot,json=inclusionListSlot,proto3" json:"inclusion_list_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` + InclusionListSignature []byte `protobuf:"bytes,7,opt,name=inclusion_list_signature,json=inclusionListSignature,proto3" json:"inclusion_list_signature,omitempty" ssz-size:"96"` + PayloadWithheld bool `protobuf:"varint,8,opt,name=payload_withheld,json=payloadWithheld,proto3" json:"payload_withheld,omitempty"` + StateRoot []byte `protobuf:"bytes,9,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty" ssz-size:"32"` +} + +func (x *BlindPayloadEnvelope) Reset() { + *x = BlindPayloadEnvelope{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_prysm_v1alpha1_blind_payload_envelope_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BlindPayloadEnvelope) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BlindPayloadEnvelope) ProtoMessage() {} + +func (x *BlindPayloadEnvelope) ProtoReflect() protoreflect.Message { + mi := &file_proto_prysm_v1alpha1_blind_payload_envelope_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BlindPayloadEnvelope.ProtoReflect.Descriptor instead. +func (*BlindPayloadEnvelope) Descriptor() ([]byte, []int) { + return file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescGZIP(), []int{1} +} + +func (x *BlindPayloadEnvelope) GetPayloadRoot() []byte { + if x != nil { + return x.PayloadRoot + } + return nil +} + +func (x *BlindPayloadEnvelope) GetBuilderIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex { + if x != nil { + return x.BuilderIndex + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0) +} + +func (x *BlindPayloadEnvelope) GetBeaconBlockRoot() []byte { + if x != nil { + return x.BeaconBlockRoot + } + return nil +} + +func (x *BlindPayloadEnvelope) GetBlobKzgCommitments() [][]byte { + if x != nil { + return x.BlobKzgCommitments + } + return nil +} + +func (x *BlindPayloadEnvelope) GetInclusionListProposerIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex { + if x != nil { + return x.InclusionListProposerIndex + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0) +} + +func (x *BlindPayloadEnvelope) GetInclusionListSlot() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot { + if x != nil { + return x.InclusionListSlot + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(0) +} + +func (x *BlindPayloadEnvelope) GetInclusionListSignature() []byte { + if x != nil { + return x.InclusionListSignature + } + return nil +} + +func (x *BlindPayloadEnvelope) GetPayloadWithheld() bool { + if x != nil { + return x.PayloadWithheld + } + return false +} + +func (x *BlindPayloadEnvelope) GetStateRoot() []byte { + if x != nil { + return x.StateRoot + } + return nil +} + +var File_proto_prysm_v1alpha1_blind_payload_envelope_proto protoreflect.FileDescriptor + +var file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDesc = []byte{ + 0x0a, 0x31, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x5f, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, + 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1b, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x65, 0x78, 0x74, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, 0x01, 0x0a, 0x23, 0x53, 0x69, 0x67, 0x6e, + 0x65, 0x64, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x12, + 0x4e, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x34, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, + 0x65, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xd8, 0x05, 0x0a, 0x1d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, + 0x70, 0x65, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x12, 0x29, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, + 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x6f, + 0x6f, 0x74, 0x12, 0x74, 0x0a, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, + 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, + 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0c, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x32, 0x0a, 0x11, 0x62, 0x65, 0x61, 0x63, + 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x62, 0x65, 0x61, + 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x42, 0x0a, 0x14, + 0x62, 0x6c, 0x6f, 0x62, 0x5f, 0x6b, 0x7a, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, + 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x10, 0x8a, 0xb5, 0x18, 0x04, + 0x3f, 0x2c, 0x34, 0x38, 0x92, 0xb5, 0x18, 0x04, 0x34, 0x30, 0x39, 0x36, 0x52, 0x12, 0x62, 0x6c, + 0x6f, 0x62, 0x4b, 0x7a, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x12, 0x92, 0x01, 0x0a, 0x1d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, + 0x69, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, + 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, + 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, + 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x1a, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x75, 0x0a, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, + 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, + 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, + 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x40, 0x0a, 0x18, + 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, + 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x16, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, + 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, + 0x0a, 0x10, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x68, 0x65, + 0x6c, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x57, 0x69, 0x74, 0x68, 0x68, 0x65, 0x6c, 0x64, 0x12, 0x25, 0x0a, 0x0a, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, + 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, + 0x42, 0xa4, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x19, + 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x45, 0x6e, 0x76, 0x65, + 0x6c, 0x6f, 0x70, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, + 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, + 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescOnce sync.Once + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescData = file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDesc +) + +func file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescGZIP() []byte { + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescOnce.Do(func() { + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescData) + }) + return file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDescData +} + +var file_proto_prysm_v1alpha1_blind_payload_envelope_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_proto_prysm_v1alpha1_blind_payload_envelope_proto_goTypes = []interface{}{ + (*SignedBlindPayloadEnvelope)(nil), // 0: ethereum.eth.v1alpha1.SignedBlindPayloadEnvelope + (*BlindPayloadEnvelope)(nil), // 1: ethereum.eth.v1alpha1.BlindPayloadEnvelope +} +var file_proto_prysm_v1alpha1_blind_payload_envelope_proto_depIdxs = []int32{ + 1, // 0: ethereum.eth.v1alpha1.SignedBlindPayloadEnvelope.message:type_name -> ethereum.eth.v1alpha1.BlindPayloadEnvelope + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_proto_prysm_v1alpha1_blind_payload_envelope_proto_init() } +func file_proto_prysm_v1alpha1_blind_payload_envelope_proto_init() { + if File_proto_prysm_v1alpha1_blind_payload_envelope_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignedBlindPayloadEnvelope); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BlindPayloadEnvelope); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_proto_prysm_v1alpha1_blind_payload_envelope_proto_goTypes, + DependencyIndexes: file_proto_prysm_v1alpha1_blind_payload_envelope_proto_depIdxs, + MessageInfos: file_proto_prysm_v1alpha1_blind_payload_envelope_proto_msgTypes, + }.Build() + File_proto_prysm_v1alpha1_blind_payload_envelope_proto = out.File + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_rawDesc = nil + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_goTypes = nil + file_proto_prysm_v1alpha1_blind_payload_envelope_proto_depIdxs = nil +} diff --git a/proto/prysm/v1alpha1/blind_payload_envelope.pb.gw.go b/proto/prysm/v1alpha1/blind_payload_envelope.pb.gw.go new file mode 100755 index 000000000000..cdd03643f0c7 --- /dev/null +++ b/proto/prysm/v1alpha1/blind_payload_envelope.pb.gw.go @@ -0,0 +1,4 @@ +//go:build ignore +// +build ignore + +package ignore diff --git a/proto/prysm/v1alpha1/blind_payload_envelope.proto b/proto/prysm/v1alpha1/blind_payload_envelope.proto new file mode 100644 index 000000000000..0af31d5ac36f --- /dev/null +++ b/proto/prysm/v1alpha1/blind_payload_envelope.proto @@ -0,0 +1,42 @@ +// Copyright 2024 Prysmatic Labs. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +syntax = "proto3"; + +package ethereum.eth.v1alpha1; + +import "proto/eth/ext/options.proto"; + +option csharp_namespace = "Ethereum.Eth.v1alpha1"; +option go_package = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1;eth"; +option java_multiple_files = true; +option java_outer_classname = "BlindPayloadEnvelopeProto"; +option java_package = "org.ethereum.eth.v1alpha1"; +option php_namespace = "Ethereum\\Eth\\v1alpha1"; + +message SignedBlindPayloadEnvelope { + BlindPayloadEnvelope message = 1; + bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"]; +} + +message BlindPayloadEnvelope { + bytes payload_root = 1 [(ethereum.eth.ext.ssz_size) = "32"]; + 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/generated.ssz.go b/proto/prysm/v1alpha1/generated.ssz.go index 515d004ab0a7..e38f1a7003ac 100644 --- a/proto/prysm/v1alpha1/generated.ssz.go +++ b/proto/prysm/v1alpha1/generated.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 7ad11ee48b62a6ac97f56ed03ddf5c35e7b357817545820404363091b05c0b4b +// Hash: 050e86cc92690603d4c328eea81f5ca09012184e81dc5545c24c244096415333 package eth import ( @@ -19532,6 +19532,1270 @@ func (b *BeaconStateElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { 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_math.Gwei(ssz.UnmarshallUint64(buf[2736657:2736665])) + + // Field (29) 'ExitBalanceToConsume' + b.ExitBalanceToConsume = github_com_prysmaticlabs_prysm_v5_math.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_math.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) @@ -19724,6 +20988,353 @@ func (h *HistoricalSummary) HashTreeRootWith(hh *ssz.Hasher) (err error) { 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 (e *BlindPayloadEnvelope) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(e) +} + +// MarshalSSZTo ssz marshals the BlindPayloadEnvelope object to a target array +func (e *BlindPayloadEnvelope) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(221) + + // Field (0) 'PayloadRoot' + if size := len(e.PayloadRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.PayloadRoot", size, 32) + return + } + dst = append(dst, e.PayloadRoot...) + + // Field (1) 'BuilderIndex' + dst = ssz.MarshalUint64(dst, uint64(e.BuilderIndex)) + + // Field (2) 'BeaconBlockRoot' + if size := len(e.BeaconBlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) + return + } + dst = append(dst, e.BeaconBlockRoot...) + + // Offset (3) 'BlobKzgCommitments' + dst = ssz.WriteOffset(dst, offset) + offset += len(e.BlobKzgCommitments) * 48 + + // Field (4) 'InclusionListProposerIndex' + dst = ssz.MarshalUint64(dst, uint64(e.InclusionListProposerIndex)) + + // Field (5) 'InclusionListSlot' + dst = ssz.MarshalUint64(dst, uint64(e.InclusionListSlot)) + + // Field (6) 'InclusionListSignature' + if size := len(e.InclusionListSignature); size != 96 { + err = ssz.ErrBytesLengthFn("--.InclusionListSignature", size, 96) + return + } + dst = append(dst, e.InclusionListSignature...) + + // Field (7) 'PayloadWithheld' + dst = ssz.MarshalBool(dst, e.PayloadWithheld) + + // Field (8) 'StateRoot' + if size := len(e.StateRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) + return + } + dst = append(dst, e.StateRoot...) + + // Field (3) 'BlobKzgCommitments' + if size := len(e.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + for ii := 0; ii < len(e.BlobKzgCommitments); ii++ { + if size := len(e.BlobKzgCommitments[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) + return + } + dst = append(dst, e.BlobKzgCommitments[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindPayloadEnvelope object +func (e *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(e.PayloadRoot) == 0 { + e.PayloadRoot = make([]byte, 0, len(buf[0:32])) + } + e.PayloadRoot = append(e.PayloadRoot, buf[0:32]...) + + // Field (1) 'BuilderIndex' + e.BuilderIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[32:40])) + + // Field (2) 'BeaconBlockRoot' + if cap(e.BeaconBlockRoot) == 0 { + e.BeaconBlockRoot = make([]byte, 0, len(buf[40:72])) + } + e.BeaconBlockRoot = append(e.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' + e.InclusionListProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[76:84])) + + // Field (5) 'InclusionListSlot' + e.InclusionListSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[84:92])) + + // Field (6) 'InclusionListSignature' + if cap(e.InclusionListSignature) == 0 { + e.InclusionListSignature = make([]byte, 0, len(buf[92:188])) + } + e.InclusionListSignature = append(e.InclusionListSignature, buf[92:188]...) + + // Field (7) 'PayloadWithheld' + e.PayloadWithheld = ssz.UnmarshalBool(buf[188:189]) + + // Field (8) 'StateRoot' + if cap(e.StateRoot) == 0 { + e.StateRoot = make([]byte, 0, len(buf[189:221])) + } + e.StateRoot = append(e.StateRoot, buf[189:221]...) + + // Field (3) 'BlobKzgCommitments' + { + buf = tail[o3:] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + e.BlobKzgCommitments = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(e.BlobKzgCommitments[ii]) == 0 { + e.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + e.BlobKzgCommitments[ii] = append(e.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindPayloadEnvelope object +func (e *BlindPayloadEnvelope) SizeSSZ() (size int) { + size = 221 + + // Field (3) 'BlobKzgCommitments' + size += len(e.BlobKzgCommitments) * 48 + + return +} + +// HashTreeRoot ssz hashes the BlindPayloadEnvelope object +func (e *BlindPayloadEnvelope) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(e) +} + +// HashTreeRootWith ssz hashes the BlindPayloadEnvelope object with a hasher +func (e *BlindPayloadEnvelope) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'PayloadRoot' + if size := len(e.PayloadRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.PayloadRoot", size, 32) + return + } + hh.PutBytes(e.PayloadRoot) + + // Field (1) 'BuilderIndex' + hh.PutUint64(uint64(e.BuilderIndex)) + + // Field (2) 'BeaconBlockRoot' + if size := len(e.BeaconBlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) + return + } + hh.PutBytes(e.BeaconBlockRoot) + + // Field (3) 'BlobKzgCommitments' + { + if size := len(e.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range e.BlobKzgCommitments { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(e.BlobKzgCommitments)) + if ssz.EnableVectorizedHTR { + hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) + } else { + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + } + + // Field (4) 'InclusionListProposerIndex' + hh.PutUint64(uint64(e.InclusionListProposerIndex)) + + // Field (5) 'InclusionListSlot' + hh.PutUint64(uint64(e.InclusionListSlot)) + + // Field (6) 'InclusionListSignature' + if size := len(e.InclusionListSignature); size != 96 { + err = ssz.ErrBytesLengthFn("--.InclusionListSignature", size, 96) + return + } + hh.PutBytes(e.InclusionListSignature) + + // Field (7) 'PayloadWithheld' + hh.PutBool(e.PayloadWithheld) + + // Field (8) 'StateRoot' + if size := len(e.StateRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) + return + } + hh.PutBytes(e.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) diff --git a/testing/util/random/BUILD.bazel b/testing/util/random/BUILD.bazel index 79cb163017a2..82bd74cdb074 100644 --- a/testing/util/random/BUILD.bazel +++ b/testing/util/random/BUILD.bazel @@ -7,6 +7,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//config/fieldparams:go_default_library", + "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//math:go_default_library", "//proto/engine/v1:go_default_library", diff --git a/testing/util/random/epbs.go b/testing/util/random/epbs.go index cedc2f93eceb..126b3fb5269c 100644 --- a/testing/util/random/epbs.go +++ b/testing/util/random/epbs.go @@ -8,6 +8,7 @@ import ( "github.com/prysmaticlabs/go-bitfield" fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" + "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v5/math" enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" @@ -119,8 +120,12 @@ func AttestationData(t *testing.T) *ethpb.AttestationData { // Deposit creates a random Deposit for testing purposes. func Deposit(t *testing.T) *ethpb.Deposit { + proof := make([][]byte, 33) + for i := 0; i < 33; i++ { + proof[i] = randomBytes(32, t) + } return ðpb.Deposit{ - Proof: [][]byte{randomBytes(32, t), randomBytes(32, t), randomBytes(32, t)}, + Proof: proof, Data: DepositData(t), } } @@ -170,6 +175,11 @@ func VoluntaryExit(t *testing.T) *ethpb.VoluntaryExit { // BeaconState creates a random BeaconStateEPBS for testing purposes. func BeaconState(t *testing.T) *ethpb.BeaconStateEPBS { + slashing := make([]uint64, params.BeaconConfig().EpochsPerSlashingsVector) + pubkeys := make([][]byte, 512) + for i := range pubkeys { + pubkeys[i] = randomBytes(48, t) + } return ðpb.BeaconStateEPBS{ GenesisTime: randomUint64(t), GenesisValidatorsRoot: randomBytes(32, t), @@ -209,7 +219,7 @@ func BeaconState(t *testing.T) *ethpb.BeaconStateEPBS { }, Balances: []uint64{randomUint64(t)}, RandaoMixes: [][]byte{randomBytes(32, t), randomBytes(32, t), randomBytes(32, t)}, - Slashings: []uint64{randomUint64(t)}, + Slashings: slashing, PreviousEpochParticipation: randomBytes(32, t), CurrentEpochParticipation: randomBytes(32, t), JustificationBits: randomBytes(1, t), @@ -218,11 +228,11 @@ func BeaconState(t *testing.T) *ethpb.BeaconStateEPBS { FinalizedCheckpoint: ðpb.Checkpoint{Epoch: primitives.Epoch(randomUint64(t)), Root: randomBytes(32, t)}, InactivityScores: []uint64{randomUint64(t)}, CurrentSyncCommittee: ðpb.SyncCommittee{ - Pubkeys: [][]byte{randomBytes(48, t), randomBytes(48, t), randomBytes(48, t)}, + Pubkeys: pubkeys, AggregatePubkey: randomBytes(48, t), }, NextSyncCommittee: ðpb.SyncCommittee{ - Pubkeys: [][]byte{randomBytes(48, t), randomBytes(48, t), randomBytes(48, t)}, + Pubkeys: pubkeys, AggregatePubkey: randomBytes(48, t), }, NextWithdrawalIndex: randomUint64(t), @@ -428,6 +438,30 @@ func InclusionSummary(t *testing.T) *enginev1.InclusionListSummary { } } +// SignedBlindPayloadEnvelope creates a random SignedBlindPayloadEnvelope for testing purposes. +func SignedBlindPayloadEnvelope(t *testing.T) *ethpb.SignedBlindPayloadEnvelope { + return ðpb.SignedBlindPayloadEnvelope{ + Message: BlindPayloadEnvelope(t), + Signature: randomBytes(96, t), + } +} + +// BlindPayloadEnvelope creates a random BlindPayloadEnvelope for testing purposes. +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), + } +} + func randomBytes(n int, t *testing.T) []byte { b := make([]byte, n) _, err := rand.Read(b)