diff --git a/modules/core/02-client/client/cli/query.go b/modules/core/02-client/client/cli/query.go index 337b142419c..b8eacf3421f 100644 --- a/modules/core/02-client/client/cli/query.go +++ b/modules/core/02-client/client/cli/query.go @@ -3,7 +3,6 @@ package cli import ( "errors" "fmt" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" diff --git a/modules/core/02-client/client/utils/utils.go b/modules/core/02-client/client/utils/utils.go index 6b4df0f6993..8b490439720 100644 --- a/modules/core/02-client/client/utils/utils.go +++ b/modules/core/02-client/client/utils/utils.go @@ -2,6 +2,8 @@ package utils import ( "context" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/client" @@ -61,7 +63,10 @@ func QueryClientStateABCI( return nil, err } + MaybeDecodeWasmData(clientCtx.Codec, anyClientState) + clientStateRes := types.NewQueryClientStateResponse(anyClientState, proofBz, proofHeight) + return clientStateRes, nil } @@ -114,6 +119,8 @@ func QueryConsensusStateABCI( return nil, err } + MaybeDecodeWasmData(clientCtx.Codec, anyConsensusState) + return types.NewQueryConsensusStateResponse(anyConsensusState, proofBz, proofHeight), nil } @@ -206,3 +213,36 @@ func QuerySelfConsensusState(clientCtx client.Context) (*ibctm.ConsensusState, i return state, height, nil } + +func MaybeDecodeWasmData(codec codec.BinaryCodec, any *codectypes.Any) { + switch any.TypeUrl { + case "/ibc.lightclients.wasm.v1.ClientState": + var state wasmtypes.ClientState + err := codec.Unmarshal(any.Value, &state) + if err == nil { + var innerAny codectypes.Any + err = codec.Unmarshal(state.Data, &innerAny) + if err == nil { + state.XInner = &wasmtypes.ClientState_Inner{Inner: &innerAny} + bts, err := state.Marshal() + if err == nil { + any.Value = bts + } + } + } + case "/ibc.lightclients.wasm.v1.ConsensusState": + var state wasmtypes.ConsensusState + err := codec.Unmarshal(any.Value, &state) + if err == nil { + var innerAny codectypes.Any + err = codec.Unmarshal(state.Data, &innerAny) + if err == nil { + state.XInner = &wasmtypes.ConsensusState_Inner{Inner: &innerAny} + bts, err := state.Marshal() + if err == nil { + any.Value = bts + } + } + } + } +} diff --git a/modules/core/02-client/keeper/grpc_query.go b/modules/core/02-client/keeper/grpc_query.go index a8e1104323c..bbdff8413f1 100644 --- a/modules/core/02-client/keeper/grpc_query.go +++ b/modules/core/02-client/keeper/grpc_query.go @@ -14,6 +14,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + utils "github.com/cosmos/ibc-go/v7/modules/core/02-client/client/utils" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" "github.com/cosmos/ibc-go/v7/modules/core/exported" @@ -45,6 +46,8 @@ func (q Keeper) ClientState(c context.Context, req *types.QueryClientStateReques return nil, status.Error(codes.Internal, err.Error()) } + utils.MaybeDecodeWasmData(q.cdc, any) + proofHeight := types.GetSelfHeight(ctx) return &types.QueryClientStateResponse{ ClientState: any, @@ -81,6 +84,9 @@ func (q Keeper) ClientStates(c context.Context, req *types.QueryClientStatesRequ } identifiedClient := types.NewIdentifiedClientState(clientID, clientState) + + utils.MaybeDecodeWasmData(q.cdc, identifiedClient.ClientState) + clientStates = append(clientStates, identifiedClient) return true, nil }) @@ -136,6 +142,8 @@ func (q Keeper) ConsensusState(c context.Context, req *types.QueryConsensusState return nil, status.Error(codes.Internal, err.Error()) } + utils.MaybeDecodeWasmData(q.cdc, any) + proofHeight := types.GetSelfHeight(ctx) return &types.QueryConsensusStateResponse{ ConsensusState: any, @@ -174,7 +182,11 @@ func (q Keeper) ConsensusStates(c context.Context, req *types.QueryConsensusStat return false, err } - consensusStates = append(consensusStates, types.NewConsensusStateWithHeight(height, consensusState)) + consensusStateWithHeight := types.NewConsensusStateWithHeight(height, consensusState) + + utils.MaybeDecodeWasmData(q.cdc, consensusStateWithHeight.ConsensusState) + + consensusStates = append(consensusStates, consensusStateWithHeight) return true, nil }) if err != nil { diff --git a/modules/core/types/codec.go b/modules/core/types/codec.go index e2c67424026..caf929d5e18 100644 --- a/modules/core/types/codec.go +++ b/modules/core/types/codec.go @@ -8,6 +8,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" localhost "github.com/cosmos/ibc-go/v7/modules/light-clients/09-localhost" + grandpa "github.com/cosmos/ibc-go/v7/modules/light-clients/10-grandpa" ) // RegisterInterfaces registers ibc types against interfaces using the global InterfaceRegistry. @@ -18,4 +19,5 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { channeltypes.RegisterInterfaces(registry) commitmenttypes.RegisterInterfaces(registry) localhost.RegisterInterfaces(registry) + grandpa.RegisterInterfaces(registry) } diff --git a/modules/light-clients/08-wasm/types/wasm.pb.go b/modules/light-clients/08-wasm/types/wasm.pb.go index 0a2f17cacb9..5bd4a99e2b7 100644 --- a/modules/light-clients/08-wasm/types/wasm.pb.go +++ b/modules/light-clients/08-wasm/types/wasm.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types1 "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" types "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -29,6 +30,9 @@ type ClientState struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` CodeId []byte `protobuf:"bytes,2,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` LatestHeight types.Height `protobuf:"bytes,3,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height" yaml:"latest_height"` + // Types that are valid to be assigned to XInner: + // *ClientState_Inner + XInner isClientState_XInner `protobuf_oneof:"_inner" json:",omitempty"` } func (m *ClientState) Reset() { *m = ClientState{} } @@ -64,12 +68,48 @@ func (m *ClientState) XXX_DiscardUnknown() { var xxx_messageInfo_ClientState proto.InternalMessageInfo +type isClientState_XInner interface { + isClientState_XInner() + MarshalTo([]byte) (int, error) + Size() int +} + +type ClientState_Inner struct { + Inner *types1.Any `protobuf:"bytes,100,opt,name=inner,proto3,oneof" json:"inner,omitempty"` +} + +func (*ClientState_Inner) isClientState_XInner() {} + +func (m *ClientState) GetXInner() isClientState_XInner { + if m != nil { + return m.XInner + } + return nil +} + +func (m *ClientState) GetInner() *types1.Any { + if x, ok := m.GetXInner().(*ClientState_Inner); ok { + return x.Inner + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ClientState) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ClientState_Inner)(nil), + } +} + // Wasm light client's ConsensusState type ConsensusState struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // timestamp that corresponds to the block height in which the ConsensusState // was stored. Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // Types that are valid to be assigned to XInner: + // *ConsensusState_Inner + XInner isConsensusState_XInner `protobuf_oneof:"_inner" json:",omitempty"` } func (m *ConsensusState) Reset() { *m = ConsensusState{} } @@ -105,10 +145,46 @@ func (m *ConsensusState) XXX_DiscardUnknown() { var xxx_messageInfo_ConsensusState proto.InternalMessageInfo +type isConsensusState_XInner interface { + isConsensusState_XInner() + MarshalTo([]byte) (int, error) + Size() int +} + +type ConsensusState_Inner struct { + Inner *types1.Any `protobuf:"bytes,100,opt,name=inner,proto3,oneof" json:"inner,omitempty"` +} + +func (*ConsensusState_Inner) isConsensusState_XInner() {} + +func (m *ConsensusState) GetXInner() isConsensusState_XInner { + if m != nil { + return m.XInner + } + return nil +} + +func (m *ConsensusState) GetInner() *types1.Any { + if x, ok := m.GetXInner().(*ConsensusState_Inner); ok { + return x.Inner + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ConsensusState) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ConsensusState_Inner)(nil), + } +} + // Wasm light client Header type Header struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Height types.Height `protobuf:"bytes,2,opt,name=height,proto3" json:"height" yaml:"height"` + // Types that are valid to be assigned to XInner: + // *Header_Inner + XInner isHeader_XInner `protobuf_oneof:"_inner" json:",omitempty"` } func (m *Header) Reset() { *m = Header{} } @@ -144,6 +220,39 @@ func (m *Header) XXX_DiscardUnknown() { var xxx_messageInfo_Header proto.InternalMessageInfo +type isHeader_XInner interface { + isHeader_XInner() + MarshalTo([]byte) (int, error) + Size() int +} + +type Header_Inner struct { + Inner *types1.Any `protobuf:"bytes,100,opt,name=inner,proto3,oneof" json:"inner,omitempty"` +} + +func (*Header_Inner) isHeader_XInner() {} + +func (m *Header) GetXInner() isHeader_XInner { + if m != nil { + return m.XInner + } + return nil +} + +func (m *Header) GetInner() *types1.Any { + if x, ok := m.GetXInner().(*Header_Inner); ok { + return x.Inner + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Header) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Header_Inner)(nil), + } +} + // Wasm light client Misbehaviour type Misbehaviour struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` @@ -194,32 +303,35 @@ func init() { } var fileDescriptor_678928ebbdee1807 = []byte{ - // 386 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x6a, 0xea, 0x40, - 0x14, 0x86, 0x13, 0xaf, 0xe4, 0x72, 0x47, 0xbd, 0x8b, 0xe0, 0xe5, 0x06, 0x91, 0x44, 0x72, 0x37, - 0x6e, 0xcc, 0x5c, 0xdb, 0x45, 0x8b, 0x9b, 0x82, 0x6e, 0x74, 0xd1, 0x8d, 0x5d, 0xb5, 0x50, 0x64, - 0x32, 0x19, 0x92, 0x81, 0x8c, 0x23, 0xce, 0x24, 0xc5, 0x37, 0xe8, 0xb2, 0x6f, 0xd0, 0x3e, 0x8e, - 0x4b, 0x97, 0x5d, 0x49, 0xd1, 0x37, 0xe8, 0x13, 0x94, 0xcc, 0x44, 0xda, 0x82, 0xa5, 0xab, 0x9c, - 0x73, 0xf2, 0xe5, 0x3f, 0xff, 0x4f, 0x0e, 0xf8, 0x47, 0x43, 0x0c, 0x53, 0x1a, 0x27, 0x12, 0xa7, - 0x94, 0xcc, 0xa5, 0x80, 0x77, 0x48, 0x30, 0x98, 0xf7, 0xd5, 0x33, 0x58, 0x2c, 0xb9, 0xe4, 0xb6, - 0x43, 0x43, 0x1c, 0x7c, 0x84, 0x02, 0xf5, 0x32, 0xef, 0xb7, 0x9a, 0x31, 0x8f, 0xb9, 0x82, 0x60, - 0x51, 0x69, 0xbe, 0xe5, 0x15, 0xa2, 0x98, 0x2f, 0x09, 0xd4, 0x7c, 0x21, 0xa7, 0x2b, 0x0d, 0xf8, - 0x8f, 0x26, 0xa8, 0x8d, 0xd4, 0xe0, 0x4a, 0x22, 0x49, 0x6c, 0x1b, 0x54, 0x23, 0x24, 0x91, 0x63, - 0x76, 0xcc, 0x6e, 0x7d, 0xaa, 0x6a, 0xfb, 0x2f, 0xf8, 0x89, 0x79, 0x44, 0x66, 0x34, 0x72, 0x2a, - 0x6a, 0x6c, 0x15, 0xed, 0x24, 0xb2, 0x6f, 0x41, 0x23, 0x45, 0x92, 0x08, 0x39, 0x4b, 0x48, 0xe1, - 0xc9, 0xf9, 0xd1, 0x31, 0xbb, 0xb5, 0x93, 0x56, 0x50, 0xb8, 0x2c, 0xb6, 0x06, 0xe5, 0xae, 0xbc, - 0x1f, 0x8c, 0x15, 0x31, 0x6c, 0xaf, 0xb7, 0x9e, 0xf1, 0xba, 0xf5, 0x9a, 0x2b, 0xc4, 0xd2, 0x81, - 0xff, 0xe9, 0x73, 0x7f, 0x5a, 0xd7, 0xbd, 0x66, 0x07, 0xd5, 0xfb, 0x27, 0xcf, 0xf0, 0xc7, 0xe0, - 0xf7, 0x88, 0xcf, 0x05, 0x99, 0x8b, 0x4c, 0x7c, 0xed, 0xb1, 0x0d, 0x7e, 0x49, 0xca, 0x88, 0x90, - 0x88, 0x2d, 0x94, 0xcb, 0xea, 0xf4, 0x7d, 0x50, 0x2a, 0x31, 0x60, 0x8d, 0x09, 0x8a, 0xc8, 0xf2, - 0xa8, 0xc2, 0x04, 0x58, 0x65, 0x8a, 0xca, 0xb7, 0x29, 0xfe, 0x94, 0x29, 0x1a, 0x3a, 0xc5, 0xc1, - 0x7e, 0x29, 0x50, 0xae, 0xeb, 0x82, 0xfa, 0x25, 0x15, 0x21, 0x49, 0x50, 0x4e, 0x79, 0x76, 0x74, - 0xa9, 0x26, 0x87, 0xd7, 0xeb, 0x9d, 0x6b, 0x6e, 0x76, 0xae, 0xf9, 0xb2, 0x73, 0xcd, 0x87, 0xbd, - 0x6b, 0x6c, 0xf6, 0xae, 0xf1, 0xbc, 0x77, 0x8d, 0x9b, 0x8b, 0x98, 0xca, 0x24, 0x0b, 0x03, 0xcc, - 0x19, 0xc4, 0x5c, 0x30, 0x2e, 0x20, 0x0d, 0x71, 0x2f, 0xe6, 0x30, 0x3f, 0x83, 0x8c, 0x47, 0x59, - 0x4a, 0x84, 0x3e, 0x9a, 0xde, 0xe1, 0x6a, 0xfe, 0x9f, 0xf7, 0xd4, 0xe1, 0xc8, 0xd5, 0x82, 0x88, - 0xd0, 0x52, 0xbf, 0xf9, 0xf4, 0x2d, 0x00, 0x00, 0xff, 0xff, 0x8b, 0xed, 0x18, 0x0a, 0x5e, 0x02, - 0x00, 0x00, + // 438 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x3f, 0x8f, 0xd3, 0x30, + 0x14, 0x8f, 0x8f, 0x12, 0xc0, 0xd7, 0x63, 0x88, 0x8a, 0x08, 0xd5, 0x29, 0x39, 0x85, 0xa5, 0x4b, + 0x6d, 0x0a, 0x03, 0xe8, 0x16, 0xc4, 0x75, 0x69, 0x07, 0x96, 0x30, 0x81, 0x84, 0x2a, 0xc7, 0x31, + 0x89, 0xa5, 0x24, 0xae, 0x62, 0x27, 0x28, 0x33, 0x4b, 0x47, 0x3e, 0x02, 0x23, 0x1f, 0xa5, 0x63, + 0x47, 0xc4, 0x50, 0xa1, 0xf6, 0x1b, 0xf0, 0x09, 0x50, 0xec, 0x54, 0x80, 0x54, 0xc4, 0xd0, 0x29, + 0xef, 0xbd, 0xfc, 0xfc, 0x7e, 0x7f, 0xa4, 0x07, 0x1f, 0xf3, 0x88, 0xe2, 0x8c, 0x27, 0xa9, 0xa2, + 0x19, 0x67, 0x85, 0x92, 0xf8, 0x23, 0x91, 0x39, 0xae, 0x27, 0xfa, 0x8b, 0x96, 0xa5, 0x50, 0xc2, + 0x71, 0x79, 0x44, 0xd1, 0x9f, 0x20, 0xa4, 0x7f, 0xd6, 0x93, 0xe1, 0x20, 0x11, 0x89, 0xd0, 0x20, + 0xdc, 0x56, 0x06, 0x3f, 0x7c, 0x94, 0x08, 0x91, 0x64, 0x0c, 0xeb, 0x2e, 0xaa, 0x3e, 0x60, 0x52, + 0x34, 0xdd, 0x2f, 0xbf, 0xe5, 0xa3, 0xa2, 0x64, 0xd8, 0xac, 0x6a, 0x99, 0x4c, 0x65, 0x00, 0xc1, + 0x77, 0x00, 0xcf, 0xa7, 0x7a, 0xf0, 0x46, 0x11, 0xc5, 0x1c, 0x07, 0xf6, 0x62, 0xa2, 0x88, 0x0b, + 0xae, 0xc0, 0xa8, 0x1f, 0xea, 0xda, 0x79, 0x08, 0xef, 0x50, 0x11, 0xb3, 0x05, 0x8f, 0xdd, 0x33, + 0x3d, 0xb6, 0xdb, 0x76, 0x1e, 0x3b, 0xef, 0xe1, 0x45, 0x46, 0x14, 0x93, 0x6a, 0x91, 0xb2, 0x56, + 0xae, 0x7b, 0xeb, 0x0a, 0x8c, 0xce, 0x9f, 0x0e, 0x51, 0x6b, 0xa0, 0x65, 0x45, 0x1d, 0x57, 0x3d, + 0x41, 0x33, 0x8d, 0xb8, 0xb9, 0x5c, 0x6f, 0x7d, 0xeb, 0xe7, 0xd6, 0x1f, 0x34, 0x24, 0xcf, 0xae, + 0x83, 0xbf, 0x9e, 0x07, 0x61, 0xdf, 0xf4, 0x06, 0xeb, 0x60, 0x78, 0x9b, 0x17, 0x05, 0x2b, 0xdd, + 0x58, 0xaf, 0x1d, 0x20, 0xe3, 0x13, 0x1d, 0x7c, 0xa2, 0x57, 0x45, 0x33, 0xb3, 0x42, 0x03, 0x5a, + 0x01, 0x70, 0xdd, 0x5b, 0x7d, 0xf1, 0xad, 0x9b, 0xbb, 0xd0, 0x5e, 0xe8, 0x51, 0xf0, 0x09, 0xc0, + 0xfb, 0x53, 0x51, 0x48, 0x56, 0xc8, 0x4a, 0xfe, 0xdb, 0xdf, 0x25, 0xbc, 0xa7, 0x78, 0xce, 0xa4, + 0x22, 0xf9, 0x52, 0x3b, 0xec, 0x85, 0xbf, 0x07, 0xa7, 0xab, 0xf8, 0x0a, 0xa0, 0x3d, 0x63, 0x24, + 0x66, 0xe5, 0x51, 0xf6, 0x39, 0xb4, 0xbb, 0xf4, 0xce, 0xfe, 0x9b, 0xde, 0x83, 0x2e, 0xbd, 0x0b, + 0x93, 0xde, 0x21, 0xb6, 0x6e, 0xc1, 0xe9, 0x52, 0x47, 0xb0, 0xff, 0x9a, 0xcb, 0x88, 0xa5, 0xa4, + 0xe6, 0xa2, 0x3a, 0xaa, 0xb7, 0x7b, 0xf3, 0x76, 0xbd, 0xf3, 0xc0, 0x66, 0xe7, 0x81, 0x1f, 0x3b, + 0x0f, 0x7c, 0xde, 0x7b, 0xd6, 0x66, 0xef, 0x59, 0xdf, 0xf6, 0x9e, 0xf5, 0xee, 0x65, 0xc2, 0x55, + 0x5a, 0x45, 0x88, 0x8a, 0x1c, 0x53, 0x21, 0x73, 0x21, 0x31, 0x8f, 0xe8, 0x38, 0x11, 0xb8, 0x7e, + 0x8e, 0x73, 0x11, 0x57, 0x19, 0x93, 0xe6, 0x04, 0xc6, 0x87, 0x1b, 0x78, 0xf2, 0x62, 0xac, 0xcf, + 0x40, 0x35, 0x4b, 0x26, 0x23, 0x5b, 0xcb, 0x7d, 0xf6, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x09, + 0xb5, 0x6f, 0x2c, 0x03, 0x00, 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -242,6 +354,15 @@ func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.XInner != nil { + { + size := m.XInner.Size() + i -= size + if _, err := m.XInner.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } { size, err := m.LatestHeight.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -269,6 +390,29 @@ func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ClientState_Inner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientState_Inner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Inner != nil { + { + size, err := m.Inner.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWasm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0xa2 + } + return len(dAtA) - i, nil +} func (m *ConsensusState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -289,6 +433,15 @@ func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.XInner != nil { + { + size := m.XInner.Size() + i -= size + if _, err := m.XInner.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } if m.Timestamp != 0 { i = encodeVarintWasm(dAtA, i, uint64(m.Timestamp)) i-- @@ -304,6 +457,29 @@ func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ConsensusState_Inner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsensusState_Inner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Inner != nil { + { + size, err := m.Inner.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWasm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0xa2 + } + return len(dAtA) - i, nil +} func (m *Header) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -324,6 +500,15 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.XInner != nil { + { + size := m.XInner.Size() + i -= size + if _, err := m.XInner.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } { size, err := m.Height.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -344,6 +529,29 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Header_Inner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Inner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Inner != nil { + { + size, err := m.Inner.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWasm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0xa2 + } + return len(dAtA) - i, nil +} func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -401,9 +609,24 @@ func (m *ClientState) Size() (n int) { } l = m.LatestHeight.Size() n += 1 + l + sovWasm(uint64(l)) + if m.XInner != nil { + n += m.XInner.Size() + } return n } +func (m *ClientState_Inner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Inner != nil { + l = m.Inner.Size() + n += 2 + l + sovWasm(uint64(l)) + } + return n +} func (m *ConsensusState) Size() (n int) { if m == nil { return 0 @@ -417,9 +640,24 @@ func (m *ConsensusState) Size() (n int) { if m.Timestamp != 0 { n += 1 + sovWasm(uint64(m.Timestamp)) } + if m.XInner != nil { + n += m.XInner.Size() + } return n } +func (m *ConsensusState_Inner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Inner != nil { + l = m.Inner.Size() + n += 2 + l + sovWasm(uint64(l)) + } + return n +} func (m *Header) Size() (n int) { if m == nil { return 0 @@ -432,9 +670,24 @@ func (m *Header) Size() (n int) { } l = m.Height.Size() n += 1 + l + sovWasm(uint64(l)) + if m.XInner != nil { + n += m.XInner.Size() + } return n } +func (m *Header_Inner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Inner != nil { + l = m.Inner.Size() + n += 2 + l + sovWasm(uint64(l)) + } + return n +} func (m *Misbehaviour) Size() (n int) { if m == nil { return 0 @@ -584,6 +837,41 @@ func (m *ClientState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 100: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Inner", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWasm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWasm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types1.Any{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.XInner = &ClientState_Inner{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWasm(dAtA[iNdEx:]) @@ -687,6 +975,41 @@ func (m *ConsensusState) Unmarshal(dAtA []byte) error { break } } + case 100: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Inner", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWasm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWasm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types1.Any{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.XInner = &ConsensusState_Inner{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWasm(dAtA[iNdEx:]) @@ -804,6 +1127,41 @@ func (m *Header) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 100: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Inner", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWasm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWasm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types1.Any{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.XInner = &Header_Inner{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWasm(dAtA[iNdEx:]) diff --git a/modules/light-clients/10-grandpa/client_state.go b/modules/light-clients/10-grandpa/client_state.go new file mode 100644 index 00000000000..7e71a9077cf --- /dev/null +++ b/modules/light-clients/10-grandpa/client_state.go @@ -0,0 +1,76 @@ +package grandpa + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v7/modules/core/exported" +) + +var _ exported.ClientState = (*ClientState)(nil) + +// The implementation of ClientState is needed to register the protobuf type, but none of the functions is actually +// used anywhere + +func (m *ClientState) ClientType() string { + panic("unimplemented") +} + +func (m *ClientState) GetLatestHeight() exported.Height { + panic("unimplemented") +} + +func (m *ClientState) Validate() error { + panic("unimplemented") +} + +func (m *ClientState) Status(_ types.Context, _ types.KVStore, _ codec.BinaryCodec) exported.Status { + panic("unimplemented") +} + +func (m *ClientState) ExportMetadata(_ types.KVStore) []exported.GenesisMetadata { + panic("unimplemented") +} + +func (m *ClientState) ZeroCustomFields() exported.ClientState { + panic("unimplemented") +} + +func (m *ClientState) GetTimestampAtHeight(_ types.Context, _ types.KVStore, _ codec.BinaryCodec, _ exported.Height) (uint64, error) { + panic("unimplemented") +} + +func (m *ClientState) Initialize(_ types.Context, _ codec.BinaryCodec, _ types.KVStore, _ exported.ConsensusState) error { + panic("unimplemented") +} + +func (m *ClientState) VerifyMembership(_ types.Context, _ types.KVStore, _ codec.BinaryCodec, _ exported.Height, _ uint64, _ uint64, _ []byte, _ exported.Path, _ []byte) error { + panic("unimplemented") +} + +func (m *ClientState) VerifyNonMembership(_ types.Context, _ types.KVStore, _ codec.BinaryCodec, _ exported.Height, _ uint64, _ uint64, _ []byte, _ exported.Path) error { + panic("unimplemented") +} + +func (m *ClientState) VerifyClientMessage(_ types.Context, _ codec.BinaryCodec, _ types.KVStore, _ exported.ClientMessage) error { + panic("unimplemented") +} + +func (m *ClientState) CheckForMisbehaviour(_ types.Context, _ codec.BinaryCodec, _ types.KVStore, _ exported.ClientMessage) bool { + panic("unimplemented") +} + +func (m *ClientState) UpdateStateOnMisbehaviour(_ types.Context, _ codec.BinaryCodec, _ types.KVStore, _ exported.ClientMessage) { + panic("unimplemented") +} + +func (m *ClientState) UpdateState(_ types.Context, _ codec.BinaryCodec, _ types.KVStore, _ exported.ClientMessage) []exported.Height { + panic("unimplemented") +} + +func (m *ClientState) CheckSubstituteAndUpdateState(_ types.Context, _ codec.BinaryCodec, _, _ types.KVStore, _ exported.ClientState) error { + panic("unimplemented") +} + +func (m *ClientState) VerifyUpgradeAndUpdateState(_ types.Context, _ codec.BinaryCodec, _ types.KVStore, _ exported.ClientState, _ exported.ConsensusState, _, _ []byte) error { + panic("unimplemented") +} diff --git a/modules/light-clients/10-grandpa/codec.go b/modules/light-clients/10-grandpa/codec.go new file mode 100644 index 00000000000..1f61aa0323c --- /dev/null +++ b/modules/light-clients/10-grandpa/codec.go @@ -0,0 +1,20 @@ +package grandpa + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + + "github.com/cosmos/ibc-go/v7/modules/core/exported" +) + +// RegisterInterfaces registers the tendermint concrete client-related +// implementations and interfaces. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*exported.ClientState)(nil), + &ClientState{}, + ) + registry.RegisterImplementations( + (*exported.ConsensusState)(nil), + &ConsensusState{}, + ) +} diff --git a/modules/light-clients/10-grandpa/consensus_state.go b/modules/light-clients/10-grandpa/consensus_state.go new file mode 100644 index 00000000000..69351d065dc --- /dev/null +++ b/modules/light-clients/10-grandpa/consensus_state.go @@ -0,0 +1,22 @@ +package grandpa + +import ( + "github.com/cosmos/ibc-go/v7/modules/core/exported" +) + +var _ exported.ConsensusState = (*ConsensusState)(nil) + +// The implementation of ConsensusState is needed to register the protobuf type, but none of the functions is actually +// used anywhere + +func (m ConsensusState) ClientType() string { + panic("unimplemented") +} + +func (m ConsensusState) GetTimestamp() uint64 { + panic("unimplemented") +} + +func (m ConsensusState) ValidateBasic() error { + panic("unimplemented") +} diff --git a/modules/light-clients/10-grandpa/grandpa.pb.go b/modules/light-clients/10-grandpa/grandpa.pb.go new file mode 100644 index 00000000000..c890e785fa3 --- /dev/null +++ b/modules/light-clients/10-grandpa/grandpa.pb.go @@ -0,0 +1,2824 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ibc/lightclients/grandpa/v1/grandpa.proto + +package grandpa + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type RelayChain int32 + +const ( + RelayChain_POLKADOT RelayChain = 0 + RelayChain_KUSAMA RelayChain = 1 + RelayChain_ROCOCO RelayChain = 2 +) + +var RelayChain_name = map[int32]string{ + 0: "POLKADOT", + 1: "KUSAMA", + 2: "ROCOCO", +} + +var RelayChain_value = map[string]int32{ + "POLKADOT": 0, + "KUSAMA": 1, + "ROCOCO": 2, +} + +func (x RelayChain) String() string { + return proto.EnumName(RelayChain_name, int32(x)) +} + +func (RelayChain) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{0} +} + +type Authority struct { + // ed25519 public key of the authority + PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + // authority weight + Weight uint64 `protobuf:"varint,2,opt,name=weight,proto3" json:"weight,omitempty"` +} + +func (m *Authority) Reset() { *m = Authority{} } +func (m *Authority) String() string { return proto.CompactTextString(m) } +func (*Authority) ProtoMessage() {} +func (*Authority) Descriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{0} +} +func (m *Authority) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Authority) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Authority.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 *Authority) XXX_Merge(src proto.Message) { + xxx_messageInfo_Authority.Merge(m, src) +} +func (m *Authority) XXX_Size() int { + return m.Size() +} +func (m *Authority) XXX_DiscardUnknown() { + xxx_messageInfo_Authority.DiscardUnknown(m) +} + +var xxx_messageInfo_Authority proto.InternalMessageInfo + +func (m *Authority) GetPublicKey() []byte { + if m != nil { + return m.PublicKey + } + return nil +} + +func (m *Authority) GetWeight() uint64 { + if m != nil { + return m.Weight + } + return 0 +} + +// ClientState for the grandpa client +type ClientState struct { + // Latest relay chain block hash + LatestRelayHash []byte `protobuf:"bytes,1,opt,name=latest_relay_hash,json=latestRelayHash,proto3" json:"latest_relay_hash,omitempty"` + // Latest relay chain height + LatestRelayHeight uint32 `protobuf:"varint,2,opt,name=latest_relay_height,json=latestRelayHeight,proto3" json:"latest_relay_height,omitempty"` + // current grandpa authority set id + CurrentSetId uint64 `protobuf:"varint,3,opt,name=current_set_id,json=currentSetId,proto3" json:"current_set_id,omitempty"` + // Types that are valid to be assigned to XFrozenHeight: + // + // *ClientState_FrozenHeight + XFrozenHeight isClientState_XFrozenHeight `protobuf_oneof:"_frozen_height"` + // Known relay chains + RelayChain RelayChain `protobuf:"varint,5,opt,name=relay_chain,json=relayChain,proto3,enum=ibc.lightclients.grandpa.v1.RelayChain" json:"relay_chain,omitempty"` + // ParaId of associated parachain + ParaId uint32 `protobuf:"varint,6,opt,name=para_id,json=paraId,proto3" json:"para_id,omitempty"` + // latest parachain height + LatestParaHeight uint32 `protobuf:"varint,7,opt,name=latest_para_height,json=latestParaHeight,proto3" json:"latest_para_height,omitempty"` + // Current grandpa authorities + CurrentAuthorities []*Authority `protobuf:"bytes,8,rep,name=current_authorities,json=currentAuthorities,proto3" json:"current_authorities,omitempty"` +} + +func (m *ClientState) Reset() { *m = ClientState{} } +func (m *ClientState) String() string { return proto.CompactTextString(m) } +func (*ClientState) ProtoMessage() {} +func (*ClientState) Descriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{1} +} +func (m *ClientState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClientState.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 *ClientState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientState.Merge(m, src) +} +func (m *ClientState) XXX_Size() int { + return m.Size() +} +func (m *ClientState) XXX_DiscardUnknown() { + xxx_messageInfo_ClientState.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientState proto.InternalMessageInfo + +type isClientState_XFrozenHeight interface { + isClientState_XFrozenHeight() + MarshalTo([]byte) (int, error) + Size() int +} + +type ClientState_FrozenHeight struct { + FrozenHeight uint64 `protobuf:"varint,4,opt,name=frozen_height,json=frozenHeight,proto3,oneof" json:"frozen_height,omitempty"` +} + +func (*ClientState_FrozenHeight) isClientState_XFrozenHeight() {} + +func (m *ClientState) GetXFrozenHeight() isClientState_XFrozenHeight { + if m != nil { + return m.XFrozenHeight + } + return nil +} + +func (m *ClientState) GetLatestRelayHash() []byte { + if m != nil { + return m.LatestRelayHash + } + return nil +} + +func (m *ClientState) GetLatestRelayHeight() uint32 { + if m != nil { + return m.LatestRelayHeight + } + return 0 +} + +func (m *ClientState) GetCurrentSetId() uint64 { + if m != nil { + return m.CurrentSetId + } + return 0 +} + +func (m *ClientState) GetFrozenHeight() uint64 { + if x, ok := m.GetXFrozenHeight().(*ClientState_FrozenHeight); ok { + return x.FrozenHeight + } + return 0 +} + +func (m *ClientState) GetRelayChain() RelayChain { + if m != nil { + return m.RelayChain + } + return RelayChain_POLKADOT +} + +func (m *ClientState) GetParaId() uint32 { + if m != nil { + return m.ParaId + } + return 0 +} + +func (m *ClientState) GetLatestParaHeight() uint32 { + if m != nil { + return m.LatestParaHeight + } + return 0 +} + +func (m *ClientState) GetCurrentAuthorities() []*Authority { + if m != nil { + return m.CurrentAuthorities + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ClientState) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ClientState_FrozenHeight)(nil), + } +} + +type ParachainHeaderWithRelayHash struct { + RelayHash []byte `protobuf:"bytes,1,opt,name=relay_hash,json=relayHash,proto3" json:"relay_hash,omitempty"` + ParachainHeader *ParachainHeaderProofs `protobuf:"bytes,2,opt,name=parachain_header,json=parachainHeader,proto3" json:"parachain_header,omitempty"` +} + +func (m *ParachainHeaderWithRelayHash) Reset() { *m = ParachainHeaderWithRelayHash{} } +func (m *ParachainHeaderWithRelayHash) String() string { return proto.CompactTextString(m) } +func (*ParachainHeaderWithRelayHash) ProtoMessage() {} +func (*ParachainHeaderWithRelayHash) Descriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{2} +} +func (m *ParachainHeaderWithRelayHash) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParachainHeaderWithRelayHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParachainHeaderWithRelayHash.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 *ParachainHeaderWithRelayHash) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParachainHeaderWithRelayHash.Merge(m, src) +} +func (m *ParachainHeaderWithRelayHash) XXX_Size() int { + return m.Size() +} +func (m *ParachainHeaderWithRelayHash) XXX_DiscardUnknown() { + xxx_messageInfo_ParachainHeaderWithRelayHash.DiscardUnknown(m) +} + +var xxx_messageInfo_ParachainHeaderWithRelayHash proto.InternalMessageInfo + +func (m *ParachainHeaderWithRelayHash) GetRelayHash() []byte { + if m != nil { + return m.RelayHash + } + return nil +} + +func (m *ParachainHeaderWithRelayHash) GetParachainHeader() *ParachainHeaderProofs { + if m != nil { + return m.ParachainHeader + } + return nil +} + +// Grandpa finality proof +type FinalityProof struct { + // The hash of block F for which justification is provided. + Block []byte `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` + // Justification of the block F. + Justification []byte `protobuf:"bytes,2,opt,name=justification,proto3" json:"justification,omitempty"` + // The set of headers in the range (B; F] that we believe are unknown to the + // caller. Ordered. + UnknownHeaders [][]byte `protobuf:"bytes,3,rep,name=unknown_headers,json=unknownHeaders,proto3" json:"unknown_headers,omitempty"` +} + +func (m *FinalityProof) Reset() { *m = FinalityProof{} } +func (m *FinalityProof) String() string { return proto.CompactTextString(m) } +func (*FinalityProof) ProtoMessage() {} +func (*FinalityProof) Descriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{3} +} +func (m *FinalityProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinalityProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FinalityProof.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 *FinalityProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinalityProof.Merge(m, src) +} +func (m *FinalityProof) XXX_Size() int { + return m.Size() +} +func (m *FinalityProof) XXX_DiscardUnknown() { + xxx_messageInfo_FinalityProof.DiscardUnknown(m) +} + +var xxx_messageInfo_FinalityProof proto.InternalMessageInfo + +func (m *FinalityProof) GetBlock() []byte { + if m != nil { + return m.Block + } + return nil +} + +func (m *FinalityProof) GetJustification() []byte { + if m != nil { + return m.Justification + } + return nil +} + +func (m *FinalityProof) GetUnknownHeaders() [][]byte { + if m != nil { + return m.UnknownHeaders + } + return nil +} + +// Holds relavant parachain proofs for both header and timestamp extrinsic. +type ParachainHeaderProofs struct { + // State proofs that prove a parachain header exists at a given relay chain + // height + StateProof [][]byte `protobuf:"bytes,1,rep,name=state_proof,json=stateProof,proto3" json:"state_proof,omitempty"` + // Timestamp extrinsic for ibc + Extrinsic []byte `protobuf:"bytes,2,opt,name=extrinsic,proto3" json:"extrinsic,omitempty"` + // Timestamp extrinsic proof for previously proven parachain header. + ExtrinsicProof [][]byte `protobuf:"bytes,3,rep,name=extrinsic_proof,json=extrinsicProof,proto3" json:"extrinsic_proof,omitempty"` +} + +func (m *ParachainHeaderProofs) Reset() { *m = ParachainHeaderProofs{} } +func (m *ParachainHeaderProofs) String() string { return proto.CompactTextString(m) } +func (*ParachainHeaderProofs) ProtoMessage() {} +func (*ParachainHeaderProofs) Descriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{4} +} +func (m *ParachainHeaderProofs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParachainHeaderProofs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParachainHeaderProofs.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 *ParachainHeaderProofs) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParachainHeaderProofs.Merge(m, src) +} +func (m *ParachainHeaderProofs) XXX_Size() int { + return m.Size() +} +func (m *ParachainHeaderProofs) XXX_DiscardUnknown() { + xxx_messageInfo_ParachainHeaderProofs.DiscardUnknown(m) +} + +var xxx_messageInfo_ParachainHeaderProofs proto.InternalMessageInfo + +func (m *ParachainHeaderProofs) GetStateProof() [][]byte { + if m != nil { + return m.StateProof + } + return nil +} + +func (m *ParachainHeaderProofs) GetExtrinsic() []byte { + if m != nil { + return m.Extrinsic + } + return nil +} + +func (m *ParachainHeaderProofs) GetExtrinsicProof() [][]byte { + if m != nil { + return m.ExtrinsicProof + } + return nil +} + +// ConsensusState defines the consensus state from Tendermint. +type ConsensusState struct { + // timestamp that corresponds to the block height in which the ConsensusState + // was stored. + Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + // packet commitment root + Root []byte `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"` +} + +func (m *ConsensusState) Reset() { *m = ConsensusState{} } +func (m *ConsensusState) String() string { return proto.CompactTextString(m) } +func (*ConsensusState) ProtoMessage() {} +func (*ConsensusState) Descriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{5} +} +func (m *ConsensusState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsensusState.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 *ConsensusState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusState.Merge(m, src) +} +func (m *ConsensusState) XXX_Size() int { + return m.Size() +} +func (m *ConsensusState) XXX_DiscardUnknown() { + xxx_messageInfo_ConsensusState.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsensusState proto.InternalMessageInfo + +func (m *ConsensusState) GetRoot() []byte { + if m != nil { + return m.Root + } + return nil +} + +// GRANDPA finality proof and parachain headers +type Header struct { + // GRANDPA finality proof + FinalityProof *FinalityProof `protobuf:"bytes,1,opt,name=finality_proof,json=finalityProof,proto3" json:"finality_proof,omitempty"` + // new parachain headers finalized by the GRANDPA finality proof + ParachainHeaders []*ParachainHeaderWithRelayHash `protobuf:"bytes,2,rep,name=parachain_headers,json=parachainHeaders,proto3" json:"parachain_headers,omitempty"` + ParaId uint32 `protobuf:"varint,3,opt,name=para_id,json=paraId,proto3" json:"para_id,omitempty"` + ParaHeight uint32 `protobuf:"varint,4,opt,name=para_height,json=paraHeight,proto3" json:"para_height,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 fileDescriptor_cd16ccf01137b53b, []int{6} +} +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) GetFinalityProof() *FinalityProof { + if m != nil { + return m.FinalityProof + } + return nil +} + +func (m *Header) GetParachainHeaders() []*ParachainHeaderWithRelayHash { + if m != nil { + return m.ParachainHeaders + } + return nil +} + +func (m *Header) GetParaId() uint32 { + if m != nil { + return m.ParaId + } + return 0 +} + +func (m *Header) GetParaHeight() uint32 { + if m != nil { + return m.ParaHeight + } + return 0 +} + +// GRANDPA misbehaviour type +type Misbehaviour struct { + // First SCALE-encoded finality proof. + FirstFinalityProof []byte `protobuf:"bytes,1,opt,name=first_finality_proof,json=firstFinalityProof,proto3" json:"first_finality_proof,omitempty"` + // Second SCALE-encoded finality proof. + SecondFinalityProof []byte `protobuf:"bytes,2,opt,name=second_finality_proof,json=secondFinalityProof,proto3" json:"second_finality_proof,omitempty"` +} + +func (m *Misbehaviour) Reset() { *m = Misbehaviour{} } +func (m *Misbehaviour) String() string { return proto.CompactTextString(m) } +func (*Misbehaviour) ProtoMessage() {} +func (*Misbehaviour) Descriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{7} +} +func (m *Misbehaviour) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Misbehaviour.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 *Misbehaviour) XXX_Merge(src proto.Message) { + xxx_messageInfo_Misbehaviour.Merge(m, src) +} +func (m *Misbehaviour) XXX_Size() int { + return m.Size() +} +func (m *Misbehaviour) XXX_DiscardUnknown() { + xxx_messageInfo_Misbehaviour.DiscardUnknown(m) +} + +var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo + +func (m *Misbehaviour) GetFirstFinalityProof() []byte { + if m != nil { + return m.FirstFinalityProof + } + return nil +} + +func (m *Misbehaviour) GetSecondFinalityProof() []byte { + if m != nil { + return m.SecondFinalityProof + } + return nil +} + +// ClientMessage for ics10-GRANDPA +type ClientMessage struct { + // Types that are valid to be assigned to Message: + // + // *ClientMessage_Header + // *ClientMessage_Misbehaviour + Message isClientMessage_Message `protobuf_oneof:"message"` +} + +func (m *ClientMessage) Reset() { *m = ClientMessage{} } +func (m *ClientMessage) String() string { return proto.CompactTextString(m) } +func (*ClientMessage) ProtoMessage() {} +func (*ClientMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_cd16ccf01137b53b, []int{8} +} +func (m *ClientMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClientMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClientMessage.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 *ClientMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientMessage.Merge(m, src) +} +func (m *ClientMessage) XXX_Size() int { + return m.Size() +} +func (m *ClientMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ClientMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientMessage proto.InternalMessageInfo + +type isClientMessage_Message interface { + isClientMessage_Message() + MarshalTo([]byte) (int, error) + Size() int +} + +type ClientMessage_Header struct { + Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof" json:"header,omitempty"` +} +type ClientMessage_Misbehaviour struct { + Misbehaviour *Misbehaviour `protobuf:"bytes,2,opt,name=misbehaviour,proto3,oneof" json:"misbehaviour,omitempty"` +} + +func (*ClientMessage_Header) isClientMessage_Message() {} +func (*ClientMessage_Misbehaviour) isClientMessage_Message() {} + +func (m *ClientMessage) GetMessage() isClientMessage_Message { + if m != nil { + return m.Message + } + return nil +} + +func (m *ClientMessage) GetHeader() *Header { + if x, ok := m.GetMessage().(*ClientMessage_Header); ok { + return x.Header + } + return nil +} + +func (m *ClientMessage) GetMisbehaviour() *Misbehaviour { + if x, ok := m.GetMessage().(*ClientMessage_Misbehaviour); ok { + return x.Misbehaviour + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ClientMessage) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ClientMessage_Header)(nil), + (*ClientMessage_Misbehaviour)(nil), + } +} + +func init() { + proto.RegisterEnum("ibc.lightclients.grandpa.v1.RelayChain", RelayChain_name, RelayChain_value) + proto.RegisterType((*Authority)(nil), "ibc.lightclients.grandpa.v1.Authority") + proto.RegisterType((*ClientState)(nil), "ibc.lightclients.grandpa.v1.ClientState") + proto.RegisterType((*ParachainHeaderWithRelayHash)(nil), "ibc.lightclients.grandpa.v1.ParachainHeaderWithRelayHash") + proto.RegisterType((*FinalityProof)(nil), "ibc.lightclients.grandpa.v1.FinalityProof") + proto.RegisterType((*ParachainHeaderProofs)(nil), "ibc.lightclients.grandpa.v1.ParachainHeaderProofs") + proto.RegisterType((*ConsensusState)(nil), "ibc.lightclients.grandpa.v1.ConsensusState") + proto.RegisterType((*Header)(nil), "ibc.lightclients.grandpa.v1.Header") + proto.RegisterType((*Misbehaviour)(nil), "ibc.lightclients.grandpa.v1.Misbehaviour") + proto.RegisterType((*ClientMessage)(nil), "ibc.lightclients.grandpa.v1.ClientMessage") +} + +func init() { + proto.RegisterFile("ibc/lightclients/grandpa/v1/grandpa.proto", fileDescriptor_cd16ccf01137b53b) +} + +var fileDescriptor_cd16ccf01137b53b = []byte{ + // 843 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x6e, 0x1b, 0x45, + 0x18, 0xf7, 0xc6, 0xa9, 0x13, 0x7f, 0x5e, 0x3b, 0xce, 0x24, 0x85, 0x55, 0x68, 0x6d, 0x6b, 0xa9, + 0xa8, 0x1b, 0xa1, 0x35, 0x35, 0x27, 0x0e, 0x1c, 0x6c, 0x23, 0xe4, 0x2a, 0x44, 0x0e, 0x9b, 0xa2, + 0x9e, 0xd0, 0x6a, 0xbc, 0x1e, 0x7b, 0x87, 0x38, 0x3b, 0xab, 0x99, 0x71, 0x8a, 0xb9, 0x70, 0xe5, + 0xd8, 0x07, 0xe0, 0x09, 0xb8, 0xf3, 0x0e, 0x3d, 0xf6, 0xc8, 0x09, 0x50, 0xf2, 0x1c, 0x48, 0x68, + 0x67, 0xc6, 0x6b, 0x6f, 0xa8, 0x2c, 0x71, 0xfb, 0xe6, 0xf7, 0xfd, 0xfb, 0x7d, 0xff, 0x06, 0x9e, + 0xd1, 0x71, 0xd8, 0x99, 0xd3, 0x59, 0x24, 0xc3, 0x39, 0x25, 0xb1, 0x14, 0x9d, 0x19, 0xc7, 0xf1, + 0x24, 0xc1, 0x9d, 0x9b, 0xe7, 0x2b, 0xd1, 0x4b, 0x38, 0x93, 0x0c, 0x7d, 0x44, 0xc7, 0xa1, 0xb7, + 0x69, 0xea, 0xad, 0xf4, 0x37, 0xcf, 0x4f, 0x9a, 0x33, 0xc6, 0x66, 0x73, 0xd2, 0x51, 0xa6, 0xe3, + 0xc5, 0xb4, 0x23, 0xe9, 0x35, 0x11, 0x12, 0x5f, 0x27, 0xda, 0xfb, 0xe4, 0x78, 0xc6, 0x66, 0x4c, + 0x89, 0x9d, 0x54, 0xd2, 0xa8, 0xdb, 0x87, 0x72, 0x6f, 0x21, 0x23, 0xc6, 0xa9, 0x5c, 0xa2, 0xc7, + 0x00, 0xc9, 0x62, 0x3c, 0xa7, 0x61, 0x70, 0x45, 0x96, 0x8e, 0xd5, 0xb2, 0xda, 0xb6, 0x5f, 0xd6, + 0xc8, 0x19, 0x59, 0xa2, 0x0f, 0xa0, 0xf4, 0x9a, 0xa4, 0xe9, 0x9d, 0x9d, 0x96, 0xd5, 0xde, 0xf5, + 0xcd, 0xcb, 0xfd, 0xbd, 0x08, 0x95, 0x81, 0x62, 0x74, 0x29, 0xb1, 0x24, 0xe8, 0x14, 0x0e, 0xe7, + 0x58, 0x12, 0x21, 0x03, 0x4e, 0xe6, 0x78, 0x19, 0x44, 0x58, 0x44, 0x26, 0xda, 0x81, 0x56, 0xf8, + 0x29, 0x3e, 0xc4, 0x22, 0x42, 0x1e, 0x1c, 0xe5, 0x6d, 0xd7, 0x09, 0xaa, 0xfe, 0xe1, 0xa6, 0xb5, + 0x52, 0xa0, 0x27, 0x50, 0x0b, 0x17, 0x9c, 0x93, 0x58, 0x06, 0x82, 0xc8, 0x80, 0x4e, 0x9c, 0xa2, + 0xe2, 0x62, 0x1b, 0xf4, 0x92, 0xc8, 0x17, 0x13, 0xd4, 0x86, 0xea, 0x94, 0xb3, 0x9f, 0x48, 0xbc, + 0x8a, 0xb7, 0x9b, 0x1a, 0x0d, 0x0b, 0xbe, 0xad, 0x61, 0x1d, 0xec, 0x17, 0xcb, 0x42, 0x43, 0xa8, + 0xe8, 0xc4, 0x61, 0x84, 0x69, 0xec, 0x3c, 0x68, 0x59, 0xed, 0x5a, 0xf7, 0xa9, 0xb7, 0xa5, 0xd3, + 0x9e, 0xa2, 0x33, 0x48, 0xcd, 0x7d, 0xe0, 0x99, 0x8c, 0x3e, 0x84, 0xbd, 0x04, 0x73, 0x9c, 0x52, + 0x2a, 0x29, 0xf6, 0xa5, 0xf4, 0xf9, 0x62, 0x82, 0x3e, 0x05, 0x64, 0x4a, 0x54, 0x7a, 0xc3, 0x68, + 0x4f, 0xd9, 0xd4, 0xb5, 0xe6, 0x02, 0x73, 0x6c, 0x0a, 0x7c, 0x05, 0x47, 0xab, 0x02, 0xb1, 0x19, + 0x0c, 0x25, 0xc2, 0xd9, 0x6f, 0x15, 0xdb, 0x95, 0xee, 0x27, 0x5b, 0x89, 0x65, 0x83, 0xf4, 0x91, + 0x09, 0xd1, 0x5b, 0x47, 0xe8, 0xd7, 0xa1, 0x16, 0xe4, 0x9a, 0xe2, 0xfe, 0x6a, 0xc1, 0xa3, 0x34, + 0xb3, 0x2a, 0x7d, 0x48, 0xf0, 0x84, 0xf0, 0x57, 0x54, 0x46, 0xeb, 0xe1, 0x3c, 0x06, 0xf8, 0xcf, + 0x04, 0xcb, 0x3c, 0x53, 0x7f, 0x0f, 0xf5, 0x64, 0xe5, 0x1e, 0x44, 0xca, 0x5f, 0x0d, 0xae, 0xd2, + 0xed, 0x6e, 0xe5, 0x79, 0x2f, 0xe7, 0x05, 0x67, 0x6c, 0x2a, 0xfc, 0x83, 0x24, 0x0f, 0xbb, 0x12, + 0xaa, 0x5f, 0xd3, 0x18, 0xcf, 0xa9, 0x5c, 0x2a, 0x13, 0x74, 0x0c, 0x0f, 0xc6, 0x73, 0x16, 0x5e, + 0x19, 0x26, 0xfa, 0x81, 0x9e, 0x40, 0xf5, 0x87, 0x85, 0x90, 0x74, 0x4a, 0x43, 0x2c, 0x29, 0x8b, + 0x15, 0x05, 0xdb, 0xcf, 0x83, 0xe8, 0x29, 0x1c, 0x2c, 0xe2, 0xab, 0x98, 0xbd, 0x5e, 0x31, 0x15, + 0x4e, 0xb1, 0x55, 0x6c, 0xdb, 0x7e, 0xcd, 0xc0, 0x3a, 0xa9, 0x70, 0x7f, 0x86, 0x87, 0xef, 0xe5, + 0x87, 0x9a, 0x50, 0x11, 0xe9, 0x7a, 0x07, 0x49, 0xfa, 0x76, 0x2c, 0xe5, 0x0d, 0x0a, 0xd2, 0xf4, + 0x1e, 0x41, 0x99, 0xfc, 0x28, 0x39, 0x8d, 0x05, 0x0d, 0x0d, 0x89, 0x35, 0x90, 0x12, 0xc8, 0x1e, + 0x26, 0x84, 0x21, 0x90, 0xc1, 0x2a, 0x8c, 0x1b, 0x41, 0x6d, 0xc0, 0x62, 0x41, 0x62, 0xb1, 0x10, + 0xfa, 0x9e, 0xfa, 0x50, 0xce, 0x8e, 0x59, 0xd5, 0x5e, 0xe9, 0x9e, 0x78, 0xfa, 0xdc, 0xbd, 0xd5, + 0xb9, 0x7b, 0x2f, 0x57, 0x16, 0xfd, 0xfd, 0xb7, 0x7f, 0x36, 0x0b, 0x6f, 0xfe, 0x6a, 0x5a, 0xfe, + 0xda, 0x0d, 0x21, 0xd8, 0xe5, 0x8c, 0x49, 0xc3, 0x4b, 0xc9, 0xee, 0x3f, 0x16, 0x94, 0x74, 0x89, + 0xe8, 0x5b, 0xa8, 0x4d, 0x4d, 0xaf, 0xb3, 0xfa, 0xd2, 0x3c, 0xa7, 0x5b, 0x07, 0x99, 0x1b, 0x8f, + 0x5f, 0x9d, 0xe6, 0xa6, 0x35, 0x85, 0xc3, 0xfb, 0xdb, 0x21, 0x9c, 0x1d, 0xb5, 0xc6, 0x5f, 0xfc, + 0x9f, 0xf5, 0xc8, 0xad, 0xa4, 0x5f, 0xbf, 0xb7, 0x25, 0x62, 0xf3, 0xee, 0x8a, 0xb9, 0xbb, 0x6b, + 0x42, 0x65, 0xf3, 0xe0, 0x76, 0x95, 0x12, 0x92, 0xec, 0xd4, 0x5c, 0x09, 0xf6, 0x39, 0x15, 0x63, + 0x12, 0xe1, 0x1b, 0xca, 0x16, 0x1c, 0x7d, 0x06, 0xc7, 0x53, 0xca, 0x85, 0x0c, 0xde, 0xd3, 0x0a, + 0xdb, 0x47, 0x4a, 0x97, 0xdf, 0xc8, 0x2e, 0x3c, 0x14, 0x24, 0x64, 0xf1, 0xe4, 0xbe, 0x8b, 0x6e, + 0xf3, 0x91, 0x56, 0xe6, 0x7c, 0xdc, 0xdf, 0x2c, 0xa8, 0xea, 0xdf, 0xf2, 0x9c, 0x08, 0x81, 0x67, + 0x04, 0x7d, 0x09, 0x25, 0x73, 0x3d, 0xba, 0xe9, 0x1f, 0x6f, 0x6d, 0x8f, 0xae, 0x7b, 0x58, 0xf0, + 0x8d, 0x13, 0x1a, 0x81, 0x7d, 0xbd, 0x51, 0x86, 0x39, 0xc1, 0x67, 0x5b, 0x83, 0x6c, 0xd6, 0x9d, + 0x7e, 0x8b, 0x9b, 0x01, 0xfa, 0x65, 0xd8, 0xbb, 0xd6, 0xd4, 0x4e, 0xbb, 0x00, 0xeb, 0xef, 0x0e, + 0xd9, 0xb0, 0x7f, 0x31, 0xfa, 0xe6, 0xac, 0xf7, 0xd5, 0xe8, 0x65, 0xbd, 0x80, 0x00, 0x4a, 0x67, + 0xdf, 0x5d, 0xf6, 0xce, 0x7b, 0x75, 0x2b, 0x95, 0xfd, 0xd1, 0x60, 0x34, 0x18, 0xd5, 0x77, 0xfa, + 0xce, 0xdb, 0xdb, 0x86, 0xf5, 0xee, 0xb6, 0x61, 0xfd, 0x7d, 0xdb, 0xb0, 0xde, 0xdc, 0x35, 0x0a, + 0xef, 0xee, 0x1a, 0x85, 0x3f, 0xee, 0x1a, 0x85, 0x71, 0x49, 0x6d, 0xeb, 0xe7, 0xff, 0x06, 0x00, + 0x00, 0xff, 0xff, 0x24, 0xc2, 0xe8, 0x38, 0xf4, 0x06, 0x00, 0x00, +} + +func (m *Authority) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Authority) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Authority) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Weight != 0 { + i = encodeVarintGrandpa(dAtA, i, uint64(m.Weight)) + i-- + dAtA[i] = 0x10 + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClientState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClientState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CurrentAuthorities) > 0 { + for iNdEx := len(m.CurrentAuthorities) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CurrentAuthorities[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGrandpa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if m.LatestParaHeight != 0 { + i = encodeVarintGrandpa(dAtA, i, uint64(m.LatestParaHeight)) + i-- + dAtA[i] = 0x38 + } + if m.ParaId != 0 { + i = encodeVarintGrandpa(dAtA, i, uint64(m.ParaId)) + i-- + dAtA[i] = 0x30 + } + if m.RelayChain != 0 { + i = encodeVarintGrandpa(dAtA, i, uint64(m.RelayChain)) + i-- + dAtA[i] = 0x28 + } + if m.XFrozenHeight != nil { + { + size := m.XFrozenHeight.Size() + i -= size + if _, err := m.XFrozenHeight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if m.CurrentSetId != 0 { + i = encodeVarintGrandpa(dAtA, i, uint64(m.CurrentSetId)) + i-- + dAtA[i] = 0x18 + } + if m.LatestRelayHeight != 0 { + i = encodeVarintGrandpa(dAtA, i, uint64(m.LatestRelayHeight)) + i-- + dAtA[i] = 0x10 + } + if len(m.LatestRelayHash) > 0 { + i -= len(m.LatestRelayHash) + copy(dAtA[i:], m.LatestRelayHash) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.LatestRelayHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClientState_FrozenHeight) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientState_FrozenHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i = encodeVarintGrandpa(dAtA, i, uint64(m.FrozenHeight)) + i-- + dAtA[i] = 0x20 + return len(dAtA) - i, nil +} +func (m *ParachainHeaderWithRelayHash) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ParachainHeaderWithRelayHash) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParachainHeaderWithRelayHash) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ParachainHeader != nil { + { + size, err := m.ParachainHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGrandpa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RelayHash) > 0 { + i -= len(m.RelayHash) + copy(dAtA[i:], m.RelayHash) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.RelayHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FinalityProof) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FinalityProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FinalityProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UnknownHeaders) > 0 { + for iNdEx := len(m.UnknownHeaders) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UnknownHeaders[iNdEx]) + copy(dAtA[i:], m.UnknownHeaders[iNdEx]) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.UnknownHeaders[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Justification) > 0 { + i -= len(m.Justification) + copy(dAtA[i:], m.Justification) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.Justification))) + i-- + dAtA[i] = 0x12 + } + if len(m.Block) > 0 { + i -= len(m.Block) + copy(dAtA[i:], m.Block) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.Block))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ParachainHeaderProofs) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ParachainHeaderProofs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParachainHeaderProofs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ExtrinsicProof) > 0 { + for iNdEx := len(m.ExtrinsicProof) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ExtrinsicProof[iNdEx]) + copy(dAtA[i:], m.ExtrinsicProof[iNdEx]) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.ExtrinsicProof[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Extrinsic) > 0 { + i -= len(m.Extrinsic) + copy(dAtA[i:], m.Extrinsic) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.Extrinsic))) + i-- + dAtA[i] = 0x12 + } + if len(m.StateProof) > 0 { + for iNdEx := len(m.StateProof) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.StateProof[iNdEx]) + copy(dAtA[i:], m.StateProof[iNdEx]) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.StateProof[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ConsensusState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsensusState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Root) > 0 { + i -= len(m.Root) + copy(dAtA[i:], m.Root) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.Root))) + i-- + dAtA[i] = 0x12 + } + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGrandpa(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Header) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Header) MarshalTo(dAtA []byte) (int, error) { + 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.ParaHeight != 0 { + i = encodeVarintGrandpa(dAtA, i, uint64(m.ParaHeight)) + i-- + dAtA[i] = 0x20 + } + if m.ParaId != 0 { + i = encodeVarintGrandpa(dAtA, i, uint64(m.ParaId)) + i-- + dAtA[i] = 0x18 + } + if len(m.ParachainHeaders) > 0 { + for iNdEx := len(m.ParachainHeaders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ParachainHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGrandpa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.FinalityProof != nil { + { + size, err := m.FinalityProof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGrandpa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Misbehaviour) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SecondFinalityProof) > 0 { + i -= len(m.SecondFinalityProof) + copy(dAtA[i:], m.SecondFinalityProof) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.SecondFinalityProof))) + i-- + dAtA[i] = 0x12 + } + if len(m.FirstFinalityProof) > 0 { + i -= len(m.FirstFinalityProof) + copy(dAtA[i:], m.FirstFinalityProof) + i = encodeVarintGrandpa(dAtA, i, uint64(len(m.FirstFinalityProof))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClientMessage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClientMessage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Message != nil { + { + size := m.Message.Size() + i -= size + if _, err := m.Message.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *ClientMessage_Header) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientMessage_Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGrandpa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *ClientMessage_Misbehaviour) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientMessage_Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Misbehaviour != nil { + { + size, err := m.Misbehaviour.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGrandpa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func encodeVarintGrandpa(dAtA []byte, offset int, v uint64) int { + offset -= sovGrandpa(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Authority) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PublicKey) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + if m.Weight != 0 { + n += 1 + sovGrandpa(uint64(m.Weight)) + } + return n +} + +func (m *ClientState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.LatestRelayHash) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + if m.LatestRelayHeight != 0 { + n += 1 + sovGrandpa(uint64(m.LatestRelayHeight)) + } + if m.CurrentSetId != 0 { + n += 1 + sovGrandpa(uint64(m.CurrentSetId)) + } + if m.XFrozenHeight != nil { + n += m.XFrozenHeight.Size() + } + if m.RelayChain != 0 { + n += 1 + sovGrandpa(uint64(m.RelayChain)) + } + if m.ParaId != 0 { + n += 1 + sovGrandpa(uint64(m.ParaId)) + } + if m.LatestParaHeight != 0 { + n += 1 + sovGrandpa(uint64(m.LatestParaHeight)) + } + if len(m.CurrentAuthorities) > 0 { + for _, e := range m.CurrentAuthorities { + l = e.Size() + n += 1 + l + sovGrandpa(uint64(l)) + } + } + return n +} + +func (m *ClientState_FrozenHeight) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovGrandpa(uint64(m.FrozenHeight)) + return n +} +func (m *ParachainHeaderWithRelayHash) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RelayHash) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + if m.ParachainHeader != nil { + l = m.ParachainHeader.Size() + n += 1 + l + sovGrandpa(uint64(l)) + } + return n +} + +func (m *FinalityProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Block) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + l = len(m.Justification) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + if len(m.UnknownHeaders) > 0 { + for _, b := range m.UnknownHeaders { + l = len(b) + n += 1 + l + sovGrandpa(uint64(l)) + } + } + return n +} + +func (m *ParachainHeaderProofs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.StateProof) > 0 { + for _, b := range m.StateProof { + l = len(b) + n += 1 + l + sovGrandpa(uint64(l)) + } + } + l = len(m.Extrinsic) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + if len(m.ExtrinsicProof) > 0 { + for _, b := range m.ExtrinsicProof { + l = len(b) + n += 1 + l + sovGrandpa(uint64(l)) + } + } + return n +} + +func (m *ConsensusState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovGrandpa(uint64(l)) + l = len(m.Root) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + return n +} + +func (m *Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FinalityProof != nil { + l = m.FinalityProof.Size() + n += 1 + l + sovGrandpa(uint64(l)) + } + if len(m.ParachainHeaders) > 0 { + for _, e := range m.ParachainHeaders { + l = e.Size() + n += 1 + l + sovGrandpa(uint64(l)) + } + } + if m.ParaId != 0 { + n += 1 + sovGrandpa(uint64(m.ParaId)) + } + if m.ParaHeight != 0 { + n += 1 + sovGrandpa(uint64(m.ParaHeight)) + } + return n +} + +func (m *Misbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FirstFinalityProof) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + l = len(m.SecondFinalityProof) + if l > 0 { + n += 1 + l + sovGrandpa(uint64(l)) + } + return n +} + +func (m *ClientMessage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Message != nil { + n += m.Message.Size() + } + return n +} + +func (m *ClientMessage_Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovGrandpa(uint64(l)) + } + return n +} +func (m *ClientMessage_Misbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Misbehaviour != nil { + l = m.Misbehaviour.Size() + n += 1 + l + sovGrandpa(uint64(l)) + } + return n +} + +func sovGrandpa(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGrandpa(x uint64) (n int) { + return sovGrandpa(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Authority) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Authority: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Authority: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKey == nil { + m.PublicKey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + m.Weight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Weight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClientState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClientState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClientState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestRelayHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LatestRelayHash = append(m.LatestRelayHash[:0], dAtA[iNdEx:postIndex]...) + if m.LatestRelayHash == nil { + m.LatestRelayHash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestRelayHeight", wireType) + } + m.LatestRelayHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestRelayHeight |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentSetId", wireType) + } + m.CurrentSetId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentSetId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FrozenHeight", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.XFrozenHeight = &ClientState_FrozenHeight{v} + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RelayChain", wireType) + } + m.RelayChain = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RelayChain |= RelayChain(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParaId", wireType) + } + m.ParaId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParaId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestParaHeight", wireType) + } + m.LatestParaHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestParaHeight |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentAuthorities", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentAuthorities = append(m.CurrentAuthorities, &Authority{}) + if err := m.CurrentAuthorities[len(m.CurrentAuthorities)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ParachainHeaderWithRelayHash) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ParachainHeaderWithRelayHash: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParachainHeaderWithRelayHash: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RelayHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RelayHash = append(m.RelayHash[:0], dAtA[iNdEx:postIndex]...) + if m.RelayHash == nil { + m.RelayHash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParachainHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ParachainHeader == nil { + m.ParachainHeader = &ParachainHeaderProofs{} + } + if err := m.ParachainHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FinalityProof) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FinalityProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FinalityProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Block", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Block = append(m.Block[:0], dAtA[iNdEx:postIndex]...) + if m.Block == nil { + m.Block = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Justification", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Justification = append(m.Justification[:0], dAtA[iNdEx:postIndex]...) + if m.Justification == nil { + m.Justification = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnknownHeaders", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UnknownHeaders = append(m.UnknownHeaders, make([]byte, postIndex-iNdEx)) + copy(m.UnknownHeaders[len(m.UnknownHeaders)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ParachainHeaderProofs) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ParachainHeaderProofs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParachainHeaderProofs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateProof", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateProof = append(m.StateProof, make([]byte, postIndex-iNdEx)) + copy(m.StateProof[len(m.StateProof)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extrinsic", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Extrinsic = append(m.Extrinsic[:0], dAtA[iNdEx:postIndex]...) + if m.Extrinsic == nil { + m.Extrinsic = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtrinsicProof", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtrinsicProof = append(m.ExtrinsicProof, make([]byte, postIndex-iNdEx)) + copy(m.ExtrinsicProof[len(m.ExtrinsicProof)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsensusState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsensusState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsensusState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Root", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Root = append(m.Root[:0], dAtA[iNdEx:postIndex]...) + if m.Root == nil { + m.Root = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalityProof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FinalityProof == nil { + m.FinalityProof = &FinalityProof{} + } + if err := m.FinalityProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParachainHeaders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParachainHeaders = append(m.ParachainHeaders, &ParachainHeaderWithRelayHash{}) + if err := m.ParachainHeaders[len(m.ParachainHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParaId", wireType) + } + m.ParaId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParaId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParaHeight", wireType) + } + m.ParaHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParaHeight |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Misbehaviour) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Misbehaviour: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Misbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FirstFinalityProof", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FirstFinalityProof = append(m.FirstFinalityProof[:0], dAtA[iNdEx:postIndex]...) + if m.FirstFinalityProof == nil { + m.FirstFinalityProof = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondFinalityProof", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecondFinalityProof = append(m.SecondFinalityProof[:0], dAtA[iNdEx:postIndex]...) + if m.SecondFinalityProof == nil { + m.SecondFinalityProof = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClientMessage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClientMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClientMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Header{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Message = &ClientMessage_Header{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Misbehaviour", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrandpa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrandpa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGrandpa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Misbehaviour{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Message = &ClientMessage_Misbehaviour{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrandpa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGrandpa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGrandpa(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 { + if shift >= 64 { + return 0, ErrIntOverflowGrandpa + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGrandpa + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGrandpa + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGrandpa + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGrandpa + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGrandpa + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGrandpa = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGrandpa = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGrandpa = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/ibc/lightclients/grandpa/v1/grandpa.proto b/proto/ibc/lightclients/grandpa/v1/grandpa.proto new file mode 100644 index 00000000000..c348201f1fb --- /dev/null +++ b/proto/ibc/lightclients/grandpa/v1/grandpa.proto @@ -0,0 +1,123 @@ +// Copyright (C) 2022 ComposableFi. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package ibc.lightclients.grandpa.v1; + +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; + +enum RelayChain { + POLKADOT = 0; + KUSAMA = 1; + ROCOCO = 2; +} + +message Authority { + // ed25519 public key of the authority + bytes public_key = 1; + // authority weight + uint64 weight = 2; +} + +// ClientState for the grandpa client +message ClientState { + // Latest relay chain block hash + bytes latest_relay_hash = 1; + + // Latest relay chain height + uint32 latest_relay_height = 2; + + // current grandpa authority set id + uint64 current_set_id = 3; + + // Block height when the client was frozen due to a misbehaviour + optional uint64 frozen_height = 4; + + // Known relay chains + RelayChain relay_chain = 5; + + // ParaId of associated parachain + uint32 para_id = 6; + + // latest parachain height + uint32 latest_para_height = 7; + + // Current grandpa authorities + repeated Authority current_authorities = 8; +} + +message ParachainHeaderWithRelayHash { + bytes relay_hash = 1; + ParachainHeaderProofs parachain_header = 2; +} + +// Grandpa finality proof +message FinalityProof { + // The hash of block F for which justification is provided. + bytes block = 1; + // Justification of the block F. + bytes justification = 2; + // The set of headers in the range (B; F] that we believe are unknown to the + // caller. Ordered. + repeated bytes unknown_headers = 3; +} + +// Holds relavant parachain proofs for both header and timestamp extrinsic. +message ParachainHeaderProofs { + // State proofs that prove a parachain header exists at a given relay chain + // height + repeated bytes state_proof = 1; + // Timestamp extrinsic for ibc + bytes extrinsic = 2; + // Timestamp extrinsic proof for previously proven parachain header. + repeated bytes extrinsic_proof = 3; +} + +// ConsensusState defines the consensus state from Tendermint. +message ConsensusState { + // timestamp that corresponds to the block height in which the ConsensusState + // was stored. + google.protobuf.Timestamp timestamp = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + // packet commitment root + bytes root = 2; +} + +// GRANDPA finality proof and parachain headers +message Header { + // GRANDPA finality proof + FinalityProof finality_proof = 1; + // new parachain headers finalized by the GRANDPA finality proof + repeated ParachainHeaderWithRelayHash parachain_headers = 2; + uint32 para_id = 3; + uint32 para_height = 4; +} + +// GRANDPA misbehaviour type +message Misbehaviour { + // First SCALE-encoded finality proof. + bytes first_finality_proof = 1; + // Second SCALE-encoded finality proof. + bytes second_finality_proof = 2; +} + +// ClientMessage for ics10-GRANDPA +message ClientMessage { + oneof message { + Header header = 1; + Misbehaviour misbehaviour = 2; + } +} diff --git a/proto/ibc/lightclients/wasm/v1/wasm.proto b/proto/ibc/lightclients/wasm/v1/wasm.proto index a05b10ba0c4..6adaabd5199 100644 --- a/proto/ibc/lightclients/wasm/v1/wasm.proto +++ b/proto/ibc/lightclients/wasm/v1/wasm.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package ibc.lightclients.wasm.v1; import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; import "ibc/core/client/v1/client.proto"; option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"; @@ -14,6 +15,7 @@ message ClientState { bytes code_id = 2; ibc.core.client.v1.Height latest_height = 3 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"latest_height\""]; + optional google.protobuf.Any inner = 100; } // Wasm light client's ConsensusState @@ -24,6 +26,7 @@ message ConsensusState { // timestamp that corresponds to the block height in which the ConsensusState // was stored. uint64 timestamp = 2; + optional google.protobuf.Any inner = 100 [(gogoproto.moretags) = "json:\",omitempty\""]; } // Wasm light client Header @@ -32,6 +35,7 @@ message Header { bytes data = 1; ibc.core.client.v1.Height height = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"height\""]; + optional google.protobuf.Any inner = 100 [(gogoproto.moretags) = "json:\",omitempty\""]; } // Wasm light client Misbehaviour @@ -39,4 +43,5 @@ message Misbehaviour { option (gogoproto.goproto_getters) = false; bytes data = 1; + optional google.protobuf.Any inner = 100 [(gogoproto.moretags) = "json:\",omitempty\""]; }