diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index b17e381d9a..80d0a94461 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -27604,7 +27604,6 @@ paths: - Query /zeta-chain/lightclient/prove: get: - summary: Prove performs merkle proof verification operationId: Query_Prove responses: "200": @@ -27667,6 +27666,20 @@ paths: format: int64 tags: - Query + /zeta-chain/lightclient/verification_flags: + get: + operationId: Query_VerificationFlags + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/lightclientQueryVerificationFlagsResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + tags: + - Query /zeta-chain/observer/TSS: get: summary: Queries a tSS by index. @@ -54385,6 +54398,19 @@ definitions: properties: chain_state: $ref: '#/definitions/lightclientChainState' + lightclientQueryVerificationFlagsResponse: + type: object + properties: + verification_flags: + $ref: '#/definitions/lightclientVerificationFlags' + lightclientVerificationFlags: + type: object + properties: + ethTypeChainEnabled: + type: boolean + btcTypeChainEnabled: + type: boolean + title: VerificationFlags is a structure containing information which chain types are enabled for block header verification observerAdmin_Policy: type: object properties: diff --git a/proto/lightclient/genesis.proto b/proto/lightclient/genesis.proto index 02ceef2910..3706da09dc 100644 --- a/proto/lightclient/genesis.proto +++ b/proto/lightclient/genesis.proto @@ -3,6 +3,7 @@ package zetachain.zetacore.lightclient; import "gogoproto/gogo.proto"; import "lightclient/chain_state.proto"; +import "lightclient/verification_flags.proto"; import "pkg/proofs/proofs.proto"; option go_package = "github.com/zeta-chain/zetacore/x/lightclient/types"; @@ -11,4 +12,5 @@ option go_package = "github.com/zeta-chain/zetacore/x/lightclient/types"; message GenesisState { repeated proofs.BlockHeader block_headers = 1 [(gogoproto.nullable) = false]; repeated ChainState chain_states = 2 [(gogoproto.nullable) = false]; + VerificationFlags verification_flags = 3 [(gogoproto.nullable) = false]; } diff --git a/proto/lightclient/query.proto b/proto/lightclient/query.proto index b8ff40fce9..7433093b04 100644 --- a/proto/lightclient/query.proto +++ b/proto/lightclient/query.proto @@ -5,6 +5,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "lightclient/chain_state.proto"; +import "lightclient/verification_flags.proto"; import "pkg/proofs/proofs.proto"; option go_package = "github.com/zeta-chain/zetacore/x/lightclient/types"; @@ -27,10 +28,13 @@ service Query { option (google.api.http).get = "/zeta-chain/lightclient/chain_state/{chain_id}"; } - // Prove performs merkle proof verification rpc Prove(QueryProveRequest) returns (QueryProveResponse) { option (google.api.http).get = "/zeta-chain/lightclient/prove"; } + + rpc VerificationFlags(QueryVerificationFlagsRequest) returns (QueryVerificationFlagsResponse) { + option (google.api.http).get = "/zeta-chain/lightclient/verification_flags"; + } } message QueryAllBlockHeaderRequest { @@ -78,3 +82,9 @@ message QueryProveRequest { message QueryProveResponse { bool valid = 1; } + +message QueryVerificationFlagsRequest {} + +message QueryVerificationFlagsResponse { + VerificationFlags verification_flags = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/lightclient/verification_flags.proto b/proto/lightclient/verification_flags.proto new file mode 100644 index 0000000000..5d9e85fa2f --- /dev/null +++ b/proto/lightclient/verification_flags.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package zetachain.zetacore.lightclient; + +option go_package = "github.com/zeta-chain/zetacore/x/lightclient/types"; + +// VerificationFlags is a structure containing information which chain types are enabled for block header verification +message VerificationFlags { + bool ethTypeChainEnabled = 1; + bool btcTypeChainEnabled = 2; +} diff --git a/typescript/lightclient/genesis_pb.d.ts b/typescript/lightclient/genesis_pb.d.ts index 7451227de0..03bdc94b3a 100644 --- a/typescript/lightclient/genesis_pb.d.ts +++ b/typescript/lightclient/genesis_pb.d.ts @@ -7,6 +7,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM import { Message, proto3 } from "@bufbuild/protobuf"; import type { BlockHeader } from "../pkg/proofs/proofs_pb.js"; import type { ChainState } from "./chain_state_pb.js"; +import type { VerificationFlags } from "./verification_flags_pb.js"; /** * GenesisState defines the lightclient module's genesis state. @@ -24,6 +25,11 @@ export declare class GenesisState extends Message { */ chainStates: ChainState[]; + /** + * @generated from field: zetachain.zetacore.lightclient.VerificationFlags verification_flags = 3; + */ + verificationFlags?: VerificationFlags; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/typescript/lightclient/index.d.ts b/typescript/lightclient/index.d.ts index b028678622..625a2724b2 100644 --- a/typescript/lightclient/index.d.ts +++ b/typescript/lightclient/index.d.ts @@ -1,3 +1,4 @@ export * from "./chain_state_pb"; export * from "./genesis_pb"; export * from "./query_pb"; +export * from "./verification_flags_pb"; diff --git a/typescript/lightclient/query_pb.d.ts b/typescript/lightclient/query_pb.d.ts index 5088d18675..50d17f1885 100644 --- a/typescript/lightclient/query_pb.d.ts +++ b/typescript/lightclient/query_pb.d.ts @@ -8,6 +8,7 @@ import { Message, proto3 } from "@bufbuild/protobuf"; import type { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination_pb.js"; import type { BlockHeader, Proof } from "../pkg/proofs/proofs_pb.js"; import type { ChainState } from "./chain_state_pb.js"; +import type { VerificationFlags } from "./verification_flags_pb.js"; /** * @generated from message zetachain.zetacore.lightclient.QueryAllBlockHeaderRequest @@ -279,3 +280,46 @@ export declare class QueryProveResponse extends Message { static equals(a: QueryProveResponse | PlainMessage | undefined, b: QueryProveResponse | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.lightclient.QueryVerificationFlagsRequest + */ +export declare class QueryVerificationFlagsRequest extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.lightclient.QueryVerificationFlagsRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryVerificationFlagsRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryVerificationFlagsRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryVerificationFlagsRequest; + + static equals(a: QueryVerificationFlagsRequest | PlainMessage | undefined, b: QueryVerificationFlagsRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.lightclient.QueryVerificationFlagsResponse + */ +export declare class QueryVerificationFlagsResponse extends Message { + /** + * @generated from field: zetachain.zetacore.lightclient.VerificationFlags verification_flags = 1; + */ + verificationFlags?: VerificationFlags; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.lightclient.QueryVerificationFlagsResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryVerificationFlagsResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryVerificationFlagsResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryVerificationFlagsResponse; + + static equals(a: QueryVerificationFlagsResponse | PlainMessage | undefined, b: QueryVerificationFlagsResponse | PlainMessage | undefined): boolean; +} + diff --git a/typescript/lightclient/verification_flags_pb.d.ts b/typescript/lightclient/verification_flags_pb.d.ts new file mode 100644 index 0000000000..d2325779b2 --- /dev/null +++ b/typescript/lightclient/verification_flags_pb.d.ts @@ -0,0 +1,39 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file lightclient/verification_flags.proto (package zetachain.zetacore.lightclient, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * VerificationFlags is a structure containing information which chain types are enabled for block header verification + * + * @generated from message zetachain.zetacore.lightclient.VerificationFlags + */ +export declare class VerificationFlags extends Message { + /** + * @generated from field: bool ethTypeChainEnabled = 1; + */ + ethTypeChainEnabled: boolean; + + /** + * @generated from field: bool btcTypeChainEnabled = 2; + */ + btcTypeChainEnabled: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.lightclient.VerificationFlags"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): VerificationFlags; + + static fromJson(jsonValue: JsonValue, options?: Partial): VerificationFlags; + + static fromJsonString(jsonString: string, options?: Partial): VerificationFlags; + + static equals(a: VerificationFlags | PlainMessage | undefined, b: VerificationFlags | PlainMessage | undefined): boolean; +} + diff --git a/x/lightclient/genesis.go b/x/lightclient/genesis.go index be632d257b..3f8239a198 100644 --- a/x/lightclient/genesis.go +++ b/x/lightclient/genesis.go @@ -17,12 +17,24 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.ChainStates { k.SetChainState(ctx, elem) } + + // set verification flags + k.SetVerificationFlags(ctx, genState.VerificationFlags) } // ExportGenesis returns the lightclient module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + verificationFlags, found := k.GetVerificationFlags(ctx) + if !found { + verificationFlags = types.VerificationFlags{ + EthTypeChainEnabled: false, + BtcTypeChainEnabled: false, + } + } + return &types.GenesisState{ - BlockHeaders: k.GetAllBlockHeaders(ctx), - ChainStates: k.GetAllChainStates(ctx), + BlockHeaders: k.GetAllBlockHeaders(ctx), + ChainStates: k.GetAllChainStates(ctx), + VerificationFlags: verificationFlags, } } diff --git a/x/lightclient/keeper/grpc_query_verification_flags.go b/x/lightclient/keeper/grpc_query_verification_flags.go new file mode 100644 index 0000000000..aca55988c0 --- /dev/null +++ b/x/lightclient/keeper/grpc_query_verification_flags.go @@ -0,0 +1,25 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/lightclient/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// VerificationFlags implements the Query/VerificationFlags gRPC method +func (k Keeper) VerificationFlags(c context.Context, req *types.QueryVerificationFlagsRequest) (*types.QueryVerificationFlagsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetVerificationFlags(ctx) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryVerificationFlagsResponse{VerificationFlags: val}, nil +} diff --git a/x/lightclient/keeper/verification_flags.go b/x/lightclient/keeper/verification_flags.go new file mode 100644 index 0000000000..5ba0d61ffe --- /dev/null +++ b/x/lightclient/keeper/verification_flags.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/lightclient/types" +) + +// SetVerificationFlags set the verification flags in the store +func (k Keeper) SetVerificationFlags(ctx sdk.Context, crosschainFlags types.VerificationFlags) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.VerificationFlagsKey)) + b := k.cdc.MustMarshal(&crosschainFlags) + store.Set([]byte{0}, b) +} + +// GetVerificationFlags returns the verification flags +func (k Keeper) GetVerificationFlags(ctx sdk.Context) (val types.VerificationFlags, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.VerificationFlagsKey)) + + b := store.Get([]byte{0}) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} diff --git a/x/lightclient/types/genesis.go b/x/lightclient/types/genesis.go index 4479a501a9..d4883d5b33 100644 --- a/x/lightclient/types/genesis.go +++ b/x/lightclient/types/genesis.go @@ -11,6 +11,10 @@ func DefaultGenesis() *GenesisState { return &GenesisState{ BlockHeaders: []proofs.BlockHeader{}, ChainStates: []ChainState{}, + VerificationFlags: VerificationFlags{ + EthTypeChainEnabled: false, + BtcTypeChainEnabled: false, + }, } } diff --git a/x/lightclient/types/genesis.pb.go b/x/lightclient/types/genesis.pb.go index 60609f09db..adca0d82ee 100644 --- a/x/lightclient/types/genesis.pb.go +++ b/x/lightclient/types/genesis.pb.go @@ -27,8 +27,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the lightclient module's genesis state. type GenesisState struct { - BlockHeaders []proofs.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers"` - ChainStates []ChainState `protobuf:"bytes,2,rep,name=chain_states,json=chainStates,proto3" json:"chain_states"` + BlockHeaders []proofs.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers"` + ChainStates []ChainState `protobuf:"bytes,2,rep,name=chain_states,json=chainStates,proto3" json:"chain_states"` + VerificationFlags VerificationFlags `protobuf:"bytes,3,opt,name=verification_flags,json=verificationFlags,proto3" json:"verification_flags"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -78,6 +79,13 @@ func (m *GenesisState) GetChainStates() []ChainState { return nil } +func (m *GenesisState) GetVerificationFlags() VerificationFlags { + if m != nil { + return m.VerificationFlags + } + return VerificationFlags{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.lightclient.GenesisState") } @@ -85,24 +93,27 @@ func init() { func init() { proto.RegisterFile("lightclient/genesis.proto", fileDescriptor_645b5300b371cd43) } var fileDescriptor_645b5300b371cd43 = []byte{ - // 263 bytes of a gzipped FileDescriptorProto + // 314 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xc9, 0x4c, 0xcf, 0x28, 0x49, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xab, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x90, 0x54, 0x4b, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x95, 0xea, 0x83, 0x58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x01, 0x00, 0x00, 0xff, 0xff, 0x6c, - 0xb2, 0xd1, 0x9e, 0x85, 0x01, 0x00, 0x00, + 0x96, 0xa4, 0x42, 0xa5, 0x55, 0x90, 0xa5, 0xcb, 0x52, 0x8b, 0x32, 0xd3, 0x32, 0x93, 0x13, 0x4b, + 0x32, 0xf3, 0xf3, 0xe2, 0xd3, 0x72, 0x12, 0xd3, 0xa1, 0x56, 0x4b, 0x89, 0x17, 0x64, 0xa7, 0xeb, + 0x17, 0x14, 0xe5, 0xe7, 0xa7, 0x15, 0x43, 0x29, 0x88, 0x84, 0x52, 0x37, 0x13, 0x17, 0x8f, 0x3b, + 0xc4, 0x95, 0xc1, 0x20, 0x53, 0x85, 0xec, 0xb8, 0x78, 0x93, 0x72, 0xf2, 0x93, 0xb3, 0xe3, 0x33, + 0x52, 0x13, 0x53, 0x52, 0x8b, 0x8a, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x84, 0xf5, 0xa0, + 0xda, 0x9c, 0x40, 0x92, 0x1e, 0x60, 0x39, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0x78, 0x92, + 0x10, 0x42, 0xc5, 0x42, 0xc1, 0x5c, 0x3c, 0x48, 0x8e, 0x2c, 0x96, 0x60, 0x02, 0x6b, 0xd7, 0xd2, + 0xc3, 0xef, 0x77, 0x3d, 0x67, 0x90, 0x14, 0xd8, 0x05, 0x50, 0x53, 0xb9, 0x93, 0xe1, 0x22, 0xc5, + 0x42, 0x69, 0x5c, 0x42, 0x98, 0x5e, 0x93, 0x60, 0x56, 0x60, 0xd4, 0xe0, 0x36, 0x32, 0x24, 0x64, + 0x74, 0x18, 0x92, 0x4e, 0x37, 0x90, 0x46, 0xa8, 0x0d, 0x82, 0x65, 0x18, 0x12, 0x3e, 0x27, 0x1e, + 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, + 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x94, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, + 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xb2, 0x45, 0x17, 0x6c, 0xa1, 0x3e, 0xcc, 0x42, 0xfd, 0x0a, 0x7d, + 0xe4, 0x78, 0x28, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x07, 0xb1, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0xd4, 0xfb, 0x01, 0x8d, 0x13, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -125,6 +136,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.VerificationFlags.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a if len(m.ChainStates) > 0 { for iNdEx := len(m.ChainStates) - 1; iNdEx >= 0; iNdEx-- { { @@ -185,6 +206,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + l = m.VerificationFlags.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -291,6 +314,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerificationFlags", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VerificationFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/lightclient/types/keys.go b/x/lightclient/types/keys.go index cf9457affc..6369421e58 100644 --- a/x/lightclient/types/keys.go +++ b/x/lightclient/types/keys.go @@ -18,8 +18,9 @@ const ( ) const ( - BlockHeaderKey = "BlockHeader-value-" - ChainStateKey = "ChainState-value-" + BlockHeaderKey = "BlockHeader-value-" + ChainStateKey = "ChainState-value-" + VerificationFlagsKey = "VerificationFlags-value-" ) func KeyPrefix(p string) []byte { diff --git a/x/lightclient/types/query.pb.go b/x/lightclient/types/query.pb.go index 99ab08338e..7d96e11051 100644 --- a/x/lightclient/types/query.pb.go +++ b/x/lightclient/types/query.pb.go @@ -520,6 +520,86 @@ func (m *QueryProveResponse) GetValid() bool { return false } +type QueryVerificationFlagsRequest struct { +} + +func (m *QueryVerificationFlagsRequest) Reset() { *m = QueryVerificationFlagsRequest{} } +func (m *QueryVerificationFlagsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVerificationFlagsRequest) ProtoMessage() {} +func (*QueryVerificationFlagsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_03e46747c4ffba77, []int{10} +} +func (m *QueryVerificationFlagsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVerificationFlagsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVerificationFlagsRequest.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 *QueryVerificationFlagsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVerificationFlagsRequest.Merge(m, src) +} +func (m *QueryVerificationFlagsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVerificationFlagsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVerificationFlagsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVerificationFlagsRequest proto.InternalMessageInfo + +type QueryVerificationFlagsResponse struct { + VerificationFlags VerificationFlags `protobuf:"bytes,1,opt,name=verification_flags,json=verificationFlags,proto3" json:"verification_flags"` +} + +func (m *QueryVerificationFlagsResponse) Reset() { *m = QueryVerificationFlagsResponse{} } +func (m *QueryVerificationFlagsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVerificationFlagsResponse) ProtoMessage() {} +func (*QueryVerificationFlagsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_03e46747c4ffba77, []int{11} +} +func (m *QueryVerificationFlagsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVerificationFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVerificationFlagsResponse.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 *QueryVerificationFlagsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVerificationFlagsResponse.Merge(m, src) +} +func (m *QueryVerificationFlagsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVerificationFlagsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVerificationFlagsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVerificationFlagsResponse proto.InternalMessageInfo + +func (m *QueryVerificationFlagsResponse) GetVerificationFlags() VerificationFlags { + if m != nil { + return m.VerificationFlags + } + return VerificationFlags{} +} + func init() { proto.RegisterType((*QueryAllBlockHeaderRequest)(nil), "zetachain.zetacore.lightclient.QueryAllBlockHeaderRequest") proto.RegisterType((*QueryAllBlockHeaderResponse)(nil), "zetachain.zetacore.lightclient.QueryAllBlockHeaderResponse") @@ -531,59 +611,67 @@ func init() { proto.RegisterType((*QueryGetChainStateResponse)(nil), "zetachain.zetacore.lightclient.QueryGetChainStateResponse") proto.RegisterType((*QueryProveRequest)(nil), "zetachain.zetacore.lightclient.QueryProveRequest") proto.RegisterType((*QueryProveResponse)(nil), "zetachain.zetacore.lightclient.QueryProveResponse") + proto.RegisterType((*QueryVerificationFlagsRequest)(nil), "zetachain.zetacore.lightclient.QueryVerificationFlagsRequest") + proto.RegisterType((*QueryVerificationFlagsResponse)(nil), "zetachain.zetacore.lightclient.QueryVerificationFlagsResponse") } func init() { proto.RegisterFile("lightclient/query.proto", fileDescriptor_03e46747c4ffba77) } var fileDescriptor_03e46747c4ffba77 = []byte{ - // 752 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x4f, 0xd4, 0x4e, - 0x18, 0xc7, 0x77, 0x80, 0xe5, 0xcf, 0x2c, 0xfc, 0x92, 0xdf, 0x48, 0xc2, 0x52, 0xa5, 0x90, 0x12, - 0x84, 0x60, 0x68, 0x65, 0x35, 0x24, 0x2e, 0x89, 0x09, 0x98, 0x88, 0x44, 0x0f, 0x50, 0xe3, 0xc5, - 0x0b, 0x99, 0xed, 0x8e, 0xdd, 0x86, 0xd2, 0x29, 0x3b, 0x03, 0x59, 0x24, 0x5c, 0x7c, 0x05, 0x26, - 0xc4, 0xb7, 0xe0, 0x1b, 0xf0, 0x42, 0xe2, 0xcd, 0x13, 0x47, 0x12, 0x2f, 0x9e, 0x8c, 0x01, 0x5f, - 0x88, 0x99, 0xe9, 0xac, 0x9d, 0x85, 0x22, 0x85, 0x70, 0xda, 0x76, 0xa6, 0xcf, 0xf3, 0x7c, 0xbe, - 0xdf, 0xe7, 0x99, 0xc9, 0xc2, 0x91, 0x30, 0xf0, 0x1b, 0xdc, 0x0b, 0x03, 0x12, 0x71, 0x67, 0x7b, - 0x87, 0x34, 0xf7, 0xec, 0xb8, 0x49, 0x39, 0x45, 0xe6, 0x7b, 0xc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x54, 0xae, 0x13, 0xa2, 0x40, 0xa7, 0x24, 0xe8, 0x38, 0x1a, 0xbb, 0x0c, 0x34, 0x16, 0x9f, 0x2f, - 0xbf, 0x3a, 0x3e, 0x35, 0xc1, 0xc9, 0xa9, 0x09, 0x7e, 0x9d, 0x9a, 0xe0, 0xe3, 0x99, 0x59, 0x38, - 0x39, 0x33, 0x0b, 0x3f, 0xce, 0xcc, 0xc2, 0xdb, 0x8a, 0x1f, 0xf0, 0xc6, 0x4e, 0xcd, 0xf6, 0xe8, - 0x96, 0x9e, 0xa2, 0x5d, 0xdf, 0x69, 0x75, 0x64, 0xe3, 0x7b, 0x31, 0x61, 0xb5, 0x5e, 0xf9, 0x2f, - 0xe1, 0xd1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x45, 0xdb, 0x53, 0xf8, 0x08, 0x00, 0x00, + // 843 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0xc7, 0x33, 0x40, 0xf8, 0x98, 0xc0, 0x95, 0x98, 0x8b, 0x44, 0xf0, 0xbd, 0x31, 0xc8, 0x5c, + 0x2e, 0x28, 0x2d, 0x76, 0x93, 0x56, 0x48, 0x0d, 0x2a, 0x12, 0x54, 0x82, 0xa2, 0x76, 0x01, 0xae, + 0xda, 0x45, 0x37, 0x91, 0xe3, 0x4c, 0x1c, 0x0b, 0xe3, 0x31, 0xf1, 0x10, 0x85, 0x22, 0x36, 0x5d, + 0x75, 0x59, 0xa9, 0xea, 0x2b, 0xf4, 0x05, 0xba, 0x41, 0xea, 0xae, 0x8b, 0x8a, 0x25, 0x52, 0x37, + 0x5d, 0x54, 0x55, 0x05, 0x7d, 0x90, 0xca, 0xe3, 0x49, 0x3d, 0xf9, 0x2a, 0x26, 0x62, 0x15, 0x7b, + 0xc6, 0xe7, 0x9c, 0xdf, 0x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 0x06, 0xfd, 0x3f, 0xc9, 0x6a, 0xed, 0xd4, 0x48, 0x3d, 0x06, 0x1b, 0x9a, 0x86, 0x23, 0xb4, 0x11, + 0xb6, 0x59, 0xe0, 0xcc, 0x98, 0x3e, 0x4c, 0x1b, 0x41, 0x8f, 0xa1, 0x79, 0x98, 0x64, 0xfd, 0x92, + 0x1e, 0x64, 0x40, 0x13, 0xcd, 0xee, 0xd9, 0x09, 0x7e, 0xf4, 0x70, 0xaf, 0xad, 0x4f, 0x87, 0x58, + 0x82, 0xa8, 0x4f, 0x83, 0xba, 0xb4, 0x51, 0xb4, 0xdd, 0x32, 0x6e, 0xa4, 0x93, 0x61, 0x5d, 0xda, + 0xd8, 0x0e, 0x5e, 0x95, 0x2c, 0x44, 0x22, 0x27, 0xf7, 0x62, 0x0a, 0x26, 0xeb, 0x86, 0xc3, 0x29, + 0x47, 0xf5, 0xf0, 0x45, 0x99, 0x85, 0x19, 0xf6, 0xed, 0x73, 0x61, 0xe8, 0x6c, 0x06, 0x33, 0x87, + 0xeb, 0x53, 0x5e, 0x03, 0x28, 0xf7, 0xfa, 0x82, 0x67, 0xae, 0x40, 0xd4, 0x39, 0xb3, 0xb8, 0xd9, + 0xb9, 0xab, 0xcc, 0xee, 0x48, 0xcb, 0xbb, 0x6c, 0xb2, 0xde, 0xbe, 0x91, 0xff, 0x36, 0x0a, 0x93, + 0x0c, 0x05, 0x9d, 0x02, 0xf8, 0x97, 0x70, 0xd5, 0xd6, 0x1d, 0x07, 0x15, 0xae, 0x2a, 0xd4, 0x7b, + 0x42, 0x4a, 0xab, 0x7d, 0xc5, 0x86, 0xea, 0x95, 0xe5, 0x57, 0x5f, 0x7e, 0xbe, 0x1d, 0x58, 0x44, + 0x0b, 0x5a, 0x10, 0xba, 0xcc, 0xb2, 0x68, 0xe2, 0x3c, 0x6f, 0x19, 0x8a, 0xe8, 0x13, 0x80, 0x29, + 0x21, 0x4d, 0x4c, 0xee, 0xae, 0xa3, 0x2c, 0x26, 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 0x00, + 0x00, 0xff, 0xff, 0x4b, 0x9e, 0x6d, 0x85, 0x93, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -602,8 +690,8 @@ type QueryClient interface { BlockHeader(ctx context.Context, in *QueryGetBlockHeaderRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderResponse, error) ChainStateAll(ctx context.Context, in *QueryAllChainStateRequest, opts ...grpc.CallOption) (*QueryAllChainStateResponse, error) ChainState(ctx context.Context, in *QueryGetChainStateRequest, opts ...grpc.CallOption) (*QueryGetChainStateResponse, error) - // Prove performs merkle proof verification Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) + VerificationFlags(ctx context.Context, in *QueryVerificationFlagsRequest, opts ...grpc.CallOption) (*QueryVerificationFlagsResponse, error) } type queryClient struct { @@ -659,14 +747,23 @@ func (c *queryClient) Prove(ctx context.Context, in *QueryProveRequest, opts ... return out, nil } +func (c *queryClient) VerificationFlags(ctx context.Context, in *QueryVerificationFlagsRequest, opts ...grpc.CallOption) (*QueryVerificationFlagsResponse, error) { + out := new(QueryVerificationFlagsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.lightclient.Query/VerificationFlags", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { BlockHeaderAll(context.Context, *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) BlockHeader(context.Context, *QueryGetBlockHeaderRequest) (*QueryGetBlockHeaderResponse, error) ChainStateAll(context.Context, *QueryAllChainStateRequest) (*QueryAllChainStateResponse, error) ChainState(context.Context, *QueryGetChainStateRequest) (*QueryGetChainStateResponse, error) - // Prove performs merkle proof verification Prove(context.Context, *QueryProveRequest) (*QueryProveResponse, error) + VerificationFlags(context.Context, *QueryVerificationFlagsRequest) (*QueryVerificationFlagsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -688,6 +785,9 @@ func (*UnimplementedQueryServer) ChainState(ctx context.Context, req *QueryGetCh func (*UnimplementedQueryServer) Prove(ctx context.Context, req *QueryProveRequest) (*QueryProveResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Prove not implemented") } +func (*UnimplementedQueryServer) VerificationFlags(ctx context.Context, req *QueryVerificationFlagsRequest) (*QueryVerificationFlagsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VerificationFlags not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -783,6 +883,24 @@ func _Query_Prove_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } +func _Query_VerificationFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVerificationFlagsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).VerificationFlags(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.lightclient.Query/VerificationFlags", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).VerificationFlags(ctx, req.(*QueryVerificationFlagsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.lightclient.Query", HandlerType: (*QueryServer)(nil), @@ -807,6 +925,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Prove", Handler: _Query_Prove_Handler, }, + { + MethodName: "VerificationFlags", + Handler: _Query_VerificationFlags_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "lightclient/query.proto", @@ -1200,6 +1322,62 @@ func (m *QueryProveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryVerificationFlagsRequest) 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 *QueryVerificationFlagsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVerificationFlagsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryVerificationFlagsResponse) 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 *QueryVerificationFlagsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVerificationFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.VerificationFlags.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1365,6 +1543,26 @@ func (m *QueryProveResponse) Size() (n int) { return n } +func (m *QueryVerificationFlagsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryVerificationFlagsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.VerificationFlags.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2366,6 +2564,139 @@ func (m *QueryProveResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryVerificationFlagsRequest) 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 ErrIntOverflowQuery + } + 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: QueryVerificationFlagsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVerificationFlagsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVerificationFlagsResponse) 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 ErrIntOverflowQuery + } + 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: QueryVerificationFlagsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVerificationFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerificationFlags", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VerificationFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/lightclient/types/query.pb.gw.go b/x/lightclient/types/query.pb.gw.go index 58ded35829..1b62c608cb 100644 --- a/x/lightclient/types/query.pb.gw.go +++ b/x/lightclient/types/query.pb.gw.go @@ -249,6 +249,24 @@ func local_request_Query_Prove_0(ctx context.Context, marshaler runtime.Marshale } +func request_Query_VerificationFlags_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVerificationFlagsRequest + var metadata runtime.ServerMetadata + + msg, err := client.VerificationFlags(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_VerificationFlags_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVerificationFlagsRequest + var metadata runtime.ServerMetadata + + msg, err := server.VerificationFlags(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -370,6 +388,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_VerificationFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_VerificationFlags_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VerificationFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -511,6 +552,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_VerificationFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_VerificationFlags_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VerificationFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -524,6 +585,8 @@ var ( pattern_Query_ChainState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "lightclient", "chain_state", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Prove_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "lightclient", "prove"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_VerificationFlags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "lightclient", "verification_flags"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -536,4 +599,6 @@ var ( forward_Query_ChainState_0 = runtime.ForwardResponseMessage forward_Query_Prove_0 = runtime.ForwardResponseMessage + + forward_Query_VerificationFlags_0 = runtime.ForwardResponseMessage ) diff --git a/x/lightclient/types/verification_flags.pb.go b/x/lightclient/types/verification_flags.pb.go new file mode 100644 index 0000000000..94c90b358a --- /dev/null +++ b/x/lightclient/types/verification_flags.pb.go @@ -0,0 +1,352 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lightclient/verification_flags.proto + +package types + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// 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 + +// VerificationFlags is a structure containing information which chain types are enabled for block header verification +type VerificationFlags struct { + EthTypeChainEnabled bool `protobuf:"varint,1,opt,name=ethTypeChainEnabled,proto3" json:"ethTypeChainEnabled,omitempty"` + BtcTypeChainEnabled bool `protobuf:"varint,2,opt,name=btcTypeChainEnabled,proto3" json:"btcTypeChainEnabled,omitempty"` +} + +func (m *VerificationFlags) Reset() { *m = VerificationFlags{} } +func (m *VerificationFlags) String() string { return proto.CompactTextString(m) } +func (*VerificationFlags) ProtoMessage() {} +func (*VerificationFlags) Descriptor() ([]byte, []int) { + return fileDescriptor_86eae6d737b3f8cc, []int{0} +} +func (m *VerificationFlags) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerificationFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VerificationFlags.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 *VerificationFlags) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerificationFlags.Merge(m, src) +} +func (m *VerificationFlags) XXX_Size() int { + return m.Size() +} +func (m *VerificationFlags) XXX_DiscardUnknown() { + xxx_messageInfo_VerificationFlags.DiscardUnknown(m) +} + +var xxx_messageInfo_VerificationFlags proto.InternalMessageInfo + +func (m *VerificationFlags) GetEthTypeChainEnabled() bool { + if m != nil { + return m.EthTypeChainEnabled + } + return false +} + +func (m *VerificationFlags) GetBtcTypeChainEnabled() bool { + if m != nil { + return m.BtcTypeChainEnabled + } + return false +} + +func init() { + proto.RegisterType((*VerificationFlags)(nil), "zetachain.zetacore.lightclient.VerificationFlags") +} + +func init() { + proto.RegisterFile("lightclient/verification_flags.proto", fileDescriptor_86eae6d737b3f8cc) +} + +var fileDescriptor_86eae6d737b3f8cc = []byte{ + // 199 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc9, 0xc9, 0x4c, 0xcf, + 0x28, 0x49, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0xd1, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xcb, 0x4c, 0x4e, + 0x2c, 0xc9, 0xcc, 0xcf, 0x8b, 0x4f, 0xcb, 0x49, 0x4c, 0x2f, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x92, 0xab, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, + 0x52, 0xf5, 0x90, 0x34, 0x2a, 0x95, 0x73, 0x09, 0x86, 0x21, 0xe9, 0x75, 0x03, 0x69, 0x15, 0x32, + 0xe0, 0x12, 0x4e, 0x2d, 0xc9, 0x08, 0xa9, 0x2c, 0x48, 0x75, 0x06, 0xe9, 0x74, 0xcd, 0x4b, 0x4c, + 0xca, 0x49, 0x4d, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x08, 0xc2, 0x26, 0x05, 0xd2, 0x91, 0x54, + 0x92, 0x8c, 0xa1, 0x83, 0x09, 0xa2, 0x03, 0x8b, 0x94, 0x93, 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, + 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, + 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, + 0xea, 0x83, 0xdc, 0xac, 0x0b, 0x76, 0xbe, 0x3e, 0xcc, 0xf9, 0xfa, 0x15, 0xfa, 0xc8, 0x3e, 0x2f, + 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xfb, 0xd6, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x84, + 0x57, 0x0d, 0x3e, 0x15, 0x01, 0x00, 0x00, +} + +func (m *VerificationFlags) 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 *VerificationFlags) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerificationFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BtcTypeChainEnabled { + i-- + if m.BtcTypeChainEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.EthTypeChainEnabled { + i-- + if m.EthTypeChainEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintVerificationFlags(dAtA []byte, offset int, v uint64) int { + offset -= sovVerificationFlags(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *VerificationFlags) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EthTypeChainEnabled { + n += 2 + } + if m.BtcTypeChainEnabled { + n += 2 + } + return n +} + +func sovVerificationFlags(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozVerificationFlags(x uint64) (n int) { + return sovVerificationFlags(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *VerificationFlags) 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 ErrIntOverflowVerificationFlags + } + 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: VerificationFlags: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerificationFlags: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EthTypeChainEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerificationFlags + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EthTypeChainEnabled = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcTypeChainEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerificationFlags + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BtcTypeChainEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipVerificationFlags(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthVerificationFlags + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVerificationFlags(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, ErrIntOverflowVerificationFlags + } + 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, ErrIntOverflowVerificationFlags + } + 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, ErrIntOverflowVerificationFlags + } + 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, ErrInvalidLengthVerificationFlags + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVerificationFlags + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthVerificationFlags + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthVerificationFlags = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVerificationFlags = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVerificationFlags = fmt.Errorf("proto: unexpected end of group") +)