From 77840254fc025cc1d593fd0abd8c1023f7e29390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Wed, 13 Apr 2022 19:05:04 +0200 Subject: [PATCH 1/5] feat: build proto deterministically with docker --- buf.gen.yaml | 9 ++ buf.yaml | 12 ++ proto/gen.sh | 11 +- proto/protoc.sh | 6 + third_party/proto/gogoproto/gogo.proto | 145 +++++++++++++++++++++++++ 5 files changed, 176 insertions(+), 7 deletions(-) create mode 100644 buf.gen.yaml create mode 100644 buf.yaml create mode 100644 proto/protoc.sh create mode 100644 third_party/proto/gogoproto/gogo.proto diff --git a/buf.gen.yaml b/buf.gen.yaml new file mode 100644 index 00000000000..133d8301c55 --- /dev/null +++ b/buf.gen.yaml @@ -0,0 +1,9 @@ +version: v1beta1 + +# The plugins to run. +plugins: + # The name of the plugin. + - name: gogofaster + # The the relative output directory. + out: proto + diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 00000000000..6ed37d3afd7 --- /dev/null +++ b/buf.yaml @@ -0,0 +1,12 @@ +version: v1beta1 + +build: + roots: + - proto + - third_party/proto +lint: + use: + - DEFAULT +breaking: + use: + - FILE diff --git a/proto/gen.sh b/proto/gen.sh index 3606df97e65..60b2ef6a850 100755 --- a/proto/gen.sh +++ b/proto/gen.sh @@ -1,13 +1,10 @@ #!/usr/bin/env bash # see: https://stackoverflow.com/a/246128 -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -TARGET_DIR=../types/pb -IMPORTS="-I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"/.. +TARGET_DIR=./types/pb cd $SCRIPT_DIR rm -rf $TARGET_DIR/* -protoc $IMPORTS --gofast_out=paths=source_relative:. optimint/optimint.proto -protoc $IMPORTS --gofast_out=plugins=grpc,paths=source_relative:. dalc/dalc.proto -mv github.com/celestiaorg/optimint/types/pb/* $TARGET_DIR/ -rm -rf github.com +docker run -v $PWD:/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./proto/protoc.sh +cp -r ./proto/github.com/celestiaorg/optimint/types/pb/* $TARGET_DIR/ diff --git a/proto/protoc.sh b/proto/protoc.sh new file mode 100644 index 00000000000..61444adebf1 --- /dev/null +++ b/proto/protoc.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -eo pipefail + +buf generate --path="./proto/dalc" --template="buf.gen.yaml" --config="buf.yaml" +buf generate --path="./proto/optimint" --template="buf.gen.yaml" --config="buf.yaml" diff --git a/third_party/proto/gogoproto/gogo.proto b/third_party/proto/gogoproto/gogo.proto new file mode 100644 index 00000000000..49e78f99fe5 --- /dev/null +++ b/third_party/proto/gogoproto/gogo.proto @@ -0,0 +1,145 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; +option go_package = "github.com/gogo/protobuf/gogoproto"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; + optional bool enumdecl = 62024; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; + optional bool typedecl_all = 63030; + optional bool enumdecl_all = 63031; + + optional bool goproto_registration = 63032; + optional bool messagename_all = 63033; + + optional bool goproto_sizecache_all = 63034; + optional bool goproto_unkeyed_all = 63035; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + optional bool compare = 64029; + + optional bool typedecl = 64030; + + optional bool messagename = 64033; + + optional bool goproto_sizecache = 64034; + optional bool goproto_unkeyed = 64035; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; + optional bool wktpointer = 65012; + + optional string castrepeated = 65013; +} From 6340945d28b74438c7cb3a3fb1008b82bdde8141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Wed, 13 Apr 2022 19:05:32 +0200 Subject: [PATCH 2/5] feat: updated protobuf types --- types/pb/dalc/dalc.pb.go | 872 +++++++++++++++++-------------- types/pb/optimint/optimint.pb.go | 858 ++++++++++++++++++------------ 2 files changed, 1004 insertions(+), 726 deletions(-) diff --git a/types/pb/dalc/dalc.pb.go b/types/pb/dalc/dalc.pb.go index ffcad377cb6..5c9536fe819 100644 --- a/types/pb/dalc/dalc.pb.go +++ b/types/pb/dalc/dalc.pb.go @@ -1,37 +1,15 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: dalc/dalc.proto -/* - Package dalc is a generated protocol buffer package. - - It is generated from these files: - dalc/dalc.proto - - It has these top-level messages: - DAResponse - SubmitBlockRequest - SubmitBlockResponse - CheckBlockAvailabilityRequest - CheckBlockAvailabilityResponse - RetrieveBlocksRequest - RetrieveBlocksResponse -*/ package dalc import ( fmt "fmt" - - proto "github.com/golang/protobuf/proto" - - math "math" - optimint "github.com/celestiaorg/optimint/types/pb/optimint" - - context "golang.org/x/net/context" - - grpc "google.golang.org/grpc" - + proto "github.com/gogo/protobuf/proto" io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -43,7 +21,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type StatusCode int32 @@ -60,6 +38,7 @@ var StatusCode_name = map[int32]string{ 2: "STATUS_CODE_TIMEOUT", 3: "STATUS_CODE_ERROR", } + var StatusCode_value = map[string]int32{ "STATUS_CODE_UNSPECIFIED": 0, "STATUS_CODE_SUCCESS": 1, @@ -70,7 +49,10 @@ var StatusCode_value = map[string]int32{ func (x StatusCode) String() string { return proto.EnumName(StatusCode_name, int32(x)) } -func (StatusCode) EnumDescriptor() ([]byte, []int) { return fileDescriptorDalc, []int{0} } + +func (StatusCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_45d7d8eda2693dc1, []int{0} +} type DAResponse struct { Code StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=dalc.StatusCode" json:"code,omitempty"` @@ -78,10 +60,38 @@ type DAResponse struct { DataLayerHeight uint64 `protobuf:"varint,3,opt,name=data_layer_height,json=dataLayerHeight,proto3" json:"data_layer_height,omitempty"` } -func (m *DAResponse) Reset() { *m = DAResponse{} } -func (m *DAResponse) String() string { return proto.CompactTextString(m) } -func (*DAResponse) ProtoMessage() {} -func (*DAResponse) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{0} } +func (m *DAResponse) Reset() { *m = DAResponse{} } +func (m *DAResponse) String() string { return proto.CompactTextString(m) } +func (*DAResponse) ProtoMessage() {} +func (*DAResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_45d7d8eda2693dc1, []int{0} +} +func (m *DAResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DAResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DAResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DAResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DAResponse.Merge(m, src) +} +func (m *DAResponse) XXX_Size() int { + return m.Size() +} +func (m *DAResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DAResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DAResponse proto.InternalMessageInfo func (m *DAResponse) GetCode() StatusCode { if m != nil { @@ -105,13 +115,41 @@ func (m *DAResponse) GetDataLayerHeight() uint64 { } type SubmitBlockRequest struct { - Block *optimint.Block `protobuf:"bytes,1,opt,name=block" json:"block,omitempty"` + Block *optimint.Block `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` } -func (m *SubmitBlockRequest) Reset() { *m = SubmitBlockRequest{} } -func (m *SubmitBlockRequest) String() string { return proto.CompactTextString(m) } -func (*SubmitBlockRequest) ProtoMessage() {} -func (*SubmitBlockRequest) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{1} } +func (m *SubmitBlockRequest) Reset() { *m = SubmitBlockRequest{} } +func (m *SubmitBlockRequest) String() string { return proto.CompactTextString(m) } +func (*SubmitBlockRequest) ProtoMessage() {} +func (*SubmitBlockRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_45d7d8eda2693dc1, []int{1} +} +func (m *SubmitBlockRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubmitBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubmitBlockRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SubmitBlockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubmitBlockRequest.Merge(m, src) +} +func (m *SubmitBlockRequest) XXX_Size() int { + return m.Size() +} +func (m *SubmitBlockRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SubmitBlockRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SubmitBlockRequest proto.InternalMessageInfo func (m *SubmitBlockRequest) GetBlock() *optimint.Block { if m != nil { @@ -121,13 +159,41 @@ func (m *SubmitBlockRequest) GetBlock() *optimint.Block { } type SubmitBlockResponse struct { - Result *DAResponse `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"` + Result *DAResponse `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` +} + +func (m *SubmitBlockResponse) Reset() { *m = SubmitBlockResponse{} } +func (m *SubmitBlockResponse) String() string { return proto.CompactTextString(m) } +func (*SubmitBlockResponse) ProtoMessage() {} +func (*SubmitBlockResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_45d7d8eda2693dc1, []int{2} +} +func (m *SubmitBlockResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubmitBlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubmitBlockResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SubmitBlockResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubmitBlockResponse.Merge(m, src) +} +func (m *SubmitBlockResponse) XXX_Size() int { + return m.Size() +} +func (m *SubmitBlockResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SubmitBlockResponse.DiscardUnknown(m) } -func (m *SubmitBlockResponse) Reset() { *m = SubmitBlockResponse{} } -func (m *SubmitBlockResponse) String() string { return proto.CompactTextString(m) } -func (*SubmitBlockResponse) ProtoMessage() {} -func (*SubmitBlockResponse) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{2} } +var xxx_messageInfo_SubmitBlockResponse proto.InternalMessageInfo func (m *SubmitBlockResponse) GetResult() *DAResponse { if m != nil { @@ -144,9 +210,35 @@ func (m *CheckBlockAvailabilityRequest) Reset() { *m = CheckBlockAvailab func (m *CheckBlockAvailabilityRequest) String() string { return proto.CompactTextString(m) } func (*CheckBlockAvailabilityRequest) ProtoMessage() {} func (*CheckBlockAvailabilityRequest) Descriptor() ([]byte, []int) { - return fileDescriptorDalc, []int{3} + return fileDescriptor_45d7d8eda2693dc1, []int{3} +} +func (m *CheckBlockAvailabilityRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CheckBlockAvailabilityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CheckBlockAvailabilityRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CheckBlockAvailabilityRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CheckBlockAvailabilityRequest.Merge(m, src) +} +func (m *CheckBlockAvailabilityRequest) XXX_Size() int { + return m.Size() +} +func (m *CheckBlockAvailabilityRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CheckBlockAvailabilityRequest.DiscardUnknown(m) } +var xxx_messageInfo_CheckBlockAvailabilityRequest proto.InternalMessageInfo + func (m *CheckBlockAvailabilityRequest) GetDataLayerHeight() uint64 { if m != nil { return m.DataLayerHeight @@ -155,7 +247,7 @@ func (m *CheckBlockAvailabilityRequest) GetDataLayerHeight() uint64 { } type CheckBlockAvailabilityResponse struct { - Result *DAResponse `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"` + Result *DAResponse `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` DataAvailable bool `protobuf:"varint,2,opt,name=data_available,json=dataAvailable,proto3" json:"data_available,omitempty"` } @@ -163,9 +255,35 @@ func (m *CheckBlockAvailabilityResponse) Reset() { *m = CheckBlockAvaila func (m *CheckBlockAvailabilityResponse) String() string { return proto.CompactTextString(m) } func (*CheckBlockAvailabilityResponse) ProtoMessage() {} func (*CheckBlockAvailabilityResponse) Descriptor() ([]byte, []int) { - return fileDescriptorDalc, []int{4} + return fileDescriptor_45d7d8eda2693dc1, []int{4} +} +func (m *CheckBlockAvailabilityResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CheckBlockAvailabilityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CheckBlockAvailabilityResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CheckBlockAvailabilityResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CheckBlockAvailabilityResponse.Merge(m, src) +} +func (m *CheckBlockAvailabilityResponse) XXX_Size() int { + return m.Size() +} +func (m *CheckBlockAvailabilityResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CheckBlockAvailabilityResponse.DiscardUnknown(m) } +var xxx_messageInfo_CheckBlockAvailabilityResponse proto.InternalMessageInfo + func (m *CheckBlockAvailabilityResponse) GetResult() *DAResponse { if m != nil { return m.Result @@ -184,10 +302,38 @@ type RetrieveBlocksRequest struct { DataLayerHeight uint64 `protobuf:"varint,1,opt,name=data_layer_height,json=dataLayerHeight,proto3" json:"data_layer_height,omitempty"` } -func (m *RetrieveBlocksRequest) Reset() { *m = RetrieveBlocksRequest{} } -func (m *RetrieveBlocksRequest) String() string { return proto.CompactTextString(m) } -func (*RetrieveBlocksRequest) ProtoMessage() {} -func (*RetrieveBlocksRequest) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{5} } +func (m *RetrieveBlocksRequest) Reset() { *m = RetrieveBlocksRequest{} } +func (m *RetrieveBlocksRequest) String() string { return proto.CompactTextString(m) } +func (*RetrieveBlocksRequest) ProtoMessage() {} +func (*RetrieveBlocksRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_45d7d8eda2693dc1, []int{5} +} +func (m *RetrieveBlocksRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RetrieveBlocksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RetrieveBlocksRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RetrieveBlocksRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_RetrieveBlocksRequest.Merge(m, src) +} +func (m *RetrieveBlocksRequest) XXX_Size() int { + return m.Size() +} +func (m *RetrieveBlocksRequest) XXX_DiscardUnknown() { + xxx_messageInfo_RetrieveBlocksRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_RetrieveBlocksRequest proto.InternalMessageInfo func (m *RetrieveBlocksRequest) GetDataLayerHeight() uint64 { if m != nil { @@ -197,14 +343,42 @@ func (m *RetrieveBlocksRequest) GetDataLayerHeight() uint64 { } type RetrieveBlocksResponse struct { - Result *DAResponse `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"` - Blocks []*optimint.Block `protobuf:"bytes,2,rep,name=blocks" json:"blocks,omitempty"` + Result *DAResponse `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` + Blocks []*optimint.Block `protobuf:"bytes,2,rep,name=blocks,proto3" json:"blocks,omitempty"` } -func (m *RetrieveBlocksResponse) Reset() { *m = RetrieveBlocksResponse{} } -func (m *RetrieveBlocksResponse) String() string { return proto.CompactTextString(m) } -func (*RetrieveBlocksResponse) ProtoMessage() {} -func (*RetrieveBlocksResponse) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{6} } +func (m *RetrieveBlocksResponse) Reset() { *m = RetrieveBlocksResponse{} } +func (m *RetrieveBlocksResponse) String() string { return proto.CompactTextString(m) } +func (*RetrieveBlocksResponse) ProtoMessage() {} +func (*RetrieveBlocksResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_45d7d8eda2693dc1, []int{6} +} +func (m *RetrieveBlocksResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RetrieveBlocksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RetrieveBlocksResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RetrieveBlocksResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RetrieveBlocksResponse.Merge(m, src) +} +func (m *RetrieveBlocksResponse) XXX_Size() int { + return m.Size() +} +func (m *RetrieveBlocksResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RetrieveBlocksResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_RetrieveBlocksResponse proto.InternalMessageInfo func (m *RetrieveBlocksResponse) GetResult() *DAResponse { if m != nil { @@ -221,6 +395,7 @@ func (m *RetrieveBlocksResponse) GetBlocks() []*optimint.Block { } func init() { + proto.RegisterEnum("dalc.StatusCode", StatusCode_name, StatusCode_value) proto.RegisterType((*DAResponse)(nil), "dalc.DAResponse") proto.RegisterType((*SubmitBlockRequest)(nil), "dalc.SubmitBlockRequest") proto.RegisterType((*SubmitBlockResponse)(nil), "dalc.SubmitBlockResponse") @@ -228,151 +403,51 @@ func init() { proto.RegisterType((*CheckBlockAvailabilityResponse)(nil), "dalc.CheckBlockAvailabilityResponse") proto.RegisterType((*RetrieveBlocksRequest)(nil), "dalc.RetrieveBlocksRequest") proto.RegisterType((*RetrieveBlocksResponse)(nil), "dalc.RetrieveBlocksResponse") - proto.RegisterEnum("dalc.StatusCode", StatusCode_name, StatusCode_value) -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for DALCService service - -type DALCServiceClient interface { - SubmitBlock(ctx context.Context, in *SubmitBlockRequest, opts ...grpc.CallOption) (*SubmitBlockResponse, error) - CheckBlockAvailability(ctx context.Context, in *CheckBlockAvailabilityRequest, opts ...grpc.CallOption) (*CheckBlockAvailabilityResponse, error) - RetrieveBlocks(ctx context.Context, in *RetrieveBlocksRequest, opts ...grpc.CallOption) (*RetrieveBlocksResponse, error) -} - -type dALCServiceClient struct { - cc *grpc.ClientConn -} - -func NewDALCServiceClient(cc *grpc.ClientConn) DALCServiceClient { - return &dALCServiceClient{cc} -} - -func (c *dALCServiceClient) SubmitBlock(ctx context.Context, in *SubmitBlockRequest, opts ...grpc.CallOption) (*SubmitBlockResponse, error) { - out := new(SubmitBlockResponse) - err := grpc.Invoke(ctx, "/dalc.DALCService/SubmitBlock", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dALCServiceClient) CheckBlockAvailability(ctx context.Context, in *CheckBlockAvailabilityRequest, opts ...grpc.CallOption) (*CheckBlockAvailabilityResponse, error) { - out := new(CheckBlockAvailabilityResponse) - err := grpc.Invoke(ctx, "/dalc.DALCService/CheckBlockAvailability", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil } -func (c *dALCServiceClient) RetrieveBlocks(ctx context.Context, in *RetrieveBlocksRequest, opts ...grpc.CallOption) (*RetrieveBlocksResponse, error) { - out := new(RetrieveBlocksResponse) - err := grpc.Invoke(ctx, "/dalc.DALCService/RetrieveBlocks", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for DALCService service - -type DALCServiceServer interface { - SubmitBlock(context.Context, *SubmitBlockRequest) (*SubmitBlockResponse, error) - CheckBlockAvailability(context.Context, *CheckBlockAvailabilityRequest) (*CheckBlockAvailabilityResponse, error) - RetrieveBlocks(context.Context, *RetrieveBlocksRequest) (*RetrieveBlocksResponse, error) -} - -func RegisterDALCServiceServer(s *grpc.Server, srv DALCServiceServer) { - s.RegisterService(&_DALCService_serviceDesc, srv) -} - -func _DALCService_SubmitBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SubmitBlockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DALCServiceServer).SubmitBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/dalc.DALCService/SubmitBlock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DALCServiceServer).SubmitBlock(ctx, req.(*SubmitBlockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _DALCService_CheckBlockAvailability_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CheckBlockAvailabilityRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DALCServiceServer).CheckBlockAvailability(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/dalc.DALCService/CheckBlockAvailability", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DALCServiceServer).CheckBlockAvailability(ctx, req.(*CheckBlockAvailabilityRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _DALCService_RetrieveBlocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RetrieveBlocksRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DALCServiceServer).RetrieveBlocks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/dalc.DALCService/RetrieveBlocks", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DALCServiceServer).RetrieveBlocks(ctx, req.(*RetrieveBlocksRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _DALCService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "dalc.DALCService", - HandlerType: (*DALCServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SubmitBlock", - Handler: _DALCService_SubmitBlock_Handler, - }, - { - MethodName: "CheckBlockAvailability", - Handler: _DALCService_CheckBlockAvailability_Handler, - }, - { - MethodName: "RetrieveBlocks", - Handler: _DALCService_RetrieveBlocks_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "dalc/dalc.proto", +func init() { proto.RegisterFile("dalc/dalc.proto", fileDescriptor_45d7d8eda2693dc1) } + +var fileDescriptor_45d7d8eda2693dc1 = []byte{ + // 527 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xda, 0x4c, + 0x10, 0xc7, 0x31, 0xf0, 0xf1, 0xb5, 0x83, 0x0a, 0x64, 0xa3, 0x04, 0x97, 0xb4, 0x16, 0x72, 0x13, + 0x15, 0x45, 0x2a, 0x48, 0xf4, 0xd8, 0x43, 0x45, 0x8c, 0xdb, 0xa2, 0x26, 0xa5, 0x5a, 0xc3, 0xa5, + 0x17, 0x64, 0x9b, 0x11, 0xac, 0x30, 0x31, 0xf1, 0x2e, 0xa8, 0x3c, 0x42, 0x6f, 0x7d, 0xac, 0x1e, + 0x73, 0xec, 0xb1, 0x82, 0x17, 0xa9, 0xbc, 0x36, 0x84, 0xa4, 0x6e, 0xa4, 0xf4, 0x62, 0xed, 0xce, + 0x6f, 0x67, 0xe6, 0x3f, 0x9e, 0xd1, 0x40, 0x71, 0x68, 0x7b, 0x6e, 0x23, 0xfc, 0xd4, 0x67, 0x81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53, 0xae, 0x57, 0x9a, 0xf2, + 0x6b, 0xa5, 0x29, 0xdf, 0xd7, 0x5a, 0xea, 0x7a, 0xad, 0xa5, 0x7e, 0xae, 0xb5, 0xd4, 0x97, 0x57, + 0x23, 0x26, 0xc6, 0x73, 0xa7, 0xee, 0xfa, 0xd3, 0x86, 0x8b, 0x1e, 0x72, 0xc1, 0x6c, 0x3f, 0x18, + 0x6d, 0x57, 0x45, 0x43, 0x2c, 0x67, 0xc8, 0x1b, 0x33, 0x47, 0xee, 0x15, 0x27, 0x27, 0x37, 0xc7, + 0xeb, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x72, 0xc7, 0x7f, 0x66, 0x6b, 0x04, 0x00, 0x00, } func (m *DAResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -380,33 +455,39 @@ func (m *DAResponse) Marshal() (dAtA []byte, err error) { } func (m *DAResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DAResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintDalc(dAtA, i, uint64(m.Code)) + if m.DataLayerHeight != 0 { + i = encodeVarintDalc(dAtA, i, uint64(m.DataLayerHeight)) + i-- + dAtA[i] = 0x18 } if len(m.Message) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Message) + copy(dAtA[i:], m.Message) i = encodeVarintDalc(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) + i-- + dAtA[i] = 0x12 } - if m.DataLayerHeight != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintDalc(dAtA, i, uint64(m.DataLayerHeight)) + if m.Code != 0 { + i = encodeVarintDalc(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *SubmitBlockRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -414,27 +495,34 @@ func (m *SubmitBlockRequest) Marshal() (dAtA []byte, err error) { } func (m *SubmitBlockRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SubmitBlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.Block != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintDalc(dAtA, i, uint64(m.Block.Size())) - n1, err := m.Block.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Block.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDalc(dAtA, i, uint64(size)) } - i += n1 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *SubmitBlockResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -442,27 +530,34 @@ func (m *SubmitBlockResponse) Marshal() (dAtA []byte, err error) { } func (m *SubmitBlockResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SubmitBlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.Result != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintDalc(dAtA, i, uint64(m.Result.Size())) - n2, err := m.Result.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDalc(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *CheckBlockAvailabilityRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -470,22 +565,27 @@ func (m *CheckBlockAvailabilityRequest) Marshal() (dAtA []byte, err error) { } func (m *CheckBlockAvailabilityRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CheckBlockAvailabilityRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.DataLayerHeight != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintDalc(dAtA, i, uint64(m.DataLayerHeight)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *CheckBlockAvailabilityResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -493,37 +593,44 @@ func (m *CheckBlockAvailabilityResponse) Marshal() (dAtA []byte, err error) { } func (m *CheckBlockAvailabilityResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CheckBlockAvailabilityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Result != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintDalc(dAtA, i, uint64(m.Result.Size())) - n3, err := m.Result.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } if m.DataAvailable { - dAtA[i] = 0x10 - i++ + i-- if m.DataAvailable { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x10 + } + if m.Result != nil { + { + size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDalc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RetrieveBlocksRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -531,22 +638,27 @@ func (m *RetrieveBlocksRequest) Marshal() (dAtA []byte, err error) { } func (m *RetrieveBlocksRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RetrieveBlocksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.DataLayerHeight != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintDalc(dAtA, i, uint64(m.DataLayerHeight)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *RetrieveBlocksResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -554,63 +666,59 @@ func (m *RetrieveBlocksResponse) Marshal() (dAtA []byte, err error) { } func (m *RetrieveBlocksResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RetrieveBlocksResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Result != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintDalc(dAtA, i, uint64(m.Result.Size())) - n4, err := m.Result.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } if len(m.Blocks) > 0 { - for _, msg := range m.Blocks { + for iNdEx := len(m.Blocks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Blocks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDalc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintDalc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Result != nil { + { + size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintDalc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } -func encodeFixed64Dalc(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Dalc(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintDalc(dAtA []byte, offset int, v uint64) int { + offset -= sovDalc(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *DAResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Code != 0 { @@ -627,6 +735,9 @@ func (m *DAResponse) Size() (n int) { } func (m *SubmitBlockRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Block != nil { @@ -637,6 +748,9 @@ func (m *SubmitBlockRequest) Size() (n int) { } func (m *SubmitBlockResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Result != nil { @@ -647,6 +761,9 @@ func (m *SubmitBlockResponse) Size() (n int) { } func (m *CheckBlockAvailabilityRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.DataLayerHeight != 0 { @@ -656,6 +773,9 @@ func (m *CheckBlockAvailabilityRequest) Size() (n int) { } func (m *CheckBlockAvailabilityResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Result != nil { @@ -669,6 +789,9 @@ func (m *CheckBlockAvailabilityResponse) Size() (n int) { } func (m *RetrieveBlocksRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.DataLayerHeight != 0 { @@ -678,6 +801,9 @@ func (m *RetrieveBlocksRequest) Size() (n int) { } func (m *RetrieveBlocksResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Result != nil { @@ -694,14 +820,7 @@ func (m *RetrieveBlocksResponse) Size() (n int) { } func sovDalc(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozDalc(x uint64) (n int) { return sovDalc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -721,7 +840,7 @@ func (m *DAResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -749,7 +868,7 @@ func (m *DAResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (StatusCode(b) & 0x7F) << shift + m.Code |= StatusCode(b&0x7F) << shift if b < 0x80 { break } @@ -768,7 +887,7 @@ func (m *DAResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -778,6 +897,9 @@ func (m *DAResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthDalc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDalc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -797,7 +919,7 @@ func (m *DAResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DataLayerHeight |= (uint64(b) & 0x7F) << shift + m.DataLayerHeight |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -808,7 +930,7 @@ func (m *DAResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDalc } if (iNdEx + skippy) > l { @@ -838,7 +960,7 @@ func (m *SubmitBlockRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -866,7 +988,7 @@ func (m *SubmitBlockRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -875,6 +997,9 @@ func (m *SubmitBlockRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthDalc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDalc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -891,7 +1016,7 @@ func (m *SubmitBlockRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDalc } if (iNdEx + skippy) > l { @@ -921,7 +1046,7 @@ func (m *SubmitBlockResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -949,7 +1074,7 @@ func (m *SubmitBlockResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -958,6 +1083,9 @@ func (m *SubmitBlockResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthDalc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDalc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -974,7 +1102,7 @@ func (m *SubmitBlockResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDalc } if (iNdEx + skippy) > l { @@ -1004,7 +1132,7 @@ func (m *CheckBlockAvailabilityRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1032,7 +1160,7 @@ func (m *CheckBlockAvailabilityRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DataLayerHeight |= (uint64(b) & 0x7F) << shift + m.DataLayerHeight |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1043,7 +1171,7 @@ func (m *CheckBlockAvailabilityRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDalc } if (iNdEx + skippy) > l { @@ -1073,7 +1201,7 @@ func (m *CheckBlockAvailabilityResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1101,7 +1229,7 @@ func (m *CheckBlockAvailabilityResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1110,6 +1238,9 @@ func (m *CheckBlockAvailabilityResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthDalc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDalc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1134,7 +1265,7 @@ func (m *CheckBlockAvailabilityResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1146,7 +1277,7 @@ func (m *CheckBlockAvailabilityResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDalc } if (iNdEx + skippy) > l { @@ -1176,7 +1307,7 @@ func (m *RetrieveBlocksRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1204,7 +1335,7 @@ func (m *RetrieveBlocksRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DataLayerHeight |= (uint64(b) & 0x7F) << shift + m.DataLayerHeight |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1215,7 +1346,7 @@ func (m *RetrieveBlocksRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDalc } if (iNdEx + skippy) > l { @@ -1245,7 +1376,7 @@ func (m *RetrieveBlocksResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1273,7 +1404,7 @@ func (m *RetrieveBlocksResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1282,6 +1413,9 @@ func (m *RetrieveBlocksResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthDalc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDalc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1306,7 +1440,7 @@ func (m *RetrieveBlocksResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1315,6 +1449,9 @@ func (m *RetrieveBlocksResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthDalc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDalc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1329,7 +1466,7 @@ func (m *RetrieveBlocksResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDalc } if (iNdEx + skippy) > l { @@ -1347,6 +1484,7 @@ func (m *RetrieveBlocksResponse) Unmarshal(dAtA []byte) error { func skipDalc(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1378,10 +1516,8 @@ func skipDalc(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1398,92 +1534,34 @@ func skipDalc(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthDalc } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDalc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipDalc(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDalc + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthDalc + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthDalc = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDalc = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthDalc = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDalc = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDalc = fmt.Errorf("proto: unexpected end of group") ) - -func init() { proto.RegisterFile("dalc/dalc.proto", fileDescriptorDalc) } - -var fileDescriptorDalc = []byte{ - // 518 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x51, 0x6f, 0x12, 0x41, - 0x10, 0xc7, 0x39, 0x40, 0xd4, 0x21, 0x02, 0xdd, 0xa6, 0xe5, 0xa4, 0x4a, 0xc8, 0xd9, 0x46, 0xd2, - 0x44, 0x48, 0xf0, 0xd1, 0x87, 0x86, 0x1e, 0x67, 0x24, 0xb6, 0x62, 0xf6, 0xe0, 0xc5, 0x17, 0xb2, - 0x77, 0x4c, 0x60, 0xc3, 0xd1, 0xa3, 0xb7, 0x0b, 0x91, 0x8f, 0xe0, 0x37, 0xf0, 0x23, 0xf9, 0xe8, - 0x47, 0x30, 0xf8, 0x45, 0xcc, 0xed, 0x1d, 0x94, 0xd6, 0xb3, 0x49, 0x7d, 0xb9, 0xec, 0xce, 0x6f, - 0x67, 0xe6, 0x3f, 0x37, 0x93, 0x81, 0xe2, 0x88, 0x79, 0x6e, 0x33, 0xfc, 0x34, 0xe6, 0x81, 0x2f, - 0x7d, 0x92, 0x0d, 0xcf, 0x95, 0xb2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be, 0xff, 0xae, 0xa6, 0xbe, 0xbc, 0x19, 0x73, 0x39, 0x59, 0x38, 0x0d, 0xd7, 0x9f, 0x35, - 0x5d, 0xf4, 0x50, 0x48, 0xce, 0xfc, 0x60, 0xbc, 0x5d, 0x11, 0x4d, 0xb9, 0x9a, 0xa3, 0x68, 0xce, - 0x1d, 0xb5, 0x4f, 0x9c, 0x9c, 0xda, 0x18, 0x6f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xbe, - 0xc3, 0x8c, 0x63, 0x04, 0x00, 0x00, -} diff --git a/types/pb/optimint/optimint.pb.go b/types/pb/optimint/optimint.pb.go index f50bda05aea..c21e7d42e73 100644 --- a/types/pb/optimint/optimint.pb.go +++ b/types/pb/optimint/optimint.pb.go @@ -1,31 +1,15 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: optimint/optimint.proto -/* - Package optimint is a generated protocol buffer package. - - It is generated from these files: - optimint/optimint.proto - - It has these top-level messages: - Version - Header - Commit - Data - Block -*/ package optimint import ( fmt "fmt" - - proto "github.com/golang/protobuf/proto" - - math "math" - - tendermint_abci "github.com/tendermint/tendermint/abci/types" - + proto "github.com/gogo/protobuf/proto" + types "github.com/tendermint/tendermint/abci/types" io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -37,7 +21,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Version captures the consensus rules for processing a block in the blockchain, // including all blockchain data structures and the rules of the application's @@ -48,10 +32,38 @@ type Version struct { App uint64 `protobuf:"varint,2,opt,name=app,proto3" json:"app,omitempty"` } -func (m *Version) Reset() { *m = Version{} } -func (m *Version) String() string { return proto.CompactTextString(m) } -func (*Version) ProtoMessage() {} -func (*Version) Descriptor() ([]byte, []int) { return fileDescriptorOptimint, []int{0} } +func (m *Version) Reset() { *m = Version{} } +func (m *Version) String() string { return proto.CompactTextString(m) } +func (*Version) ProtoMessage() {} +func (*Version) Descriptor() ([]byte, []int) { + return fileDescriptor_c876654a788c67ff, []int{0} +} +func (m *Version) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Version.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(m, src) +} +func (m *Version) XXX_Size() int { + return m.Size() +} +func (m *Version) XXX_DiscardUnknown() { + xxx_messageInfo_Version.DiscardUnknown(m) +} + +var xxx_messageInfo_Version proto.InternalMessageInfo func (m *Version) GetBlock() uint64 { if m != nil { @@ -69,7 +81,7 @@ func (m *Version) GetApp() uint64 { type Header struct { // Block and App version - Version *Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + Version *Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // NamespaceID identifies this chain e.g. when connected to other rollups via IBC. NamespaceId []byte `protobuf:"bytes,2,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` // Block height @@ -100,10 +112,38 @@ type Header struct { AggregatorsHash []byte `protobuf:"bytes,12,opt,name=aggregators_hash,json=aggregatorsHash,proto3" json:"aggregators_hash,omitempty"` } -func (m *Header) Reset() { *m = Header{} } -func (m *Header) String() string { return proto.CompactTextString(m) } -func (*Header) ProtoMessage() {} -func (*Header) Descriptor() ([]byte, []int) { return fileDescriptorOptimint, []int{1} } +func (m *Header) Reset() { *m = Header{} } +func (m *Header) String() string { return proto.CompactTextString(m) } +func (*Header) ProtoMessage() {} +func (*Header) Descriptor() ([]byte, []int) { + return fileDescriptor_c876654a788c67ff, []int{1} +} +func (m *Header) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Header.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) +} +func (m *Header) XXX_Size() int { + return m.Size() +} +func (m *Header) XXX_DiscardUnknown() { + xxx_messageInfo_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_Header proto.InternalMessageInfo func (m *Header) GetVersion() *Version { if m != nil { @@ -193,13 +233,41 @@ type Commit struct { Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` HeaderHash []byte `protobuf:"bytes,2,opt,name=header_hash,json=headerHash,proto3" json:"header_hash,omitempty"` // Note: most of the time this will be a single sinature - Signatures [][]byte `protobuf:"bytes,3,rep,name=signatures" json:"signatures,omitempty"` + Signatures [][]byte `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"` +} + +func (m *Commit) Reset() { *m = Commit{} } +func (m *Commit) String() string { return proto.CompactTextString(m) } +func (*Commit) ProtoMessage() {} +func (*Commit) Descriptor() ([]byte, []int) { + return fileDescriptor_c876654a788c67ff, []int{2} +} +func (m *Commit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Commit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Commit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Commit) XXX_Merge(src proto.Message) { + xxx_messageInfo_Commit.Merge(m, src) +} +func (m *Commit) XXX_Size() int { + return m.Size() +} +func (m *Commit) XXX_DiscardUnknown() { + xxx_messageInfo_Commit.DiscardUnknown(m) } -func (m *Commit) Reset() { *m = Commit{} } -func (m *Commit) String() string { return proto.CompactTextString(m) } -func (*Commit) ProtoMessage() {} -func (*Commit) Descriptor() ([]byte, []int) { return fileDescriptorOptimint, []int{2} } +var xxx_messageInfo_Commit proto.InternalMessageInfo func (m *Commit) GetHeight() uint64 { if m != nil { @@ -223,15 +291,43 @@ func (m *Commit) GetSignatures() [][]byte { } type Data struct { - Txs [][]byte `protobuf:"bytes,1,rep,name=txs" json:"txs,omitempty"` - IntermediateStateRoots [][]byte `protobuf:"bytes,2,rep,name=intermediate_state_roots,json=intermediateStateRoots" json:"intermediate_state_roots,omitempty"` - Evidence []*tendermint_abci.Evidence `protobuf:"bytes,3,rep,name=evidence" json:"evidence,omitempty"` + Txs [][]byte `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` + IntermediateStateRoots [][]byte `protobuf:"bytes,2,rep,name=intermediate_state_roots,json=intermediateStateRoots,proto3" json:"intermediate_state_roots,omitempty"` + Evidence []*types.Evidence `protobuf:"bytes,3,rep,name=evidence,proto3" json:"evidence,omitempty"` } -func (m *Data) Reset() { *m = Data{} } -func (m *Data) String() string { return proto.CompactTextString(m) } -func (*Data) ProtoMessage() {} -func (*Data) Descriptor() ([]byte, []int) { return fileDescriptorOptimint, []int{3} } +func (m *Data) Reset() { *m = Data{} } +func (m *Data) String() string { return proto.CompactTextString(m) } +func (*Data) ProtoMessage() {} +func (*Data) Descriptor() ([]byte, []int) { + return fileDescriptor_c876654a788c67ff, []int{3} +} +func (m *Data) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Data.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Data) XXX_Merge(src proto.Message) { + xxx_messageInfo_Data.Merge(m, src) +} +func (m *Data) XXX_Size() int { + return m.Size() +} +func (m *Data) XXX_DiscardUnknown() { + xxx_messageInfo_Data.DiscardUnknown(m) +} + +var xxx_messageInfo_Data proto.InternalMessageInfo func (m *Data) GetTxs() [][]byte { if m != nil { @@ -247,7 +343,7 @@ func (m *Data) GetIntermediateStateRoots() [][]byte { return nil } -func (m *Data) GetEvidence() []*tendermint_abci.Evidence { +func (m *Data) GetEvidence() []*types.Evidence { if m != nil { return m.Evidence } @@ -255,15 +351,43 @@ func (m *Data) GetEvidence() []*tendermint_abci.Evidence { } type Block struct { - Header *Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - Data *Data `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` - LastCommit *Commit `protobuf:"bytes,3,opt,name=last_commit,json=lastCommit" json:"last_commit,omitempty"` + Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + LastCommit *Commit `protobuf:"bytes,3,opt,name=last_commit,json=lastCommit,proto3" json:"last_commit,omitempty"` } -func (m *Block) Reset() { *m = Block{} } -func (m *Block) String() string { return proto.CompactTextString(m) } -func (*Block) ProtoMessage() {} -func (*Block) Descriptor() ([]byte, []int) { return fileDescriptorOptimint, []int{4} } +func (m *Block) Reset() { *m = Block{} } +func (m *Block) String() string { return proto.CompactTextString(m) } +func (*Block) ProtoMessage() {} +func (*Block) Descriptor() ([]byte, []int) { + return fileDescriptor_c876654a788c67ff, []int{4} +} +func (m *Block) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Block.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Block) XXX_Merge(src proto.Message) { + xxx_messageInfo_Block.Merge(m, src) +} +func (m *Block) XXX_Size() int { + return m.Size() +} +func (m *Block) XXX_DiscardUnknown() { + xxx_messageInfo_Block.DiscardUnknown(m) +} + +var xxx_messageInfo_Block proto.InternalMessageInfo func (m *Block) GetHeader() *Header { if m != nil { @@ -293,10 +417,53 @@ func init() { proto.RegisterType((*Data)(nil), "optimint.Data") proto.RegisterType((*Block)(nil), "optimint.Block") } + +func init() { proto.RegisterFile("optimint/optimint.proto", fileDescriptor_c876654a788c67ff) } + +var fileDescriptor_c876654a788c67ff = []byte{ + // 568 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x93, 0xc1, 0x6e, 0xd4, 0x30, + 0x10, 0x86, 0x9b, 0xee, 0x76, 0x77, 0x3b, 0x29, 0x65, 0x6b, 0xa1, 0x92, 0x52, 0x29, 0x94, 0x48, + 0x48, 0x05, 0xa4, 0xac, 0x5a, 0x84, 0xc4, 0x95, 0x02, 0x52, 0x11, 0xb7, 0x20, 0x71, 0xe0, 0xb2, + 0xf2, 0x26, 0xa3, 0xc4, 0x62, 0x13, 0x5b, 0xb6, 0xb7, 0x82, 0x37, 0x80, 0x1b, 0xaf, 0xc3, 0x1b, + 0x70, 0xec, 0x91, 0x23, 0x6a, 0x5f, 0x04, 0x79, 0x9c, 0x4d, 0xb6, 0x97, 0xc8, 0xfe, 0xff, 0x2f, + 0x13, 0xcf, 0xe4, 0x37, 0x3c, 0x94, 0xca, 0x8a, 0x5a, 0x34, 0x76, 0xb6, 0x5e, 0xa4, 0x4a, 0x4b, + 0x2b, 0xd9, 0x64, 0xbd, 0x7f, 0x74, 0x6c, 0xb1, 0x29, 0x50, 0x13, 0xc4, 0x17, 0xb9, 0x98, 0xd9, + 0xef, 0x0a, 0x8d, 0xc7, 0x92, 0x33, 0x18, 0x7f, 0x46, 0x6d, 0x84, 0x6c, 0xd8, 0x03, 0xd8, 0x59, + 0x2c, 0x65, 0xfe, 0x35, 0x0a, 0x4e, 0x82, 0xd3, 0x61, 0xe6, 0x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d1, 0x98, 0x28, 0xf4, 0xe8, 0x5a, 0x7f, 0xe3, 0x65, 0x87, 0xf2, 0xb2, 0xd4, 0x58, 0x72, 0x2b, + 0x75, 0x5b, 0x75, 0xcf, 0xa3, 0x1b, 0xba, 0xab, 0x9a, 0x70, 0x18, 0xf9, 0x76, 0x37, 0x46, 0x1d, + 0xdc, 0x19, 0xf5, 0x63, 0x08, 0x37, 0x27, 0xea, 0x7f, 0x12, 0x54, 0xfd, 0x34, 0x63, 0x00, 0x23, + 0xca, 0x86, 0xdb, 0x95, 0x46, 0x13, 0x0d, 0x4e, 0x06, 0xce, 0xef, 0x95, 0xe4, 0x67, 0x00, 0xc3, + 0x77, 0xdc, 0x72, 0x97, 0x1c, 0xfb, 0xcd, 0x44, 0x01, 0x11, 0x6e, 0xc9, 0x5e, 0x43, 0x24, 0x1a, + 0x8b, 0xba, 0xc6, 0x42, 0x70, 0x8b, 0x73, 0x63, 0xdd, 0x53, 0x4b, 0x69, 0x4d, 0xb4, 0x4d, 0xd8, + 0xe1, 0xa6, 0xff, 0xc9, 0xd9, 0x99, 0x73, 0xd9, 0x2b, 0x98, 0xe0, 0x95, 0x28, 0xb0, 0xc9, 0x91, + 0x3e, 0x19, 0x9e, 0x1f, 0xa5, 0x7d, 0xac, 0x53, 0x17, 0xeb, 0xf4, 0x7d, 0x0b, 0x64, 0x1d, 0x9a, + 0xfc, 0x08, 0x60, 0xe7, 0x82, 0x62, 0x7c, 0xea, 0xda, 0x75, 0x3d, 0xb4, 0x41, 0x9d, 0xf6, 0x41, + 0xf5, 0x49, 0xc9, 0x5a, 0x9f, 0x25, 0x30, 0x74, 0xbf, 0x9c, 0x3a, 0x0f, 0xcf, 0xf7, 0x7b, 0xce, + 0x35, 0x95, 0x91, 0xc7, 0xce, 0x20, 0xdc, 0x48, 0x14, 0x85, 0xf5, 0x4e, 0x49, 0x3f, 0xe3, 0x0c, + 0xfa, 0x78, 0x5d, 0x7c, 0xfc, 0x73, 0x13, 0x07, 0xd7, 0x37, 0x71, 0xf0, 0xef, 0x26, 0x0e, 0x7e, + 0xdd, 0xc6, 0x5b, 0xd7, 0xb7, 0xf1, 0xd6, 0xdf, 0xdb, 0x78, 0xeb, 0xcb, 0x59, 0x29, 0x6c, 0xb5, + 0x5a, 0xa4, 0xb9, 0xac, 0x67, 0x39, 0x2e, 0xd1, 0x58, 0xc1, 0xa5, 0x2e, 0xbb, 0x0b, 0xed, 0xef, + 0xeb, 0x4c, 0x2d, 0x3a, 0x65, 0x31, 0xa2, 0xcb, 0xfb, 0xf2, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xc5, 0xd1, 0xe5, 0xa6, 0xfe, 0x03, 0x00, 0x00, +} + func (m *Version) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -304,27 +471,32 @@ func (m *Version) Marshal() (dAtA []byte, err error) { } func (m *Version) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Block != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(m.Block)) - } if m.App != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintOptimint(dAtA, i, uint64(m.App)) + i-- + dAtA[i] = 0x10 + } + if m.Block != 0 { + i = encodeVarintOptimint(dAtA, i, uint64(m.Block)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Header) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -332,91 +504,107 @@ func (m *Header) Marshal() (dAtA []byte, err error) { } func (m *Header) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Version != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintOptimint(dAtA, i, uint64(m.Version.Size())) - n1, err := m.Version.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if len(m.NamespaceId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(m.NamespaceId))) - i += copy(dAtA[i:], m.NamespaceId) + if len(m.AggregatorsHash) > 0 { + i -= len(m.AggregatorsHash) + copy(dAtA[i:], m.AggregatorsHash) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.AggregatorsHash))) + i-- + dAtA[i] = 0x62 } - if m.Height != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(m.Height)) + if len(m.ProposerAddress) > 0 { + i -= len(m.ProposerAddress) + copy(dAtA[i:], m.ProposerAddress) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.ProposerAddress))) + i-- + dAtA[i] = 0x5a } - if m.Time != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(m.Time)) + if len(m.LastResultsHash) > 0 { + i -= len(m.LastResultsHash) + copy(dAtA[i:], m.LastResultsHash) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.LastResultsHash))) + i-- + dAtA[i] = 0x52 } - if len(m.LastHeaderHash) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(m.LastHeaderHash))) - i += copy(dAtA[i:], m.LastHeaderHash) + if len(m.AppHash) > 0 { + i -= len(m.AppHash) + copy(dAtA[i:], m.AppHash) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.AppHash))) + i-- + dAtA[i] = 0x4a } - if len(m.LastCommitHash) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(m.LastCommitHash))) - i += copy(dAtA[i:], m.LastCommitHash) + if len(m.ConsensusHash) > 0 { + i -= len(m.ConsensusHash) + copy(dAtA[i:], m.ConsensusHash) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.ConsensusHash))) + i-- + dAtA[i] = 0x42 } if len(m.DataHash) > 0 { - dAtA[i] = 0x3a - i++ + i -= len(m.DataHash) + copy(dAtA[i:], m.DataHash) i = encodeVarintOptimint(dAtA, i, uint64(len(m.DataHash))) - i += copy(dAtA[i:], m.DataHash) + i-- + dAtA[i] = 0x3a } - if len(m.ConsensusHash) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(m.ConsensusHash))) - i += copy(dAtA[i:], m.ConsensusHash) + if len(m.LastCommitHash) > 0 { + i -= len(m.LastCommitHash) + copy(dAtA[i:], m.LastCommitHash) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.LastCommitHash))) + i-- + dAtA[i] = 0x32 } - if len(m.AppHash) > 0 { - dAtA[i] = 0x4a - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(m.AppHash))) - i += copy(dAtA[i:], m.AppHash) + if len(m.LastHeaderHash) > 0 { + i -= len(m.LastHeaderHash) + copy(dAtA[i:], m.LastHeaderHash) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.LastHeaderHash))) + i-- + dAtA[i] = 0x2a } - if len(m.LastResultsHash) > 0 { - dAtA[i] = 0x52 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(m.LastResultsHash))) - i += copy(dAtA[i:], m.LastResultsHash) + if m.Time != 0 { + i = encodeVarintOptimint(dAtA, i, uint64(m.Time)) + i-- + dAtA[i] = 0x20 } - if len(m.ProposerAddress) > 0 { - dAtA[i] = 0x5a - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(m.ProposerAddress))) - i += copy(dAtA[i:], m.ProposerAddress) + if m.Height != 0 { + i = encodeVarintOptimint(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 } - if len(m.AggregatorsHash) > 0 { - dAtA[i] = 0x62 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(m.AggregatorsHash))) - i += copy(dAtA[i:], m.AggregatorsHash) + if len(m.NamespaceId) > 0 { + i -= len(m.NamespaceId) + copy(dAtA[i:], m.NamespaceId) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.NamespaceId))) + i-- + dAtA[i] = 0x12 } - return i, nil + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOptimint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Commit) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -424,36 +612,43 @@ func (m *Commit) Marshal() (dAtA []byte, err error) { } func (m *Commit) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(m.Height)) + if len(m.Signatures) > 0 { + for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Signatures[iNdEx]) + copy(dAtA[i:], m.Signatures[iNdEx]) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.Signatures[iNdEx]))) + i-- + dAtA[i] = 0x1a + } } if len(m.HeaderHash) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.HeaderHash) + copy(dAtA[i:], m.HeaderHash) i = encodeVarintOptimint(dAtA, i, uint64(len(m.HeaderHash))) - i += copy(dAtA[i:], m.HeaderHash) + i-- + dAtA[i] = 0x12 } - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - dAtA[i] = 0x1a - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } + if m.Height != 0 { + i = encodeVarintOptimint(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Data) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -461,45 +656,54 @@ func (m *Data) Marshal() (dAtA []byte, err error) { } func (m *Data) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Txs) > 0 { - for _, b := range m.Txs { - dAtA[i] = 0xa - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) + if len(m.Evidence) > 0 { + for iNdEx := len(m.Evidence) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Evidence[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOptimint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } } if len(m.IntermediateStateRoots) > 0 { - for _, b := range m.IntermediateStateRoots { + for iNdEx := len(m.IntermediateStateRoots) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.IntermediateStateRoots[iNdEx]) + copy(dAtA[i:], m.IntermediateStateRoots[iNdEx]) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.IntermediateStateRoots[iNdEx]))) + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) } } - if len(m.Evidence) > 0 { - for _, msg := range m.Evidence { - dAtA[i] = 0x1a - i++ - i = encodeVarintOptimint(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + if len(m.Txs) > 0 { + for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Txs[iNdEx]) + copy(dAtA[i:], m.Txs[iNdEx]) + i = encodeVarintOptimint(dAtA, i, uint64(len(m.Txs[iNdEx]))) + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *Block) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -507,71 +711,69 @@ func (m *Block) Marshal() (dAtA []byte, err error) { } func (m *Block) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Block) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintOptimint(dAtA, i, uint64(m.Header.Size())) - n2, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.LastCommit != nil { + { + size, err := m.LastCommit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOptimint(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x1a } if m.Data != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintOptimint(dAtA, i, uint64(m.Data.Size())) - n3, err := m.Data.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOptimint(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x12 } - if m.LastCommit != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintOptimint(dAtA, i, uint64(m.LastCommit.Size())) - n4, err := m.LastCommit.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOptimint(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } -func encodeFixed64Optimint(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Optimint(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintOptimint(dAtA []byte, offset int, v uint64) int { + offset -= sovOptimint(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Version) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Block != 0 { @@ -584,6 +786,9 @@ func (m *Version) Size() (n int) { } func (m *Header) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Version != nil { @@ -636,6 +841,9 @@ func (m *Header) Size() (n int) { } func (m *Commit) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Height != 0 { @@ -655,6 +863,9 @@ func (m *Commit) Size() (n int) { } func (m *Data) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.Txs) > 0 { @@ -679,6 +890,9 @@ func (m *Data) Size() (n int) { } func (m *Block) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -697,14 +911,7 @@ func (m *Block) Size() (n int) { } func sovOptimint(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozOptimint(x uint64) (n int) { return sovOptimint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -724,7 +931,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -752,7 +959,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Block |= (uint64(b) & 0x7F) << shift + m.Block |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -771,7 +978,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.App |= (uint64(b) & 0x7F) << shift + m.App |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -782,7 +989,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthOptimint } if (iNdEx + skippy) > l { @@ -812,7 +1019,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -840,7 +1047,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -849,6 +1056,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -873,7 +1083,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -882,6 +1092,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -904,7 +1117,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (uint64(b) & 0x7F) << shift + m.Height |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -923,7 +1136,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Time |= (uint64(b) & 0x7F) << shift + m.Time |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -942,7 +1155,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -951,6 +1164,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -973,7 +1189,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -982,6 +1198,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1004,7 +1223,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1013,6 +1232,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1035,7 +1257,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1044,6 +1266,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1066,7 +1291,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1075,6 +1300,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1097,7 +1325,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1106,6 +1334,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1128,7 +1359,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1137,6 +1368,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1159,7 +1393,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1168,6 +1402,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1182,7 +1419,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthOptimint } if (iNdEx + skippy) > l { @@ -1212,7 +1449,7 @@ func (m *Commit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1240,7 +1477,7 @@ func (m *Commit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (uint64(b) & 0x7F) << shift + m.Height |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1259,7 +1496,7 @@ func (m *Commit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1268,6 +1505,9 @@ func (m *Commit) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1290,7 +1530,7 @@ func (m *Commit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1299,6 +1539,9 @@ func (m *Commit) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1311,7 +1554,7 @@ func (m *Commit) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthOptimint } if (iNdEx + skippy) > l { @@ -1341,7 +1584,7 @@ func (m *Data) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1369,7 +1612,7 @@ func (m *Data) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1378,6 +1621,9 @@ func (m *Data) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1398,7 +1644,7 @@ func (m *Data) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1407,6 +1653,9 @@ func (m *Data) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1427,7 +1676,7 @@ func (m *Data) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1436,10 +1685,13 @@ func (m *Data) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Evidence = append(m.Evidence, &tendermint_abci.Evidence{}) + m.Evidence = append(m.Evidence, &types.Evidence{}) if err := m.Evidence[len(m.Evidence)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1450,7 +1702,7 @@ func (m *Data) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthOptimint } if (iNdEx + skippy) > l { @@ -1480,7 +1732,7 @@ func (m *Block) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1508,7 +1760,7 @@ func (m *Block) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1517,6 +1769,9 @@ func (m *Block) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1541,7 +1796,7 @@ func (m *Block) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1550,6 +1805,9 @@ func (m *Block) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1574,7 +1832,7 @@ func (m *Block) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1583,6 +1841,9 @@ func (m *Block) Unmarshal(dAtA []byte) error { return ErrInvalidLengthOptimint } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOptimint + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1599,7 +1860,7 @@ func (m *Block) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthOptimint } if (iNdEx + skippy) > l { @@ -1617,6 +1878,7 @@ func (m *Block) Unmarshal(dAtA []byte) error { func skipOptimint(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1648,10 +1910,8 @@ func skipOptimint(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1668,94 +1928,34 @@ func skipOptimint(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthOptimint } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowOptimint - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipOptimint(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOptimint + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthOptimint + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthOptimint = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOptimint = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthOptimint = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOptimint = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOptimint = fmt.Errorf("proto: unexpected end of group") ) - -func init() { proto.RegisterFile("optimint/optimint.proto", fileDescriptorOptimint) } - -var fileDescriptorOptimint = []byte{ - // 558 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x93, 0xd1, 0x6e, 0xd3, 0x30, - 0x14, 0x86, 0xc9, 0xda, 0xb5, 0xdd, 0xc9, 0x18, 0x9d, 0x85, 0x46, 0xc6, 0xa4, 0x32, 0x22, 0x21, - 0x15, 0x90, 0x52, 0xb5, 0x08, 0x89, 0x5b, 0x36, 0x90, 0xc6, 0x6d, 0x90, 0xb8, 0xe0, 0xa6, 0x72, - 0x93, 0xa3, 0xc4, 0xa2, 0x89, 0x2d, 0xdb, 0x9d, 0xe0, 0x0d, 0xe0, 0x0d, 0x78, 0x15, 0xde, 0x80, - 0x4b, 0x1e, 0x01, 0x95, 0x17, 0x41, 0x3e, 0x4e, 0x93, 0xee, 0x26, 0xb2, 0xff, 0xff, 0xcb, 0x89, - 0xcf, 0xc9, 0x6f, 0x78, 0x24, 0x95, 0x15, 0x95, 0xa8, 0xed, 0x6c, 0xb7, 0x48, 0x94, 0x96, 0x56, - 0xb2, 0xd1, 0x6e, 0xff, 0xf8, 0xc2, 0x62, 0x9d, 0xa3, 0x26, 0x88, 0xaf, 0x32, 0x31, 0xb3, 0xdf, - 0x14, 0x1a, 0x8f, 0xc5, 0x73, 0x18, 0x7e, 0x42, 0x6d, 0x84, 0xac, 0xd9, 0x43, 0x38, 0x5c, 0xad, - 0x65, 0xf6, 0x25, 0x0a, 0x2e, 0x83, 0x69, 0x3f, 0xf5, 0x1b, 0x36, 0x86, 0x1e, 0x57, 0x2a, 0x3a, - 0x20, 0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, 0x37, - 0xb9, 0xf7, 0x79, 0x5e, 0x08, 0x5b, 0x6e, 0x56, 0x49, 0x26, 0xab, 0x59, 0x86, 0x6b, 0x34, 0x56, - 0x70, 0xa9, 0x8b, 0xf6, 0x22, 0xfb, 0x7b, 0x3a, 0x53, 0xab, 0x56, 0x59, 0x0d, 0xe8, 0xd2, 0xbe, - 0xfa, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x67, 0x81, 0x08, 0xf6, 0x03, 0x00, 0x00, -} From 16933e543c59df785475cc60864ffaf9e7dcddc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Wed, 13 Apr 2022 19:36:08 +0200 Subject: [PATCH 3/5] fix: make it work --- buf.gen.yaml | 7 +- proto/gen.sh | 2 +- types/pb/dalc/dalc.pb.go | 156 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 4 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index 133d8301c55..d059983c3f4 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -4,6 +4,7 @@ version: v1beta1 plugins: # The name of the plugin. - name: gogofaster - # The the relative output directory. - out: proto - + # The the relative output directory. + out: proto/pb + # Any options to provide to the plugin. + opt: Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,plugins=grpc,paths=source_relative diff --git a/proto/gen.sh b/proto/gen.sh index 60b2ef6a850..764416fda52 100755 --- a/proto/gen.sh +++ b/proto/gen.sh @@ -7,4 +7,4 @@ TARGET_DIR=./types/pb cd $SCRIPT_DIR rm -rf $TARGET_DIR/* docker run -v $PWD:/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./proto/protoc.sh -cp -r ./proto/github.com/celestiaorg/optimint/types/pb/* $TARGET_DIR/ +cp -r ./proto/pb/* $TARGET_DIR/ diff --git a/types/pb/dalc/dalc.pb.go b/types/pb/dalc/dalc.pb.go index 5c9536fe819..c89e04c32fa 100644 --- a/types/pb/dalc/dalc.pb.go +++ b/types/pb/dalc/dalc.pb.go @@ -4,9 +4,13 @@ package dalc import ( + context "context" fmt "fmt" optimint "github.com/celestiaorg/optimint/types/pb/optimint" proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" io "io" math "math" math_bits "math/bits" @@ -444,6 +448,158 @@ var fileDescriptor_45d7d8eda2693dc1 = []byte{ 0xeb, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x72, 0xc7, 0x7f, 0x66, 0x6b, 0x04, 0x00, 0x00, } +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// DALCServiceClient is the client API for DALCService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type DALCServiceClient interface { + SubmitBlock(ctx context.Context, in *SubmitBlockRequest, opts ...grpc.CallOption) (*SubmitBlockResponse, error) + CheckBlockAvailability(ctx context.Context, in *CheckBlockAvailabilityRequest, opts ...grpc.CallOption) (*CheckBlockAvailabilityResponse, error) + RetrieveBlocks(ctx context.Context, in *RetrieveBlocksRequest, opts ...grpc.CallOption) (*RetrieveBlocksResponse, error) +} + +type dALCServiceClient struct { + cc *grpc.ClientConn +} + +func NewDALCServiceClient(cc *grpc.ClientConn) DALCServiceClient { + return &dALCServiceClient{cc} +} + +func (c *dALCServiceClient) SubmitBlock(ctx context.Context, in *SubmitBlockRequest, opts ...grpc.CallOption) (*SubmitBlockResponse, error) { + out := new(SubmitBlockResponse) + err := c.cc.Invoke(ctx, "/dalc.DALCService/SubmitBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dALCServiceClient) CheckBlockAvailability(ctx context.Context, in *CheckBlockAvailabilityRequest, opts ...grpc.CallOption) (*CheckBlockAvailabilityResponse, error) { + out := new(CheckBlockAvailabilityResponse) + err := c.cc.Invoke(ctx, "/dalc.DALCService/CheckBlockAvailability", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dALCServiceClient) RetrieveBlocks(ctx context.Context, in *RetrieveBlocksRequest, opts ...grpc.CallOption) (*RetrieveBlocksResponse, error) { + out := new(RetrieveBlocksResponse) + err := c.cc.Invoke(ctx, "/dalc.DALCService/RetrieveBlocks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DALCServiceServer is the server API for DALCService service. +type DALCServiceServer interface { + SubmitBlock(context.Context, *SubmitBlockRequest) (*SubmitBlockResponse, error) + CheckBlockAvailability(context.Context, *CheckBlockAvailabilityRequest) (*CheckBlockAvailabilityResponse, error) + RetrieveBlocks(context.Context, *RetrieveBlocksRequest) (*RetrieveBlocksResponse, error) +} + +// UnimplementedDALCServiceServer can be embedded to have forward compatible implementations. +type UnimplementedDALCServiceServer struct { +} + +func (*UnimplementedDALCServiceServer) SubmitBlock(ctx context.Context, req *SubmitBlockRequest) (*SubmitBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitBlock not implemented") +} +func (*UnimplementedDALCServiceServer) CheckBlockAvailability(ctx context.Context, req *CheckBlockAvailabilityRequest) (*CheckBlockAvailabilityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckBlockAvailability not implemented") +} +func (*UnimplementedDALCServiceServer) RetrieveBlocks(ctx context.Context, req *RetrieveBlocksRequest) (*RetrieveBlocksResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RetrieveBlocks not implemented") +} + +func RegisterDALCServiceServer(s *grpc.Server, srv DALCServiceServer) { + s.RegisterService(&_DALCService_serviceDesc, srv) +} + +func _DALCService_SubmitBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SubmitBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DALCServiceServer).SubmitBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dalc.DALCService/SubmitBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DALCServiceServer).SubmitBlock(ctx, req.(*SubmitBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DALCService_CheckBlockAvailability_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckBlockAvailabilityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DALCServiceServer).CheckBlockAvailability(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dalc.DALCService/CheckBlockAvailability", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DALCServiceServer).CheckBlockAvailability(ctx, req.(*CheckBlockAvailabilityRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DALCService_RetrieveBlocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RetrieveBlocksRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DALCServiceServer).RetrieveBlocks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dalc.DALCService/RetrieveBlocks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DALCServiceServer).RetrieveBlocks(ctx, req.(*RetrieveBlocksRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _DALCService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dalc.DALCService", + HandlerType: (*DALCServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SubmitBlock", + Handler: _DALCService_SubmitBlock_Handler, + }, + { + MethodName: "CheckBlockAvailability", + Handler: _DALCService_CheckBlockAvailability_Handler, + }, + { + MethodName: "RetrieveBlocks", + Handler: _DALCService_RetrieveBlocks_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dalc/dalc.proto", +} + func (m *DAResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) From c641368b5162427eb14cbb1f93080de745bbfc2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Wed, 13 Apr 2022 21:05:01 +0200 Subject: [PATCH 4/5] docs: add information about ./proto/gen.sh into README --- README.md | 6 ++++++ buf.gen.yaml | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5fe8f101cb1..3f484c7f919 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,12 @@ To test: go test ./... ``` +To regenerate protobuf types: + +```sh +./proto/gen.sh +``` + ## Contributing We welcome your contributions! Everyone is welcome to contribute, whether it's in the form of code, diff --git a/buf.gen.yaml b/buf.gen.yaml index d059983c3f4..2a08f8a50f8 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -6,5 +6,3 @@ plugins: - name: gogofaster # The the relative output directory. out: proto/pb - # Any options to provide to the plugin. - opt: Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,plugins=grpc,paths=source_relative From c1b448a437c4b022a8023091cc3d5c782439ef7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Wed, 13 Apr 2022 21:30:58 +0200 Subject: [PATCH 5/5] fix: add GRPC plugin to protobuf generation --- buf.gen.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buf.gen.yaml b/buf.gen.yaml index 2a08f8a50f8..c9a0e589eb0 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -6,3 +6,5 @@ plugins: - name: gogofaster # The the relative output directory. out: proto/pb + # Any options to provide to the plugin. + opt: plugins=grpc,paths=source_relative