diff --git a/proto/cosmos/base/node/v2/query.proto b/proto/cosmos/base/node/v2/query.proto deleted file mode 100644 index 24de6fd21223..000000000000 --- a/proto/cosmos/base/node/v2/query.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package cosmos.base.node.v2; - -import "google/api/annotations.proto"; - -option go_package = "cosmossdk.io/server/v2/api/grpc/nodeservice"; - -// Service defines the gRPC querier service for node related queries. -service Service { - // Config queries for the operator configuration. - rpc Config(ConfigRequest) returns (ConfigResponse) { - option (google.api.http).get = "/cosmos/base/node/v2/config"; - } -} - -// ConfigRequest defines the request structure for the Config gRPC query. -message ConfigRequest {} - -// ConfigResponse defines the response structure for the Config gRPC query. -message ConfigResponse { - string minimum_gas_price = 1; -} \ No newline at end of file diff --git a/scripts/build/protobuf.mk b/scripts/build/protobuf.mk index d269e624331d..25d98b3f9538 100644 --- a/scripts/build/protobuf.mk +++ b/scripts/build/protobuf.mk @@ -1,4 +1,4 @@ -protoVer=0.15.1 +protoVer=0.15.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) diff --git a/server/v2/api/grpc/nodeservice/query.pb.go b/server/v2/api/grpc/nodeservice/query.pb.go deleted file mode 100644 index 7201c35db4f1..000000000000 --- a/server/v2/api/grpc/nodeservice/query.pb.go +++ /dev/null @@ -1,532 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/node/v2/query.proto - -package nodeservice - -import ( - context "context" - fmt "fmt" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// 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 - -// ConfigRequest defines the request structure for the Config gRPC query. -type ConfigRequest struct { -} - -func (m *ConfigRequest) Reset() { *m = ConfigRequest{} } -func (m *ConfigRequest) String() string { return proto.CompactTextString(m) } -func (*ConfigRequest) ProtoMessage() {} -func (*ConfigRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e86a941b0be4e1ff, []int{0} -} -func (m *ConfigRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConfigRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConfigRequest.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 *ConfigRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConfigRequest.Merge(m, src) -} -func (m *ConfigRequest) XXX_Size() int { - return m.Size() -} -func (m *ConfigRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ConfigRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ConfigRequest proto.InternalMessageInfo - -// ConfigResponse defines the response structure for the Config gRPC query. -type ConfigResponse struct { - MinimumGasPrice string `protobuf:"bytes,1,opt,name=minimum_gas_price,json=minimumGasPrice,proto3" json:"minimum_gas_price,omitempty"` -} - -func (m *ConfigResponse) Reset() { *m = ConfigResponse{} } -func (m *ConfigResponse) String() string { return proto.CompactTextString(m) } -func (*ConfigResponse) ProtoMessage() {} -func (*ConfigResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e86a941b0be4e1ff, []int{1} -} -func (m *ConfigResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConfigResponse.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 *ConfigResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConfigResponse.Merge(m, src) -} -func (m *ConfigResponse) XXX_Size() int { - return m.Size() -} -func (m *ConfigResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ConfigResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ConfigResponse proto.InternalMessageInfo - -func (m *ConfigResponse) GetMinimumGasPrice() string { - if m != nil { - return m.MinimumGasPrice - } - return "" -} - -func init() { - proto.RegisterType((*ConfigRequest)(nil), "cosmos.base.node.v2.ConfigRequest") - proto.RegisterType((*ConfigResponse)(nil), "cosmos.base.node.v2.ConfigResponse") -} - -func init() { proto.RegisterFile("cosmos/base/node/v2/query.proto", fileDescriptor_e86a941b0be4e1ff) } - -var fileDescriptor_e86a941b0be4e1ff = []byte{ - // 275 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xb1, 0x4a, 0xf4, 0x40, - 0x14, 0x85, 0x33, 0x7f, 0xb1, 0x3f, 0x0e, 0xe8, 0x62, 0x6c, 0x64, 0xd5, 0x51, 0xb2, 0x8d, 0x28, - 0xcc, 0x40, 0x6c, 0xad, 0x14, 0xb1, 0x95, 0xb5, 0xb3, 0x59, 0x66, 0xb3, 0xd7, 0x30, 0x68, 0xe6, - 0x66, 0xe7, 0x26, 0x01, 0x4b, 0x7d, 0x02, 0xc1, 0x97, 0xb2, 0x5c, 0xb0, 0xb1, 0x94, 0xc4, 0x07, - 0x91, 0xc9, 0x68, 0x21, 0x2c, 0xb6, 0xe7, 0x7e, 0xe7, 0xdc, 0xc3, 0xe1, 0xfb, 0x19, 0x52, 0x81, - 0xa4, 0x66, 0x9a, 0x40, 0x59, 0x9c, 0x83, 0x6a, 0x52, 0xb5, 0xa8, 0xc1, 0x3d, 0xc8, 0xd2, 0x61, - 0x85, 0xf1, 0x56, 0x00, 0xa4, 0x07, 0xa4, 0x07, 0x64, 0x93, 0x8e, 0x76, 0x73, 0xc4, 0xfc, 0x1e, - 0x94, 0x2e, 0x8d, 0xd2, 0xd6, 0x62, 0xa5, 0x2b, 0x83, 0x96, 0x82, 0x25, 0x19, 0xf2, 0xf5, 0x73, - 0xb4, 0xb7, 0x26, 0x9f, 0xc0, 0xa2, 0x06, 0xaa, 0x92, 0x53, 0xbe, 0xf1, 0x23, 0x50, 0x89, 0x96, - 0x20, 0x3e, 0xe2, 0x9b, 0x85, 0xb1, 0xa6, 0xa8, 0x8b, 0x69, 0xae, 0x69, 0x5a, 0x3a, 0x93, 0xc1, - 0x36, 0x3b, 0x60, 0x87, 0x6b, 0x93, 0xe1, 0xf7, 0xe1, 0x52, 0xd3, 0x95, 0x97, 0xd3, 0x47, 0xc6, - 0xff, 0x5f, 0x83, 0x6b, 0x4c, 0x06, 0x71, 0xc3, 0x07, 0x21, 0x29, 0x4e, 0xe4, 0x8a, 0x62, 0xf2, - 0xd7, 0xdf, 0xd1, 0xf8, 0x4f, 0x26, 0x54, 0x49, 0xc6, 0x4f, 0x6f, 0x9f, 0x2f, 0xff, 0xf6, 0xe2, - 0x1d, 0xb5, 0x6a, 0x8a, 0xac, 0x87, 0xcf, 0x2e, 0x5e, 0x5b, 0xc1, 0x96, 0xad, 0x60, 0x1f, 0xad, - 0x60, 0xcf, 0x9d, 0x88, 0x96, 0x9d, 0x88, 0xde, 0x3b, 0x11, 0xdd, 0x1c, 0x07, 0x17, 0xcd, 0xef, - 0xa4, 0x41, 0x45, 0xe0, 0x1a, 0x70, 0xde, 0xe8, 0xa7, 0xc9, 0x5d, 0x99, 0xf5, 0x49, 0x14, 0xea, - 0xcf, 0x06, 0xfd, 0x40, 0x27, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbb, 0xb3, 0x6b, 0x93, 0x76, - 0x01, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ServiceClient is the client API for Service service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ServiceClient interface { - // Config queries for the operator configuration. - Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error) -} - -type serviceClient struct { - cc grpc1.ClientConn -} - -func NewServiceClient(cc grpc1.ClientConn) ServiceClient { - return &serviceClient{cc} -} - -func (c *serviceClient) Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error) { - out := new(ConfigResponse) - err := c.cc.Invoke(ctx, "/cosmos.base.node.v2.Service/Config", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ServiceServer is the server API for Service service. -type ServiceServer interface { - // Config queries for the operator configuration. - Config(context.Context, *ConfigRequest) (*ConfigResponse, error) -} - -// UnimplementedServiceServer can be embedded to have forward compatible implementations. -type UnimplementedServiceServer struct { -} - -func (*UnimplementedServiceServer) Config(ctx context.Context, req *ConfigRequest) (*ConfigResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Config not implemented") -} - -func RegisterServiceServer(s grpc1.Server, srv ServiceServer) { - s.RegisterService(&_Service_serviceDesc, srv) -} - -func _Service_Config_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfigRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).Config(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.base.node.v2.Service/Config", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Config(ctx, req.(*ConfigRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var Service_serviceDesc = _Service_serviceDesc -var _Service_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.base.node.v2.Service", - HandlerType: (*ServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Config", - Handler: _Service_Config_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/base/node/v2/query.proto", -} - -func (m *ConfigRequest) 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 *ConfigRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConfigRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ConfigResponse) 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 *ConfigResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MinimumGasPrice) > 0 { - i -= len(m.MinimumGasPrice) - copy(dAtA[i:], m.MinimumGasPrice) - i = encodeVarintQuery(dAtA, i, uint64(len(m.MinimumGasPrice))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ConfigRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ConfigResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MinimumGasPrice) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ConfigRequest) 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: ConfigRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConfigRequest: 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 *ConfigResponse) 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: ConfigResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimumGasPrice", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinimumGasPrice = string(dAtA[iNdEx:postIndex]) - 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 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - 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, ErrIntOverflowQuery - } - 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, ErrIntOverflowQuery - } - 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, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/server/v2/api/grpc/nodeservice/query.pb.gw.go b/server/v2/api/grpc/nodeservice/query.pb.gw.go deleted file mode 100644 index b301d29dccfe..000000000000 --- a/server/v2/api/grpc/nodeservice/query.pb.gw.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cosmos/base/node/v2/query.proto - -/* -Package nodeservice is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package nodeservice - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Service_Config_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ConfigRequest - var metadata runtime.ServerMetadata - - msg, err := client.Config(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Service_Config_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ConfigRequest - var metadata runtime.ServerMetadata - - msg, err := server.Config(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterServiceHandlerServer registers the http handlers for service Service to "mux". -// UnaryRPC :call ServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterServiceHandlerFromEndpoint instead. -func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceServer) error { - - mux.Handle("GET", pattern_Service_Config_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_Service_Config_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_Service_Config_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterServiceHandlerFromEndpoint is same as RegisterServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterServiceHandler(ctx, mux, conn) -} - -// RegisterServiceHandler registers the http handlers for service Service to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterServiceHandlerClient(ctx, mux, NewServiceClient(conn)) -} - -// RegisterServiceHandlerClient registers the http handlers for service Service -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ServiceClient" to call the correct interceptors. -func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceClient) error { - - mux.Handle("GET", pattern_Service_Config_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_Service_Config_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Service_Config_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Service_Config_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmos", "base", "node", "v2", "config"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Service_Config_0 = runtime.ForwardResponseMessage -) diff --git a/server/v2/api/grpc/nodeservice/service.go b/server/v2/api/grpc/nodeservice/service.go deleted file mode 100644 index 51f84d36142f..000000000000 --- a/server/v2/api/grpc/nodeservice/service.go +++ /dev/null @@ -1,29 +0,0 @@ -package nodeservice - -import ( - context "context" - - "cosmossdk.io/core/server" -) - -var _ ServiceServer = queryServer{} - -type queryServer struct { - cfg server.ConfigMap -} - -func NewQueryServer(cfg server.ConfigMap) ServiceServer { - return queryServer{cfg: cfg} -} - -func (s queryServer) Config(ctx context.Context, _ *ConfigRequest) (*ConfigResponse, error) { - minGasPricesStr := "" - minGasPrices, ok := s.cfg["server"].(map[string]interface{})["minimum-gas-prices"] - if ok { - minGasPricesStr = minGasPrices.(string) - } - - return &ConfigResponse{ - MinimumGasPrice: minGasPricesStr, - }, nil -} diff --git a/server/v2/api/grpc/server.go b/server/v2/api/grpc/server.go index 9aa06515de33..5775a6fd0e1e 100644 --- a/server/v2/api/grpc/server.go +++ b/server/v2/api/grpc/server.go @@ -26,7 +26,6 @@ import ( "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc/gogoreflection" - "cosmossdk.io/server/v2/api/grpc/nodeservice" ) const ( @@ -75,9 +74,6 @@ func New[T transaction.Tx]( // register grpc query handler v2 RegisterServiceServer(grpcSrv, &v2Service{queryHandlers, queryable}) - // register node service - nodeservice.RegisterServiceServer(grpcSrv, nodeservice.NewQueryServer(cfg)) - // reflection allows external clients to see what services and methods the gRPC server exposes. gogoreflection.Register(grpcSrv, slices.Collect(maps.Keys(queryHandlers)), logger.With("sub-module", "grpc-reflection")) diff --git a/server/v2/cometbft/grpc.go b/server/v2/cometbft/grpc.go index 5a2d64d7d2a2..66bbc86731f1 100644 --- a/server/v2/cometbft/grpc.go +++ b/server/v2/cometbft/grpc.go @@ -2,6 +2,7 @@ package cometbft import ( "context" + "fmt" abci "github.com/cometbft/cometbft/abci/types" abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1" @@ -15,6 +16,7 @@ import ( "cosmossdk.io/core/server" corestore "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" + storeserver "cosmossdk.io/server/v2/store" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" @@ -208,10 +210,15 @@ func (s nodeServer[T]) Config(ctx context.Context, _ *nodeservice.ConfigRequest) minGasPricesStr = minGasPrices.(string) } + storeCfg, err := storeserver.UnmarshalConfig(s.cfg) + if err != nil { + return nil, err + } + return &nodeservice.ConfigResponse{ MinimumGasPrice: minGasPricesStr, - PruningKeepRecent: "ambiguous in v2", - PruningInterval: "ambiguous in v2", + PruningKeepRecent: fmt.Sprintf("%d", storeCfg.Options.SCPruningOption.KeepRecent), + PruningInterval: fmt.Sprintf("%d", storeCfg.Options.SCPruningOption.Interval), HaltHeight: s.cometBFTAppConfig.HaltHeight, }, nil } diff --git a/server/v2/go.mod b/server/v2/go.mod index 0f84cf2ef70e..8de9635ee4ec 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -35,7 +35,6 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 google.golang.org/protobuf v1.35.2 ) @@ -113,6 +112,7 @@ require ( golang.org/x/text v0.20.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/confix/data/v2-app.toml b/tools/confix/data/v2-app.toml index 394cc41e7b09..2f9ed9e734d3 100644 --- a/tools/confix/data/v2-app.toml +++ b/tools/confix/data/v2-app.toml @@ -41,6 +41,12 @@ max-recv-msg-size = 10485760 # The default value is math.MaxInt32. max-send-msg-size = 2147483647 +[grpc-gateway] +# Enable defines if the gRPC-gateway should be enabled. +enable = true +# Address defines the address the gRPC-gateway server binds to. +address = 'localhost:1317' + [rest] # Enable defines if the REST server should be enabled. enable = true @@ -56,18 +62,9 @@ minimum-gas-prices = '0stake' app-db-backend = 'goleveldb' [store.options] -# State storage database type. Currently we support: "pebble" and "rocksdb" -ss-type = 'pebble' # State commitment database type. Currently we support: "iavl" and "iavl-v2" sc-type = 'iavl' -# Pruning options for state storage -[store.options.ss-pruning-option] -# Number of recent heights to keep on disk. -keep-recent = 2 -# Height interval at which pruned heights are removed from disk. -interval = 100 - # Pruning options for state commitment [store.options.sc-pruning-option] # Number of recent heights to keep on disk. diff --git a/tools/confix/migrations.go b/tools/confix/migrations.go index 77fc4a671cb4..3589124c733b 100644 --- a/tools/confix/migrations.go +++ b/tools/confix/migrations.go @@ -46,11 +46,9 @@ var v2KeyChanges = v2KeyChangesMap{ "halt-time": []string{"comet.halt-time"}, "app-db-backend": []string{"store.app-db-backend"}, "pruning-keep-recent": []string{ - "store.options.ss-pruning-option.keep-recent", "store.options.sc-pruning-option.keep-recent", }, "pruning-interval": []string{ - "store.options.ss-pruning-option.interval", "store.options.sc-pruning-option.interval", }, "iavl-cache-size": []string{"store.options.iavl-config.cache-size"},