fix(server/v2/comebft): wire missing services + fix simulation (#21964)
This commit is contained in:
parent
f96b3b00e3
commit
d697a3de0f
981
api/cosmos/base/node/v2/query.pulsar.go
Normal file
981
api/cosmos/base/node/v2/query.pulsar.go
Normal file
@ -0,0 +1,981 @@
|
||||
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
|
||||
package nodev2
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
runtime "github.com/cosmos/cosmos-proto/runtime"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoiface "google.golang.org/protobuf/runtime/protoiface"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
io "io"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
var (
|
||||
md_ConfigRequest protoreflect.MessageDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_cosmos_base_node_v2_query_proto_init()
|
||||
md_ConfigRequest = File_cosmos_base_node_v2_query_proto.Messages().ByName("ConfigRequest")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_ConfigRequest)(nil)
|
||||
|
||||
type fastReflection_ConfigRequest ConfigRequest
|
||||
|
||||
func (x *ConfigRequest) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_ConfigRequest)(x)
|
||||
}
|
||||
|
||||
func (x *ConfigRequest) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_base_node_v2_query_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
var _fastReflection_ConfigRequest_messageType fastReflection_ConfigRequest_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_ConfigRequest_messageType{}
|
||||
|
||||
type fastReflection_ConfigRequest_messageType struct{}
|
||||
|
||||
func (x fastReflection_ConfigRequest_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_ConfigRequest)(nil)
|
||||
}
|
||||
func (x fastReflection_ConfigRequest_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_ConfigRequest)
|
||||
}
|
||||
func (x fastReflection_ConfigRequest_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_ConfigRequest
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_ConfigRequest) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_ConfigRequest
|
||||
}
|
||||
|
||||
// Type returns the message type, which encapsulates both Go and protobuf
|
||||
// type information. If the Go type information is not needed,
|
||||
// it is recommended that the message descriptor be used instead.
|
||||
func (x *fastReflection_ConfigRequest) Type() protoreflect.MessageType {
|
||||
return _fastReflection_ConfigRequest_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_ConfigRequest) New() protoreflect.Message {
|
||||
return new(fastReflection_ConfigRequest)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_ConfigRequest) Interface() protoreflect.ProtoMessage {
|
||||
return (*ConfigRequest)(x)
|
||||
}
|
||||
|
||||
// Range iterates over every populated field in an undefined order,
|
||||
// calling f for each field descriptor and value encountered.
|
||||
// Range returns immediately if f returns false.
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_ConfigRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
}
|
||||
|
||||
// Has reports whether a field is populated.
|
||||
//
|
||||
// Some fields have the property of nullability where it is possible to
|
||||
// distinguish between the default value of a field and whether the field
|
||||
// was explicitly populated with the default value. Singular message fields,
|
||||
// member fields of a oneof, and proto2 scalar fields are nullable. Such
|
||||
// fields are populated only if explicitly set.
|
||||
//
|
||||
// In other cases (aside from the nullable cases above),
|
||||
// a proto3 scalar field is populated if it contains a non-zero value, and
|
||||
// a repeated field is populated if it is non-empty.
|
||||
func (x *fastReflection_ConfigRequest) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigRequest"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigRequest does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Clear clears the field such that a subsequent Has call reports false.
|
||||
//
|
||||
// Clearing an extension field clears both the extension type and value
|
||||
// associated with the given field number.
|
||||
//
|
||||
// Clear is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ConfigRequest) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigRequest"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigRequest does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Get retrieves the value for a field.
|
||||
//
|
||||
// For unpopulated scalars, it returns the default value, where
|
||||
// the default value of a bytes scalar is guaranteed to be a copy.
|
||||
// For unpopulated composite types, it returns an empty, read-only view
|
||||
// of the value; to obtain a mutable reference, use Mutable.
|
||||
func (x *fastReflection_ConfigRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigRequest"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigRequest does not contain field %s", descriptor.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Set stores the value for a field.
|
||||
//
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType.
|
||||
// When setting a composite type, it is unspecified whether the stored value
|
||||
// aliases the source's memory in any way. If the composite value is an
|
||||
// empty, read-only value, then it panics.
|
||||
//
|
||||
// Set is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ConfigRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigRequest"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigRequest does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Mutable returns a mutable reference to a composite type.
|
||||
//
|
||||
// If the field is unpopulated, it may allocate a composite value.
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType
|
||||
// if not already stored.
|
||||
// It panics if the field does not contain a composite type.
|
||||
//
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ConfigRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigRequest"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigRequest does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// NewField returns a new value that is assignable to the field
|
||||
// for the given descriptor. For scalars, this returns the default value.
|
||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||
func (x *fastReflection_ConfigRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigRequest"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigRequest does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// WhichOneof reports which field within the oneof is populated,
|
||||
// returning nil if none are populated.
|
||||
// It panics if the oneof descriptor does not belong to this message.
|
||||
func (x *fastReflection_ConfigRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in cosmos.base.node.v2.ConfigRequest", d.FullName()))
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// GetUnknown retrieves the entire list of unknown fields.
|
||||
// The caller may only mutate the contents of the RawFields
|
||||
// if the mutated bytes are stored back into the message with SetUnknown.
|
||||
func (x *fastReflection_ConfigRequest) GetUnknown() protoreflect.RawFields {
|
||||
return x.unknownFields
|
||||
}
|
||||
|
||||
// SetUnknown stores an entire list of unknown fields.
|
||||
// The raw fields must be syntactically valid according to the wire format.
|
||||
// An implementation may panic if this is not the case.
|
||||
// Once stored, the caller must not mutate the content of the RawFields.
|
||||
// An empty RawFields may be passed to clear the fields.
|
||||
//
|
||||
// SetUnknown is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ConfigRequest) SetUnknown(fields protoreflect.RawFields) {
|
||||
x.unknownFields = fields
|
||||
}
|
||||
|
||||
// IsValid reports whether the message is valid.
|
||||
//
|
||||
// An invalid message is an empty, read-only value.
|
||||
//
|
||||
// An invalid message often corresponds to a nil pointer of the concrete
|
||||
// message type, but the details are implementation dependent.
|
||||
// Validity is not part of the protobuf data model, and may not
|
||||
// be preserved in marshaling or other operations.
|
||||
func (x *fastReflection_ConfigRequest) IsValid() bool {
|
||||
return x != nil
|
||||
}
|
||||
|
||||
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
|
||||
// This method may return nil.
|
||||
//
|
||||
// The returned methods type is identical to
|
||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||
// Consult the protoiface package documentation for details.
|
||||
func (x *fastReflection_ConfigRequest) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*ConfigRequest)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
n += len(x.unknownFields)
|
||||
}
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: n,
|
||||
}
|
||||
}
|
||||
|
||||
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||
x := input.Message.Interface().(*ConfigRequest)
|
||||
if x == nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.MarshalInputToOptions(input)
|
||||
_ = options
|
||||
size := options.Size(x)
|
||||
dAtA := make([]byte, size)
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if input.Buf != nil {
|
||||
input.Buf = append(input.Buf, dAtA...)
|
||||
} else {
|
||||
input.Buf = dAtA
|
||||
}
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
x := input.Message.Interface().(*ConfigRequest)
|
||||
if x == nil {
|
||||
return protoiface.UnmarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Flags: input.Flags,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.UnmarshalInputToOptions(input)
|
||||
_ = options
|
||||
dAtA := input.Buf
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ConfigRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ConfigRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if !options.DiscardUnknown {
|
||||
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
|
||||
}
|
||||
return &protoiface.Methods{
|
||||
NoUnkeyedLiterals: struct{}{},
|
||||
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
|
||||
Size: size,
|
||||
Marshal: marshal,
|
||||
Unmarshal: unmarshal,
|
||||
Merge: nil,
|
||||
CheckInitialized: nil,
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
md_ConfigResponse protoreflect.MessageDescriptor
|
||||
fd_ConfigResponse_minimum_gas_price protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_cosmos_base_node_v2_query_proto_init()
|
||||
md_ConfigResponse = File_cosmos_base_node_v2_query_proto.Messages().ByName("ConfigResponse")
|
||||
fd_ConfigResponse_minimum_gas_price = md_ConfigResponse.Fields().ByName("minimum_gas_price")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_ConfigResponse)(nil)
|
||||
|
||||
type fastReflection_ConfigResponse ConfigResponse
|
||||
|
||||
func (x *ConfigResponse) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_ConfigResponse)(x)
|
||||
}
|
||||
|
||||
func (x *ConfigResponse) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_base_node_v2_query_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
var _fastReflection_ConfigResponse_messageType fastReflection_ConfigResponse_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_ConfigResponse_messageType{}
|
||||
|
||||
type fastReflection_ConfigResponse_messageType struct{}
|
||||
|
||||
func (x fastReflection_ConfigResponse_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_ConfigResponse)(nil)
|
||||
}
|
||||
func (x fastReflection_ConfigResponse_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_ConfigResponse)
|
||||
}
|
||||
func (x fastReflection_ConfigResponse_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_ConfigResponse
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_ConfigResponse) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_ConfigResponse
|
||||
}
|
||||
|
||||
// Type returns the message type, which encapsulates both Go and protobuf
|
||||
// type information. If the Go type information is not needed,
|
||||
// it is recommended that the message descriptor be used instead.
|
||||
func (x *fastReflection_ConfigResponse) Type() protoreflect.MessageType {
|
||||
return _fastReflection_ConfigResponse_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_ConfigResponse) New() protoreflect.Message {
|
||||
return new(fastReflection_ConfigResponse)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_ConfigResponse) Interface() protoreflect.ProtoMessage {
|
||||
return (*ConfigResponse)(x)
|
||||
}
|
||||
|
||||
// Range iterates over every populated field in an undefined order,
|
||||
// calling f for each field descriptor and value encountered.
|
||||
// Range returns immediately if f returns false.
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_ConfigResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if x.MinimumGasPrice != "" {
|
||||
value := protoreflect.ValueOfString(x.MinimumGasPrice)
|
||||
if !f(fd_ConfigResponse_minimum_gas_price, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Has reports whether a field is populated.
|
||||
//
|
||||
// Some fields have the property of nullability where it is possible to
|
||||
// distinguish between the default value of a field and whether the field
|
||||
// was explicitly populated with the default value. Singular message fields,
|
||||
// member fields of a oneof, and proto2 scalar fields are nullable. Such
|
||||
// fields are populated only if explicitly set.
|
||||
//
|
||||
// In other cases (aside from the nullable cases above),
|
||||
// a proto3 scalar field is populated if it contains a non-zero value, and
|
||||
// a repeated field is populated if it is non-empty.
|
||||
func (x *fastReflection_ConfigResponse) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.base.node.v2.ConfigResponse.minimum_gas_price":
|
||||
return x.MinimumGasPrice != ""
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigResponse"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigResponse does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Clear clears the field such that a subsequent Has call reports false.
|
||||
//
|
||||
// Clearing an extension field clears both the extension type and value
|
||||
// associated with the given field number.
|
||||
//
|
||||
// Clear is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ConfigResponse) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.base.node.v2.ConfigResponse.minimum_gas_price":
|
||||
x.MinimumGasPrice = ""
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigResponse"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigResponse does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Get retrieves the value for a field.
|
||||
//
|
||||
// For unpopulated scalars, it returns the default value, where
|
||||
// the default value of a bytes scalar is guaranteed to be a copy.
|
||||
// For unpopulated composite types, it returns an empty, read-only view
|
||||
// of the value; to obtain a mutable reference, use Mutable.
|
||||
func (x *fastReflection_ConfigResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
case "cosmos.base.node.v2.ConfigResponse.minimum_gas_price":
|
||||
value := x.MinimumGasPrice
|
||||
return protoreflect.ValueOfString(value)
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigResponse"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigResponse does not contain field %s", descriptor.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Set stores the value for a field.
|
||||
//
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType.
|
||||
// When setting a composite type, it is unspecified whether the stored value
|
||||
// aliases the source's memory in any way. If the composite value is an
|
||||
// empty, read-only value, then it panics.
|
||||
//
|
||||
// Set is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ConfigResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.base.node.v2.ConfigResponse.minimum_gas_price":
|
||||
x.MinimumGasPrice = value.Interface().(string)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigResponse"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigResponse does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Mutable returns a mutable reference to a composite type.
|
||||
//
|
||||
// If the field is unpopulated, it may allocate a composite value.
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType
|
||||
// if not already stored.
|
||||
// It panics if the field does not contain a composite type.
|
||||
//
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ConfigResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.base.node.v2.ConfigResponse.minimum_gas_price":
|
||||
panic(fmt.Errorf("field minimum_gas_price of message cosmos.base.node.v2.ConfigResponse is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigResponse"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigResponse does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// NewField returns a new value that is assignable to the field
|
||||
// for the given descriptor. For scalars, this returns the default value.
|
||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||
func (x *fastReflection_ConfigResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.base.node.v2.ConfigResponse.minimum_gas_price":
|
||||
return protoreflect.ValueOfString("")
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.node.v2.ConfigResponse"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.base.node.v2.ConfigResponse does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// WhichOneof reports which field within the oneof is populated,
|
||||
// returning nil if none are populated.
|
||||
// It panics if the oneof descriptor does not belong to this message.
|
||||
func (x *fastReflection_ConfigResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in cosmos.base.node.v2.ConfigResponse", d.FullName()))
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// GetUnknown retrieves the entire list of unknown fields.
|
||||
// The caller may only mutate the contents of the RawFields
|
||||
// if the mutated bytes are stored back into the message with SetUnknown.
|
||||
func (x *fastReflection_ConfigResponse) GetUnknown() protoreflect.RawFields {
|
||||
return x.unknownFields
|
||||
}
|
||||
|
||||
// SetUnknown stores an entire list of unknown fields.
|
||||
// The raw fields must be syntactically valid according to the wire format.
|
||||
// An implementation may panic if this is not the case.
|
||||
// Once stored, the caller must not mutate the content of the RawFields.
|
||||
// An empty RawFields may be passed to clear the fields.
|
||||
//
|
||||
// SetUnknown is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ConfigResponse) SetUnknown(fields protoreflect.RawFields) {
|
||||
x.unknownFields = fields
|
||||
}
|
||||
|
||||
// IsValid reports whether the message is valid.
|
||||
//
|
||||
// An invalid message is an empty, read-only value.
|
||||
//
|
||||
// An invalid message often corresponds to a nil pointer of the concrete
|
||||
// message type, but the details are implementation dependent.
|
||||
// Validity is not part of the protobuf data model, and may not
|
||||
// be preserved in marshaling or other operations.
|
||||
func (x *fastReflection_ConfigResponse) IsValid() bool {
|
||||
return x != nil
|
||||
}
|
||||
|
||||
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
|
||||
// This method may return nil.
|
||||
//
|
||||
// The returned methods type is identical to
|
||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||
// Consult the protoiface package documentation for details.
|
||||
func (x *fastReflection_ConfigResponse) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*ConfigResponse)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
l = len(x.MinimumGasPrice)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
n += len(x.unknownFields)
|
||||
}
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: n,
|
||||
}
|
||||
}
|
||||
|
||||
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||
x := input.Message.Interface().(*ConfigResponse)
|
||||
if x == nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.MarshalInputToOptions(input)
|
||||
_ = options
|
||||
size := options.Size(x)
|
||||
dAtA := make([]byte, size)
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.MinimumGasPrice) > 0 {
|
||||
i -= len(x.MinimumGasPrice)
|
||||
copy(dAtA[i:], x.MinimumGasPrice)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinimumGasPrice)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
if input.Buf != nil {
|
||||
input.Buf = append(input.Buf, dAtA...)
|
||||
} else {
|
||||
input.Buf = dAtA
|
||||
}
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
x := input.Message.Interface().(*ConfigResponse)
|
||||
if x == nil {
|
||||
return protoiface.UnmarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Flags: input.Flags,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.UnmarshalInputToOptions(input)
|
||||
_ = options
|
||||
dAtA := input.Buf
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ConfigResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinimumGasPrice", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.MinimumGasPrice = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if !options.DiscardUnknown {
|
||||
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
|
||||
}
|
||||
return &protoiface.Methods{
|
||||
NoUnkeyedLiterals: struct{}{},
|
||||
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
|
||||
Size: size,
|
||||
Marshal: marshal,
|
||||
Unmarshal: unmarshal,
|
||||
Merge: nil,
|
||||
CheckInitialized: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.0
|
||||
// protoc (unknown)
|
||||
// source: cosmos/base/node/v2/query.proto
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// ConfigRequest defines the request structure for the Config gRPC query.
|
||||
type ConfigRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *ConfigRequest) Reset() {
|
||||
*x = ConfigRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_base_node_v2_query_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ConfigRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ConfigRequest) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use ConfigRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ConfigRequest) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_base_node_v2_query_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
// ConfigResponse defines the response structure for the Config gRPC query.
|
||||
type ConfigResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
MinimumGasPrice string `protobuf:"bytes,1,opt,name=minimum_gas_price,json=minimumGasPrice,proto3" json:"minimum_gas_price,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ConfigResponse) Reset() {
|
||||
*x = ConfigResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_base_node_v2_query_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ConfigResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ConfigResponse) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use ConfigResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ConfigResponse) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_base_node_v2_query_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ConfigResponse) GetMinimumGasPrice() string {
|
||||
if x != nil {
|
||||
return x.MinimumGasPrice
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_cosmos_base_node_v2_query_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_cosmos_base_node_v2_query_proto_rawDesc = []byte{
|
||||
0x0a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x6e, 0x6f,
|
||||
0x64, 0x65, 0x2f, 0x76, 0x32, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x2e, 0x76, 0x32, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3c, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x6d, 0x69, 0x6e, 0x69, 0x6d,
|
||||
0x75, 0x6d, 0x5f, 0x67, 0x61, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x47, 0x61, 0x73, 0x50, 0x72,
|
||||
0x69, 0x63, 0x65, 0x32, 0x81, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x76, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x76, 0x32, 0x2e,
|
||||
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
|
||||
0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x76, 0x32,
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0xc1, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
|
||||
0x2e, 0x76, 0x32, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
|
||||
0x01, 0x5a, 0x2b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f,
|
||||
0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f,
|
||||
0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x76, 0x32, 0x3b, 0x6e, 0x6f, 0x64, 0x65, 0x76, 0x32, 0xa2, 0x02,
|
||||
0x03, 0x43, 0x42, 0x4e, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x61,
|
||||
0x73, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x4e, 0x6f, 0x64, 0x65, 0x5c, 0x56, 0x32,
|
||||
0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
|
||||
0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x73,
|
||||
0x65, 0x3a, 0x3a, 0x4e, 0x6f, 0x64, 0x65, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_cosmos_base_node_v2_query_proto_rawDescOnce sync.Once
|
||||
file_cosmos_base_node_v2_query_proto_rawDescData = file_cosmos_base_node_v2_query_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_cosmos_base_node_v2_query_proto_rawDescGZIP() []byte {
|
||||
file_cosmos_base_node_v2_query_proto_rawDescOnce.Do(func() {
|
||||
file_cosmos_base_node_v2_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_base_node_v2_query_proto_rawDescData)
|
||||
})
|
||||
return file_cosmos_base_node_v2_query_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_cosmos_base_node_v2_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_cosmos_base_node_v2_query_proto_goTypes = []interface{}{
|
||||
(*ConfigRequest)(nil), // 0: cosmos.base.node.v2.ConfigRequest
|
||||
(*ConfigResponse)(nil), // 1: cosmos.base.node.v2.ConfigResponse
|
||||
}
|
||||
var file_cosmos_base_node_v2_query_proto_depIdxs = []int32{
|
||||
0, // 0: cosmos.base.node.v2.Service.Config:input_type -> cosmos.base.node.v2.ConfigRequest
|
||||
1, // 1: cosmos.base.node.v2.Service.Config:output_type -> cosmos.base.node.v2.ConfigResponse
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_cosmos_base_node_v2_query_proto_init() }
|
||||
func file_cosmos_base_node_v2_query_proto_init() {
|
||||
if File_cosmos_base_node_v2_query_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_cosmos_base_node_v2_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ConfigRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_cosmos_base_node_v2_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ConfigResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_cosmos_base_node_v2_query_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_cosmos_base_node_v2_query_proto_goTypes,
|
||||
DependencyIndexes: file_cosmos_base_node_v2_query_proto_depIdxs,
|
||||
MessageInfos: file_cosmos_base_node_v2_query_proto_msgTypes,
|
||||
}.Build()
|
||||
File_cosmos_base_node_v2_query_proto = out.File
|
||||
file_cosmos_base_node_v2_query_proto_rawDesc = nil
|
||||
file_cosmos_base_node_v2_query_proto_goTypes = nil
|
||||
file_cosmos_base_node_v2_query_proto_depIdxs = nil
|
||||
}
|
||||
127
api/cosmos/base/node/v2/query_grpc.pb.go
Normal file
127
api/cosmos/base/node/v2/query_grpc.pb.go
Normal file
@ -0,0 +1,127 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc (unknown)
|
||||
// source: cosmos/base/node/v2/query.proto
|
||||
|
||||
package nodev2
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Service_Config_FullMethodName = "/cosmos.base.node.v2.Service/Config"
|
||||
)
|
||||
|
||||
// ServiceClient is the client API for Service service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
//
|
||||
// Service defines the gRPC querier service for node related queries.
|
||||
type ServiceClient interface {
|
||||
// Config queries for the operator configuration.
|
||||
Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error)
|
||||
}
|
||||
|
||||
type serviceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
|
||||
return &serviceClient{cc}
|
||||
}
|
||||
|
||||
func (c *serviceClient) Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ConfigResponse)
|
||||
err := c.cc.Invoke(ctx, Service_Config_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ServiceServer is the server API for Service service.
|
||||
// All implementations must embed UnimplementedServiceServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// Service defines the gRPC querier service for node related queries.
|
||||
type ServiceServer interface {
|
||||
// Config queries for the operator configuration.
|
||||
Config(context.Context, *ConfigRequest) (*ConfigResponse, error)
|
||||
mustEmbedUnimplementedServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedServiceServer struct{}
|
||||
|
||||
func (UnimplementedServiceServer) Config(context.Context, *ConfigRequest) (*ConfigResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Config not implemented")
|
||||
}
|
||||
func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {}
|
||||
func (UnimplementedServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeServiceServer interface {
|
||||
mustEmbedUnimplementedServiceServer()
|
||||
}
|
||||
|
||||
func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer) {
|
||||
// If the following call pancis, it indicates UnimplementedServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
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: Service_Config_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServiceServer).Config(ctx, req.(*ConfigRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Service_ServiceDesc is the grpc.ServiceDesc for Service service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
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",
|
||||
}
|
||||
@ -38,12 +38,12 @@ type (
|
||||
|
||||
// NewQueryServer creates a new CometBFT query server.
|
||||
func NewQueryServer(
|
||||
clientCtx CometRPC,
|
||||
cometRPC CometRPC,
|
||||
queryFn abciQueryFn,
|
||||
consensusAddressCodec address.Codec,
|
||||
) ServiceServer {
|
||||
return queryServer{
|
||||
rpc: clientCtx,
|
||||
rpc: cometRPC,
|
||||
queryFn: queryFn,
|
||||
consensusCodec: consensusAddressCodec,
|
||||
}
|
||||
@ -284,7 +284,7 @@ func (s queryServer) ABCIQuery(ctx context.Context, req *ABCIQueryRequest) (*ABC
|
||||
func RegisterTendermintService(
|
||||
clientCtx client.Context,
|
||||
server gogogrpc.Server,
|
||||
iRegistry codectypes.InterfaceRegistry,
|
||||
_ codectypes.InterfaceRegistry,
|
||||
queryFn abciQueryFn,
|
||||
) {
|
||||
node, err := clientCtx.GetNode()
|
||||
|
||||
22
proto/cosmos/base/node/v2/query.proto
Normal file
22
proto/cosmos/base/node/v2/query.proto
Normal file
@ -0,0 +1,22 @@
|
||||
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;
|
||||
}
|
||||
532
server/v2/api/grpc/nodeservice/query.pb.go
Normal file
532
server/v2/api/grpc/nodeservice/query.pb.go
Normal file
@ -0,0 +1,532 @@
|
||||
// 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")
|
||||
)
|
||||
153
server/v2/api/grpc/nodeservice/query.pb.gw.go
Normal file
153
server/v2/api/grpc/nodeservice/query.pb.gw.go
Normal file
@ -0,0 +1,153 @@
|
||||
// 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
|
||||
)
|
||||
29
server/v2/api/grpc/nodeservice/service.go
Normal file
29
server/v2/api/grpc/nodeservice/service.go
Normal file
@ -0,0 +1,29 @@
|
||||
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
|
||||
}
|
||||
@ -26,6 +26,7 @@ import (
|
||||
"cosmossdk.io/log"
|
||||
serverv2 "cosmossdk.io/server/v2"
|
||||
"cosmossdk.io/server/v2/api/grpc/gogoreflection"
|
||||
"cosmossdk.io/server/v2/api/grpc/nodeservice"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -39,7 +40,8 @@ type Server[T transaction.Tx] struct {
|
||||
config *Config
|
||||
cfgOptions []CfgOption
|
||||
|
||||
grpcSrv *grpc.Server
|
||||
grpcSrv *grpc.Server
|
||||
extraGRPCHandlers []func(*grpc.Server) error
|
||||
}
|
||||
|
||||
// New creates a new grpc server.
|
||||
@ -49,11 +51,13 @@ func New[T transaction.Tx](
|
||||
queryHandlers map[string]appmodulev2.Handler,
|
||||
queryable func(ctx context.Context, version uint64, msg transaction.Msg) (transaction.Msg, error),
|
||||
cfg server.ConfigMap,
|
||||
cfgOptions ...CfgOption,
|
||||
opts ...OptionFunc[T],
|
||||
) (*Server[T], error) {
|
||||
srv := &Server[T]{
|
||||
cfgOptions: cfgOptions,
|
||||
srv := &Server[T]{}
|
||||
for _, opt := range opts {
|
||||
opt(srv)
|
||||
}
|
||||
|
||||
serverCfg := srv.Config().(*Config)
|
||||
if len(cfg) > 0 {
|
||||
if err := serverv2.UnmarshalSubConfig(cfg, srv.Name(), &serverCfg); err != nil {
|
||||
@ -68,11 +72,23 @@ func New[T transaction.Tx](
|
||||
grpc.UnknownServiceHandler(makeUnknownServiceHandler(queryHandlers, queryable)),
|
||||
)
|
||||
|
||||
// Reflection allows external clients to see what services and methods the gRPC server exposes.
|
||||
// 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"))
|
||||
|
||||
// Register V2 grpc handlers
|
||||
RegisterServiceServer(grpcSrv, &v2Service{queryHandlers, queryable})
|
||||
// register extra handlers on the grpc server
|
||||
var err error
|
||||
for _, fn := range srv.extraGRPCHandlers {
|
||||
err = errors.Join(err, fn(grpcSrv))
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to register extra gRPC handlers: %w", err)
|
||||
}
|
||||
|
||||
srv.grpcSrv = grpcSrv
|
||||
srv.config = serverCfg
|
||||
@ -81,6 +97,22 @@ func New[T transaction.Tx](
|
||||
return srv, nil
|
||||
}
|
||||
|
||||
type OptionFunc[T transaction.Tx] func(*Server[T])
|
||||
|
||||
// WithCfgOptions allows to overwrite the default server configuration.
|
||||
func WithCfgOptions[T transaction.Tx](cfgOptions ...CfgOption) OptionFunc[T] {
|
||||
return func(srv *Server[T]) {
|
||||
srv.cfgOptions = cfgOptions
|
||||
}
|
||||
}
|
||||
|
||||
// WithExtraGRPCHandlers allows to register extra handlers on the grpc server.
|
||||
func WithExtraGRPCHandlers[T transaction.Tx](handlers ...func(*grpc.Server) error) OptionFunc[T] {
|
||||
return func(srv *Server[T]) {
|
||||
srv.extraGRPCHandlers = handlers
|
||||
}
|
||||
}
|
||||
|
||||
// NewWithConfigOptions creates a new GRPC server with the provided config options.
|
||||
// It is *not* a fully functional server (since it has been created without dependencies)
|
||||
// The returned server should only be used to get and set configuration.
|
||||
@ -227,8 +259,3 @@ func (s *Server[T]) Stop(ctx context.Context) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetGRPCServer returns the underlying gRPC server.
|
||||
func (s *Server[T]) GetGRPCServer() *grpc.Server {
|
||||
return s.grpcSrv
|
||||
}
|
||||
|
||||
@ -11,6 +11,9 @@ import (
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
@ -27,7 +30,6 @@ import (
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/schema/appdata"
|
||||
"cosmossdk.io/server/v2/appmanager"
|
||||
"cosmossdk.io/server/v2/cometbft/client/grpc/cmtservice"
|
||||
"cosmossdk.io/server/v2/cometbft/handlers"
|
||||
"cosmossdk.io/server/v2/cometbft/mempool"
|
||||
"cosmossdk.io/server/v2/cometbft/types"
|
||||
@ -37,13 +39,18 @@ import (
|
||||
consensustypes "cosmossdk.io/x/consensus/types"
|
||||
)
|
||||
|
||||
const (
|
||||
QueryPathApp = "app"
|
||||
QueryPathP2P = "p2p"
|
||||
QueryPathStore = "store"
|
||||
)
|
||||
|
||||
var _ abci.Application = (*Consensus[transaction.Tx])(nil)
|
||||
|
||||
type Consensus[T transaction.Tx] struct {
|
||||
logger log.Logger
|
||||
appName, version string
|
||||
app appmanager.AppManager[T]
|
||||
appCloser func() error
|
||||
txCodec transaction.Codec[T]
|
||||
store types.Store
|
||||
streaming streaming.Manager
|
||||
@ -78,7 +85,6 @@ func NewConsensus[T transaction.Tx](
|
||||
logger log.Logger,
|
||||
appName string,
|
||||
app appmanager.AppManager[T],
|
||||
appCloser func() error,
|
||||
mp mempool.Mempool[T],
|
||||
indexedEvents map[string]struct{},
|
||||
queryHandlersMap map[string]appmodulev2.Handler,
|
||||
@ -91,7 +97,6 @@ func NewConsensus[T transaction.Tx](
|
||||
appName: appName,
|
||||
version: getCometBFTServerVersion(),
|
||||
app: app,
|
||||
appCloser: appCloser,
|
||||
cfg: cfg,
|
||||
store: store,
|
||||
logger: logger,
|
||||
@ -221,17 +226,17 @@ func (c *Consensus[T]) Query(ctx context.Context, req *abciproto.QueryRequest) (
|
||||
}
|
||||
|
||||
switch path[0] {
|
||||
case cmtservice.QueryPathApp:
|
||||
case QueryPathApp:
|
||||
resp, err = c.handlerQueryApp(ctx, path, req)
|
||||
|
||||
case cmtservice.QueryPathStore:
|
||||
resp, err = c.handleQueryStore(path, c.store, req)
|
||||
case QueryPathStore:
|
||||
resp, err = c.handleQueryStore(path, req)
|
||||
|
||||
case cmtservice.QueryPathP2P:
|
||||
case QueryPathP2P:
|
||||
resp, err = c.handleQueryP2P(path)
|
||||
|
||||
default:
|
||||
resp = QueryResult(errorsmod.Wrap(cometerrors.ErrUnknownRequest, "unknown query path"), c.cfg.AppTomlConfig.Trace)
|
||||
resp = QueryResult(errorsmod.Wrapf(cometerrors.ErrUnknownRequest, "unknown query path %s", req.Path), c.cfg.AppTomlConfig.Trace)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@ -267,6 +272,50 @@ func (c *Consensus[T]) maybeRunGRPCQuery(ctx context.Context, req *abci.QueryReq
|
||||
handlerFullName = string(md.Input().FullName())
|
||||
}
|
||||
|
||||
// special case for simulation as it is an external gRPC registered on the grpc server component
|
||||
// and not on the app itself, so it won't pass the router afterwards.
|
||||
if req.Path == "/cosmos.tx.v1beta1.Service/Simulate" {
|
||||
simulateRequest := &txtypes.SimulateRequest{}
|
||||
err = gogoproto.Unmarshal(req.Data, simulateRequest)
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("unable to decode gRPC request with path %s from ABCI.Query: %w", req.Path, err)
|
||||
}
|
||||
|
||||
tx, err := c.txCodec.Decode(simulateRequest.TxBytes)
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("failed to decode tx: %w", err)
|
||||
}
|
||||
|
||||
txResult, _, err := c.app.Simulate(ctx, tx)
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("%v with gas used: '%d'", err, txResult.GasUsed)
|
||||
}
|
||||
|
||||
msgResponses := make([]*codectypes.Any, 0, len(txResult.Resp))
|
||||
// pack the messages into Any
|
||||
for _, msg := range txResult.Resp {
|
||||
anyMsg, err := codectypes.NewAnyWithValue(msg)
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("failed to pack message response: %w", err)
|
||||
}
|
||||
|
||||
msgResponses = append(msgResponses, anyMsg)
|
||||
}
|
||||
|
||||
resp := &txtypes.SimulateResponse{
|
||||
GasInfo: &sdk.GasInfo{
|
||||
GasUsed: txResult.GasUsed,
|
||||
GasWanted: txResult.GasWanted,
|
||||
},
|
||||
Result: &sdk.Result{
|
||||
MsgResponses: msgResponses,
|
||||
},
|
||||
}
|
||||
|
||||
res, err := queryResponse(resp, req.Height)
|
||||
return res, true, err
|
||||
}
|
||||
|
||||
handler, found := c.queryHandlersMap[handlerFullName]
|
||||
if !found {
|
||||
return nil, true, fmt.Errorf("no query handler found for %s", req.Path)
|
||||
@ -281,7 +330,6 @@ func (c *Consensus[T]) maybeRunGRPCQuery(ctx context.Context, req *abci.QueryReq
|
||||
resp := QueryResult(err, c.cfg.AppTomlConfig.Trace)
|
||||
resp.Height = req.Height
|
||||
return resp, true, err
|
||||
|
||||
}
|
||||
|
||||
resp, err = queryResponse(res, req.Height)
|
||||
|
||||
@ -699,7 +699,7 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock.
|
||||
nil,
|
||||
)
|
||||
|
||||
return NewConsensus[mock.Tx](log.NewNopLogger(), "testing-app", am, func() error { return nil },
|
||||
return NewConsensus[mock.Tx](log.NewNopLogger(), "testing-app", am,
|
||||
mempool, map[string]struct{}{}, nil, mockStore,
|
||||
Config{AppTomlConfig: DefaultAppTomlConfig()}, mock.TxCodec{}, "test")
|
||||
}
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
package cmtservice
|
||||
|
||||
import (
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
cmtv1beta1 "cosmossdk.io/api/cosmos/base/tendermint/v1beta1"
|
||||
)
|
||||
|
||||
var CometBFTAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{
|
||||
Service: cmtv1beta1.Service_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "GetNodeInfo",
|
||||
Use: "node-info",
|
||||
Short: "Query the current node info",
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetSyncing",
|
||||
Use: "syncing",
|
||||
Short: "Query node syncing status",
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetLatestBlock",
|
||||
Use: "block-latest",
|
||||
Short: "Query for the latest committed block",
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetBlockByHeight",
|
||||
Use: "block-by-height <height>",
|
||||
Short: "Query for a committed block by height",
|
||||
Long: "Query for a specific committed block using the CometBFT RPC `block_by_height` method",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}},
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetLatestValidatorSet",
|
||||
Use: "validator-set",
|
||||
Alias: []string{"validator-set-latest", "comet-validator-set", "cometbft-validator-set", "tendermint-validator-set"},
|
||||
Short: "Query for the latest validator set",
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetValidatorSetByHeight",
|
||||
Use: "validator-set-by-height <height>",
|
||||
Short: "Query for a validator set by height",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}},
|
||||
},
|
||||
{
|
||||
RpcMethod: "ABCIQuery",
|
||||
Skip: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// NewCometBFTCommands is a fake `appmodule.Module` to be considered as a module
|
||||
// and be added in AutoCLI.
|
||||
func NewCometBFTCommands() *cometModule {
|
||||
return &cometModule{}
|
||||
}
|
||||
|
||||
type cometModule struct{}
|
||||
|
||||
func (m cometModule) IsOnePerModuleType() {}
|
||||
func (m cometModule) IsAppModule() {}
|
||||
|
||||
func (m cometModule) Name() string {
|
||||
return "comet"
|
||||
}
|
||||
|
||||
func (m cometModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
return &autocliv1.ModuleOptions{
|
||||
Query: CometBFTAutoCLIDescriptor,
|
||||
}
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
package cmtservice
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
gogogrpc "github.com/cosmos/gogoproto/grpc"
|
||||
gogoprotoany "github.com/cosmos/gogoproto/types/any"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
|
||||
"cosmossdk.io/core/address"
|
||||
"cosmossdk.io/server/v2/cometbft/client/rpc"
|
||||
|
||||
cmtservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
|
||||
)
|
||||
|
||||
var _ gogoprotoany.UnpackInterfacesMessage = &cmtservice.GetLatestValidatorSetResponse{}
|
||||
|
||||
const (
|
||||
QueryPathApp = "app"
|
||||
QueryPathP2P = "p2p"
|
||||
QueryPathStore = "store"
|
||||
)
|
||||
|
||||
type abciQueryFn = func(context.Context, *abci.QueryRequest) (*abci.QueryResponse, error)
|
||||
|
||||
// RegisterTendermintService registers the CometBFT queries on the gRPC router.
|
||||
func RegisterTendermintService(
|
||||
client rpc.CometRPC,
|
||||
server gogogrpc.Server,
|
||||
queryFn abciQueryFn,
|
||||
consensusCodec address.Codec,
|
||||
) {
|
||||
cmtservice.RegisterServiceServer(server, cmtservice.NewQueryServer(client, queryFn, consensusCodec))
|
||||
}
|
||||
|
||||
// RegisterGRPCGatewayRoutes mounts the CometBFT service's GRPC-gateway routes on the
|
||||
// given Mux.
|
||||
func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.ServeMux) {
|
||||
_ = cmtservice.RegisterServiceHandlerClient(context.Background(), mux, cmtservice.NewServiceClient(clientConn))
|
||||
}
|
||||
|
||||
// SplitABCIQueryPath splits a string path using the delimiter '/'.
|
||||
//
|
||||
// e.g. "this/is/funny" becomes []string{"this", "is", "funny"}
|
||||
func SplitABCIQueryPath(requestPath string) (path []string) {
|
||||
path = strings.Split(requestPath, "/")
|
||||
|
||||
// first element is empty string
|
||||
if len(path) > 0 && path[0] == "" {
|
||||
path = path[1:]
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
@ -50,9 +50,15 @@ func QueryBlocks(ctx context.Context, rpcClient CometRPC, page, limit int, query
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := NewSearchBlocksResult(int64(resBlocks.TotalCount), int64(len(blocks)), int64(page), int64(limit), blocks)
|
||||
|
||||
return result, nil
|
||||
totalPages := calcTotalPages(int64(resBlocks.TotalCount), int64(limit))
|
||||
return &sdk.SearchBlocksResult{
|
||||
TotalCount: int64(resBlocks.TotalCount),
|
||||
Count: int64(len(blocks)),
|
||||
PageNumber: int64(page),
|
||||
PageTotal: totalPages,
|
||||
Limit: int64(limit),
|
||||
Blocks: blocks,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetBlockByHeight gets block by height
|
||||
@ -65,7 +71,7 @@ func GetBlockByHeight(ctx context.Context, rpcClient CometRPC, height *int64) (*
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out, err := NewResponseResultBlock(resBlock)
|
||||
out, err := responseResultBlock(resBlock)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -90,7 +96,7 @@ func GetBlockByHash(ctx context.Context, rpcClient CometRPC, hashHexString strin
|
||||
} else if resBlock.Block == nil {
|
||||
return nil, fmt.Errorf("block not found with hash: %s", hashHexString)
|
||||
}
|
||||
out, err := NewResponseResultBlock(resBlock)
|
||||
out, err := responseResultBlock(resBlock)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -6,8 +6,6 @@ import (
|
||||
cmttypes "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
coretypes "github.com/cometbft/cometbft/rpc/core/types"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// formatBlockResults parses the indexed blocks into a slice of BlockResponse objects.
|
||||
@ -17,7 +15,7 @@ func formatBlockResults(resBlocks []*coretypes.ResultBlock) ([]*cmttypes.Block,
|
||||
out = make([]*cmttypes.Block, len(resBlocks))
|
||||
)
|
||||
for i := range resBlocks {
|
||||
out[i], err = NewResponseResultBlock(resBlocks[i])
|
||||
out[i], err = responseResultBlock(resBlocks[i])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to create response block from comet result block: %v: %w", resBlocks[i], err)
|
||||
}
|
||||
@ -29,20 +27,8 @@ func formatBlockResults(resBlocks []*coretypes.ResultBlock) ([]*cmttypes.Block,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewSearchBlocksResult(totalCount, count, page, limit int64, blocks []*cmttypes.Block) *sdk.SearchBlocksResult {
|
||||
totalPages := calcTotalPages(totalCount, limit)
|
||||
return &sdk.SearchBlocksResult{
|
||||
TotalCount: totalCount,
|
||||
Count: count,
|
||||
PageNumber: page,
|
||||
PageTotal: totalPages,
|
||||
Limit: limit,
|
||||
Blocks: blocks,
|
||||
}
|
||||
}
|
||||
|
||||
// NewResponseResultBlock returns a BlockResponse given a ResultBlock from CometBFT
|
||||
func NewResponseResultBlock(res *coretypes.ResultBlock) (*cmttypes.Block, error) {
|
||||
// responseResultBlock returns a BlockResponse given a ResultBlock from CometBFT
|
||||
func responseResultBlock(res *coretypes.ResultBlock) (*cmttypes.Block, error) {
|
||||
blkProto, err := res.Block.ToProto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@ -33,10 +33,10 @@ require (
|
||||
github.com/cometbft/cometbft/api v1.0.0-rc.1
|
||||
github.com/cosmos/cosmos-sdk v0.53.0
|
||||
github.com/cosmos/gogoproto v1.7.0
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.9.0
|
||||
google.golang.org/grpc v1.68.0
|
||||
google.golang.org/protobuf v1.35.2
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
@ -111,6 +111,7 @@ require (
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
|
||||
github.com/hashicorp/go-hclog v1.6.3 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
@ -186,7 +187,6 @@ require (
|
||||
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
|
||||
google.golang.org/grpc v1.68.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gotest.tools/v3 v3.5.1 // indirect
|
||||
|
||||
220
server/v2/cometbft/grpc.go
Normal file
220
server/v2/cometbft/grpc.go
Normal file
@ -0,0 +1,220 @@
|
||||
package cometbft
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
cmtv1beta1 "cosmossdk.io/api/cosmos/base/tendermint/v1beta1"
|
||||
"cosmossdk.io/core/server"
|
||||
"cosmossdk.io/core/transaction"
|
||||
errorsmod "cosmossdk.io/errors/v2"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
|
||||
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||
)
|
||||
|
||||
// GRPCServiceRegistrar returns a function that registers the CometBFT gRPC service
|
||||
// Those services are defined for backward compatibility.
|
||||
// Eventually, they will be removed in favor of the new gRPC services.
|
||||
func (c *Consensus[T]) GRPCServiceRegistrar(
|
||||
clientCtx client.Context,
|
||||
cfg server.ConfigMap,
|
||||
) func(srv *grpc.Server) error {
|
||||
return func(srv *grpc.Server) error {
|
||||
cmtservice.RegisterServiceServer(srv, cmtservice.NewQueryServer(clientCtx.Client, c.Query, clientCtx.ConsensusAddressCodec))
|
||||
txtypes.RegisterServiceServer(srv, txServer[T]{clientCtx, c})
|
||||
nodeservice.RegisterServiceServer(srv, nodeServer[T]{cfg, c})
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// CometBFTAutoCLIDescriptor is the auto-generated CLI descriptor for the CometBFT service
|
||||
var CometBFTAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{
|
||||
Service: cmtv1beta1.Service_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "GetNodeInfo",
|
||||
Use: "node-info",
|
||||
Short: "Query the current node info",
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetSyncing",
|
||||
Use: "syncing",
|
||||
Short: "Query node syncing status",
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetLatestBlock",
|
||||
Use: "block-latest",
|
||||
Short: "Query for the latest committed block",
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetBlockByHeight",
|
||||
Use: "block-by-height <height>",
|
||||
Short: "Query for a committed block by height",
|
||||
Long: "Query for a specific committed block using the CometBFT RPC `block_by_height` method",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}},
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetLatestValidatorSet",
|
||||
Use: "validator-set",
|
||||
Alias: []string{"validator-set-latest", "comet-validator-set", "cometbft-validator-set", "tendermint-validator-set"},
|
||||
Short: "Query for the latest validator set",
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetValidatorSetByHeight",
|
||||
Use: "validator-set-by-height <height>",
|
||||
Short: "Query for a validator set by height",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}},
|
||||
},
|
||||
{
|
||||
RpcMethod: "ABCIQuery",
|
||||
Skip: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
type txServer[T transaction.Tx] struct {
|
||||
clientCtx client.Context
|
||||
consensus *Consensus[T]
|
||||
}
|
||||
|
||||
// BroadcastTx implements tx.ServiceServer.
|
||||
func (t txServer[T]) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) {
|
||||
return client.TxServiceBroadcast(ctx, t.clientCtx, req)
|
||||
}
|
||||
|
||||
// GetBlockWithTxs implements tx.ServiceServer.
|
||||
func (t txServer[T]) GetBlockWithTxs(context.Context, *txtypes.GetBlockWithTxsRequest) (*txtypes.GetBlockWithTxsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "not implemented")
|
||||
}
|
||||
|
||||
// GetTx implements tx.ServiceServer.
|
||||
func (t txServer[T]) GetTx(context.Context, *txtypes.GetTxRequest) (*txtypes.GetTxResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "not implemented")
|
||||
}
|
||||
|
||||
// GetTxsEvent implements tx.ServiceServer.
|
||||
func (t txServer[T]) GetTxsEvent(context.Context, *txtypes.GetTxsEventRequest) (*txtypes.GetTxsEventResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "not implemented")
|
||||
}
|
||||
|
||||
// Simulate implements tx.ServiceServer.
|
||||
func (t txServer[T]) Simulate(ctx context.Context, req *txtypes.SimulateRequest) (*txtypes.SimulateResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid empty tx")
|
||||
}
|
||||
|
||||
txBytes := req.TxBytes
|
||||
if txBytes == nil && req.Tx != nil {
|
||||
// This block is for backwards-compatibility.
|
||||
// We used to support passing a `Tx` in req. But if we do that, sig
|
||||
// verification might not pass, because the .Marshal() below might not
|
||||
// be the same marshaling done by the client.
|
||||
var err error
|
||||
txBytes, err = proto.Marshal(req.Tx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid tx; %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if txBytes == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "empty txBytes is not allowed")
|
||||
}
|
||||
|
||||
tx, err := t.consensus.txCodec.Decode(txBytes)
|
||||
if err != nil {
|
||||
return nil, errorsmod.Wrap(err, "failed to decode tx")
|
||||
}
|
||||
|
||||
txResult, _, err := t.consensus.app.Simulate(ctx, tx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Unknown, "%v with gas used: '%d'", err, txResult.GasUsed)
|
||||
}
|
||||
|
||||
msgResponses := make([]*codectypes.Any, 0, len(txResult.Resp))
|
||||
// pack the messages into Any
|
||||
for _, msg := range txResult.Resp {
|
||||
anyMsg, err := codectypes.NewAnyWithValue(msg)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Unknown, "failed to pack message response: %v", err)
|
||||
}
|
||||
msgResponses = append(msgResponses, anyMsg)
|
||||
}
|
||||
|
||||
return &txtypes.SimulateResponse{
|
||||
GasInfo: &sdk.GasInfo{
|
||||
GasUsed: txResult.GasUsed,
|
||||
GasWanted: txResult.GasWanted,
|
||||
},
|
||||
Result: &sdk.Result{
|
||||
MsgResponses: msgResponses,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// TxDecode implements tx.ServiceServer.
|
||||
func (t txServer[T]) TxDecode(context.Context, *txtypes.TxDecodeRequest) (*txtypes.TxDecodeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "not implemented")
|
||||
}
|
||||
|
||||
// TxDecodeAmino implements tx.ServiceServer.
|
||||
func (t txServer[T]) TxDecodeAmino(context.Context, *txtypes.TxDecodeAminoRequest) (*txtypes.TxDecodeAminoResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "not implemented")
|
||||
}
|
||||
|
||||
// TxEncode implements tx.ServiceServer.
|
||||
func (t txServer[T]) TxEncode(context.Context, *txtypes.TxEncodeRequest) (*txtypes.TxEncodeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "not implemented")
|
||||
}
|
||||
|
||||
// TxEncodeAmino implements tx.ServiceServer.
|
||||
func (t txServer[T]) TxEncodeAmino(context.Context, *txtypes.TxEncodeAminoRequest) (*txtypes.TxEncodeAminoResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "not implemented")
|
||||
}
|
||||
|
||||
var _ txtypes.ServiceServer = txServer[transaction.Tx]{}
|
||||
|
||||
type nodeServer[T transaction.Tx] struct {
|
||||
cfg server.ConfigMap
|
||||
consensus *Consensus[T]
|
||||
}
|
||||
|
||||
func (s nodeServer[T]) Config(ctx context.Context, _ *nodeservice.ConfigRequest) (*nodeservice.ConfigResponse, error) {
|
||||
minGasPricesStr := ""
|
||||
minGasPrices, ok := s.cfg["server"].(map[string]interface{})["minimum-gas-prices"]
|
||||
if ok {
|
||||
minGasPricesStr = minGasPrices.(string)
|
||||
}
|
||||
|
||||
return &nodeservice.ConfigResponse{
|
||||
MinimumGasPrice: minGasPricesStr,
|
||||
PruningKeepRecent: "ambiguous in v2",
|
||||
PruningInterval: "ambiguous in v2",
|
||||
HaltHeight: s.consensus.cfg.AppTomlConfig.HaltHeight,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s nodeServer[T]) Status(ctx context.Context, _ *nodeservice.StatusRequest) (*nodeservice.StatusResponse, error) {
|
||||
nodeInfo, err := s.consensus.Info(ctx, &v1.InfoRequest{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &nodeservice.StatusResponse{
|
||||
Height: uint64(nodeInfo.LastBlockHeight),
|
||||
Timestamp: nil,
|
||||
AppHash: nil,
|
||||
ValidatorHash: nodeInfo.LastBlockAppHash,
|
||||
}, nil
|
||||
}
|
||||
@ -8,7 +8,6 @@ import (
|
||||
crypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1"
|
||||
|
||||
errorsmod "cosmossdk.io/errors/v2"
|
||||
"cosmossdk.io/server/v2/cometbft/types"
|
||||
cometerrors "cosmossdk.io/server/v2/cometbft/types/errors"
|
||||
)
|
||||
|
||||
@ -84,7 +83,7 @@ func (c *Consensus[T]) handlerQueryApp(ctx context.Context, path []string, req *
|
||||
return nil, errorsmod.Wrapf(cometerrors.ErrUnknownRequest, "unknown query: %s", path)
|
||||
}
|
||||
|
||||
func (c *Consensus[T]) handleQueryStore(path []string, _ types.Store, req *abci.QueryRequest) (*abci.QueryResponse, error) {
|
||||
func (c *Consensus[T]) handleQueryStore(path []string, req *abci.QueryRequest) (*abci.QueryResponse, error) {
|
||||
req.Path = "/" + strings.Join(path[1:], "/")
|
||||
if req.Height <= 1 && req.Prove {
|
||||
return nil, errorsmod.Wrap(
|
||||
|
||||
@ -116,7 +116,6 @@ func New[T transaction.Tx](
|
||||
logger,
|
||||
appName,
|
||||
appManager,
|
||||
nil,
|
||||
srv.serverOptions.Mempool(cfg),
|
||||
indexEvents,
|
||||
queryHandlers,
|
||||
|
||||
@ -35,6 +35,7 @@ require (
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/spf13/viper v1.19.0
|
||||
github.com/stretchr/testify v1.9.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,7 +114,6 @@ 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
|
||||
|
||||
@ -7,9 +7,7 @@ import (
|
||||
corestore "cosmossdk.io/core/store"
|
||||
)
|
||||
|
||||
var (
|
||||
errInvalidIterator = errors.New("invalid iterator")
|
||||
)
|
||||
var errInvalidIterator = errors.New("invalid iterator")
|
||||
|
||||
// mergedIterator merges a parent Iterator and a child Iterator.
|
||||
// The child iterator may contain items that shadow or override items in the parent iterator.
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"cosmossdk.io/log"
|
||||
runtimev2 "cosmossdk.io/runtime/v2"
|
||||
serverv2 "cosmossdk.io/server/v2"
|
||||
"cosmossdk.io/server/v2/api/grpc"
|
||||
grpcserver "cosmossdk.io/server/v2/api/grpc"
|
||||
"cosmossdk.io/server/v2/api/rest"
|
||||
"cosmossdk.io/server/v2/api/telemetry"
|
||||
"cosmossdk.io/server/v2/cometbft"
|
||||
@ -40,7 +40,10 @@ type CommandDependencies[T transaction.Tx] struct {
|
||||
TxConfig client.TxConfig
|
||||
ModuleManager *runtimev2.MM[T]
|
||||
SimApp *simapp.SimApp[T]
|
||||
Consensus serverv2.ServerComponent[T]
|
||||
// could be more generic with serverv2.ServerComponent[T]
|
||||
// however, we want to register extra grpc handlers
|
||||
ConsensusServer *cometbft.CometBFTServer[T]
|
||||
ClientContext client.Context
|
||||
}
|
||||
|
||||
func InitRootCmd[T transaction.Tx](
|
||||
@ -66,8 +69,8 @@ func InitRootCmd[T transaction.Tx](
|
||||
|
||||
// build CLI skeleton for initial config parsing or a client application invocation
|
||||
if deps.SimApp == nil {
|
||||
if deps.Consensus == nil {
|
||||
deps.Consensus = cometbft.NewWithConfigOptions[T](initCometConfig())
|
||||
if deps.ConsensusServer == nil {
|
||||
deps.ConsensusServer = cometbft.NewWithConfigOptions[T](initCometConfig())
|
||||
}
|
||||
return serverv2.AddCommands[T](
|
||||
rootCmd,
|
||||
@ -75,8 +78,8 @@ func InitRootCmd[T transaction.Tx](
|
||||
io.NopCloser(nil),
|
||||
deps.GlobalConfig,
|
||||
initServerConfig(),
|
||||
deps.Consensus,
|
||||
&grpc.Server[T]{},
|
||||
deps.ConsensusServer,
|
||||
&grpcserver.Server[T]{},
|
||||
&serverstore.Server[T]{},
|
||||
&telemetry.Server[T]{},
|
||||
&rest.Server[T]{},
|
||||
@ -85,10 +88,7 @@ func InitRootCmd[T transaction.Tx](
|
||||
|
||||
// build full app!
|
||||
simApp := deps.SimApp
|
||||
grpcServer, err := grpc.New[T](logger, simApp.InterfaceRegistry(), simApp.QueryHandlers(), simApp.Query, deps.GlobalConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// store component (not a server)
|
||||
storeComponent, err := serverstore.New[T](simApp.Store(), deps.GlobalConfig)
|
||||
if err != nil {
|
||||
@ -100,8 +100,8 @@ func InitRootCmd[T transaction.Tx](
|
||||
}
|
||||
|
||||
// consensus component
|
||||
if deps.Consensus == nil {
|
||||
deps.Consensus, err = cometbft.New(
|
||||
if deps.ConsensusServer == nil {
|
||||
deps.ConsensusServer, err = cometbft.New(
|
||||
logger,
|
||||
simApp.Name(),
|
||||
simApp.Store(),
|
||||
@ -116,11 +116,29 @@ func InitRootCmd[T transaction.Tx](
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
telemetryServer, err := telemetry.New[T](deps.GlobalConfig, logger)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
grpcServer, err := grpcserver.New[T](
|
||||
logger,
|
||||
simApp.InterfaceRegistry(),
|
||||
simApp.QueryHandlers(),
|
||||
simApp.Query,
|
||||
deps.GlobalConfig,
|
||||
grpcserver.WithExtraGRPCHandlers[T](
|
||||
deps.ConsensusServer.Consensus.GRPCServiceRegistrar(
|
||||
deps.ClientContext,
|
||||
deps.GlobalConfig,
|
||||
),
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// wire server commands
|
||||
return serverv2.AddCommands[T](
|
||||
rootCmd,
|
||||
@ -128,7 +146,7 @@ func InitRootCmd[T transaction.Tx](
|
||||
simApp,
|
||||
deps.GlobalConfig,
|
||||
initServerConfig(),
|
||||
deps.Consensus,
|
||||
deps.ConsensusServer,
|
||||
grpcServer,
|
||||
storeComponent,
|
||||
telemetryServer,
|
||||
|
||||
@ -94,6 +94,7 @@ func NewRootCmd[T transaction.Tx](
|
||||
TxConfig: clientCtx.TxConfig,
|
||||
ModuleManager: moduleManager,
|
||||
SimApp: simApp,
|
||||
ClientContext: clientCtx,
|
||||
}
|
||||
rootCommand = &cobra.Command{
|
||||
Use: "simdv2",
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
gogoany "github.com/cosmos/gogoproto/types/any"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/simapp"
|
||||
baseaccountv1 "cosmossdk.io/x/accounts/defaults/base/v1"
|
||||
@ -17,7 +18,6 @@ import (
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -3,12 +3,14 @@ package accounts
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/core/header"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
counterv1 "cosmossdk.io/x/accounts/testing/counter/v1"
|
||||
"cosmossdk.io/x/bank/testutil"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestDependencies aims to test wiring between different account components,
|
||||
|
||||
@ -11,7 +11,6 @@ import (
|
||||
"cosmossdk.io/collections"
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
"cosmossdk.io/store/prefix"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
"cosmossdk.io/x/staking/types"
|
||||
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
@ -429,14 +428,13 @@ func (k Querier) Redelegations(ctx context.Context, req *types.QueryRedelegation
|
||||
var pageRes *query.PageResponse
|
||||
var err error
|
||||
|
||||
store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx))
|
||||
switch {
|
||||
case req.DelegatorAddr != "" && req.SrcValidatorAddr != "" && req.DstValidatorAddr != "":
|
||||
redels, err = queryRedelegation(ctx, k, req)
|
||||
case req.DelegatorAddr == "" && req.SrcValidatorAddr != "" && req.DstValidatorAddr == "":
|
||||
redels, pageRes, err = queryRedelegationsFromSrcValidator(ctx, k, req)
|
||||
default:
|
||||
redels, pageRes, err = queryAllRedelegations(ctx, store, k, req)
|
||||
redels, pageRes, err = queryAllRedelegations(ctx, k, req)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@ -557,7 +555,7 @@ func queryRedelegationsFromSrcValidator(ctx context.Context, k Querier, req *typ
|
||||
}, query.WithCollectionPaginationTriplePrefix[[]byte, []byte, []byte](valAddr))
|
||||
}
|
||||
|
||||
func queryAllRedelegations(ctx context.Context, store storetypes.KVStore, k Querier, req *types.QueryRedelegationsRequest) (redels types.Redelegations, res *query.PageResponse, err error) {
|
||||
func queryAllRedelegations(ctx context.Context, k Querier, req *types.QueryRedelegationsRequest) (redels types.Redelegations, res *query.PageResponse, err error) {
|
||||
delAddr, err := k.authKeeper.AddressCodec().StringToBytes(req.DelegatorAddr)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
||||
Loading…
Reference in New Issue
Block a user