mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
SSZ-QL: Add endpoints (BeaconState/BeaconBlock) (#15888)
* Move ssz_query objects into testing folder (ensuring test objects only used in test environment) * Add containers for response * Export sszInfo * Add QueryBeaconState/Block * Add comments and few refactor * Fix merge conflict issues * Return 500 when calculate offset fails * Add test for QueryBeaconState * Add test for QueryBeaconBlock * Changelog :) * Rename `QuerySSZRequest` to `SSZQueryRequest` * Fix middleware hooks for RPC to accept JSON from client and return SSZ * Convert to `SSZObject` directly from proto * Move marshalling/calculating hash tree root part after `CalculateOffsetAndLength` * Make nogo happy * Add informing comment for using proto unsafe conversion --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
282
proto/ssz_query/response.pb.go
generated
Executable file
282
proto/ssz_query/response.pb.go
generated
Executable file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user