From 5e5583483683fda5b06cc36de3dddae88ae37ac9 Mon Sep 17 00:00:00 2001 From: Manu NALEPA Date: Wed, 17 Jul 2024 20:40:31 +0200 Subject: [PATCH] Add in column sidecars protos (#13862) --- config/params/config.go | 4 + config/params/loader_test.go | 2 - config/params/mainnet_config.go | 2 + proto/eth/v1/data_columns.proto | 36 +++ proto/prysm/v1alpha1/BUILD.bazel | 2 + proto/prysm/v1alpha1/data_columns.pb.go | 225 +++++++++++++++ proto/prysm/v1alpha1/data_columns.pb.gw.go | 4 + proto/prysm/v1alpha1/data_columns.proto | 36 +++ proto/prysm/v1alpha1/deneb.ssz.go | 301 ++++++++++++++++++++- proto/prysm/v1alpha1/light_client.pb.go | 5 +- proto/ssz_proto_library.bzl | 10 + 11 files changed, 622 insertions(+), 5 deletions(-) create mode 100644 proto/eth/v1/data_columns.proto create mode 100755 proto/prysm/v1alpha1/data_columns.pb.go create mode 100755 proto/prysm/v1alpha1/data_columns.pb.gw.go create mode 100644 proto/prysm/v1alpha1/data_columns.proto diff --git a/config/params/config.go b/config/params/config.go index a1e59c1033a6..8463b5f0ae56 100644 --- a/config/params/config.go +++ b/config/params/config.go @@ -255,6 +255,10 @@ 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 humber 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. + // 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. diff --git a/config/params/loader_test.go b/config/params/loader_test.go index 1760f0bf223a..948520807446 100644 --- a/config/params/loader_test.go +++ b/config/params/loader_test.go @@ -25,7 +25,6 @@ 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", @@ -43,7 +42,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..c6709e269c29 100644 --- a/config/params/mainnet_config.go +++ b/config/params/mainnet_config.go @@ -297,6 +297,8 @@ var mainnetBeaconConfig = &BeaconChainConfig{ // PeerDAS NumberOfColumns: 128, MaxCellsInExtendedMatrix: 768, + SamplesPerSlot: 8, + CustodyRequirement: 1, // Values related to networking parameters. GossipMaxSize: 10 * 1 << 20, // 10 MiB diff --git a/proto/eth/v1/data_columns.proto b/proto/eth/v1/data_columns.proto new file mode 100644 index 000000000000..b6cf2a79d75e --- /dev/null +++ b/proto/eth/v1/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/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index e79cd7856734..84c92486649a 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -142,6 +142,7 @@ ssz_deneb_objs = [ "LightClientHeaderDeneb", "LightClientOptimisticUpdateDeneb", "LightClientUpdateDeneb", + "DataColumnSidecar", "SignedBeaconBlockContentsDeneb", "SignedBeaconBlockDeneb", "SignedBlindedBeaconBlockDeneb", @@ -352,6 +353,7 @@ ssz_proto_files( "beacon_state.proto", "blobs.proto", "light_client.proto", + "data_columns.proto", "sync_committee.proto", "withdrawals.proto", ], 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.pb.gw.go b/proto/prysm/v1alpha1/data_columns.pb.gw.go new file mode 100755 index 000000000000..cdd03643f0c7 --- /dev/null +++ b/proto/prysm/v1alpha1/data_columns.pb.gw.go @@ -0,0 +1,4 @@ +//go:build ignore +// +build ignore + +package ignore diff --git a/proto/prysm/v1alpha1/data_columns.proto b/proto/prysm/v1alpha1/data_columns.proto new file mode 100644 index 000000000000..92820b51d532 --- /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"]; +} \ No newline at end of file diff --git a/proto/prysm/v1alpha1/deneb.ssz.go b/proto/prysm/v1alpha1/deneb.ssz.go index d5b8cf461aba..a27ed1402b39 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: cf1d45507e9bc949b6d9033b0555b60c470978a8b7b9542a2a5a11f2f641524a package eth import ( @@ -3594,6 +3594,305 @@ func (b *BlobIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } +// 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 +} + // MarshalSSZ ssz marshals the LightClientHeaderDeneb object func (l *LightClientHeaderDeneb) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(l) diff --git a/proto/prysm/v1alpha1/light_client.pb.go b/proto/prysm/v1alpha1/light_client.pb.go index e0bf066767c8..34992141bc7c 100755 --- a/proto/prysm/v1alpha1/light_client.pb.go +++ b/proto/prysm/v1alpha1/light_client.pb.go @@ -7,13 +7,14 @@ package eth import ( + reflect "reflect" + sync "sync" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" v1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" _ "github.com/prysmaticlabs/prysm/v5/proto/eth/ext" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( 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 #######