diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 540a09a7..fe08ad8f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,7 +22,7 @@ jobs: with: go-version: 1.21.6 check-latest: true - - uses: golangci/golangci-lint-action@v3 + - uses: golangci/golangci-lint-action@v6 with: version: latest args: --timeout 10m --tests=false --exclude-dirs="e2e" @@ -33,7 +33,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install Buf - uses: bufbuild/buf-setup-action@v1.26.1 + uses: bufbuild/buf-setup-action@v1.47.2 - name: Lint Proto run: make proto-lint - name: clang-format Check diff --git a/.golangci.yml b/.golangci.yml index fbaa89d1..00aa5caf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -20,7 +20,7 @@ linters: - misspell - prealloc - revive - - exportloopref + - copyloopvar - staticcheck - stylecheck - typecheck diff --git a/proto/buf.yaml b/proto/buf.yaml index 3d213e18..c9aa9081 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -10,7 +10,7 @@ breaking: - FILE lint: use: - - DEFAULT + - STANDARD - COMMENTS - FILE_LOWER_SNAKE_CASE except: diff --git a/proto/sedachain/pubkey/v1/query.proto b/proto/sedachain/pubkey/v1/query.proto index 4416bcda..55da7a2c 100644 --- a/proto/sedachain/pubkey/v1/query.proto +++ b/proto/sedachain/pubkey/v1/query.proto @@ -11,6 +11,11 @@ option go_package = "github.com/sedaprotocol/seda-chain/x/pubkey/types"; // Query defines the gRPC querier service. service Query { + // Params returns the total set of pubkey parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/seda/pubkey/params"; + } + // ValidatorKeys returns a given validator's registered keys. rpc ValidatorKeys(QueryValidatorKeysRequest) returns (QueryValidatorKeysResponse) { @@ -25,6 +30,15 @@ service Query { } } +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + // QueryValidatorKeysRequest is request type for the Query/ValidatorKeys // RPC method. message QueryValidatorKeysRequest { diff --git a/x/pubkey/client/cli/query.go b/x/pubkey/client/cli/query.go index 96cd79f8..624e63ec 100644 --- a/x/pubkey/client/cli/query.go +++ b/x/pubkey/client/cli/query.go @@ -21,12 +21,37 @@ func GetQueryCmd() *cobra.Command { } cmd.AddCommand( + GetCmdQueryParams(), GetCmdValidatorKeys(), GetProvingSchemes(), ) return cmd } +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query the current pubkey module parameters", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + // GetCmdValidatorKeys returns the command for querying a given // validator's public keys. func GetCmdValidatorKeys() *cobra.Command { diff --git a/x/pubkey/keeper/grpc_query.go b/x/pubkey/keeper/grpc_query.go index 426aeaa1..220cea69 100644 --- a/x/pubkey/keeper/grpc_query.go +++ b/x/pubkey/keeper/grpc_query.go @@ -14,6 +14,15 @@ type Querier struct { Keeper } +func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params, err := q.Keeper.GetParams(ctx) + if err != nil { + return nil, err + } + return &types.QueryParamsResponse{Params: params}, nil +} + func (q Querier) ValidatorKeys(ctx context.Context, req *types.QueryValidatorKeysRequest) (*types.QueryValidatorKeysResponse, error) { result, err := q.GetValidatorKeys(ctx, req.ValidatorAddr) if err != nil { diff --git a/x/pubkey/keeper/keeper.go b/x/pubkey/keeper/keeper.go index bfdeb46e..00242877 100644 --- a/x/pubkey/keeper/keeper.go +++ b/x/pubkey/keeper/keeper.go @@ -215,6 +215,10 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { return k.params.Set(ctx, params) } +func (k Keeper) GetParams(ctx sdk.Context) (types.Params, error) { + return k.params.Get(ctx) +} + func (k Keeper) GetActivationBlockDelay(ctx sdk.Context) (int64, error) { params, err := k.params.Get(ctx) if err != nil { diff --git a/x/pubkey/types/query.pb.go b/x/pubkey/types/query.pb.go index 4152a56b..417c754f 100644 --- a/x/pubkey/types/query.pb.go +++ b/x/pubkey/types/query.pb.go @@ -30,6 +30,89 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ab5fa3182b3fb474, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ab5fa3182b3fb474, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + // QueryValidatorKeysRequest is request type for the Query/ValidatorKeys // RPC method. type QueryValidatorKeysRequest struct { @@ -40,7 +123,7 @@ func (m *QueryValidatorKeysRequest) Reset() { *m = QueryValidatorKeysReq func (m *QueryValidatorKeysRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorKeysRequest) ProtoMessage() {} func (*QueryValidatorKeysRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ab5fa3182b3fb474, []int{0} + return fileDescriptor_ab5fa3182b3fb474, []int{2} } func (m *QueryValidatorKeysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -86,7 +169,7 @@ func (m *QueryValidatorKeysResponse) Reset() { *m = QueryValidatorKeysRe func (m *QueryValidatorKeysResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorKeysResponse) ProtoMessage() {} func (*QueryValidatorKeysResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ab5fa3182b3fb474, []int{1} + return fileDescriptor_ab5fa3182b3fb474, []int{3} } func (m *QueryValidatorKeysResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -131,7 +214,7 @@ func (m *QueryProvingSchemesRequest) Reset() { *m = QueryProvingSchemesR func (m *QueryProvingSchemesRequest) String() string { return proto.CompactTextString(m) } func (*QueryProvingSchemesRequest) ProtoMessage() {} func (*QueryProvingSchemesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ab5fa3182b3fb474, []int{2} + return fileDescriptor_ab5fa3182b3fb474, []int{4} } func (m *QueryProvingSchemesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,7 +253,7 @@ func (m *QueryProvingSchemesResponse) Reset() { *m = QueryProvingSchemes func (m *QueryProvingSchemesResponse) String() string { return proto.CompactTextString(m) } func (*QueryProvingSchemesResponse) ProtoMessage() {} func (*QueryProvingSchemesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ab5fa3182b3fb474, []int{3} + return fileDescriptor_ab5fa3182b3fb474, []int{5} } func (m *QueryProvingSchemesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -207,6 +290,8 @@ func (m *QueryProvingSchemesResponse) GetProvingSchemes() []ProvingScheme { } func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "sedachain.pubkey.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "sedachain.pubkey.v1.QueryParamsResponse") proto.RegisterType((*QueryValidatorKeysRequest)(nil), "sedachain.pubkey.v1.QueryValidatorKeysRequest") proto.RegisterType((*QueryValidatorKeysResponse)(nil), "sedachain.pubkey.v1.QueryValidatorKeysResponse") proto.RegisterType((*QueryProvingSchemesRequest)(nil), "sedachain.pubkey.v1.QueryProvingSchemesRequest") @@ -216,37 +301,40 @@ func init() { func init() { proto.RegisterFile("sedachain/pubkey/v1/query.proto", fileDescriptor_ab5fa3182b3fb474) } var fileDescriptor_ab5fa3182b3fb474 = []byte{ - // 467 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcb, 0x6e, 0xd4, 0x30, - 0x14, 0x9d, 0x94, 0x87, 0x84, 0xab, 0x0e, 0xc8, 0xb0, 0x68, 0x43, 0x49, 0xa7, 0x11, 0x48, 0x15, - 0x52, 0x63, 0x66, 0x60, 0xc5, 0x8e, 0x59, 0x21, 0x75, 0xd3, 0x4e, 0x25, 0x24, 0xd8, 0x8c, 0xf2, - 0xb8, 0xca, 0x58, 0x9d, 0xb1, 0xdd, 0xd8, 0x09, 0x44, 0x88, 0x0d, 0x5f, 0x80, 0xc4, 0x07, 0xf0, - 0x03, 0x2c, 0xf9, 0x88, 0x2e, 0x2b, 0xd8, 0x74, 0x85, 0xd0, 0x0c, 0x1f, 0x82, 0xe2, 0x38, 0xd3, - 0xa6, 0x32, 0x55, 0x77, 0xf6, 0xbd, 0xe7, 0x9e, 0x73, 0x7c, 0xae, 0xd1, 0x96, 0x84, 0x24, 0x8c, - 0x27, 0x21, 0x65, 0x44, 0xe4, 0xd1, 0x11, 0x94, 0xa4, 0xe8, 0x93, 0xe3, 0x1c, 0xb2, 0x32, 0x10, - 0x19, 0x57, 0x1c, 0xdf, 0x5f, 0x02, 0x82, 0x1a, 0x10, 0x14, 0x7d, 0x77, 0x33, 0xe5, 0x3c, 0x9d, - 0x02, 0x09, 0x05, 0x25, 0x21, 0x63, 0x5c, 0x85, 0x8a, 0x72, 0x26, 0xeb, 0x11, 0xf7, 0x41, 0xca, - 0x53, 0xae, 0x8f, 0xa4, 0x3a, 0x99, 0xea, 0x46, 0xcc, 0xe5, 0x8c, 0xcb, 0x71, 0xdd, 0xa8, 0x2f, - 0xa6, 0xb5, 0x6d, 0x33, 0x91, 0x02, 0x03, 0x49, 0x1b, 0x48, 0xcf, 0x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- 0xf9, 0xd7, 0xdf, 0xaf, 0x2b, 0x2f, 0xf0, 0x80, 0x54, 0x83, 0xbb, 0xed, 0x8f, 0xb1, 0x5c, 0x40, - 0x15, 0x3e, 0xf9, 0xd8, 0x5e, 0xfc, 0x27, 0xfc, 0xcd, 0x41, 0xdd, 0x76, 0x4c, 0xf8, 0x0a, 0x7d, - 0x6b, 0xdc, 0xee, 0xb3, 0xeb, 0x0f, 0x18, 0xc7, 0x4f, 0xb5, 0xe3, 0xc7, 0xd8, 0xb7, 0x38, 0xbe, - 0xb4, 0x9a, 0xe1, 0xde, 0xc9, 0xdc, 0x73, 0x4e, 0xe7, 0x9e, 0xf3, 0x67, 0xee, 0x39, 0x5f, 0x16, - 0x5e, 0xe7, 0x74, 0xe1, 0x75, 0xce, 0x16, 0x5e, 0xe7, 0x5d, 0x3f, 0xa5, 0x6a, 0x92, 0x47, 0x41, - 0xcc, 0x67, 0x9a, 0x47, 0x7f, 0xfd, 0x98, 0x4f, 0x2f, 0x92, 0x7e, 0x68, 0x68, 0x55, 0x29, 0x40, - 0x46, 0xb7, 0x35, 0xe6, 0xf9, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc8, 0xb2, 0x16, 0x8b, 0xea, - 0x03, 0x00, 0x00, + // 528 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6e, 0xd3, 0x40, + 0x14, 0x8d, 0x29, 0x44, 0x62, 0xaa, 0x06, 0x34, 0x29, 0x52, 0xeb, 0x14, 0x37, 0xb5, 0x40, 0x44, + 0x48, 0xf5, 0x90, 0xc0, 0x06, 0x76, 0x64, 0x85, 0xd4, 0x4d, 0x9a, 0x4a, 0x48, 0xb0, 0x89, 0xc6, + 0xf6, 0xc8, 0xb1, 0x9a, 0x78, 0xa6, 0x1e, 0xdb, 0xd4, 0x42, 0x6c, 0x38, 0x01, 0x12, 0x07, 0xe0, + 0x02, 0x2c, 0x39, 0x44, 0x97, 0x55, 0xd9, 0xb0, 0x42, 0x28, 0xe1, 0x20, 0xc8, 0x33, 0x63, 0x13, + 0x97, 0x01, 0xba, 0x73, 0xfe, 0x7f, 0xff, 0xbd, 0xf7, 0xe7, 0xfd, 0x80, 0x5d, 0x4e, 0x7c, 0xec, + 0x4d, 0x71, 0x18, 0x21, 0x96, 0xba, 0xc7, 0x24, 0x47, 0x59, 0x1f, 0x9d, 0xa4, 0x24, 0xce, 0x1d, + 0x16, 0xd3, 0x84, 0xc2, 0x76, 0x05, 0x70, 0x24, 0xc0, 0xc9, 0xfa, 0xe6, 0x4e, 0x40, 0x69, 0x30, + 0x23, 0x08, 0xb3, 0x10, 0xe1, 0x28, 0xa2, 0x09, 0x4e, 0x42, 0x1a, 0x71, 0x39, 0x62, 0x6e, 0x06, + 0x34, 0xa0, 0xe2, 0x13, 0x15, 0x5f, 0xaa, 0xba, 0xed, 0x51, 0x3e, 0xa7, 0x7c, 0x22, 0x1b, 0xf2, + 0x87, 0x6a, 0xed, 0xe9, 0x4c, 0x04, 0x24, 0x22, 0x3c, 0x2c, 0x21, 0x5d, 0x1d, 0x44, 0x19, 0x12, + 0x08, 0x7b, 0x13, 0xc0, 0xc3, 0xc2, 0xf7, 0x08, 0xc7, 0x78, 0xce, 0xc7, 0xe4, 0x24, 0x25, 0x3c, + 0xb1, 0x47, 0xa0, 0x5d, 0xab, 0x72, 0x46, 0x23, 0x4e, 0xe0, 0x53, 0xd0, 0x64, 0xa2, 0xb2, 0x65, + 0x74, 0x8d, 0xde, 0xfa, 0xa0, 0xe3, 0x68, 0xd6, 0x74, 0xe4, 0xd0, 0xf0, 0xfa, 0xd9, 0xf7, 0xdd, + 0xc6, 0x58, 0x0d, 0xd8, 0x04, 0x6c, 0x0b, 0xc6, 0x97, 0x78, 0x16, 0xfa, 0x38, 0xa1, 0xf1, 0x01, + 0xc9, 0x4b, 0x39, 0xf8, 0x02, 0xb4, 0xb2, 0x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a2, 0x2f, 0x62, 0x47, 0x6f, + 0xeb, 0x27, 0xf7, 0x0e, 0x7e, 0x32, 0x40, 0xab, 0x1e, 0x10, 0xfc, 0x87, 0xbe, 0x36, 0x68, 0xf3, + 0xd1, 0xd5, 0x07, 0x94, 0xe3, 0x87, 0xc2, 0xf1, 0x3d, 0x68, 0x6b, 0x1c, 0x5f, 0x3a, 0x8a, 0xe1, + 0xc1, 0xd9, 0xc2, 0x32, 0xce, 0x17, 0x96, 0xf1, 0x63, 0x61, 0x19, 0x1f, 0x96, 0x56, 0xe3, 0x7c, + 0x69, 0x35, 0xbe, 0x2d, 0xad, 0xc6, 0xeb, 0x7e, 0x10, 0x26, 0xd3, 0xd4, 0x75, 0x3c, 0x3a, 0x17, + 0x3c, 0xe2, 0xcf, 0xed, 0xd1, 0xd9, 0x2a, 0xe9, 0x69, 0x49, 0x9b, 0xe4, 0x8c, 0x70, 0xb7, 0x29, + 0x30, 0x8f, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc4, 0x4d, 0x23, 0xa7, 0xcc, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -261,6 +349,8 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // Params returns the total set of pubkey parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // ValidatorKeys returns a given validator's registered keys. ValidatorKeys(ctx context.Context, in *QueryValidatorKeysRequest, opts ...grpc.CallOption) (*QueryValidatorKeysResponse, error) // ProvingSchemes returns the statuses of the SEDA proving schemes. @@ -275,6 +365,15 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/sedachain.pubkey.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) ValidatorKeys(ctx context.Context, in *QueryValidatorKeysRequest, opts ...grpc.CallOption) (*QueryValidatorKeysResponse, error) { out := new(QueryValidatorKeysResponse) err := c.cc.Invoke(ctx, "/sedachain.pubkey.v1.Query/ValidatorKeys", in, out, opts...) @@ -295,6 +394,8 @@ func (c *queryClient) ProvingSchemes(ctx context.Context, in *QueryProvingScheme // QueryServer is the server API for Query service. type QueryServer interface { + // Params returns the total set of pubkey parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // ValidatorKeys returns a given validator's registered keys. ValidatorKeys(context.Context, *QueryValidatorKeysRequest) (*QueryValidatorKeysResponse, error) // ProvingSchemes returns the statuses of the SEDA proving schemes. @@ -305,6 +406,9 @@ type QueryServer interface { type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} func (*UnimplementedQueryServer) ValidatorKeys(ctx context.Context, req *QueryValidatorKeysRequest) (*QueryValidatorKeysResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ValidatorKeys not implemented") } @@ -316,6 +420,24 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sedachain.pubkey.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_ValidatorKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryValidatorKeysRequest) if err := dec(in); err != nil { @@ -357,6 +479,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "sedachain.pubkey.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, { MethodName: "ValidatorKeys", Handler: _Query_ValidatorKeys_Handler, @@ -370,6 +496,62 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "sedachain/pubkey/v1/query.proto", } +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.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 (m *QueryValidatorKeysRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -504,6 +686,26 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func (m *QueryValidatorKeysRequest) Size() (n int) { if m == nil { return 0 @@ -558,6 +760,139 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params.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 (m *QueryValidatorKeysRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/pubkey/types/query.pb.gw.go b/x/pubkey/types/query.pb.gw.go index e04995c0..aeb07ea9 100644 --- a/x/pubkey/types/query.pb.gw.go +++ b/x/pubkey/types/query.pb.gw.go @@ -33,6 +33,24 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_ValidatorKeys_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryValidatorKeysRequest var metadata runtime.ServerMetadata @@ -111,6 +129,29 @@ func local_request_Query_ProvingSchemes_0(ctx context.Context, marshaler runtime // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_ValidatorKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -198,6 +239,26 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_ValidatorKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -242,12 +303,16 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"seda", "pubkey", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ValidatorKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"seda-chain", "pubkey", "validator_keys", "validator_addr"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ProvingSchemes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"seda-chain", "pubkey", "proving_schemes"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + forward_Query_ValidatorKeys_0 = runtime.ForwardResponseMessage forward_Query_ProvingSchemes_0 = runtime.ForwardResponseMessage