From 3c939f6b9e020fd3e8b83ffa3db9d54bec1bcaf2 Mon Sep 17 00:00:00 2001 From: Manu NALEPA Date: Wed, 20 Nov 2024 11:59:00 +0100 Subject: [PATCH] Add data column sidecars proto. --- CHANGELOG.md | 1 + beacon-chain/rpc/eth/config/handlers_test.go | 5 +- config/params/config.go | 18 +- config/params/loader_test.go | 3 - config/params/mainnet_config.go | 8 +- proto/prysm/v1alpha1/BUILD.bazel | 24 +- proto/prysm/v1alpha1/data_columns.pb.go | 225 ++++++++++++++ proto/prysm/v1alpha1/data_columns.proto | 36 +++ proto/prysm/v1alpha1/deneb.ssz.go | 2 +- proto/prysm/v1alpha1/fulu.ssz.go | 306 +++++++++++++++++++ proto/ssz_proto_library.bzl | 10 + 11 files changed, 626 insertions(+), 12 deletions(-) create mode 100755 proto/prysm/v1alpha1/data_columns.pb.go create mode 100644 proto/prysm/v1alpha1/data_columns.proto create mode 100644 proto/prysm/v1alpha1/fulu.ssz.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a28e87f89281..836a3c54c3a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Validator REST mode Electra block support. - Added validator index label to `validator_statuses` metric. - Added Validator REST mode use of Attestation V2 endpoints and Electra attestations. +- PeerDAS: Added data column sidecars proto. ### Changed diff --git a/beacon-chain/rpc/eth/config/handlers_test.go b/beacon-chain/rpc/eth/config/handlers_test.go index 8284e095bb4b..30bddfd24c76 100644 --- a/beacon-chain/rpc/eth/config/handlers_test.go +++ b/beacon-chain/rpc/eth/config/handlers_test.go @@ -79,6 +79,7 @@ func TestGetSpec(t *testing.T) { config.DenebForkEpoch = 105 config.ElectraForkVersion = []byte("ElectraForkVersion") config.ElectraForkEpoch = 107 + config.Eip7594ForkEpoch = 109 config.BLSWithdrawalPrefixByte = byte('b') config.ETH1AddressWithdrawalPrefixByte = byte('c') config.GenesisDelay = 24 @@ -189,7 +190,7 @@ func TestGetSpec(t *testing.T) { data, ok := resp.Data.(map[string]interface{}) require.Equal(t, true, ok) - assert.Equal(t, 155, len(data)) + assert.Equal(t, 156, len(data)) for k, v := range data { t.Run(k, func(t *testing.T) { switch k { @@ -267,6 +268,8 @@ func TestGetSpec(t *testing.T) { assert.Equal(t, "0x"+hex.EncodeToString([]byte("ElectraForkVersion")), v) case "ELECTRA_FORK_EPOCH": assert.Equal(t, "107", v) + case "EIP7594_FORK_EPOCH": + assert.Equal(t, "109", v) case "MIN_ANCHOR_POW_BLOCK_DIFFICULTY": assert.Equal(t, "1000", v) case "BLS_WITHDRAWAL_PREFIX": diff --git a/config/params/config.go b/config/params/config.go index 69a20bb6fec8..cc9369bbde42 100644 --- a/config/params/config.go +++ b/config/params/config.go @@ -166,6 +166,7 @@ type BeaconChainConfig struct { DenebForkEpoch primitives.Epoch `yaml:"DENEB_FORK_EPOCH" spec:"true"` // DenebForkEpoch is used to represent the assigned fork epoch for deneb. ElectraForkVersion []byte `yaml:"ELECTRA_FORK_VERSION" spec:"true"` // ElectraForkVersion is used to represent the fork version for electra. ElectraForkEpoch primitives.Epoch `yaml:"ELECTRA_FORK_EPOCH" spec:"true"` // ElectraForkEpoch is used to represent the assigned fork epoch for electra. + Eip7594ForkEpoch primitives.Epoch `yaml:"EIP7594_FORK_EPOCH" spec:"true"` // EIP7594ForkEpoch is used to represent the assigned fork epoch for peer das. ForkVersionSchedule map[[fieldparams.VersionLength]byte]primitives.Epoch // Schedule of fork epochs by version. ForkVersionNames map[[fieldparams.VersionLength]byte]string // Human-readable names of fork versions. @@ -255,6 +256,13 @@ type BeaconChainConfig struct { MaxDepositRequestsPerPayload uint64 `yaml:"MAX_DEPOSIT_REQUESTS_PER_PAYLOAD" spec:"true"` // MaxDepositRequestsPerPayload is the maximum number of execution layer deposits in each payload UnsetDepositRequestsStartIndex uint64 `yaml:"UNSET_DEPOSIT_REQUESTS_START_INDEX" spec:"true"` // UnsetDepositRequestsStartIndex is used to check the start index for eip6110 + // PeerDAS Values + SamplesPerSlot uint64 `yaml:"SAMPLES_PER_SLOT"` // SamplesPerSlot refers to the number of random samples a node queries per slot. + CustodyRequirement uint64 `yaml:"CUSTODY_REQUIREMENT"` // CustodyRequirement refers to the minimum amount of subnets a peer must custody and serve samples from. + MinEpochsForDataColumnSidecarsRequest primitives.Epoch `yaml:"MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS"` // MinEpochsForDataColumnSidecarsRequest is the minimum number of epochs the node will keep the data columns for. + MaxCellsInExtendedMatrix uint64 `yaml:"MAX_CELLS_IN_EXTENDED_MATRIX" spec:"true"` // MaxCellsInExtendedMatrix is the full data of one-dimensional erasure coding extended blobs (in row major format). + NumberOfColumns uint64 `yaml:"NUMBER_OF_COLUMNS" spec:"true"` // NumberOfColumns in the extended data matrix. + // Networking Specific Parameters GossipMaxSize uint64 `yaml:"GOSSIP_MAX_SIZE" spec:"true"` // GossipMaxSize is the maximum allowed size of uncompressed gossip messages. MaxChunkSize uint64 `yaml:"MAX_CHUNK_SIZE" spec:"true"` // MaxChunkSize is the maximum allowed size of uncompressed req/resp chunked responses. @@ -272,10 +280,6 @@ type BeaconChainConfig struct { AttestationSubnetPrefixBits uint64 `yaml:"ATTESTATION_SUBNET_PREFIX_BITS" spec:"true"` // AttestationSubnetPrefixBits is defined as (ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS). SubnetsPerNode uint64 `yaml:"SUBNETS_PER_NODE" spec:"true"` // SubnetsPerNode is the number of long-lived subnets a beacon node should be subscribed to. NodeIdBits uint64 `yaml:"NODE_ID_BITS" spec:"true"` // NodeIdBits defines the bit length of a node id. - - // PeerDAS - NumberOfColumns uint64 `yaml:"NUMBER_OF_COLUMNS" spec:"true"` // NumberOfColumns in the extended data matrix. - MaxCellsInExtendedMatrix uint64 `yaml:"MAX_CELLS_IN_EXTENDED_MATRIX" spec:"true"` // MaxCellsInExtendedMatrix is the full data of one-dimensional erasure coding extended blobs (in row major format). } // InitializeForkSchedule initializes the schedules forks baked into the config. @@ -360,6 +364,12 @@ func DenebEnabled() bool { return BeaconConfig().DenebForkEpoch < math.MaxUint64 } +// PeerDASEnabled centralizes the check to determine if code paths +// that are specific to peerdas should be allowed to execute. +func PeerDASEnabled() bool { + return BeaconConfig().Eip7594ForkEpoch < math.MaxUint64 +} + // WithinDAPeriod checks if the block epoch is within MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS of the given current epoch. func WithinDAPeriod(block, current primitives.Epoch) bool { return block+BeaconConfig().MinEpochsForBlobsSidecarsRequest >= current diff --git a/config/params/loader_test.go b/config/params/loader_test.go index 1760f0bf223a..791e896dda6f 100644 --- a/config/params/loader_test.go +++ b/config/params/loader_test.go @@ -25,12 +25,10 @@ import ( // IMPORTANT: Use one field per line and sort these alphabetically to reduce conflicts. var placeholderFields = []string{ "BYTES_PER_LOGS_BLOOM", // Compile time constant on ExecutionPayload.logs_bloom. - "CUSTODY_REQUIREMENT", "EIP6110_FORK_EPOCH", "EIP6110_FORK_VERSION", "EIP7002_FORK_EPOCH", "EIP7002_FORK_VERSION", - "EIP7594_FORK_EPOCH", "EIP7594_FORK_VERSION", "EIP7732_FORK_EPOCH", "EIP7732_FORK_VERSION", @@ -43,7 +41,6 @@ var placeholderFields = []string{ "MAX_REQUEST_PAYLOADS", // Compile time constant on BeaconBlockBody.ExecutionRequests "MAX_TRANSACTIONS_PER_PAYLOAD", // Compile time constant on ExecutionPayload.transactions. "REORG_HEAD_WEIGHT_THRESHOLD", - "SAMPLES_PER_SLOT", "TARGET_NUMBER_OF_PEERS", "UPDATE_TIMEOUT", "WHISK_EPOCHS_PER_SHUFFLING_PHASE", diff --git a/config/params/mainnet_config.go b/config/params/mainnet_config.go index 39449260b83f..d345f61faf69 100644 --- a/config/params/mainnet_config.go +++ b/config/params/mainnet_config.go @@ -216,6 +216,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{ DenebForkEpoch: mainnetDenebForkEpoch, ElectraForkVersion: []byte{5, 0, 0, 0}, ElectraForkEpoch: mainnetElectraForkEpoch, + Eip7594ForkEpoch: math.MaxUint64, // New values introduced in Altair hard fork 1. // Participation flag indices. @@ -295,8 +296,11 @@ var mainnetBeaconConfig = &BeaconChainConfig{ UnsetDepositRequestsStartIndex: math.MaxUint64, // PeerDAS - NumberOfColumns: 128, - MaxCellsInExtendedMatrix: 768, + NumberOfColumns: 128, + MaxCellsInExtendedMatrix: 768, + SamplesPerSlot: 8, + CustodyRequirement: 4, + MinEpochsForDataColumnSidecarsRequest: 4096, // Values related to networking parameters. GossipMaxSize: 10 * 1 << 20, // 10 MiB diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 51ec7d961645..b2f664ddfdb8 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -174,6 +174,11 @@ ssz_electra_objs = [ "SignedConsolidation", ] +ssz_fulu_objs = [ + "DataColumnIdentifier", + "DataColumnSidecar", +] + ssz_gen_marshal( name = "ssz_generated_phase0", out = "phase0.ssz.go", @@ -251,6 +256,19 @@ ssz_gen_marshal( objs = ssz_electra_objs, ) +ssz_gen_marshal( + name = "ssz_generated_fulu", + out = "fulu.ssz.go", + exclude_objs = ssz_phase0_objs + ssz_altair_objs + ssz_bellatrix_objs + ssz_capella_objs + ssz_deneb_objs + ssz_electra_objs, + go_proto = ":go_proto", + includes = [ + "//consensus-types/primitives:go_default_library", + "//math:go_default_library", + "//proto/engine/v1:go_default_library", + ], + objs = ssz_fulu_objs, +) + ssz_gen_marshal( name = "ssz_generated_non_core", out = "non-core.ssz.go", @@ -263,8 +281,10 @@ ssz_gen_marshal( objs = [ "BeaconBlocksByRangeRequest", "BlobSidecarsByRangeRequest", + "DataColumnSidecarsByRangeRequest", "MetaDataV0", "MetaDataV1", + "MetaDataV2", "SignedValidatorRegistrationV1", "ValidatorRegistrationV1", "BuilderBid", @@ -313,6 +333,7 @@ go_library( ":ssz_generated_capella", # keep ":ssz_generated_deneb", # keep ":ssz_generated_electra", # keep + ":ssz_generated_fulu", # keep ":ssz_generated_non_core", # keep ":ssz_generated_phase0", # keep ], @@ -354,6 +375,7 @@ ssz_proto_files( "beacon_state.proto", "blobs.proto", "light_client.proto", + "data_columns.proto", "sync_committee.proto", "withdrawals.proto", ], @@ -380,4 +402,4 @@ go_test( "//testing/require:go_default_library", "@com_github_google_gofuzz//:go_default_library", ], -) +) \ No newline at end of file diff --git a/proto/prysm/v1alpha1/data_columns.pb.go b/proto/prysm/v1alpha1/data_columns.pb.go new file mode 100755 index 000000000000..2ce1d83d3f20 --- /dev/null +++ b/proto/prysm/v1alpha1/data_columns.pb.go @@ -0,0 +1,225 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: proto/prysm/v1alpha1/data_columns.proto + +package eth + +import ( + reflect "reflect" + sync "sync" + + _ "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 DataColumnSidecar struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ColumnIndex uint64 `protobuf:"varint,1,opt,name=column_index,json=columnIndex,proto3" json:"column_index,omitempty"` + DataColumn [][]byte `protobuf:"bytes,2,rep,name=data_column,json=dataColumn,proto3" json:"data_column,omitempty" ssz-max:"4096" ssz-size:"?,2048"` + KzgCommitments [][]byte `protobuf:"bytes,3,rep,name=kzg_commitments,json=kzgCommitments,proto3" json:"kzg_commitments,omitempty" ssz-max:"4096" ssz-size:"?,48"` + KzgProof [][]byte `protobuf:"bytes,4,rep,name=kzg_proof,json=kzgProof,proto3" json:"kzg_proof,omitempty" ssz-max:"4096" ssz-size:"?,48"` + SignedBlockHeader *SignedBeaconBlockHeader `protobuf:"bytes,5,opt,name=signed_block_header,json=signedBlockHeader,proto3" json:"signed_block_header,omitempty"` + KzgCommitmentsInclusionProof [][]byte `protobuf:"bytes,6,rep,name=kzg_commitments_inclusion_proof,json=kzgCommitmentsInclusionProof,proto3" json:"kzg_commitments_inclusion_proof,omitempty" ssz-size:"4,32"` +} + +func (x *DataColumnSidecar) Reset() { + *x = DataColumnSidecar{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_prysm_v1alpha1_data_columns_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DataColumnSidecar) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataColumnSidecar) ProtoMessage() {} + +func (x *DataColumnSidecar) ProtoReflect() protoreflect.Message { + mi := &file_proto_prysm_v1alpha1_data_columns_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 DataColumnSidecar.ProtoReflect.Descriptor instead. +func (*DataColumnSidecar) Descriptor() ([]byte, []int) { + return file_proto_prysm_v1alpha1_data_columns_proto_rawDescGZIP(), []int{0} +} + +func (x *DataColumnSidecar) GetColumnIndex() uint64 { + if x != nil { + return x.ColumnIndex + } + return 0 +} + +func (x *DataColumnSidecar) GetDataColumn() [][]byte { + if x != nil { + return x.DataColumn + } + return nil +} + +func (x *DataColumnSidecar) GetKzgCommitments() [][]byte { + if x != nil { + return x.KzgCommitments + } + return nil +} + +func (x *DataColumnSidecar) GetKzgProof() [][]byte { + if x != nil { + return x.KzgProof + } + return nil +} + +func (x *DataColumnSidecar) GetSignedBlockHeader() *SignedBeaconBlockHeader { + if x != nil { + return x.SignedBlockHeader + } + return nil +} + +func (x *DataColumnSidecar) GetKzgCommitmentsInclusionProof() [][]byte { + if x != nil { + return x.KzgCommitmentsInclusionProof + } + return nil +} + +var File_proto_prysm_v1alpha1_data_columns_proto protoreflect.FileDescriptor + +var file_proto_prysm_v1alpha1_data_columns_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x73, 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, 0x1a, 0x27, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x86, 0x03, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x43, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x53, 0x69, 0x64, 0x65, 0x63, 0x61, 0x72, 0x12, 0x21, 0x0a, 0x0c, + 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, + 0x33, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0c, 0x42, 0x12, 0x8a, 0xb5, 0x18, 0x06, 0x3f, 0x2c, 0x32, 0x30, 0x34, 0x38, + 0x92, 0xb5, 0x18, 0x04, 0x34, 0x30, 0x39, 0x36, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x43, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x39, 0x0a, 0x0f, 0x6b, 0x7a, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x10, 0x8a, + 0xb5, 0x18, 0x04, 0x3f, 0x2c, 0x34, 0x38, 0x92, 0xb5, 0x18, 0x04, 0x34, 0x30, 0x39, 0x36, 0x52, + 0x0e, 0x6b, 0x7a, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, + 0x2d, 0x0a, 0x09, 0x6b, 0x7a, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 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, 0x08, 0x6b, 0x7a, 0x67, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x5e, + 0x0a, 0x13, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x74, + 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x11, 0x73, 0x69, 0x67, + 0x6e, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x4f, + 0x0a, 0x1f, 0x6b, 0x7a, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x5f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x34, 0x2c, 0x33, + 0x32, 0x52, 0x1c, 0x6b, 0x7a, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, + 0x9b, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, + 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x44, + 0x61, 0x74, 0x61, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 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_data_columns_proto_rawDescOnce sync.Once + file_proto_prysm_v1alpha1_data_columns_proto_rawDescData = file_proto_prysm_v1alpha1_data_columns_proto_rawDesc +) + +func file_proto_prysm_v1alpha1_data_columns_proto_rawDescGZIP() []byte { + file_proto_prysm_v1alpha1_data_columns_proto_rawDescOnce.Do(func() { + file_proto_prysm_v1alpha1_data_columns_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_prysm_v1alpha1_data_columns_proto_rawDescData) + }) + return file_proto_prysm_v1alpha1_data_columns_proto_rawDescData +} + +var file_proto_prysm_v1alpha1_data_columns_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_proto_prysm_v1alpha1_data_columns_proto_goTypes = []interface{}{ + (*DataColumnSidecar)(nil), // 0: ethereum.eth.v1alpha1.DataColumnSidecar + (*SignedBeaconBlockHeader)(nil), // 1: ethereum.eth.v1alpha1.SignedBeaconBlockHeader +} +var file_proto_prysm_v1alpha1_data_columns_proto_depIdxs = []int32{ + 1, // 0: ethereum.eth.v1alpha1.DataColumnSidecar.signed_block_header:type_name -> ethereum.eth.v1alpha1.SignedBeaconBlockHeader + 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_data_columns_proto_init() } +func file_proto_prysm_v1alpha1_data_columns_proto_init() { + if File_proto_prysm_v1alpha1_data_columns_proto != nil { + return + } + file_proto_prysm_v1alpha1_beacon_block_proto_init() + if !protoimpl.UnsafeEnabled { + file_proto_prysm_v1alpha1_data_columns_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DataColumnSidecar); 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_data_columns_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_proto_prysm_v1alpha1_data_columns_proto_goTypes, + DependencyIndexes: file_proto_prysm_v1alpha1_data_columns_proto_depIdxs, + MessageInfos: file_proto_prysm_v1alpha1_data_columns_proto_msgTypes, + }.Build() + File_proto_prysm_v1alpha1_data_columns_proto = out.File + file_proto_prysm_v1alpha1_data_columns_proto_rawDesc = nil + file_proto_prysm_v1alpha1_data_columns_proto_goTypes = nil + file_proto_prysm_v1alpha1_data_columns_proto_depIdxs = nil +} diff --git a/proto/prysm/v1alpha1/data_columns.proto b/proto/prysm/v1alpha1/data_columns.proto new file mode 100644 index 000000000000..b6cf2a79d75e --- /dev/null +++ b/proto/prysm/v1alpha1/data_columns.proto @@ -0,0 +1,36 @@ +// Copyright 2024 Offchain 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"; +import "proto/prysm/v1alpha1/beacon_block.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 = "DataColumnsProto"; +option java_package = "org.ethereum.eth.v1alpha1"; +option php_namespace = "Ethereum\\Eth\\v1alpha1"; + + +message DataColumnSidecar { + uint64 column_index = 1; + repeated bytes data_column = 2 [(ethereum.eth.ext.ssz_size) = "?,bytes_per_cell.size", (ethereum.eth.ext.ssz_max) = "max_blob_commitments.size"]; + repeated bytes kzg_commitments = 3 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "max_blob_commitments.size"]; + repeated bytes kzg_proof = 4 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "max_blob_commitments.size"]; + SignedBeaconBlockHeader signed_block_header = 5; + repeated bytes kzg_commitments_inclusion_proof = 6 [(ethereum.eth.ext.ssz_size) = "kzg_commitments_inclusion_proof_depth.size,32"]; +} diff --git a/proto/prysm/v1alpha1/deneb.ssz.go b/proto/prysm/v1alpha1/deneb.ssz.go index d5b8cf461aba..c1205954a20b 100644 --- a/proto/prysm/v1alpha1/deneb.ssz.go +++ b/proto/prysm/v1alpha1/deneb.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: dc56f26fb2603482588d88426187e889583abce2eeb7556ac0dc1ebaa891c455 +// Hash: 46a42bb6eb8741d238d1762863cf0b2258f940795f4bc80ecf36b1ef68f237aa package eth import ( diff --git a/proto/prysm/v1alpha1/fulu.ssz.go b/proto/prysm/v1alpha1/fulu.ssz.go new file mode 100644 index 000000000000..466a18f9b06e --- /dev/null +++ b/proto/prysm/v1alpha1/fulu.ssz.go @@ -0,0 +1,306 @@ +// Code generated by fastssz. DO NOT EDIT. +// Hash: a319f57dbacf3ff759b75d215a370a393df7a1b3bc4c141cda582ece07944647 +package eth + +import ( + ssz "github.com/prysmaticlabs/fastssz" +) + +// MarshalSSZ ssz marshals the DataColumnSidecar object +func (d *DataColumnSidecar) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(d) +} + +// MarshalSSZTo ssz marshals the DataColumnSidecar object to a target array +func (d *DataColumnSidecar) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(356) + + // Field (0) 'ColumnIndex' + dst = ssz.MarshalUint64(dst, d.ColumnIndex) + + // Offset (1) 'DataColumn' + dst = ssz.WriteOffset(dst, offset) + offset += len(d.DataColumn) * 2048 + + // Offset (2) 'KzgCommitments' + dst = ssz.WriteOffset(dst, offset) + offset += len(d.KzgCommitments) * 48 + + // Offset (3) 'KzgProof' + dst = ssz.WriteOffset(dst, offset) + offset += len(d.KzgProof) * 48 + + // Field (4) 'SignedBlockHeader' + if d.SignedBlockHeader == nil { + d.SignedBlockHeader = new(SignedBeaconBlockHeader) + } + if dst, err = d.SignedBlockHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (5) 'KzgCommitmentsInclusionProof' + if size := len(d.KzgCommitmentsInclusionProof); size != 4 { + err = ssz.ErrVectorLengthFn("--.KzgCommitmentsInclusionProof", size, 4) + return + } + for ii := 0; ii < 4; ii++ { + if size := len(d.KzgCommitmentsInclusionProof[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.KzgCommitmentsInclusionProof[ii]", size, 32) + return + } + dst = append(dst, d.KzgCommitmentsInclusionProof[ii]...) + } + + // Field (1) 'DataColumn' + if size := len(d.DataColumn); size > 4096 { + err = ssz.ErrListTooBigFn("--.DataColumn", size, 4096) + return + } + for ii := 0; ii < len(d.DataColumn); ii++ { + if size := len(d.DataColumn[ii]); size != 2048 { + err = ssz.ErrBytesLengthFn("--.DataColumn[ii]", size, 2048) + return + } + dst = append(dst, d.DataColumn[ii]...) + } + + // Field (2) 'KzgCommitments' + if size := len(d.KzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgCommitments", size, 4096) + return + } + for ii := 0; ii < len(d.KzgCommitments); ii++ { + if size := len(d.KzgCommitments[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgCommitments[ii]", size, 48) + return + } + dst = append(dst, d.KzgCommitments[ii]...) + } + + // Field (3) 'KzgProof' + if size := len(d.KzgProof); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgProof", size, 4096) + return + } + for ii := 0; ii < len(d.KzgProof); ii++ { + if size := len(d.KzgProof[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgProof[ii]", size, 48) + return + } + dst = append(dst, d.KzgProof[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the DataColumnSidecar object +func (d *DataColumnSidecar) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 356 { + return ssz.ErrSize + } + + tail := buf + var o1, o2, o3 uint64 + + // Field (0) 'ColumnIndex' + d.ColumnIndex = ssz.UnmarshallUint64(buf[0:8]) + + // Offset (1) 'DataColumn' + if o1 = ssz.ReadOffset(buf[8:12]); o1 > size { + return ssz.ErrOffset + } + + if o1 != 356 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (2) 'KzgCommitments' + if o2 = ssz.ReadOffset(buf[12:16]); o2 > size || o1 > o2 { + return ssz.ErrOffset + } + + // Offset (3) 'KzgProof' + if o3 = ssz.ReadOffset(buf[16:20]); o3 > size || o2 > o3 { + return ssz.ErrOffset + } + + // Field (4) 'SignedBlockHeader' + if d.SignedBlockHeader == nil { + d.SignedBlockHeader = new(SignedBeaconBlockHeader) + } + if err = d.SignedBlockHeader.UnmarshalSSZ(buf[20:228]); err != nil { + return err + } + + // Field (5) 'KzgCommitmentsInclusionProof' + d.KzgCommitmentsInclusionProof = make([][]byte, 4) + for ii := 0; ii < 4; ii++ { + if cap(d.KzgCommitmentsInclusionProof[ii]) == 0 { + d.KzgCommitmentsInclusionProof[ii] = make([]byte, 0, len(buf[228:356][ii*32:(ii+1)*32])) + } + d.KzgCommitmentsInclusionProof[ii] = append(d.KzgCommitmentsInclusionProof[ii], buf[228:356][ii*32:(ii+1)*32]...) + } + + // Field (1) 'DataColumn' + { + buf = tail[o1:o2] + num, err := ssz.DivideInt2(len(buf), 2048, 4096) + if err != nil { + return err + } + d.DataColumn = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(d.DataColumn[ii]) == 0 { + d.DataColumn[ii] = make([]byte, 0, len(buf[ii*2048:(ii+1)*2048])) + } + d.DataColumn[ii] = append(d.DataColumn[ii], buf[ii*2048:(ii+1)*2048]...) + } + } + + // Field (2) 'KzgCommitments' + { + buf = tail[o2:o3] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + d.KzgCommitments = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(d.KzgCommitments[ii]) == 0 { + d.KzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + d.KzgCommitments[ii] = append(d.KzgCommitments[ii], buf[ii*48:(ii+1)*48]...) + } + } + + // Field (3) 'KzgProof' + { + buf = tail[o3:] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + d.KzgProof = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(d.KzgProof[ii]) == 0 { + d.KzgProof[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + d.KzgProof[ii] = append(d.KzgProof[ii], buf[ii*48:(ii+1)*48]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the DataColumnSidecar object +func (d *DataColumnSidecar) SizeSSZ() (size int) { + size = 356 + + // Field (1) 'DataColumn' + size += len(d.DataColumn) * 2048 + + // Field (2) 'KzgCommitments' + size += len(d.KzgCommitments) * 48 + + // Field (3) 'KzgProof' + size += len(d.KzgProof) * 48 + + return +} + +// HashTreeRoot ssz hashes the DataColumnSidecar object +func (d *DataColumnSidecar) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(d) +} + +// HashTreeRootWith ssz hashes the DataColumnSidecar object with a hasher +func (d *DataColumnSidecar) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'ColumnIndex' + hh.PutUint64(d.ColumnIndex) + + // Field (1) 'DataColumn' + { + if size := len(d.DataColumn); size > 4096 { + err = ssz.ErrListTooBigFn("--.DataColumn", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range d.DataColumn { + if len(i) != 2048 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(d.DataColumn)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (2) 'KzgCommitments' + { + if size := len(d.KzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgCommitments", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range d.KzgCommitments { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(d.KzgCommitments)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (3) 'KzgProof' + { + if size := len(d.KzgProof); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgProof", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range d.KzgProof { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(d.KzgProof)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (4) 'SignedBlockHeader' + if err = d.SignedBlockHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (5) 'KzgCommitmentsInclusionProof' + { + if size := len(d.KzgCommitmentsInclusionProof); size != 4 { + err = ssz.ErrVectorLengthFn("--.KzgCommitmentsInclusionProof", size, 4) + return + } + subIndx := hh.Index() + for _, i := range d.KzgCommitmentsInclusionProof { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + hh.Merkleize(indx) + return +} diff --git a/proto/ssz_proto_library.bzl b/proto/ssz_proto_library.bzl index 820cad3ff7ce..0fcb9197100a 100644 --- a/proto/ssz_proto_library.bzl +++ b/proto/ssz_proto_library.bzl @@ -36,6 +36,11 @@ mainnet = { "pending_partial_withdrawals_limit": "134217728", "pending_consolidations_limit": "262144", "max_consolidation_requests_per_payload.size": "1", + "field_elements_per_cell.size": "64", + "field_elements_per_ext_blob.size": "8192", + "bytes_per_cell.size": "2048", # FIELD_ELEMENTS_PER_CELL * BYTES_PER_FIELD_ELEMENT + "cells_per_blob.size": "128", + "kzg_commitments_inclusion_proof_depth.size": "4", } minimal = { @@ -68,6 +73,11 @@ minimal = { "pending_partial_withdrawals_limit": "64", "pending_consolidations_limit": "64", "max_consolidation_requests_per_payload.size": "1", + "field_elements_per_cell.size": "64", + "field_elements_per_ext_blob.size": "8192", + "bytes_per_cell.size": "2048", # FIELD_ELEMENTS_PER_CELL * BYTES_PER_FIELD_ELEMENT + "cells_per_blob.size": "128", + "kzg_commitments_inclusion_proof_depth.size": "4", } ###### Rules definitions #######