From b12a51020bd336e0aae0eb3cb8403b5d3791478c Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 16:13:22 +0900 Subject: [PATCH 01/10] Move ssz_query objects into testing folder (ensuring test objects only used in test environment) --- encoding/ssz/query/BUILD.bazel | 2 +- encoding/ssz/query/analyzer_test.go | 2 +- encoding/ssz/query/query_test.go | 2 +- proto/ssz_query/ssz_query.pb.go | 508 ----------------- proto/ssz_query/{ => testing}/BUILD.bazel | 10 +- proto/ssz_query/testing/test_containers.pb.go | 509 ++++++++++++++++++ .../test_containers.proto} | 4 +- .../test_containers.ssz.go} | 2 +- 8 files changed, 520 insertions(+), 519 deletions(-) delete mode 100755 proto/ssz_query/ssz_query.pb.go rename proto/ssz_query/{ => testing}/BUILD.bazel (93%) create mode 100755 proto/ssz_query/testing/test_containers.pb.go rename proto/ssz_query/{ssz_query.proto => testing/test_containers.proto} (99%) rename proto/ssz_query/{ssz_query.ssz.go => testing/test_containers.ssz.go} (99%) diff --git a/encoding/ssz/query/BUILD.bazel b/encoding/ssz/query/BUILD.bazel index 837d17054ce2..d206beaa517f 100644 --- a/encoding/ssz/query/BUILD.bazel +++ b/encoding/ssz/query/BUILD.bazel @@ -32,7 +32,7 @@ go_test( deps = [ ":go_default_library", "//encoding/ssz/query/testutil:go_default_library", - "//proto/ssz_query:go_default_library", + "//proto/ssz_query/testing:go_default_library", "//testing/require:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], diff --git a/encoding/ssz/query/analyzer_test.go b/encoding/ssz/query/analyzer_test.go index 7c8d4666fa4c..ff51882544d0 100644 --- a/encoding/ssz/query/analyzer_test.go +++ b/encoding/ssz/query/analyzer_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/OffchainLabs/prysm/v6/encoding/ssz/query" - sszquerypb "github.com/OffchainLabs/prysm/v6/proto/ssz_query" + sszquerypb "github.com/OffchainLabs/prysm/v6/proto/ssz_query/testing" "github.com/OffchainLabs/prysm/v6/testing/require" ) diff --git a/encoding/ssz/query/query_test.go b/encoding/ssz/query/query_test.go index 934f28a5f9cd..92ed7b12e81e 100644 --- a/encoding/ssz/query/query_test.go +++ b/encoding/ssz/query/query_test.go @@ -6,7 +6,7 @@ import ( "github.com/OffchainLabs/prysm/v6/encoding/ssz/query" "github.com/OffchainLabs/prysm/v6/encoding/ssz/query/testutil" - sszquerypb "github.com/OffchainLabs/prysm/v6/proto/ssz_query" + sszquerypb "github.com/OffchainLabs/prysm/v6/proto/ssz_query/testing" "github.com/OffchainLabs/prysm/v6/testing/require" "github.com/prysmaticlabs/go-bitfield" ) diff --git a/proto/ssz_query/ssz_query.pb.go b/proto/ssz_query/ssz_query.pb.go deleted file mode 100755 index 3d273eeeb1f1..000000000000 --- a/proto/ssz_query/ssz_query.pb.go +++ /dev/null @@ -1,508 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.3 -// protoc v3.21.7 -// source: proto/ssz_query/ssz_query.proto - -package ssz_query - -import ( - reflect "reflect" - sync "sync" - - _ "github.com/OffchainLabs/prysm/v6/proto/eth/ext" - github_com_prysmaticlabs_go_bitfield "github.com/prysmaticlabs/go-bitfield" - 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 FixedNestedContainer struct { - state protoimpl.MessageState `protogen:"open.v1"` - Value1 uint64 `protobuf:"varint,1,opt,name=value1,proto3" json:"value1,omitempty"` - Value2 []byte `protobuf:"bytes,2,opt,name=value2,proto3" json:"value2,omitempty" ssz-size:"32"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *FixedNestedContainer) Reset() { - *x = FixedNestedContainer{} - mi := &file_proto_ssz_query_ssz_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *FixedNestedContainer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FixedNestedContainer) ProtoMessage() {} - -func (x *FixedNestedContainer) ProtoReflect() protoreflect.Message { - mi := &file_proto_ssz_query_ssz_query_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FixedNestedContainer.ProtoReflect.Descriptor instead. -func (*FixedNestedContainer) Descriptor() ([]byte, []int) { - return file_proto_ssz_query_ssz_query_proto_rawDescGZIP(), []int{0} -} - -func (x *FixedNestedContainer) GetValue1() uint64 { - if x != nil { - return x.Value1 - } - return 0 -} - -func (x *FixedNestedContainer) GetValue2() []byte { - if x != nil { - return x.Value2 - } - return nil -} - -type FixedTestContainer struct { - state protoimpl.MessageState `protogen:"open.v1"` - FieldUint32 uint32 `protobuf:"varint,1,opt,name=field_uint32,json=fieldUint32,proto3" json:"field_uint32,omitempty"` - FieldUint64 uint64 `protobuf:"varint,2,opt,name=field_uint64,json=fieldUint64,proto3" json:"field_uint64,omitempty"` - FieldBool bool `protobuf:"varint,3,opt,name=field_bool,json=fieldBool,proto3" json:"field_bool,omitempty"` - FieldBytes32 []byte `protobuf:"bytes,4,opt,name=field_bytes32,json=fieldBytes32,proto3" json:"field_bytes32,omitempty" ssz-size:"32"` - Nested *FixedNestedContainer `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"` - VectorField []uint64 `protobuf:"varint,6,rep,packed,name=vector_field,json=vectorField,proto3" json:"vector_field,omitempty" ssz-size:"24"` - TwoDimensionBytesField [][]byte `protobuf:"bytes,7,rep,name=two_dimension_bytes_field,json=twoDimensionBytesField,proto3" json:"two_dimension_bytes_field,omitempty" ssz-size:"5,32"` - Bitvector64Field github_com_prysmaticlabs_go_bitfield.Bitvector64 `protobuf:"bytes,8,opt,name=bitvector64_field,json=bitvector64Field,proto3" json:"bitvector64_field,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector64" ssz-size:"8"` - Bitvector512Field github_com_prysmaticlabs_go_bitfield.Bitvector512 `protobuf:"bytes,9,opt,name=bitvector512_field,json=bitvector512Field,proto3" json:"bitvector512_field,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector512" ssz-size:"64"` - TrailingField []byte `protobuf:"bytes,10,opt,name=trailing_field,json=trailingField,proto3" json:"trailing_field,omitempty" ssz-size:"56"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *FixedTestContainer) Reset() { - *x = FixedTestContainer{} - mi := &file_proto_ssz_query_ssz_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *FixedTestContainer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FixedTestContainer) ProtoMessage() {} - -func (x *FixedTestContainer) ProtoReflect() protoreflect.Message { - mi := &file_proto_ssz_query_ssz_query_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FixedTestContainer.ProtoReflect.Descriptor instead. -func (*FixedTestContainer) Descriptor() ([]byte, []int) { - return file_proto_ssz_query_ssz_query_proto_rawDescGZIP(), []int{1} -} - -func (x *FixedTestContainer) GetFieldUint32() uint32 { - if x != nil { - return x.FieldUint32 - } - return 0 -} - -func (x *FixedTestContainer) GetFieldUint64() uint64 { - if x != nil { - return x.FieldUint64 - } - return 0 -} - -func (x *FixedTestContainer) GetFieldBool() bool { - if x != nil { - return x.FieldBool - } - return false -} - -func (x *FixedTestContainer) GetFieldBytes32() []byte { - if x != nil { - return x.FieldBytes32 - } - return nil -} - -func (x *FixedTestContainer) GetNested() *FixedNestedContainer { - if x != nil { - return x.Nested - } - return nil -} - -func (x *FixedTestContainer) GetVectorField() []uint64 { - if x != nil { - return x.VectorField - } - return nil -} - -func (x *FixedTestContainer) GetTwoDimensionBytesField() [][]byte { - if x != nil { - return x.TwoDimensionBytesField - } - return nil -} - -func (x *FixedTestContainer) GetBitvector64Field() github_com_prysmaticlabs_go_bitfield.Bitvector64 { - if x != nil { - return x.Bitvector64Field - } - return github_com_prysmaticlabs_go_bitfield.Bitvector64(nil) -} - -func (x *FixedTestContainer) GetBitvector512Field() github_com_prysmaticlabs_go_bitfield.Bitvector512 { - if x != nil { - return x.Bitvector512Field - } - return github_com_prysmaticlabs_go_bitfield.Bitvector512(nil) -} - -func (x *FixedTestContainer) GetTrailingField() []byte { - if x != nil { - return x.TrailingField - } - return nil -} - -type VariableNestedContainer struct { - state protoimpl.MessageState `protogen:"open.v1"` - Value1 uint64 `protobuf:"varint,1,opt,name=value1,proto3" json:"value1,omitempty"` - FieldListUint64 []uint64 `protobuf:"varint,2,rep,packed,name=field_list_uint64,json=fieldListUint64,proto3" json:"field_list_uint64,omitempty" ssz-max:"100"` - NestedListField [][]byte `protobuf:"bytes,3,rep,name=nested_list_field,json=nestedListField,proto3" json:"nested_list_field,omitempty" ssz-max:"100,50" ssz-size:"?,?"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VariableNestedContainer) Reset() { - *x = VariableNestedContainer{} - mi := &file_proto_ssz_query_ssz_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VariableNestedContainer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VariableNestedContainer) ProtoMessage() {} - -func (x *VariableNestedContainer) ProtoReflect() protoreflect.Message { - mi := &file_proto_ssz_query_ssz_query_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VariableNestedContainer.ProtoReflect.Descriptor instead. -func (*VariableNestedContainer) Descriptor() ([]byte, []int) { - return file_proto_ssz_query_ssz_query_proto_rawDescGZIP(), []int{2} -} - -func (x *VariableNestedContainer) GetValue1() uint64 { - if x != nil { - return x.Value1 - } - return 0 -} - -func (x *VariableNestedContainer) GetFieldListUint64() []uint64 { - if x != nil { - return x.FieldListUint64 - } - return nil -} - -func (x *VariableNestedContainer) GetNestedListField() [][]byte { - if x != nil { - return x.NestedListField - } - return nil -} - -type VariableTestContainer struct { - state protoimpl.MessageState `protogen:"open.v1"` - LeadingField []byte `protobuf:"bytes,1,opt,name=leading_field,json=leadingField,proto3" json:"leading_field,omitempty" ssz-size:"32"` - FieldListUint64 []uint64 `protobuf:"varint,2,rep,packed,name=field_list_uint64,json=fieldListUint64,proto3" json:"field_list_uint64,omitempty" ssz-max:"2048"` - FieldListContainer []*FixedNestedContainer `protobuf:"bytes,3,rep,name=field_list_container,json=fieldListContainer,proto3" json:"field_list_container,omitempty" ssz-max:"128"` - FieldListBytes32 [][]byte `protobuf:"bytes,4,rep,name=field_list_bytes32,json=fieldListBytes32,proto3" json:"field_list_bytes32,omitempty" ssz-max:"100" ssz-size:"?,32"` - Nested *VariableNestedContainer `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"` - BitlistField github_com_prysmaticlabs_go_bitfield.Bitlist `protobuf:"bytes,6,opt,name=bitlist_field,json=bitlistField,proto3" json:"bitlist_field,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitlist" ssz-max:"2048"` - NestedListField [][]byte `protobuf:"bytes,7,rep,name=nested_list_field,json=nestedListField,proto3" json:"nested_list_field,omitempty" ssz-max:"100,50" ssz-size:"?,?"` - TrailingField []byte `protobuf:"bytes,8,opt,name=trailing_field,json=trailingField,proto3" json:"trailing_field,omitempty" ssz-size:"56"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VariableTestContainer) Reset() { - *x = VariableTestContainer{} - mi := &file_proto_ssz_query_ssz_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VariableTestContainer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VariableTestContainer) ProtoMessage() {} - -func (x *VariableTestContainer) ProtoReflect() protoreflect.Message { - mi := &file_proto_ssz_query_ssz_query_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VariableTestContainer.ProtoReflect.Descriptor instead. -func (*VariableTestContainer) Descriptor() ([]byte, []int) { - return file_proto_ssz_query_ssz_query_proto_rawDescGZIP(), []int{3} -} - -func (x *VariableTestContainer) GetLeadingField() []byte { - if x != nil { - return x.LeadingField - } - return nil -} - -func (x *VariableTestContainer) GetFieldListUint64() []uint64 { - if x != nil { - return x.FieldListUint64 - } - return nil -} - -func (x *VariableTestContainer) GetFieldListContainer() []*FixedNestedContainer { - if x != nil { - return x.FieldListContainer - } - return nil -} - -func (x *VariableTestContainer) GetFieldListBytes32() [][]byte { - if x != nil { - return x.FieldListBytes32 - } - return nil -} - -func (x *VariableTestContainer) GetNested() *VariableNestedContainer { - if x != nil { - return x.Nested - } - return nil -} - -func (x *VariableTestContainer) GetBitlistField() github_com_prysmaticlabs_go_bitfield.Bitlist { - if x != nil { - return x.BitlistField - } - return github_com_prysmaticlabs_go_bitfield.Bitlist(nil) -} - -func (x *VariableTestContainer) GetNestedListField() [][]byte { - if x != nil { - return x.NestedListField - } - return nil -} - -func (x *VariableTestContainer) GetTrailingField() []byte { - if x != nil { - return x.TrailingField - } - return nil -} - -var File_proto_ssz_query_ssz_query_proto protoreflect.FileDescriptor - -var file_proto_ssz_query_ssz_query_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x09, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 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, 0x4e, 0x0a, 0x14, 0x46, 0x69, 0x78, - 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x1e, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, - 0x32, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x22, 0xd2, 0x04, 0x0a, 0x12, 0x46, 0x69, - 0x78, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x55, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x75, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, - 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x2b, 0x0a, 0x0d, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, - 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, - 0x18, 0x02, 0x33, 0x32, 0x52, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, - 0x33, 0x32, 0x12, 0x37, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x46, - 0x69, 0x78, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x0c, 0x76, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x06, 0x20, 0x03, 0x28, - 0x04, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x32, 0x34, 0x52, 0x0b, 0x76, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43, 0x0a, 0x19, 0x74, 0x77, 0x6f, 0x5f, 0x64, 0x69, - 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x35, - 0x2c, 0x33, 0x32, 0x52, 0x16, 0x74, 0x77, 0x6f, 0x44, 0x69, 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x66, 0x0a, 0x11, 0x62, - 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x36, 0x34, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x39, 0x82, 0xb5, 0x18, 0x30, 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, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x2e, 0x42, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x36, 0x34, 0x8a, 0xb5, 0x18, 0x01, - 0x38, 0x52, 0x10, 0x62, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x36, 0x34, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x12, 0x6a, 0x0a, 0x12, 0x62, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x35, 0x31, 0x32, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x42, - 0x3b, 0x82, 0xb5, 0x18, 0x31, 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, 0x67, 0x6f, - 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, 0x76, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x35, 0x31, 0x32, 0x8a, 0xb5, 0x18, 0x02, 0x36, 0x34, 0x52, 0x11, 0x62, 0x69, - 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x35, 0x31, 0x32, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, - 0x2d, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x35, 0x36, 0x52, - 0x0d, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0xa5, - 0x01, 0x0a, 0x17, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, - 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x31, 0x12, 0x33, 0x0a, 0x11, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, - 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x42, 0x07, 0x92, - 0xb5, 0x18, 0x03, 0x31, 0x30, 0x30, 0x52, 0x0f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, - 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x3d, 0x0a, 0x11, 0x6e, 0x65, 0x73, 0x74, 0x65, - 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0c, 0x42, 0x11, 0x8a, 0xb5, 0x18, 0x03, 0x3f, 0x2c, 0x3f, 0x92, 0xb5, 0x18, 0x06, 0x31, - 0x30, 0x30, 0x2c, 0x35, 0x30, 0x52, 0x0f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, - 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x9e, 0x04, 0x0a, 0x15, 0x56, 0x61, 0x72, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x54, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x12, 0x2b, 0x0a, 0x0d, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, - 0x0c, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x34, 0x0a, - 0x11, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x42, 0x08, 0x92, 0xb5, 0x18, 0x04, 0x32, 0x30, - 0x34, 0x38, 0x52, 0x0f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x69, 0x6e, - 0x74, 0x36, 0x34, 0x12, 0x5a, 0x0a, 0x14, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6c, 0x69, 0x73, - 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x46, 0x69, - 0x78, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x42, 0x07, 0x92, 0xb5, 0x18, 0x03, 0x31, 0x32, 0x38, 0x52, 0x12, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, - 0x3d, 0x0a, 0x12, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x33, 0x32, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x0f, 0x8a, 0xb5, 0x18, - 0x04, 0x3f, 0x2c, 0x33, 0x32, 0x92, 0xb5, 0x18, 0x03, 0x31, 0x30, 0x30, 0x52, 0x10, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x12, 0x3a, - 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x5d, 0x0a, 0x0d, 0x62, 0x69, - 0x74, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0c, 0x42, 0x38, 0x82, 0xb5, 0x18, 0x2c, 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, - 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, 0x6c, - 0x69, 0x73, 0x74, 0x92, 0xb5, 0x18, 0x04, 0x32, 0x30, 0x34, 0x38, 0x52, 0x0c, 0x62, 0x69, 0x74, - 0x6c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x3d, 0x0a, 0x11, 0x6e, 0x65, 0x73, - 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0c, 0x42, 0x11, 0x8a, 0xb5, 0x18, 0x03, 0x3f, 0x2c, 0x3f, 0x92, 0xb5, 0x18, - 0x06, 0x31, 0x30, 0x30, 0x2c, 0x35, 0x30, 0x52, 0x0f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, - 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x2d, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x69, - 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, - 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x35, 0x36, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, - 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x66, 0x66, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4c, 0x61, - 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_proto_ssz_query_ssz_query_proto_rawDescOnce sync.Once - file_proto_ssz_query_ssz_query_proto_rawDescData = file_proto_ssz_query_ssz_query_proto_rawDesc -) - -func file_proto_ssz_query_ssz_query_proto_rawDescGZIP() []byte { - file_proto_ssz_query_ssz_query_proto_rawDescOnce.Do(func() { - file_proto_ssz_query_ssz_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_ssz_query_ssz_query_proto_rawDescData) - }) - return file_proto_ssz_query_ssz_query_proto_rawDescData -} - -var file_proto_ssz_query_ssz_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_proto_ssz_query_ssz_query_proto_goTypes = []any{ - (*FixedNestedContainer)(nil), // 0: ssz_query.FixedNestedContainer - (*FixedTestContainer)(nil), // 1: ssz_query.FixedTestContainer - (*VariableNestedContainer)(nil), // 2: ssz_query.VariableNestedContainer - (*VariableTestContainer)(nil), // 3: ssz_query.VariableTestContainer -} -var file_proto_ssz_query_ssz_query_proto_depIdxs = []int32{ - 0, // 0: ssz_query.FixedTestContainer.nested:type_name -> ssz_query.FixedNestedContainer - 0, // 1: ssz_query.VariableTestContainer.field_list_container:type_name -> ssz_query.FixedNestedContainer - 2, // 2: ssz_query.VariableTestContainer.nested:type_name -> ssz_query.VariableNestedContainer - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_proto_ssz_query_ssz_query_proto_init() } -func file_proto_ssz_query_ssz_query_proto_init() { - if File_proto_ssz_query_ssz_query_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_ssz_query_ssz_query_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_proto_ssz_query_ssz_query_proto_goTypes, - DependencyIndexes: file_proto_ssz_query_ssz_query_proto_depIdxs, - MessageInfos: file_proto_ssz_query_ssz_query_proto_msgTypes, - }.Build() - File_proto_ssz_query_ssz_query_proto = out.File - file_proto_ssz_query_ssz_query_proto_rawDesc = nil - file_proto_ssz_query_ssz_query_proto_goTypes = nil - file_proto_ssz_query_ssz_query_proto_depIdxs = nil -} diff --git a/proto/ssz_query/BUILD.bazel b/proto/ssz_query/testing/BUILD.bazel similarity index 93% rename from proto/ssz_query/BUILD.bazel rename to proto/ssz_query/testing/BUILD.bazel index 16991bf95c61..929ce56d34da 100644 --- a/proto/ssz_query/BUILD.bazel +++ b/proto/ssz_query/testing/BUILD.bazel @@ -8,7 +8,7 @@ load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal") proto_library( name = "proto", - srcs = ["ssz_query.proto"], + srcs = ["test_containers.proto"], visibility = ["//visibility:public"], deps = [ "//proto/eth/ext:proto", @@ -20,7 +20,7 @@ go_proto_library( compilers = [ "@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc", ], - importpath = "github.com/OffchainLabs/prysm/v6/proto/ssz_query", + importpath = "github.com/OffchainLabs/prysm/v6/proto/ssz_query/testing", proto = ":proto", visibility = ["//visibility:public"], deps = [ @@ -35,7 +35,7 @@ go_proto_library( # SSZ generation for test proto messages ssz_gen_marshal( name = "ssz_generated", - out = "ssz_query.ssz.go", + out = "test_containers.ssz.go", go_proto = ":go_proto", objs = [ "FixedTestContainer", @@ -50,7 +50,7 @@ go_library( ":ssz_generated", # keep ], embed = [":go_proto"], - importpath = "github.com/OffchainLabs/prysm/v6/proto/ssz_query", + importpath = "github.com/OffchainLabs/prysm/v6/proto/ssz_query/testing", visibility = ["//visibility:public"], deps = SSZ_DEPS + [ "//proto/eth/ext:go_default_library", @@ -61,7 +61,7 @@ go_library( ssz_proto_files( name = "ssz_proto_files", - srcs = ["ssz_query.proto"], + srcs = ["test_containers.proto"], config = select({ "//conditions:default": "mainnet", "//proto:ssz_mainnet": "mainnet", diff --git a/proto/ssz_query/testing/test_containers.pb.go b/proto/ssz_query/testing/test_containers.pb.go new file mode 100755 index 000000000000..904f0c8a508d --- /dev/null +++ b/proto/ssz_query/testing/test_containers.pb.go @@ -0,0 +1,509 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.3 +// protoc v3.21.7 +// source: proto/ssz_query/testing/test_containers.proto + +package testing + +import ( + reflect "reflect" + sync "sync" + + _ "github.com/OffchainLabs/prysm/v6/proto/eth/ext" + github_com_prysmaticlabs_go_bitfield "github.com/prysmaticlabs/go-bitfield" + 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 FixedNestedContainer struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value1 uint64 `protobuf:"varint,1,opt,name=value1,proto3" json:"value1,omitempty"` + Value2 []byte `protobuf:"bytes,2,opt,name=value2,proto3" json:"value2,omitempty" ssz-size:"32"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FixedNestedContainer) Reset() { + *x = FixedNestedContainer{} + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FixedNestedContainer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FixedNestedContainer) ProtoMessage() {} + +func (x *FixedNestedContainer) ProtoReflect() protoreflect.Message { + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FixedNestedContainer.ProtoReflect.Descriptor instead. +func (*FixedNestedContainer) Descriptor() ([]byte, []int) { + return file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP(), []int{0} +} + +func (x *FixedNestedContainer) GetValue1() uint64 { + if x != nil { + return x.Value1 + } + return 0 +} + +func (x *FixedNestedContainer) GetValue2() []byte { + if x != nil { + return x.Value2 + } + return nil +} + +type FixedTestContainer struct { + state protoimpl.MessageState `protogen:"open.v1"` + FieldUint32 uint32 `protobuf:"varint,1,opt,name=field_uint32,json=fieldUint32,proto3" json:"field_uint32,omitempty"` + FieldUint64 uint64 `protobuf:"varint,2,opt,name=field_uint64,json=fieldUint64,proto3" json:"field_uint64,omitempty"` + FieldBool bool `protobuf:"varint,3,opt,name=field_bool,json=fieldBool,proto3" json:"field_bool,omitempty"` + FieldBytes32 []byte `protobuf:"bytes,4,opt,name=field_bytes32,json=fieldBytes32,proto3" json:"field_bytes32,omitempty" ssz-size:"32"` + Nested *FixedNestedContainer `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"` + VectorField []uint64 `protobuf:"varint,6,rep,packed,name=vector_field,json=vectorField,proto3" json:"vector_field,omitempty" ssz-size:"24"` + TwoDimensionBytesField [][]byte `protobuf:"bytes,7,rep,name=two_dimension_bytes_field,json=twoDimensionBytesField,proto3" json:"two_dimension_bytes_field,omitempty" ssz-size:"5,32"` + Bitvector64Field github_com_prysmaticlabs_go_bitfield.Bitvector64 `protobuf:"bytes,8,opt,name=bitvector64_field,json=bitvector64Field,proto3" json:"bitvector64_field,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector64" ssz-size:"8"` + Bitvector512Field github_com_prysmaticlabs_go_bitfield.Bitvector512 `protobuf:"bytes,9,opt,name=bitvector512_field,json=bitvector512Field,proto3" json:"bitvector512_field,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector512" ssz-size:"64"` + TrailingField []byte `protobuf:"bytes,10,opt,name=trailing_field,json=trailingField,proto3" json:"trailing_field,omitempty" ssz-size:"56"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FixedTestContainer) Reset() { + *x = FixedTestContainer{} + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FixedTestContainer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FixedTestContainer) ProtoMessage() {} + +func (x *FixedTestContainer) ProtoReflect() protoreflect.Message { + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FixedTestContainer.ProtoReflect.Descriptor instead. +func (*FixedTestContainer) Descriptor() ([]byte, []int) { + return file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP(), []int{1} +} + +func (x *FixedTestContainer) GetFieldUint32() uint32 { + if x != nil { + return x.FieldUint32 + } + return 0 +} + +func (x *FixedTestContainer) GetFieldUint64() uint64 { + if x != nil { + return x.FieldUint64 + } + return 0 +} + +func (x *FixedTestContainer) GetFieldBool() bool { + if x != nil { + return x.FieldBool + } + return false +} + +func (x *FixedTestContainer) GetFieldBytes32() []byte { + if x != nil { + return x.FieldBytes32 + } + return nil +} + +func (x *FixedTestContainer) GetNested() *FixedNestedContainer { + if x != nil { + return x.Nested + } + return nil +} + +func (x *FixedTestContainer) GetVectorField() []uint64 { + if x != nil { + return x.VectorField + } + return nil +} + +func (x *FixedTestContainer) GetTwoDimensionBytesField() [][]byte { + if x != nil { + return x.TwoDimensionBytesField + } + return nil +} + +func (x *FixedTestContainer) GetBitvector64Field() github_com_prysmaticlabs_go_bitfield.Bitvector64 { + if x != nil { + return x.Bitvector64Field + } + return github_com_prysmaticlabs_go_bitfield.Bitvector64(nil) +} + +func (x *FixedTestContainer) GetBitvector512Field() github_com_prysmaticlabs_go_bitfield.Bitvector512 { + if x != nil { + return x.Bitvector512Field + } + return github_com_prysmaticlabs_go_bitfield.Bitvector512(nil) +} + +func (x *FixedTestContainer) GetTrailingField() []byte { + if x != nil { + return x.TrailingField + } + return nil +} + +type VariableNestedContainer struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value1 uint64 `protobuf:"varint,1,opt,name=value1,proto3" json:"value1,omitempty"` + FieldListUint64 []uint64 `protobuf:"varint,2,rep,packed,name=field_list_uint64,json=fieldListUint64,proto3" json:"field_list_uint64,omitempty" ssz-max:"100"` + NestedListField [][]byte `protobuf:"bytes,3,rep,name=nested_list_field,json=nestedListField,proto3" json:"nested_list_field,omitempty" ssz-max:"100,50" ssz-size:"?,?"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VariableNestedContainer) Reset() { + *x = VariableNestedContainer{} + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VariableNestedContainer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VariableNestedContainer) ProtoMessage() {} + +func (x *VariableNestedContainer) ProtoReflect() protoreflect.Message { + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VariableNestedContainer.ProtoReflect.Descriptor instead. +func (*VariableNestedContainer) Descriptor() ([]byte, []int) { + return file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP(), []int{2} +} + +func (x *VariableNestedContainer) GetValue1() uint64 { + if x != nil { + return x.Value1 + } + return 0 +} + +func (x *VariableNestedContainer) GetFieldListUint64() []uint64 { + if x != nil { + return x.FieldListUint64 + } + return nil +} + +func (x *VariableNestedContainer) GetNestedListField() [][]byte { + if x != nil { + return x.NestedListField + } + return nil +} + +type VariableTestContainer struct { + state protoimpl.MessageState `protogen:"open.v1"` + LeadingField []byte `protobuf:"bytes,1,opt,name=leading_field,json=leadingField,proto3" json:"leading_field,omitempty" ssz-size:"32"` + FieldListUint64 []uint64 `protobuf:"varint,2,rep,packed,name=field_list_uint64,json=fieldListUint64,proto3" json:"field_list_uint64,omitempty" ssz-max:"2048"` + FieldListContainer []*FixedNestedContainer `protobuf:"bytes,3,rep,name=field_list_container,json=fieldListContainer,proto3" json:"field_list_container,omitempty" ssz-max:"128"` + FieldListBytes32 [][]byte `protobuf:"bytes,4,rep,name=field_list_bytes32,json=fieldListBytes32,proto3" json:"field_list_bytes32,omitempty" ssz-max:"100" ssz-size:"?,32"` + Nested *VariableNestedContainer `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"` + BitlistField github_com_prysmaticlabs_go_bitfield.Bitlist `protobuf:"bytes,6,opt,name=bitlist_field,json=bitlistField,proto3" json:"bitlist_field,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitlist" ssz-max:"2048"` + NestedListField [][]byte `protobuf:"bytes,7,rep,name=nested_list_field,json=nestedListField,proto3" json:"nested_list_field,omitempty" ssz-max:"100,50" ssz-size:"?,?"` + TrailingField []byte `protobuf:"bytes,8,opt,name=trailing_field,json=trailingField,proto3" json:"trailing_field,omitempty" ssz-size:"56"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VariableTestContainer) Reset() { + *x = VariableTestContainer{} + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VariableTestContainer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VariableTestContainer) ProtoMessage() {} + +func (x *VariableTestContainer) ProtoReflect() protoreflect.Message { + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VariableTestContainer.ProtoReflect.Descriptor instead. +func (*VariableTestContainer) Descriptor() ([]byte, []int) { + return file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP(), []int{3} +} + +func (x *VariableTestContainer) GetLeadingField() []byte { + if x != nil { + return x.LeadingField + } + return nil +} + +func (x *VariableTestContainer) GetFieldListUint64() []uint64 { + if x != nil { + return x.FieldListUint64 + } + return nil +} + +func (x *VariableTestContainer) GetFieldListContainer() []*FixedNestedContainer { + if x != nil { + return x.FieldListContainer + } + return nil +} + +func (x *VariableTestContainer) GetFieldListBytes32() [][]byte { + if x != nil { + return x.FieldListBytes32 + } + return nil +} + +func (x *VariableTestContainer) GetNested() *VariableNestedContainer { + if x != nil { + return x.Nested + } + return nil +} + +func (x *VariableTestContainer) GetBitlistField() github_com_prysmaticlabs_go_bitfield.Bitlist { + if x != nil { + return x.BitlistField + } + return github_com_prysmaticlabs_go_bitfield.Bitlist(nil) +} + +func (x *VariableTestContainer) GetNestedListField() [][]byte { + if x != nil { + return x.NestedListField + } + return nil +} + +func (x *VariableTestContainer) GetTrailingField() []byte { + if x != nil { + return x.TrailingField + } + return nil +} + +var File_proto_ssz_query_testing_test_containers_proto protoreflect.FileDescriptor + +var file_proto_ssz_query_testing_test_containers_proto_rawDesc = []byte{ + 0x0a, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x07, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 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, 0x4e, 0x0a, 0x14, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4e, 0x65, + 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x16, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x1e, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x32, 0x22, 0xd0, 0x04, 0x0a, 0x12, 0x46, 0x69, 0x78, 0x65, 0x64, 0x54, + 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, + 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x55, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x6f, 0x6f, + 0x6c, 0x12, 0x2b, 0x0a, 0x0d, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x33, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, + 0x52, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x12, 0x35, + 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4e, 0x65, + 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x06, 0x6e, + 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x0c, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x42, 0x06, 0x8a, 0xb5, 0x18, + 0x02, 0x32, 0x34, 0x52, 0x0b, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x12, 0x43, 0x0a, 0x19, 0x74, 0x77, 0x6f, 0x5f, 0x64, 0x69, 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x35, 0x2c, 0x33, 0x32, 0x52, 0x16, 0x74, + 0x77, 0x6f, 0x44, 0x69, 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x66, 0x0a, 0x11, 0x62, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x36, 0x34, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, + 0x42, 0x39, 0x82, 0xb5, 0x18, 0x30, 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, 0x67, + 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, 0x76, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x36, 0x34, 0x8a, 0xb5, 0x18, 0x01, 0x38, 0x52, 0x10, 0x62, 0x69, 0x74, + 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x36, 0x34, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x6a, 0x0a, + 0x12, 0x62, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x35, 0x31, 0x32, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x3b, 0x82, 0xb5, 0x18, 0x31, 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, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x35, 0x31, 0x32, + 0x8a, 0xb5, 0x18, 0x02, 0x36, 0x34, 0x52, 0x11, 0x62, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x35, 0x31, 0x32, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x2d, 0x0a, 0x0e, 0x74, 0x72, 0x61, + 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x35, 0x36, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x69, 0x6c, + 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0xa5, 0x01, 0x0a, 0x17, 0x56, 0x61, 0x72, + 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x33, 0x0a, 0x11, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, + 0x34, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x42, 0x07, 0x92, 0xb5, 0x18, 0x03, 0x31, 0x30, 0x30, + 0x52, 0x0f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, + 0x34, 0x12, 0x3d, 0x0a, 0x11, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, + 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x11, 0x8a, 0xb5, + 0x18, 0x03, 0x3f, 0x2c, 0x3f, 0x92, 0xb5, 0x18, 0x06, 0x31, 0x30, 0x30, 0x2c, 0x35, 0x30, 0x52, + 0x0f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x22, 0x9a, 0x04, 0x0a, 0x15, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x65, 0x73, + 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x0d, 0x6c, 0x65, + 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0c, 0x6c, 0x65, 0x61, 0x64, 0x69, + 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x34, 0x0a, 0x11, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x04, 0x42, 0x08, 0x92, 0xb5, 0x18, 0x04, 0x32, 0x30, 0x34, 0x38, 0x52, 0x0f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x58, 0x0a, + 0x14, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, + 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x07, 0x92, 0xb5, 0x18, 0x03, + 0x31, 0x32, 0x38, 0x52, 0x12, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x12, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0c, 0x42, 0x0f, 0x8a, 0xb5, 0x18, 0x04, 0x3f, 0x2c, 0x33, 0x32, 0x92, 0xb5, 0x18, + 0x03, 0x31, 0x30, 0x30, 0x52, 0x10, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x12, 0x38, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, + 0x12, 0x5d, 0x0a, 0x0d, 0x62, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x38, 0x82, 0xb5, 0x18, 0x2c, 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, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x2e, 0x42, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x92, 0xb5, 0x18, 0x04, 0x32, 0x30, 0x34, + 0x38, 0x52, 0x0c, 0x62, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, + 0x3d, 0x0a, 0x11, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x11, 0x8a, 0xb5, 0x18, 0x03, + 0x3f, 0x2c, 0x3f, 0x92, 0xb5, 0x18, 0x06, 0x31, 0x30, 0x30, 0x2c, 0x35, 0x30, 0x52, 0x0f, 0x6e, + 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x2d, + 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x35, 0x36, 0x52, 0x0d, + 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x42, 0x5a, + 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x66, 0x66, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, + 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_ssz_query_testing_test_containers_proto_rawDescOnce sync.Once + file_proto_ssz_query_testing_test_containers_proto_rawDescData = file_proto_ssz_query_testing_test_containers_proto_rawDesc +) + +func file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP() []byte { + file_proto_ssz_query_testing_test_containers_proto_rawDescOnce.Do(func() { + file_proto_ssz_query_testing_test_containers_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_ssz_query_testing_test_containers_proto_rawDescData) + }) + return file_proto_ssz_query_testing_test_containers_proto_rawDescData +} + +var file_proto_ssz_query_testing_test_containers_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_proto_ssz_query_testing_test_containers_proto_goTypes = []any{ + (*FixedNestedContainer)(nil), // 0: testing.FixedNestedContainer + (*FixedTestContainer)(nil), // 1: testing.FixedTestContainer + (*VariableNestedContainer)(nil), // 2: testing.VariableNestedContainer + (*VariableTestContainer)(nil), // 3: testing.VariableTestContainer +} +var file_proto_ssz_query_testing_test_containers_proto_depIdxs = []int32{ + 0, // 0: testing.FixedTestContainer.nested:type_name -> testing.FixedNestedContainer + 0, // 1: testing.VariableTestContainer.field_list_container:type_name -> testing.FixedNestedContainer + 2, // 2: testing.VariableTestContainer.nested:type_name -> testing.VariableNestedContainer + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_proto_ssz_query_testing_test_containers_proto_init() } +func file_proto_ssz_query_testing_test_containers_proto_init() { + if File_proto_ssz_query_testing_test_containers_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_ssz_query_testing_test_containers_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_proto_ssz_query_testing_test_containers_proto_goTypes, + DependencyIndexes: file_proto_ssz_query_testing_test_containers_proto_depIdxs, + MessageInfos: file_proto_ssz_query_testing_test_containers_proto_msgTypes, + }.Build() + File_proto_ssz_query_testing_test_containers_proto = out.File + file_proto_ssz_query_testing_test_containers_proto_rawDesc = nil + file_proto_ssz_query_testing_test_containers_proto_goTypes = nil + file_proto_ssz_query_testing_test_containers_proto_depIdxs = nil +} diff --git a/proto/ssz_query/ssz_query.proto b/proto/ssz_query/testing/test_containers.proto similarity index 99% rename from proto/ssz_query/ssz_query.proto rename to proto/ssz_query/testing/test_containers.proto index 4fe88515d74d..3ddeb9eebe49 100644 --- a/proto/ssz_query/ssz_query.proto +++ b/proto/ssz_query/testing/test_containers.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package ssz_query; +package testing; import "proto/eth/ext/options.proto"; -option go_package = "github.com/OffchainLabs/prysm/v6/proto/ssz_query"; +option go_package = "github.com/OffchainLabs/prysm/v6/proto/ssz_query/testing;testing"; // ===== FIXED-SIZE TEST CONTAINERS ===== diff --git a/proto/ssz_query/ssz_query.ssz.go b/proto/ssz_query/testing/test_containers.ssz.go similarity index 99% rename from proto/ssz_query/ssz_query.ssz.go rename to proto/ssz_query/testing/test_containers.ssz.go index 677d3db7a93a..fb3697740724 100644 --- a/proto/ssz_query/ssz_query.ssz.go +++ b/proto/ssz_query/testing/test_containers.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -package ssz_query +package testing import ( ssz "github.com/prysmaticlabs/fastssz" From da219b1f7238cd06d3bedfba9589d862ac3ab489 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 16:28:13 +0900 Subject: [PATCH 02/10] Add containers for response --- proto/ssz_query/BUILD.bazel | 57 +++++ proto/ssz_query/response.pb.go | 282 ++++++++++++++++++++++ proto/ssz_query/response.proto | 27 +++ proto/ssz_query/response.ssz.go | 410 ++++++++++++++++++++++++++++++++ 4 files changed, 776 insertions(+) create mode 100644 proto/ssz_query/BUILD.bazel create mode 100755 proto/ssz_query/response.pb.go create mode 100644 proto/ssz_query/response.proto create mode 100644 proto/ssz_query/response.ssz.go diff --git a/proto/ssz_query/BUILD.bazel b/proto/ssz_query/BUILD.bazel new file mode 100644 index 000000000000..b4357eec32dd --- /dev/null +++ b/proto/ssz_query/BUILD.bazel @@ -0,0 +1,57 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal") + +# gazelle:ignore + +proto_library( + name = "proto", + srcs = ["response.proto"], + visibility = ["//visibility:public"], + deps = [ + "//proto/eth/ext:proto", + ], +) + +go_proto_library( + name = "go_proto", + compilers = [ + "@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc", + ], + importpath = "github.com/OffchainLabs/prysm/v6/proto/ssz_query", + proto = ":proto", + visibility = ["//visibility:public"], + deps = [ + "//proto/eth/ext:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", + "@org_golang_google_protobuf//runtime/protoimpl:go_default_library", + ], +) + +# SSZ generation for proto messages +ssz_gen_marshal( + name = "ssz_generated", + out = "response.ssz.go", + go_proto = ":go_proto", + objs = [ + "SSZQueryProof", + "SSZQueryResponse", + "SSZQueryResponseWithProof", + ], +) + +go_library( + name = "go_default_library", + srcs = [ + ":ssz_generated", # keep + ], + embed = [":go_proto"], + importpath = "github.com/OffchainLabs/prysm/v6/proto/ssz_query", + visibility = ["//visibility:public"], + deps = SSZ_DEPS + [ + "//proto/eth/ext:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + ], +) diff --git a/proto/ssz_query/response.pb.go b/proto/ssz_query/response.pb.go new file mode 100755 index 000000000000..f6ef39d3f05d --- /dev/null +++ b/proto/ssz_query/response.pb.go @@ -0,0 +1,282 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.3 +// protoc v3.21.7 +// source: proto/ssz_query/response.proto + +package ssz_query + +import ( + reflect "reflect" + sync "sync" + + _ "github.com/OffchainLabs/prysm/v6/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 SSZQueryProof struct { + state protoimpl.MessageState `protogen:"open.v1"` + Leaf []byte `protobuf:"bytes,1,opt,name=leaf,proto3" json:"leaf,omitempty" ssz-size:"32"` + Gindex uint64 `protobuf:"varint,2,opt,name=gindex,proto3" json:"gindex,omitempty"` + Proofs [][]byte `protobuf:"bytes,3,rep,name=proofs,proto3" json:"proofs,omitempty" ssz-max:"64,?" ssz-size:"?,32"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SSZQueryProof) Reset() { + *x = SSZQueryProof{} + mi := &file_proto_ssz_query_response_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SSZQueryProof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SSZQueryProof) ProtoMessage() {} + +func (x *SSZQueryProof) ProtoReflect() protoreflect.Message { + mi := &file_proto_ssz_query_response_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SSZQueryProof.ProtoReflect.Descriptor instead. +func (*SSZQueryProof) Descriptor() ([]byte, []int) { + return file_proto_ssz_query_response_proto_rawDescGZIP(), []int{0} +} + +func (x *SSZQueryProof) GetLeaf() []byte { + if x != nil { + return x.Leaf + } + return nil +} + +func (x *SSZQueryProof) GetGindex() uint64 { + if x != nil { + return x.Gindex + } + return 0 +} + +func (x *SSZQueryProof) GetProofs() [][]byte { + if x != nil { + return x.Proofs + } + return nil +} + +type SSZQueryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Root []byte `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty" ssz-size:"32"` + Result []byte `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty" ssz-max:"1073741824"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SSZQueryResponse) Reset() { + *x = SSZQueryResponse{} + mi := &file_proto_ssz_query_response_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SSZQueryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SSZQueryResponse) ProtoMessage() {} + +func (x *SSZQueryResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_ssz_query_response_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SSZQueryResponse.ProtoReflect.Descriptor instead. +func (*SSZQueryResponse) Descriptor() ([]byte, []int) { + return file_proto_ssz_query_response_proto_rawDescGZIP(), []int{1} +} + +func (x *SSZQueryResponse) GetRoot() []byte { + if x != nil { + return x.Root + } + return nil +} + +func (x *SSZQueryResponse) GetResult() []byte { + if x != nil { + return x.Result + } + return nil +} + +type SSZQueryResponseWithProof struct { + state protoimpl.MessageState `protogen:"open.v1"` + Root []byte `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty" ssz-size:"32"` + Result []byte `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty" ssz-max:"1073741824"` + Proof *SSZQueryProof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SSZQueryResponseWithProof) Reset() { + *x = SSZQueryResponseWithProof{} + mi := &file_proto_ssz_query_response_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SSZQueryResponseWithProof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SSZQueryResponseWithProof) ProtoMessage() {} + +func (x *SSZQueryResponseWithProof) ProtoReflect() protoreflect.Message { + mi := &file_proto_ssz_query_response_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SSZQueryResponseWithProof.ProtoReflect.Descriptor instead. +func (*SSZQueryResponseWithProof) Descriptor() ([]byte, []int) { + return file_proto_ssz_query_response_proto_rawDescGZIP(), []int{2} +} + +func (x *SSZQueryResponseWithProof) GetRoot() []byte { + if x != nil { + return x.Root + } + return nil +} + +func (x *SSZQueryResponseWithProof) GetResult() []byte { + if x != nil { + return x.Result + } + return nil +} + +func (x *SSZQueryResponseWithProof) GetProof() *SSZQueryProof { + if x != nil { + return x.Proof + } + return nil +} + +var File_proto_ssz_query_response_proto protoreflect.FileDescriptor + +var file_proto_ssz_query_response_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x07, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 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, 0x6d, 0x0a, 0x0d, 0x53, 0x53, 0x5a, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x1a, 0x0a, 0x04, 0x6c, 0x65, 0x61, 0x66, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x04, 0x6c, + 0x65, 0x61, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x06, 0x67, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x28, 0x0a, 0x06, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x10, 0x8a, 0xb5, 0x18, + 0x04, 0x3f, 0x2c, 0x33, 0x32, 0x92, 0xb5, 0x18, 0x04, 0x36, 0x34, 0x2c, 0x3f, 0x52, 0x06, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x22, 0x56, 0x0a, 0x10, 0x53, 0x53, 0x5a, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x04, 0x72, 0x6f, 0x6f, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, + 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0e, 0x92, 0xb5, 0x18, 0x0a, 0x31, 0x30, 0x37, 0x33, 0x37, + 0x34, 0x31, 0x38, 0x32, 0x34, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x8d, 0x01, + 0x0a, 0x19, 0x53, 0x53, 0x5a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x1a, 0x0a, 0x04, 0x72, + 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, + 0x32, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0e, 0x92, 0xb5, 0x18, 0x0a, 0x31, 0x30, 0x37, + 0x33, 0x37, 0x34, 0x31, 0x38, 0x32, 0x34, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x2c, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x53, 0x5a, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x32, 0x5a, + 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x66, 0x66, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, + 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_ssz_query_response_proto_rawDescOnce sync.Once + file_proto_ssz_query_response_proto_rawDescData = file_proto_ssz_query_response_proto_rawDesc +) + +func file_proto_ssz_query_response_proto_rawDescGZIP() []byte { + file_proto_ssz_query_response_proto_rawDescOnce.Do(func() { + file_proto_ssz_query_response_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_ssz_query_response_proto_rawDescData) + }) + return file_proto_ssz_query_response_proto_rawDescData +} + +var file_proto_ssz_query_response_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_proto_ssz_query_response_proto_goTypes = []any{ + (*SSZQueryProof)(nil), // 0: testing.SSZQueryProof + (*SSZQueryResponse)(nil), // 1: testing.SSZQueryResponse + (*SSZQueryResponseWithProof)(nil), // 2: testing.SSZQueryResponseWithProof +} +var file_proto_ssz_query_response_proto_depIdxs = []int32{ + 0, // 0: testing.SSZQueryResponseWithProof.proof:type_name -> testing.SSZQueryProof + 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_ssz_query_response_proto_init() } +func file_proto_ssz_query_response_proto_init() { + if File_proto_ssz_query_response_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_ssz_query_response_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_proto_ssz_query_response_proto_goTypes, + DependencyIndexes: file_proto_ssz_query_response_proto_depIdxs, + MessageInfos: file_proto_ssz_query_response_proto_msgTypes, + }.Build() + File_proto_ssz_query_response_proto = out.File + file_proto_ssz_query_response_proto_rawDesc = nil + file_proto_ssz_query_response_proto_goTypes = nil + file_proto_ssz_query_response_proto_depIdxs = nil +} diff --git a/proto/ssz_query/response.proto b/proto/ssz_query/response.proto new file mode 100644 index 000000000000..299204af2985 --- /dev/null +++ b/proto/ssz_query/response.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +package testing; + +import "proto/eth/ext/options.proto"; + +option go_package = "github.com/OffchainLabs/prysm/v6/proto/ssz_query"; + +message SSZQueryProof { + bytes leaf = 1 [ (ethereum.eth.ext.ssz_size) = "32" ]; + uint64 gindex = 2; + repeated bytes proofs = 3 [ + (ethereum.eth.ext.ssz_size) = "?,32", + (ethereum.eth.ext.ssz_max) = "64,?" + ]; +} + +message SSZQueryResponse { + bytes root = 1 [ (ethereum.eth.ext.ssz_size) = "32" ]; + bytes result = 2 [ (ethereum.eth.ext.ssz_max) = "1073741824" ]; +} + +message SSZQueryResponseWithProof { + bytes root = 1 [ (ethereum.eth.ext.ssz_size) = "32" ]; + bytes result = 2 [ (ethereum.eth.ext.ssz_max) = "1073741824" ]; + SSZQueryProof proof = 3; +} diff --git a/proto/ssz_query/response.ssz.go b/proto/ssz_query/response.ssz.go new file mode 100644 index 000000000000..d7d082318f22 --- /dev/null +++ b/proto/ssz_query/response.ssz.go @@ -0,0 +1,410 @@ +// Code generated by fastssz. DO NOT EDIT. +package ssz_query + +import ( + ssz "github.com/prysmaticlabs/fastssz" +) + +// MarshalSSZ ssz marshals the SSZQueryProof object +func (s *SSZQueryProof) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SSZQueryProof object to a target array +func (s *SSZQueryProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(44) + + // Field (0) 'Leaf' + if size := len(s.Leaf); size != 32 { + err = ssz.ErrBytesLengthFn("--.Leaf", size, 32) + return + } + dst = append(dst, s.Leaf...) + + // Field (1) 'Gindex' + dst = ssz.MarshalUint64(dst, s.Gindex) + + // Offset (2) 'Proofs' + dst = ssz.WriteOffset(dst, offset) + offset += len(s.Proofs) * 32 + + // Field (2) 'Proofs' + if size := len(s.Proofs); size > 64 { + err = ssz.ErrListTooBigFn("--.Proofs", size, 64) + return + } + for ii := 0; ii < len(s.Proofs); ii++ { + if size := len(s.Proofs[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.Proofs[ii]", size, 32) + return + } + dst = append(dst, s.Proofs[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the SSZQueryProof object +func (s *SSZQueryProof) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 44 { + return ssz.ErrSize + } + + tail := buf + var o2 uint64 + + // Field (0) 'Leaf' + if cap(s.Leaf) == 0 { + s.Leaf = make([]byte, 0, len(buf[0:32])) + } + s.Leaf = append(s.Leaf, buf[0:32]...) + + // Field (1) 'Gindex' + s.Gindex = ssz.UnmarshallUint64(buf[32:40]) + + // Offset (2) 'Proofs' + if o2 = ssz.ReadOffset(buf[40:44]); o2 > size { + return ssz.ErrOffset + } + + if o2 != 44 { + return ssz.ErrInvalidVariableOffset + } + + // Field (2) 'Proofs' + { + buf = tail[o2:] + num, err := ssz.DivideInt2(len(buf), 32, 64) + if err != nil { + return err + } + s.Proofs = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(s.Proofs[ii]) == 0 { + s.Proofs[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) + } + s.Proofs[ii] = append(s.Proofs[ii], buf[ii*32:(ii+1)*32]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SSZQueryProof object +func (s *SSZQueryProof) SizeSSZ() (size int) { + size = 44 + + // Field (2) 'Proofs' + size += len(s.Proofs) * 32 + + return +} + +// HashTreeRoot ssz hashes the SSZQueryProof object +func (s *SSZQueryProof) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SSZQueryProof object with a hasher +func (s *SSZQueryProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Leaf' + if size := len(s.Leaf); size != 32 { + err = ssz.ErrBytesLengthFn("--.Leaf", size, 32) + return + } + hh.PutBytes(s.Leaf) + + // Field (1) 'Gindex' + hh.PutUint64(s.Gindex) + + // Field (2) 'Proofs' + { + if size := len(s.Proofs); size > 64 { + err = ssz.ErrListTooBigFn("--.Proofs", size, 64) + return + } + subIndx := hh.Index() + for _, i := range s.Proofs { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + + numItems := uint64(len(s.Proofs)) + hh.MerkleizeWithMixin(subIndx, numItems, 64) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SSZQueryResponse object +func (s *SSZQueryResponse) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SSZQueryResponse object to a target array +func (s *SSZQueryResponse) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(36) + + // Field (0) 'Root' + if size := len(s.Root); size != 32 { + err = ssz.ErrBytesLengthFn("--.Root", size, 32) + return + } + dst = append(dst, s.Root...) + + // Offset (1) 'Result' + dst = ssz.WriteOffset(dst, offset) + offset += len(s.Result) + + // Field (1) 'Result' + if size := len(s.Result); size > 1073741824 { + err = ssz.ErrBytesLengthFn("--.Result", size, 1073741824) + return + } + dst = append(dst, s.Result...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SSZQueryResponse object +func (s *SSZQueryResponse) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 36 { + return ssz.ErrSize + } + + tail := buf + var o1 uint64 + + // Field (0) 'Root' + if cap(s.Root) == 0 { + s.Root = make([]byte, 0, len(buf[0:32])) + } + s.Root = append(s.Root, buf[0:32]...) + + // Offset (1) 'Result' + if o1 = ssz.ReadOffset(buf[32:36]); o1 > size { + return ssz.ErrOffset + } + + if o1 != 36 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'Result' + { + buf = tail[o1:] + if len(buf) > 1073741824 { + return ssz.ErrBytesLength + } + if cap(s.Result) == 0 { + s.Result = make([]byte, 0, len(buf)) + } + s.Result = append(s.Result, buf...) + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SSZQueryResponse object +func (s *SSZQueryResponse) SizeSSZ() (size int) { + size = 36 + + // Field (1) 'Result' + size += len(s.Result) + + return +} + +// HashTreeRoot ssz hashes the SSZQueryResponse object +func (s *SSZQueryResponse) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SSZQueryResponse object with a hasher +func (s *SSZQueryResponse) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Root' + if size := len(s.Root); size != 32 { + err = ssz.ErrBytesLengthFn("--.Root", size, 32) + return + } + hh.PutBytes(s.Root) + + // Field (1) 'Result' + { + elemIndx := hh.Index() + byteLen := uint64(len(s.Result)) + if byteLen > 1073741824 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(s.Result) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SSZQueryResponseWithProof object +func (s *SSZQueryResponseWithProof) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SSZQueryResponseWithProof object to a target array +func (s *SSZQueryResponseWithProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(40) + + // Field (0) 'Root' + if size := len(s.Root); size != 32 { + err = ssz.ErrBytesLengthFn("--.Root", size, 32) + return + } + dst = append(dst, s.Root...) + + // Offset (1) 'Result' + dst = ssz.WriteOffset(dst, offset) + offset += len(s.Result) + + // Offset (2) 'Proof' + dst = ssz.WriteOffset(dst, offset) + if s.Proof == nil { + s.Proof = new(SSZQueryProof) + } + offset += s.Proof.SizeSSZ() + + // Field (1) 'Result' + if size := len(s.Result); size > 1073741824 { + err = ssz.ErrBytesLengthFn("--.Result", size, 1073741824) + return + } + dst = append(dst, s.Result...) + + // Field (2) 'Proof' + if dst, err = s.Proof.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the SSZQueryResponseWithProof object +func (s *SSZQueryResponseWithProof) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 40 { + return ssz.ErrSize + } + + tail := buf + var o1, o2 uint64 + + // Field (0) 'Root' + if cap(s.Root) == 0 { + s.Root = make([]byte, 0, len(buf[0:32])) + } + s.Root = append(s.Root, buf[0:32]...) + + // Offset (1) 'Result' + if o1 = ssz.ReadOffset(buf[32:36]); o1 > size { + return ssz.ErrOffset + } + + if o1 != 40 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (2) 'Proof' + if o2 = ssz.ReadOffset(buf[36:40]); o2 > size || o1 > o2 { + return ssz.ErrOffset + } + + // Field (1) 'Result' + { + buf = tail[o1:o2] + if len(buf) > 1073741824 { + return ssz.ErrBytesLength + } + if cap(s.Result) == 0 { + s.Result = make([]byte, 0, len(buf)) + } + s.Result = append(s.Result, buf...) + } + + // Field (2) 'Proof' + { + buf = tail[o2:] + if s.Proof == nil { + s.Proof = new(SSZQueryProof) + } + if err = s.Proof.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SSZQueryResponseWithProof object +func (s *SSZQueryResponseWithProof) SizeSSZ() (size int) { + size = 40 + + // Field (1) 'Result' + size += len(s.Result) + + // Field (2) 'Proof' + if s.Proof == nil { + s.Proof = new(SSZQueryProof) + } + size += s.Proof.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SSZQueryResponseWithProof object +func (s *SSZQueryResponseWithProof) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SSZQueryResponseWithProof object with a hasher +func (s *SSZQueryResponseWithProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Root' + if size := len(s.Root); size != 32 { + err = ssz.ErrBytesLengthFn("--.Root", size, 32) + return + } + hh.PutBytes(s.Root) + + // Field (1) 'Result' + { + elemIndx := hh.Index() + byteLen := uint64(len(s.Result)) + if byteLen > 1073741824 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(s.Result) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) + } + + // Field (2) 'Proof' + if err = s.Proof.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} From 554f29c41e0d0dc1183aae2f7b2df25d04aeee03 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 16:53:20 +0900 Subject: [PATCH 03/10] Export sszInfo --- encoding/ssz/query/analyzer.go | 32 ++++++++++---------- encoding/ssz/query/container.go | 4 +-- encoding/ssz/query/list.go | 4 +-- encoding/ssz/query/query.go | 4 +-- encoding/ssz/query/ssz_info.go | 50 ++++++++++++++++---------------- encoding/ssz/query/ssz_object.go | 6 ++-- encoding/ssz/query/vector.go | 4 +-- 7 files changed, 52 insertions(+), 52 deletions(-) diff --git a/encoding/ssz/query/analyzer.go b/encoding/ssz/query/analyzer.go index 52ba85ad6d3e..ef77c731b576 100644 --- a/encoding/ssz/query/analyzer.go +++ b/encoding/ssz/query/analyzer.go @@ -10,7 +10,7 @@ import ( const offsetBytes = 4 // AnalyzeObject analyzes given object and returns its SSZ information. -func AnalyzeObject(obj SSZObject) (*sszInfo, error) { +func AnalyzeObject(obj SSZObject) (*SszInfo, error) { value := dereferencePointer(obj) info, err := analyzeType(value.Type(), nil) @@ -31,9 +31,9 @@ func AnalyzeObject(obj SSZObject) (*sszInfo, error) { } // PopulateVariableLengthInfo populates runtime information for SSZ fields of variable-sized types. -// This function updates the sszInfo structure with actual lengths and offsets that can only +// This function updates the SszInfo structure with actual lengths and offsets that can only // be determined at runtime for variable-sized items like Lists and variable-sized Container fields. -func PopulateVariableLengthInfo(sszInfo *sszInfo, value any) error { +func PopulateVariableLengthInfo(sszInfo *SszInfo, value any) error { if sszInfo == nil { return errors.New("sszInfo is nil") } @@ -118,7 +118,7 @@ func PopulateVariableLengthInfo(sszInfo *sszInfo, value any) error { fieldInfo := containerInfo.fields[fieldName] childSszInfo := fieldInfo.sszInfo if childSszInfo == nil { - return fmt.Errorf("sszInfo is nil for field %s", fieldName) + return fmt.Errorf("SszInfo is nil for field %s", fieldName) } // Skip fixed-size fields. @@ -150,7 +150,7 @@ func PopulateVariableLengthInfo(sszInfo *sszInfo, value any) error { } // analyzeType is an entry point that inspects a reflect.Type and computes its SSZ layout information. -func analyzeType(typ reflect.Type, tag *reflect.StructTag) (*sszInfo, error) { +func analyzeType(typ reflect.Type, tag *reflect.StructTag) (*SszInfo, error) { switch typ.Kind() { // Basic types (e.g., uintN where N is 8, 16, 32, 64) // NOTE: uint128 and uint256 are represented as []byte in Go, @@ -174,8 +174,8 @@ func analyzeType(typ reflect.Type, tag *reflect.StructTag) (*sszInfo, error) { } // analyzeBasicType analyzes SSZ basic types (uintN, bool) and returns its info. -func analyzeBasicType(typ reflect.Type) (*sszInfo, error) { - sszInfo := &sszInfo{ +func analyzeBasicType(typ reflect.Type) (*SszInfo, error) { + sszInfo := &SszInfo{ typ: typ, // Every basic type is fixed-size and not variable. @@ -206,7 +206,7 @@ func analyzeBasicType(typ reflect.Type) (*sszInfo, error) { } // analyzeHomogeneousColType analyzes homogeneous collection types (e.g., List, Vector, Bitlist, Bitvector) and returns its SSZ info. -func analyzeHomogeneousColType(typ reflect.Type, tag *reflect.StructTag) (*sszInfo, error) { +func analyzeHomogeneousColType(typ reflect.Type, tag *reflect.StructTag) (*SszInfo, error) { if typ.Kind() != reflect.Slice { return nil, fmt.Errorf("can only analyze slice types, got %v", typ.Kind()) } @@ -252,9 +252,9 @@ func analyzeHomogeneousColType(typ reflect.Type, tag *reflect.StructTag) (*sszIn } // analyzeListType analyzes SSZ List/Bitlist type and returns its SSZ info. -func analyzeListType(typ reflect.Type, elementInfo *sszInfo, limit uint64, isBitfield bool) (*sszInfo, error) { +func analyzeListType(typ reflect.Type, elementInfo *SszInfo, limit uint64, isBitfield bool) (*SszInfo, error) { if isBitfield { - return &sszInfo{ + return &SszInfo{ sszType: Bitlist, typ: typ, @@ -271,7 +271,7 @@ func analyzeListType(typ reflect.Type, elementInfo *sszInfo, limit uint64, isBit return nil, errors.New("element info is required for List") } - return &sszInfo{ + return &SszInfo{ sszType: List, typ: typ, @@ -286,9 +286,9 @@ func analyzeListType(typ reflect.Type, elementInfo *sszInfo, limit uint64, isBit } // analyzeVectorType analyzes SSZ Vector/Bitvector type and returns its SSZ info. -func analyzeVectorType(typ reflect.Type, elementInfo *sszInfo, length uint64, isBitfield bool) (*sszInfo, error) { +func analyzeVectorType(typ reflect.Type, elementInfo *SszInfo, length uint64, isBitfield bool) (*SszInfo, error) { if isBitfield { - return &sszInfo{ + return &SszInfo{ sszType: Bitvector, typ: typ, @@ -312,7 +312,7 @@ func analyzeVectorType(typ reflect.Type, elementInfo *sszInfo, length uint64, is return nil, fmt.Errorf("vector length must be greater than 0, got %d", length) } - return &sszInfo{ + return &SszInfo{ sszType: Vector, typ: typ, @@ -327,7 +327,7 @@ func analyzeVectorType(typ reflect.Type, elementInfo *sszInfo, length uint64, is } // analyzeContainerType analyzes SSZ Container type and returns its SSZ info. -func analyzeContainerType(typ reflect.Type) (*sszInfo, error) { +func analyzeContainerType(typ reflect.Type) (*SszInfo, error) { if typ.Kind() != reflect.Struct { return nil, fmt.Errorf("can only analyze struct types, got %v", typ.Kind()) } @@ -335,7 +335,7 @@ func analyzeContainerType(typ reflect.Type) (*sszInfo, error) { fields := make(map[string]*fieldInfo) order := make([]string, 0, typ.NumField()) - sszInfo := &sszInfo{ + sszInfo := &SszInfo{ sszType: Container, typ: typ, } diff --git a/encoding/ssz/query/container.go b/encoding/ssz/query/container.go index 374bd7c4fb4e..ab42addf7084 100644 --- a/encoding/ssz/query/container.go +++ b/encoding/ssz/query/container.go @@ -1,7 +1,7 @@ package query // containerInfo has -// 1. fields: a field map that maps a field's JSON name to its sszInfo for nested Containers +// 1. fields: a field map that maps a field's JSON name to its SszInfo for nested Containers // 2. order: a list of field names in the order they should be serialized type containerInfo struct { fields map[string]*fieldInfo @@ -10,7 +10,7 @@ type containerInfo struct { type fieldInfo struct { // sszInfo contains the SSZ information of the field. - sszInfo *sszInfo + sszInfo *SszInfo // offset is the offset of the field within the parent struct. offset uint64 // goFieldName is the name of the field in Go struct. diff --git a/encoding/ssz/query/list.go b/encoding/ssz/query/list.go index 5b797a422f29..7e47bcc415dd 100644 --- a/encoding/ssz/query/list.go +++ b/encoding/ssz/query/list.go @@ -13,7 +13,7 @@ type listInfo struct { // limit is the maximum number of elements in the list. limit uint64 // element is the SSZ info of the list's element type. - element *sszInfo + element *SszInfo // length is the actual number of elements at runtime (0 if not set). length uint64 // elementSizes caches each element's byte size for variable-sized type elements @@ -27,7 +27,7 @@ func (l *listInfo) Limit() uint64 { return l.limit } -func (l *listInfo) Element() (*sszInfo, error) { +func (l *listInfo) Element() (*SszInfo, error) { if l == nil { return nil, errors.New("listInfo is nil") } diff --git a/encoding/ssz/query/query.go b/encoding/ssz/query/query.go index c19ec94b20f7..60669fd7a1a4 100644 --- a/encoding/ssz/query/query.go +++ b/encoding/ssz/query/query.go @@ -6,8 +6,8 @@ import ( ) // CalculateOffsetAndLength calculates the offset and length of a given path within the SSZ object. -// By walking the given path, it accumulates the offsets based on sszInfo. -func CalculateOffsetAndLength(sszInfo *sszInfo, path []PathElement) (*sszInfo, uint64, uint64, error) { +// By walking the given path, it accumulates the offsets based on SszInfo. +func CalculateOffsetAndLength(sszInfo *SszInfo, path []PathElement) (*SszInfo, uint64, uint64, error) { if sszInfo == nil { return nil, 0, 0, errors.New("sszInfo is nil") } diff --git a/encoding/ssz/query/ssz_info.go b/encoding/ssz/query/ssz_info.go index 0ba3369196bb..6891ef10bad5 100644 --- a/encoding/ssz/query/ssz_info.go +++ b/encoding/ssz/query/ssz_info.go @@ -7,8 +7,8 @@ import ( "strings" ) -// sszInfo holds the all necessary data for analyzing SSZ data types. -type sszInfo struct { +// SszInfo holds the all necessary data for analyzing SSZ data types. +type SszInfo struct { // Type of the SSZ structure (Basic, Container, List, etc.). sszType SSZType // Type in Go. Need this for unmarshaling. @@ -37,14 +37,14 @@ type sszInfo struct { bitvectorInfo *bitvectorInfo } -func (info *sszInfo) FixedSize() uint64 { +func (info *SszInfo) FixedSize() uint64 { if info == nil { return 0 } return info.fixedSize } -func (info *sszInfo) Size() uint64 { +func (info *SszInfo) Size() uint64 { if info == nil { return 0 } @@ -82,73 +82,73 @@ func (info *sszInfo) Size() uint64 { } } -func (info *sszInfo) ContainerInfo() (*containerInfo, error) { +func (info *SszInfo) ContainerInfo() (*containerInfo, error) { if info == nil { - return nil, errors.New("sszInfo is nil") + return nil, errors.New("SszInfo is nil") } if info.sszType != Container { - return nil, fmt.Errorf("sszInfo is not a Container type, got %s", info.sszType) + return nil, fmt.Errorf("SszInfo is not a Container type, got %s", info.sszType) } if info.containerInfo == nil { - return nil, errors.New("sszInfo.containerInfo is nil") + return nil, errors.New("SszInfo.containerInfo is nil") } return info.containerInfo, nil } -func (info *sszInfo) ListInfo() (*listInfo, error) { +func (info *SszInfo) ListInfo() (*listInfo, error) { if info == nil { - return nil, errors.New("sszInfo is nil") + return nil, errors.New("SszInfo is nil") } if info.sszType != List { - return nil, fmt.Errorf("sszInfo is not a List type, got %s", info.sszType) + return nil, fmt.Errorf("SszInfo is not a List type, got %s", info.sszType) } return info.listInfo, nil } -func (info *sszInfo) VectorInfo() (*vectorInfo, error) { +func (info *SszInfo) VectorInfo() (*vectorInfo, error) { if info == nil { - return nil, errors.New("sszInfo is nil") + return nil, errors.New("SszInfo is nil") } if info.sszType != Vector { - return nil, fmt.Errorf("sszInfo is not a Vector type, got %s", info.sszType) + return nil, fmt.Errorf("SszInfo is not a Vector type, got %s", info.sszType) } return info.vectorInfo, nil } -func (info *sszInfo) BitlistInfo() (*bitlistInfo, error) { +func (info *SszInfo) BitlistInfo() (*bitlistInfo, error) { if info == nil { - return nil, errors.New("sszInfo is nil") + return nil, errors.New("SszInfo is nil") } if info.sszType != Bitlist { - return nil, fmt.Errorf("sszInfo is not a Bitlist type, got %s", info.sszType) + return nil, fmt.Errorf("SszInfo is not a Bitlist type, got %s", info.sszType) } return info.bitlistInfo, nil } -func (info *sszInfo) BitvectorInfo() (*bitvectorInfo, error) { +func (info *SszInfo) BitvectorInfo() (*bitvectorInfo, error) { if info == nil { - return nil, errors.New("sszInfo is nil") + return nil, errors.New("SszInfo is nil") } if info.sszType != Bitvector { - return nil, fmt.Errorf("sszInfo is not a Bitvector type, got %s", info.sszType) + return nil, fmt.Errorf("SszInfo is not a Bitvector type, got %s", info.sszType) } return info.bitvectorInfo, nil } -// String implements the Stringer interface for sszInfo. +// String implements the Stringer interface for SszInfo. // This follows the notation used in the consensus specs. -func (info *sszInfo) String() string { +func (info *SszInfo) String() string { if info == nil { return "" } @@ -173,8 +173,8 @@ func (info *sszInfo) String() string { } } -// Print returns a string representation of the sszInfo, which is useful for debugging. -func (info *sszInfo) Print() string { +// Print returns a string representation of the SszInfo, which is useful for debugging. +func (info *SszInfo) Print() string { if info == nil { return "" } @@ -183,7 +183,7 @@ func (info *sszInfo) Print() string { return builder.String() } -func printRecursive(info *sszInfo, builder *strings.Builder, prefix string) { +func printRecursive(info *SszInfo, builder *strings.Builder, prefix string) { var sizeDesc string if info.isVariable { sizeDesc = "Variable-size" diff --git a/encoding/ssz/query/ssz_object.go b/encoding/ssz/query/ssz_object.go index a56b15983dd8..9a546eec935a 100644 --- a/encoding/ssz/query/ssz_object.go +++ b/encoding/ssz/query/ssz_object.go @@ -8,13 +8,13 @@ type SSZObject interface { // HashTreeRoot calls the HashTreeRoot method on the stored interface if it implements SSZObject. // Returns the 32-byte hash tree root or an error if the interface doesn't support hashing. -func (info *sszInfo) HashTreeRoot() ([32]byte, error) { +func (info *SszInfo) HashTreeRoot() ([32]byte, error) { if info == nil { - return [32]byte{}, errors.New("sszInfo is nil") + return [32]byte{}, errors.New("SszInfo is nil") } if info.source == nil { - return [32]byte{}, errors.New("sszInfo.source is nil") + return [32]byte{}, errors.New("SszInfo.source is nil") } // Check if the value implements the Hashable interface diff --git a/encoding/ssz/query/vector.go b/encoding/ssz/query/vector.go index c0c0f70d38dd..439588365387 100644 --- a/encoding/ssz/query/vector.go +++ b/encoding/ssz/query/vector.go @@ -5,7 +5,7 @@ import "errors" // vectorInfo holds information about a SSZ Vector type. type vectorInfo struct { // element is the SSZ info of the vector's element type. - element *sszInfo + element *SszInfo // length is the fixed length of the vector. length uint64 } @@ -18,7 +18,7 @@ func (v *vectorInfo) Length() uint64 { return v.length } -func (v *vectorInfo) Element() (*sszInfo, error) { +func (v *vectorInfo) Element() (*SszInfo, error) { if v == nil { return nil, errors.New("vectorInfo is nil") } From 19230d9f41de36685f511b5632462a19a9a2ea77 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 16:54:00 +0900 Subject: [PATCH 04/10] Add QueryBeaconState/Block --- api/server/structs/endpoints_beacon.go | 5 + beacon-chain/rpc/endpoints.go | 24 ++- beacon-chain/rpc/endpoints_test.go | 2 + beacon-chain/rpc/prysm/beacon/BUILD.bazel | 6 + beacon-chain/rpc/prysm/beacon/server.go | 1 + beacon-chain/rpc/prysm/beacon/ssz_query.go | 194 ++++++++++++++++++ .../rpc/prysm/beacon/ssz_query_test.go | 7 + 7 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 beacon-chain/rpc/prysm/beacon/ssz_query.go create mode 100644 beacon-chain/rpc/prysm/beacon/ssz_query_test.go diff --git a/api/server/structs/endpoints_beacon.go b/api/server/structs/endpoints_beacon.go index f9c0a2a3809b..b751dbef7d68 100644 --- a/api/server/structs/endpoints_beacon.go +++ b/api/server/structs/endpoints_beacon.go @@ -296,3 +296,8 @@ type GetBlobsResponse struct { Finalized bool `json:"finalized"` Data []string `json:"data"` //blobs } + +type QuerySSZRequest struct { + Query string `json:"query"` + IncludeProof bool `json:"include_proof,omitempty"` +} diff --git a/beacon-chain/rpc/endpoints.go b/beacon-chain/rpc/endpoints.go index 3092955b547a..fb072589db42 100644 --- a/beacon-chain/rpc/endpoints.go +++ b/beacon-chain/rpc/endpoints.go @@ -97,7 +97,7 @@ func (s *Service) endpoints( endpoints = append(endpoints, s.beaconEndpoints(ch, stater, blocker, validatorServer, coreService)...) endpoints = append(endpoints, s.configEndpoints()...) endpoints = append(endpoints, s.eventsEndpoints()...) - endpoints = append(endpoints, s.prysmBeaconEndpoints(ch, stater, coreService)...) + endpoints = append(endpoints, s.prysmBeaconEndpoints(ch, stater, blocker, coreService)...) endpoints = append(endpoints, s.prysmNodeEndpoints()...) endpoints = append(endpoints, s.prysmValidatorEndpoints(stater, coreService)...) @@ -1184,6 +1184,7 @@ func (s *Service) eventsEndpoints() []endpoint { func (s *Service) prysmBeaconEndpoints( ch *stategen.CanonicalHistory, stater lookup.Stater, + blocker lookup.Blocker, coreService *core.Service, ) []endpoint { server := &beaconprysm.Server{ @@ -1194,6 +1195,7 @@ func (s *Service) prysmBeaconEndpoints( CanonicalHistory: ch, BeaconDB: s.cfg.BeaconDB, Stater: stater, + Blocker: blocker, ChainInfoFetcher: s.cfg.ChainInfoFetcher, FinalizationFetcher: s.cfg.FinalizationFetcher, CoreService: coreService, @@ -1266,6 +1268,26 @@ func (s *Service) prysmBeaconEndpoints( handler: server.PublishBlobs, methods: []string{http.MethodPost}, }, + { + template: "/prysm/v1/beacon/states/{state_id}/query", + name: namespace + ".QueryBeaconState", + middleware: []middleware.Middleware{ + middleware.AcceptHeaderHandler([]string{api.JsonMediaType, api.OctetStreamMediaType}), + middleware.AcceptEncodingHeaderHandler(), + }, + handler: server.QueryBeaconState, + methods: []string{http.MethodPost}, + }, + { + template: "/prysm/v1/beacon/blocks/{block_id}/query", + name: namespace + ".QueryBeaconBlock", + middleware: []middleware.Middleware{ + middleware.AcceptHeaderHandler([]string{api.JsonMediaType, api.OctetStreamMediaType}), + middleware.AcceptEncodingHeaderHandler(), + }, + handler: server.QueryBeaconBlock, + methods: []string{http.MethodPost}, + }, } } diff --git a/beacon-chain/rpc/endpoints_test.go b/beacon-chain/rpc/endpoints_test.go index 27d62a97ee68..e2a579cdd734 100644 --- a/beacon-chain/rpc/endpoints_test.go +++ b/beacon-chain/rpc/endpoints_test.go @@ -127,6 +127,8 @@ func Test_endpoints(t *testing.T) { "/prysm/v1/beacon/states/{state_id}/validator_count": {http.MethodGet}, "/prysm/v1/beacon/chain_head": {http.MethodGet}, "/prysm/v1/beacon/blobs": {http.MethodPost}, + "/prysm/v1/beacon/states/{state_id}/query": {http.MethodPost}, + "/prysm/v1/beacon/blocks/{block_id}/query": {http.MethodPost}, } prysmNodeRoutes := map[string][]string{ diff --git a/beacon-chain/rpc/prysm/beacon/BUILD.bazel b/beacon-chain/rpc/prysm/beacon/BUILD.bazel index e4a36ab4ce25..c3f5572d9b4f 100644 --- a/beacon-chain/rpc/prysm/beacon/BUILD.bazel +++ b/beacon-chain/rpc/prysm/beacon/BUILD.bazel @@ -5,11 +5,13 @@ go_library( srcs = [ "handlers.go", "server.go", + "ssz_query.go", "validator_count.go", ], importpath = "github.com/OffchainLabs/prysm/v6/beacon-chain/rpc/prysm/beacon", visibility = ["//visibility:public"], deps = [ + "//api:go_default_library", "//api/server/structs:go_default_library", "//beacon-chain/blockchain:go_default_library", "//beacon-chain/core/helpers:go_default_library", @@ -27,10 +29,13 @@ go_library( "//consensus-types/primitives:go_default_library", "//consensus-types/validator:go_default_library", "//encoding/bytesutil:go_default_library", + "//encoding/ssz/query:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", "//proto/eth/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", + "//proto/ssz_query:go_default_library", + "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -41,6 +46,7 @@ go_test( name = "go_default_test", srcs = [ "handlers_test.go", + "ssz_query_test.go", "validator_count_test.go", ], embed = [":go_default_library"], diff --git a/beacon-chain/rpc/prysm/beacon/server.go b/beacon-chain/rpc/prysm/beacon/server.go index 8789552a54b3..efb9714b04d1 100644 --- a/beacon-chain/rpc/prysm/beacon/server.go +++ b/beacon-chain/rpc/prysm/beacon/server.go @@ -18,6 +18,7 @@ type Server struct { CanonicalHistory *stategen.CanonicalHistory BeaconDB beacondb.ReadOnlyDatabase Stater lookup.Stater + Blocker lookup.Blocker ChainInfoFetcher blockchain.ChainInfoFetcher FinalizationFetcher blockchain.FinalizationFetcher CoreService *core.Service diff --git a/beacon-chain/rpc/prysm/beacon/ssz_query.go b/beacon-chain/rpc/prysm/beacon/ssz_query.go new file mode 100644 index 000000000000..4d868c4bb603 --- /dev/null +++ b/beacon-chain/rpc/prysm/beacon/ssz_query.go @@ -0,0 +1,194 @@ +package beacon + +import ( + "encoding/json" + "errors" + "io" + "net/http" + + "github.com/OffchainLabs/prysm/v6/api" + "github.com/OffchainLabs/prysm/v6/api/server/structs" + "github.com/OffchainLabs/prysm/v6/beacon-chain/rpc/eth/shared" + "github.com/OffchainLabs/prysm/v6/beacon-chain/rpc/lookup" + "github.com/OffchainLabs/prysm/v6/encoding/ssz/query" + "github.com/OffchainLabs/prysm/v6/monitoring/tracing/trace" + "github.com/OffchainLabs/prysm/v6/network/httputil" + ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1" + sszquerypb "github.com/OffchainLabs/prysm/v6/proto/ssz_query" + "github.com/OffchainLabs/prysm/v6/runtime/version" +) + +func (s *Server) QueryBeaconState(w http.ResponseWriter, r *http.Request) { + ctx, span := trace.StartSpan(r.Context(), "beacon.QueryBeaconState") + defer span.End() + + stateID := r.PathValue("state_id") + if stateID == "" { + httputil.HandleError(w, "state_id is required in URL params", http.StatusBadRequest) + return + } + + stateRoot, err := s.Stater.StateRoot(ctx, []byte(stateID)) + if err != nil { + var rootNotFoundErr *lookup.StateRootNotFoundError + if errors.As(err, &rootNotFoundErr) { + httputil.HandleError(w, "State root not found: "+rootNotFoundErr.Error(), http.StatusNotFound) + return + } + httputil.HandleError(w, "Could not get state root: "+err.Error(), http.StatusInternalServerError) + return + } + + st, err := s.Stater.State(ctx, []byte(stateID)) + if err != nil { + shared.WriteStateFetchError(w, err) + return + } + + var req structs.QuerySSZRequest + err = json.NewDecoder(r.Body).Decode(&req) + switch { + case errors.Is(err, io.EOF): + httputil.HandleError(w, "No data submitted", http.StatusBadRequest) + return + case err != nil: + httputil.HandleError(w, "Could not decode request body: "+err.Error(), http.StatusBadRequest) + return + } + + if len(req.Query) == 0 { + httputil.HandleError(w, "Empty query submitted", http.StatusBadRequest) + return + } + + path, err := query.ParsePath(req.Query) + if err != nil { + httputil.HandleError(w, "Could not parse path '"+req.Query+"': "+err.Error(), http.StatusBadRequest) + return + } + + var sszObject query.SSZObject + switch st.Version() { + case version.Phase0: + sszObject = st.ToProto().(*ethpb.BeaconState) + case version.Altair: + sszObject = st.ToProto().(*ethpb.BeaconStateAltair) + case version.Bellatrix: + sszObject = st.ToProto().(*ethpb.BeaconStateBellatrix) + case version.Capella: + sszObject = st.ToProto().(*ethpb.BeaconStateCapella) + case version.Deneb: + sszObject = st.ToProto().(*ethpb.BeaconStateDeneb) + case version.Fulu: + sszObject = st.ToProto().(*ethpb.BeaconStateFulu) + default: + httputil.HandleError(w, "Unsupported state version for querying: "+version.String(st.Version()), http.StatusBadRequest) + return + } + + info, err := query.AnalyzeObject(sszObject) + if err != nil { + httputil.HandleError(w, "Could not analyze state object: "+err.Error(), http.StatusInternalServerError) + return + } + + encodedState, err := st.MarshalSSZ() + if err != nil { + httputil.HandleError(w, "Could not marshal state to SSZ: "+err.Error(), http.StatusInternalServerError) + return + } + + _, offset, length, err := query.CalculateOffsetAndLength(info, path) + if err != nil { + httputil.HandleError(w, "Could not calculate offset and length for path '"+req.Query+"': "+err.Error(), http.StatusBadRequest) + return + } + + response := &sszquerypb.SSZQueryResponse{ + Root: stateRoot, + Result: encodedState[offset : offset+length], + } + responseSsz, err := response.MarshalSSZ() + if err != nil { + httputil.HandleError(w, "Could not marshal response to SSZ: "+err.Error(), http.StatusInternalServerError) + return + } + + w.Header().Set(api.VersionHeader, version.String(st.Version())) + httputil.WriteSsz(w, responseSsz) +} + +func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { + ctx, span := trace.StartSpan(r.Context(), "beacon.QueryBeaconBlock") + defer span.End() + + blockId := r.PathValue("block_id") + if blockId == "" { + httputil.HandleError(w, "block_id is required in URL params", http.StatusBadRequest) + return + } + + signedBlock, err := s.Blocker.Block(ctx, []byte(blockId)) + if !shared.WriteBlockFetchError(w, signedBlock, err) { + return + } + blockRoot, err := signedBlock.Block().HashTreeRoot() + if err != nil { + httputil.HandleError(w, "Could not compute block root: "+err.Error(), http.StatusInternalServerError) + return + } + + var req structs.QuerySSZRequest + err = json.NewDecoder(r.Body).Decode(&req) + switch { + case errors.Is(err, io.EOF): + httputil.HandleError(w, "No data submitted", http.StatusBadRequest) + return + case err != nil: + httputil.HandleError(w, "Could not decode request body: "+err.Error(), http.StatusBadRequest) + return + } + + if len(req.Query) == 0 { + httputil.HandleError(w, "Empty query submitted", http.StatusBadRequest) + return + } + + path, err := query.ParsePath(req.Query) + if err != nil { + httputil.HandleError(w, "Could not parse path '"+req.Query+"': "+err.Error(), http.StatusBadRequest) + return + } + + block := signedBlock.Block() + info, err := query.AnalyzeObject(block) + if err != nil { + httputil.HandleError(w, "Could not analyze block object: "+err.Error(), http.StatusInternalServerError) + return + } + + encodedState, err := block.MarshalSSZ() + if err != nil { + httputil.HandleError(w, "Could not marshal block to SSZ: "+err.Error(), http.StatusInternalServerError) + return + } + + _, offset, length, err := query.CalculateOffsetAndLength(info, path) + if err != nil { + httputil.HandleError(w, "Could not calculate offset and length for path '"+req.Query+"': "+err.Error(), http.StatusBadRequest) + return + } + + response := &sszquerypb.SSZQueryResponse{ + Root: blockRoot[:], + Result: encodedState[offset : offset+length], + } + responseSsz, err := response.MarshalSSZ() + if err != nil { + httputil.HandleError(w, "Could not marshal response to SSZ: "+err.Error(), http.StatusInternalServerError) + return + } + + w.Header().Set(api.VersionHeader, version.String(signedBlock.Version())) + httputil.WriteSsz(w, responseSsz) +} diff --git a/beacon-chain/rpc/prysm/beacon/ssz_query_test.go b/beacon-chain/rpc/prysm/beacon/ssz_query_test.go new file mode 100644 index 000000000000..113d5cac91e3 --- /dev/null +++ b/beacon-chain/rpc/prysm/beacon/ssz_query_test.go @@ -0,0 +1,7 @@ +package beacon + +import "testing" + +func TestServer_QueryBeaconState(t *testing.T) {} + +func TestServer_QueryBeaconBlock(t *testing.T) {} From 086d3490d25e9e8b42c4e6ffc0c89b4d473f1345 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 17:09:27 +0900 Subject: [PATCH 05/10] Add comments and few refactor --- beacon-chain/rpc/prysm/beacon/ssz_query.go | 80 ++++++++++++---------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/beacon-chain/rpc/prysm/beacon/ssz_query.go b/beacon-chain/rpc/prysm/beacon/ssz_query.go index 4d868c4bb603..dfd1d2df606a 100644 --- a/beacon-chain/rpc/prysm/beacon/ssz_query.go +++ b/beacon-chain/rpc/prysm/beacon/ssz_query.go @@ -18,6 +18,8 @@ import ( "github.com/OffchainLabs/prysm/v6/runtime/version" ) +// QueryBeaconState handles SSZ Query request for BeaconState. +// Returns as bytes serialized SSZQueryResponse. func (s *Server) QueryBeaconState(w http.ResponseWriter, r *http.Request) { ctx, span := trace.StartSpan(r.Context(), "beacon.QueryBeaconState") defer span.End() @@ -28,25 +30,9 @@ func (s *Server) QueryBeaconState(w http.ResponseWriter, r *http.Request) { return } - stateRoot, err := s.Stater.StateRoot(ctx, []byte(stateID)) - if err != nil { - var rootNotFoundErr *lookup.StateRootNotFoundError - if errors.As(err, &rootNotFoundErr) { - httputil.HandleError(w, "State root not found: "+rootNotFoundErr.Error(), http.StatusNotFound) - return - } - httputil.HandleError(w, "Could not get state root: "+err.Error(), http.StatusInternalServerError) - return - } - - st, err := s.Stater.State(ctx, []byte(stateID)) - if err != nil { - shared.WriteStateFetchError(w, err) - return - } - + // Validate path before lookup: it might be expensive. var req structs.QuerySSZRequest - err = json.NewDecoder(r.Body).Decode(&req) + err := json.NewDecoder(r.Body).Decode(&req) switch { case errors.Is(err, io.EOF): httputil.HandleError(w, "No data submitted", http.StatusBadRequest) @@ -67,6 +53,23 @@ func (s *Server) QueryBeaconState(w http.ResponseWriter, r *http.Request) { return } + stateRoot, err := s.Stater.StateRoot(ctx, []byte(stateID)) + if err != nil { + var rootNotFoundErr *lookup.StateRootNotFoundError + if errors.As(err, &rootNotFoundErr) { + httputil.HandleError(w, "State root not found: "+rootNotFoundErr.Error(), http.StatusNotFound) + return + } + httputil.HandleError(w, "Could not get state root: "+err.Error(), http.StatusInternalServerError) + return + } + + st, err := s.Stater.State(ctx, []byte(stateID)) + if err != nil { + shared.WriteStateFetchError(w, err) + return + } + var sszObject query.SSZObject switch st.Version() { case version.Phase0: @@ -108,6 +111,7 @@ func (s *Server) QueryBeaconState(w http.ResponseWriter, r *http.Request) { Root: stateRoot, Result: encodedState[offset : offset+length], } + responseSsz, err := response.MarshalSSZ() if err != nil { httputil.HandleError(w, "Could not marshal response to SSZ: "+err.Error(), http.StatusInternalServerError) @@ -118,28 +122,15 @@ func (s *Server) QueryBeaconState(w http.ResponseWriter, r *http.Request) { httputil.WriteSsz(w, responseSsz) } +// QueryBeaconState handles SSZ Query request for BeaconState. +// Returns as bytes serialized SSZQueryResponse. func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { ctx, span := trace.StartSpan(r.Context(), "beacon.QueryBeaconBlock") defer span.End() - blockId := r.PathValue("block_id") - if blockId == "" { - httputil.HandleError(w, "block_id is required in URL params", http.StatusBadRequest) - return - } - - signedBlock, err := s.Blocker.Block(ctx, []byte(blockId)) - if !shared.WriteBlockFetchError(w, signedBlock, err) { - return - } - blockRoot, err := signedBlock.Block().HashTreeRoot() - if err != nil { - httputil.HandleError(w, "Could not compute block root: "+err.Error(), http.StatusInternalServerError) - return - } - + // Validate path first as lookup may be expensive. var req structs.QuerySSZRequest - err = json.NewDecoder(r.Body).Decode(&req) + err := json.NewDecoder(r.Body).Decode(&req) switch { case errors.Is(err, io.EOF): httputil.HandleError(w, "No data submitted", http.StatusBadRequest) @@ -160,7 +151,25 @@ func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { return } + blockId := r.PathValue("block_id") + if blockId == "" { + httputil.HandleError(w, "block_id is required in URL params", http.StatusBadRequest) + return + } + + signedBlock, err := s.Blocker.Block(ctx, []byte(blockId)) + if !shared.WriteBlockFetchError(w, signedBlock, err) { + return + } + + blockRoot, err := signedBlock.Block().HashTreeRoot() + if err != nil { + httputil.HandleError(w, "Could not compute block root: "+err.Error(), http.StatusInternalServerError) + return + } + block := signedBlock.Block() + info, err := query.AnalyzeObject(block) if err != nil { httputil.HandleError(w, "Could not analyze block object: "+err.Error(), http.StatusInternalServerError) @@ -183,6 +192,7 @@ func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { Root: blockRoot[:], Result: encodedState[offset : offset+length], } + responseSsz, err := response.MarshalSSZ() if err != nil { httputil.HandleError(w, "Could not marshal response to SSZ: "+err.Error(), http.StatusInternalServerError) From 6ff9029e0b8ec32c0f4c5ff5b83ff52df7535b20 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 18:47:20 +0900 Subject: [PATCH 06/10] Fix merge conflict issues --- encoding/ssz/query/analyzer.go | 16 +- proto/ssz_query/testing/test_containers.pb.go | 205 +++++++++++----- proto/testing/test.pb.go | 227 +++++------------- 3 files changed, 210 insertions(+), 238 deletions(-) diff --git a/encoding/ssz/query/analyzer.go b/encoding/ssz/query/analyzer.go index 441e07bbc625..305e934ee841 100644 --- a/encoding/ssz/query/analyzer.go +++ b/encoding/ssz/query/analyzer.go @@ -158,7 +158,7 @@ func PopulateVariableLengthInfo(sszInfo *SszInfo, value reflect.Value) error { } // analyzeType is an entry point that inspects a reflect.Value and computes its SSZ layout information. -func analyzeType(value reflect.Value, tag *reflect.StructTag) (*sszInfo, error) { +func analyzeType(value reflect.Value, tag *reflect.StructTag) (*SszInfo, error) { switch value.Kind() { // Basic types (e.g., uintN where N is 8, 16, 32, 64) // NOTE: uint128 and uint256 are represented as []byte in Go, @@ -182,7 +182,7 @@ func analyzeType(value reflect.Value, tag *reflect.StructTag) (*sszInfo, error) } // analyzeBasicType analyzes SSZ basic types (uintN, bool) and returns its info. -func analyzeBasicType(value reflect.Value) (*sszInfo, error) { +func analyzeBasicType(value reflect.Value) (*SszInfo, error) { var sszType SSZType switch value.Kind() { @@ -200,7 +200,7 @@ func analyzeBasicType(value reflect.Value) (*sszInfo, error) { return nil, fmt.Errorf("unsupported basic type %v for SSZ calculation", value.Kind()) } - sszInfo := &sszInfo{ + sszInfo := &SszInfo{ sszType: sszType, typ: value.Type(), @@ -212,7 +212,7 @@ func analyzeBasicType(value reflect.Value) (*sszInfo, error) { } // analyzeHomogeneousColType analyzes homogeneous collection types (e.g., List, Vector, Bitlist, Bitvector) and returns its SSZ info. -func analyzeHomogeneousColType(value reflect.Value, tag *reflect.StructTag) (*sszInfo, error) { +func analyzeHomogeneousColType(value reflect.Value, tag *reflect.StructTag) (*SszInfo, error) { if value.Kind() != reflect.Slice { return nil, fmt.Errorf("can only analyze slice types, got %v", value.Kind()) } @@ -262,7 +262,7 @@ func analyzeHomogeneousColType(value reflect.Value, tag *reflect.StructTag) (*ss } // analyzeListType analyzes SSZ List/Bitlist type and returns its SSZ info. -func analyzeListType(value reflect.Value, elementInfo *sszInfo, limit uint64, isBitfield bool) (*sszInfo, error) { +func analyzeListType(value reflect.Value, elementInfo *SszInfo, limit uint64, isBitfield bool) (*SszInfo, error) { if isBitfield { return &SszInfo{ sszType: Bitlist, @@ -294,7 +294,7 @@ func analyzeListType(value reflect.Value, elementInfo *sszInfo, limit uint64, is } // analyzeVectorType analyzes SSZ Vector/Bitvector type and returns its SSZ info. -func analyzeVectorType(value reflect.Value, elementInfo *sszInfo, length uint64, isBitfield bool) (*sszInfo, error) { +func analyzeVectorType(value reflect.Value, elementInfo *SszInfo, length uint64, isBitfield bool) (*SszInfo, error) { if isBitfield { return &SszInfo{ sszType: Bitvector, @@ -332,7 +332,7 @@ func analyzeVectorType(value reflect.Value, elementInfo *sszInfo, length uint64, } // analyzeContainerType analyzes SSZ Container type and returns its SSZ info. -func analyzeContainerType(value reflect.Value) (*sszInfo, error) { +func analyzeContainerType(value reflect.Value) (*SszInfo, error) { if value.Kind() != reflect.Struct { return nil, fmt.Errorf("can only analyze struct types, got %v", value.Kind()) } @@ -386,7 +386,7 @@ func analyzeContainerType(value reflect.Value) (*sszInfo, error) { } } - return &sszInfo{ + return &SszInfo{ sszType: Container, typ: containerTyp, source: castToSSZObject(value), diff --git a/proto/ssz_query/testing/test_containers.pb.go b/proto/ssz_query/testing/test_containers.pb.go index 904f0c8a508d..695e68103c2b 100755 --- a/proto/ssz_query/testing/test_containers.pb.go +++ b/proto/ssz_query/testing/test_containers.pb.go @@ -251,23 +251,76 @@ func (x *VariableNestedContainer) GetNestedListField() [][]byte { return nil } +type VariableOuterContainer struct { + state protoimpl.MessageState `protogen:"open.v1"` + Inner_1 *VariableNestedContainer `protobuf:"bytes,1,opt,name=inner_1,json=inner1,proto3" json:"inner_1,omitempty"` + Inner_2 *VariableNestedContainer `protobuf:"bytes,2,opt,name=inner_2,json=inner2,proto3" json:"inner_2,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VariableOuterContainer) Reset() { + *x = VariableOuterContainer{} + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VariableOuterContainer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VariableOuterContainer) ProtoMessage() {} + +func (x *VariableOuterContainer) ProtoReflect() protoreflect.Message { + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VariableOuterContainer.ProtoReflect.Descriptor instead. +func (*VariableOuterContainer) Descriptor() ([]byte, []int) { + return file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP(), []int{3} +} + +func (x *VariableOuterContainer) GetInner_1() *VariableNestedContainer { + if x != nil { + return x.Inner_1 + } + return nil +} + +func (x *VariableOuterContainer) GetInner_2() *VariableNestedContainer { + if x != nil { + return x.Inner_2 + } + return nil +} + type VariableTestContainer struct { - state protoimpl.MessageState `protogen:"open.v1"` - LeadingField []byte `protobuf:"bytes,1,opt,name=leading_field,json=leadingField,proto3" json:"leading_field,omitempty" ssz-size:"32"` - FieldListUint64 []uint64 `protobuf:"varint,2,rep,packed,name=field_list_uint64,json=fieldListUint64,proto3" json:"field_list_uint64,omitempty" ssz-max:"2048"` - FieldListContainer []*FixedNestedContainer `protobuf:"bytes,3,rep,name=field_list_container,json=fieldListContainer,proto3" json:"field_list_container,omitempty" ssz-max:"128"` - FieldListBytes32 [][]byte `protobuf:"bytes,4,rep,name=field_list_bytes32,json=fieldListBytes32,proto3" json:"field_list_bytes32,omitempty" ssz-max:"100" ssz-size:"?,32"` - Nested *VariableNestedContainer `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"` - BitlistField github_com_prysmaticlabs_go_bitfield.Bitlist `protobuf:"bytes,6,opt,name=bitlist_field,json=bitlistField,proto3" json:"bitlist_field,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitlist" ssz-max:"2048"` - NestedListField [][]byte `protobuf:"bytes,7,rep,name=nested_list_field,json=nestedListField,proto3" json:"nested_list_field,omitempty" ssz-max:"100,50" ssz-size:"?,?"` - TrailingField []byte `protobuf:"bytes,8,opt,name=trailing_field,json=trailingField,proto3" json:"trailing_field,omitempty" ssz-size:"56"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + LeadingField []byte `protobuf:"bytes,1,opt,name=leading_field,json=leadingField,proto3" json:"leading_field,omitempty" ssz-size:"32"` + FieldListUint64 []uint64 `protobuf:"varint,2,rep,packed,name=field_list_uint64,json=fieldListUint64,proto3" json:"field_list_uint64,omitempty" ssz-max:"2048"` + FieldListContainer []*FixedNestedContainer `protobuf:"bytes,3,rep,name=field_list_container,json=fieldListContainer,proto3" json:"field_list_container,omitempty" ssz-max:"128"` + FieldListBytes32 [][]byte `protobuf:"bytes,4,rep,name=field_list_bytes32,json=fieldListBytes32,proto3" json:"field_list_bytes32,omitempty" ssz-max:"100" ssz-size:"?,32"` + Nested *VariableNestedContainer `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"` + VariableContainerList []*VariableOuterContainer `protobuf:"bytes,6,rep,name=variable_container_list,json=variableContainerList,proto3" json:"variable_container_list,omitempty" ssz-max:"10"` + BitlistField github_com_prysmaticlabs_go_bitfield.Bitlist `protobuf:"bytes,7,opt,name=bitlist_field,json=bitlistField,proto3" json:"bitlist_field,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitlist" ssz-max:"2048"` + NestedListField [][]byte `protobuf:"bytes,8,rep,name=nested_list_field,json=nestedListField,proto3" json:"nested_list_field,omitempty" ssz-max:"100,50" ssz-size:"?,?"` + TrailingField []byte `protobuf:"bytes,9,opt,name=trailing_field,json=trailingField,proto3" json:"trailing_field,omitempty" ssz-size:"56"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *VariableTestContainer) Reset() { *x = VariableTestContainer{} - mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[3] + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -279,7 +332,7 @@ func (x *VariableTestContainer) String() string { func (*VariableTestContainer) ProtoMessage() {} func (x *VariableTestContainer) ProtoReflect() protoreflect.Message { - mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[3] + mi := &file_proto_ssz_query_testing_test_containers_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -292,7 +345,7 @@ func (x *VariableTestContainer) ProtoReflect() protoreflect.Message { // Deprecated: Use VariableTestContainer.ProtoReflect.Descriptor instead. func (*VariableTestContainer) Descriptor() ([]byte, []int) { - return file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP(), []int{3} + return file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP(), []int{4} } func (x *VariableTestContainer) GetLeadingField() []byte { @@ -330,6 +383,13 @@ func (x *VariableTestContainer) GetNested() *VariableNestedContainer { return nil } +func (x *VariableTestContainer) GetVariableContainerList() []*VariableOuterContainer { + if x != nil { + return x.VariableContainerList + } + return nil +} + func (x *VariableTestContainer) GetBitlistField() github_com_prysmaticlabs_go_bitfield.Bitlist { if x != nil { return x.BitlistField @@ -412,45 +472,60 @@ var file_proto_ssz_query_testing_test_containers_proto_rawDesc = []byte{ 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x11, 0x8a, 0xb5, 0x18, 0x03, 0x3f, 0x2c, 0x3f, 0x92, 0xb5, 0x18, 0x06, 0x31, 0x30, 0x30, 0x2c, 0x35, 0x30, 0x52, 0x0f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x22, 0x9a, 0x04, 0x0a, 0x15, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x65, 0x73, - 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x0d, 0x6c, 0x65, - 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0c, 0x6c, 0x65, 0x61, 0x64, 0x69, - 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x34, 0x0a, 0x11, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x04, 0x42, 0x08, 0x92, 0xb5, 0x18, 0x04, 0x32, 0x30, 0x34, 0x38, 0x52, 0x0f, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x58, 0x0a, - 0x14, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, 0x65, - 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x07, 0x92, 0xb5, 0x18, 0x03, - 0x31, 0x32, 0x38, 0x52, 0x12, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x12, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0c, 0x42, 0x0f, 0x8a, 0xb5, 0x18, 0x04, 0x3f, 0x2c, 0x33, 0x32, 0x92, 0xb5, 0x18, - 0x03, 0x31, 0x30, 0x30, 0x52, 0x10, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, - 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x12, 0x38, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, - 0x12, 0x5d, 0x0a, 0x0d, 0x62, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x38, 0x82, 0xb5, 0x18, 0x2c, 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, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x2e, 0x42, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x92, 0xb5, 0x18, 0x04, 0x32, 0x30, 0x34, - 0x38, 0x52, 0x0c, 0x62, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, - 0x3d, 0x0a, 0x11, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x11, 0x8a, 0xb5, 0x18, 0x03, - 0x3f, 0x2c, 0x3f, 0x92, 0xb5, 0x18, 0x06, 0x31, 0x30, 0x30, 0x2c, 0x35, 0x30, 0x52, 0x0f, 0x6e, - 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x2d, - 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x35, 0x36, 0x52, 0x0d, - 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x42, 0x5a, - 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x66, 0x66, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, - 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x8e, 0x01, 0x0a, 0x16, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x75, 0x74, + 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x07, 0x69, + 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4e, + 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x06, + 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x31, 0x12, 0x39, 0x0a, 0x07, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, + 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x06, 0x69, 0x6e, 0x6e, 0x65, 0x72, + 0x32, 0x22, 0xfb, 0x04, 0x0a, 0x15, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x65, + 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x0d, 0x6c, + 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0c, 0x6c, 0x65, 0x61, 0x64, + 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x34, 0x0a, 0x11, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x04, 0x42, 0x08, 0x92, 0xb5, 0x18, 0x04, 0x32, 0x30, 0x34, 0x38, 0x52, 0x0f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x58, + 0x0a, 0x14, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4e, 0x65, 0x73, 0x74, + 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x07, 0x92, 0xb5, 0x18, + 0x03, 0x31, 0x32, 0x38, 0x52, 0x12, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x12, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0c, 0x42, 0x0f, 0x8a, 0xb5, 0x18, 0x04, 0x3f, 0x2c, 0x33, 0x32, 0x92, 0xb5, + 0x18, 0x03, 0x31, 0x30, 0x30, 0x52, 0x10, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x33, 0x32, 0x12, 0x38, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, + 0x64, 0x12, 0x5f, 0x0a, 0x17, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x61, 0x72, + 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x42, 0x06, 0x92, 0xb5, 0x18, 0x02, 0x31, 0x30, 0x52, 0x15, 0x76, 0x61, 0x72, + 0x69, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4c, 0x69, + 0x73, 0x74, 0x12, 0x5d, 0x0a, 0x0d, 0x62, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x38, 0x82, 0xb5, 0x18, 0x2c, 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, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x92, 0xb5, 0x18, 0x04, 0x32, + 0x30, 0x34, 0x38, 0x52, 0x0c, 0x62, 0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x12, 0x3d, 0x0a, 0x11, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, + 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x11, 0x8a, 0xb5, + 0x18, 0x03, 0x3f, 0x2c, 0x3f, 0x92, 0xb5, 0x18, 0x06, 0x31, 0x30, 0x30, 0x2c, 0x35, 0x30, 0x52, + 0x0f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x12, 0x2d, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x35, 0x36, + 0x52, 0x0d, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, + 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x66, + 0x66, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x2f, 0x76, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x7a, 0x5f, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3b, 0x74, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -465,22 +540,26 @@ func file_proto_ssz_query_testing_test_containers_proto_rawDescGZIP() []byte { return file_proto_ssz_query_testing_test_containers_proto_rawDescData } -var file_proto_ssz_query_testing_test_containers_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_proto_ssz_query_testing_test_containers_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_proto_ssz_query_testing_test_containers_proto_goTypes = []any{ (*FixedNestedContainer)(nil), // 0: testing.FixedNestedContainer (*FixedTestContainer)(nil), // 1: testing.FixedTestContainer (*VariableNestedContainer)(nil), // 2: testing.VariableNestedContainer - (*VariableTestContainer)(nil), // 3: testing.VariableTestContainer + (*VariableOuterContainer)(nil), // 3: testing.VariableOuterContainer + (*VariableTestContainer)(nil), // 4: testing.VariableTestContainer } var file_proto_ssz_query_testing_test_containers_proto_depIdxs = []int32{ 0, // 0: testing.FixedTestContainer.nested:type_name -> testing.FixedNestedContainer - 0, // 1: testing.VariableTestContainer.field_list_container:type_name -> testing.FixedNestedContainer - 2, // 2: testing.VariableTestContainer.nested:type_name -> testing.VariableNestedContainer - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 2, // 1: testing.VariableOuterContainer.inner_1:type_name -> testing.VariableNestedContainer + 2, // 2: testing.VariableOuterContainer.inner_2:type_name -> testing.VariableNestedContainer + 0, // 3: testing.VariableTestContainer.field_list_container:type_name -> testing.FixedNestedContainer + 2, // 4: testing.VariableTestContainer.nested:type_name -> testing.VariableNestedContainer + 3, // 5: testing.VariableTestContainer.variable_container_list:type_name -> testing.VariableOuterContainer + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_proto_ssz_query_testing_test_containers_proto_init() } @@ -494,7 +573,7 @@ func file_proto_ssz_query_testing_test_containers_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_ssz_query_testing_test_containers_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/testing/test.pb.go b/proto/testing/test.pb.go index b5891dc142d4..7bb1f9c379c7 100755 --- a/proto/testing/test.pb.go +++ b/proto/testing/test.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 +// protoc-gen-go v1.36.3 // protoc v3.21.7 // source: proto/testing/test.proto @@ -73,21 +73,18 @@ func (Person_PhoneType) EnumDescriptor() ([]byte, []int) { } type TestMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Foo string `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty"` + Bar string `protobuf:"bytes,2,opt,name=bar,proto3" json:"bar,omitempty" spec-name:"foo" ssz-size:"32"` unknownFields protoimpl.UnknownFields - - Foo string `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty"` - Bar string `protobuf:"bytes,2,opt,name=bar,proto3" json:"bar,omitempty" spec-name:"foo" ssz-size:"32"` + sizeCache protoimpl.SizeCache } func (x *TestMessage) Reset() { *x = TestMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_testing_test_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_testing_test_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TestMessage) String() string { @@ -98,7 +95,7 @@ func (*TestMessage) ProtoMessage() {} func (x *TestMessage) ProtoReflect() protoreflect.Message { mi := &file_proto_testing_test_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -128,21 +125,18 @@ func (x *TestMessage) GetBar() string { } type TestNestedMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Fuzz string `protobuf:"bytes,1,opt,name=fuzz,proto3" json:"fuzz,omitempty"` + Msg *TestMessage `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` unknownFields protoimpl.UnknownFields - - Fuzz string `protobuf:"bytes,1,opt,name=fuzz,proto3" json:"fuzz,omitempty"` - Msg *TestMessage `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TestNestedMessage) Reset() { *x = TestNestedMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_testing_test_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_testing_test_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TestNestedMessage) String() string { @@ -153,7 +147,7 @@ func (*TestNestedMessage) ProtoMessage() {} func (x *TestNestedMessage) ProtoReflect() protoreflect.Message { mi := &file_proto_testing_test_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -183,21 +177,18 @@ func (x *TestNestedMessage) GetMsg() *TestMessage { } type Puzzle struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Challenge string `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"` + Answer string `protobuf:"bytes,2,opt,name=answer,proto3" json:"answer,omitempty"` unknownFields protoimpl.UnknownFields - - Challenge string `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"` - Answer string `protobuf:"bytes,2,opt,name=answer,proto3" json:"answer,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Puzzle) Reset() { *x = Puzzle{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_testing_test_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_testing_test_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Puzzle) String() string { @@ -208,7 +199,7 @@ func (*Puzzle) ProtoMessage() {} func (x *Puzzle) ProtoReflect() protoreflect.Message { mi := &file_proto_testing_test_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -238,24 +229,21 @@ func (x *Puzzle) GetAnswer() string { } type Person struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` + Phones []*Person_PhoneNumber `protobuf:"bytes,4,rep,name=phones,proto3" json:"phones,omitempty"` + LastUpdated *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - Phones []*Person_PhoneNumber `protobuf:"bytes,4,rep,name=phones,proto3" json:"phones,omitempty"` - LastUpdated *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Person) Reset() { *x = Person{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_testing_test_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_testing_test_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Person) String() string { @@ -266,7 +254,7 @@ func (*Person) ProtoMessage() {} func (x *Person) ProtoReflect() protoreflect.Message { mi := &file_proto_testing_test_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -317,20 +305,17 @@ func (x *Person) GetLastUpdated() *timestamppb.Timestamp { } type AddressBook struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + People []*Person `protobuf:"bytes,1,rep,name=people,proto3" json:"people,omitempty"` unknownFields protoimpl.UnknownFields - - People []*Person `protobuf:"bytes,1,rep,name=people,proto3" json:"people,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AddressBook) Reset() { *x = AddressBook{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_testing_test_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_testing_test_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddressBook) String() string { @@ -341,7 +326,7 @@ func (*AddressBook) ProtoMessage() {} func (x *AddressBook) ProtoReflect() protoreflect.Message { mi := &file_proto_testing_test_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -364,21 +349,18 @@ func (x *AddressBook) GetPeople() []*Person { } type TestSimpleMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Foo []byte `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty"` + Bar uint64 `protobuf:"varint,2,opt,name=bar,proto3" json:"bar,omitempty"` unknownFields protoimpl.UnknownFields - - Foo []byte `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty"` - Bar uint64 `protobuf:"varint,2,opt,name=bar,proto3" json:"bar,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TestSimpleMessage) Reset() { *x = TestSimpleMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_testing_test_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_testing_test_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TestSimpleMessage) String() string { @@ -389,7 +371,7 @@ func (*TestSimpleMessage) ProtoMessage() {} func (x *TestSimpleMessage) ProtoReflect() protoreflect.Message { mi := &file_proto_testing_test_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -419,21 +401,18 @@ func (x *TestSimpleMessage) GetBar() uint64 { } type Person_PhoneNumber struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"` + Type Person_PhoneType `protobuf:"varint,2,opt,name=type,proto3,enum=testing.Person_PhoneType" json:"type,omitempty"` unknownFields protoimpl.UnknownFields - - Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"` - Type Person_PhoneType `protobuf:"varint,2,opt,name=type,proto3,enum=testing.Person_PhoneType" json:"type,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Person_PhoneNumber) Reset() { *x = Person_PhoneNumber{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_testing_test_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_testing_test_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Person_PhoneNumber) String() string { @@ -444,7 +423,7 @@ func (*Person_PhoneNumber) ProtoMessage() {} func (x *Person_PhoneNumber) ProtoReflect() protoreflect.Message { mi := &file_proto_testing_test_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -574,7 +553,7 @@ func file_proto_testing_test_proto_rawDescGZIP() []byte { var file_proto_testing_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_proto_testing_test_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_proto_testing_test_proto_goTypes = []interface{}{ +var file_proto_testing_test_proto_goTypes = []any{ (Person_PhoneType)(0), // 0: testing.Person.PhoneType (*TestMessage)(nil), // 1: testing.TestMessage (*TestNestedMessage)(nil), // 2: testing.TestNestedMessage @@ -606,92 +585,6 @@ func file_proto_testing_test_proto_init() { if File_proto_testing_test_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_proto_testing_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_testing_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestNestedMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_testing_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Puzzle); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_testing_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Person); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_testing_test_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddressBook); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_testing_test_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestSimpleMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_testing_test_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Person_PhoneNumber); 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{ From 5f02a53334720e7d2e068a5051ff5af84a248ca6 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 19:16:56 +0900 Subject: [PATCH 07/10] Return 500 when calculate offset fails --- beacon-chain/rpc/prysm/beacon/ssz_query.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/beacon-chain/rpc/prysm/beacon/ssz_query.go b/beacon-chain/rpc/prysm/beacon/ssz_query.go index dfd1d2df606a..03c8fc4369f0 100644 --- a/beacon-chain/rpc/prysm/beacon/ssz_query.go +++ b/beacon-chain/rpc/prysm/beacon/ssz_query.go @@ -103,7 +103,7 @@ func (s *Server) QueryBeaconState(w http.ResponseWriter, r *http.Request) { _, offset, length, err := query.CalculateOffsetAndLength(info, path) if err != nil { - httputil.HandleError(w, "Could not calculate offset and length for path '"+req.Query+"': "+err.Error(), http.StatusBadRequest) + httputil.HandleError(w, "Could not calculate offset and length for path '"+req.Query+"': "+err.Error(), http.StatusInternalServerError) return } @@ -128,7 +128,13 @@ func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { ctx, span := trace.StartSpan(r.Context(), "beacon.QueryBeaconBlock") defer span.End() - // Validate path first as lookup may be expensive. + blockId := r.PathValue("block_id") + if blockId == "" { + httputil.HandleError(w, "block_id is required in URL params", http.StatusBadRequest) + return + } + + // Validate path before lookup: it might be expensive. var req structs.QuerySSZRequest err := json.NewDecoder(r.Body).Decode(&req) switch { @@ -151,12 +157,6 @@ func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { return } - blockId := r.PathValue("block_id") - if blockId == "" { - httputil.HandleError(w, "block_id is required in URL params", http.StatusBadRequest) - return - } - signedBlock, err := s.Blocker.Block(ctx, []byte(blockId)) if !shared.WriteBlockFetchError(w, signedBlock, err) { return @@ -184,7 +184,7 @@ func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { _, offset, length, err := query.CalculateOffsetAndLength(info, path) if err != nil { - httputil.HandleError(w, "Could not calculate offset and length for path '"+req.Query+"': "+err.Error(), http.StatusBadRequest) + httputil.HandleError(w, "Could not calculate offset and length for path '"+req.Query+"': "+err.Error(), http.StatusInternalServerError) return } From a4d42884e4b8e2542e9899956bd846e91c32b959 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 19:17:30 +0900 Subject: [PATCH 08/10] Add test for QueryBeaconState --- beacon-chain/rpc/prysm/beacon/BUILD.bazel | 3 + .../rpc/prysm/beacon/ssz_query_test.go | 213 +++++++++++++++++- 2 files changed, 214 insertions(+), 2 deletions(-) diff --git a/beacon-chain/rpc/prysm/beacon/BUILD.bazel b/beacon-chain/rpc/prysm/beacon/BUILD.bazel index c3f5572d9b4f..380dc8480e4d 100644 --- a/beacon-chain/rpc/prysm/beacon/BUILD.bazel +++ b/beacon-chain/rpc/prysm/beacon/BUILD.bazel @@ -51,6 +51,7 @@ go_test( ], embed = [":go_default_library"], deps = [ + "//api:go_default_library", "//api/server/structs:go_default_library", "//beacon-chain/blockchain/testing:go_default_library", "//beacon-chain/core/helpers:go_default_library", @@ -73,6 +74,8 @@ go_test( "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", + "//proto/ssz_query:go_default_library", + "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/prysm/beacon/ssz_query_test.go b/beacon-chain/rpc/prysm/beacon/ssz_query_test.go index 113d5cac91e3..d400cc520beb 100644 --- a/beacon-chain/rpc/prysm/beacon/ssz_query_test.go +++ b/beacon-chain/rpc/prysm/beacon/ssz_query_test.go @@ -1,7 +1,216 @@ package beacon -import "testing" +import ( + "bytes" + "context" + "encoding/binary" + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "testing" -func TestServer_QueryBeaconState(t *testing.T) {} + "github.com/OffchainLabs/prysm/v6/api" + "github.com/OffchainLabs/prysm/v6/api/server/structs" + chainMock "github.com/OffchainLabs/prysm/v6/beacon-chain/blockchain/testing" + "github.com/OffchainLabs/prysm/v6/beacon-chain/rpc/testutil" + "github.com/OffchainLabs/prysm/v6/consensus-types/primitives" + sszquerypb "github.com/OffchainLabs/prysm/v6/proto/ssz_query" + "github.com/OffchainLabs/prysm/v6/runtime/version" + "github.com/OffchainLabs/prysm/v6/testing/assert" + "github.com/OffchainLabs/prysm/v6/testing/require" + "github.com/OffchainLabs/prysm/v6/testing/util" +) + +func TestQueryBeaconState(t *testing.T) { + ctx := context.Background() + + st, _ := util.DeterministicGenesisState(t, 16) + require.NoError(t, st.SetSlot(primitives.Slot(42))) + stateRoot, err := st.HashTreeRoot(ctx) + require.NoError(t, err) + require.NoError(t, st.UpdateBalancesAtIndex(0, 42000000000)) + + tests := []struct { + path string + expectedValue []byte + }{ + { + path: ".slot", + expectedValue: func() []byte { + slot := st.Slot() + result, _ := slot.MarshalSSZ() + return result + }(), + }, + { + path: ".latest_block_header", + expectedValue: func() []byte { + header := st.LatestBlockHeader() + result, _ := header.MarshalSSZ() + return result + }(), + }, + { + path: ".validators", + expectedValue: func() []byte { + b := make([]byte, 0) + validators := st.Validators() + for _, v := range validators { + vBytes, _ := v.MarshalSSZ() + b = append(b, vBytes...) + } + return b + + }(), + }, + { + path: ".validators[0]", + expectedValue: func() []byte { + v, _ := st.ValidatorAtIndex(0) + result, _ := v.MarshalSSZ() + return result + }(), + }, + { + path: ".validators[0].withdrawal_credentials", + expectedValue: func() []byte { + v, _ := st.ValidatorAtIndex(0) + return v.WithdrawalCredentials + }(), + }, + { + path: ".validators[0].effective_balance", + expectedValue: func() []byte { + v, _ := st.ValidatorAtIndex(0) + b := make([]byte, 8) + binary.LittleEndian.PutUint64(b, uint64(v.EffectiveBalance)) + return b + }(), + }, + } + + for _, tt := range tests { + t.Run(tt.path, func(t *testing.T) { + chainService := &chainMock.ChainService{Optimistic: false, FinalizedRoots: make(map[[32]byte]bool)} + s := &Server{ + OptimisticModeFetcher: chainService, + FinalizationFetcher: chainService, + Stater: &testutil.MockStater{ + BeaconStateRoot: stateRoot[:], + BeaconState: st, + }, + } + + requestBody := &structs.QuerySSZRequest{ + Query: tt.path, + } + var buf bytes.Buffer + require.NoError(t, json.NewEncoder(&buf).Encode(requestBody)) + + request := httptest.NewRequest(http.MethodPost, "http://example.com/prysm/v1/beacon/states/{state_id}/query", &buf) + request.SetPathValue("state_id", "head") + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + + s.QueryBeaconState(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + assert.Equal(t, version.String(version.Phase0), writer.Header().Get(api.VersionHeader)) + + expectedResponse := &sszquerypb.SSZQueryResponse{ + Root: stateRoot[:], + Result: tt.expectedValue, + } + sszExpectedResponse, err := expectedResponse.MarshalSSZ() + require.NoError(t, err) + assert.DeepEqual(t, sszExpectedResponse, writer.Body.Bytes()) + }) + } +} + +func TestQueryBeaconStateInvalidRequest(t *testing.T) { + ctx := context.Background() + + st, _ := util.DeterministicGenesisState(t, 16) + require.NoError(t, st.SetSlot(primitives.Slot(42))) + stateRoot, err := st.HashTreeRoot(ctx) + require.NoError(t, err) + + tests := []struct { + name string + stateId string + path string + code int + errorString string + }{ + { + name: "empty query submitted", + stateId: "head", + path: "", + errorString: "Empty query submitted", + }, + { + name: "invalid path", + stateId: "head", + path: ".invalid[]]", + errorString: "Could not parse path", + }, + { + name: "non-existent field", + stateId: "head", + path: ".non_existent_field", + code: http.StatusInternalServerError, + errorString: "Could not calculate offset and length for path", + }, + { + name: "empty state ID", + stateId: "", + path: "", + }, + { + name: "far future slot", + stateId: "1000000000000", + path: "", + }, + } + + for _, tt := range tests { + t.Run(tt.path, func(t *testing.T) { + chainService := &chainMock.ChainService{Optimistic: false, FinalizedRoots: make(map[[32]byte]bool)} + s := &Server{ + OptimisticModeFetcher: chainService, + FinalizationFetcher: chainService, + Stater: &testutil.MockStater{ + BeaconStateRoot: stateRoot[:], + BeaconState: st, + }, + } + + requestBody := &structs.QuerySSZRequest{ + Query: tt.path, + } + var buf bytes.Buffer + require.NoError(t, json.NewEncoder(&buf).Encode(requestBody)) + + request := httptest.NewRequest(http.MethodPost, "http://example.com/prysm/v1/beacon/states/{state_id}/query", &buf) + request.SetPathValue("state_id", tt.stateId) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + + s.QueryBeaconState(writer, request) + + if tt.code == 0 { + tt.code = http.StatusBadRequest + } else { + tt.code = tt.code + } + require.Equal(t, tt.code, writer.Code) + if tt.errorString != "" { + errorString := writer.Body.String() + require.Equal(t, true, strings.Contains(errorString, tt.errorString)) + } + }) + } +} func TestServer_QueryBeaconBlock(t *testing.T) {} From 875c39d0d205196889f40471d1562b1680d5443b Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 19:49:01 +0900 Subject: [PATCH 09/10] Add test for QueryBeaconBlock --- beacon-chain/rpc/prysm/beacon/BUILD.bazel | 1 + beacon-chain/rpc/prysm/beacon/ssz_query.go | 40 ++++-- .../rpc/prysm/beacon/ssz_query_test.go | 123 +++++++++++++++++- 3 files changed, 155 insertions(+), 9 deletions(-) diff --git a/beacon-chain/rpc/prysm/beacon/BUILD.bazel b/beacon-chain/rpc/prysm/beacon/BUILD.bazel index 380dc8480e4d..6315d6ef7c90 100644 --- a/beacon-chain/rpc/prysm/beacon/BUILD.bazel +++ b/beacon-chain/rpc/prysm/beacon/BUILD.bazel @@ -70,6 +70,7 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", + "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", diff --git a/beacon-chain/rpc/prysm/beacon/ssz_query.go b/beacon-chain/rpc/prysm/beacon/ssz_query.go index 03c8fc4369f0..a18991c7f810 100644 --- a/beacon-chain/rpc/prysm/beacon/ssz_query.go +++ b/beacon-chain/rpc/prysm/beacon/ssz_query.go @@ -162,23 +162,47 @@ func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { return } - blockRoot, err := signedBlock.Block().HashTreeRoot() + encodedBlock, err := signedBlock.Block().MarshalSSZ() if err != nil { - httputil.HandleError(w, "Could not compute block root: "+err.Error(), http.StatusInternalServerError) + httputil.HandleError(w, "Could not marshal block to SSZ: "+err.Error(), http.StatusInternalServerError) return } - block := signedBlock.Block() + protoBlock, err := signedBlock.Block().Proto() + if err != nil { + httputil.HandleError(w, "Could not convert block to proto: "+err.Error(), http.StatusInternalServerError) + return + } - info, err := query.AnalyzeObject(block) + var block query.SSZObject + switch signedBlock.Version() { + case version.Phase0: + block = protoBlock.(*ethpb.BeaconBlock) + case version.Altair: + block = protoBlock.(*ethpb.BeaconBlockAltair) + case version.Bellatrix: + block = protoBlock.(*ethpb.BeaconBlockBellatrix) + case version.Capella: + block = protoBlock.(*ethpb.BeaconBlockCapella) + case version.Deneb: + block = protoBlock.(*ethpb.BeaconBlockDeneb) + case version.Electra: + case version.Fulu: + block = protoBlock.(*ethpb.BeaconBlockElectra) + default: + httputil.HandleError(w, "Unsupported block version for querying: "+version.String(signedBlock.Version()), http.StatusBadRequest) + return + } + + blockRoot, err := block.HashTreeRoot() if err != nil { - httputil.HandleError(w, "Could not analyze block object: "+err.Error(), http.StatusInternalServerError) + httputil.HandleError(w, "Could not compute block root: "+err.Error(), http.StatusInternalServerError) return } - encodedState, err := block.MarshalSSZ() + info, err := query.AnalyzeObject(block) if err != nil { - httputil.HandleError(w, "Could not marshal block to SSZ: "+err.Error(), http.StatusInternalServerError) + httputil.HandleError(w, "Could not analyze block object: "+err.Error(), http.StatusInternalServerError) return } @@ -190,7 +214,7 @@ func (s *Server) QueryBeaconBlock(w http.ResponseWriter, r *http.Request) { response := &sszquerypb.SSZQueryResponse{ Root: blockRoot[:], - Result: encodedState[offset : offset+length], + Result: encodedBlock[offset : offset+length], } responseSsz, err := response.MarshalSSZ() diff --git a/beacon-chain/rpc/prysm/beacon/ssz_query_test.go b/beacon-chain/rpc/prysm/beacon/ssz_query_test.go index d400cc520beb..6a8f4176f09b 100644 --- a/beacon-chain/rpc/prysm/beacon/ssz_query_test.go +++ b/beacon-chain/rpc/prysm/beacon/ssz_query_test.go @@ -14,12 +14,17 @@ import ( "github.com/OffchainLabs/prysm/v6/api/server/structs" chainMock "github.com/OffchainLabs/prysm/v6/beacon-chain/blockchain/testing" "github.com/OffchainLabs/prysm/v6/beacon-chain/rpc/testutil" + "github.com/OffchainLabs/prysm/v6/consensus-types/blocks" + "github.com/OffchainLabs/prysm/v6/consensus-types/interfaces" "github.com/OffchainLabs/prysm/v6/consensus-types/primitives" + eth "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1" sszquerypb "github.com/OffchainLabs/prysm/v6/proto/ssz_query" "github.com/OffchainLabs/prysm/v6/runtime/version" "github.com/OffchainLabs/prysm/v6/testing/assert" "github.com/OffchainLabs/prysm/v6/testing/require" "github.com/OffchainLabs/prysm/v6/testing/util" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/prysmaticlabs/go-bitfield" ) func TestQueryBeaconState(t *testing.T) { @@ -213,4 +218,120 @@ func TestQueryBeaconStateInvalidRequest(t *testing.T) { } } -func TestServer_QueryBeaconBlock(t *testing.T) {} +func TestQueryBeaconBlock(t *testing.T) { + randaoReveal, err := hexutil.Decode("0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505") + require.NoError(t, err) + root, err := hexutil.Decode("0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2") + require.NoError(t, err) + signature, err := hexutil.Decode("0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505") + require.NoError(t, err) + att := ð.Attestation{ + AggregationBits: bitfield.Bitlist{0x01}, + Data: ð.AttestationData{ + Slot: 1, + CommitteeIndex: 1, + BeaconBlockRoot: root, + Source: ð.Checkpoint{ + Epoch: 1, + Root: root, + }, + Target: ð.Checkpoint{ + Epoch: 1, + Root: root, + }, + }, + Signature: signature, + } + + tests := []struct { + name string + path string + block interfaces.ReadOnlySignedBeaconBlock + expectedValue []byte + }{ + { + name: "slot", + path: ".slot", + block: func() interfaces.ReadOnlySignedBeaconBlock { + b := util.NewBeaconBlock() + b.Block.Slot = 123 + sb, err := blocks.NewSignedBeaconBlock(b) + require.NoError(t, err) + return sb + }(), + expectedValue: func() []byte { + b := make([]byte, 8) + binary.LittleEndian.PutUint64(b, 123) + return b + }(), + }, + { + name: "randao_reveal", + path: ".body.randao_reveal", + block: func() interfaces.ReadOnlySignedBeaconBlock { + b := util.NewBeaconBlock() + b.Block.Body.RandaoReveal = randaoReveal + sb, err := blocks.NewSignedBeaconBlock(b) + require.NoError(t, err) + return sb + }(), + expectedValue: randaoReveal, + }, + { + name: "attestations", + path: ".body.attestations", + block: func() interfaces.ReadOnlySignedBeaconBlock { + b := util.NewBeaconBlock() + b.Block.Body.Attestations = []*eth.Attestation{ + att, + } + sb, err := blocks.NewSignedBeaconBlock(b) + require.NoError(t, err) + return sb + }(), + expectedValue: func() []byte { + b, err := att.MarshalSSZ() + require.NoError(t, err) + return b + }(), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + mockBlockFetcher := &testutil.MockBlocker{BlockToReturn: tt.block} + mockChainService := &chainMock.ChainService{ + FinalizedRoots: map[[32]byte]bool{}, + } + s := &Server{ + FinalizationFetcher: mockChainService, + Blocker: mockBlockFetcher, + } + requestBody := &structs.QuerySSZRequest{ + Query: tt.path, + } + var buf bytes.Buffer + require.NoError(t, json.NewEncoder(&buf).Encode(requestBody)) + + request := httptest.NewRequest(http.MethodPost, "http://example.com/prysm/v1/beacon/blocks/{block_id}/query", &buf) + request.SetPathValue("block_id", "head") + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + + s.QueryBeaconBlock(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + assert.Equal(t, version.String(version.Phase0), writer.Header().Get(api.VersionHeader)) + + blockRoot, err := tt.block.Block().HashTreeRoot() + require.NoError(t, err) + + expectedResponse := &sszquerypb.SSZQueryResponse{ + Root: blockRoot[:], + Result: tt.expectedValue, + } + sszExpectedResponse, err := expectedResponse.MarshalSSZ() + require.NoError(t, err) + assert.DeepEqual(t, sszExpectedResponse, writer.Body.Bytes()) + }) + } +} From de38cf62b5cb4c2425b2198fdcf4c0d53e72c6c2 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Fri, 17 Oct 2025 19:53:18 +0900 Subject: [PATCH 10/10] Changelog :) --- changelog/syjn99_ssz-ql-endpoints.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/syjn99_ssz-ql-endpoints.md diff --git a/changelog/syjn99_ssz-ql-endpoints.md b/changelog/syjn99_ssz-ql-endpoints.md new file mode 100644 index 000000000000..b5fccec18bf8 --- /dev/null +++ b/changelog/syjn99_ssz-ql-endpoints.md @@ -0,0 +1,3 @@ +### Added + +- SSZ-QL: Add endpoints for `BeaconState`/`BeaconBlock`.