diff --git a/api/cosmos/feemarket/module/v1/module.pulsar.go b/api/cosmos/feemarket/module/v1/module.pulsar.go new file mode 100644 index 000000000000..6a8da110cefc --- /dev/null +++ b/api/cosmos/feemarket/module/v1/module.pulsar.go @@ -0,0 +1,578 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package feemarketv1 + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + 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_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_module_v1_module_proto_init() + md_Module = File_cosmos_feemarket_module_v1_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_module_v1_module_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_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// 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_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(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_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, 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_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Module")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Module 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_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Module")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Module 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_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Module")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Module 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_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Module")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Module 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_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.Module.authority": + panic(fmt.Errorf("field authority of message cosmos.feemarket.v1.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Module")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Module 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_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Module")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Module 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_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.Module", 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_Module) 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_Module) 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_Module) 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_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + 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.Authority) + 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().(*Module) + 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.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + 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().(*Module) + 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: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: 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 Authority", 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.Authority = 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/feemarket/module/v1/module.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) +) + +// Module is the config object of the builder module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Authority defines the custom module authority. If not set, defaults to the + // governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_module_v1_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_module_v1_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_cosmos_feemarket_module_v1_module_proto protoreflect.FileDescriptor + +var file_cosmos_feemarket_module_v1_module_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x20, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x48, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x20, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x1a, + 0x0a, 0x18, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x78, + 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0xcd, 0x01, 0x0a, 0x17, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, + 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, + 0x76, 0x31, 0x3b, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, + 0x03, 0x43, 0x46, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x46, 0x65, + 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x46, 0x65, 0x65, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_cosmos_feemarket_module_v1_module_proto_rawDescOnce sync.Once + file_cosmos_feemarket_module_v1_module_proto_rawDescData = file_cosmos_feemarket_module_v1_module_proto_rawDesc +) + +func file_cosmos_feemarket_module_v1_module_proto_rawDescGZIP() []byte { + file_cosmos_feemarket_module_v1_module_proto_rawDescOnce.Do(func() { + file_cosmos_feemarket_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_feemarket_module_v1_module_proto_rawDescData) + }) + return file_cosmos_feemarket_module_v1_module_proto_rawDescData +} + +var file_cosmos_feemarket_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_feemarket_module_v1_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: cosmos.feemarket.v1.Module +} +var file_cosmos_feemarket_module_v1_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] 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_feemarket_module_v1_module_proto_init() } +func file_cosmos_feemarket_module_v1_module_proto_init() { + if File_cosmos_feemarket_module_v1_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cosmos_feemarket_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); 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_feemarket_module_v1_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_feemarket_module_v1_module_proto_goTypes, + DependencyIndexes: file_cosmos_feemarket_module_v1_module_proto_depIdxs, + MessageInfos: file_cosmos_feemarket_module_v1_module_proto_msgTypes, + }.Build() + File_cosmos_feemarket_module_v1_module_proto = out.File + file_cosmos_feemarket_module_v1_module_proto_rawDesc = nil + file_cosmos_feemarket_module_v1_module_proto_goTypes = nil + file_cosmos_feemarket_module_v1_module_proto_depIdxs = nil +} diff --git a/api/cosmos/feemarket/v1/genesis.pulsar.go b/api/cosmos/feemarket/v1/genesis.pulsar.go new file mode 100644 index 000000000000..eb68750851b5 --- /dev/null +++ b/api/cosmos/feemarket/v1/genesis.pulsar.go @@ -0,0 +1,1501 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package feemarketv1 + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + 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_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_state protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_genesis_proto_init() + md_GenesisState = File_cosmos_feemarket_v1_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_state = md_GenesisState.Fields().ByName("state") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_genesis_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_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// 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_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(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_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if x.State != nil { + value := protoreflect.ValueOfMessage(x.State.ProtoReflect()) + if !f(fd_GenesisState_state, 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_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.GenesisState.params": + return x.Params != nil + case "cosmos.feemarket.v1.GenesisState.state": + return x.State != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GenesisState 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_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.GenesisState.params": + x.Params = nil + case "cosmos.feemarket.v1.GenesisState.state": + x.State = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GenesisState 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_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.feemarket.v1.GenesisState.state": + value := x.State + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GenesisState 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_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "cosmos.feemarket.v1.GenesisState.state": + x.State = value.Message().Interface().(*State) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GenesisState 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_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "cosmos.feemarket.v1.GenesisState.state": + if x.State == nil { + x.State = new(State) + } + return protoreflect.ValueOfMessage(x.State.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GenesisState 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_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.feemarket.v1.GenesisState.state": + m := new(State) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GenesisState 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_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.GenesisState", 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_GenesisState) 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_GenesisState) 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_GenesisState) 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_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + 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.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.State != nil { + l = options.Size(x.State) + 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().(*GenesisState) + 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 x.State != nil { + encoded, err := options.Marshal(x.State) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + 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().(*GenesisState) + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: 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 Params", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.State == nil { + x.State = &State{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.State); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + 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, + } +} + +var _ protoreflect.List = (*_State_3_list)(nil) + +type _State_3_list struct { + list *[]uint64 +} + +func (x *_State_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_State_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfUint64((*x.list)[i]) +} + +func (x *_State_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Uint() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_State_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Uint() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_State_3_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message State at list field Window as it is not of Message kind")) +} + +func (x *_State_3_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_State_3_list) NewElement() protoreflect.Value { + v := uint64(0) + return protoreflect.ValueOfUint64(v) +} + +func (x *_State_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_State protoreflect.MessageDescriptor + fd_State_base_gas_price protoreflect.FieldDescriptor + fd_State_learning_rate protoreflect.FieldDescriptor + fd_State_window protoreflect.FieldDescriptor + fd_State_index protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_genesis_proto_init() + md_State = File_cosmos_feemarket_v1_genesis_proto.Messages().ByName("State") + fd_State_base_gas_price = md_State.Fields().ByName("base_gas_price") + fd_State_learning_rate = md_State.Fields().ByName("learning_rate") + fd_State_window = md_State.Fields().ByName("window") + fd_State_index = md_State.Fields().ByName("index") +} + +var _ protoreflect.Message = (*fastReflection_State)(nil) + +type fastReflection_State State + +func (x *State) ProtoReflect() protoreflect.Message { + return (*fastReflection_State)(x) +} + +func (x *State) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_genesis_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_State_messageType fastReflection_State_messageType +var _ protoreflect.MessageType = fastReflection_State_messageType{} + +type fastReflection_State_messageType struct{} + +func (x fastReflection_State_messageType) Zero() protoreflect.Message { + return (*fastReflection_State)(nil) +} +func (x fastReflection_State_messageType) New() protoreflect.Message { + return new(fastReflection_State) +} +func (x fastReflection_State_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_State +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_State) Descriptor() protoreflect.MessageDescriptor { + return md_State +} + +// 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_State) Type() protoreflect.MessageType { + return _fastReflection_State_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_State) New() protoreflect.Message { + return new(fastReflection_State) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_State) Interface() protoreflect.ProtoMessage { + return (*State)(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_State) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.BaseGasPrice != "" { + value := protoreflect.ValueOfString(x.BaseGasPrice) + if !f(fd_State_base_gas_price, value) { + return + } + } + if x.LearningRate != "" { + value := protoreflect.ValueOfString(x.LearningRate) + if !f(fd_State_learning_rate, value) { + return + } + } + if len(x.Window) != 0 { + value := protoreflect.ValueOfList(&_State_3_list{list: &x.Window}) + if !f(fd_State_window, value) { + return + } + } + if x.Index != uint64(0) { + value := protoreflect.ValueOfUint64(x.Index) + if !f(fd_State_index, 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_State) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.State.base_gas_price": + return x.BaseGasPrice != "" + case "cosmos.feemarket.v1.State.learning_rate": + return x.LearningRate != "" + case "cosmos.feemarket.v1.State.window": + return len(x.Window) != 0 + case "cosmos.feemarket.v1.State.index": + return x.Index != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.State")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.State 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_State) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.State.base_gas_price": + x.BaseGasPrice = "" + case "cosmos.feemarket.v1.State.learning_rate": + x.LearningRate = "" + case "cosmos.feemarket.v1.State.window": + x.Window = nil + case "cosmos.feemarket.v1.State.index": + x.Index = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.State")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.State 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_State) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.State.base_gas_price": + value := x.BaseGasPrice + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.State.learning_rate": + value := x.LearningRate + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.State.window": + if len(x.Window) == 0 { + return protoreflect.ValueOfList(&_State_3_list{}) + } + listValue := &_State_3_list{list: &x.Window} + return protoreflect.ValueOfList(listValue) + case "cosmos.feemarket.v1.State.index": + value := x.Index + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.State")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.State 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_State) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.State.base_gas_price": + x.BaseGasPrice = value.Interface().(string) + case "cosmos.feemarket.v1.State.learning_rate": + x.LearningRate = value.Interface().(string) + case "cosmos.feemarket.v1.State.window": + lv := value.List() + clv := lv.(*_State_3_list) + x.Window = *clv.list + case "cosmos.feemarket.v1.State.index": + x.Index = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.State")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.State 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_State) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.State.window": + if x.Window == nil { + x.Window = []uint64{} + } + value := &_State_3_list{list: &x.Window} + return protoreflect.ValueOfList(value) + case "cosmos.feemarket.v1.State.base_gas_price": + panic(fmt.Errorf("field base_gas_price of message cosmos.feemarket.v1.State is not mutable")) + case "cosmos.feemarket.v1.State.learning_rate": + panic(fmt.Errorf("field learning_rate of message cosmos.feemarket.v1.State is not mutable")) + case "cosmos.feemarket.v1.State.index": + panic(fmt.Errorf("field index of message cosmos.feemarket.v1.State is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.State")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.State 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_State) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.State.base_gas_price": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.State.learning_rate": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.State.window": + list := []uint64{} + return protoreflect.ValueOfList(&_State_3_list{list: &list}) + case "cosmos.feemarket.v1.State.index": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.State")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.State 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_State) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.State", 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_State) 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_State) 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_State) 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_State) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*State) + 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.BaseGasPrice) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.LearningRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Window) > 0 { + l = 0 + for _, e := range x.Window { + l += runtime.Sov(uint64(e)) + } + n += 1 + runtime.Sov(uint64(l)) + l + } + if x.Index != 0 { + n += 1 + runtime.Sov(uint64(x.Index)) + } + 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().(*State) + 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 x.Index != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Index)) + i-- + dAtA[i] = 0x20 + } + if len(x.Window) > 0 { + var pksize2 int + for _, num := range x.Window { + pksize2 += runtime.Sov(uint64(num)) + } + i -= pksize2 + j1 := i + for _, num := range x.Window { + for num >= 1<<7 { + dAtA[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA[j1] = uint8(num) + j1++ + } + i = runtime.EncodeVarint(dAtA, i, uint64(pksize2)) + i-- + dAtA[i] = 0x1a + } + if len(x.LearningRate) > 0 { + i -= len(x.LearningRate) + copy(dAtA[i:], x.LearningRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.LearningRate))) + i-- + dAtA[i] = 0x12 + } + if len(x.BaseGasPrice) > 0 { + i -= len(x.BaseGasPrice) + copy(dAtA[i:], x.BaseGasPrice) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.BaseGasPrice))) + 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().(*State) + 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: State: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: State: 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 BaseGasPrice", 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.BaseGasPrice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LearningRate", 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.LearningRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType == 0 { + var v 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++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Window = append(x.Window, v) + } else if wireType == 2 { + var packedLen int + 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++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + packedLen + 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 + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(x.Window) == 0 { + x.Window = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v 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++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Window = append(x.Window, v) + } + } else { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Window", wireType) + } + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + x.Index = 0 + 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++ + x.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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/feemarket/v1/genesis.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) +) + +// GenesisState defines the feemarket module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Params are the parameters for the feemarket module. These parameters + // can be utilized to implement both the base EIP-1559 fee market and + // and the AIMD EIP-1559 fee market. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + // State contains the current state of the AIMD fee market. + State *State `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetState() *State { + if x != nil { + return x.State + } + return nil +} + +// State is utilized to track the current state of the fee market. This includes +// the current base fee, learning rate, and block utilization within the +// specified AIMD window. +type State struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // BaseGasPrice is the current base fee. This is denominated in the fee per + // gas unit. + BaseGasPrice string `protobuf:"bytes,1,opt,name=base_gas_price,json=baseGasPrice,proto3" json:"base_gas_price,omitempty"` + // LearningRate is the current learning rate. + LearningRate string `protobuf:"bytes,2,opt,name=learning_rate,json=learningRate,proto3" json:"learning_rate,omitempty"` + // Window contains a list of the last blocks' utilization values. This is used + // to calculate the next base fee. This stores the number of units of gas + // consumed per block. + Window []uint64 `protobuf:"varint,3,rep,packed,name=window,proto3" json:"window,omitempty"` + // Index is the index of the current block in the block utilization window. + Index uint64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` +} + +func (x *State) Reset() { + *x = State{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_genesis_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *State) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*State) ProtoMessage() {} + +// Deprecated: Use State.ProtoReflect.Descriptor instead. +func (*State) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_genesis_proto_rawDescGZIP(), []int{1} +} + +func (x *State) GetBaseGasPrice() string { + if x != nil { + return x.BaseGasPrice + } + return "" +} + +func (x *State) GetLearningRate() string { + if x != nil { + return x.LearningRate + } + return "" +} + +func (x *State) GetWindow() []uint64 { + if x != nil { + return x.Window + } + return nil +} + +func (x *State) GetIndex() uint64 { + if x != nil { + return x.Index + } + return 0 +} + +var File_cosmos_feemarket_v1_genesis_proto protoreflect.FileDescriptor + +var file_cosmos_feemarket_v1_genesis_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x81, 0x01, 0x0a, 0x0c, + 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x39, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, + 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, + 0xe6, 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x57, 0x0a, 0x0e, 0x62, 0x61, 0x73, + 0x65, 0x5f, 0x67, 0x61, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, + 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, + 0x63, 0x65, 0x12, 0x56, 0x0a, 0x0d, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x72, + 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, + 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, 0x6c, 0x65, + 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x77, 0x69, + 0x6e, 0x64, 0x6f, 0x77, 0x18, 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x77, 0x69, 0x6e, 0x64, + 0x6f, 0x77, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x42, 0xc7, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, + 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x66, 0x65, 0x65, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x46, 0x58, 0xaa, 0x02, 0x13, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_feemarket_v1_genesis_proto_rawDescOnce sync.Once + file_cosmos_feemarket_v1_genesis_proto_rawDescData = file_cosmos_feemarket_v1_genesis_proto_rawDesc +) + +func file_cosmos_feemarket_v1_genesis_proto_rawDescGZIP() []byte { + file_cosmos_feemarket_v1_genesis_proto_rawDescOnce.Do(func() { + file_cosmos_feemarket_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_feemarket_v1_genesis_proto_rawDescData) + }) + return file_cosmos_feemarket_v1_genesis_proto_rawDescData +} + +var file_cosmos_feemarket_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cosmos_feemarket_v1_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: cosmos.feemarket.v1.GenesisState + (*State)(nil), // 1: cosmos.feemarket.v1.State + (*Params)(nil), // 2: cosmos.feemarket.v1.Params +} +var file_cosmos_feemarket_v1_genesis_proto_depIdxs = []int32{ + 2, // 0: cosmos.feemarket.v1.GenesisState.params:type_name -> cosmos.feemarket.v1.Params + 1, // 1: cosmos.feemarket.v1.GenesisState.state:type_name -> cosmos.feemarket.v1.State + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_cosmos_feemarket_v1_genesis_proto_init() } +func file_cosmos_feemarket_v1_genesis_proto_init() { + if File_cosmos_feemarket_v1_genesis_proto != nil { + return + } + file_cosmos_feemarket_v1_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_feemarket_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_genesis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*State); 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_feemarket_v1_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_feemarket_v1_genesis_proto_goTypes, + DependencyIndexes: file_cosmos_feemarket_v1_genesis_proto_depIdxs, + MessageInfos: file_cosmos_feemarket_v1_genesis_proto_msgTypes, + }.Build() + File_cosmos_feemarket_v1_genesis_proto = out.File + file_cosmos_feemarket_v1_genesis_proto_rawDesc = nil + file_cosmos_feemarket_v1_genesis_proto_goTypes = nil + file_cosmos_feemarket_v1_genesis_proto_depIdxs = nil +} diff --git a/api/cosmos/feemarket/v1/params.pulsar.go b/api/cosmos/feemarket/v1/params.pulsar.go new file mode 100644 index 000000000000..56e0197f549f --- /dev/null +++ b/api/cosmos/feemarket/v1/params.pulsar.go @@ -0,0 +1,1389 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package feemarketv1 + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + 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_Params protoreflect.MessageDescriptor + fd_Params_alpha protoreflect.FieldDescriptor + fd_Params_beta protoreflect.FieldDescriptor + fd_Params_gamma protoreflect.FieldDescriptor + fd_Params_delta protoreflect.FieldDescriptor + fd_Params_min_base_gas_price protoreflect.FieldDescriptor + fd_Params_min_learning_rate protoreflect.FieldDescriptor + fd_Params_max_learning_rate protoreflect.FieldDescriptor + fd_Params_max_block_utilization protoreflect.FieldDescriptor + fd_Params_window protoreflect.FieldDescriptor + fd_Params_fee_denom protoreflect.FieldDescriptor + fd_Params_enabled protoreflect.FieldDescriptor + fd_Params_distribute_fees protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_params_proto_init() + md_Params = File_cosmos_feemarket_v1_params_proto.Messages().ByName("Params") + fd_Params_alpha = md_Params.Fields().ByName("alpha") + fd_Params_beta = md_Params.Fields().ByName("beta") + fd_Params_gamma = md_Params.Fields().ByName("gamma") + fd_Params_delta = md_Params.Fields().ByName("delta") + fd_Params_min_base_gas_price = md_Params.Fields().ByName("min_base_gas_price") + fd_Params_min_learning_rate = md_Params.Fields().ByName("min_learning_rate") + fd_Params_max_learning_rate = md_Params.Fields().ByName("max_learning_rate") + fd_Params_max_block_utilization = md_Params.Fields().ByName("max_block_utilization") + fd_Params_window = md_Params.Fields().ByName("window") + fd_Params_fee_denom = md_Params.Fields().ByName("fee_denom") + fd_Params_enabled = md_Params.Fields().ByName("enabled") + fd_Params_distribute_fees = md_Params.Fields().ByName("distribute_fees") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_params_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_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// 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_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(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_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Alpha != "" { + value := protoreflect.ValueOfString(x.Alpha) + if !f(fd_Params_alpha, value) { + return + } + } + if x.Beta != "" { + value := protoreflect.ValueOfString(x.Beta) + if !f(fd_Params_beta, value) { + return + } + } + if x.Gamma != "" { + value := protoreflect.ValueOfString(x.Gamma) + if !f(fd_Params_gamma, value) { + return + } + } + if x.Delta != "" { + value := protoreflect.ValueOfString(x.Delta) + if !f(fd_Params_delta, value) { + return + } + } + if x.MinBaseGasPrice != "" { + value := protoreflect.ValueOfString(x.MinBaseGasPrice) + if !f(fd_Params_min_base_gas_price, value) { + return + } + } + if x.MinLearningRate != "" { + value := protoreflect.ValueOfString(x.MinLearningRate) + if !f(fd_Params_min_learning_rate, value) { + return + } + } + if x.MaxLearningRate != "" { + value := protoreflect.ValueOfString(x.MaxLearningRate) + if !f(fd_Params_max_learning_rate, value) { + return + } + } + if x.MaxBlockUtilization != uint64(0) { + value := protoreflect.ValueOfUint64(x.MaxBlockUtilization) + if !f(fd_Params_max_block_utilization, value) { + return + } + } + if x.Window != uint64(0) { + value := protoreflect.ValueOfUint64(x.Window) + if !f(fd_Params_window, value) { + return + } + } + if x.FeeDenom != "" { + value := protoreflect.ValueOfString(x.FeeDenom) + if !f(fd_Params_fee_denom, value) { + return + } + } + if x.Enabled != false { + value := protoreflect.ValueOfBool(x.Enabled) + if !f(fd_Params_enabled, value) { + return + } + } + if x.DistributeFees != false { + value := protoreflect.ValueOfBool(x.DistributeFees) + if !f(fd_Params_distribute_fees, 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_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.Params.alpha": + return x.Alpha != "" + case "cosmos.feemarket.v1.Params.beta": + return x.Beta != "" + case "cosmos.feemarket.v1.Params.gamma": + return x.Gamma != "" + case "cosmos.feemarket.v1.Params.delta": + return x.Delta != "" + case "cosmos.feemarket.v1.Params.min_base_gas_price": + return x.MinBaseGasPrice != "" + case "cosmos.feemarket.v1.Params.min_learning_rate": + return x.MinLearningRate != "" + case "cosmos.feemarket.v1.Params.max_learning_rate": + return x.MaxLearningRate != "" + case "cosmos.feemarket.v1.Params.max_block_utilization": + return x.MaxBlockUtilization != uint64(0) + case "cosmos.feemarket.v1.Params.window": + return x.Window != uint64(0) + case "cosmos.feemarket.v1.Params.fee_denom": + return x.FeeDenom != "" + case "cosmos.feemarket.v1.Params.enabled": + return x.Enabled != false + case "cosmos.feemarket.v1.Params.distribute_fees": + return x.DistributeFees != false + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Params")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Params 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_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.Params.alpha": + x.Alpha = "" + case "cosmos.feemarket.v1.Params.beta": + x.Beta = "" + case "cosmos.feemarket.v1.Params.gamma": + x.Gamma = "" + case "cosmos.feemarket.v1.Params.delta": + x.Delta = "" + case "cosmos.feemarket.v1.Params.min_base_gas_price": + x.MinBaseGasPrice = "" + case "cosmos.feemarket.v1.Params.min_learning_rate": + x.MinLearningRate = "" + case "cosmos.feemarket.v1.Params.max_learning_rate": + x.MaxLearningRate = "" + case "cosmos.feemarket.v1.Params.max_block_utilization": + x.MaxBlockUtilization = uint64(0) + case "cosmos.feemarket.v1.Params.window": + x.Window = uint64(0) + case "cosmos.feemarket.v1.Params.fee_denom": + x.FeeDenom = "" + case "cosmos.feemarket.v1.Params.enabled": + x.Enabled = false + case "cosmos.feemarket.v1.Params.distribute_fees": + x.DistributeFees = false + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Params")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Params 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_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.Params.alpha": + value := x.Alpha + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.Params.beta": + value := x.Beta + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.Params.gamma": + value := x.Gamma + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.Params.delta": + value := x.Delta + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.Params.min_base_gas_price": + value := x.MinBaseGasPrice + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.Params.min_learning_rate": + value := x.MinLearningRate + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.Params.max_learning_rate": + value := x.MaxLearningRate + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.Params.max_block_utilization": + value := x.MaxBlockUtilization + return protoreflect.ValueOfUint64(value) + case "cosmos.feemarket.v1.Params.window": + value := x.Window + return protoreflect.ValueOfUint64(value) + case "cosmos.feemarket.v1.Params.fee_denom": + value := x.FeeDenom + return protoreflect.ValueOfString(value) + case "cosmos.feemarket.v1.Params.enabled": + value := x.Enabled + return protoreflect.ValueOfBool(value) + case "cosmos.feemarket.v1.Params.distribute_fees": + value := x.DistributeFees + return protoreflect.ValueOfBool(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Params")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Params 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_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.Params.alpha": + x.Alpha = value.Interface().(string) + case "cosmos.feemarket.v1.Params.beta": + x.Beta = value.Interface().(string) + case "cosmos.feemarket.v1.Params.gamma": + x.Gamma = value.Interface().(string) + case "cosmos.feemarket.v1.Params.delta": + x.Delta = value.Interface().(string) + case "cosmos.feemarket.v1.Params.min_base_gas_price": + x.MinBaseGasPrice = value.Interface().(string) + case "cosmos.feemarket.v1.Params.min_learning_rate": + x.MinLearningRate = value.Interface().(string) + case "cosmos.feemarket.v1.Params.max_learning_rate": + x.MaxLearningRate = value.Interface().(string) + case "cosmos.feemarket.v1.Params.max_block_utilization": + x.MaxBlockUtilization = value.Uint() + case "cosmos.feemarket.v1.Params.window": + x.Window = value.Uint() + case "cosmos.feemarket.v1.Params.fee_denom": + x.FeeDenom = value.Interface().(string) + case "cosmos.feemarket.v1.Params.enabled": + x.Enabled = value.Bool() + case "cosmos.feemarket.v1.Params.distribute_fees": + x.DistributeFees = value.Bool() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Params")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Params 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_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.Params.alpha": + panic(fmt.Errorf("field alpha of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.beta": + panic(fmt.Errorf("field beta of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.gamma": + panic(fmt.Errorf("field gamma of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.delta": + panic(fmt.Errorf("field delta of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.min_base_gas_price": + panic(fmt.Errorf("field min_base_gas_price of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.min_learning_rate": + panic(fmt.Errorf("field min_learning_rate of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.max_learning_rate": + panic(fmt.Errorf("field max_learning_rate of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.max_block_utilization": + panic(fmt.Errorf("field max_block_utilization of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.window": + panic(fmt.Errorf("field window of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.fee_denom": + panic(fmt.Errorf("field fee_denom of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.enabled": + panic(fmt.Errorf("field enabled of message cosmos.feemarket.v1.Params is not mutable")) + case "cosmos.feemarket.v1.Params.distribute_fees": + panic(fmt.Errorf("field distribute_fees of message cosmos.feemarket.v1.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Params")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Params 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_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.Params.alpha": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.Params.beta": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.Params.gamma": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.Params.delta": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.Params.min_base_gas_price": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.Params.min_learning_rate": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.Params.max_learning_rate": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.Params.max_block_utilization": + return protoreflect.ValueOfUint64(uint64(0)) + case "cosmos.feemarket.v1.Params.window": + return protoreflect.ValueOfUint64(uint64(0)) + case "cosmos.feemarket.v1.Params.fee_denom": + return protoreflect.ValueOfString("") + case "cosmos.feemarket.v1.Params.enabled": + return protoreflect.ValueOfBool(false) + case "cosmos.feemarket.v1.Params.distribute_fees": + return protoreflect.ValueOfBool(false) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.Params")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.Params 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_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.Params", 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_Params) 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_Params) 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_Params) 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_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + 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.Alpha) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Beta) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Gamma) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Delta) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.MinBaseGasPrice) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.MinLearningRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.MaxLearningRate) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.MaxBlockUtilization != 0 { + n += 1 + runtime.Sov(uint64(x.MaxBlockUtilization)) + } + if x.Window != 0 { + n += 1 + runtime.Sov(uint64(x.Window)) + } + l = len(x.FeeDenom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Enabled { + n += 2 + } + if x.DistributeFees { + n += 2 + } + 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().(*Params) + 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 x.DistributeFees { + i-- + if x.DistributeFees { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x60 + } + if x.Enabled { + i-- + if x.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if len(x.FeeDenom) > 0 { + i -= len(x.FeeDenom) + copy(dAtA[i:], x.FeeDenom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FeeDenom))) + i-- + dAtA[i] = 0x52 + } + if x.Window != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Window)) + i-- + dAtA[i] = 0x48 + } + if x.MaxBlockUtilization != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxBlockUtilization)) + i-- + dAtA[i] = 0x40 + } + if len(x.MaxLearningRate) > 0 { + i -= len(x.MaxLearningRate) + copy(dAtA[i:], x.MaxLearningRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MaxLearningRate))) + i-- + dAtA[i] = 0x3a + } + if len(x.MinLearningRate) > 0 { + i -= len(x.MinLearningRate) + copy(dAtA[i:], x.MinLearningRate) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinLearningRate))) + i-- + dAtA[i] = 0x32 + } + if len(x.MinBaseGasPrice) > 0 { + i -= len(x.MinBaseGasPrice) + copy(dAtA[i:], x.MinBaseGasPrice) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinBaseGasPrice))) + i-- + dAtA[i] = 0x2a + } + if len(x.Delta) > 0 { + i -= len(x.Delta) + copy(dAtA[i:], x.Delta) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Delta))) + i-- + dAtA[i] = 0x22 + } + if len(x.Gamma) > 0 { + i -= len(x.Gamma) + copy(dAtA[i:], x.Gamma) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Gamma))) + i-- + dAtA[i] = 0x1a + } + if len(x.Beta) > 0 { + i -= len(x.Beta) + copy(dAtA[i:], x.Beta) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Beta))) + i-- + dAtA[i] = 0x12 + } + if len(x.Alpha) > 0 { + i -= len(x.Alpha) + copy(dAtA[i:], x.Alpha) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Alpha))) + 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().(*Params) + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: 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 Alpha", 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.Alpha = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Beta", 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.Beta = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Gamma", 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.Gamma = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Delta", 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.Delta = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinBaseGasPrice", 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.MinBaseGasPrice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinLearningRate", 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.MinLearningRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxLearningRate", 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.MaxLearningRate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxBlockUtilization", wireType) + } + x.MaxBlockUtilization = 0 + 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++ + x.MaxBlockUtilization |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Window", wireType) + } + x.Window = 0 + 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++ + x.Window |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", 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.FeeDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + 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++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Enabled = bool(v != 0) + case 12: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DistributeFees", wireType) + } + var v int + 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++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.DistributeFees = bool(v != 0) + 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/feemarket/v1/params.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) +) + +// Params contains the required set of parameters for the EIP1559 fee market +// plugin implementation. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Alpha is the amount we additively increase the learning rate + // when it is above or below the target +/- threshold. + // + // Must be > 0. + Alpha string `protobuf:"bytes,1,opt,name=alpha,proto3" json:"alpha,omitempty"` + // Beta is the amount we multiplicatively decrease the learning rate + // when it is within the target +/- threshold. + // + // Must be [0, 1]. + Beta string `protobuf:"bytes,2,opt,name=beta,proto3" json:"beta,omitempty"` + // Gamma is the threshold for the learning rate. If the learning rate is + // above or below the target +/- threshold, we additively increase the + // learning rate by Alpha. Otherwise, we multiplicatively decrease the + // learning rate by Beta. + // + // Must be [0, 0.5]. + Gamma string `protobuf:"bytes,3,opt,name=gamma,proto3" json:"gamma,omitempty"` + // Delta is the amount we additively increase/decrease the gas price when the + // net block utilization difference in the window is above/below the target + // utilization. + Delta string `protobuf:"bytes,4,opt,name=delta,proto3" json:"delta,omitempty"` + // MinBaseGasPrice determines the initial gas price of the module and the + // global minimum for the network. + MinBaseGasPrice string `protobuf:"bytes,5,opt,name=min_base_gas_price,json=minBaseGasPrice,proto3" json:"min_base_gas_price,omitempty"` + // MinLearningRate is the lower bound for the learning rate. + MinLearningRate string `protobuf:"bytes,6,opt,name=min_learning_rate,json=minLearningRate,proto3" json:"min_learning_rate,omitempty"` + // MaxLearningRate is the upper bound for the learning rate. + MaxLearningRate string `protobuf:"bytes,7,opt,name=max_learning_rate,json=maxLearningRate,proto3" json:"max_learning_rate,omitempty"` + // MaxBlockUtilization is the maximum block utilization. + MaxBlockUtilization uint64 `protobuf:"varint,8,opt,name=max_block_utilization,json=maxBlockUtilization,proto3" json:"max_block_utilization,omitempty"` + // Window defines the window size for calculating an adaptive learning rate + // over a moving window of blocks. + Window uint64 `protobuf:"varint,9,opt,name=window,proto3" json:"window,omitempty"` + // FeeDenom is the denom that will be used for all fee payments. + FeeDenom string `protobuf:"bytes,10,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` + // Enabled is a boolean that determines whether the EIP1559 fee market is + // enabled. + Enabled bool `protobuf:"varint,11,opt,name=enabled,proto3" json:"enabled,omitempty"` + // DistributeFees is a boolean that determines whether the fees are burned or + // distributed to all stakers. + DistributeFees bool `protobuf:"varint,12,opt,name=distribute_fees,json=distributeFees,proto3" json:"distribute_fees,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_params_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetAlpha() string { + if x != nil { + return x.Alpha + } + return "" +} + +func (x *Params) GetBeta() string { + if x != nil { + return x.Beta + } + return "" +} + +func (x *Params) GetGamma() string { + if x != nil { + return x.Gamma + } + return "" +} + +func (x *Params) GetDelta() string { + if x != nil { + return x.Delta + } + return "" +} + +func (x *Params) GetMinBaseGasPrice() string { + if x != nil { + return x.MinBaseGasPrice + } + return "" +} + +func (x *Params) GetMinLearningRate() string { + if x != nil { + return x.MinLearningRate + } + return "" +} + +func (x *Params) GetMaxLearningRate() string { + if x != nil { + return x.MaxLearningRate + } + return "" +} + +func (x *Params) GetMaxBlockUtilization() uint64 { + if x != nil { + return x.MaxBlockUtilization + } + return 0 +} + +func (x *Params) GetWindow() uint64 { + if x != nil { + return x.Window + } + return 0 +} + +func (x *Params) GetFeeDenom() string { + if x != nil { + return x.FeeDenom + } + return "" +} + +func (x *Params) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +func (x *Params) GetDistributeFees() bool { + if x != nil { + return x.DistributeFees + } + return false +} + +var File_cosmos_feemarket_v1_params_proto protoreflect.FileDescriptor + +var file_cosmos_feemarket_v1_params_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf4, 0x05, 0x0a, 0x06, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x47, 0x0a, 0x05, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x05, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x12, 0x45, 0x0a, 0x04, + 0x62, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x04, 0x62, + 0x65, 0x74, 0x61, 0x12, 0x47, 0x0a, 0x05, 0x67, 0x61, 0x6d, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x05, 0x67, 0x61, 0x6d, 0x6d, 0x61, 0x12, 0x47, 0x0a, 0x05, + 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, + 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, + 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x05, + 0x64, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x5e, 0x0a, 0x12, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x61, 0x73, + 0x65, 0x5f, 0x67, 0x61, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, + 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0f, 0x6d, 0x69, 0x6e, 0x42, 0x61, 0x73, 0x65, 0x47, 0x61, 0x73, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x5d, 0x0a, 0x11, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x61, + 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, + 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x44, 0x65, 0x63, 0x52, 0x0f, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, + 0x52, 0x61, 0x74, 0x65, 0x12, 0x5d, 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x61, 0x72, + 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, + 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, + 0x65, 0x63, 0x52, 0x0f, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x52, + 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x5f, 0x75, 0x74, 0x69, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x13, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x55, 0x74, 0x69, 0x6c, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x77, 0x69, 0x6e, 0x64, 0x6f, + 0x77, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x12, + 0x1b, 0x0a, 0x09, 0x66, 0x65, 0x65, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x66, 0x65, 0x65, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x18, 0x0a, 0x07, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x46, 0x65, 0x65, 0x73, 0x42, + 0xc6, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, + 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, + 0x3b, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, + 0x46, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x46, 0x65, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x46, 0x65, 0x65, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_feemarket_v1_params_proto_rawDescOnce sync.Once + file_cosmos_feemarket_v1_params_proto_rawDescData = file_cosmos_feemarket_v1_params_proto_rawDesc +) + +func file_cosmos_feemarket_v1_params_proto_rawDescGZIP() []byte { + file_cosmos_feemarket_v1_params_proto_rawDescOnce.Do(func() { + file_cosmos_feemarket_v1_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_feemarket_v1_params_proto_rawDescData) + }) + return file_cosmos_feemarket_v1_params_proto_rawDescData +} + +var file_cosmos_feemarket_v1_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_feemarket_v1_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: cosmos.feemarket.v1.Params +} +var file_cosmos_feemarket_v1_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] 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_feemarket_v1_params_proto_init() } +func file_cosmos_feemarket_v1_params_proto_init() { + if File_cosmos_feemarket_v1_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cosmos_feemarket_v1_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); 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_feemarket_v1_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_feemarket_v1_params_proto_goTypes, + DependencyIndexes: file_cosmos_feemarket_v1_params_proto_depIdxs, + MessageInfos: file_cosmos_feemarket_v1_params_proto_msgTypes, + }.Build() + File_cosmos_feemarket_v1_params_proto = out.File + file_cosmos_feemarket_v1_params_proto_rawDesc = nil + file_cosmos_feemarket_v1_params_proto_goTypes = nil + file_cosmos_feemarket_v1_params_proto_depIdxs = nil +} diff --git a/api/cosmos/feemarket/v1/query.pulsar.go b/api/cosmos/feemarket/v1/query.pulsar.go new file mode 100644 index 000000000000..903976b9b923 --- /dev/null +++ b/api/cosmos/feemarket/v1/query.pulsar.go @@ -0,0 +1,3844 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package feemarketv1 + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + _ "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_ParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_feemarket_v1_query_proto_init() + md_ParamsRequest = File_cosmos_feemarket_v1_query_proto.Messages().ByName("ParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_ParamsRequest)(nil) + +type fastReflection_ParamsRequest ParamsRequest + +func (x *ParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_ParamsRequest)(x) +} + +func (x *ParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_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_ParamsRequest_messageType fastReflection_ParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_ParamsRequest_messageType{} + +type fastReflection_ParamsRequest_messageType struct{} + +func (x fastReflection_ParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_ParamsRequest)(nil) +} +func (x fastReflection_ParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_ParamsRequest) +} +func (x fastReflection_ParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_ParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_ParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_ParamsRequest +} + +// 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_ParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_ParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_ParamsRequest) New() protoreflect.Message { + return new(fastReflection_ParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_ParamsRequest) Interface() protoreflect.ProtoMessage { + return (*ParamsRequest)(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_ParamsRequest) 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_ParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsRequest 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_ParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsRequest 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_ParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsRequest 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_ParamsRequest) 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.feemarket.v1.ParamsRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsRequest 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_ParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsRequest 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_ParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsRequest 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_ParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.ParamsRequest", 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_ParamsRequest) 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_ParamsRequest) 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_ParamsRequest) 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_ParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*ParamsRequest) + 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().(*ParamsRequest) + 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().(*ParamsRequest) + 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: ParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsRequest: 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_ParamsResponse protoreflect.MessageDescriptor + fd_ParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_query_proto_init() + md_ParamsResponse = File_cosmos_feemarket_v1_query_proto.Messages().ByName("ParamsResponse") + fd_ParamsResponse_params = md_ParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_ParamsResponse)(nil) + +type fastReflection_ParamsResponse ParamsResponse + +func (x *ParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_ParamsResponse)(x) +} + +func (x *ParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_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_ParamsResponse_messageType fastReflection_ParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_ParamsResponse_messageType{} + +type fastReflection_ParamsResponse_messageType struct{} + +func (x fastReflection_ParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_ParamsResponse)(nil) +} +func (x fastReflection_ParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_ParamsResponse) +} +func (x fastReflection_ParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_ParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_ParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_ParamsResponse +} + +// 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_ParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_ParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_ParamsResponse) New() protoreflect.Message { + return new(fastReflection_ParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_ParamsResponse) Interface() protoreflect.ProtoMessage { + return (*ParamsResponse)(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_ParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_ParamsResponse_params, 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_ParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.ParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsResponse 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_ParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.ParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsResponse 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_ParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.ParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsResponse 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_ParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.ParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsResponse 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_ParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.ParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsResponse 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_ParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.ParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.ParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.ParamsResponse 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_ParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.ParamsResponse", 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_ParamsResponse) 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_ParamsResponse) 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_ParamsResponse) 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_ParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*ParamsResponse) + 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.Params != nil { + l = options.Size(x.Params) + 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().(*ParamsResponse) + 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 x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + 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().(*ParamsResponse) + 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: ParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsResponse: 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 Params", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + 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, + } +} + +var ( + md_StateRequest protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_feemarket_v1_query_proto_init() + md_StateRequest = File_cosmos_feemarket_v1_query_proto.Messages().ByName("StateRequest") +} + +var _ protoreflect.Message = (*fastReflection_StateRequest)(nil) + +type fastReflection_StateRequest StateRequest + +func (x *StateRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_StateRequest)(x) +} + +func (x *StateRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[2] + 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_StateRequest_messageType fastReflection_StateRequest_messageType +var _ protoreflect.MessageType = fastReflection_StateRequest_messageType{} + +type fastReflection_StateRequest_messageType struct{} + +func (x fastReflection_StateRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_StateRequest)(nil) +} +func (x fastReflection_StateRequest_messageType) New() protoreflect.Message { + return new(fastReflection_StateRequest) +} +func (x fastReflection_StateRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_StateRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_StateRequest) Descriptor() protoreflect.MessageDescriptor { + return md_StateRequest +} + +// 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_StateRequest) Type() protoreflect.MessageType { + return _fastReflection_StateRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_StateRequest) New() protoreflect.Message { + return new(fastReflection_StateRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_StateRequest) Interface() protoreflect.ProtoMessage { + return (*StateRequest)(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_StateRequest) 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_StateRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateRequest 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_StateRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateRequest 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_StateRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateRequest 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_StateRequest) 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.feemarket.v1.StateRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateRequest 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_StateRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateRequest 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_StateRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateRequest 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_StateRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.StateRequest", 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_StateRequest) 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_StateRequest) 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_StateRequest) 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_StateRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*StateRequest) + 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().(*StateRequest) + 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().(*StateRequest) + 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: StateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: StateRequest: 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_StateResponse protoreflect.MessageDescriptor + fd_StateResponse_state protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_query_proto_init() + md_StateResponse = File_cosmos_feemarket_v1_query_proto.Messages().ByName("StateResponse") + fd_StateResponse_state = md_StateResponse.Fields().ByName("state") +} + +var _ protoreflect.Message = (*fastReflection_StateResponse)(nil) + +type fastReflection_StateResponse StateResponse + +func (x *StateResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_StateResponse)(x) +} + +func (x *StateResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[3] + 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_StateResponse_messageType fastReflection_StateResponse_messageType +var _ protoreflect.MessageType = fastReflection_StateResponse_messageType{} + +type fastReflection_StateResponse_messageType struct{} + +func (x fastReflection_StateResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_StateResponse)(nil) +} +func (x fastReflection_StateResponse_messageType) New() protoreflect.Message { + return new(fastReflection_StateResponse) +} +func (x fastReflection_StateResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_StateResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_StateResponse) Descriptor() protoreflect.MessageDescriptor { + return md_StateResponse +} + +// 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_StateResponse) Type() protoreflect.MessageType { + return _fastReflection_StateResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_StateResponse) New() protoreflect.Message { + return new(fastReflection_StateResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_StateResponse) Interface() protoreflect.ProtoMessage { + return (*StateResponse)(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_StateResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.State != nil { + value := protoreflect.ValueOfMessage(x.State.ProtoReflect()) + if !f(fd_StateResponse_state, 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_StateResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.StateResponse.state": + return x.State != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateResponse 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_StateResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.StateResponse.state": + x.State = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateResponse 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_StateResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.StateResponse.state": + value := x.State + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateResponse 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_StateResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.StateResponse.state": + x.State = value.Message().Interface().(*State) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateResponse 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_StateResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.StateResponse.state": + if x.State == nil { + x.State = new(State) + } + return protoreflect.ValueOfMessage(x.State.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateResponse 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_StateResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.StateResponse.state": + m := new(State) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.StateResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.StateResponse 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_StateResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.StateResponse", 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_StateResponse) 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_StateResponse) 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_StateResponse) 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_StateResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*StateResponse) + 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.State != nil { + l = options.Size(x.State) + 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().(*StateResponse) + 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 x.State != nil { + encoded, err := options.Marshal(x.State) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + 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().(*StateResponse) + 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: StateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: StateResponse: 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 State", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.State == nil { + x.State = &State{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.State); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + 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, + } +} + +var ( + md_GasPriceRequest protoreflect.MessageDescriptor + fd_GasPriceRequest_denom protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_query_proto_init() + md_GasPriceRequest = File_cosmos_feemarket_v1_query_proto.Messages().ByName("GasPriceRequest") + fd_GasPriceRequest_denom = md_GasPriceRequest.Fields().ByName("denom") +} + +var _ protoreflect.Message = (*fastReflection_GasPriceRequest)(nil) + +type fastReflection_GasPriceRequest GasPriceRequest + +func (x *GasPriceRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_GasPriceRequest)(x) +} + +func (x *GasPriceRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[4] + 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_GasPriceRequest_messageType fastReflection_GasPriceRequest_messageType +var _ protoreflect.MessageType = fastReflection_GasPriceRequest_messageType{} + +type fastReflection_GasPriceRequest_messageType struct{} + +func (x fastReflection_GasPriceRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_GasPriceRequest)(nil) +} +func (x fastReflection_GasPriceRequest_messageType) New() protoreflect.Message { + return new(fastReflection_GasPriceRequest) +} +func (x fastReflection_GasPriceRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GasPriceRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GasPriceRequest) Descriptor() protoreflect.MessageDescriptor { + return md_GasPriceRequest +} + +// 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_GasPriceRequest) Type() protoreflect.MessageType { + return _fastReflection_GasPriceRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GasPriceRequest) New() protoreflect.Message { + return new(fastReflection_GasPriceRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GasPriceRequest) Interface() protoreflect.ProtoMessage { + return (*GasPriceRequest)(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_GasPriceRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Denom != "" { + value := protoreflect.ValueOfString(x.Denom) + if !f(fd_GasPriceRequest_denom, 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_GasPriceRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceRequest.denom": + return x.Denom != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceRequest 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_GasPriceRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceRequest.denom": + x.Denom = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceRequest 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_GasPriceRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.GasPriceRequest.denom": + value := x.Denom + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceRequest 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_GasPriceRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceRequest.denom": + x.Denom = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceRequest 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_GasPriceRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceRequest.denom": + panic(fmt.Errorf("field denom of message cosmos.feemarket.v1.GasPriceRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceRequest 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_GasPriceRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceRequest.denom": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceRequest 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_GasPriceRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.GasPriceRequest", 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_GasPriceRequest) 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_GasPriceRequest) 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_GasPriceRequest) 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_GasPriceRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GasPriceRequest) + 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.Denom) + 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().(*GasPriceRequest) + 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.Denom) > 0 { + i -= len(x.Denom) + copy(dAtA[i:], x.Denom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom))) + 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().(*GasPriceRequest) + 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: GasPriceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GasPriceRequest: 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 Denom", 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.Denom = 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, + } +} + +var ( + md_GasPriceResponse protoreflect.MessageDescriptor + fd_GasPriceResponse_price protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_query_proto_init() + md_GasPriceResponse = File_cosmos_feemarket_v1_query_proto.Messages().ByName("GasPriceResponse") + fd_GasPriceResponse_price = md_GasPriceResponse.Fields().ByName("price") +} + +var _ protoreflect.Message = (*fastReflection_GasPriceResponse)(nil) + +type fastReflection_GasPriceResponse GasPriceResponse + +func (x *GasPriceResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_GasPriceResponse)(x) +} + +func (x *GasPriceResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[5] + 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_GasPriceResponse_messageType fastReflection_GasPriceResponse_messageType +var _ protoreflect.MessageType = fastReflection_GasPriceResponse_messageType{} + +type fastReflection_GasPriceResponse_messageType struct{} + +func (x fastReflection_GasPriceResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_GasPriceResponse)(nil) +} +func (x fastReflection_GasPriceResponse_messageType) New() protoreflect.Message { + return new(fastReflection_GasPriceResponse) +} +func (x fastReflection_GasPriceResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GasPriceResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GasPriceResponse) Descriptor() protoreflect.MessageDescriptor { + return md_GasPriceResponse +} + +// 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_GasPriceResponse) Type() protoreflect.MessageType { + return _fastReflection_GasPriceResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GasPriceResponse) New() protoreflect.Message { + return new(fastReflection_GasPriceResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GasPriceResponse) Interface() protoreflect.ProtoMessage { + return (*GasPriceResponse)(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_GasPriceResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Price != nil { + value := protoreflect.ValueOfMessage(x.Price.ProtoReflect()) + if !f(fd_GasPriceResponse_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_GasPriceResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceResponse.price": + return x.Price != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceResponse 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_GasPriceResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceResponse.price": + x.Price = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceResponse 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_GasPriceResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.GasPriceResponse.price": + value := x.Price + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceResponse 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_GasPriceResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceResponse.price": + x.Price = value.Message().Interface().(*v1beta1.DecCoin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceResponse 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_GasPriceResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceResponse.price": + if x.Price == nil { + x.Price = new(v1beta1.DecCoin) + } + return protoreflect.ValueOfMessage(x.Price.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceResponse 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_GasPriceResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPriceResponse.price": + m := new(v1beta1.DecCoin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPriceResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPriceResponse 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_GasPriceResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.GasPriceResponse", 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_GasPriceResponse) 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_GasPriceResponse) 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_GasPriceResponse) 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_GasPriceResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GasPriceResponse) + 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.Price != nil { + l = options.Size(x.Price) + 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().(*GasPriceResponse) + 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 x.Price != nil { + encoded, err := options.Marshal(x.Price) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + 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().(*GasPriceResponse) + 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: GasPriceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GasPriceResponse: 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 Price", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.Price == nil { + x.Price = &v1beta1.DecCoin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Price); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + 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, + } +} + +var ( + md_GasPricesRequest protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_feemarket_v1_query_proto_init() + md_GasPricesRequest = File_cosmos_feemarket_v1_query_proto.Messages().ByName("GasPricesRequest") +} + +var _ protoreflect.Message = (*fastReflection_GasPricesRequest)(nil) + +type fastReflection_GasPricesRequest GasPricesRequest + +func (x *GasPricesRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_GasPricesRequest)(x) +} + +func (x *GasPricesRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[6] + 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_GasPricesRequest_messageType fastReflection_GasPricesRequest_messageType +var _ protoreflect.MessageType = fastReflection_GasPricesRequest_messageType{} + +type fastReflection_GasPricesRequest_messageType struct{} + +func (x fastReflection_GasPricesRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_GasPricesRequest)(nil) +} +func (x fastReflection_GasPricesRequest_messageType) New() protoreflect.Message { + return new(fastReflection_GasPricesRequest) +} +func (x fastReflection_GasPricesRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GasPricesRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GasPricesRequest) Descriptor() protoreflect.MessageDescriptor { + return md_GasPricesRequest +} + +// 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_GasPricesRequest) Type() protoreflect.MessageType { + return _fastReflection_GasPricesRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GasPricesRequest) New() protoreflect.Message { + return new(fastReflection_GasPricesRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GasPricesRequest) Interface() protoreflect.ProtoMessage { + return (*GasPricesRequest)(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_GasPricesRequest) 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_GasPricesRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesRequest 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_GasPricesRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesRequest 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_GasPricesRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesRequest 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_GasPricesRequest) 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.feemarket.v1.GasPricesRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesRequest 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_GasPricesRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesRequest 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_GasPricesRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesRequest")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesRequest 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_GasPricesRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.GasPricesRequest", 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_GasPricesRequest) 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_GasPricesRequest) 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_GasPricesRequest) 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_GasPricesRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GasPricesRequest) + 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().(*GasPricesRequest) + 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().(*GasPricesRequest) + 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: GasPricesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GasPricesRequest: 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 _ protoreflect.List = (*_GasPricesResponse_1_list)(nil) + +type _GasPricesResponse_1_list struct { + list *[]*v1beta1.DecCoin +} + +func (x *_GasPricesResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GasPricesResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GasPricesResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.DecCoin) + (*x.list)[i] = concreteValue +} + +func (x *_GasPricesResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.DecCoin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GasPricesResponse_1_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.DecCoin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GasPricesResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GasPricesResponse_1_list) NewElement() protoreflect.Value { + v := new(v1beta1.DecCoin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GasPricesResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GasPricesResponse protoreflect.MessageDescriptor + fd_GasPricesResponse_prices protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_query_proto_init() + md_GasPricesResponse = File_cosmos_feemarket_v1_query_proto.Messages().ByName("GasPricesResponse") + fd_GasPricesResponse_prices = md_GasPricesResponse.Fields().ByName("prices") +} + +var _ protoreflect.Message = (*fastReflection_GasPricesResponse)(nil) + +type fastReflection_GasPricesResponse GasPricesResponse + +func (x *GasPricesResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_GasPricesResponse)(x) +} + +func (x *GasPricesResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[7] + 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_GasPricesResponse_messageType fastReflection_GasPricesResponse_messageType +var _ protoreflect.MessageType = fastReflection_GasPricesResponse_messageType{} + +type fastReflection_GasPricesResponse_messageType struct{} + +func (x fastReflection_GasPricesResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_GasPricesResponse)(nil) +} +func (x fastReflection_GasPricesResponse_messageType) New() protoreflect.Message { + return new(fastReflection_GasPricesResponse) +} +func (x fastReflection_GasPricesResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GasPricesResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GasPricesResponse) Descriptor() protoreflect.MessageDescriptor { + return md_GasPricesResponse +} + +// 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_GasPricesResponse) Type() protoreflect.MessageType { + return _fastReflection_GasPricesResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GasPricesResponse) New() protoreflect.Message { + return new(fastReflection_GasPricesResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GasPricesResponse) Interface() protoreflect.ProtoMessage { + return (*GasPricesResponse)(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_GasPricesResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Prices) != 0 { + value := protoreflect.ValueOfList(&_GasPricesResponse_1_list{list: &x.Prices}) + if !f(fd_GasPricesResponse_prices, 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_GasPricesResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPricesResponse.prices": + return len(x.Prices) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesResponse 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_GasPricesResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPricesResponse.prices": + x.Prices = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesResponse 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_GasPricesResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.GasPricesResponse.prices": + if len(x.Prices) == 0 { + return protoreflect.ValueOfList(&_GasPricesResponse_1_list{}) + } + listValue := &_GasPricesResponse_1_list{list: &x.Prices} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesResponse 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_GasPricesResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPricesResponse.prices": + lv := value.List() + clv := lv.(*_GasPricesResponse_1_list) + x.Prices = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesResponse 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_GasPricesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPricesResponse.prices": + if x.Prices == nil { + x.Prices = []*v1beta1.DecCoin{} + } + value := &_GasPricesResponse_1_list{list: &x.Prices} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesResponse 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_GasPricesResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.GasPricesResponse.prices": + list := []*v1beta1.DecCoin{} + return protoreflect.ValueOfList(&_GasPricesResponse_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.GasPricesResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.GasPricesResponse 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_GasPricesResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.GasPricesResponse", 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_GasPricesResponse) 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_GasPricesResponse) 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_GasPricesResponse) 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_GasPricesResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GasPricesResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Prices) > 0 { + for _, e := range x.Prices { + l = options.Size(e) + 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().(*GasPricesResponse) + 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.Prices) > 0 { + for iNdEx := len(x.Prices) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Prices[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + 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().(*GasPricesResponse) + 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: GasPricesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GasPricesResponse: 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 Prices", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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.Prices = append(x.Prices, &v1beta1.DecCoin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Prices[len(x.Prices)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + 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/feemarket/v1/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) +) + +// ParamsRequest is the request type for the Query/Params RPC method. +type ParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ParamsRequest) Reset() { + *x = ParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParamsRequest) ProtoMessage() {} + +// Deprecated: Use ParamsRequest.ProtoReflect.Descriptor instead. +func (*ParamsRequest) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_query_proto_rawDescGZIP(), []int{0} +} + +// ParamsResponse is the response type for the Query/Params RPC method. +type ParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *ParamsResponse) Reset() { + *x = ParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParamsResponse) ProtoMessage() {} + +// Deprecated: Use ParamsResponse.ProtoReflect.Descriptor instead. +func (*ParamsResponse) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_query_proto_rawDescGZIP(), []int{1} +} + +func (x *ParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// StateRequest is the request type for the Query/State RPC method. +type StateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StateRequest) Reset() { + *x = StateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StateRequest) ProtoMessage() {} + +// Deprecated: Use StateRequest.ProtoReflect.Descriptor instead. +func (*StateRequest) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_query_proto_rawDescGZIP(), []int{2} +} + +// StateResponse is the response type for the Query/State RPC method. +type StateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State *State `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` +} + +func (x *StateResponse) Reset() { + *x = StateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StateResponse) ProtoMessage() {} + +// Deprecated: Use StateResponse.ProtoReflect.Descriptor instead. +func (*StateResponse) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_query_proto_rawDescGZIP(), []int{3} +} + +func (x *StateResponse) GetState() *State { + if x != nil { + return x.State + } + return nil +} + +// GasPriceRequest is the request type for the Query/GasPrice RPC method. +type GasPriceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // denom we are querying gas price in + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (x *GasPriceRequest) Reset() { + *x = GasPriceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GasPriceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GasPriceRequest) ProtoMessage() {} + +// Deprecated: Use GasPriceRequest.ProtoReflect.Descriptor instead. +func (*GasPriceRequest) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_query_proto_rawDescGZIP(), []int{4} +} + +func (x *GasPriceRequest) GetDenom() string { + if x != nil { + return x.Denom + } + return "" +} + +// GasPriceResponse is the response type for the Query/GasPrice RPC method. +// Returns a gas price in specified denom. +type GasPriceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Price *v1beta1.DecCoin `protobuf:"bytes,1,opt,name=price,proto3" json:"price,omitempty"` +} + +func (x *GasPriceResponse) Reset() { + *x = GasPriceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GasPriceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GasPriceResponse) ProtoMessage() {} + +// Deprecated: Use GasPriceResponse.ProtoReflect.Descriptor instead. +func (*GasPriceResponse) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_query_proto_rawDescGZIP(), []int{5} +} + +func (x *GasPriceResponse) GetPrice() *v1beta1.DecCoin { + if x != nil { + return x.Price + } + return nil +} + +// GasPriceRequest is the request type for the Query/GasPrices RPC method. +type GasPricesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GasPricesRequest) Reset() { + *x = GasPricesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GasPricesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GasPricesRequest) ProtoMessage() {} + +// Deprecated: Use GasPricesRequest.ProtoReflect.Descriptor instead. +func (*GasPricesRequest) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_query_proto_rawDescGZIP(), []int{6} +} + +// GasPricesResponse is the response type for the Query/GasPrices RPC method. +// Returns a gas price in all available denoms. +type GasPricesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Prices []*v1beta1.DecCoin `protobuf:"bytes,1,rep,name=prices,proto3" json:"prices,omitempty"` +} + +func (x *GasPricesResponse) Reset() { + *x = GasPricesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_query_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GasPricesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GasPricesResponse) ProtoMessage() {} + +// Deprecated: Use GasPricesResponse.ProtoReflect.Descriptor instead. +func (*GasPricesResponse) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_query_proto_rawDescGZIP(), []int{7} +} + +func (x *GasPricesResponse) GetPrices() []*v1beta1.DecCoin { + if x != nil { + return x.Prices + } + return nil +} + +var File_cosmos_feemarket_v1_query_proto protoreflect.FileDescriptor + +var file_cosmos_feemarket_v1_query_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, + 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, + 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, + 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x4b, 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, + 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x22, 0x0e, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x47, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x04, 0xc8, 0xde, + 0x1f, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x27, 0x0a, 0x0f, 0x47, 0x61, 0x73, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, + 0x6f, 0x6d, 0x22, 0x51, 0x0a, 0x10, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x63, 0x43, + 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x05, + 0x70, 0x72, 0x69, 0x63, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x83, 0x01, 0x0a, 0x11, 0x47, 0x61, + 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x6e, 0x0a, 0x06, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x38, 0xc8, + 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, + 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, + 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x32, + 0xe6, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x6f, 0x0a, 0x06, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x6b, 0x0a, 0x05, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x15, 0x12, 0x13, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x76, + 0x31, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x08, 0x47, 0x61, 0x73, 0x50, + 0x72, 0x69, 0x63, 0x65, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, + 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x61, 0x73, 0x50, 0x72, + 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, 0x1f, 0x2f, 0x66, 0x65, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x61, 0x73, 0x5f, 0x70, 0x72, 0x69, + 0x63, 0x65, 0x2f, 0x7b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x12, 0x7c, 0x0a, 0x09, 0x47, 0x61, + 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x61, + 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, + 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x61, + 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x42, 0xc5, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x46, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x31, + 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x3a, 0x3a, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_feemarket_v1_query_proto_rawDescOnce sync.Once + file_cosmos_feemarket_v1_query_proto_rawDescData = file_cosmos_feemarket_v1_query_proto_rawDesc +) + +func file_cosmos_feemarket_v1_query_proto_rawDescGZIP() []byte { + file_cosmos_feemarket_v1_query_proto_rawDescOnce.Do(func() { + file_cosmos_feemarket_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_feemarket_v1_query_proto_rawDescData) + }) + return file_cosmos_feemarket_v1_query_proto_rawDescData +} + +var file_cosmos_feemarket_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_cosmos_feemarket_v1_query_proto_goTypes = []interface{}{ + (*ParamsRequest)(nil), // 0: cosmos.feemarket.v1.ParamsRequest + (*ParamsResponse)(nil), // 1: cosmos.feemarket.v1.ParamsResponse + (*StateRequest)(nil), // 2: cosmos.feemarket.v1.StateRequest + (*StateResponse)(nil), // 3: cosmos.feemarket.v1.StateResponse + (*GasPriceRequest)(nil), // 4: cosmos.feemarket.v1.GasPriceRequest + (*GasPriceResponse)(nil), // 5: cosmos.feemarket.v1.GasPriceResponse + (*GasPricesRequest)(nil), // 6: cosmos.feemarket.v1.GasPricesRequest + (*GasPricesResponse)(nil), // 7: cosmos.feemarket.v1.GasPricesResponse + (*Params)(nil), // 8: cosmos.feemarket.v1.Params + (*State)(nil), // 9: cosmos.feemarket.v1.State + (*v1beta1.DecCoin)(nil), // 10: cosmos.base.v1beta1.DecCoin +} +var file_cosmos_feemarket_v1_query_proto_depIdxs = []int32{ + 8, // 0: cosmos.feemarket.v1.ParamsResponse.params:type_name -> cosmos.feemarket.v1.Params + 9, // 1: cosmos.feemarket.v1.StateResponse.state:type_name -> cosmos.feemarket.v1.State + 10, // 2: cosmos.feemarket.v1.GasPriceResponse.price:type_name -> cosmos.base.v1beta1.DecCoin + 10, // 3: cosmos.feemarket.v1.GasPricesResponse.prices:type_name -> cosmos.base.v1beta1.DecCoin + 0, // 4: cosmos.feemarket.v1.Query.Params:input_type -> cosmos.feemarket.v1.ParamsRequest + 2, // 5: cosmos.feemarket.v1.Query.State:input_type -> cosmos.feemarket.v1.StateRequest + 4, // 6: cosmos.feemarket.v1.Query.GasPrice:input_type -> cosmos.feemarket.v1.GasPriceRequest + 6, // 7: cosmos.feemarket.v1.Query.GasPrices:input_type -> cosmos.feemarket.v1.GasPricesRequest + 1, // 8: cosmos.feemarket.v1.Query.Params:output_type -> cosmos.feemarket.v1.ParamsResponse + 3, // 9: cosmos.feemarket.v1.Query.State:output_type -> cosmos.feemarket.v1.StateResponse + 5, // 10: cosmos.feemarket.v1.Query.GasPrice:output_type -> cosmos.feemarket.v1.GasPriceResponse + 7, // 11: cosmos.feemarket.v1.Query.GasPrices:output_type -> cosmos.feemarket.v1.GasPricesResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_cosmos_feemarket_v1_query_proto_init() } +func file_cosmos_feemarket_v1_query_proto_init() { + if File_cosmos_feemarket_v1_query_proto != nil { + return + } + file_cosmos_feemarket_v1_params_proto_init() + file_cosmos_feemarket_v1_genesis_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_feemarket_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GasPriceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GasPriceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GasPricesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GasPricesResponse); 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_feemarket_v1_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cosmos_feemarket_v1_query_proto_goTypes, + DependencyIndexes: file_cosmos_feemarket_v1_query_proto_depIdxs, + MessageInfos: file_cosmos_feemarket_v1_query_proto_msgTypes, + }.Build() + File_cosmos_feemarket_v1_query_proto = out.File + file_cosmos_feemarket_v1_query_proto_rawDesc = nil + file_cosmos_feemarket_v1_query_proto_goTypes = nil + file_cosmos_feemarket_v1_query_proto_depIdxs = nil +} diff --git a/api/cosmos/feemarket/v1/query_grpc.pb.go b/api/cosmos/feemarket/v1/query_grpc.pb.go new file mode 100644 index 000000000000..8b1e9d06f429 --- /dev/null +++ b/api/cosmos/feemarket/v1/query_grpc.pb.go @@ -0,0 +1,251 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: cosmos/feemarket/v1/query.proto + +package feemarketv1 + +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 ( + Query_Params_FullMethodName = "/cosmos.feemarket.v1.Query/Params" + Query_State_FullMethodName = "/cosmos.feemarket.v1.Query/State" + Query_GasPrice_FullMethodName = "/cosmos.feemarket.v1.Query/GasPrice" + Query_GasPrices_FullMethodName = "/cosmos.feemarket.v1.Query/GasPrices" +) + +// QueryClient is the client API for Query 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. +// +// Query Service for the feemarket module. +type QueryClient interface { + // Params returns the current feemarket module parameters. + Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) + // State returns the current feemarket module state. + State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) + // GasPrice returns the current feemarket module gas price + // for specified denom. + GasPrice(ctx context.Context, in *GasPriceRequest, opts ...grpc.CallOption) (*GasPriceResponse, error) + // GasPrices returns the current feemarket module list of gas prices + // in all available denoms. + GasPrices(ctx context.Context, in *GasPricesRequest, opts ...grpc.CallOption) (*GasPricesResponse, error) +} + +type queryClient struct { + cc grpc.ClientConnInterface +} + +func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ParamsResponse) + err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StateResponse) + err := c.cc.Invoke(ctx, Query_State_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GasPrice(ctx context.Context, in *GasPriceRequest, opts ...grpc.CallOption) (*GasPriceResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GasPriceResponse) + err := c.cc.Invoke(ctx, Query_GasPrice_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GasPrices(ctx context.Context, in *GasPricesRequest, opts ...grpc.CallOption) (*GasPricesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GasPricesResponse) + err := c.cc.Invoke(ctx, Query_GasPrices_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +// All implementations must embed UnimplementedQueryServer +// for forward compatibility. +// +// Query Service for the feemarket module. +type QueryServer interface { + // Params returns the current feemarket module parameters. + Params(context.Context, *ParamsRequest) (*ParamsResponse, error) + // State returns the current feemarket module state. + State(context.Context, *StateRequest) (*StateResponse, error) + // GasPrice returns the current feemarket module gas price + // for specified denom. + GasPrice(context.Context, *GasPriceRequest) (*GasPriceResponse, error) + // GasPrices returns the current feemarket module list of gas prices + // in all available denoms. + GasPrices(context.Context, *GasPricesRequest) (*GasPricesResponse, error) + mustEmbedUnimplementedQueryServer() +} + +// UnimplementedQueryServer 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 UnimplementedQueryServer struct{} + +func (UnimplementedQueryServer) Params(context.Context, *ParamsRequest) (*ParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (UnimplementedQueryServer) State(context.Context, *StateRequest) (*StateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method State not implemented") +} +func (UnimplementedQueryServer) GasPrice(context.Context, *GasPriceRequest) (*GasPriceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GasPrice not implemented") +} +func (UnimplementedQueryServer) GasPrices(context.Context, *GasPricesRequest) (*GasPricesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GasPrices not implemented") +} +func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} +func (UnimplementedQueryServer) testEmbeddedByValue() {} + +// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to QueryServer will +// result in compilation errors. +type UnsafeQueryServer interface { + mustEmbedUnimplementedQueryServer() +} + +func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { + // If the following call pancis, it indicates UnimplementedQueryServer 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(&Query_ServiceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_Params_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_State_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).State(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_State_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).State(ctx, req.(*StateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GasPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GasPriceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GasPrice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_GasPrice_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GasPrice(ctx, req.(*GasPriceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GasPrices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GasPricesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GasPrices(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_GasPrices_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GasPrices(ctx, req.(*GasPricesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Query_ServiceDesc is the grpc.ServiceDesc for Query service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Query_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.feemarket.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "State", + Handler: _Query_State_Handler, + }, + { + MethodName: "GasPrice", + Handler: _Query_GasPrice_Handler, + }, + { + MethodName: "GasPrices", + Handler: _Query_GasPrices_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/feemarket/v1/query.proto", +} diff --git a/api/cosmos/feemarket/v1/tx.pulsar.go b/api/cosmos/feemarket/v1/tx.pulsar.go new file mode 100644 index 000000000000..39cf879f173f --- /dev/null +++ b/api/cosmos/feemarket/v1/tx.pulsar.go @@ -0,0 +1,1085 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package feemarketv1 + +import ( + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + 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_MsgParams protoreflect.MessageDescriptor + fd_MsgParams_params protoreflect.FieldDescriptor + fd_MsgParams_authority protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feemarket_v1_tx_proto_init() + md_MsgParams = File_cosmos_feemarket_v1_tx_proto.Messages().ByName("MsgParams") + fd_MsgParams_params = md_MsgParams.Fields().ByName("params") + fd_MsgParams_authority = md_MsgParams.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_MsgParams)(nil) + +type fastReflection_MsgParams MsgParams + +func (x *MsgParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgParams)(x) +} + +func (x *MsgParams) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_tx_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_MsgParams_messageType fastReflection_MsgParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgParams_messageType{} + +type fastReflection_MsgParams_messageType struct{} + +func (x fastReflection_MsgParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgParams)(nil) +} +func (x fastReflection_MsgParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgParams) +} +func (x fastReflection_MsgParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgParams +} + +// 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_MsgParams) Type() protoreflect.MessageType { + return _fastReflection_MsgParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgParams) New() protoreflect.Message { + return new(fastReflection_MsgParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgParams) Interface() protoreflect.ProtoMessage { + return (*MsgParams)(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_MsgParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgParams_params, value) { + return + } + } + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgParams_authority, 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_MsgParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feemarket.v1.MsgParams.params": + return x.Params != nil + case "cosmos.feemarket.v1.MsgParams.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParams")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParams 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_MsgParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feemarket.v1.MsgParams.params": + x.Params = nil + case "cosmos.feemarket.v1.MsgParams.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParams")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParams 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_MsgParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feemarket.v1.MsgParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.feemarket.v1.MsgParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParams")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParams 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_MsgParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feemarket.v1.MsgParams.params": + x.Params = value.Message().Interface().(*Params) + case "cosmos.feemarket.v1.MsgParams.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParams")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParams 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_MsgParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.MsgParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "cosmos.feemarket.v1.MsgParams.authority": + panic(fmt.Errorf("field authority of message cosmos.feemarket.v1.MsgParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParams")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParams 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_MsgParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feemarket.v1.MsgParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.feemarket.v1.MsgParams.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParams")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParams 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_MsgParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.MsgParams", 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_MsgParams) 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_MsgParams) 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_MsgParams) 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_MsgParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgParams) + 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.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Authority) + 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().(*MsgParams) + 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.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0x12 + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + 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().(*MsgParams) + 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: MsgParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParams: 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 Params", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = 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, + } +} + +var ( + md_MsgParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_feemarket_v1_tx_proto_init() + md_MsgParamsResponse = File_cosmos_feemarket_v1_tx_proto.Messages().ByName("MsgParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgParamsResponse)(nil) + +type fastReflection_MsgParamsResponse MsgParamsResponse + +func (x *MsgParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgParamsResponse)(x) +} + +func (x *MsgParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feemarket_v1_tx_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_MsgParamsResponse_messageType fastReflection_MsgParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgParamsResponse_messageType{} + +type fastReflection_MsgParamsResponse_messageType struct{} + +func (x fastReflection_MsgParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgParamsResponse)(nil) +} +func (x fastReflection_MsgParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgParamsResponse) +} +func (x fastReflection_MsgParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgParamsResponse +} + +// 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_MsgParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgParamsResponse)(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_MsgParamsResponse) 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_MsgParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParamsResponse 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_MsgParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParamsResponse 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_MsgParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParamsResponse 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_MsgParamsResponse) 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.feemarket.v1.MsgParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParamsResponse 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_MsgParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParamsResponse 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_MsgParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feemarket.v1.MsgParamsResponse")) + } + panic(fmt.Errorf("message cosmos.feemarket.v1.MsgParamsResponse 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_MsgParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feemarket.v1.MsgParamsResponse", 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_MsgParamsResponse) 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_MsgParamsResponse) 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_MsgParamsResponse) 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_MsgParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgParamsResponse) + 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().(*MsgParamsResponse) + 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().(*MsgParamsResponse) + 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: MsgParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParamsResponse: 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, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: cosmos/feemarket/v1/tx.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) +) + +// MsgParams defines the Msg/Params request type. It contains the +// new parameters for the feemarket module. +type MsgParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Params defines the new parameters for the feemarket module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + // Authority defines the authority that is updating the feemarket module + // parameters. + Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *MsgParams) Reset() { + *x = MsgParams{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgParams) ProtoMessage() {} + +// Deprecated: Use MsgParams.ProtoReflect.Descriptor instead. +func (*MsgParams) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *MsgParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +// MsgParamsResponse defines the Msg/Params response type. +type MsgParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgParamsResponse) Reset() { + *x = MsgParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feemarket_v1_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgParamsResponse) Descriptor() ([]byte, []int) { + return file_cosmos_feemarket_v1_tx_proto_rawDescGZIP(), []int{1} +} + +var File_cosmos_feemarket_v1_tx_proto protoreflect.FileDescriptor + +var file_cosmos_feemarket_v1_tx_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x8e, 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x39, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x5e, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x50, 0x0a, 0x06, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, + 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x76, + 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, + 0x76, 0x31, 0x3b, 0x66, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, + 0x03, 0x43, 0x46, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x46, 0x65, + 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x46, 0x65, 0x65, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_cosmos_feemarket_v1_tx_proto_rawDescOnce sync.Once + file_cosmos_feemarket_v1_tx_proto_rawDescData = file_cosmos_feemarket_v1_tx_proto_rawDesc +) + +func file_cosmos_feemarket_v1_tx_proto_rawDescGZIP() []byte { + file_cosmos_feemarket_v1_tx_proto_rawDescOnce.Do(func() { + file_cosmos_feemarket_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_feemarket_v1_tx_proto_rawDescData) + }) + return file_cosmos_feemarket_v1_tx_proto_rawDescData +} + +var file_cosmos_feemarket_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cosmos_feemarket_v1_tx_proto_goTypes = []interface{}{ + (*MsgParams)(nil), // 0: cosmos.feemarket.v1.MsgParams + (*MsgParamsResponse)(nil), // 1: cosmos.feemarket.v1.MsgParamsResponse + (*Params)(nil), // 2: cosmos.feemarket.v1.Params +} +var file_cosmos_feemarket_v1_tx_proto_depIdxs = []int32{ + 2, // 0: cosmos.feemarket.v1.MsgParams.params:type_name -> cosmos.feemarket.v1.Params + 0, // 1: cosmos.feemarket.v1.Msg.Params:input_type -> cosmos.feemarket.v1.MsgParams + 1, // 2: cosmos.feemarket.v1.Msg.Params:output_type -> cosmos.feemarket.v1.MsgParamsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_cosmos_feemarket_v1_tx_proto_init() } +func file_cosmos_feemarket_v1_tx_proto_init() { + if File_cosmos_feemarket_v1_tx_proto != nil { + return + } + file_cosmos_feemarket_v1_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_feemarket_v1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feemarket_v1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgParamsResponse); 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_feemarket_v1_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cosmos_feemarket_v1_tx_proto_goTypes, + DependencyIndexes: file_cosmos_feemarket_v1_tx_proto_depIdxs, + MessageInfos: file_cosmos_feemarket_v1_tx_proto_msgTypes, + }.Build() + File_cosmos_feemarket_v1_tx_proto = out.File + file_cosmos_feemarket_v1_tx_proto_rawDesc = nil + file_cosmos_feemarket_v1_tx_proto_goTypes = nil + file_cosmos_feemarket_v1_tx_proto_depIdxs = nil +} diff --git a/api/cosmos/feemarket/v1/tx_grpc.pb.go b/api/cosmos/feemarket/v1/tx_grpc.pb.go new file mode 100644 index 000000000000..ecbfa7ec49de --- /dev/null +++ b/api/cosmos/feemarket/v1/tx_grpc.pb.go @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: cosmos/feemarket/v1/tx.proto + +package feemarketv1 + +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 ( + Msg_Params_FullMethodName = "/cosmos.feemarket.v1.Msg/Params" +) + +// MsgClient is the client API for Msg 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. +// +// Message service defines the types of messages supported by the feemarket +// module. +type MsgClient interface { + // Params defines a method for updating the feemarket module parameters. + Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) +} + +type msgClient struct { + cc grpc.ClientConnInterface +} + +func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgParamsResponse) + err := c.cc.Invoke(ctx, Msg_Params_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +// All implementations must embed UnimplementedMsgServer +// for forward compatibility. +// +// Message service defines the types of messages supported by the feemarket +// module. +type MsgServer interface { + // Params defines a method for updating the feemarket module parameters. + Params(context.Context, *MsgParams) (*MsgParamsResponse, error) + mustEmbedUnimplementedMsgServer() +} + +// UnimplementedMsgServer 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 UnimplementedMsgServer struct{} + +func (UnimplementedMsgServer) Params(context.Context, *MsgParams) (*MsgParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} +func (UnimplementedMsgServer) testEmbeddedByValue() {} + +// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MsgServer will +// result in compilation errors. +type UnsafeMsgServer interface { + mustEmbedUnimplementedMsgServer() +} + +func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + // If the following call pancis, it indicates UnimplementedMsgServer 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(&Msg_ServiceDesc, srv) +} + +func _Msg_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Params_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Params(ctx, req.(*MsgParams)) + } + return interceptor(ctx, in, info, handler) +} + +// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Msg_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.feemarket.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Msg_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/feemarket/v1/tx.proto", +} diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh index 57ef89cef1c5..fc98fdef2d06 100755 --- a/scripts/mockgen.sh +++ b/scripts/mockgen.sh @@ -28,3 +28,4 @@ $mockgen_cmd -source=x/staking/types/expected_keepers.go -package testutil -dest $mockgen_cmd -source=x/protocolpool/types/expected_keepers.go -package testutil -destination x/protocolpool/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/upgrade/types/expected_keepers.go -package testutil -destination x/upgrade/testutil/expected_keepers_mocks.go $mockgen_cmd -source=core/gas/service.go -package gas -destination core/testing/gas/service_mocks.go +$mockgen_cmd -source=x/feemarket/ante/expected_keepers.go -package gas -destination x/feemarket/ante/mocks/expected_keepers_mocks.go diff --git a/x/feemarket/README.md b/x/feemarket/README.md new file mode 100644 index 000000000000..4635cb6b4f66 --- /dev/null +++ b/x/feemarket/README.md @@ -0,0 +1,123 @@ +# Additive Increase Multiplicative Decrease (AIMD) EIP-1559 + +## Overview + +> **Definitions:** +> +> * **`Target Block Size`**: This is the target block gas consumption. +> * **`Max Block Size`**: This is the maximum block gas consumption. + +This plugin implements the AIMD (Additive Increase Multiplicative Decrease) EIP-1559 fee market as described in this [AIMD EIP-1559](https://arxiv.org/abs/2110.04753) research publication. + +The AIMD EIP-1559 fee market is a slight modification to Ethereum's EIP-1559 fee market. Specifically it introduces the notion of a adaptive learning rate which scales the base fee (reserve price to be included in a block) more aggressively when the network is congested and less aggressively when the network is not congested. This is primarily done to address the often cited criticism of EIP-1559 that it's base fee often lags behind the current demand for block space. The learning rate on Ethereum is effectively hard-coded to be 12.5%, which means that between any two blocks the base fee can maximally increase by 12.5% or decrease by 12.5%. Additionally, AIMD EIP-1559 differs from Ethereum's EIP-1559 by considering a configured time window (number of blocks) to consider when calculating and comparing target block utilization and current block utilization. + +## Parameters + +### Ethereum EIP-1559 + +Base EIP-1559 currently utilizes the following parameters to compute the base fee: + +* **`PreviousBaseFee`**: This is the base fee from the previous block. This must be a value that is greater than `0`. +* **`TargetBlockSize`**: This is the target block size in bytes. This must be a value that is greater than `0`. +* **`PreviousBlockSize`**: This is the block size from the previous block. + +The calculation for the updated base fee for the next block is as follows: + +```golang +currentBaseFee := previousBaseFee * (1 + 0.125 * (currentBlockSize - targetBlockSize) / targetBlockSize) +``` + +### AIMD EIP-1559 + +AIMD EIP-1559 introduces a few new parameters to the EIP-1559 fee market: + +* **`Alpha`**: This is the amount we additively increase the learning rate when the target utilization is less than the current utilization i.e. the block was more full than the target size. This must be a value that is greater than `0.0`. +* **`Beta`**: This is the amount we multiplicatively decrease the learning rate when the target utilization is greater than the current utilization i.e. the block was less full than the target size. This must be a value that is greater than `0.0`. +* **`Window`**: This is the number of blocks we look back to compute the current utilization. This must be a value that is greater than `0`. Instead of only utilizing the previous block's utilization, we now consider the utilization of the previous `Window` blocks. +* **`Gamma`**: This determines whether you are additively increase or multiplicatively decreasing the learning rate based on the target and current block utilization. This must be a value that is between `[0, 1]`. For example, if `Gamma = 0.25`, then we multiplicatively decrease the learning rate if the average ratio of current block size to max block size over some window of blocks is within `(0.25, 0.75)` and additively increase it if outside that range. +* **`MaxLearningRate`**: This is the maximum learning rate that can be applied to the base fee. This must be a value that is between `[0, 1]`. +* **`MinLearningRate`**: This is the minimum learning rate that can be applied to the base fee. This must be a value that is between `[0, 1]`. +* **`Delta`**: This is a trailing constant that is used to smooth the learning rate. In order to further converge the long term net gas usage and net gas goal, we introduce another integral term which tracks how much gas off from 0 gas we’re at. We add a constant c which basically forces the fee to slowly trend in some direction until this has gone to 0. + +The calculation for the updated base fee for the next block is as follows: + +```golang + +// sumBlockSizesInWindow returns the sum of the block sizes in the window. +blockConsumption := sumBlockSizesInWindow(window) / (window * maxBlockSize) + +if blockConsumption < gamma || blockConsumption > 1 - gamma { + // MAX_LEARNING_RATE is a constant that is configured by the chain developer + newLearningRate := min(MaxLearningRate, alpha + currentLearningRate) +} else { + // MIN_LEARNING_RATE is a constant that is configured by the chain developer + newLearningRate := max(MinLearningRate, beta * currentLearningRate) +} + +// netGasDelta returns the net gas difference between every block in the window and the target block size. +newBaseFee := currentBaseFee * (1 + newLearningRate * (currentBlockSize - targetBlockSize) / targetBlockSize) + delta * netGasDelta(window) +``` + +## Examples + +> **Assume the following parameters:** +> +> * `TargetBlockSize = 50` +> * `MaxBlockSize = 100` +> * `Window = 1` +> * `Alpha = 0.025` +> * `Beta = 0.95` +> * `Gamma = 0.25` +> * `MAX_LEARNING_RATE = 1.0` +> * `MIN_LEARNING_RATE = 0.0125` +> * `Current Learning Rate = 0.125` +> * `Previous Base Fee = 10.0` +> * `Delta = 0` + +### Block is Completely Empty + +In this example, we expect the learning rate to additively increase and the base fee to decrease. + +```golang +blockConsumption := sumBlockSizesInWindow(1) / (1 * 100) == 0 +newLearningRate := min(1.0, 0.025 + 0.125) == 0.15 +newBaseFee := 10 * (1 + 0.15 * (0 - 50) / 50) == 8.5 +``` + +As we can see, the base fee decreased by 1.5 and the learning rate increases. + +### Block is Completely Full + +In this example, we expect the learning rate to multiplicatively increase and the base fee to increase. + +```golang +blockConsumption := sumBlockSizesInWindow(1) / (1 * 100) == 1 +newLearningRate := min(1.0, 0.025 + 0.125) == 0.15 +newBaseFee := 10 * (1 + 0.95 * 0.125) == 11.875 +``` + +As we can see, the base fee increased by 1.875 and the learning rate increases. + +### Block is at Target Utilization + +In this example, we expect the learning rate to decrease and the base fee to remain the same. + +```golang +blockConsumption := sumBlockSizesInWindow(1) / (1 * 100) == 0.5 +newLearningRate := max(0.0125, 0.95 * 0.125) == 0.11875 +newBaseFee := 10 * (1 + 0.11875 * (0 - 50) / 50) == 10 +``` + +As we can see, the base fee remained the same and the learning rate decreased. + +## Default EIP-1559 With AIMD EIP-1559 + +It is entirely possible to implement the default EIP-1559 fee market with the AIMD EIP-1559 fee market. This can be done by setting the following parameters: + +* `Alpha = 0.0` +* `Beta = 1.0` +* `Gamma = 1.0` +* `MAX_LEARNING_RATE = 0.125` +* `MIN_LEARNING_RATE = 0.125` +* `Delta = 0` +* `Window = 1` diff --git a/x/feemarket/ante/expected_keepers.go b/x/feemarket/ante/expected_keepers.go new file mode 100644 index 000000000000..848930569fd0 --- /dev/null +++ b/x/feemarket/ante/expected_keepers.go @@ -0,0 +1,43 @@ +package ante + +import ( + "context" + + "cosmossdk.io/core/address" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + feemarkettypes "cosmossdk.io/x/feemarket/types" +) + +// AccountKeeper defines the contract needed for AccountKeeper related APIs. +// Interface provides support to use non-sdk AccountKeeper for AnteHandler's decorators. +type AccountKeeper interface { + GetParams(ctx context.Context) (params authtypes.Params) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) + GetModuleAddress(moduleName string) sdk.AccAddress + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI + NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + AddressCodec() address.Codec +} + +// FeeGrantKeeper defines the expected feegrant keeper. +type FeeGrantKeeper interface { + UseGrantedFees(ctx context.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error +} + +// BankKeeper defines the contract needed for supply related APIs. +type BankKeeper interface { + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error +} + +// FeeMarketKeeper defines the expected feemarket keeper. +type FeeMarketKeeper interface { + GetState(ctx sdk.Context) (feemarkettypes.State, error) + GetMinGasPrice(ctx sdk.Context, denom string) (sdk.DecCoin, error) + GetParams(ctx sdk.Context) (feemarkettypes.Params, error) + SetState(ctx sdk.Context, state feemarkettypes.State) error + SetParams(ctx sdk.Context, params feemarkettypes.Params) error + ResolveToDenom(ctx sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) +} diff --git a/x/feemarket/ante/fee.go b/x/feemarket/ante/fee.go new file mode 100644 index 000000000000..e87bb3223481 --- /dev/null +++ b/x/feemarket/ante/fee.go @@ -0,0 +1,308 @@ +package ante + +import ( + "bytes" + "math" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + feemarkettypes "cosmossdk.io/x/feemarket/types" +) + +type feeMarketCheckDecorator struct { + feemarketKeeper FeeMarketKeeper + bankKeeper BankKeeper + feegrantKeeper FeeGrantKeeper + accountKeeper AccountKeeper +} + +func newFeeMarketCheckDecorator(ak AccountKeeper, bk BankKeeper, fk FeeGrantKeeper, fmk FeeMarketKeeper) feeMarketCheckDecorator { + return feeMarketCheckDecorator{ + feemarketKeeper: fmk, + bankKeeper: bk, + feegrantKeeper: fk, + accountKeeper: ak, + } +} + +// FeeMarketCheckDecorator checks sufficient fees from the fee payer based off of the current +// state of the feemarket. +// If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error. +// Call next AnteHandler if fees successfully checked. +// +// If x/feemarket is disabled (params.Enabled == false), the handler will fall back to the default +// Cosmos SDK fee deduction antehandler. +// +// CONTRACT: Tx must implement FeeTx interface +type FeeMarketCheckDecorator struct { + feemarketKeeper FeeMarketKeeper + + feemarketDecorator feeMarketCheckDecorator + fallbackDecorator sdk.AnteDecorator +} + +func NewFeeMarketCheckDecorator(ak AccountKeeper, bk BankKeeper, fk FeeGrantKeeper, fmk FeeMarketKeeper, fallbackDecorator sdk.AnteDecorator) FeeMarketCheckDecorator { + return FeeMarketCheckDecorator{ + feemarketKeeper: fmk, + feemarketDecorator: newFeeMarketCheckDecorator( + ak, bk, fk, fmk, + ), + fallbackDecorator: fallbackDecorator, + } +} + +// AnteHandle calls the feemarket internal antehandler if the keeper is enabled. If disabled, the fallback +// fee antehandler is fallen back to. +func (d FeeMarketCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + params, err := d.feemarketKeeper.GetParams(ctx) + if err != nil { + return ctx, err + } + if params.Enabled { + return d.feemarketDecorator.anteHandle(ctx, tx, simulate, next) + } + + // only use fallback if not nil + if d.fallbackDecorator != nil { + return d.fallbackDecorator.AnteHandle(ctx, tx, simulate, next) + } + + return next(ctx, tx, simulate) +} + +// anteHandle checks if the tx provides sufficient fee to cover the required fee from the fee market. +func (dfd feeMarketCheckDecorator) anteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + // GenTx consume no fee + if ctx.BlockHeight() == 0 { + return next(ctx, tx, simulate) + } + + feeTx, ok := tx.(sdk.FeeTx) + if !ok { + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + } + + if !simulate && ctx.BlockHeight() > 0 && feeTx.GetGas() == 0 { + return ctx, sdkerrors.ErrInvalidGasLimit.Wrapf("must provide positive gas") + } + + params, err := dfd.feemarketKeeper.GetParams(ctx) + if err != nil { + return ctx, errorsmod.Wrapf(err, "unable to get fee market params") + } + + // return if disabled + if !params.Enabled { + return next(ctx, tx, simulate) + } + + feeCoins := feeTx.GetFee() + gas := feeTx.GetGas() // use provided gas limit + + if len(feeCoins) == 0 && !simulate { + return ctx, errorsmod.Wrapf(feemarkettypes.ErrNoFeeCoins, "got length %d", len(feeCoins)) + } + if len(feeCoins) > 1 { + return ctx, errorsmod.Wrapf(feemarkettypes.ErrTooManyFeeCoins, "got length %d", len(feeCoins)) + } + + // if simulating - create a dummy zero value for the user + payCoin := sdk.NewCoin(params.FeeDenom, sdkmath.ZeroInt()) + if !simulate { + payCoin = feeCoins[0] + } + + feeGas := int64(feeTx.GetGas()) + + minGasPrice, err := dfd.feemarketKeeper.GetMinGasPrice(ctx, payCoin.GetDenom()) + if err != nil { + return ctx, errorsmod.Wrapf(err, "unable to get min gas price for denom %s", payCoin.GetDenom()) + } + + ctx.Logger().Info("fee deduct ante handle", + "min gas prices", minGasPrice, + "fee", feeCoins, + "gas limit", gas, + ) + + ctx = ctx.WithMinGasPrices(sdk.NewDecCoins(minGasPrice)) + + if !simulate { + _, _, err := CheckTxFee(ctx, minGasPrice, payCoin, feeGas, true) + if err != nil { + return ctx, errorsmod.Wrapf(err, "error checking fee") + } + } + + // escrow the entire amount that the account provided as fee (feeCoin) + err = dfd.EscrowFunds(ctx, tx, payCoin) + if err != nil { + return ctx, errorsmod.Wrapf(err, "error escrowing funds") + } + + priorityFee, err := dfd.resolveTxPriorityCoins(ctx, payCoin, params.FeeDenom) + if err != nil { + return ctx, errorsmod.Wrapf(err, "error resolving fee priority") + } + + baseGasPrice, err := dfd.feemarketKeeper.GetMinGasPrice(ctx, params.FeeDenom) + if err != nil { + return ctx, err + } + + ctx = ctx.WithPriority(GetTxPriority(priorityFee, int64(gas), baseGasPrice)) + + return next(ctx, tx, simulate) +} + +// resolveTxPriorityCoins converts the coins to the proper denom used for tx prioritization calculation. +func (dfd feeMarketCheckDecorator) resolveTxPriorityCoins(ctx sdk.Context, fee sdk.Coin, baseDenom string) (sdk.Coin, error) { + if fee.Denom == baseDenom { + return fee, nil + } + + feeDec := sdk.NewDecCoinFromCoin(fee) + convertedDec, err := dfd.feemarketKeeper.ResolveToDenom(ctx, feeDec, baseDenom) + if err != nil { + return sdk.Coin{}, err + } + + // truncate down + return sdk.NewCoin(baseDenom, convertedDec.Amount.TruncateInt()), nil +} + +// EscrowFunds escrows the fully provided fee from the payer account during tx execution. +// The actual fee is deducted in the post handler along with the tip. +func (dfd feeMarketCheckDecorator) EscrowFunds(ctx sdk.Context, sdkTx sdk.Tx, providedFee sdk.Coin) error { + feeTx, ok := sdkTx.(sdk.FeeTx) + if !ok { + return errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + } + + feePayer := feeTx.FeePayer() + feeGranter := feeTx.FeeGranter() + deductFeesFrom := feePayer + + // if feegranter set deduct fee from feegranter account. + // this works with only when feegrant enabled. + if feeGranter != nil { + if dfd.feegrantKeeper == nil { + return sdkerrors.ErrInvalidRequest.Wrap("fee grants are not enabled") + } else if !bytes.Equal(feeGranter, feePayer) { + if !providedFee.IsNil() { + err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, sdk.NewCoins(providedFee), + sdkTx.GetMsgs()) + if err != nil { + return errorsmod.Wrapf(err, "%s does not allow to pay fees for %s", feeGranter, feePayer) + } + } + } + + deductFeesFrom = feeGranter + } + + deductFeesFromAcc := dfd.accountKeeper.GetAccount(ctx, deductFeesFrom) + if deductFeesFromAcc == nil { + return sdkerrors.ErrUnknownAddress.Wrapf("fee payer address: %s does not exist", deductFeesFrom) + } + + return escrow(dfd.bankKeeper, ctx, deductFeesFromAcc, sdk.NewCoins(providedFee)) +} + +// escrow deducts coins to the escrow. +func escrow(bankKeeper BankKeeper, ctx sdk.Context, acc sdk.AccountI, coins sdk.Coins) error { + targetModuleAcc := feemarkettypes.FeeCollectorName + err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), targetModuleAcc, coins) + if err != nil { + return err + } + + return nil +} + +// CheckTxFee implements the logic for the fee market to check if a Tx has provided sufficient +// fees given the current state of the fee market. Returns an error if insufficient fees. +func CheckTxFee(ctx sdk.Context, gasPrice sdk.DecCoin, feeCoin sdk.Coin, feeGas int64, isAnte bool) (payCoin sdk.Coin, tip sdk.Coin, err error) { + payCoin = feeCoin + + // Ensure that the provided fees meet the minimum + if !gasPrice.IsZero() { + var ( + requiredFee sdk.Coin + consumedFee sdk.Coin + ) + + // Determine the required fees by multiplying each required minimum gas + // price by the gas, where fee = ceil(minGasPrice * gas). + gasConsumed := int64(ctx.GasMeter().GasConsumed()) + gcDec := sdkmath.LegacyNewDec(gasConsumed) + glDec := sdkmath.LegacyNewDec(feeGas) + + consumedFeeAmount := gasPrice.Amount.Mul(gcDec) + limitFee := gasPrice.Amount.Mul(glDec) + + consumedFee = sdk.NewCoin(gasPrice.Denom, consumedFeeAmount.Ceil().RoundInt()) + requiredFee = sdk.NewCoin(gasPrice.Denom, limitFee.Ceil().RoundInt()) + + if !payCoin.IsGTE(requiredFee) { + return sdk.Coin{}, sdk.Coin{}, sdkerrors.ErrInsufficientFee.Wrapf( + "got: %s required: %s, minGasPrice: %s, gas: %d", + payCoin, + requiredFee, + gasPrice, + gasConsumed, + ) + } + + if isAnte { + tip = payCoin.Sub(requiredFee) + payCoin = requiredFee + } else { + tip = payCoin.Sub(consumedFee) + payCoin = consumedFee + } + } + + return payCoin, tip, nil +} + +const ( + // gasPricePrecision is the amount of digit precision to scale the gas prices to. + gasPricePrecision = 6 +) + +// GetTxPriority returns a naive tx priority based on the amount of gas price provided in a transaction. +// +// The fee amount is divided by the gasLimit to calculate "Effective Gas Price". +// This value is then normalized and scaled into an integer, so it can be used as a priority. +// +// effectiveGasPrice = feeAmount / gas limit (denominated in fee per gas) +// normalizedGasPrice = effectiveGasPrice / currentGasPrice (floor is 1. The minimum effective gas price can ever be is current gas price) +// scaledGasPrice = normalizedGasPrice * 10 ^ gasPricePrecision (amount of decimal places in the normalized gas price to consider when converting to int64). +func GetTxPriority(fee sdk.Coin, gasLimit int64, currentGasPrice sdk.DecCoin) int64 { + // protections from dividing by 0 + if gasLimit == 0 { + return 0 + } + + // if the gas price is 0, just use a raw amount + if currentGasPrice.IsZero() { + return fee.Amount.Int64() + } + + effectiveGasPrice := fee.Amount.ToLegacyDec().QuoInt64(gasLimit) + normalizedGasPrice := effectiveGasPrice.Quo(currentGasPrice.Amount) + scaledGasPrice := normalizedGasPrice.MulInt64(int64(math.Pow10(gasPricePrecision))) + + // overflow panic protection + if scaledGasPrice.GTE(sdkmath.LegacyNewDec(math.MaxInt64)) { + return math.MaxInt64 + } else if scaledGasPrice.LTE(sdkmath.LegacyOneDec()) { + return 0 + } + + return scaledGasPrice.TruncateInt64() +} diff --git a/x/feemarket/ante/fee_test.go b/x/feemarket/ante/fee_test.go new file mode 100644 index 000000000000..d62a8ea8cd71 --- /dev/null +++ b/x/feemarket/ante/fee_test.go @@ -0,0 +1,428 @@ +package ante_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/mock" + + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + _ "github.com/cosmos/cosmos-sdk/x/auth" + + antesuite "cosmossdk.io/x/feemarket/ante/suite" + "cosmossdk.io/x/feemarket/types" +) + +func TestAnteHandleMock(t *testing.T) { + // Same data for every test case + gasLimit := antesuite.NewTestGasLimit() + + validFeeAmount := types.DefaultMinBaseGasPrice.MulInt64(int64(gasLimit)) + validFee := sdk.NewCoins(sdk.NewCoin("stake", validFeeAmount.TruncateInt())) + validFeeDifferentDenom := sdk.NewCoins(sdk.NewCoin("atom", math.Int(validFeeAmount))) + + testCases := []antesuite.TestCase{ + { + Name: "0 gas given should fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: true, + }, + // test --gas=auto flag settings + // when --gas=auto is set, cosmos-sdk sets gas=0 and simulate=true + { + Name: "--gas=auto behaviour test", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil) + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + Mock: true, + }, + { + Name: "0 gas given should fail with resolvable denom", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFeeDifferentDenom, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: true, + }, + { + Name: "0 gas given should pass in simulate - no fee", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + ExpErr: nil, + Mock: true, + }, + { + Name: "0 gas given should pass in simulate - fee", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + ExpErr: nil, + Mock: true, + }, + { + Name: "signer has enough funds, should pass", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil) + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: true, + ExpErr: nil, + Mock: true, + }, + { + Name: "signer has enough funds in resolvable denom, should pass", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeDifferentDenom, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: true, + ExpErr: nil, + Mock: true, + }, + { + Name: "no fee - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 1000000000, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: types.ErrNoFeeCoins, + Mock: true, + }, + { + Name: "no gas limit - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: true, + }, + } + + for _, tc := range testCases { + t.Run(fmt.Sprintf("Case %s", tc.Name), func(t *testing.T) { + s := antesuite.SetupTestSuite(t, tc.Mock) + s.TxBuilder = s.ClientCtx.TxConfig.NewTxBuilder() + args := tc.Malleate(s) + + s.RunTestCase(t, tc, args) + }) + } +} + +func TestAnteHandle(t *testing.T) { + // Same data for every test case + gasLimit := antesuite.NewTestGasLimit() + + validFeeAmount := types.DefaultMinBaseGasPrice.MulInt64(int64(gasLimit)) + validFee := sdk.NewCoins(sdk.NewCoin("stake", validFeeAmount.TruncateInt())) + validFeeDifferentDenom := sdk.NewCoins(sdk.NewCoin("atom", math.Int(validFeeAmount))) + + testCases := []antesuite.TestCase{ + { + Name: "0 gas given should fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: false, + }, + // test --gas=auto flag settings + // when --gas=auto is set, cosmos-sdk sets gas=0 and simulate=true + { + Name: "--gas=auto behaviour test - no balance", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + Mock: false, + }, + { + Name: "0 gas given should fail with resolvable denom", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFeeDifferentDenom, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: false, + }, + { + Name: "0 gas given should pass in simulate - no fee", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + ExpErr: nil, + Mock: false, + }, + { + Name: "0 gas given should pass in simulate - fee", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + ExpErr: nil, + Mock: false, + }, + { + Name: "signer has enough funds, should pass", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validFee, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: true, + ExpErr: nil, + Mock: false, + }, + { + Name: "signer has insufficient funds, should fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + // no balance + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrInsufficientFunds, + Mock: false, + }, + { + Name: "signer has enough funds in resolvable denom, should pass", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validFeeDifferentDenom, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeDifferentDenom, + } + }, + RunAnte: true, + RunPost: false, + Simulate: false, + ExpPass: true, + ExpErr: nil, + Mock: false, + }, + { + Name: "no fee - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 1000000000, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: types.ErrNoFeeCoins, + Mock: false, + }, + { + Name: "no gas limit - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: false, + }, + } + + for _, tc := range testCases { + t.Run(fmt.Sprintf("Case %s", tc.Name), func(t *testing.T) { + s := antesuite.SetupTestSuite(t, tc.Mock) + s.TxBuilder = s.ClientCtx.TxConfig.NewTxBuilder() + args := tc.Malleate(s) + + s.RunTestCase(t, tc, args) + }) + } +} diff --git a/x/feemarket/ante/feegrant_test.go b/x/feemarket/ante/feegrant_test.go new file mode 100644 index 000000000000..c24e494b4daf --- /dev/null +++ b/x/feemarket/ante/feegrant_test.go @@ -0,0 +1,227 @@ +package ante_test + +import ( + "context" + "math/rand" + "testing" + "time" + + "cosmossdk.io/x/feegrant" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authante "github.com/cosmos/cosmos-sdk/x/auth/ante" + authsign "github.com/cosmos/cosmos-sdk/x/auth/signing" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + feemarketante "cosmossdk.io/x/feemarket/ante" + antesuite "cosmossdk.io/x/feemarket/ante/suite" + "cosmossdk.io/x/feemarket/types" +) + +func TestEscrowFunds(t *testing.T) { + cases := map[string]struct { + fee int64 + valid bool + err error + malleate func(*antesuite.TestSuite) (signer antesuite.TestAccount, feeAcc sdk.AccAddress) + }{ + "paying with insufficient fee": { + fee: 1, + valid: false, + err: sdkerrors.ErrInsufficientFee, + malleate: func(suite *antesuite.TestSuite) (antesuite.TestAccount, sdk.AccAddress) { + accs := suite.CreateTestAccounts(1) + return accs[0], nil + }, + }, + "paying with good funds": { + fee: 24497000000, + valid: true, + malleate: func(s *antesuite.TestSuite) (antesuite.TestAccount, sdk.AccAddress) { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil) + + return accs[0], nil + }, + }, + "paying with no account": { + fee: 24497000000, + valid: false, + err: sdkerrors.ErrUnknownAddress, + malleate: func(_ *antesuite.TestSuite) (antesuite.TestAccount, sdk.AccAddress) { + // Do not register the account + priv, _, addr := testdata.KeyTestPubAddr() + return antesuite.TestAccount{ + Account: authtypes.NewBaseAccountWithAddress(addr), + Priv: priv, + }, nil + }, + }, + "valid fee grant": { + // note: the original test said "valid fee grant with no account". + // this is impossible given that feegrant.GrantAllowance calls + // SetAccount for the grantee. + fee: 36630000000, + valid: true, + malleate: func(s *antesuite.TestSuite) (antesuite.TestAccount, sdk.AccAddress) { + accs := s.CreateTestAccounts(2) + s.MockFeeGrantKeeper.On("UseGrantedFees", mock.Anything, accs[1].Account.GetAddress(), accs[0].Account.GetAddress(), mock.Anything, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[1].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil) + + return accs[0], accs[1].Account.GetAddress() + }, + }, + "no fee grant": { + fee: 36630000000, + valid: false, + err: sdkerrors.ErrNotFound, + malleate: func(s *antesuite.TestSuite) (antesuite.TestAccount, sdk.AccAddress) { + accs := s.CreateTestAccounts(2) + s.MockFeeGrantKeeper.On( + "UseGrantedFees", mock.Anything, accs[1].Account.GetAddress(), accs[0].Account.GetAddress(), mock.Anything, mock.Anything). + Return(sdkerrors.ErrNotFound.Wrap("fee-grant not found")). + Once() + return accs[0], accs[1].Account.GetAddress() + }, + }, + "allowance smaller than requested fee": { + fee: 36630000000, + valid: false, + err: feegrant.ErrFeeLimitExceeded, + malleate: func(s *antesuite.TestSuite) (antesuite.TestAccount, sdk.AccAddress) { + accs := s.CreateTestAccounts(2) + s.MockFeeGrantKeeper.On( + "UseGrantedFees", mock.Anything, accs[1].Account.GetAddress(), accs[0].Account.GetAddress(), mock.Anything, mock.Anything). + Return(feegrant.ErrFeeLimitExceeded.Wrap("basic allowance")). + Once() + return accs[0], accs[1].Account.GetAddress() + }, + }, + "granter cannot cover allowed fee grant": { + fee: 36630000000, + valid: false, + err: sdkerrors.ErrInsufficientFunds, + malleate: func(s *antesuite.TestSuite) (antesuite.TestAccount, sdk.AccAddress) { + accs := s.CreateTestAccounts(2) + s.MockFeeGrantKeeper.On("UseGrantedFees", mock.Anything, accs[1].Account.GetAddress(), accs[0].Account.GetAddress(), mock.Anything, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[1].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(sdkerrors.ErrInsufficientFunds) + return accs[0], accs[1].Account.GetAddress() + }, + }, + } + + for name, stc := range cases { + tc := stc // to make scopelint happy + t.Run(name, func(t *testing.T) { + s := antesuite.SetupTestSuite(t, true) + protoTxCfg := tx.NewTxConfig(codec.NewProtoCodec(s.EncCfg.InterfaceRegistry), tx.DefaultSignModes) + // this just tests our handler + dfd := feemarketante.NewFeeMarketCheckDecorator(s.AccountKeeper, s.MockBankKeeper, s.MockFeeGrantKeeper, + s.FeeMarketKeeper, authante.NewDeductFeeDecorator( + s.AccountKeeper, + s.MockBankKeeper, + s.MockFeeGrantKeeper, + nil, + )) + feeAnteHandler := sdk.ChainAnteDecorators(dfd) + + signer, feeAcc := stc.malleate(s) + + fee := sdk.NewCoins(sdk.NewInt64Coin("stake", tc.fee)) + msgs := []sdk.Msg{testdata.NewTestMsg(signer.Account.GetAddress())} + + acc := s.AccountKeeper.GetAccount(s.Ctx, signer.Account.GetAddress()) + privs, accNums, seqs := []cryptotypes.PrivKey{signer.Priv}, []uint64{0}, []uint64{0} + if acc != nil { + accNums, seqs = []uint64{acc.GetAccountNumber()}, []uint64{acc.GetSequence()} + } + + var defaultGenTxGas uint64 = 10 + tx, err := genTxWithFeeGranter(protoTxCfg, msgs, fee, defaultGenTxGas, s.Ctx.ChainID(), accNums, seqs, feeAcc, privs...) + require.NoError(t, err) + _, err = feeAnteHandler(s.Ctx, tx, false) // tests only feegrant ante + if tc.valid { + require.NoError(t, err) + } else { + require.ErrorIs(t, err, tc.err) + } + }) + } +} + +func genTxWithFeeGranter(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, + accSeqs []uint64, feeGranter sdk.AccAddress, priv ...cryptotypes.PrivKey, +) (sdk.Tx, error) { + sigs := make([]signing.SignatureV2, len(priv)) + + // create a random length memo + r := rand.New(rand.NewSource(time.Now().UnixNano())) + + memo := simulation.RandStringOfLength(r, simulation.RandIntBetween(r, 0, 100)) + + signMode := signing.SignMode_SIGN_MODE_DIRECT + + // 1st round: set SignatureV2 with empty signatures, to set correct + // signer infos. + for i, p := range priv { + sigs[i] = signing.SignatureV2{ + PubKey: p.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: signMode, + }, + Sequence: accSeqs[i], + } + } + + tx := gen.NewTxBuilder() + err := tx.SetMsgs(msgs...) + if err != nil { + return nil, err + } + err = tx.SetSignatures(sigs...) + if err != nil { + return nil, err + } + tx.SetMemo(memo) + tx.SetFeeAmount(feeAmt) + tx.SetGasLimit(gas) + tx.SetFeeGranter(feeGranter) + + // 2nd round: once all signer infos are set, every signer can sign. + for i, p := range priv { + signerData := authsign.SignerData{ + ChainID: chainID, + AccountNumber: accNums[i], + Sequence: accSeqs[i], + PubKey: p.PubKey(), + } + signBytes, err := authsign.GetSignBytesAdapter( + context.Background(), gen.SignModeHandler(), signMode, signerData, tx.GetTx()) + if err != nil { + panic(err) + } + sig, err := p.Sign(signBytes) + if err != nil { + panic(err) + } + sigs[i].Data.(*signing.SingleSignatureData).Signature = sig + err = tx.SetSignatures(sigs...) + if err != nil { + panic(err) + } + } + + return tx.GetTx(), nil +} diff --git a/x/feemarket/ante/mocks/expected_keepers_mocks.go b/x/feemarket/ante/mocks/expected_keepers_mocks.go new file mode 100644 index 000000000000..01a11675b5c1 --- /dev/null +++ b/x/feemarket/ante/mocks/expected_keepers_mocks.go @@ -0,0 +1,320 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/feemarket/ante/expected_keepers.go + +// Package gas is a generated GoMock package. +package gas + +import ( + context "context" + reflect "reflect" + + address "cosmossdk.io/core/address" + types "cosmossdk.io/x/feemarket/types" + types0 "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/x/auth/types" + gomock "github.com/golang/mock/gomock" +) + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// AddressCodec mocks base method. +func (m *MockAccountKeeper) AddressCodec() address.Codec { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddressCodec") + ret0, _ := ret[0].(address.Codec) + return ret0 +} + +// AddressCodec indicates an expected call of AddressCodec. +func (mr *MockAccountKeeperMockRecorder) AddressCodec() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddressCodec", reflect.TypeOf((*MockAccountKeeper)(nil).AddressCodec)) +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types0.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", ctx, addr) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) +} + +// GetModuleAccount mocks base method. +func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, name string) types0.ModuleAccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAccount", ctx, name) + ret0, _ := ret[0].(types0.ModuleAccountI) + return ret0 +} + +// GetModuleAccount indicates an expected call of GetModuleAccount. +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, name interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, name) +} + +// GetModuleAddress mocks base method. +func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types0.AccAddress { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAddress", moduleName) + ret0, _ := ret[0].(types0.AccAddress) + return ret0 +} + +// GetModuleAddress indicates an expected call of GetModuleAddress. +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), moduleName) +} + +// GetParams mocks base method. +func (m *MockAccountKeeper) GetParams(ctx context.Context) types1.Params { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetParams", ctx) + ret0, _ := ret[0].(types1.Params) + return ret0 +} + +// GetParams indicates an expected call of GetParams. +func (mr *MockAccountKeeperMockRecorder) GetParams(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetParams", reflect.TypeOf((*MockAccountKeeper)(nil).GetParams), ctx) +} + +// NewAccountWithAddress mocks base method. +func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr types0.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewAccountWithAddress", ctx, addr) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// NewAccountWithAddress indicates an expected call of NewAccountWithAddress. +func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccountWithAddress", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccountWithAddress), ctx, addr) +} + +// SetAccount mocks base method. +func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types0.AccountI) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetAccount", ctx, acc) +} + +// SetAccount indicates an expected call of SetAccount. +func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) +} + +// MockFeeGrantKeeper is a mock of FeeGrantKeeper interface. +type MockFeeGrantKeeper struct { + ctrl *gomock.Controller + recorder *MockFeeGrantKeeperMockRecorder +} + +// MockFeeGrantKeeperMockRecorder is the mock recorder for MockFeeGrantKeeper. +type MockFeeGrantKeeperMockRecorder struct { + mock *MockFeeGrantKeeper +} + +// NewMockFeeGrantKeeper creates a new mock instance. +func NewMockFeeGrantKeeper(ctrl *gomock.Controller) *MockFeeGrantKeeper { + mock := &MockFeeGrantKeeper{ctrl: ctrl} + mock.recorder = &MockFeeGrantKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockFeeGrantKeeper) EXPECT() *MockFeeGrantKeeperMockRecorder { + return m.recorder +} + +// UseGrantedFees mocks base method. +func (m *MockFeeGrantKeeper) UseGrantedFees(ctx context.Context, granter, grantee types0.AccAddress, fee types0.Coins, msgs []types0.Msg) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UseGrantedFees", ctx, granter, grantee, fee, msgs) + ret0, _ := ret[0].(error) + return ret0 +} + +// UseGrantedFees indicates an expected call of UseGrantedFees. +func (mr *MockFeeGrantKeeperMockRecorder) UseGrantedFees(ctx, granter, grantee, fee, msgs interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UseGrantedFees", reflect.TypeOf((*MockFeeGrantKeeper)(nil).UseGrantedFees), ctx, granter, grantee, fee, msgs) +} + +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder +} + +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper +} + +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder +} + +// SendCoinsFromAccountToModule mocks base method. +func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types0.AccAddress, recipientModule string, amt types0.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) +} + +// MockFeeMarketKeeper is a mock of FeeMarketKeeper interface. +type MockFeeMarketKeeper struct { + ctrl *gomock.Controller + recorder *MockFeeMarketKeeperMockRecorder +} + +// MockFeeMarketKeeperMockRecorder is the mock recorder for MockFeeMarketKeeper. +type MockFeeMarketKeeperMockRecorder struct { + mock *MockFeeMarketKeeper +} + +// NewMockFeeMarketKeeper creates a new mock instance. +func NewMockFeeMarketKeeper(ctrl *gomock.Controller) *MockFeeMarketKeeper { + mock := &MockFeeMarketKeeper{ctrl: ctrl} + mock.recorder = &MockFeeMarketKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockFeeMarketKeeper) EXPECT() *MockFeeMarketKeeperMockRecorder { + return m.recorder +} + +// GetMinGasPrice mocks base method. +func (m *MockFeeMarketKeeper) GetMinGasPrice(ctx types0.Context, denom string) (types0.DecCoin, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMinGasPrice", ctx, denom) + ret0, _ := ret[0].(types0.DecCoin) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetMinGasPrice indicates an expected call of GetMinGasPrice. +func (mr *MockFeeMarketKeeperMockRecorder) GetMinGasPrice(ctx, denom interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMinGasPrice", reflect.TypeOf((*MockFeeMarketKeeper)(nil).GetMinGasPrice), ctx, denom) +} + +// GetParams mocks base method. +func (m *MockFeeMarketKeeper) GetParams(ctx types0.Context) (types.Params, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetParams", ctx) + ret0, _ := ret[0].(types.Params) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetParams indicates an expected call of GetParams. +func (mr *MockFeeMarketKeeperMockRecorder) GetParams(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetParams", reflect.TypeOf((*MockFeeMarketKeeper)(nil).GetParams), ctx) +} + +// GetState mocks base method. +func (m *MockFeeMarketKeeper) GetState(ctx types0.Context) (types.State, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetState", ctx) + ret0, _ := ret[0].(types.State) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetState indicates an expected call of GetState. +func (mr *MockFeeMarketKeeperMockRecorder) GetState(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetState", reflect.TypeOf((*MockFeeMarketKeeper)(nil).GetState), ctx) +} + +// ResolveToDenom mocks base method. +func (m *MockFeeMarketKeeper) ResolveToDenom(ctx types0.Context, coin types0.DecCoin, denom string) (types0.DecCoin, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResolveToDenom", ctx, coin, denom) + ret0, _ := ret[0].(types0.DecCoin) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResolveToDenom indicates an expected call of ResolveToDenom. +func (mr *MockFeeMarketKeeperMockRecorder) ResolveToDenom(ctx, coin, denom interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResolveToDenom", reflect.TypeOf((*MockFeeMarketKeeper)(nil).ResolveToDenom), ctx, coin, denom) +} + +// SetParams mocks base method. +func (m *MockFeeMarketKeeper) SetParams(ctx types0.Context, params types.Params) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetParams", ctx, params) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetParams indicates an expected call of SetParams. +func (mr *MockFeeMarketKeeperMockRecorder) SetParams(ctx, params interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetParams", reflect.TypeOf((*MockFeeMarketKeeper)(nil).SetParams), ctx, params) +} + +// SetState mocks base method. +func (m *MockFeeMarketKeeper) SetState(ctx types0.Context, state types.State) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetState", ctx, state) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetState indicates an expected call of SetState. +func (mr *MockFeeMarketKeeperMockRecorder) SetState(ctx, state interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetState", reflect.TypeOf((*MockFeeMarketKeeper)(nil).SetState), ctx, state) +} diff --git a/x/feemarket/ante/suite/suite.go b/x/feemarket/ante/suite/suite.go new file mode 100644 index 000000000000..7394f8978ca1 --- /dev/null +++ b/x/feemarket/ante/suite/suite.go @@ -0,0 +1,389 @@ +package suite + +import ( + "testing" + + storetypes "cosmossdk.io/store/types" + bankkeeper "cosmossdk.io/x/bank/keeper" + banktypes "cosmossdk.io/x/bank/types" + txsigning "cosmossdk.io/x/tx/signing" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authante "github.com/cosmos/cosmos-sdk/x/auth/ante" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + feemarketkeeper "cosmossdk.io/x/feemarket/keeper" + + feemarketante "cosmossdk.io/x/feemarket/ante" + "cosmossdk.io/x/feemarket/ante/mocks" + feemarketpost "cosmossdk.io/x/feemarket/post" + testkeeper "cosmossdk.io/x/feemarket/testutils" + feemarkettypes "cosmossdk.io/x/feemarket/types" +) + +type TestSuite struct { + suite.Suite + + Ctx sdk.Context + AnteHandler sdk.AnteHandler + PostHandler sdk.PostHandler + ClientCtx client.Context + TxBuilder client.TxBuilder + + AccountKeeper feemarketante.AccountKeeper + FeeMarketKeeper *feemarketkeeper.Keeper + BankKeeper bankkeeper.Keeper + FeeGrantKeeper feemarketante.FeeGrantKeeper + + MockBankKeeper *mocks.BankKeeper + MockFeeGrantKeeper *mocks.FeeGrantKeeper + EncCfg TestEncodingConfig + + MsgServer feemarkettypes.MsgServer +} + +// TestAccount represents an account used in the tests in x/auth/ante. +type TestAccount struct { + Account sdk.AccountI + Priv cryptotypes.PrivKey +} + +type TestAccountBalance struct { + TestAccount + sdk.Coins +} + +func (s *TestSuite) CreateTestAccounts(numAccs int) []TestAccount { + s.T().Helper() + + var accounts []TestAccount + + for i := 0; i < numAccs; i++ { + priv, _, addr := testdata.KeyTestPubAddr() + acc := s.AccountKeeper.NewAccountWithAddress(s.Ctx, addr) + err := acc.SetAccountNumber(uint64(i + 1000)) + if err != nil { + panic(err) + } + s.AccountKeeper.SetAccount(s.Ctx, acc) + accounts = append(accounts, TestAccount{acc, priv}) + } + + return accounts +} + +func (s *TestSuite) SetAccountBalances(accounts []TestAccountBalance) { + s.T().Helper() + + oldState := s.BankKeeper.ExportGenesis(s.Ctx) + + balances := make([]banktypes.Balance, len(accounts)) + for i, acc := range accounts { + balances[i] = banktypes.Balance{ + Address: acc.Account.GetAddress().String(), + Coins: acc.Coins, + } + } + + oldState.Balances = balances + s.BankKeeper.InitGenesis(s.Ctx, oldState) +} + +// SetupTestSuite setups a new test, with new app, context, and anteHandler. +func SetupTestSuite(t *testing.T, mock bool) *TestSuite { + s := &TestSuite{} + + s.EncCfg = MakeTestEncodingConfig() + ctx, testKeepers, _ := testkeeper.NewTestSetup(t) + s.Ctx = ctx + + s.AccountKeeper = testKeepers.AccountKeeper + s.FeeMarketKeeper = testKeepers.FeeMarketKeeper + s.BankKeeper = testKeepers.BankKeeper + s.FeeGrantKeeper = testKeepers.FeeGrantKeeper + + s.MockBankKeeper = mocks.NewBankKeeper(t) + s.MockFeeGrantKeeper = mocks.NewFeeGrantKeeper(t) + + s.ClientCtx = client.Context{}.WithTxConfig(s.EncCfg.TxConfig) + s.TxBuilder = s.ClientCtx.TxConfig.NewTxBuilder() + + s.FeeMarketKeeper.SetEnabledHeight(s.Ctx, -1) + s.MsgServer = feemarketkeeper.NewMsgServer(s.FeeMarketKeeper) + + s.SetupHandlers(mock) + s.SetT(t) + + s.BankKeeper.InitGenesis(s.Ctx, &banktypes.GenesisState{}) + + return s +} + +func (s *TestSuite) SetupHandlers(mock bool) { + bankKeeper := s.BankKeeper + feeGrantKeeper := s.FeeGrantKeeper + + if mock { + bankKeeper = s.MockBankKeeper + feeGrantKeeper = s.MockFeeGrantKeeper + } + + // create basic antehandler with the feemarket decorator + anteDecorators := []sdk.AnteDecorator{ + authante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first + feemarketante.NewFeeMarketCheckDecorator( // fee market replaces fee deduct decorator + s.AccountKeeper, + bankKeeper, + feeGrantKeeper, + s.FeeMarketKeeper, + authante.NewDeductFeeDecorator( + s.AccountKeeper, + bankKeeper, + feeGrantKeeper, + nil, + ), + ), + authante.NewSigGasConsumeDecorator(s.AccountKeeper, authante.DefaultSigVerificationGasConsumer), + } + + s.AnteHandler = sdk.ChainAnteDecorators(anteDecorators...) + + // create basic postHandler with the feemarket decorator + postDecorators := []sdk.PostDecorator{ + feemarketpost.NewFeeMarketDeductDecorator( + s.AccountKeeper, + bankKeeper, + s.FeeMarketKeeper, + ), + } + + s.PostHandler = sdk.ChainPostDecorators(postDecorators...) +} + +// TestCase represents a test case used in test tables. +type TestCase struct { + Name string + Malleate func(*TestSuite) TestCaseArgs + StateUpdate func(*TestSuite) + RunAnte bool + RunPost bool + Simulate bool + ExpPass bool + ExpErr error + ExpectConsumedGas uint64 + Mock bool +} + +type TestCaseArgs struct { + ChainID string + AccNums []uint64 + AccSeqs []uint64 + FeeAmount sdk.Coins + GasLimit uint64 + Msgs []sdk.Msg + Privs []cryptotypes.PrivKey +} + +// DeliverMsgs constructs a tx and runs it through the ante handler. This is used to set the context for a test case, for +// example to test for replay protection. +func (s *TestSuite) DeliverMsgs(t *testing.T, privs []cryptotypes.PrivKey, msgs []sdk.Msg, feeAmount sdk.Coins, gasLimit uint64, accNums, accSeqs []uint64, chainID string, simulate bool) (sdk.Context, error) { + require.NoError(t, s.TxBuilder.SetMsgs(msgs...)) + s.TxBuilder.SetFeeAmount(feeAmount) + s.TxBuilder.SetGasLimit(gasLimit) + + tx, txErr := s.CreateTestTx(privs, accNums, accSeqs, chainID) + require.NoError(t, txErr) + return s.AnteHandler(s.Ctx, tx, simulate) +} + +func (s *TestSuite) RunTestCase(t *testing.T, tc TestCase, args TestCaseArgs) { + require.NoError(t, s.TxBuilder.SetMsgs(args.Msgs...)) + s.TxBuilder.SetFeeAmount(args.FeeAmount) + s.TxBuilder.SetGasLimit(args.GasLimit) + + // Theoretically speaking, ante handler unit tests should only test + // ante handlers, but here we sometimes also test the tx creation + // process. + tx, txErr := s.CreateTestTx(args.Privs, args.AccNums, args.AccSeqs, args.ChainID) + + var ( + newCtx sdk.Context + anteErr error + postErr error + ) + + // reset gas meter + s.Ctx = s.Ctx.WithGasMeter(storetypes.NewGasMeter(NewTestGasLimit())) + + if tc.RunAnte { + newCtx, anteErr = s.AnteHandler(s.Ctx, tx, tc.Simulate) + } + + // perform mid-tx state update if configured + if tc.StateUpdate != nil { + tc.StateUpdate(s) + } + + if tc.RunPost && anteErr == nil { + newCtx, postErr = s.PostHandler(s.Ctx, tx, tc.Simulate, true) + } + + if tc.ExpPass { + require.NoError(t, txErr) + require.NoError(t, anteErr) + require.NoError(t, postErr) + require.NotNil(t, newCtx) + + s.Ctx = newCtx + if tc.RunPost { + consumedGas := newCtx.GasMeter().GasConsumed() + require.Equal(t, tc.ExpectConsumedGas, consumedGas) + } + + } else { + switch { + case txErr != nil: + require.Error(t, txErr) + require.ErrorIs(t, txErr, tc.ExpErr) + + case anteErr != nil: + require.Error(t, anteErr) + require.NoError(t, postErr) + require.ErrorIs(t, anteErr, tc.ExpErr) + + case postErr != nil: + require.NoError(t, anteErr) + require.Error(t, postErr) + require.ErrorIs(t, postErr, tc.ExpErr) + + default: + t.Fatal("expected one of txErr, handleErr to be an error") + } + } +} + +// CreateTestTx is a helper function to create a tx given multiple inputs. +func (s *TestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []uint64, accSeqs []uint64, chainID string) (authsigning.Tx, error) { + // First round: we gather all the signer infos. We use the "set empty + // signature" hack to do that. + var sigsV2 []signing.SignatureV2 + for i, priv := range privs { + sigV2 := signing.SignatureV2{ + PubKey: priv.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: signing.SignMode(s.ClientCtx.TxConfig.SignModeHandler().DefaultMode()), + Signature: nil, + }, + Sequence: accSeqs[i], + } + + sigsV2 = append(sigsV2, sigV2) + } + err := s.TxBuilder.SetSignatures(sigsV2...) + if err != nil { + return nil, err + } + + // Second round: all signer infos are set, so each signer can sign. + sigsV2 = []signing.SignatureV2{} + for i, priv := range privs { + signerData := authsigning.SignerData{ + ChainID: chainID, + AccountNumber: accNums[i], + Sequence: accSeqs[i], + } + sigV2, err := tx.SignWithPrivKey( + s.Ctx, + signing.SignMode(s.ClientCtx.TxConfig.SignModeHandler().DefaultMode()), signerData, + s.TxBuilder, priv, s.ClientCtx.TxConfig, accSeqs[i]) + if err != nil { + return nil, err + } + + sigsV2 = append(sigsV2, sigV2) + } + err = s.TxBuilder.SetSignatures(sigsV2...) + if err != nil { + return nil, err + } + + return s.TxBuilder.GetTx(), nil +} + +// NewTestFeeAmount is a test fee amount. +func NewTestFeeAmount() sdk.Coins { + return sdk.NewCoins(sdk.NewInt64Coin("stake", 150)) +} + +// NewTestGasLimit is a test fee gas limit. +func NewTestGasLimit() uint64 { + return 200000 +} + +// TestEncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type TestEncodingConfig struct { + InterfaceRegistry codectypes.InterfaceRegistry + Codec codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} + +// MakeTestEncodingConfig creates a test EncodingConfig for a test configuration. +func MakeTestEncodingConfig() TestEncodingConfig { + amino := codec.NewLegacyAmino() + + interfaceRegistry := InterfaceRegistry() + cdc := codec.NewProtoCodec(interfaceRegistry) + txCfg := authtx.NewTxConfig(cdc, authtx.DefaultSignModes) + + std.RegisterLegacyAminoCodec(amino) + std.RegisterInterfaces(interfaceRegistry) + + return TestEncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Codec: cdc, + TxConfig: txCfg, + Amino: amino, + } +} + +func InterfaceRegistry() codectypes.InterfaceRegistry { + interfaceRegistry, err := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: txsigning.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + }, + }) + if err != nil { + panic(err) + } + + // always register + cryptocodec.RegisterInterfaces(interfaceRegistry) + authtypes.RegisterInterfaces(interfaceRegistry) + + // call extra registry functions + feemarkettypes.RegisterInterfaces(interfaceRegistry) + + return interfaceRegistry +} diff --git a/x/feemarket/client/cli/query.go b/x/feemarket/client/cli/query.go new file mode 100644 index 000000000000..728be71a5d8b --- /dev/null +++ b/x/feemarket/client/cli/query.go @@ -0,0 +1,143 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "cosmossdk.io/x/feemarket/types" +) + +// GetQueryCmd returns the parent command for all x/feemarket cli query commands. +func GetQueryCmd() *cobra.Command { + // create base command + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + // add sub-commands + cmd.AddCommand( + GetParamsCmd(), + GetStateCmd(), + GetGasPriceCmd(), + GetGasPricesCmd(), + ) + + return cmd +} + +// GetParamsCmd returns the cli-command that queries the current feemarket parameters. +func GetParamsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query for the current feemarket parameters", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.Params(cmd.Context(), &types.ParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(&resp.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetStateCmd returns the cli-command that queries the current feemarket state. +func GetStateCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "state", + Short: "Query for the current feemarket state", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.State(cmd.Context(), &types.StateRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(&resp.State) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetGasPriceCmd returns the cli-command that queries the current feemarket gas price. +func GetGasPriceCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "gas-price", + Short: "Query for the current feemarket gas price", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.GasPrice(cmd.Context(), &types.GasPriceRequest{ + Denom: args[0], + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetGasPricesCmd returns the cli-command that queries all current feemarket gas prices. +func GetGasPricesCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "gas-prices", + Short: "Query for all current feemarket gas prices", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.GasPrices(cmd.Context(), &types.GasPricesRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/feemarket/depinject.go b/x/feemarket/depinject.go new file mode 100644 index 000000000000..3c733644eace --- /dev/null +++ b/x/feemarket/depinject.go @@ -0,0 +1,66 @@ +package feemarket + +import ( + "cosmossdk.io/core/appmodule" + "cosmossdk.io/depinject" + "cosmossdk.io/depinject/appconfig" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + modulev1 "cosmossdk.io/api/cosmos/feemarket/module/v1" + "cosmossdk.io/x/feemarket/keeper" + "cosmossdk.io/x/feemarket/types" +) + +const govModuleName = "gov" + +func init() { + appconfig.Register( + &modulev1.Module{}, + appconfig.Provide(ProvideModule), + ) +} + +type Inputs struct { + depinject.In + + Config *modulev1.Module + Cdc codec.Codec + Env appmodule.Environment + AccountKeeper types.AccountKeeper +} + +type Outputs struct { + depinject.Out + + Keeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in Inputs) Outputs { + var ( + authority sdk.AccAddress + err error + ) + if in.Config.Authority != "" { + authority, err = sdk.AccAddressFromBech32(in.Config.Authority) + if err != nil { + panic(err) + } + } else { + authority = authtypes.NewModuleAddress(govModuleName) + } + + Keeper := keeper.NewKeeper( + in.Cdc, + in.Env, + in.AccountKeeper, + nil, + authority.String(), + ) + + m := NewAppModule(in.Cdc, *Keeper) + + return Outputs{Keeper: *Keeper, Module: m} +} diff --git a/x/feemarket/fuzz/aimd_eip1559_test.go b/x/feemarket/fuzz/aimd_eip1559_test.go new file mode 100644 index 000000000000..13a62eb69b47 --- /dev/null +++ b/x/feemarket/fuzz/aimd_eip1559_test.go @@ -0,0 +1,170 @@ +package fuzz_test + +import ( + "testing" + + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + "pgregory.net/rapid" + + "cosmossdk.io/x/feemarket/types" +) + +// TestAIMDLearningRate ensures that the additive increase +// multiplicative decrease learning rate algorithm correctly +// adjusts the learning rate. In particular, if the block +// utilization is greater than theta or less than 1 - theta, then +// the learning rate is increased by the additive increase +// parameter. Otherwise, the learning rate is decreased by +// the multiplicative decrease parameter. +func TestAIMDLearningRate(t *testing.T) { + t.Parallel() + + rapid.Check(t, func(t *rapid.T) { + state := types.DefaultAIMDState() + window := rapid.Int64Range(1, 50).Draw(t, "window") + state.Window = make([]uint64, window) + + params := CreateRandomAIMDParams(t) + + // Randomly generate the block utilization. + numBlocks := rapid.Uint64Range(0, 1000).Draw(t, "num_blocks") + gasGen := rapid.Uint64Range(0, params.MaxBlockUtilization) + + // Update the fee market. + for i := uint64(0); i < numBlocks; i++ { + blockUtilization := gasGen.Draw(t, "gas") + prevLearningRate := state.LearningRate + + // Update the fee market. + if err := state.Update(blockUtilization, params); err != nil { + t.Fatalf("block update errors: %v", err) + } + + // Update the learning rate. + lr := state.UpdateLearningRate(params) + utilization := state.GetAverageUtilization(params) + + // Ensure that the learning rate is always bounded. + require.True(t, lr.GTE(params.MinLearningRate)) + require.True(t, lr.LTE(params.MaxLearningRate)) + + if utilization.LTE(params.Gamma) || utilization.GTE(math.LegacyOneDec().Sub(params.Gamma)) { + require.True(t, lr.GTE(prevLearningRate)) + } else { + require.True(t, lr.LTE(prevLearningRate)) + } + + // Update the current height. + state.IncrementHeight() + } + }) +} + +// TestAIMDGasPrice ensures that the additive increase multiplicative +// decrease gas price adjustment algorithm correctly adjusts the base +// fee. In particular, the gas price should function the same as the +// default EIP-1559 base fee adjustment algorithm. +func TestAIMDGasPrice(t *testing.T) { + rapid.Check(t, func(t *rapid.T) { + state := types.DefaultAIMDState() + window := rapid.Int64Range(1, 50).Draw(t, "window") + state.Window = make([]uint64, window) + + params := CreateRandomAIMDParams(t) + + // Randomly generate the block utilization. + numBlocks := rapid.Uint64Range(0, uint64(window)*10).Draw(t, "num_blocks") + gasGen := rapid.Uint64Range(0, params.MaxBlockUtilization) + + // Update the fee market. + for i := uint64(0); i < numBlocks; i++ { + blockUtilization := gasGen.Draw(t, "gas") + prevBaseGasPrice := state.BaseGasPrice + + if err := state.Update(blockUtilization, params); err != nil { + t.Fatalf("block update errors: %v", err) + } + + var total uint64 + for _, utilization := range state.Window { + total += utilization + } + + // Update the learning rate. + lr := state.UpdateLearningRate(params) + // Update the base gas price. + + var newPrice math.LegacyDec + func() { + defer func() { + if rec := recover(); rec != nil { + newPrice = params.MinBaseGasPrice + } + }() + + // Calculate the new base gasPrice with the learning rate adjustment. + currentBlockSize := math.LegacyNewDecFromInt(math.NewIntFromUint64(state.Window[state.Index])) + targetBlockSize := math.LegacyNewDecFromInt(math.NewIntFromUint64(params.TargetBlockUtilization())) + utilization := (currentBlockSize.Sub(targetBlockSize)).Quo(targetBlockSize) + + // Truncate the learning rate adjustment to an integer. + // + // This is equivalent to + // 1 + (learningRate * (currentBlockSize - targetBlockSize) / targetBlockSize) + learningRateAdjustment := math.LegacyOneDec().Add(lr.Mul(utilization)) + + // Calculate the delta adjustment. + net := math.LegacyNewDecFromInt(state.GetNetUtilization(params)).Mul(params.Delta) + + // Update the base gasPrice. + newPrice = prevBaseGasPrice.Mul(learningRateAdjustment).Add(net) + // Ensure the base gasPrice is greater than the minimum base gasPrice. + if newPrice.LT(params.MinBaseGasPrice) { + newPrice = params.MinBaseGasPrice + } + }() + + state.UpdateBaseGasPrice(params) + + // Ensure that the minimum base fee is always less than the base gas price. + require.True(t, params.MinBaseGasPrice.LTE(state.BaseGasPrice)) + + require.Equal(t, newPrice, state.BaseGasPrice) + + // Update the current height. + state.IncrementHeight() + } + }) +} + +// CreateRandomAIMDParams returns a random set of parameters for the AIMD +// EIP-1559 fee market implementation. +func CreateRandomAIMDParams(t *rapid.T) types.Params { + a := rapid.Uint64Range(1, 1000).Draw(t, "alpha") + alpha := math.LegacyNewDec(int64(a)).Quo(math.LegacyNewDec(1000)) + + b := rapid.Uint64Range(50, 99).Draw(t, "beta") + beta := math.LegacyNewDec(int64(b)).Quo(math.LegacyNewDec(100)) + + g := rapid.Uint64Range(10, 50).Draw(t, "gamma") + gamma := math.LegacyNewDec(int64(g)).Quo(math.LegacyNewDec(100)) + + d := rapid.Uint64Range(1, 1000).Draw(t, "delta") + delta := math.LegacyNewDec(int64(d)).Quo(math.LegacyNewDec(1000)) + + targetBlockUtilization := rapid.Uint64Range(1, 30_000_000).Draw(t, "target_block_utilization") + maxBlockUtilization := rapid.Uint64Range(targetBlockUtilization, targetBlockUtilization*5).Draw(t, "max_block_utilization") + + distributeFees := rapid.Bool().Draw(t, "distribute_fees") + + params := types.DefaultAIMDParams() + params.Alpha = alpha + params.Beta = beta + params.Gamma = gamma + params.Delta = delta + params.MaxBlockUtilization = maxBlockUtilization + params.DistributeFees = distributeFees + + return params +} diff --git a/x/feemarket/fuzz/eip1559_test.go b/x/feemarket/fuzz/eip1559_test.go new file mode 100644 index 000000000000..34bd7c3f0e03 --- /dev/null +++ b/x/feemarket/fuzz/eip1559_test.go @@ -0,0 +1,97 @@ +package fuzz_test + +import ( + "testing" + + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + "pgregory.net/rapid" + + "cosmossdk.io/x/feemarket/types" +) + +// TestLearningRate ensures that the learning rate is always +// constant for the default EIP-1559 implementation. +func TestLearningRate(t *testing.T) { + rapid.Check(t, func(t *rapid.T) { + state := types.DefaultState() + params := CreateRandomParams(t) + + // Randomly generate alpha and beta. + prevLearningRate := state.LearningRate + + // Randomly generate the block utilization. + blockUtilization := rapid.Uint64Range(0, params.MaxBlockUtilization).Draw(t, "gas") + + // Update the fee market. + if err := state.Update(blockUtilization, params); err != nil { + t.Fatalf("block update errors: %v", err) + } + + // Update the learning rate. + lr := state.UpdateLearningRate(params) + require.Equal(t, types.DefaultMinLearningRate, lr) + require.Equal(t, prevLearningRate, state.LearningRate) + }) +} + +// TestGasPrice ensures that the gas price moves in the correct +// direction for the default EIP-1559 implementation. +func TestGasPrice(t *testing.T) { + rapid.Check(t, func(t *rapid.T) { + state := types.DefaultState() + params := CreateRandomParams(t) + + // Update the current base fee to be 10% higher than the minimum base fee. + prevBaseFee := state.BaseGasPrice.Mul(math.LegacyNewDec(11)).Quo(math.LegacyNewDec(10)) + state.BaseGasPrice = prevBaseFee + + // Randomly generate the block utilization. + blockUtilization := rapid.Uint64Range(0, params.MaxBlockUtilization).Draw(t, "gas") + + // Update the fee market. + if err := state.Update(blockUtilization, params); err != nil { + t.Fatalf("block update errors: %v", err) + } + + // Update the learning rate. + state.UpdateLearningRate(params) + // Update the base fee. + state.UpdateBaseGasPrice(params) + + // Ensure that the minimum base fee is always less than the base fee. + require.True(t, params.MinBaseGasPrice.LTE(state.BaseGasPrice)) + + switch { + case blockUtilization > params.TargetBlockUtilization(): + require.True(t, state.BaseGasPrice.GTE(prevBaseFee)) + case blockUtilization < params.TargetBlockUtilization(): + require.True(t, state.BaseGasPrice.LTE(prevBaseFee)) + default: + require.Equal(t, state.BaseGasPrice, prevBaseFee) + } + }) +} + +// CreateRandomParams returns a random set of parameters for the default +// EIP-1559 fee market implementation. +func CreateRandomParams(t *rapid.T) types.Params { + a := rapid.Uint64Range(1, 1000).Draw(t, "alpha") + alpha := math.LegacyNewDec(int64(a)).Quo(math.LegacyNewDec(1000)) + + b := rapid.Uint64Range(50, 99).Draw(t, "beta") + beta := math.LegacyNewDec(int64(b)).Quo(math.LegacyNewDec(100)) + + g := rapid.Uint64Range(10, 50).Draw(t, "gamma") + gamma := math.LegacyNewDec(int64(g)).Quo(math.LegacyNewDec(100)) + + maxBlockUtilization := rapid.Uint64Range(2, 30_000_000).Draw(t, "max_block_utilization") + + params := types.DefaultParams() + params.Alpha = alpha + params.Beta = beta + params.Gamma = gamma + params.MaxBlockUtilization = maxBlockUtilization + + return params +} diff --git a/x/feemarket/fuzz/tx_priority_test.go b/x/feemarket/fuzz/tx_priority_test.go new file mode 100644 index 000000000000..4279b6a94baf --- /dev/null +++ b/x/feemarket/fuzz/tx_priority_test.go @@ -0,0 +1,53 @@ +package fuzz_test + +import ( + "math" + "testing" + + sdkmath "cosmossdk.io/math" + "github.com/stretchr/testify/require" + "pgregory.net/rapid" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "cosmossdk.io/x/feemarket/ante" +) + +type input struct { + payFee sdk.Coin + gasLimit int64 + currentGasPrice sdk.DecCoin +} + +// TestGetTxPriority ensures that tx priority is properly bounded +func TestGetTxPriority(t *testing.T) { + rapid.Check(t, func(t *rapid.T) { + inputs := createRandomInput(t) + + priority := ante.GetTxPriority(inputs.payFee, inputs.gasLimit, inputs.currentGasPrice) + require.GreaterOrEqual(t, priority, int64(0)) + require.LessOrEqual(t, priority, int64(math.MaxInt64)) + }) +} + +// CreateRandomInput returns a random inputs to the priority function. +func createRandomInput(t *rapid.T) input { + denom := "skip" + + price := rapid.Int64Range(1, 1_000_000_000).Draw(t, "gas price") + priceDec := sdkmath.LegacyNewDecWithPrec(price, 6) + + gasLimit := rapid.Int64Range(1_000_000, 1_000_000_000_000).Draw(t, "gas limit") + + if priceDec.MulInt64(gasLimit).GTE(sdkmath.LegacyNewDec(math.MaxInt64)) { + t.Fatalf("not supposed to happen") + } + + payFeeAmt := rapid.Int64Range(priceDec.MulInt64(gasLimit).TruncateInt64(), math.MaxInt64).Draw(t, "fee amount") + + return input{ + payFee: sdk.NewCoin(denom, sdkmath.NewInt(payFeeAmt)), + gasLimit: gasLimit, + currentGasPrice: sdk.NewDecCoinFromDec(denom, priceDec), + } +} diff --git a/x/feemarket/go.mod b/x/feemarket/go.mod new file mode 100644 index 000000000000..382e0f4ac00e --- /dev/null +++ b/x/feemarket/go.mod @@ -0,0 +1,184 @@ +module cosmossdk.io/x/feemarket + +go 1.23.1 + +replace github.com/cosmos/cosmos-sdk => ../../. + +// TODO remove post spinning out all modules +replace ( + cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections + cosmossdk.io/core => ../../core + cosmossdk.io/core/testing => ../../core/testing + cosmossdk.io/store => ../../store + cosmossdk.io/x/bank => ../bank + cosmossdk.io/x/feegrant => ../feegrant + cosmossdk.io/x/staking => ../staking +) + +require ( + cosmossdk.io/api v0.7.5 + cosmossdk.io/collections v0.4.0 + cosmossdk.io/core v1.0.0-alpha.2 + cosmossdk.io/depinject v1.0.0 + cosmossdk.io/errors v1.0.1 + cosmossdk.io/math v1.3.0 + cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc + cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 + cosmossdk.io/x/feegrant v0.0.0-00010101000000-000000000000 + cosmossdk.io/x/tx v0.13.4 + github.com/cosmos/cosmos-proto v1.0.0-beta.5 + github.com/cosmos/cosmos-sdk v0.53.0 + github.com/cosmos/gogoproto v1.7.0 + github.com/golang/mock v1.6.0 + github.com/golang/protobuf v1.5.4 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/spf13/cobra v1.8.1 + github.com/stretchr/testify v1.9.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 + google.golang.org/grpc v1.66.2 + pgregory.net/rapid v1.1.0 +) + +require ( + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/log v1.4.1 // indirect + cosmossdk.io/schema v0.2.0 // indirect + cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect + filippo.io/edwards25519 v1.1.0 // indirect + github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect + github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect + github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bgentry/speakeasy v0.2.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cockroachdb/errors v1.11.3 // indirect + github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v1.1.2 // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f // indirect + github.com/cometbft/cometbft-db v0.15.0 // indirect + github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect + github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-db v1.0.3-0.20240911104526-ddc3f09bfc22 // indirect + github.com/cosmos/crypto v0.1.2 // indirect + github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gogogateway v1.2.0 // indirect + github.com/cosmos/iavl v1.3.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect + github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/danieljoos/wincred v1.2.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect + github.com/dgraph-io/badger/v4 v4.3.0 // indirect + github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/dvsekhvalnov/jose2go v1.6.0 // indirect + github.com/emicklei/dot v1.6.2 // indirect + github.com/fatih/color v1.17.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/getsentry/sentry-go v0.27.0 // indirect + github.com/go-kit/kit v0.13.0 // indirect + github.com/go-kit/log v0.2.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect + github.com/gogo/googleapis v1.4.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/btree v1.1.3 // indirect + github.com/google/flatbuffers v2.0.8+incompatible // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/orderedcode v0.0.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + 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/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 + github.com/hashicorp/go-metrics v0.5.3 // indirect + github.com/hashicorp/go-plugin v1.6.1 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/hdevalence/ed25519consensus v0.2.0 // indirect + github.com/huandu/skiplist v1.2.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jmhodges/levigo v1.0.0 // indirect + github.com/klauspost/compress v1.17.9 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/lib/pq v1.10.9 // indirect + github.com/linxGnu/grocksdb v1.9.3 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/minio/highwayhash v1.0.3 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mtibben/percent v0.2.1 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.20.3 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.59.1 // indirect + github.com/prometheus/procfs v0.15.1 // indirect + github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/rs/cors v1.11.0 // indirect + github.com/rs/zerolog v1.33.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sasha-s/go-deadlock v0.3.5 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.7.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.19.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/supranational/blst v0.3.13 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect + github.com/tendermint/go-amino v0.16.0 // indirect + github.com/tidwall/btree v1.7.0 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect + go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect + go.opencensus.io v0.24.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.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/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect +) diff --git a/x/feemarket/go.sum b/x/feemarket/go.sum new file mode 100644 index 000000000000..90e085c44478 --- /dev/null +++ b/x/feemarket/go.sum @@ -0,0 +1,699 @@ +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= +cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= +cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= +cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/x/tx v0.13.4 h1:Eg0PbJgeO0gM8p5wx6xa0fKR7hIV6+8lC56UrsvSo0Y= +cosmossdk.io/x/tx v0.13.4/go.mod h1:BkFqrnGGgW50Y6cwTy+JvgAhiffbGEKW6KF9ufcDpvk= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= +github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0= +github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/adlio/schema v1.3.6 h1:k1/zc2jNfeiZBA5aFTRy37jlBIuCkXCm0XmvpzCKI9I= +github.com/adlio/schema v1.3.6/go.mod h1:qkxwLgPBd1FgLRHYVCmQT/rrBr3JH38J9LjmVzWNudg= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= +github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f h1:rPWKqyc+CeuddICqlqptf+3NPE8exbC9SOGuDPTEN3k= +github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f/go.mod h1:MqZ5E5jLU1JdP10FSRXhItpm+GdHMbW7Myv3UARLxqg= +github.com/cometbft/cometbft-db v0.15.0 h1:VLtsRt8udD4jHCyjvrsTBpgz83qne5hnL245AcPJVRk= +github.com/cometbft/cometbft-db v0.15.0/go.mod h1:EBrFs1GDRiTqrWXYi4v90Awf/gcdD5ExzdPbg4X8+mk= +github.com/cometbft/cometbft/api v1.0.0-rc.1 h1:GtdXwDGlqwHYs16A4egjwylfYOMYyEacLBrs3Zvpt7g= +github.com/cometbft/cometbft/api v1.0.0-rc.1/go.mod h1:NDFKiBBD8HJC6QQLAoUI99YhsiRZtg2+FJWfk6A6m6o= +github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= +github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= +github.com/cosmos/cosmos-db v1.0.3-0.20240911104526-ddc3f09bfc22 h1:V3WlarcZwlYYt3dUsStxm0FAFXVeEcvgwfmR6upxm5M= +github.com/cosmos/cosmos-db v1.0.3-0.20240911104526-ddc3f09bfc22/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls= +github.com/cosmos/crypto v0.1.2/go.mod h1:b6VWz3HczIpBaQPvI7KrbQeF3pXHh0al3T5e0uwMBQw= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= +github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= +github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= +github.com/cosmos/iavl v1.3.0 h1:Ezaxt8aPA3kbkhsfyqwenChGLQwHDAIif3tG9x1FMV8= +github.com/cosmos/iavl v1.3.0/go.mod h1:T6SfBcyhulVIY2G/ZtAtQm/QiJvsuhIos52V4dWYk88= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= +github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= +github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/dgraph-io/badger/v4 v4.3.0 h1:lcsCE1/1qrRhqP+zYx6xDZb8n7U+QlwNicpc676Ub40= +github.com/dgraph-io/badger/v4 v4.3.0/go.mod h1:Sc0T595g8zqAQRDf44n+z3wG4BOqLwceaFntt8KPxUM= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 h1:Pux6+xANi0I7RRo5E1gflI4EZ2yx3BGZ75JkAIvGEOA= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91/go.mod h1:swkazRqnUf1N62d0Nutz7KIj2UKqsm/H8tD0nBJAXqM= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= +github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= +github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= +github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= +github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= +github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= +github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= +github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= +github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= +github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= +github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= +github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/linxGnu/grocksdb v1.9.3 h1:s1cbPcOd0cU2SKXRG1nEqCOWYAELQjdqg3RVI2MH9ik= +github.com/linxGnu/grocksdb v1.9.3/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= +github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= +github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= +github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= +github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= +github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= +github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= +github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= +github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= +github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= +github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= +github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= +go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6ejyAJc760RwW4SnVDiTYTzwnXuxo= +go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/x/feemarket/keeper/abci.go b/x/feemarket/keeper/abci.go new file mode 100644 index 000000000000..ee877dabef4b --- /dev/null +++ b/x/feemarket/keeper/abci.go @@ -0,0 +1,10 @@ +package keeper + +import "context" + +// EndBlock returns an endblocker for the x/feemarket module. The endblocker +// is responsible for updating the state of the fee market based on the +// AIMD learning rate adjustment algorithm. +func (k *Keeper) EndBlock(ctx context.Context) error { + return k.UpdateFeeMarket(ctx) +} diff --git a/x/feemarket/keeper/feemarket.go b/x/feemarket/keeper/feemarket.go new file mode 100644 index 000000000000..cb89237b5f27 --- /dev/null +++ b/x/feemarket/keeper/feemarket.go @@ -0,0 +1,138 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// UpdateFeeMarket updates the base fee and learning rate based on the +// AIMD learning rate adjustment algorithm. Note that if the fee market +// is disabled, this function will return without updating the fee market. +// This is executed in EndBlock which allows the next block's base fee to +// be readily available for wallets to estimate gas prices. +func (k *Keeper) UpdateFeeMarket(ctx context.Context) error { + params, err := k.GetParams(ctx) + if err != nil { + return err + } + + k.Environment.Logger.Info( + "updated the fee market", + "params", params, + ) + + if !params.Enabled { + return nil + } + + state, err := k.GetState(ctx) + if err != nil { + return err + } + + // Update the learning rate based on the block utilization seen in the + // current block. This is the AIMD learning rate adjustment algorithm. + newLR := state.UpdateLearningRate( + params, + ) + + // Update the base gas price based with the new learning rate and delta adjustment. + newBaseGasPrice := state.UpdateBaseGasPrice(params) + height := k.Environment.HeaderService.HeaderInfo(ctx).Height + k.Logger.Info( + "updated the fee market", + "height", height, + "new_base_gas_price", newBaseGasPrice, + "new_learning_rate", newLR, + "average_block_utilization", state.GetAverageUtilization(params), + "net_block_utilization", state.GetNetUtilization(params), + ) + + // Increment the height of the state and set the new state. + state.IncrementHeight() + return k.SetState(ctx, state) +} + +// GetBaseGasPrice returns the base fee from the fee market state. +func (k *Keeper) GetBaseGasPrice(ctx context.Context) (math.LegacyDec, error) { + state, err := k.GetState(ctx) + if err != nil { + return math.LegacyDec{}, err + } + + return state.BaseGasPrice, nil +} + +// GetLearningRate returns the learning rate from the fee market state. +func (k *Keeper) GetLearningRate(ctx context.Context) (math.LegacyDec, error) { + state, err := k.GetState(ctx) + if err != nil { + return math.LegacyDec{}, err + } + + return state.LearningRate, nil +} + +// GetMinGasPrice returns the mininum gas prices for given denom as sdk.DecCoins from the fee market state. +func (k *Keeper) GetMinGasPrice(ctx context.Context, denom string) (sdk.DecCoin, error) { + baseGasPrice, err := k.GetBaseGasPrice(ctx) + if err != nil { + return sdk.DecCoin{}, err + } + + params, err := k.GetParams(ctx) + if err != nil { + return sdk.DecCoin{}, err + } + + var gasPrice sdk.DecCoin + + if params.FeeDenom == denom { + gasPrice = sdk.NewDecCoinFromDec(params.FeeDenom, baseGasPrice) + } else { + gasPrice, err = k.ResolveToDenom(ctx, sdk.NewDecCoinFromDec(params.FeeDenom, baseGasPrice), denom) + if err != nil { + return sdk.DecCoin{}, err + } + } + + return gasPrice, nil +} + +// GetMinGasPrices returns the mininum gas prices as sdk.DecCoins from the fee market state. +func (k *Keeper) GetMinGasPrices(ctx context.Context) (sdk.DecCoins, error) { + baseGasPrice, err := k.GetBaseGasPrice(ctx) + if err != nil { + return sdk.NewDecCoins(), err + } + + params, err := k.GetParams(ctx) + if err != nil { + return sdk.NewDecCoins(), err + } + + minGasPrice := sdk.NewDecCoinFromDec(params.FeeDenom, baseGasPrice) + minGasPrices := sdk.NewDecCoins(minGasPrice) + + extraDenoms, err := k.resolver.ExtraDenoms(ctx) + if err != nil { + return sdk.NewDecCoins(), err + } + + for _, denom := range extraDenoms { + gasPrice, err := k.ResolveToDenom(ctx, minGasPrice, denom) + if err != nil { + k.Logger.Info( + "failed to convert gas price", + "min gas price", minGasPrice, + "denom", denom, + ) + continue + } + minGasPrices = minGasPrices.Add(gasPrice) + } + + return minGasPrices, nil +} diff --git a/x/feemarket/keeper/feemarket_test.go b/x/feemarket/keeper/feemarket_test.go new file mode 100644 index 000000000000..dbbb0c929079 --- /dev/null +++ b/x/feemarket/keeper/feemarket_test.go @@ -0,0 +1,480 @@ +package keeper_test + +import ( + "cosmossdk.io/math" + "cosmossdk.io/x/feemarket/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (s *KeeperTestSuite) TestUpdateFeeMarket() { + s.Run("empty block with default eip1559 with min base fee", func() { + state := types.DefaultState() + params := types.DefaultParams() + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(fee, params.MinBaseGasPrice) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("empty block with default eip1559 with preset base fee", func() { + state := types.DefaultState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyNewDec(2)) + params := types.DefaultParams() + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to decrease by 1/8th. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + + factor := math.LegacyMustNewDecFromStr("0.875") + expectedFee := state.BaseGasPrice.Mul(factor) + s.Require().Equal(fee, expectedFee) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("empty block with default eip1559 with preset base fee < 1", func() { + state := types.DefaultState() + // this value should be ignored -> 0.5 should be used instead + state.BaseGasPrice = math.LegacyMustNewDecFromStr("0.25") + + // change MinBaseGasPrice value < 1 + params := types.DefaultParams() + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("0.5") + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + + s.Require().Equal(fee, math.LegacyMustNewDecFromStr("0.5")) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("empty block default eip1559 with preset base fee that should default to min", func() { + // Set the base fee to just below the expected threshold decrease of 1/8th. This means it + // should default to the minimum base fee. + state := types.DefaultState() + factor := math.LegacyMustNewDecFromStr("0.125") + change := state.BaseGasPrice.Mul(factor) + state.BaseGasPrice = types.DefaultMinBaseGasPrice.Sub(change) + + params := types.DefaultParams() + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to decrease by 1/8th. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(fee, params.MinBaseGasPrice) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("target block with default eip1559 at min base fee", func() { + state := types.DefaultState() + params := types.DefaultParams() + + // Reaching the target block size means that we expect this to not + // increase. + err := state.Update(params.TargetBlockUtilization(), params) + s.Require().NoError(err) + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to remain the same. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(fee, params.MinBaseGasPrice) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("target block with default eip1559 at preset base fee", func() { + state := types.DefaultState() + params := types.DefaultParams() + + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyNewDec(2)) + // Reaching the target block size means that we expect this to not + // increase. + err := state.Update(params.TargetBlockUtilization(), params) + s.Require().NoError(err) + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to remain the same. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(state.BaseGasPrice, fee) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("max block with default eip1559 at min base fee", func() { + state := types.DefaultState() + params := types.DefaultParams() + + // Reaching the target block size means that we expect this to not + // increase. + err := state.Update(params.MaxBlockUtilization, params) + s.Require().NoError(err) + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to increase by 1/8th. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + + factor := math.LegacyMustNewDecFromStr("1.125") + expectedFee := state.BaseGasPrice.Mul(factor) + s.Require().Equal(fee, expectedFee) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("max block with default eip1559 at preset base fee", func() { + state := types.DefaultState() + params := types.DefaultParams() + + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyNewDec(2)) + // Reaching the target block size means that we expect this to not + // increase. + err := state.Update(params.MaxBlockUtilization, params) + s.Require().NoError(err) + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to increase by 1/8th. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + + factor := math.LegacyMustNewDecFromStr("1.125") + expectedFee := state.BaseGasPrice.Mul(factor) + s.Require().Equal(fee, expectedFee) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("in-between min and target block with default eip1559 at min base fee", func() { + state := types.DefaultState() + params := types.DefaultParams() + params.MaxBlockUtilization = 100 + + err := state.Update(25, params) + s.Require().NoError(err) + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to remain the same since it is at min base fee. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(fee, params.MinBaseGasPrice) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("in-between min and target block with default eip1559 at preset base fee", func() { + state := types.DefaultState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyNewDec(2)) + + params := types.DefaultParams() + params.MaxBlockUtilization = 100 + err := state.Update(25, params) + + s.Require().NoError(err) + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to decrease by 1/8th * 1/2. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + + factor := math.LegacyMustNewDecFromStr("0.9375") + expectedFee := state.BaseGasPrice.Mul(factor) + s.Require().Equal(fee, expectedFee) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("in-between target and max block with default eip1559 at min base fee", func() { + state := types.DefaultState() + params := types.DefaultParams() + params.MaxBlockUtilization = 100 + + err := state.Update(75, params) + s.Require().NoError(err) + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to increase by 1/8th * 1/2. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + + factor := math.LegacyMustNewDecFromStr("1.0625") + expectedFee := state.BaseGasPrice.Mul(factor) + s.Require().Equal(fee, expectedFee) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("in-between target and max block with default eip1559 at preset base fee", func() { + state := types.DefaultState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyNewDec(2)) + params := types.DefaultParams() + params.MaxBlockUtilization = 100 + + err := state.Update(75, params) + s.Require().NoError(err) + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to increase by 1/8th * 1/2. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + + factor := math.LegacyMustNewDecFromStr("1.0625") + expectedFee := state.BaseGasPrice.Mul(factor) + s.Require().Equal(fee, expectedFee) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(math.LegacyMustNewDecFromStr("0.125"), lr) + }) + + s.Run("empty blocks with aimd eip1559 with min base fee", func() { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(fee, params.MinBaseGasPrice) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + expectedLR := state.LearningRate.Add(params.Alpha) + s.Require().Equal(expectedLR, lr) + }) + + s.Run("empty blocks with aimd eip1559 with preset base fee", func() { + state := types.DefaultAIMDState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyNewDec(2)) + params := types.DefaultAIMDParams() + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to decrease by 1/8th and the learning rate to + // increase by alpha. + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + expectedLR := state.LearningRate.Add(params.Alpha) + s.Require().Equal(expectedLR, lr) + + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + factor := math.LegacyOneDec().Add(math.LegacyMustNewDecFromStr("-1.0").Mul(lr)) + expectedFee := state.BaseGasPrice.Mul(factor) + s.Require().Equal(fee, expectedFee) + }) + + s.Run("empty blocks aimd eip1559 with preset base fee that should default to min", func() { + params := types.DefaultAIMDParams() + + state := types.DefaultAIMDState() + lr := math.LegacyMustNewDecFromStr("0.125") + increase := state.BaseGasPrice.Mul(lr).TruncateInt() + + state.BaseGasPrice = types.DefaultMinBaseGasPrice.Add(math.LegacyNewDecFromInt(increase)).Sub(math.LegacyNewDec(1)) + state.LearningRate = lr + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + expectedLR := state.LearningRate.Add(params.Alpha) + s.Require().Equal(expectedLR, lr) + + // We expect the base fee to decrease by 1/8th and the learning rate to + // increase by alpha. + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(fee, params.MinBaseGasPrice) + }) + + s.Run("target block with aimd eip1559 at min base fee + LR", func() { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + // Reaching the target block size means that we expect this to not + // increase. + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.TargetBlockUtilization() + } + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to remain the same and the learning rate to + // remain at minimum. + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(params.MinLearningRate, lr) + + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(state.BaseGasPrice, fee) + }) + + s.Run("target block with aimd eip1559 at preset base fee + LR", func() { + state := types.DefaultAIMDState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyNewDec(2)) + state.LearningRate = math.LegacyMustNewDecFromStr("0.125") + params := types.DefaultAIMDParams() + + // Reaching the target block size means that we expect this to not + // increase. + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.TargetBlockUtilization() + } + + s.setGenesisState(params, state) + + s.Require().NoError(s.feeMarketKeeper.UpdateFeeMarket(s.ctx)) + + // We expect the base fee to decrease by 1/8th and the learning rate to + // decrease by lr * beta. + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + expectedLR := state.LearningRate.Mul(params.Beta) + s.Require().Equal(expectedLR, lr) + + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(state.BaseGasPrice, fee) + }) +} + +func (s *KeeperTestSuite) TestGetBaseFee() { + s.Run("can retrieve base fee with default eip-1559", func() { + gs := types.DefaultGenesisState() + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(fee, gs.State.BaseGasPrice) + }) + + s.Run("can retrieve base fee with aimd eip-1559", func() { + gs := types.DefaultAIMDGenesisState() + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + + fee, err := s.feeMarketKeeper.GetBaseGasPrice(s.ctx) + s.Require().NoError(err) + s.Require().Equal(fee, gs.State.BaseGasPrice) + }) +} + +func (s *KeeperTestSuite) TestGetLearningRate() { + s.Run("can retrieve learning rate with default eip-1559", func() { + gs := types.DefaultGenesisState() + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(lr, gs.State.LearningRate) + }) + + s.Run("can retrieve learning rate with aimd eip-1559", func() { + gs := types.DefaultAIMDGenesisState() + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + + lr, err := s.feeMarketKeeper.GetLearningRate(s.ctx) + s.Require().NoError(err) + s.Require().Equal(lr, gs.State.LearningRate) + }) +} + +func (s *KeeperTestSuite) TestGetMinGasPrices() { + s.Run("can retrieve min gas prices with default eip-1559", func() { + gs := types.DefaultGenesisState() + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + + expected := sdk.NewDecCoins(sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, gs.State.BaseGasPrice)) + + mgp, err := s.feeMarketKeeper.GetMinGasPrices(s.ctx) + s.Require().NoError(err) + s.Require().Equal(expected, mgp) + }) + + s.Run("can retrieve min gas prices with aimd eip-1559", func() { + gs := types.DefaultAIMDGenesisState() + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + + expected := sdk.NewDecCoins(sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, gs.State.BaseGasPrice)) + + mgp, err := s.feeMarketKeeper.GetMinGasPrices(s.ctx) + s.Require().NoError(err) + s.Require().Equal(expected, mgp) + }) +} + +func (s *KeeperTestSuite) setGenesisState(params types.Params, state types.State) { + gs := types.NewGenesisState(params, state) + s.NotPanics(func() { + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + }) +} diff --git a/x/feemarket/keeper/genesis.go b/x/feemarket/keeper/genesis.go new file mode 100644 index 000000000000..aa0a75d141cd --- /dev/null +++ b/x/feemarket/keeper/genesis.go @@ -0,0 +1,48 @@ +package keeper + +import ( + "context" + "errors" + + "cosmossdk.io/x/feemarket/types" +) + +// InitGenesis initializes the feemarket module's state from a given genesis state. +func (k *Keeper) InitGenesis(ctx context.Context, gs types.GenesisState) error { + if err := gs.ValidateBasic(); err != nil { + panic(err) + } + + if gs.Params.Window != uint64(len(gs.State.Window)) { + errors.New("genesis state and parameters do not match for window") + } + + // Initialize the fee market state and parameters. + if err := k.SetParams(ctx, gs.Params); err != nil { + return err + } + + if err := k.SetState(ctx, gs.State); err != nil { + return err + } + + // always init enabled height to -1 until it is explicitly set later in the application + return k.SetEnabledHeight(ctx, -1) +} + +// ExportGenesis returns a GenesisState for a given context. +func (k *Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) { + // Get the feemarket module's parameters. + params, err := k.GetParams(ctx) + if err != nil { + return nil, err + } + + // Get the feemarket module's state. + state, err := k.GetState(ctx) + if err != nil { + return nil, err + } + + return types.NewGenesisState(params, state), nil +} diff --git a/x/feemarket/keeper/genesis_test.go b/x/feemarket/keeper/genesis_test.go new file mode 100644 index 000000000000..c90288957c55 --- /dev/null +++ b/x/feemarket/keeper/genesis_test.go @@ -0,0 +1,62 @@ +package keeper_test + +import ( + "cosmossdk.io/x/feemarket/types" +) + +func (s *KeeperTestSuite) TestInitGenesis() { + s.Run("default genesis should not panic", func() { + s.Require().NotPanics(func() { + s.feeMarketKeeper.InitGenesis(s.ctx, *types.DefaultGenesisState()) + }) + }) + + s.Run("default AIMD genesis should not panic", func() { + s.Require().NotPanics(func() { + s.feeMarketKeeper.InitGenesis(s.ctx, *types.DefaultAIMDGenesisState()) + }) + }) + + s.Run("bad genesis state should panic", func() { + gs := types.DefaultGenesisState() + gs.Params.Window = 0 + s.Require().Panics(func() { + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + }) + }) + + s.Run("mismatch in params and state for window should panic", func() { + gs := types.DefaultAIMDGenesisState() + gs.Params.Window = 1 + + s.Require().Panics(func() { + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + }) + }) +} + +func (s *KeeperTestSuite) TestExportGenesis() { + s.Run("export genesis should not panic for default eip-1559", func() { + gs := types.DefaultGenesisState() + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + + var exportedGenesis *types.GenesisState + s.Require().NotPanics(func() { + exportedGenesis = s.feeMarketKeeper.ExportGenesis(s.ctx) + }) + + s.Require().Equal(gs, exportedGenesis) + }) + + s.Run("export genesis should not panic for default AIMD eip-1559", func() { + gs := types.DefaultAIMDGenesisState() + s.feeMarketKeeper.InitGenesis(s.ctx, *gs) + + var exportedGenesis *types.GenesisState + s.Require().NotPanics(func() { + exportedGenesis = s.feeMarketKeeper.ExportGenesis(s.ctx) + }) + + s.Require().Equal(gs, exportedGenesis) + }) +} diff --git a/x/feemarket/keeper/keeper.go b/x/feemarket/keeper/keeper.go new file mode 100644 index 000000000000..4da99aae8b66 --- /dev/null +++ b/x/feemarket/keeper/keeper.go @@ -0,0 +1,141 @@ +package keeper + +import ( + "context" + "errors" + "fmt" + + "cosmossdk.io/collections" + "cosmossdk.io/core/appmodule" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "cosmossdk.io/x/feemarket/types" +) + +// Keeper is the x/feemarket keeper. +type Keeper struct { + appmodule.Environment + + cdc codec.BinaryCodec + ak types.AccountKeeper + resolver types.DenomResolver + + enabledHeight collections.Item[int64] + state collections.Item[types.State] + params collections.Item[types.Params] + + // The address that is capable of executing a MsgParams message. + // Typically, this will be the governance module's address. + authority string +} + +// NewKeeper constructs a new feemarket keeper. +func NewKeeper( + cdc codec.BinaryCodec, + env appmodule.Environment, + authKeeper types.AccountKeeper, + resolver types.DenomResolver, + authority string, +) *Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + sb := collections.NewSchemaBuilder(env.KVStoreService) + + k := &Keeper{ + cdc: cdc, + Environment: env, + ak: authKeeper, + resolver: resolver, + authority: authority, + enabledHeight: collections.NewItem(sb, types.KeyEnabledHeight, "enabled_height", collections.Int64Value), + state: collections.NewItem(sb, types.KeyState, "state", codec.CollValue[types.State](cdc)), + params: collections.NewItem(sb, types.KeyParams, "params", codec.CollValue[types.Params](cdc)), + } + + return k +} + +// GetAuthority returns the address that is capable of executing a MsgUpdateParams message. +func (k *Keeper) GetAuthority() string { + return k.authority +} + +// GetEnabledHeight returns the height at which the feemarket was enabled. +func (k *Keeper) GetEnabledHeight(ctx context.Context) (int64, error) { + bz, err := k.enabledHeight.Get(ctx) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return -1, nil + } else { + return -1, err + } + } + return bz, err +} + +// SetEnabledHeight sets the height at which the feemarket was enabled. +func (k *Keeper) SetEnabledHeight(ctx context.Context, height int64) error { + if err := k.enabledHeight.Set(ctx, height); err != nil { + return err + } + + return nil +} + +// ResolveToDenom converts the given coin to the given denomination. +func (k *Keeper) ResolveToDenom(ctx context.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) { + if k.resolver == nil { + return sdk.DecCoin{}, types.ErrResolverNotSet + } + + return k.resolver.ConvertToDenom(ctx, coin, denom) +} + +// SetDenomResolver sets the keeper's denom resolver. +func (k *Keeper) SetDenomResolver(resolver types.DenomResolver) { + k.resolver = resolver +} + +// GetState returns the feemarket module's state. +func (k *Keeper) GetState(ctx context.Context) (types.State, error) { + state, err := k.state.Get(ctx) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return types.State{}, nil + } else { + return types.State{}, status.Error(codes.Internal, err.Error()) + } + } + + return state, nil +} + +// SetState sets the feemarket module's state. +func (k *Keeper) SetState(ctx context.Context, state types.State) error { + return k.state.Set(ctx, state) +} + +// GetParams returns the feemarket module's parameters. +func (k *Keeper) GetParams(ctx context.Context) (types.Params, error) { + params, err := k.params.Get(ctx) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return types.Params{}, nil + } else { + return types.Params{}, status.Error(codes.Internal, err.Error()) + } + } + + return params, nil +} + +// SetParams sets the feemarket module's parameters. +func (k *Keeper) SetParams(ctx context.Context, params types.Params) error { + return k.params.Set(ctx, params) +} diff --git a/x/feemarket/keeper/keeper_test.go b/x/feemarket/keeper/keeper_test.go new file mode 100644 index 000000000000..2c3de5f0e54b --- /dev/null +++ b/x/feemarket/keeper/keeper_test.go @@ -0,0 +1,186 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + txsigning "cosmossdk.io/x/tx/signing" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/std" + sdk "github.com/cosmos/cosmos-sdk/types" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/suite" + + "cosmossdk.io/x/feemarket/keeper" + testkeeper "cosmossdk.io/x/feemarket/testutils" + "cosmossdk.io/x/feemarket/types" + "cosmossdk.io/x/feemarket/types/mocks" +) + +const govModuleName = "gov" + +type KeeperTestSuite struct { + suite.Suite + + accountKeeper *mocks.AccountKeeper + feeMarketKeeper *keeper.Keeper + encCfg TestEncodingConfig + ctx sdk.Context + authorityAccount sdk.AccAddress + + // Message server variables + msgServer types.MsgServer + + // Query server variables + queryServer types.QueryServer +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +func (s *KeeperTestSuite) SetupTest() { + s.encCfg = MakeTestEncodingConfig() + s.authorityAccount = authtypes.NewModuleAddress(govModuleName) + s.accountKeeper = mocks.NewAccountKeeper(s.T()) + ctx, tk, tm := testkeeper.NewTestSetup(s.T()) + + s.ctx = ctx + s.feeMarketKeeper = tk.FeeMarketKeeper + s.msgServer = tm.FeeMarketMsgServer + s.queryServer = keeper.NewQueryServer(*s.feeMarketKeeper) + s.feeMarketKeeper.SetEnabledHeight(s.ctx, -1) +} + +func (s *KeeperTestSuite) TestState() { + s.Run("set and get default eip1559 state", func() { + state := types.DefaultState() + + err := s.feeMarketKeeper.SetState(s.ctx, state) + s.Require().NoError(err) + + gotState, err := s.feeMarketKeeper.GetState(s.ctx) + s.Require().NoError(err) + + s.Require().EqualValues(state, gotState) + }) + + s.Run("set and get aimd eip1559 state", func() { + state := types.DefaultAIMDState() + + err := s.feeMarketKeeper.SetState(s.ctx, state) + s.Require().NoError(err) + + gotState, err := s.feeMarketKeeper.GetState(s.ctx) + s.Require().NoError(err) + + s.Require().Equal(state, gotState) + }) +} + +func (s *KeeperTestSuite) TestParams() { + s.Run("set and get default params", func() { + params := types.DefaultParams() + + err := s.feeMarketKeeper.SetParams(s.ctx, params) + s.Require().NoError(err) + + gotParams, err := s.feeMarketKeeper.GetParams(s.ctx) + s.Require().NoError(err) + + s.Require().EqualValues(params, gotParams) + }) + + s.Run("set and get custom params", func() { + params := types.Params{ + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MinBaseGasPrice: math.LegacyNewDec(10), + MinLearningRate: math.LegacyMustNewDecFromStr("0.1"), + MaxLearningRate: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 10, + Window: 1, + Enabled: true, + } + + err := s.feeMarketKeeper.SetParams(s.ctx, params) + s.Require().NoError(err) + + gotParams, err := s.feeMarketKeeper.GetParams(s.ctx) + s.Require().NoError(err) + + s.Require().EqualValues(params, gotParams) + }) +} + +func (s *KeeperTestSuite) TestEnabledHeight() { + s.Run("get and set values", func() { + s.feeMarketKeeper.SetEnabledHeight(s.ctx, 10) + + got, err := s.feeMarketKeeper.GetEnabledHeight(s.ctx) + s.Require().NoError(err) + s.Require().Equal(int64(10), got) + }) +} + +// TestEncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type TestEncodingConfig struct { + InterfaceRegistry codectypes.InterfaceRegistry + Codec codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} + +// MakeTestEncodingConfig creates a test EncodingConfig for a test configuration. +func MakeTestEncodingConfig() TestEncodingConfig { + amino := codec.NewLegacyAmino() + + interfaceRegistry := InterfaceRegistry() + cdc := codec.NewProtoCodec(interfaceRegistry) + txCfg := authtx.NewTxConfig(cdc, authtx.DefaultSignModes) + + std.RegisterLegacyAminoCodec(amino) + std.RegisterInterfaces(interfaceRegistry) + + return TestEncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Codec: cdc, + TxConfig: txCfg, + Amino: amino, + } +} + +func InterfaceRegistry() codectypes.InterfaceRegistry { + interfaceRegistry, err := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: txsigning.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + }, + }) + if err != nil { + panic(err) + } + + // always register + cryptocodec.RegisterInterfaces(interfaceRegistry) + authtypes.RegisterInterfaces(interfaceRegistry) + + // call extra registry functions + types.RegisterInterfaces(interfaceRegistry) + + return interfaceRegistry +} diff --git a/x/feemarket/keeper/msg_server.go b/x/feemarket/keeper/msg_server.go new file mode 100644 index 000000000000..254291bcc3db --- /dev/null +++ b/x/feemarket/keeper/msg_server.go @@ -0,0 +1,52 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/x/feemarket/types" +) + +var _ types.MsgServer = (*MsgServer)(nil) + +// MsgServer is the server API for x/feemarket Msg service. +type MsgServer struct { + k *Keeper +} + +// NewMsgServer returns the MsgServer implementation. +func NewMsgServer(k *Keeper) types.MsgServer { + return &MsgServer{k} +} + +// Params defines a method that updates the module's parameters. The signer of the message must +// be the module authority. +func (ms MsgServer) Params(ctx context.Context, msg *types.MsgParams) (*types.MsgParamsResponse, error) { + + if msg.Authority != ms.k.GetAuthority() { + return nil, fmt.Errorf("invalid authority to execute message") + } + + gotParams, err := ms.k.GetParams(ctx) + if err != nil { + return nil, fmt.Errorf("error getting params: %w", err) + } + + height := ms.k.Environment.HeaderService.HeaderInfo(ctx).Height + // if going from disabled -> enabled, set enabled height + if !gotParams.Enabled && msg.Params.Enabled { + ms.k.SetEnabledHeight(ctx, height) + } + + params := msg.Params + if err := ms.k.SetParams(ctx, params); err != nil { + return nil, fmt.Errorf("error setting params: %w", err) + } + + newState := types.NewState(params.Window, params.MinBaseGasPrice, params.MinLearningRate) + if err := ms.k.SetState(ctx, newState); err != nil { + return nil, fmt.Errorf("error setting state: %w", err) + } + + return &types.MsgParamsResponse{}, nil +} diff --git a/x/feemarket/keeper/msg_server_test.go b/x/feemarket/keeper/msg_server_test.go new file mode 100644 index 000000000000..7e5ed3e754d7 --- /dev/null +++ b/x/feemarket/keeper/msg_server_test.go @@ -0,0 +1,109 @@ +package keeper_test + +import ( + "cosmossdk.io/x/feemarket/types" +) + +func (s *KeeperTestSuite) TestMsgParams() { + s.Run("accepts a req with no params", func() { + req := &types.MsgParams{ + Authority: s.authorityAccount.String(), + } + resp, err := s.msgServer.Params(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + params, err := s.feeMarketKeeper.GetParams(s.ctx) + s.Require().NoError(err) + s.Require().False(params.Enabled) + }) + + s.Run("accepts a req with params", func() { + req := &types.MsgParams{ + Authority: s.authorityAccount.String(), + Params: types.DefaultParams(), + } + resp, err := s.msgServer.Params(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + params, err := s.feeMarketKeeper.GetParams(s.ctx) + s.Require().NoError(err) + s.Require().Equal(req.Params, params) + }) + + s.Run("rejects a req with invalid signer", func() { + req := &types.MsgParams{ + Authority: "invalid", + } + _, err := s.msgServer.Params(s.ctx, req) + s.Require().Error(err) + }) + + s.Run("sets enabledHeight when transitioning from disabled -> enabled", func() { + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight()) + enabledParams := types.DefaultParams() + + req := &types.MsgParams{ + Authority: s.authorityAccount.String(), + Params: enabledParams, + } + _, err := s.msgServer.Params(s.ctx, req) + s.Require().NoError(err) + + disableParams := types.DefaultParams() + disableParams.Enabled = false + + req = &types.MsgParams{ + Authority: s.authorityAccount.String(), + Params: disableParams, + } + _, err = s.msgServer.Params(s.ctx, req) + s.Require().NoError(err) + + gotHeight, err := s.feeMarketKeeper.GetEnabledHeight(s.ctx) + s.Require().NoError(err) + s.Require().Equal(s.ctx.BlockHeight(), gotHeight) + + // now that the markets are disabled, enable and check block height + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 10) + + req = &types.MsgParams{ + Authority: s.authorityAccount.String(), + Params: enabledParams, + } + _, err = s.msgServer.Params(s.ctx, req) + s.Require().NoError(err) + + newHeight, err := s.feeMarketKeeper.GetEnabledHeight(s.ctx) + s.Require().NoError(err) + s.Require().Equal(s.ctx.BlockHeight(), newHeight) + }) + + s.Run("resets state after new params request", func() { + params, err := s.feeMarketKeeper.GetParams(s.ctx) + s.Require().NoError(err) + + state, err := s.feeMarketKeeper.GetState(s.ctx) + s.Require().NoError(err) + + err = state.Update(params.MaxBlockUtilization, params) + s.Require().NoError(err) + + err = s.feeMarketKeeper.SetState(s.ctx, state) + s.Require().NoError(err) + + params.Window = 100 + req := &types.MsgParams{ + Authority: s.authorityAccount.String(), + Params: params, + } + _, err = s.msgServer.Params(s.ctx, req) + s.Require().NoError(err) + + state, err = s.feeMarketKeeper.GetState(s.ctx) + s.Require().NoError(err) + s.Require().Equal(params.Window, uint64(len(state.Window))) + s.Require().Equal(state.Window[0], uint64(0)) + }) +} diff --git a/x/feemarket/keeper/query_server.go b/x/feemarket/keeper/query_server.go new file mode 100644 index 000000000000..04f4811d9302 --- /dev/null +++ b/x/feemarket/keeper/query_server.go @@ -0,0 +1,43 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/x/feemarket/types" +) + +var _ types.QueryServer = (*QueryServer)(nil) + +// QueryServer defines the gRPC server for the x/feemarket module. +type QueryServer struct { + k Keeper +} + +// NewQueryServer creates a new instance of the x/feemarket QueryServer type. +func NewQueryServer(keeper Keeper) types.QueryServer { + return &QueryServer{k: keeper} +} + +// Params defines a method that returns the current feemarket parameters. +func (q QueryServer) Params(ctx context.Context, _ *types.ParamsRequest) (*types.ParamsResponse, error) { + params, err := q.k.GetParams(ctx) + return &types.ParamsResponse{Params: params}, err +} + +// State defines a method that returns the current feemarket state. +func (q QueryServer) State(ctx context.Context, _ *types.StateRequest) (*types.StateResponse, error) { + state, err := q.k.GetState(ctx) + return &types.StateResponse{State: state}, err +} + +// GasPrice defines a method that returns the current feemarket base gas price. +func (q QueryServer) GasPrice(ctx context.Context, req *types.GasPriceRequest) (*types.GasPriceResponse, error) { + gasPrice, err := q.k.GetMinGasPrice(ctx, req.GetDenom()) + return &types.GasPriceResponse{Price: gasPrice}, err +} + +// GasPrices defines a method that returns the current feemarket list of gas prices. +func (q QueryServer) GasPrices(ctx context.Context, _ *types.GasPricesRequest) (*types.GasPricesResponse, error) { + gasPrices, err := q.k.GetMinGasPrices(ctx) + return &types.GasPricesResponse{Prices: gasPrices}, err +} diff --git a/x/feemarket/keeper/query_server_test.go b/x/feemarket/keeper/query_server_test.go new file mode 100644 index 000000000000..d6546165b26d --- /dev/null +++ b/x/feemarket/keeper/query_server_test.go @@ -0,0 +1,159 @@ +package keeper_test + +import ( + "cosmossdk.io/math" + + "cosmossdk.io/x/feemarket/types" +) + +func (s *KeeperTestSuite) TestParamsRequest() { + s.Run("can get default params", func() { + req := &types.ParamsRequest{} + resp, err := s.queryServer.Params(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + s.Require().Equal(types.DefaultParams(), resp.Params) + + params, err := s.feeMarketKeeper.GetParams(s.ctx) + s.Require().NoError(err) + + s.Require().Equal(resp.Params, params) + }) + + s.Run("can get updated params", func() { + params := types.Params{ + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MinBaseGasPrice: math.LegacyNewDec(10), + MinLearningRate: math.LegacyMustNewDecFromStr("0.1"), + MaxLearningRate: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 10, + Window: 1, + Enabled: true, + } + err := s.feeMarketKeeper.SetParams(s.ctx, params) + s.Require().NoError(err) + + req := &types.ParamsRequest{} + resp, err := s.queryServer.Params(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + s.Require().Equal(params, resp.Params) + + params, err = s.feeMarketKeeper.GetParams(s.ctx) + s.Require().NoError(err) + + s.Require().Equal(resp.Params, params) + }) +} + +func (s *KeeperTestSuite) TestStateRequest() { + s.Run("can get default state", func() { + req := &types.StateRequest{} + resp, err := s.queryServer.State(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + s.Require().Equal(types.DefaultState(), resp.State) + + state, err := s.feeMarketKeeper.GetState(s.ctx) + s.Require().NoError(err) + + s.Require().Equal(resp.State, state) + }) + + s.Run("can get updated state", func() { + state := types.State{ + BaseGasPrice: math.LegacyOneDec(), + LearningRate: math.LegacyOneDec(), + Window: []uint64{1}, + Index: 0, + } + err := s.feeMarketKeeper.SetState(s.ctx, state) + s.Require().NoError(err) + + req := &types.StateRequest{} + resp, err := s.queryServer.State(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + s.Require().Equal(state, resp.State) + + state, err = s.feeMarketKeeper.GetState(s.ctx) + s.Require().NoError(err) + + s.Require().Equal(resp.State, state) + }) +} + +func (s *KeeperTestSuite) TestBaseFeeRequest() { + s.Run("can get gas price", func() { + req := &types.GasPriceRequest{ + Denom: "stake", + } + resp, err := s.queryServer.GasPrice(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + gasPrice, err := s.feeMarketKeeper.GetMinGasPrice(s.ctx, req.GetDenom()) + s.Require().NoError(err) + + s.Require().Equal(resp.GetPrice(), gasPrice) + }) + + s.Run("can get updated gas price", func() { + state := types.State{ + BaseGasPrice: math.LegacyOneDec(), + } + err := s.feeMarketKeeper.SetState(s.ctx, state) + s.Require().NoError(err) + + params := types.Params{ + FeeDenom: "test", + } + err = s.feeMarketKeeper.SetParams(s.ctx, params) + s.Require().NoError(err) + + req := &types.GasPriceRequest{ + Denom: "stake", + } + resp, err := s.queryServer.GasPrice(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + gasPrice, err := s.feeMarketKeeper.GetMinGasPrice(s.ctx, req.GetDenom()) + s.Require().NoError(err) + + s.Require().Equal(resp.GetPrice(), gasPrice) + }) + + s.Run("can get updated gas price < 1", func() { + state := types.State{ + BaseGasPrice: math.LegacyMustNewDecFromStr("0.005"), + } + err := s.feeMarketKeeper.SetState(s.ctx, state) + s.Require().NoError(err) + + params := types.Params{ + FeeDenom: "test", + } + err = s.feeMarketKeeper.SetParams(s.ctx, params) + s.Require().NoError(err) + + req := &types.GasPriceRequest{ + Denom: "stake", + } + resp, err := s.queryServer.GasPrice(s.ctx, req) + s.Require().NoError(err) + s.Require().NotNil(resp) + + fee, err := s.feeMarketKeeper.GetMinGasPrice(s.ctx, req.GetDenom()) + s.Require().NoError(err) + + s.Require().Equal(resp.GetPrice(), fee) + }) +} diff --git a/x/feemarket/module.go b/x/feemarket/module.go new file mode 100644 index 000000000000..7180c24a82fa --- /dev/null +++ b/x/feemarket/module.go @@ -0,0 +1,140 @@ +package feemarket + +import ( + "context" + "encoding/json" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/registry" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + "github.com/spf13/cobra" + + "cosmossdk.io/x/feemarket/client/cli" + "cosmossdk.io/x/feemarket/keeper" + "cosmossdk.io/x/feemarket/types" +) + +// ConsensusVersion is the x/feemarket module's consensus version identifier. +const ConsensusVersion = 1 + +var ( + _ module.HasGenesis = AppModule{} + _ module.AppModuleBasic = AppModule{} + _ module.HasServices = AppModule{} + + _ appmodule.AppModule = AppModule{} + _ appmodule.HasEndBlocker = AppModule{} +) + +// AppModule represents an application module for the x/feemarket module. +type AppModule struct { + cdc codec.Codec + k keeper.Keeper +} + +// NewAppModule returns an application module for the x/feemarket module. +func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { + return AppModule{ + cdc: cdc, + k: k, + } +} + +// Name returns the name of x/feemarket module. +func (amb AppModule) Name() string { return types.ModuleName } + +// RegisterLegacyAminoCodec registers the necessary types from the x/feemarket module for amino +// serialization. +func (amb AppModule) RegisterLegacyAminoCodec(cdc registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the necessary implementations / interfaces in the x/feemarket +// module w/ the interface-registry. +func (amb AppModule) RegisterInterfaces(ir codectypes.InterfaceRegistry) { + types.RegisterInterfaces(ir) +} + +// RegisterGRPCGatewayRoutes registers the necessary REST routes for the GRPC-gateway to +// the x/feemarket module QueryService on mux. This method panics on failure. +func (amb AppModule) RegisterGRPCGatewayRoutes(cliCtx client.Context, mux *runtime.ServeMux) { + // Register the gate-way routes w/ the provided mux. + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(cliCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd is a no-op, as no txs are registered for submission (apart from messages that +// can only be executed by governance). +func (amb AppModule) GetTxCmd() *cobra.Command { + return nil +} + +// GetQueryCmd returns the x/feemarket module base query cli-command. +func (amb AppModule) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// EndBlock returns an endblocker for the x/feemarket module. +func (am AppModule) EndBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return am.k.EndBlock(sdkCtx) +} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } + +// RegisterServices registers the module's services with the app's module configurator. +func (am AppModule) RegisterServices(cfc module.Configurator) { + types.RegisterMsgServer(cfc.MsgServer(), keeper.NewMsgServer(&am.k)) + types.RegisterQueryServer(cfc.QueryServer(), keeper.NewQueryServer(am.k)) +} + +// DefaultGenesis returns default genesis state as raw bytes for the feemarket +// module. +func (am AppModule) DefaultGenesis() json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis performs genesis state validation for the feemarket module. +func (am AppModule) ValidateGenesis(bz json.RawMessage) error { + var gs types.GenesisState + if err := am.cdc.UnmarshalJSON(bz, &gs); err != nil { + return err + } + + return gs.ValidateBasic() +} + +// InitGenesis performs the genesis initialization for the x/feemarket module. This method returns +// no validator set updates. This method panics on any errors. +func (am AppModule) InitGenesis(ctx context.Context, bz json.RawMessage) error { + var gs types.GenesisState + if err := am.cdc.UnmarshalJSON(bz, &gs); err != nil { + return err + } + + return am.k.InitGenesis(ctx, gs) +} + +// ExportGenesis returns the feemarket module's exported genesis state as raw +// JSON bytes. This method panics on any error. +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + gs, err := am.k.ExportGenesis(ctx) + if err != nil { + return nil, err + } + return am.cdc.MarshalJSON(gs) +} diff --git a/x/feemarket/post/expected_keeper.go b/x/feemarket/post/expected_keeper.go new file mode 100644 index 000000000000..7471240c1451 --- /dev/null +++ b/x/feemarket/post/expected_keeper.go @@ -0,0 +1,47 @@ +package post + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + feemarkettypes "cosmossdk.io/x/feemarket/types" +) + +// AccountKeeper defines the contract needed for AccountKeeper related APIs. +// Interface provides support to use non-sdk AccountKeeper for AnteHandler's decorators. +// +//go:generate mockery --name AccountKeeper --filename mock_account_keeper.go +type AccountKeeper interface { + GetParams(ctx context.Context) (params authtypes.Params) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) + GetModuleAddress(moduleName string) sdk.AccAddress + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI + NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI +} + +// BankKeeper defines the contract needed for supply related APIs. +// +//go:generate mockery --name BankKeeper --filename mock_bank_keeper.go +type BankKeeper interface { + IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error + SendCoins(ctx context.Context, from, to sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error +} + +// FeeMarketKeeper defines the expected feemarket keeper. +// +//go:generate mockery --name FeeMarketKeeper --filename mock_feemarket_keeper.go +type FeeMarketKeeper interface { + GetState(ctx sdk.Context) (feemarkettypes.State, error) + GetParams(ctx sdk.Context) (feemarkettypes.Params, error) + SetParams(ctx sdk.Context, params feemarkettypes.Params) error + SetState(ctx sdk.Context, state feemarkettypes.State) error + ResolveToDenom(ctx sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) + GetMinGasPrice(ctx sdk.Context, denom string) (sdk.DecCoin, error) + GetEnabledHeight(ctx sdk.Context) (int64, error) +} diff --git a/x/feemarket/post/fee.go b/x/feemarket/post/fee.go new file mode 100644 index 000000000000..ac13e550927b --- /dev/null +++ b/x/feemarket/post/fee.go @@ -0,0 +1,213 @@ +package post + +import ( + "fmt" + + "cosmossdk.io/math" + + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "cosmossdk.io/x/feemarket/ante" + feemarkettypes "cosmossdk.io/x/feemarket/types" +) + +// BankSendGasConsumption is the gas consumption of the bank sends that occur during feemarket handler execution. +const BankSendGasConsumption = 12490 + +// FeeMarketDeductDecorator deducts fees from the fee payer based off of the current state of the feemarket. +// The fee payer is the fee granter (if specified) or first signer of the tx. +// If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error. +// If there is an excess between the given fee and the on-chain min base fee is given as a tip. +// Call next PostHandler if fees successfully deducted. +// CONTRACT: Tx must implement FeeTx interface +type FeeMarketDeductDecorator struct { + accountKeeper AccountKeeper + bankKeeper BankKeeper + feemarketKeeper FeeMarketKeeper +} + +func NewFeeMarketDeductDecorator(ak AccountKeeper, bk BankKeeper, fmk FeeMarketKeeper) FeeMarketDeductDecorator { + return FeeMarketDeductDecorator{ + accountKeeper: ak, + bankKeeper: bk, + feemarketKeeper: fmk, + } +} + +// PostHandle deducts the fee from the fee payer based on the min base fee and the gas consumed in the gasmeter. +// If there is a difference between the provided fee and the min-base fee, the difference is paid as a tip. +// Fees are sent to the x/feemarket fee-collector address. +func (dfd FeeMarketDeductDecorator) PostHandle(ctx sdk.Context, tx sdk.Tx, simulate, success bool, next sdk.PostHandler) (sdk.Context, error) { + // GenTx consume no fee + if ctx.BlockHeight() == 0 { + return next(ctx, tx, simulate, success) + } + + feeTx, ok := tx.(sdk.FeeTx) + if !ok { + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + } + + if !simulate && ctx.BlockHeight() > 0 && feeTx.GetGas() == 0 { + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidGasLimit, "must provide positive gas") + } + + // update fee market params + params, err := dfd.feemarketKeeper.GetParams(ctx) + if err != nil { + return ctx, errorsmod.Wrapf(err, "unable to get fee market params") + } + + // return if disabled + if !params.Enabled { + return next(ctx, tx, simulate, success) + } + + enabledHeight, err := dfd.feemarketKeeper.GetEnabledHeight(ctx) + if err != nil { + return ctx, errorsmod.Wrapf(err, "unable to get fee market enabled height") + } + + // if the current height is that which enabled the feemarket or lower, skip deduction + if ctx.BlockHeight() <= enabledHeight { + return next(ctx, tx, simulate, success) + } + + // update fee market state + state, err := dfd.feemarketKeeper.GetState(ctx) + if err != nil { + return ctx, errorsmod.Wrapf(err, "unable to get fee market state") + } + + feeCoins := feeTx.GetFee() + gas := ctx.GasMeter().GasConsumed() // use context gas consumed + + if len(feeCoins) == 0 && !simulate { + return ctx, errorsmod.Wrapf(feemarkettypes.ErrNoFeeCoins, "got length %d", len(feeCoins)) + } + if len(feeCoins) > 1 { + return ctx, errorsmod.Wrapf(feemarkettypes.ErrTooManyFeeCoins, "got length %d", len(feeCoins)) + } + + // if simulating and user did not provider a fee - create a dummy value for them + var ( + tip = sdk.NewCoin(params.FeeDenom, math.ZeroInt()) + payCoin = sdk.NewCoin(params.FeeDenom, math.ZeroInt()) + ) + if !simulate { + payCoin = feeCoins[0] + } + + feeGas := int64(feeTx.GetGas()) + + minGasPrice, err := dfd.feemarketKeeper.GetMinGasPrice(ctx, payCoin.GetDenom()) + if err != nil { + return ctx, errorsmod.Wrapf(err, "unable to get min gas price for denom %s", payCoin.GetDenom()) + } + + ctx.Logger().Info("fee deduct post handle", + "min gas prices", minGasPrice, + "gas consumed", gas, + ) + + if !simulate { + payCoin, tip, err = ante.CheckTxFee(ctx, minGasPrice, payCoin, feeGas, false) + if err != nil { + return ctx, err + } + } + + ctx.Logger().Info("fee deduct post handle", + "fee", payCoin, + "tip", tip, + ) + + if err := dfd.PayOutFeeAndTip(ctx, payCoin, tip); err != nil { + return ctx, err + } + + err = state.Update(gas, params) + if err != nil { + return ctx, errorsmod.Wrapf(err, "unable to update fee market state") + } + + err = dfd.feemarketKeeper.SetState(ctx, state) + if err != nil { + return ctx, errorsmod.Wrapf(err, "unable to set fee market state") + } + + if simulate { + // consume the gas that would be consumed during normal execution + ctx.GasMeter().ConsumeGas(BankSendGasConsumption, "simulation send gas consumption") + } + + return next(ctx, tx, simulate, success) +} + +// PayOutFeeAndTip deducts the provided fee and tip from the fee payer. +// If the tx uses a feegranter, the fee granter address will pay the fee instead of the tx signer. +func (dfd FeeMarketDeductDecorator) PayOutFeeAndTip(ctx sdk.Context, fee, tip sdk.Coin) error { + params, err := dfd.feemarketKeeper.GetParams(ctx) + if err != nil { + return fmt.Errorf("error getting feemarket params: %v", err) + } + + var events sdk.Events + + // deduct the fees and tip + if !fee.IsNil() { + err := DeductCoins(dfd.bankKeeper, ctx, sdk.NewCoins(fee), params.DistributeFees) + if err != nil { + return err + } + + events = append(events, sdk.NewEvent( + feemarkettypes.EventTypeFeePay, + sdk.NewAttribute(sdk.AttributeKeyFee, fee.String()), + )) + } + + proposer := sdk.AccAddress(ctx.BlockHeader().ProposerAddress) + if !tip.IsNil() { + err := SendTip(dfd.bankKeeper, ctx, proposer, sdk.NewCoins(tip)) + if err != nil { + return err + } + + events = append(events, sdk.NewEvent( + feemarkettypes.EventTypeTipPay, + sdk.NewAttribute(feemarkettypes.AttributeKeyTip, tip.String()), + sdk.NewAttribute(feemarkettypes.AttributeKeyTipPayee, proposer.String()), + )) + } + + ctx.EventManager().EmitEvents(events) + return nil +} + +// DeductCoins deducts coins from the given account. +// Coins can be sent to the default fee collector ( +// causes coins to be distributed to stakers) or kept in the fee collector account (soft burn). +func DeductCoins(bankKeeper BankKeeper, ctx sdk.Context, coins sdk.Coins, distributeFees bool) error { + if distributeFees { + err := bankKeeper.SendCoinsFromModuleToModule(ctx, feemarkettypes.FeeCollectorName, authtypes.FeeCollectorName, coins) + if err != nil { + return err + } + } + return nil +} + +// SendTip sends a tip to the current block proposer. +func SendTip(bankKeeper BankKeeper, ctx sdk.Context, proposer sdk.AccAddress, coins sdk.Coins) error { + err := bankKeeper.SendCoinsFromModuleToAccount(ctx, feemarkettypes.FeeCollectorName, proposer, coins) + if err != nil { + return err + } + + return nil +} diff --git a/x/feemarket/post/fee_test.go b/x/feemarket/post/fee_test.go new file mode 100644 index 000000000000..5543c1be5ca6 --- /dev/null +++ b/x/feemarket/post/fee_test.go @@ -0,0 +1,994 @@ +package post_test + +import ( + "fmt" + "testing" + + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/mock" + + antesuite "cosmossdk.io/x/feemarket/ante/suite" + "cosmossdk.io/x/feemarket/post" + "cosmossdk.io/x/feemarket/types" +) + +const govModuleName = "gov" + +func TestDeductCoins(t *testing.T) { + tests := []struct { + name string + coins sdk.Coins + distributeFees bool + wantErr bool + }{ + { + name: "valid", + coins: sdk.NewCoins(sdk.NewCoin("test", math.NewInt(10))), + distributeFees: false, + wantErr: false, + }, + { + name: "valid no coins", + coins: sdk.NewCoins(), + distributeFees: false, + wantErr: false, + }, + { + name: "valid zero coin", + coins: sdk.NewCoins(sdk.NewCoin("test", math.ZeroInt())), + distributeFees: false, + wantErr: false, + }, + { + name: "valid - distribute", + coins: sdk.NewCoins(sdk.NewCoin("test", math.NewInt(10))), + distributeFees: true, + wantErr: false, + }, + { + name: "valid no coins - distribute", + coins: sdk.NewCoins(), + distributeFees: true, + wantErr: false, + }, + { + name: "valid zero coin - distribute", + coins: sdk.NewCoins(sdk.NewCoin("test", math.ZeroInt())), + distributeFees: true, + wantErr: false, + }, + } + for _, tc := range tests { + t.Run(fmt.Sprintf("Case %s", tc.name), func(t *testing.T) { + s := antesuite.SetupTestSuite(t, true) + if tc.distributeFees { + s.MockBankKeeper.On("SendCoinsFromModuleToModule", s.Ctx, types.FeeCollectorName, + authtypes.FeeCollectorName, + tc.coins).Return(nil).Once() + } + + if err := post.DeductCoins(s.MockBankKeeper, s.Ctx, tc.coins, tc.distributeFees); (err != nil) != tc.wantErr { + s.Errorf(err, "DeductCoins() error = %v, wantErr %v", err, tc.wantErr) + } + }) + } +} + +func TestDeductCoinsAndDistribute(t *testing.T) { + tests := []struct { + name string + coins sdk.Coins + wantErr bool + }{ + { + name: "valid", + coins: sdk.NewCoins(sdk.NewCoin("test", math.NewInt(10))), + wantErr: false, + }, + { + name: "valid no coins", + coins: sdk.NewCoins(), + wantErr: false, + }, + { + name: "valid zero coin", + coins: sdk.NewCoins(sdk.NewCoin("test", math.ZeroInt())), + wantErr: false, + }, + } + for _, tc := range tests { + t.Run(fmt.Sprintf("Case %s", tc.name), func(t *testing.T) { + s := antesuite.SetupTestSuite(t, true) + s.MockBankKeeper.On("SendCoinsFromModuleToModule", s.Ctx, types.FeeCollectorName, authtypes.FeeCollectorName, + tc.coins).Return(nil).Once() + + if err := post.DeductCoins(s.MockBankKeeper, s.Ctx, tc.coins, true); (err != nil) != tc.wantErr { + s.Errorf(err, "DeductCoins() error = %v, wantErr %v", err, tc.wantErr) + } + }) + } +} + +func TestSendTip(t *testing.T) { + tests := []struct { + name string + coins sdk.Coins + wantErr bool + }{ + { + name: "valid", + coins: sdk.NewCoins(sdk.NewCoin("test", math.NewInt(10))), + wantErr: false, + }, + { + name: "valid no coins", + coins: sdk.NewCoins(), + wantErr: false, + }, + { + name: "valid zero coin", + coins: sdk.NewCoins(sdk.NewCoin("test", math.ZeroInt())), + wantErr: false, + }, + } + for _, tc := range tests { + t.Run(fmt.Sprintf("Case %s", tc.name), func(t *testing.T) { + s := antesuite.SetupTestSuite(t, true) + accs := s.CreateTestAccounts(2) + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", s.Ctx, types.FeeCollectorName, mock.Anything, + tc.coins).Return(nil).Once() + + if err := post.SendTip(s.MockBankKeeper, s.Ctx, accs[1].Account.GetAddress(), tc.coins); (err != nil) != tc.wantErr { + s.Errorf(err, "SendTip() error = %v, wantErr %v", err, tc.wantErr) + } + }) + } +} + +func TestPostHandleMock(t *testing.T) { + // Same data for every test case + const ( + baseDenom = "stake" + resolvableDenom = "atom" + expectedConsumedGas = 10631 + expectedConsumedSimGas = expectedConsumedGas + post.BankSendGasConsumption + gasLimit = expectedConsumedSimGas + ) + + validFeeAmount := types.DefaultMinBaseGasPrice.MulInt64(int64(gasLimit)) + validFeeAmountWithTip := validFeeAmount.Add(math.LegacyNewDec(100)) + validFee := sdk.NewCoins(sdk.NewCoin(baseDenom, validFeeAmount.TruncateInt())) + validFeeWithTip := sdk.NewCoins(sdk.NewCoin(baseDenom, validFeeAmountWithTip.TruncateInt())) + validResolvableFee := sdk.NewCoins(sdk.NewCoin(resolvableDenom, validFeeAmount.TruncateInt())) + validResolvableFeeWithTip := sdk.NewCoins(sdk.NewCoin(resolvableDenom, validFeeAmountWithTip.TruncateInt())) + + testCases := []antesuite.TestCase{ + { + Name: "signer has no funds", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(sdkerrors.ErrInsufficientFunds).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrInsufficientFunds, + Mock: true, + }, + { + Name: "signer has no funds - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(sdkerrors.ErrInsufficientFunds).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: false, + ExpErr: sdkerrors.ErrInsufficientFunds, + Mock: true, + }, + { + Name: "0 gas given should fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: true, + }, + { + Name: "0 gas given should pass - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedSimGas, + Mock: true, + }, + { + Name: "signer has enough funds, should pass, no tip", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil) + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: true, + }, + { + Name: "signer has enough funds, should pass with tip", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: true, + }, + { + Name: "signer has enough funds, should pass with tip - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedSimGas, + Mock: true, + }, + { + Name: "fee market is enabled during the transaction - should pass and skip deduction until next block", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + // disable fee market before tx + s.Ctx = s.Ctx.WithBlockHeight(10) + disabledParams := types.DefaultParams() + disabledParams.Enabled = false + err := s.FeeMarketKeeper.SetParams(s.Ctx, disabledParams) + s.Require().NoError(err) + + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + authtypes.FeeCollectorName, mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFee, + } + }, + StateUpdate: func(s *antesuite.TestSuite) { + // enable the fee market + enabledParams := types.DefaultParams() + req := &types.MsgParams{ + Authority: authtypes.NewModuleAddress(govModuleName).String(), + Params: enabledParams, + } + + _, err := s.MsgServer.Params(s.Ctx, req) + s.Require().NoError(err) + + height, err := s.FeeMarketKeeper.GetEnabledHeight(s.Ctx) + s.Require().NoError(err) + s.Require().Equal(int64(10), height) + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: 15340, // extra gas consumed because msg server is run, but deduction is skipped + Mock: true, + }, + { + Name: "signer has enough funds, should pass, no tip - resolvable denom", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, + mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: true, + }, + { + Name: "signer has enough funds, should pass, no tip - resolvable denom - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedSimGas, + Mock: true, + }, + { + Name: "signer has enough funds, should pass with tip - resolvable denom", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: true, + }, + { + Name: "signer has enough funds, should pass with tip - resolvable denom - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedSimGas, + Mock: true, + }, + { + Name: "0 gas given should pass in simulate - no fee", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedSimGas, + Mock: true, + }, + { + Name: "0 gas given should pass in simulate - fee", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedSimGas, + Mock: true, + }, + { + Name: "no fee - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 1000000000, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: types.ErrNoFeeCoins, + Mock: true, + }, + { + Name: "no gas limit - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: true, + }, + } + + for _, tc := range testCases { + t.Run(fmt.Sprintf("Case %s", tc.Name), func(t *testing.T) { + s := antesuite.SetupTestSuite(t, tc.Mock) + s.TxBuilder = s.ClientCtx.TxConfig.NewTxBuilder() + args := tc.Malleate(s) + + s.RunTestCase(t, tc, args) + }) + } +} + +func TestPostHandle(t *testing.T) { + // Same data for every test case + const ( + baseDenom = "stake" + resolvableDenom = "atom" + expectedConsumedGas = 36650 + + expectedConsumedGasResolve = 36524 // slight difference due to denom resolver + + gasLimit = 100000 + ) + + validFeeAmount := types.DefaultMinBaseGasPrice.MulInt64(int64(gasLimit)) + validFeeAmountWithTip := validFeeAmount.Add(math.LegacyNewDec(100)) + validFee := sdk.NewCoins(sdk.NewCoin(baseDenom, validFeeAmount.TruncateInt())) + validFeeWithTip := sdk.NewCoins(sdk.NewCoin(baseDenom, validFeeAmountWithTip.TruncateInt())) + validResolvableFee := sdk.NewCoins(sdk.NewCoin(resolvableDenom, validFeeAmount.TruncateInt())) + validResolvableFeeWithTip := sdk.NewCoins(sdk.NewCoin(resolvableDenom, validFeeAmountWithTip.TruncateInt())) + + testCases := []antesuite.TestCase{ + { + Name: "signer has no funds", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrInsufficientFunds, + Mock: false, + }, + { + Name: "signer has no funds - simulate - pass", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + Mock: false, + ExpectConsumedGas: expectedConsumedGas, + }, + { + Name: "0 gas given should fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: false, + }, + { + Name: "0 gas given should pass - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: false, + }, + { + Name: "signer has enough funds, should pass, no tip", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validFee, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: 36650, + Mock: false, + }, + { + Name: "signer has does not have enough funds for fee and tip - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validFee, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrInsufficientFunds, + Mock: false, + }, + { + Name: "signer has enough funds, should pass with tip", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validFeeWithTip, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: 36650, + Mock: false, + }, + { + Name: "signer has enough funds, should pass with tip - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: false, + }, + { + Name: "fee market is enabled during the transaction - should pass and skip deduction until next block", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validResolvableFee, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + // disable fee market before tx + s.Ctx = s.Ctx.WithBlockHeight(10) + disabledParams := types.DefaultParams() + disabledParams.Enabled = false + err := s.FeeMarketKeeper.SetParams(s.Ctx, disabledParams) + s.Require().NoError(err) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFee, + } + }, + StateUpdate: func(s *antesuite.TestSuite) { + // enable the fee market + enabledParams := types.DefaultParams() + req := &types.MsgParams{ + Authority: authtypes.NewModuleAddress(govModuleName).String(), + Params: enabledParams, + } + + _, err := s.MsgServer.Params(s.Ctx, req) + s.Require().NoError(err) + + height, err := s.FeeMarketKeeper.GetEnabledHeight(s.Ctx) + s.Require().NoError(err) + s.Require().Equal(int64(10), height) + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: 15340, // extra gas consumed because msg server is run, but bank keepers are skipped + Mock: false, + }, + { + Name: "signer has enough funds, should pass, no tip - resolvable denom", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validResolvableFee, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGasResolve, + Mock: false, + }, + { + Name: "signer has enough funds, should pass, no tip - resolvable denom - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validResolvableFee, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: false, + }, + { + Name: "signer has no balance, should pass, no tip - resolvable denom - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFee, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: false, + }, + { + Name: "signer does not have enough funds, fail - resolvable denom", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validResolvableFee, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrInsufficientFunds, + Mock: false, + }, + { + Name: "signer has enough funds, should pass with tip - resolvable denom", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + balance := antesuite.TestAccountBalance{ + TestAccount: accs[0], + Coins: validResolvableFeeWithTip, + } + s.SetAccountBalances([]antesuite.TestAccountBalance{balance}) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGasResolve, + Mock: false, + }, + { + Name: "signer has enough funds, should pass with tip - resolvable denom - simulate", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validResolvableFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: false, + }, + { + Name: "0 gas given should pass in simulate - no fee", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: false, + }, + { + Name: "0 gas given should pass in simulate - fee", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: validFee, + } + }, + RunAnte: true, + RunPost: false, + Simulate: true, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: false, + }, + { + Name: "no fee - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 1000000000, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: types.ErrNoFeeCoins, + Mock: false, + }, + { + Name: "no gas limit - fail", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: 0, + FeeAmount: nil, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: false, + ExpErr: sdkerrors.ErrOutOfGas, + Mock: false, + }, + } + + for _, tc := range testCases { + t.Run(fmt.Sprintf("Case %s", tc.Name), func(t *testing.T) { + s := antesuite.SetupTestSuite(t, tc.Mock) + s.TxBuilder = s.ClientCtx.TxConfig.NewTxBuilder() + args := tc.Malleate(s) + + s.RunTestCase(t, tc, args) + }) + } +} diff --git a/x/feemarket/post/mocks/mock_account_keeper.go b/x/feemarket/post/mocks/mock_account_keeper.go new file mode 100644 index 000000000000..1882847e0653 --- /dev/null +++ b/x/feemarket/post/mocks/mock_account_keeper.go @@ -0,0 +1,136 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper is an autogenerated mock type for the AccountKeeper type +type AccountKeeper struct { + mock.Mock +} + +// GetAccount provides a mock function with given fields: ctx, addr +func (_m *AccountKeeper) GetAccount(ctx context.Context, addr types.AccAddress) types.AccountI { + ret := _m.Called(ctx, addr) + + if len(ret) == 0 { + panic("no return value specified for GetAccount") + } + + var r0 types.AccountI + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) types.AccountI); ok { + r0 = rf(ctx, addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.AccountI) + } + } + + return r0 +} + +// GetModuleAccount provides a mock function with given fields: ctx, name +func (_m *AccountKeeper) GetModuleAccount(ctx context.Context, name string) types.ModuleAccountI { + ret := _m.Called(ctx, name) + + if len(ret) == 0 { + panic("no return value specified for GetModuleAccount") + } + + var r0 types.ModuleAccountI + if rf, ok := ret.Get(0).(func(context.Context, string) types.ModuleAccountI); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.ModuleAccountI) + } + } + + return r0 +} + +// GetModuleAddress provides a mock function with given fields: moduleName +func (_m *AccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { + ret := _m.Called(moduleName) + + if len(ret) == 0 { + panic("no return value specified for GetModuleAddress") + } + + var r0 types.AccAddress + if rf, ok := ret.Get(0).(func(string) types.AccAddress); ok { + r0 = rf(moduleName) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.AccAddress) + } + } + + return r0 +} + +// GetParams provides a mock function with given fields: ctx +func (_m *AccountKeeper) GetParams(ctx context.Context) authtypes.Params { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetParams") + } + + var r0 authtypes.Params + if rf, ok := ret.Get(0).(func(context.Context) authtypes.Params); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(authtypes.Params) + } + + return r0 +} + +// NewAccountWithAddress provides a mock function with given fields: ctx, addr +func (_m *AccountKeeper) NewAccountWithAddress(ctx context.Context, addr types.AccAddress) types.AccountI { + ret := _m.Called(ctx, addr) + + if len(ret) == 0 { + panic("no return value specified for NewAccountWithAddress") + } + + var r0 types.AccountI + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) types.AccountI); ok { + r0 = rf(ctx, addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.AccountI) + } + } + + return r0 +} + +// SetAccount provides a mock function with given fields: ctx, acc +func (_m *AccountKeeper) SetAccount(ctx context.Context, acc types.AccountI) { + _m.Called(ctx, acc) +} + +// NewAccountKeeper creates a new instance of AccountKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAccountKeeper(t interface { + mock.TestingT + Cleanup(func()) +}, +) *AccountKeeper { + mock := &AccountKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/x/feemarket/post/mocks/mock_bank_keeper.go b/x/feemarket/post/mocks/mock_bank_keeper.go new file mode 100644 index 000000000000..19cfc102751b --- /dev/null +++ b/x/feemarket/post/mocks/mock_bank_keeper.go @@ -0,0 +1,128 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// BankKeeper is an autogenerated mock type for the BankKeeper type +type BankKeeper struct { + mock.Mock +} + +// IsSendEnabledCoins provides a mock function with given fields: ctx, coins +func (_m *BankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types.Coin) error { + _va := make([]interface{}, len(coins)) + for _i := range coins { + _va[_i] = coins[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for IsSendEnabledCoins") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ...types.Coin) error); ok { + r0 = rf(ctx, coins...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendCoins provides a mock function with given fields: ctx, from, to, amt +func (_m *BankKeeper) SendCoins(ctx context.Context, from types.AccAddress, to types.AccAddress, amt types.Coins) error { + ret := _m.Called(ctx, from, to, amt) + + if len(ret) == 0 { + panic("no return value specified for SendCoins") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.AccAddress, types.Coins) error); ok { + r0 = rf(ctx, from, to, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendCoinsFromAccountToModule provides a mock function with given fields: ctx, senderAddr, recipientModule, amt +func (_m *BankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { + ret := _m.Called(ctx, senderAddr, recipientModule, amt) + + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromAccountToModule") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, string, types.Coins) error); ok { + r0 = rf(ctx, senderAddr, recipientModule, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendCoinsFromModuleToAccount provides a mock function with given fields: ctx, senderModule, recipientAddr, amt +func (_m *BankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { + ret := _m.Called(ctx, senderModule, recipientAddr, amt) + + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromModuleToAccount") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, types.AccAddress, types.Coins) error); ok { + r0 = rf(ctx, senderModule, recipientAddr, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendCoinsFromModuleToModule provides a mock function with given fields: ctx, senderModule, recipientModule, amt +func (_m *BankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt types.Coins) error { + ret := _m.Called(ctx, senderModule, recipientModule, amt) + + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromModuleToModule") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, types.Coins) error); ok { + r0 = rf(ctx, senderModule, recipientModule, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// NewBankKeeper creates a new instance of BankKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewBankKeeper(t interface { + mock.TestingT + Cleanup(func()) +}, +) *BankKeeper { + mock := &BankKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/x/feemarket/post/mocks/mock_feemarket_keeper.go b/x/feemarket/post/mocks/mock_feemarket_keeper.go new file mode 100644 index 000000000000..13aff02e9a56 --- /dev/null +++ b/x/feemarket/post/mocks/mock_feemarket_keeper.go @@ -0,0 +1,207 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + + feemarkettypes "cosmossdk.io/x/feemarket/types" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// FeeMarketKeeper is an autogenerated mock type for the FeeMarketKeeper type +type FeeMarketKeeper struct { + mock.Mock +} + +// GetEnabledHeight provides a mock function with given fields: ctx +func (_m *FeeMarketKeeper) GetEnabledHeight(ctx types.Context) (int64, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetEnabledHeight") + } + + var r0 int64 + var r1 error + if rf, ok := ret.Get(0).(func(types.Context) (int64, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(types.Context) int64); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(int64) + } + + if rf, ok := ret.Get(1).(func(types.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetMinGasPrice provides a mock function with given fields: ctx, denom +func (_m *FeeMarketKeeper) GetMinGasPrice(ctx types.Context, denom string) (types.DecCoin, error) { + ret := _m.Called(ctx, denom) + + if len(ret) == 0 { + panic("no return value specified for GetMinGasPrice") + } + + var r0 types.DecCoin + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, string) (types.DecCoin, error)); ok { + return rf(ctx, denom) + } + if rf, ok := ret.Get(0).(func(types.Context, string) types.DecCoin); ok { + r0 = rf(ctx, denom) + } else { + r0 = ret.Get(0).(types.DecCoin) + } + + if rf, ok := ret.Get(1).(func(types.Context, string) error); ok { + r1 = rf(ctx, denom) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetParams provides a mock function with given fields: ctx +func (_m *FeeMarketKeeper) GetParams(ctx types.Context) (feemarkettypes.Params, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetParams") + } + + var r0 feemarkettypes.Params + var r1 error + if rf, ok := ret.Get(0).(func(types.Context) (feemarkettypes.Params, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(types.Context) feemarkettypes.Params); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(feemarkettypes.Params) + } + + if rf, ok := ret.Get(1).(func(types.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetState provides a mock function with given fields: ctx +func (_m *FeeMarketKeeper) GetState(ctx types.Context) (feemarkettypes.State, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetState") + } + + var r0 feemarkettypes.State + var r1 error + if rf, ok := ret.Get(0).(func(types.Context) (feemarkettypes.State, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(types.Context) feemarkettypes.State); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(feemarkettypes.State) + } + + if rf, ok := ret.Get(1).(func(types.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ResolveToDenom provides a mock function with given fields: ctx, coin, denom +func (_m *FeeMarketKeeper) ResolveToDenom(ctx types.Context, coin types.DecCoin, denom string) (types.DecCoin, error) { + ret := _m.Called(ctx, coin, denom) + + if len(ret) == 0 { + panic("no return value specified for ResolveToDenom") + } + + var r0 types.DecCoin + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, types.DecCoin, string) (types.DecCoin, error)); ok { + return rf(ctx, coin, denom) + } + if rf, ok := ret.Get(0).(func(types.Context, types.DecCoin, string) types.DecCoin); ok { + r0 = rf(ctx, coin, denom) + } else { + r0 = ret.Get(0).(types.DecCoin) + } + + if rf, ok := ret.Get(1).(func(types.Context, types.DecCoin, string) error); ok { + r1 = rf(ctx, coin, denom) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SetParams provides a mock function with given fields: ctx, params +func (_m *FeeMarketKeeper) SetParams(ctx types.Context, params feemarkettypes.Params) error { + ret := _m.Called(ctx, params) + + if len(ret) == 0 { + panic("no return value specified for SetParams") + } + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, feemarkettypes.Params) error); ok { + r0 = rf(ctx, params) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SetState provides a mock function with given fields: ctx, state +func (_m *FeeMarketKeeper) SetState(ctx types.Context, state feemarkettypes.State) error { + ret := _m.Called(ctx, state) + + if len(ret) == 0 { + panic("no return value specified for SetState") + } + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, feemarkettypes.State) error); ok { + r0 = rf(ctx, state) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// NewFeeMarketKeeper creates a new instance of FeeMarketKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewFeeMarketKeeper(t interface { + mock.TestingT + Cleanup(func()) +}, +) *FeeMarketKeeper { + mock := &FeeMarketKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/x/feemarket/proto/buf.gen.gogo.yaml b/x/feemarket/proto/buf.gen.gogo.yaml new file mode 100644 index 000000000000..627ffbc6c51d --- /dev/null +++ b/x/feemarket/proto/buf.gen.gogo.yaml @@ -0,0 +1,8 @@ +version: v1 +plugins: + - name: gocosmos + out: .. + opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any + - name: grpc-gateway + out: .. + opt: logtostderr=true,allow_colon_final_segments=true diff --git a/x/feemarket/proto/buf.gen.pulsar.yaml b/x/feemarket/proto/buf.gen.pulsar.yaml new file mode 100644 index 000000000000..88a5b0419d7f --- /dev/null +++ b/x/feemarket/proto/buf.gen.pulsar.yaml @@ -0,0 +1,18 @@ +version: v1 +managed: + enabled: true + go_package_prefix: + default: cosmossdk.io/api + except: + - buf.build/googleapis/googleapis + - buf.build/cosmos/gogo-proto + - buf.build/cosmos/cosmos-proto + override: + buf.build/cosmos/cosmos-sdk: cosmossdk.io/api +plugins: + - name: go-pulsar + out: .. + opt: paths=source_relative + - name: go-grpc + out: .. + opt: paths=source_relative diff --git a/x/feemarket/proto/buf.lock b/x/feemarket/proto/buf.lock new file mode 100644 index 000000000000..07f103b9ff0b --- /dev/null +++ b/x/feemarket/proto/buf.lock @@ -0,0 +1,23 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 + - remote: buf.build + owner: cosmos + repository: cosmos-sdk + commit: 5a6ab7bc14314acaa912d5e53aef1c2f + digest: shake256:02c00c73493720055f9b57553a35b5550023a3c1914123b247956288a78fb913aff70e66552777ae14d759467e119079d484af081264a5dd607a94d9fbc8116b + - remote: buf.build + owner: cosmos + repository: gogo-proto + commit: 5e5b9fdd01804356895f8f79a6f1ddc1 + digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952 + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de diff --git a/x/feemarket/proto/buf.yaml b/x/feemarket/proto/buf.yaml new file mode 100644 index 000000000000..39f8a475e15b --- /dev/null +++ b/x/feemarket/proto/buf.yaml @@ -0,0 +1,18 @@ +version: v1 +name: buf.build/mods/feemarket +deps: + - buf.build/cosmos/cosmos-sdk # pin the Cosmos SDK version + - buf.build/cosmos/cosmos-proto + - buf.build/cosmos/gogo-proto + - buf.build/googleapis/googleapis +lint: + use: + - DEFAULT + - COMMENTS + - FILE_LOWER_SNAKE_CASE + except: + - UNARY_RPC + - COMMENT_FIELD + - SERVICE_SUFFIX + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME diff --git a/x/feemarket/proto/cosmos/feemarket/module/v1/module.proto b/x/feemarket/proto/cosmos/feemarket/module/v1/module.proto new file mode 100644 index 000000000000..3f48ef205c21 --- /dev/null +++ b/x/feemarket/proto/cosmos/feemarket/module/v1/module.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package cosmos.feemarket.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the builder module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "cosmossdk.io/x/feemarket" + }; + + // Authority defines the custom module authority. If not set, defaults to the + // governance module. + string authority = 1; +} diff --git a/x/feemarket/proto/cosmos/feemarket/v1/genesis.proto b/x/feemarket/proto/cosmos/feemarket/v1/genesis.proto new file mode 100644 index 000000000000..1f656cd79aa8 --- /dev/null +++ b/x/feemarket/proto/cosmos/feemarket/v1/genesis.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; +package cosmos.feemarket.v1; + +option go_package = "cosmossdk.io/x/feemarket/types"; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/feemarket/v1/params.proto"; + +// GenesisState defines the feemarket module's genesis state. +message GenesisState { + // Params are the parameters for the feemarket module. These parameters + // can be utilized to implement both the base EIP-1559 fee market and + // and the AIMD EIP-1559 fee market. + Params params = 1 [(gogoproto.nullable) = false]; + + // State contains the current state of the AIMD fee market. + State state = 2 [(gogoproto.nullable) = false]; +} + +// State is utilized to track the current state of the fee market. This includes +// the current base fee, learning rate, and block utilization within the +// specified AIMD window. +message State { + // BaseGasPrice is the current base fee. This is denominated in the fee per + // gas unit. + string base_gas_price = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // LearningRate is the current learning rate. + string learning_rate = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Window contains a list of the last blocks' utilization values. This is used + // to calculate the next base fee. This stores the number of units of gas + // consumed per block. + repeated uint64 window = 3; + + // Index is the index of the current block in the block utilization window. + uint64 index = 4; +} diff --git a/x/feemarket/proto/cosmos/feemarket/v1/params.proto b/x/feemarket/proto/cosmos/feemarket/v1/params.proto new file mode 100644 index 000000000000..b5dce893cca7 --- /dev/null +++ b/x/feemarket/proto/cosmos/feemarket/v1/params.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; +package cosmos.feemarket.v1; + +option go_package = "cosmossdk.io/x/feemarket/types"; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +// Params contains the required set of parameters for the EIP1559 fee market +// plugin implementation. +message Params { + // Alpha is the amount we additively increase the learning rate + // when it is above or below the target +/- threshold. + // + // Must be > 0. + string alpha = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Beta is the amount we multiplicatively decrease the learning rate + // when it is within the target +/- threshold. + // + // Must be [0, 1]. + string beta = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Gamma is the threshold for the learning rate. If the learning rate is + // above or below the target +/- threshold, we additively increase the + // learning rate by Alpha. Otherwise, we multiplicatively decrease the + // learning rate by Beta. + // + // Must be [0, 0.5]. + string gamma = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Delta is the amount we additively increase/decrease the gas price when the + // net block utilization difference in the window is above/below the target + // utilization. + string delta = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // MinBaseGasPrice determines the initial gas price of the module and the + // global minimum for the network. + string min_base_gas_price = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // MinLearningRate is the lower bound for the learning rate. + string min_learning_rate = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // MaxLearningRate is the upper bound for the learning rate. + string max_learning_rate = 7 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // MaxBlockUtilization is the maximum block utilization. + uint64 max_block_utilization = 8; + + // Window defines the window size for calculating an adaptive learning rate + // over a moving window of blocks. + uint64 window = 9; + + // FeeDenom is the denom that will be used for all fee payments. + string fee_denom = 10; + + // Enabled is a boolean that determines whether the EIP1559 fee market is + // enabled. + bool enabled = 11; + + // DistributeFees is a boolean that determines whether the fees are burned or + // distributed to all stakers. + bool distribute_fees = 12; +} diff --git a/x/feemarket/proto/cosmos/feemarket/v1/query.proto b/x/feemarket/proto/cosmos/feemarket/v1/query.proto new file mode 100644 index 000000000000..bf8875baa9b5 --- /dev/null +++ b/x/feemarket/proto/cosmos/feemarket/v1/query.proto @@ -0,0 +1,85 @@ +syntax = "proto3"; +package cosmos.feemarket.v1; + +option go_package = "cosmossdk.io/x/feemarket/types"; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "amino/amino.proto"; +import "cosmos/feemarket/v1/params.proto"; +import "cosmos/feemarket/v1/genesis.proto"; + +// Query Service for the feemarket module. +service Query { + // Params returns the current feemarket module parameters. + rpc Params(ParamsRequest) returns (ParamsResponse) { + option (google.api.http) = { + get: "/feemarket/v1/params" + }; + }; + + // State returns the current feemarket module state. + rpc State(StateRequest) returns (StateResponse) { + option (google.api.http) = { + get: "/feemarket/v1/state" + }; + }; + + // GasPrice returns the current feemarket module gas price + // for specified denom. + rpc GasPrice(GasPriceRequest) returns (GasPriceResponse) { + option (google.api.http) = { + get: "/feemarket/v1/gas_price/{denom}" + }; + }; + + // GasPrices returns the current feemarket module list of gas prices + // in all available denoms. + rpc GasPrices(GasPricesRequest) returns (GasPricesResponse) { + option (google.api.http) = { + get: "/feemarket/v1/gas_prices" + }; + }; +} + +// ParamsRequest is the request type for the Query/Params RPC method. +message ParamsRequest {} + +// ParamsResponse is the response type for the Query/Params RPC method. +message ParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +// StateRequest is the request type for the Query/State RPC method. +message StateRequest {} + +// StateResponse is the response type for the Query/State RPC method. +message StateResponse { + State state = 1 [(gogoproto.nullable) = false]; +} + +// GasPriceRequest is the request type for the Query/GasPrice RPC method. +message GasPriceRequest { + // denom we are querying gas price in + string denom = 1; +} + +// GasPriceResponse is the response type for the Query/GasPrice RPC method. +// Returns a gas price in specified denom. +message GasPriceResponse { + cosmos.base.v1beta1.DecCoin price = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// GasPriceRequest is the request type for the Query/GasPrices RPC method. +message GasPricesRequest {} + +// GasPricesResponse is the response type for the Query/GasPrices RPC method. +// Returns a gas price in all available denoms. +message GasPricesResponse { + repeated cosmos.base.v1beta1.DecCoin prices = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; +} diff --git a/x/feemarket/proto/cosmos/feemarket/v1/tx.proto b/x/feemarket/proto/cosmos/feemarket/v1/tx.proto new file mode 100644 index 000000000000..588ae83ebef4 --- /dev/null +++ b/x/feemarket/proto/cosmos/feemarket/v1/tx.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; +package cosmos.feemarket.v1; + +import "cosmos/feemarket/v1/params.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "cosmossdk.io/x/feemarket/types"; + +// Message service defines the types of messages supported by the feemarket +// module. +service Msg { + option (cosmos.msg.v1.service) = true; + + // Params defines a method for updating the feemarket module parameters. + rpc Params(MsgParams) returns (MsgParamsResponse); +} + +// MsgParams defines the Msg/Params request type. It contains the +// new parameters for the feemarket module. +message MsgParams { + option (cosmos.msg.v1.signer) = "authority"; + + // Params defines the new parameters for the feemarket module. + Params params = 1 [(gogoproto.nullable) = false]; + // Authority defines the authority that is updating the feemarket module + // parameters. + string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgParamsResponse defines the Msg/Params response type. +message MsgParamsResponse {} diff --git a/x/feemarket/testutils/keeper.go b/x/feemarket/testutils/keeper.go new file mode 100644 index 000000000000..29b9f51097dc --- /dev/null +++ b/x/feemarket/testutils/keeper.go @@ -0,0 +1,83 @@ +// Package keeper provides methods to initialize SDK keepers with local storage for test purposes +package keeper + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + feemarketkeeper "cosmossdk.io/x/feemarket/keeper" + feemarkettypes "cosmossdk.io/x/feemarket/types" +) + +const govModuleName = "gov" + +// TestKeepers holds all keepers used during keeper tests for all modules +type TestKeepers struct { + FeeMarketKeeper *feemarketkeeper.Keeper +} + +// TestMsgServers holds all message servers used during keeper tests for all modules +type TestMsgServers struct { + FeeMarketMsgServer feemarkettypes.MsgServer +} + +var additionalMaccPerms = map[string][]string{ + feemarkettypes.ModuleName: nil, + feemarkettypes.FeeCollectorName: {authtypes.Burner}, +} + +// NewTestSetup returns initialized instances of all the keepers and message servers of the modules +func NewTestSetup(t testing.TB) (sdk.Context, TestKeepers, TestMsgServers) { + // options = append(options, testkeeper.WithAdditionalModuleAccounts(additionalMaccPerms)) + + // _, tk, tms := testkeeper.NewTestSetup(t, options...) + + // // initialize extra keeper + // feeMarketKeeper := FeeMarket(tk.Initializer, tk.AccountKeeper) + // require.NoError(t, tk.Initializer.LoadLatest()) + + // // initialize msg servers + // feeMarketMsgSrv := feemarketkeeper.NewMsgServer(feeMarketKeeper) + + // ctx := sdk.NewContext(tk.Initializer.StateStore, tmproto.Header{ + // Time: testkeeper.ExampleTimestamp, + // Height: testkeeper.ExampleHeight, + // }, false, log.NewNopLogger()) + + // err := feeMarketKeeper.SetState(ctx, feemarkettypes.DefaultState()) + // require.NoError(t, err) + // err = feeMarketKeeper.SetParams(ctx, feemarkettypes.DefaultParams()) + // require.NoError(t, err) + + // testKeepers := TestKeepers{ + // TestKeepers: tk, + // FeeMarketKeeper: feeMarketKeeper, + // } + + // testMsgServers := TestMsgServers{ + // TestMsgServers: tms, + // FeeMarketMsgServer: feeMarketMsgSrv, + // } + + // return ctx, testKeepers, testMsgServers + return nil, TestKeepers{}, TestMsgServers{} +} + +// FeeMarket initializes the fee market module using the testkeepers intializer. +// func FeeMarket( +// initializer any, // TODO: fix +// authKeeper authkeeper.AccountKeeper, +// ) *feemarketkeeper.Keeper { +// storeKey := storetypes.NewKVStoreKey(feemarkettypes.StoreKey) +// // initializer.StateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, initializer.DB) + +// return feemarketkeeper.NewKeeper( +// initializer.Codec, +// storeKey, +// authKeeper, +// &feemarkettypes.TestDenomResolver{}, +// authtypes.NewModuleAddress(govModuleName).String(), +// ) +// } diff --git a/x/feemarket/types/codec.go b/x/feemarket/types/codec.go new file mode 100644 index 000000000000..b70ebc6fc932 --- /dev/null +++ b/x/feemarket/types/codec.go @@ -0,0 +1,25 @@ +package types + +import ( + "cosmossdk.io/core/registry" + "github.com/cosmos/cosmos-sdk/codec/legacy" + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +// RegisterLegacyAminoCodec registers the necessary x/feemarket interfaces (messages) on the +// provided LegacyAmino codec. +func RegisterLegacyAminoCodec(cdc registry.AminoRegistrar) { + legacy.RegisterAminoMsg(cdc, &MsgParams{}, "feemarket/MsgParams") +} + +// RegisterInterfaces registers the x/feemarket interfaces (messages + msg server) on the +// provided InterfaceRegistry. +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgParams{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/feemarket/types/eip1559.go b/x/feemarket/types/eip1559.go new file mode 100644 index 000000000000..b42757c0f107 --- /dev/null +++ b/x/feemarket/types/eip1559.go @@ -0,0 +1,81 @@ +package types + +import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Note: We use the same default values as Ethereum for the EIP-1559 +// fee market implementation. These parameters do not implement the +// AIMD learning rate adjustment algorithm. + +var ( + // DefaultWindow is the default window size for the sliding window + // used to calculate the base fee. In the base EIP-1559 implementation, + // only the previous block is considered. + DefaultWindow uint64 = 1 + + // DefaultAlpha is not used in the base EIP-1559 implementation. + DefaultAlpha = math.LegacyMustNewDecFromStr("0.0") + + // DefaultBeta is not used in the base EIP-1559 implementation. + DefaultBeta = math.LegacyMustNewDecFromStr("1.0") + + // DefaultGamma is not used in the base EIP-1559 implementation. + DefaultGamma = math.LegacyMustNewDecFromStr("0.0") + + // DefaultDelta is not used in the base EIP-1559 implementation. + DefaultDelta = math.LegacyMustNewDecFromStr("0.0") + + // DefaultMaxBlockUtilization is the default maximum block utilization. This is the default + // on Ethereum. This denominated in units of gas consumed in a block. + DefaultMaxBlockUtilization uint64 = 30_000_000 + + // DefaultMinBaseGasPrice is the default minimum base fee. + DefaultMinBaseGasPrice = math.LegacyOneDec() + + // DefaultMinLearningRate is not used in the base EIP-1559 implementation. + DefaultMinLearningRate = math.LegacyMustNewDecFromStr("0.125") + + // DefaultMaxLearningRate is not used in the base EIP-1559 implementation. + DefaultMaxLearningRate = math.LegacyMustNewDecFromStr("0.125") + + // DefaultFeeDenom is the Cosmos SDK default bond denom. + DefaultFeeDenom = sdk.DefaultBondDenom +) + +// DefaultParams returns a default set of parameters that implements +// the EIP-1559 fee market implementation without the AIMD learning +// rate adjustment algorithm. +func DefaultParams() Params { + return NewParams( + DefaultWindow, + DefaultAlpha, + DefaultBeta, + DefaultGamma, + DefaultDelta, + DefaultMaxBlockUtilization, + DefaultMinBaseGasPrice, + DefaultMinLearningRate, + DefaultMaxLearningRate, + DefaultFeeDenom, + true, + ) +} + +// DefaultState returns the default state for the EIP-1559 fee market +// implementation without the AIMD learning rate adjustment algorithm. +func DefaultState() State { + return NewState( + DefaultWindow, + DefaultMinBaseGasPrice, + DefaultMinLearningRate, + ) +} + +// DefaultGenesisState returns a default genesis state that implements +// the EIP-1559 fee market implementation without the AIMD learning +// rate adjustment algorithm. +func DefaultGenesisState() *GenesisState { + return NewGenesisState(DefaultParams(), DefaultState()) +} diff --git a/x/feemarket/types/eip1559_aimd.go b/x/feemarket/types/eip1559_aimd.go new file mode 100644 index 000000000000..ac074740b700 --- /dev/null +++ b/x/feemarket/types/eip1559_aimd.go @@ -0,0 +1,90 @@ +package types + +import "cosmossdk.io/math" + +// Note: The following constants are the default values for the AIMD EIP-1559 +// fee market implementation. This implements an adjustable learning rate +// algorithm that is not present in the base EIP-1559 implementation. + +var ( + // DefaultAIMDWindow is the default window size for the sliding window + // used to calculate the base fee. + DefaultAIMDWindow uint64 = 8 + + // DefaultAIMDAlpha is the default alpha value for the learning + // rate calculation. This value determines how much we want to additively + // increase the learning rate when the target block size is exceeded. + DefaultAIMDAlpha = math.LegacyMustNewDecFromStr("0.025") + + // DefaultAIMDBeta is the default beta value for the learning rate + // calculation. This value determines how much we want to multiplicatively + // decrease the learning rate when the target utilization is not met. + DefaultAIMDBeta = math.LegacyMustNewDecFromStr("0.95") + + // DefaultAIMDGamma is the default threshold for determining whether + // to increase or decrease the learning rate. In this case, we increase + // the learning rate if the block utilization within the window is greater + // than 0.75 or less than 0.25. Otherwise, we multiplicatively decrease + // the learning rate. + DefaultAIMDGamma = math.LegacyMustNewDecFromStr("0.25") + + // DefaultAIMDDelta is the default delta value for how much we additively + // increase or decrease the base fee when the net block utilization within + // the window is not equal to the target utilization. + DefaultAIMDDelta = math.LegacyMustNewDecFromStr("0.0") + + // DefaultAIMDMaxBlockSize is the default maximum block utilization. + // This is the default on Ethereum. This denominated in units of gas + // consumed in a block. + DefaultAIMDMaxBlockSize uint64 = 30_000_000 + + // DefaultAIMDMinBaseFee is the default minimum base fee. + DefaultAIMDMinBaseFee = math.LegacyMustNewDecFromStr("1000000000") + + // DefaultAIMDMinLearningRate is the default minimum learning rate. + DefaultAIMDMinLearningRate = math.LegacyMustNewDecFromStr("0.01") + + // DefaultAIMDMaxLearningRate is the default maximum learning rate. + DefaultAIMDMaxLearningRate = math.LegacyMustNewDecFromStr("0.50") + + // DefaultAIMDFeeDenom is the Cosmos SDK default bond denom. + DefaultAIMDFeeDenom = DefaultFeeDenom +) + +// DefaultAIMDParams returns a default set of parameters that implements +// the AIMD EIP-1559 fee market implementation. These parameters allow for +// the learning rate to be dynamically adjusted based on the block utilization +// within the window. +func DefaultAIMDParams() Params { + return NewParams( + DefaultAIMDWindow, + DefaultAIMDAlpha, + DefaultAIMDBeta, + DefaultAIMDGamma, + DefaultAIMDDelta, + DefaultAIMDMaxBlockSize, + DefaultAIMDMinBaseFee, + DefaultAIMDMinLearningRate, + DefaultAIMDMaxLearningRate, + DefaultAIMDFeeDenom, + true, + ) +} + +// DefaultAIMDState returns the default state for the AIMD EIP-1559 fee market +// implementation. This implementation uses a sliding window to track the +// block utilization and dynamically adjusts the learning rate based on the +// utilization within the window. +func DefaultAIMDState() State { + return NewState( + DefaultAIMDWindow, + DefaultAIMDMinBaseFee, + DefaultAIMDMinLearningRate, + ) +} + +// DefaultAIMDGenesisState returns a default genesis state that implements +// the AIMD EIP-1559 fee market implementation. +func DefaultAIMDGenesisState() *GenesisState { + return NewGenesisState(DefaultAIMDParams(), DefaultAIMDState()) +} diff --git a/x/feemarket/types/errors.go b/x/feemarket/types/errors.go new file mode 100644 index 000000000000..1fc744b29542 --- /dev/null +++ b/x/feemarket/types/errors.go @@ -0,0 +1,11 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" +) + +var ( + ErrNoFeeCoins = sdkerrors.New(ModuleName, 1, "no fee coin provided. Must provide one.") + ErrTooManyFeeCoins = sdkerrors.New(ModuleName, 2, "too many fee coins provided. Only one fee coin may be provided") + ErrResolverNotSet = sdkerrors.New(ModuleName, 3, "denom resolver interface not set. Only the feemarket base fee denomination can be used") +) diff --git a/x/feemarket/types/expected_keepers.go b/x/feemarket/types/expected_keepers.go new file mode 100644 index 000000000000..9f9dbd762395 --- /dev/null +++ b/x/feemarket/types/expected_keepers.go @@ -0,0 +1,16 @@ +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the expected account keeper (noalias) +// +//go:generate mockery --name AccountKeeper --filename mock_account_keeper.go +type AccountKeeper interface { + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + GetModuleAddress(name string) sdk.AccAddress + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI +} diff --git a/x/feemarket/types/genesis.go b/x/feemarket/types/genesis.go new file mode 100644 index 000000000000..c8ef136cff93 --- /dev/null +++ b/x/feemarket/types/genesis.go @@ -0,0 +1,35 @@ +package types + +import ( + "encoding/json" + + "github.com/cosmos/cosmos-sdk/codec" +) + +// NewGenesisState returns a new genesis state for the module. +func NewGenesisState( + params Params, + state State, +) *GenesisState { + return &GenesisState{ + Params: params, + State: state, + } +} + +// ValidateBasic performs basic validation of the genesis state data returning an +// error for any failed validation criteria. +func (gs *GenesisState) ValidateBasic() error { + if err := gs.Params.ValidateBasic(); err != nil { + return err + } + return gs.State.ValidateBasic() +} + +// GetGenesisStateFromAppState returns x/feemarket GenesisState given raw application +// genesis state. +func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) GenesisState { + var gs GenesisState + cdc.MustUnmarshalJSON(appState[ModuleName], &gs) + return gs +} diff --git a/x/feemarket/types/genesis.pb.go b/x/feemarket/types/genesis.pb.go new file mode 100644 index 000000000000..725eb1dfd3ad --- /dev/null +++ b/x/feemarket/types/genesis.pb.go @@ -0,0 +1,756 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/feemarket/v1/genesis.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// GenesisState defines the feemarket module's genesis state. +type GenesisState struct { + // Params are the parameters for the feemarket module. These parameters + // can be utilized to implement both the base EIP-1559 fee market and + // and the AIMD EIP-1559 fee market. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // State contains the current state of the AIMD fee market. + State State `protobuf:"bytes,2,opt,name=state,proto3" json:"state"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_7b9d331f7459692c, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetState() State { + if m != nil { + return m.State + } + return State{} +} + +// State is utilized to track the current state of the fee market. This includes +// the current base fee, learning rate, and block utilization within the +// specified AIMD window. +type State struct { + // BaseGasPrice is the current base fee. This is denominated in the fee per + // gas unit. + BaseGasPrice cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=base_gas_price,json=baseGasPrice,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"base_gas_price"` + // LearningRate is the current learning rate. + LearningRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=learning_rate,json=learningRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"learning_rate"` + // Window contains a list of the last blocks' utilization values. This is used + // to calculate the next base fee. This stores the number of units of gas + // consumed per block. + Window []uint64 `protobuf:"varint,3,rep,packed,name=window,proto3" json:"window,omitempty"` + // Index is the index of the current block in the block utilization window. + Index uint64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` +} + +func (m *State) Reset() { *m = State{} } +func (m *State) String() string { return proto.CompactTextString(m) } +func (*State) ProtoMessage() {} +func (*State) Descriptor() ([]byte, []int) { + return fileDescriptor_7b9d331f7459692c, []int{1} +} +func (m *State) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_State.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 *State) XXX_Merge(src proto.Message) { + xxx_messageInfo_State.Merge(m, src) +} +func (m *State) XXX_Size() int { + return m.Size() +} +func (m *State) XXX_DiscardUnknown() { + xxx_messageInfo_State.DiscardUnknown(m) +} + +var xxx_messageInfo_State proto.InternalMessageInfo + +func (m *State) GetWindow() []uint64 { + if m != nil { + return m.Window + } + return nil +} + +func (m *State) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "cosmos.feemarket.v1.GenesisState") + proto.RegisterType((*State)(nil), "cosmos.feemarket.v1.State") +} + +func init() { proto.RegisterFile("cosmos/feemarket/v1/genesis.proto", fileDescriptor_7b9d331f7459692c) } + +var fileDescriptor_7b9d331f7459692c = []byte{ + // 347 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0x3d, 0x4b, 0xc3, 0x40, + 0x18, 0xc7, 0x73, 0x36, 0x2d, 0x78, 0x56, 0x87, 0x58, 0x24, 0xb6, 0x70, 0x8d, 0x9d, 0xba, 0x78, + 0xa1, 0x0a, 0xa2, 0x6b, 0x29, 0x74, 0x71, 0x28, 0x11, 0x14, 0x5c, 0xca, 0x35, 0x7d, 0x8c, 0xa1, + 0x26, 0x57, 0x72, 0xa1, 0x2f, 0xa3, 0xdf, 0xc0, 0x0f, 0xe3, 0x87, 0xe8, 0x58, 0x9c, 0xc4, 0xa1, + 0x48, 0x0b, 0x7e, 0x0e, 0xb9, 0xdc, 0x55, 0x14, 0x32, 0xb9, 0xdd, 0xc3, 0xf3, 0xfb, 0xbf, 0x1c, + 0x0f, 0x3e, 0xf1, 0xb9, 0x88, 0xb8, 0x70, 0x1f, 0x00, 0x22, 0x96, 0x8c, 0x20, 0x75, 0x27, 0x2d, + 0x37, 0x80, 0x18, 0x44, 0x28, 0xe8, 0x38, 0xe1, 0x29, 0xb7, 0x0e, 0x15, 0x42, 0x7f, 0x10, 0x3a, + 0x69, 0x55, 0x2b, 0x01, 0x0f, 0x78, 0xb6, 0x77, 0xe5, 0x4b, 0xa1, 0xd5, 0x63, 0x85, 0xf6, 0xd5, + 0x42, 0xeb, 0xd4, 0xca, 0xc9, 0x0b, 0x1a, 0xb3, 0x84, 0x45, 0x9a, 0x68, 0x3c, 0x23, 0x5c, 0xee, + 0xaa, 0xe4, 0x9b, 0x94, 0xa5, 0x60, 0x5d, 0xe1, 0x92, 0x02, 0x6c, 0xe4, 0xa0, 0xe6, 0xde, 0x59, + 0x8d, 0xe6, 0x34, 0xa1, 0xbd, 0x0c, 0x69, 0x9b, 0x8b, 0x55, 0xdd, 0xf0, 0xb4, 0xc0, 0xba, 0xc0, + 0x45, 0x21, 0x3d, 0xec, 0x9d, 0x4c, 0x59, 0xcd, 0x55, 0x66, 0x29, 0x5a, 0xa8, 0xf0, 0xc6, 0x17, + 0xc2, 0x45, 0x15, 0x7e, 0x87, 0x0f, 0x06, 0x4c, 0x40, 0x3f, 0x60, 0xf2, 0x3b, 0xa1, 0x0f, 0x59, + 0x89, 0xdd, 0x76, 0x4b, 0xe2, 0x1f, 0xab, 0x7a, 0x4d, 0x39, 0x8a, 0xe1, 0x88, 0x86, 0xdc, 0x8d, + 0x58, 0xfa, 0x48, 0xaf, 0x21, 0x60, 0xfe, 0xbc, 0x03, 0xfe, 0xdb, 0xeb, 0x29, 0xd6, 0x81, 0x1d, + 0xf0, 0xbd, 0xb2, 0x34, 0xea, 0x32, 0xd1, 0x93, 0x36, 0xd6, 0x2d, 0xde, 0x7f, 0x02, 0x96, 0xc4, + 0x61, 0x1c, 0xf4, 0x93, 0x6d, 0xc5, 0xff, 0xf9, 0x6e, 0x7d, 0x3c, 0x59, 0xf8, 0x08, 0x97, 0xa6, + 0x61, 0x3c, 0xe4, 0x53, 0xbb, 0xe0, 0x14, 0x9a, 0xa6, 0xa7, 0x27, 0xab, 0x82, 0x8b, 0x61, 0x3c, + 0x84, 0x99, 0x6d, 0x3a, 0xa8, 0x69, 0x7a, 0x6a, 0x68, 0x5f, 0x2e, 0xd6, 0x04, 0x2d, 0xd7, 0x04, + 0x7d, 0xae, 0x09, 0x7a, 0xd9, 0x10, 0x63, 0xb9, 0x21, 0xc6, 0xfb, 0x86, 0x18, 0xf7, 0xe4, 0x4f, + 0x81, 0xd9, 0xaf, 0x83, 0xa5, 0xf3, 0x31, 0x88, 0x41, 0x29, 0xbb, 0xd6, 0xf9, 0x77, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x04, 0x85, 0x84, 0xdb, 0x3a, 0x02, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.State.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *State) 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 *State) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Index != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x20 + } + if len(m.Window) > 0 { + dAtA4 := make([]byte, len(m.Window)*10) + var j3 int + for _, num := range m.Window { + for num >= 1<<7 { + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA4[j3] = uint8(num) + j3++ + } + i -= j3 + copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintGenesis(dAtA, i, uint64(j3)) + i-- + dAtA[i] = 0x1a + } + { + size := m.LearningRate.Size() + i -= size + if _, err := m.LearningRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.BaseGasPrice.Size() + i -= size + if _, err := m.BaseGasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.State.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func (m *State) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BaseGasPrice.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.LearningRate.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Window) > 0 { + l = 0 + for _, e := range m.Window { + l += sovGenesis(uint64(e)) + } + n += 1 + sovGenesis(uint64(l)) + l + } + if m.Index != 0 { + n += 1 + sovGenesis(uint64(m.Index)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.State.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *State) 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 ErrIntOverflowGenesis + } + 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: State: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: State: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseGasPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BaseGasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LearningRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LearningRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Window = append(m.Window, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Window) == 0 { + m.Window = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Window = append(m.Window, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Window", wireType) + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/feemarket/types/genesis_test.go b/x/feemarket/types/genesis_test.go new file mode 100644 index 000000000000..e762f7e54fd4 --- /dev/null +++ b/x/feemarket/types/genesis_test.go @@ -0,0 +1,21 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "cosmossdk.io/x/feemarket/types" +) + +func TestGenesis(t *testing.T) { + t.Run("can create a new default genesis state", func(t *testing.T) { + gs := types.DefaultGenesisState() + require.NoError(t, gs.ValidateBasic()) + }) + + t.Run("can accept a valid genesis state for AIMD eip-1559", func(t *testing.T) { + gs := types.DefaultAIMDGenesisState() + require.NoError(t, gs.ValidateBasic()) + }) +} diff --git a/x/feemarket/types/keys.go b/x/feemarket/types/keys.go new file mode 100644 index 000000000000..b517601eb4f5 --- /dev/null +++ b/x/feemarket/types/keys.go @@ -0,0 +1,33 @@ +package types + +import "cosmossdk.io/collections" + +const ( + // ModuleName is the name of the feemarket module. + ModuleName = "feemarket" + // StoreKey is the store key string for the feemarket module. + StoreKey = ModuleName + + // FeeCollectorName is the root string for the fee market fee collector account address. + FeeCollectorName = "feemarket-fee-collector" +) + +var ( + // KeyParams is the store key for the feemarket module's parameters. + KeyParams = collections.NewPrefix(1) + + // KeyState is the store key for the feemarket module's data. + KeyState = collections.NewPrefix(2) + + // KeyEnabledHeight is the store key for the feemarket module's enabled height. + KeyEnabledHeight = collections.NewPrefix(3) + KeyBasePrice = collections.NewPrefix(4) + KeyLearning = collections.NewPrefix(5) + KeyIndex = collections.NewPrefix(6) + + EventTypeFeePay = "fee_pay" + EventTypeTipPay = "tip_pay" + AttributeKeyTip = "tip" + AttributeKeyTipPayer = "tip_payer" + AttributeKeyTipPayee = "tip_payee" +) diff --git a/x/feemarket/types/mocks/mock_account_keeper.go b/x/feemarket/types/mocks/mock_account_keeper.go new file mode 100644 index 000000000000..84cdcf144a5e --- /dev/null +++ b/x/feemarket/types/mocks/mock_account_keeper.go @@ -0,0 +1,91 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper is an autogenerated mock type for the AccountKeeper type +type AccountKeeper struct { + mock.Mock +} + +// GetAccount provides a mock function with given fields: ctx, addr +func (_m *AccountKeeper) GetAccount(ctx context.Context, addr types.AccAddress) types.AccountI { + ret := _m.Called(ctx, addr) + + if len(ret) == 0 { + panic("no return value specified for GetAccount") + } + + var r0 types.AccountI + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) types.AccountI); ok { + r0 = rf(ctx, addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.AccountI) + } + } + + return r0 +} + +// GetModuleAccount provides a mock function with given fields: ctx, name +func (_m *AccountKeeper) GetModuleAccount(ctx context.Context, name string) types.ModuleAccountI { + ret := _m.Called(ctx, name) + + if len(ret) == 0 { + panic("no return value specified for GetModuleAccount") + } + + var r0 types.ModuleAccountI + if rf, ok := ret.Get(0).(func(context.Context, string) types.ModuleAccountI); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.ModuleAccountI) + } + } + + return r0 +} + +// GetModuleAddress provides a mock function with given fields: name +func (_m *AccountKeeper) GetModuleAddress(name string) types.AccAddress { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for GetModuleAddress") + } + + var r0 types.AccAddress + if rf, ok := ret.Get(0).(func(string) types.AccAddress); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.AccAddress) + } + } + + return r0 +} + +// NewAccountKeeper creates a new instance of AccountKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAccountKeeper(t interface { + mock.TestingT + Cleanup(func()) +}, +) *AccountKeeper { + mock := &AccountKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/x/feemarket/types/msgs.go b/x/feemarket/types/msgs.go new file mode 100644 index 000000000000..4dc31a09bf06 --- /dev/null +++ b/x/feemarket/types/msgs.go @@ -0,0 +1,33 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgParams{} + +// NewMsgParams returns a new message to update the x/feemarket module's parameters. +func NewMsgParams(authority string, params Params) MsgParams { + return MsgParams{ + Authority: authority, + Params: params, + } +} + +// GetSigners implements GetSigners for the msg. +func (m *MsgParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic determines whether the information in the message is formatted correctly, specifically +// whether the authority is a valid acc-address. +func (m *MsgParams) ValidateBasic() error { + // validate authority address + _, err := sdk.AccAddressFromBech32(m.Authority) + if err != nil { + return err + } + + return nil +} diff --git a/x/feemarket/types/msgs_test.go b/x/feemarket/types/msgs_test.go new file mode 100644 index 000000000000..1c83da3650c0 --- /dev/null +++ b/x/feemarket/types/msgs_test.go @@ -0,0 +1,24 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "cosmossdk.io/x/feemarket/types" +) + +func TestMsgParams(t *testing.T) { + t.Run("should reject a message with an invalid authority address", func(t *testing.T) { + msg := types.NewMsgParams("invalid", types.DefaultParams()) + err := msg.ValidateBasic() + require.Error(t, err) + }) + + t.Run("should accept an empty message with a valid authority address", func(t *testing.T) { + msg := types.NewMsgParams(sdk.AccAddress("test").String(), types.DefaultParams()) + err := msg.ValidateBasic() + require.NoError(t, err) + }) +} diff --git a/x/feemarket/types/params.go b/x/feemarket/types/params.go new file mode 100644 index 000000000000..267f2b0d0b78 --- /dev/null +++ b/x/feemarket/types/params.go @@ -0,0 +1,91 @@ +package types + +import ( + fmt "fmt" + + "cosmossdk.io/math" +) + +// NewParams instantiates a new EIP-1559 Params object. This params object is utilized +// to implement both the base EIP-1559 fee and AIMD EIP-1559 fee market implementations. +func NewParams( + window uint64, + alpha math.LegacyDec, + beta math.LegacyDec, + gamma math.LegacyDec, + delta math.LegacyDec, + maxBlockSize uint64, + minBaseGasPrice math.LegacyDec, + minLearingRate math.LegacyDec, + maxLearningRate math.LegacyDec, + feeDenom string, + enabled bool, +) Params { + return Params{ + Alpha: alpha, + Beta: beta, + Gamma: gamma, + Delta: delta, + MinBaseGasPrice: minBaseGasPrice, + MinLearningRate: minLearingRate, + MaxLearningRate: maxLearningRate, + MaxBlockUtilization: maxBlockSize, + Window: window, + FeeDenom: feeDenom, + Enabled: enabled, + } +} + +// ValidateBasic performs basic validation on the parameters. +func (p *Params) ValidateBasic() error { + if p.Window == 0 { + return fmt.Errorf("window cannot be zero") + } + + if p.Alpha.IsNil() || p.Alpha.IsNegative() { + return fmt.Errorf("alpha cannot be nil must be between [0, inf)") + } + + if p.Beta.IsNil() || p.Beta.IsNegative() || p.Beta.GT(math.LegacyOneDec()) { + return fmt.Errorf("beta cannot be nil and must be between [0, 1]") + } + + if p.Gamma.IsNil() || p.Gamma.IsNegative() || p.Gamma.GT(math.LegacyMustNewDecFromStr("0.5")) { + return fmt.Errorf("theta cannot be nil and must be between [0, 0.5]") + } + + if p.Delta.IsNil() || p.Delta.IsNegative() { + return fmt.Errorf("delta cannot be nil and must be between [0, inf)") + } + + if p.MinBaseGasPrice.IsNil() || !p.MinBaseGasPrice.GTE(math.LegacyZeroDec()) { + return fmt.Errorf("min base gas price cannot be nil and must be greater than or equal to zero") + } + + if p.MaxLearningRate.IsNil() || p.MinLearningRate.IsNegative() { + return fmt.Errorf("min learning rate cannot be negative or nil") + } + + if p.MaxBlockUtilization < 2 { + return fmt.Errorf("max block utilization cannot be less than 2") + } + + if p.MaxLearningRate.IsNil() || p.MaxLearningRate.IsNegative() { + return fmt.Errorf("max learning rate cannot be negative or nil") + } + + if p.MinLearningRate.GT(p.MaxLearningRate) { + return fmt.Errorf("min learning rate cannot be greater than max learning rate") + } + + if p.FeeDenom == "" { + return fmt.Errorf("fee denom must be set") + } + + return nil +} + +// TargetBlockUtilization returns 0.5 * MaxBlockUtilization. +func (p *Params) TargetBlockUtilization() uint64 { + return p.MaxBlockUtilization / 2 +} diff --git a/x/feemarket/types/params.pb.go b/x/feemarket/types/params.pb.go new file mode 100644 index 000000000000..ff16b45f073b --- /dev/null +++ b/x/feemarket/types/params.pb.go @@ -0,0 +1,847 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/feemarket/v1/params.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// Params contains the required set of parameters for the EIP1559 fee market +// plugin implementation. +type Params struct { + // Alpha is the amount we additively increase the learning rate + // when it is above or below the target +/- threshold. + // + // Must be > 0. + Alpha cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=alpha,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"alpha"` + // Beta is the amount we multiplicatively decrease the learning rate + // when it is within the target +/- threshold. + // + // Must be [0, 1]. + Beta cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=beta,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"beta"` + // Gamma is the threshold for the learning rate. If the learning rate is + // above or below the target +/- threshold, we additively increase the + // learning rate by Alpha. Otherwise, we multiplicatively decrease the + // learning rate by Beta. + // + // Must be [0, 0.5]. + Gamma cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=gamma,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"gamma"` + // Delta is the amount we additively increase/decrease the gas price when the + // net block utilization difference in the window is above/below the target + // utilization. + Delta cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=delta,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"delta"` + // MinBaseGasPrice determines the initial gas price of the module and the + // global minimum for the network. + MinBaseGasPrice cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=min_base_gas_price,json=minBaseGasPrice,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_base_gas_price"` + // MinLearningRate is the lower bound for the learning rate. + MinLearningRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=min_learning_rate,json=minLearningRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_learning_rate"` + // MaxLearningRate is the upper bound for the learning rate. + MaxLearningRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=max_learning_rate,json=maxLearningRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"max_learning_rate"` + // MaxBlockUtilization is the maximum block utilization. + MaxBlockUtilization uint64 `protobuf:"varint,8,opt,name=max_block_utilization,json=maxBlockUtilization,proto3" json:"max_block_utilization,omitempty"` + // Window defines the window size for calculating an adaptive learning rate + // over a moving window of blocks. + Window uint64 `protobuf:"varint,9,opt,name=window,proto3" json:"window,omitempty"` + // FeeDenom is the denom that will be used for all fee payments. + FeeDenom string `protobuf:"bytes,10,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` + // Enabled is a boolean that determines whether the EIP1559 fee market is + // enabled. + Enabled bool `protobuf:"varint,11,opt,name=enabled,proto3" json:"enabled,omitempty"` + // DistributeFees is a boolean that determines whether the fees are burned or + // distributed to all stakers. + DistributeFees bool `protobuf:"varint,12,opt,name=distribute_fees,json=distributeFees,proto3" json:"distribute_fees,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_c562774a3ddf4592, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMaxBlockUtilization() uint64 { + if m != nil { + return m.MaxBlockUtilization + } + return 0 +} + +func (m *Params) GetWindow() uint64 { + if m != nil { + return m.Window + } + return 0 +} + +func (m *Params) GetFeeDenom() string { + if m != nil { + return m.FeeDenom + } + return "" +} + +func (m *Params) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func (m *Params) GetDistributeFees() bool { + if m != nil { + return m.DistributeFees + } + return false +} + +func init() { + proto.RegisterType((*Params)(nil), "cosmos.feemarket.v1.Params") +} + +func init() { proto.RegisterFile("cosmos/feemarket/v1/params.proto", fileDescriptor_c562774a3ddf4592) } + +var fileDescriptor_c562774a3ddf4592 = []byte{ + // 435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x41, 0x6e, 0xd3, 0x40, + 0x14, 0x86, 0x63, 0x48, 0xd2, 0x64, 0x40, 0x54, 0x4c, 0x01, 0x0d, 0xad, 0xe4, 0x46, 0x6c, 0xc8, + 0x06, 0x5b, 0x81, 0x0d, 0xeb, 0x28, 0xd0, 0x4d, 0x17, 0x95, 0x25, 0x36, 0x48, 0x60, 0x3d, 0xdb, + 0x2f, 0xee, 0x28, 0x9e, 0x19, 0xcb, 0x33, 0x6d, 0x5d, 0x4e, 0xc1, 0x61, 0x38, 0x44, 0x97, 0x15, + 0x2b, 0xc4, 0xa2, 0x42, 0xc9, 0x15, 0x38, 0x00, 0x9a, 0xb1, 0xa1, 0x84, 0xa5, 0xd9, 0xf9, 0xff, + 0xe7, 0xff, 0x3f, 0x3f, 0x3d, 0xe9, 0x91, 0x49, 0xaa, 0xb4, 0x50, 0x3a, 0x5c, 0x22, 0x0a, 0xa8, + 0x56, 0x68, 0xc2, 0xf3, 0x59, 0x58, 0x42, 0x05, 0x42, 0x07, 0x65, 0xa5, 0x8c, 0xa2, 0x7b, 0x4d, + 0x22, 0xf8, 0x93, 0x08, 0xce, 0x67, 0xfb, 0x4f, 0x1b, 0x33, 0x76, 0x91, 0xb0, 0x4d, 0x38, 0xb1, + 0xff, 0x28, 0x57, 0xb9, 0x6a, 0x7c, 0xfb, 0xd5, 0xb8, 0xcf, 0x7e, 0x0e, 0xc8, 0xf0, 0xc4, 0x61, + 0xe9, 0x11, 0x19, 0x40, 0x51, 0x9e, 0x02, 0xf3, 0x26, 0xde, 0x74, 0x3c, 0x9f, 0x5d, 0xdd, 0x1c, + 0xf6, 0xbe, 0xdf, 0x1c, 0x1e, 0x34, 0x14, 0x9d, 0xad, 0x02, 0xae, 0x42, 0x01, 0xe6, 0x34, 0x38, + 0xc6, 0x1c, 0xd2, 0xcb, 0x05, 0xa6, 0x5f, 0xbf, 0xbc, 0x20, 0xed, 0x4f, 0x16, 0x98, 0x46, 0x4d, + 0x9f, 0xbe, 0x21, 0xfd, 0x04, 0x0d, 0xb0, 0x3b, 0x5d, 0x39, 0xae, 0x6e, 0xe7, 0xc9, 0x41, 0x08, + 0x60, 0x77, 0x3b, 0xcf, 0xe3, 0xfa, 0x16, 0x94, 0x61, 0x61, 0x80, 0xf5, 0x3b, 0x83, 0x5c, 0x9f, + 0x7e, 0x24, 0x54, 0x70, 0x19, 0x27, 0xa0, 0x31, 0xce, 0xc1, 0x6e, 0x99, 0xa7, 0xc8, 0x06, 0x5d, + 0xa9, 0xbb, 0x82, 0xcb, 0x39, 0x68, 0x3c, 0x02, 0x7d, 0x62, 0x49, 0xf4, 0x03, 0x79, 0x68, 0xf9, + 0x05, 0x42, 0x25, 0xb9, 0xcc, 0xe3, 0x0a, 0x0c, 0xb2, 0xe1, 0xff, 0xe0, 0x8f, 0x5b, 0x54, 0x04, + 0xa6, 0xc1, 0x43, 0xfd, 0x0f, 0x7e, 0xa7, 0x3b, 0x1e, 0xea, 0x2d, 0xfc, 0x4b, 0xf2, 0xd8, 0xe2, + 0x93, 0x42, 0xa5, 0xab, 0xf8, 0xcc, 0xf0, 0x82, 0x7f, 0x02, 0xc3, 0x95, 0x64, 0xa3, 0x89, 0x37, + 0xed, 0x47, 0x7b, 0x02, 0xea, 0xb9, 0x7d, 0x7b, 0x77, 0xfb, 0x44, 0x9f, 0x90, 0xe1, 0x05, 0x97, + 0x99, 0xba, 0x60, 0x63, 0x17, 0x6a, 0x15, 0x3d, 0x20, 0xe3, 0x25, 0x62, 0x9c, 0xa1, 0x54, 0x82, + 0x11, 0x3b, 0x62, 0x34, 0x5a, 0x22, 0x2e, 0xac, 0xa6, 0x8c, 0xec, 0xa0, 0x84, 0xa4, 0xc0, 0x8c, + 0xdd, 0x9b, 0x78, 0xd3, 0x51, 0xf4, 0x5b, 0xd2, 0xe7, 0x64, 0x37, 0xe3, 0xda, 0x54, 0x3c, 0x39, + 0x33, 0x18, 0x2f, 0x11, 0x35, 0xbb, 0xef, 0x12, 0x0f, 0x6e, 0xed, 0xb7, 0x88, 0x7a, 0xfe, 0xfa, + 0x6a, 0xed, 0x7b, 0xd7, 0x6b, 0xdf, 0xfb, 0xb1, 0xf6, 0xbd, 0xcf, 0x1b, 0xbf, 0x77, 0xbd, 0xf1, + 0x7b, 0xdf, 0x36, 0x7e, 0xef, 0xbd, 0xbf, 0xb5, 0x81, 0xfa, 0xaf, 0x03, 0x34, 0x97, 0x25, 0xea, + 0x64, 0xe8, 0xee, 0xe6, 0xd5, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x48, 0x9d, 0x10, 0xa1, + 0x03, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DistributeFees { + i-- + if m.DistributeFees { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x60 + } + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if len(m.FeeDenom) > 0 { + i -= len(m.FeeDenom) + copy(dAtA[i:], m.FeeDenom) + i = encodeVarintParams(dAtA, i, uint64(len(m.FeeDenom))) + i-- + dAtA[i] = 0x52 + } + if m.Window != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.Window)) + i-- + dAtA[i] = 0x48 + } + if m.MaxBlockUtilization != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxBlockUtilization)) + i-- + dAtA[i] = 0x40 + } + { + size := m.MaxLearningRate.Size() + i -= size + if _, err := m.MaxLearningRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.MinLearningRate.Size() + i -= size + if _, err := m.MinLearningRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.MinBaseGasPrice.Size() + i -= size + if _, err := m.MinBaseGasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.Delta.Size() + i -= size + if _, err := m.Delta.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.Gamma.Size() + i -= size + if _, err := m.Gamma.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.Beta.Size() + i -= size + if _, err := m.Beta.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Alpha.Size() + i -= size + if _, err := m.Alpha.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Alpha.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.Beta.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.Gamma.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.Delta.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.MinBaseGasPrice.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.MinLearningRate.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.MaxLearningRate.Size() + n += 1 + l + sovParams(uint64(l)) + if m.MaxBlockUtilization != 0 { + n += 1 + sovParams(uint64(m.MaxBlockUtilization)) + } + if m.Window != 0 { + n += 1 + sovParams(uint64(m.Window)) + } + l = len(m.FeeDenom) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + if m.Enabled { + n += 2 + } + if m.DistributeFees { + n += 2 + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Alpha", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Alpha.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beta", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Beta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gamma", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Gamma.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delta", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Delta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinBaseGasPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinBaseGasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinLearningRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinLearningRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxLearningRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxLearningRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBlockUtilization", wireType) + } + m.MaxBlockUtilization = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxBlockUtilization |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Window", wireType) + } + m.Window = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Window |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributeFees", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DistributeFees = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/feemarket/types/params_test.go b/x/feemarket/types/params_test.go new file mode 100644 index 000000000000..6cd6cd8baaa8 --- /dev/null +++ b/x/feemarket/types/params_test.go @@ -0,0 +1,288 @@ +package types_test + +import ( + "testing" + + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + + "cosmossdk.io/x/feemarket/types" +) + +func TestParams(t *testing.T) { + testCases := []struct { + name string + p types.Params + expectedErr bool + }{ + { + name: "valid base eip-1559 params", + p: types.DefaultParams(), + expectedErr: false, + }, + { + name: "valid aimd eip-1559 params", + p: types.DefaultAIMDParams(), + expectedErr: false, + }, + { + name: "invalid window", + p: types.Params{}, + expectedErr: true, + }, + { + name: "nil alpha", + p: types.Params{ + Window: 1, + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "negative alpha", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("-0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "beta is nil", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "beta is negative", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("-0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "beta is greater than 1", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("1.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "theta is nil", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "theta is negative", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("-0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "theta is greater than 1", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("1.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "delta is nil", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "delta is negative", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("-0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "target block size is zero", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "max block size is zero", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "min base gas price is nil", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "min base has price is negative", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("-1.0"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "min learning rate is nil", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "min learning rate is negative", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + MinLearningRate: math.LegacyMustNewDecFromStr("-0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "max learning rate is nil", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + MinLearningRate: math.LegacyMustNewDecFromStr("0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "max learning rate is negative", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + MinLearningRate: math.LegacyMustNewDecFromStr("0.1"), + MaxLearningRate: math.LegacyMustNewDecFromStr("-0.1"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "min learning rate is greater than max learning rate", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + MinLearningRate: math.LegacyMustNewDecFromStr("0.1"), + MaxLearningRate: math.LegacyMustNewDecFromStr("0.05"), + FeeDenom: types.DefaultFeeDenom, + }, + expectedErr: true, + }, + { + name: "fee denom is empty", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + MinLearningRate: math.LegacyMustNewDecFromStr("0.01"), + MaxLearningRate: math.LegacyMustNewDecFromStr("0.05"), + }, + expectedErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := tc.p.ValidateBasic() + if tc.expectedErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/feemarket/types/query.pb.go b/x/feemarket/types/query.pb.go new file mode 100644 index 000000000000..78b726f9ac2a --- /dev/null +++ b/x/feemarket/types/query.pb.go @@ -0,0 +1,1615 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/feemarket/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + 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 + +// ParamsRequest is the request type for the Query/Params RPC method. +type ParamsRequest struct { +} + +func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } +func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } +func (*ParamsRequest) ProtoMessage() {} +func (*ParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_923dabf3fadbeec4, []int{0} +} +func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParamsRequest.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 *ParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamsRequest.Merge(m, src) +} +func (m *ParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *ParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo + +// ParamsResponse is the response type for the Query/Params RPC method. +type ParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } +func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } +func (*ParamsResponse) ProtoMessage() {} +func (*ParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_923dabf3fadbeec4, []int{1} +} +func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParamsResponse.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 *ParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamsResponse.Merge(m, src) +} +func (m *ParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *ParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo + +func (m *ParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// StateRequest is the request type for the Query/State RPC method. +type StateRequest struct { +} + +func (m *StateRequest) Reset() { *m = StateRequest{} } +func (m *StateRequest) String() string { return proto.CompactTextString(m) } +func (*StateRequest) ProtoMessage() {} +func (*StateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_923dabf3fadbeec4, []int{2} +} +func (m *StateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateRequest.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 *StateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateRequest.Merge(m, src) +} +func (m *StateRequest) XXX_Size() int { + return m.Size() +} +func (m *StateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StateRequest proto.InternalMessageInfo + +// StateResponse is the response type for the Query/State RPC method. +type StateResponse struct { + State State `protobuf:"bytes,1,opt,name=state,proto3" json:"state"` +} + +func (m *StateResponse) Reset() { *m = StateResponse{} } +func (m *StateResponse) String() string { return proto.CompactTextString(m) } +func (*StateResponse) ProtoMessage() {} +func (*StateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_923dabf3fadbeec4, []int{3} +} +func (m *StateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateResponse.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 *StateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateResponse.Merge(m, src) +} +func (m *StateResponse) XXX_Size() int { + return m.Size() +} +func (m *StateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StateResponse proto.InternalMessageInfo + +func (m *StateResponse) GetState() State { + if m != nil { + return m.State + } + return State{} +} + +// GasPriceRequest is the request type for the Query/GasPrice RPC method. +type GasPriceRequest struct { + // denom we are querying gas price in + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *GasPriceRequest) Reset() { *m = GasPriceRequest{} } +func (m *GasPriceRequest) String() string { return proto.CompactTextString(m) } +func (*GasPriceRequest) ProtoMessage() {} +func (*GasPriceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_923dabf3fadbeec4, []int{4} +} +func (m *GasPriceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GasPriceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GasPriceRequest.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 *GasPriceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GasPriceRequest.Merge(m, src) +} +func (m *GasPriceRequest) XXX_Size() int { + return m.Size() +} +func (m *GasPriceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GasPriceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GasPriceRequest proto.InternalMessageInfo + +func (m *GasPriceRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// GasPriceResponse is the response type for the Query/GasPrice RPC method. +// Returns a gas price in specified denom. +type GasPriceResponse struct { + Price types.DecCoin `protobuf:"bytes,1,opt,name=price,proto3" json:"price"` +} + +func (m *GasPriceResponse) Reset() { *m = GasPriceResponse{} } +func (m *GasPriceResponse) String() string { return proto.CompactTextString(m) } +func (*GasPriceResponse) ProtoMessage() {} +func (*GasPriceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_923dabf3fadbeec4, []int{5} +} +func (m *GasPriceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GasPriceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GasPriceResponse.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 *GasPriceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GasPriceResponse.Merge(m, src) +} +func (m *GasPriceResponse) XXX_Size() int { + return m.Size() +} +func (m *GasPriceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GasPriceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GasPriceResponse proto.InternalMessageInfo + +func (m *GasPriceResponse) GetPrice() types.DecCoin { + if m != nil { + return m.Price + } + return types.DecCoin{} +} + +// GasPriceRequest is the request type for the Query/GasPrices RPC method. +type GasPricesRequest struct { +} + +func (m *GasPricesRequest) Reset() { *m = GasPricesRequest{} } +func (m *GasPricesRequest) String() string { return proto.CompactTextString(m) } +func (*GasPricesRequest) ProtoMessage() {} +func (*GasPricesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_923dabf3fadbeec4, []int{6} +} +func (m *GasPricesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GasPricesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GasPricesRequest.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 *GasPricesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GasPricesRequest.Merge(m, src) +} +func (m *GasPricesRequest) XXX_Size() int { + return m.Size() +} +func (m *GasPricesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GasPricesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GasPricesRequest proto.InternalMessageInfo + +// GasPricesResponse is the response type for the Query/GasPrices RPC method. +// Returns a gas price in all available denoms. +type GasPricesResponse struct { + Prices github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=prices,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"prices"` +} + +func (m *GasPricesResponse) Reset() { *m = GasPricesResponse{} } +func (m *GasPricesResponse) String() string { return proto.CompactTextString(m) } +func (*GasPricesResponse) ProtoMessage() {} +func (*GasPricesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_923dabf3fadbeec4, []int{7} +} +func (m *GasPricesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GasPricesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GasPricesResponse.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 *GasPricesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GasPricesResponse.Merge(m, src) +} +func (m *GasPricesResponse) XXX_Size() int { + return m.Size() +} +func (m *GasPricesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GasPricesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GasPricesResponse proto.InternalMessageInfo + +func (m *GasPricesResponse) GetPrices() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Prices + } + return nil +} + +func init() { + proto.RegisterType((*ParamsRequest)(nil), "cosmos.feemarket.v1.ParamsRequest") + proto.RegisterType((*ParamsResponse)(nil), "cosmos.feemarket.v1.ParamsResponse") + proto.RegisterType((*StateRequest)(nil), "cosmos.feemarket.v1.StateRequest") + proto.RegisterType((*StateResponse)(nil), "cosmos.feemarket.v1.StateResponse") + proto.RegisterType((*GasPriceRequest)(nil), "cosmos.feemarket.v1.GasPriceRequest") + proto.RegisterType((*GasPriceResponse)(nil), "cosmos.feemarket.v1.GasPriceResponse") + proto.RegisterType((*GasPricesRequest)(nil), "cosmos.feemarket.v1.GasPricesRequest") + proto.RegisterType((*GasPricesResponse)(nil), "cosmos.feemarket.v1.GasPricesResponse") +} + +func init() { proto.RegisterFile("cosmos/feemarket/v1/query.proto", fileDescriptor_923dabf3fadbeec4) } + +var fileDescriptor_923dabf3fadbeec4 = []byte{ + // 557 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0x63, 0x4a, 0x22, 0xb2, 0xd0, 0x96, 0x6e, 0x03, 0xaa, 0xdc, 0xc8, 0x49, 0xcc, 0x47, + 0x11, 0x08, 0xaf, 0x52, 0x24, 0x54, 0x0e, 0x5c, 0x02, 0x52, 0x0f, 0x5c, 0xda, 0x70, 0xe3, 0x82, + 0x36, 0xce, 0x62, 0x56, 0xc1, 0xbb, 0xae, 0x77, 0x13, 0x51, 0x01, 0x12, 0x82, 0x17, 0x40, 0xe2, + 0x25, 0x10, 0x27, 0x1e, 0xa3, 0xc7, 0x4a, 0x5c, 0x38, 0x01, 0x4a, 0x10, 0xbc, 0x06, 0xf2, 0xee, + 0x38, 0xfd, 0x90, 0x9b, 0x5c, 0x92, 0x78, 0xf6, 0x3f, 0xff, 0xdf, 0x78, 0x66, 0x36, 0xa8, 0x11, + 0x4a, 0x15, 0x4b, 0x45, 0x5e, 0x30, 0x16, 0xd3, 0x74, 0xc0, 0x34, 0x19, 0xb5, 0xc9, 0xde, 0x90, + 0xa5, 0xfb, 0x41, 0x92, 0x4a, 0x2d, 0xf1, 0xaa, 0x15, 0x04, 0x53, 0x41, 0x30, 0x6a, 0xbb, 0xb5, + 0x48, 0x46, 0xd2, 0x9c, 0x93, 0xec, 0x97, 0x95, 0xba, 0xf5, 0x48, 0xca, 0xe8, 0x15, 0x23, 0x34, + 0xe1, 0x84, 0x0a, 0x21, 0x35, 0xd5, 0x5c, 0x0a, 0x05, 0xa7, 0x1e, 0x90, 0x7a, 0x54, 0x31, 0x32, + 0x6a, 0xf7, 0x98, 0xa6, 0x6d, 0x12, 0x4a, 0x2e, 0xe0, 0x7c, 0x85, 0xc6, 0x5c, 0x48, 0x62, 0x3e, + 0x21, 0xd4, 0x2c, 0x2a, 0x2e, 0xa1, 0x29, 0x8d, 0x73, 0xd3, 0x56, 0x91, 0x22, 0x62, 0x82, 0x29, + 0x0e, 0x12, 0x7f, 0x19, 0x2d, 0xee, 0x98, 0x94, 0x2e, 0xdb, 0x1b, 0x32, 0xa5, 0xfd, 0x27, 0x68, + 0x29, 0x0f, 0xa8, 0x44, 0x0a, 0xc5, 0xf0, 0x03, 0x54, 0xb1, 0xae, 0x6b, 0x4e, 0xd3, 0xb9, 0x75, + 0x71, 0x73, 0x3d, 0x28, 0x78, 0xe9, 0xc0, 0x26, 0x75, 0xce, 0x1f, 0xfc, 0x6c, 0x94, 0xba, 0x90, + 0xe0, 0x2f, 0xa1, 0x4b, 0x4f, 0x35, 0xd5, 0x2c, 0x37, 0xdf, 0x46, 0x8b, 0xf0, 0x0c, 0xde, 0xf7, + 0x51, 0x59, 0x65, 0x01, 0xb0, 0x76, 0x0b, 0xad, 0x4d, 0x0a, 0x38, 0x5b, 0xb9, 0xbf, 0x81, 0x96, + 0xb7, 0xa9, 0xda, 0x49, 0x79, 0x98, 0x7b, 0xe3, 0x1a, 0x2a, 0xf7, 0x99, 0x90, 0xb1, 0xb1, 0xaa, + 0x76, 0xed, 0x83, 0xbf, 0x8b, 0x2e, 0x1f, 0x09, 0x01, 0xfa, 0x10, 0x95, 0x93, 0x2c, 0x00, 0xd0, + 0x7a, 0x0e, 0xcd, 0x7a, 0x1f, 0x40, 0xef, 0x83, 0xc7, 0x2c, 0x7c, 0x24, 0xb9, 0xe8, 0x54, 0x33, + 0xec, 0x97, 0x7f, 0xdf, 0x6e, 0x3b, 0x5d, 0x9b, 0xe5, 0xe3, 0x23, 0xcb, 0x69, 0xd7, 0x3e, 0x3a, + 0x68, 0xe5, 0x58, 0x10, 0x40, 0x02, 0x55, 0x4c, 0x4a, 0xd6, 0xb9, 0x85, 0xb9, 0xa4, 0xad, 0x8c, + 0xf4, 0xf5, 0x57, 0xe3, 0x4e, 0xc4, 0xf5, 0xcb, 0x61, 0x2f, 0x08, 0x65, 0x4c, 0x60, 0x80, 0xf6, + 0xeb, 0xae, 0xea, 0x0f, 0x88, 0xde, 0x4f, 0x98, 0xca, 0x73, 0x94, 0x2d, 0x0c, 0x28, 0x9b, 0x7f, + 0x17, 0x50, 0x79, 0x37, 0xdb, 0x4e, 0x2c, 0x51, 0xc5, 0x0e, 0x04, 0xfb, 0x33, 0xa6, 0x05, 0xd5, + 0xbb, 0xd7, 0x66, 0x6a, 0xec, 0xcb, 0xf8, 0xf5, 0x0f, 0xdf, 0xff, 0x7c, 0x3e, 0x77, 0x15, 0xd7, + 0x8a, 0x16, 0x0e, 0x0f, 0x50, 0xd9, 0x8c, 0x09, 0xb7, 0xce, 0x1e, 0x61, 0x8e, 0xf3, 0x67, 0x49, + 0x80, 0xb6, 0x6e, 0x68, 0x57, 0xf0, 0xea, 0x49, 0x9a, 0x99, 0x3e, 0x7e, 0xef, 0xa0, 0x0b, 0x79, + 0xb7, 0xf1, 0xf5, 0x42, 0xb7, 0x53, 0xdb, 0xe1, 0xde, 0x98, 0xa3, 0x02, 0xec, 0x86, 0xc1, 0xb6, + 0x70, 0xe3, 0xd4, 0x9d, 0xa1, 0xea, 0xb9, 0xe9, 0x31, 0x79, 0x63, 0xd6, 0xea, 0x1d, 0x7e, 0x8b, + 0xaa, 0xd3, 0x79, 0xe3, 0xd9, 0xe6, 0xd3, 0x36, 0xdf, 0x9c, 0x27, 0x83, 0x22, 0x9a, 0xa6, 0x08, + 0x17, 0xaf, 0x9d, 0x51, 0x84, 0xea, 0x6c, 0x1d, 0x8c, 0x3d, 0xe7, 0x70, 0xec, 0x39, 0xbf, 0xc7, + 0x9e, 0xf3, 0x69, 0xe2, 0x95, 0x0e, 0x27, 0x5e, 0xe9, 0xc7, 0xc4, 0x2b, 0x3d, 0x83, 0xff, 0x11, + 0xd5, 0x1f, 0x04, 0x5c, 0x92, 0xd7, 0xc7, 0x1c, 0xcc, 0xe2, 0xf4, 0x2a, 0xe6, 0xda, 0xdf, 0xfb, + 0x1f, 0x00, 0x00, 0xff, 0xff, 0x36, 0xee, 0xe5, 0x4c, 0xda, 0x04, 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 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Params returns the current feemarket module parameters. + Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) + // State returns the current feemarket module state. + State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) + // GasPrice returns the current feemarket module gas price + // for specified denom. + GasPrice(ctx context.Context, in *GasPriceRequest, opts ...grpc.CallOption) (*GasPriceResponse, error) + // GasPrices returns the current feemarket module list of gas prices + // in all available denoms. + GasPrices(ctx context.Context, in *GasPricesRequest, opts ...grpc.CallOption) (*GasPricesResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { + out := new(ParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.feemarket.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) { + out := new(StateResponse) + err := c.cc.Invoke(ctx, "/cosmos.feemarket.v1.Query/State", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GasPrice(ctx context.Context, in *GasPriceRequest, opts ...grpc.CallOption) (*GasPriceResponse, error) { + out := new(GasPriceResponse) + err := c.cc.Invoke(ctx, "/cosmos.feemarket.v1.Query/GasPrice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GasPrices(ctx context.Context, in *GasPricesRequest, opts ...grpc.CallOption) (*GasPricesResponse, error) { + out := new(GasPricesResponse) + err := c.cc.Invoke(ctx, "/cosmos.feemarket.v1.Query/GasPrices", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params returns the current feemarket module parameters. + Params(context.Context, *ParamsRequest) (*ParamsResponse, error) + // State returns the current feemarket module state. + State(context.Context, *StateRequest) (*StateResponse, error) + // GasPrice returns the current feemarket module gas price + // for specified denom. + GasPrice(context.Context, *GasPriceRequest) (*GasPriceResponse, error) + // GasPrices returns the current feemarket module list of gas prices + // in all available denoms. + GasPrices(context.Context, *GasPricesRequest) (*GasPricesResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) State(ctx context.Context, req *StateRequest) (*StateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method State not implemented") +} +func (*UnimplementedQueryServer) GasPrice(ctx context.Context, req *GasPriceRequest) (*GasPriceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GasPrice not implemented") +} +func (*UnimplementedQueryServer) GasPrices(ctx context.Context, req *GasPricesRequest) (*GasPricesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GasPrices not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.feemarket.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_State_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).State(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.feemarket.v1.Query/State", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).State(ctx, req.(*StateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GasPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GasPriceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GasPrice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.feemarket.v1.Query/GasPrice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GasPrice(ctx, req.(*GasPriceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GasPrices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GasPricesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GasPrices(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.feemarket.v1.Query/GasPrices", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GasPrices(ctx, req.(*GasPricesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var Query_serviceDesc = _Query_serviceDesc +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.feemarket.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "State", + Handler: _Query_State_Handler, + }, + { + MethodName: "GasPrice", + Handler: _Query_GasPrice_Handler, + }, + { + MethodName: "GasPrices", + Handler: _Query_GasPrices_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/feemarket/v1/query.proto", +} + +func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StateRequest) 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 *StateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *StateResponse) 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 *StateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.State.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *GasPriceRequest) 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 *GasPriceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GasPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GasPriceResponse) 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 *GasPriceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Price.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *GasPricesRequest) 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 *GasPricesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GasPricesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *GasPricesResponse) 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 *GasPricesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GasPricesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Prices) > 0 { + for iNdEx := len(m.Prices) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Prices[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *StateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *StateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.State.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *GasPriceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *GasPriceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Price.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *GasPricesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *GasPricesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Prices) > 0 { + for _, e := range m.Prices { + l = e.Size() + 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 *ParamsRequest) 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: ParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsRequest: 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 *ParamsResponse) 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: ParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateRequest) 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: StateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateRequest: 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 *StateResponse) 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: StateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.State.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GasPriceRequest) 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: GasPriceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GasPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 (m *GasPriceResponse) 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: GasPriceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GasPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GasPricesRequest) 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: GasPricesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GasPricesRequest: 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 *GasPricesResponse) 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: GasPricesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GasPricesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prices = append(m.Prices, types.DecCoin{}) + if err := m.Prices[len(m.Prices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/feemarket/types/query.pb.gw.go b/x/feemarket/types/query.pb.gw.go new file mode 100644 index 000000000000..68a5f083cac5 --- /dev/null +++ b/x/feemarket/types/query.pb.gw.go @@ -0,0 +1,384 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: cosmos/feemarket/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +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_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_State_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq StateRequest + var metadata runtime.ServerMetadata + + msg, err := client.State(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_State_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq StateRequest + var metadata runtime.ServerMetadata + + msg, err := server.State(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GasPrice_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GasPriceRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.GasPrice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GasPrice_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GasPriceRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.GasPrice(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GasPrices_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GasPricesRequest + var metadata runtime.ServerMetadata + + msg, err := client.GasPrices(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GasPrices_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GasPricesRequest + var metadata runtime.ServerMetadata + + msg, err := server.GasPrices(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_State_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_State_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_State_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GasPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GasPrice_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GasPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GasPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GasPrices_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GasPrices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(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 RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_State_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_State_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_State_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GasPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GasPrice_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GasPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GasPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GasPrices_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GasPrices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"feemarket", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_State_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"feemarket", "v1", "state"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GasPrice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"feemarket", "v1", "gas_price", "denom"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GasPrices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"feemarket", "v1", "gas_prices"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_State_0 = runtime.ForwardResponseMessage + + forward_Query_GasPrice_0 = runtime.ForwardResponseMessage + + forward_Query_GasPrices_0 = runtime.ForwardResponseMessage +) diff --git a/x/feemarket/types/resolver.go b/x/feemarket/types/resolver.go new file mode 100644 index 000000000000..6cefb1bdb300 --- /dev/null +++ b/x/feemarket/types/resolver.go @@ -0,0 +1,50 @@ +package types + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// DenomResolver is an interface to convert a given token to the feemarket's base token. +type DenomResolver interface { + // ConvertToDenom converts deccoin into the equivalent amount of the token denominated in denom. + ConvertToDenom(ctx context.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) + // ExtraDenoms returns a list of denoms in addition of `Params.base_denom` it's possible to pay fees with + ExtraDenoms(ctx context.Context) ([]string, error) +} + +// TestDenomResolver is a test implementation of the DenomResolver interface. It returns "feeCoin.Amount baseDenom" for all coins that are not the baseDenom. +// NOTE: DO NOT USE THIS IN PRODUCTION +type TestDenomResolver struct{} + +// ConvertToDenom returns "coin.Amount denom" for all coins that are not the denom. +func (r *TestDenomResolver) ConvertToDenom(_ context.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) { + if coin.Denom == denom { + return coin, nil + } + + return sdk.NewDecCoinFromDec(denom, coin.Amount), nil +} + +func (r *TestDenomResolver) ExtraDenoms(_ context.Context) ([]string, error) { + return []string{}, nil +} + +// ErrorDenomResolver is a test implementation of the DenomResolver interface. It returns an error for all coins that are not the baseDenom. +// NOTE: DO NOT USE THIS IN PRODUCTION +type ErrorDenomResolver struct{} + +// ConvertToDenom returns an error for all coins that are not the denom. +func (r *ErrorDenomResolver) ConvertToDenom(_ context.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) { + if coin.Denom == denom { + return coin, nil + } + + return sdk.DecCoin{}, fmt.Errorf("error resolving denom") +} + +func (r *ErrorDenomResolver) ExtraDenoms(_ context.Context) ([]string, error) { + return []string{}, nil +} diff --git a/x/feemarket/types/state.go b/x/feemarket/types/state.go new file mode 100644 index 000000000000..bedd715c1a31 --- /dev/null +++ b/x/feemarket/types/state.go @@ -0,0 +1,172 @@ +package types + +import ( + fmt "fmt" + + "cosmossdk.io/math" +) + +// NewState instantiates a new fee market state instance. This is utilized +// to implement both the base EIP-1559 fee market implementation and the +// AIMD EIP-1559 fee market implementation. Note that on init, you initialize +// both the minimum and current base gas price to the same value. +func NewState( + windowSize uint64, + baseGasPrice math.LegacyDec, + learningRate math.LegacyDec, +) State { + return State{ + Window: make([]uint64, windowSize), + BaseGasPrice: baseGasPrice, + Index: 0, + LearningRate: learningRate, + } +} + +// Update updates the block utilization for the current height with the given +// transaction utilization i.e. gas limit. +func (s *State) Update(gas uint64, params Params) error { + update := s.Window[s.Index] + gas + if update > params.MaxBlockUtilization { + return fmt.Errorf("block utilization of %d cannot exceed max block utilization of %d", update, params.MaxBlockUtilization) + } + + s.Window[s.Index] = update + return nil +} + +// IncrementHeight increments the current height of the state. +func (s *State) IncrementHeight() { + s.Index = (s.Index + 1) % uint64(len(s.Window)) + s.Window[s.Index] = 0 +} + +// UpdateBaseGasPrice updates the learning rate and base gas price based on the AIMD +// learning rate adjustment algorithm. The learning rate is updated +// based on the average utilization of the block window. The base gas price is +// update using the new learning rate and the delta adjustment. Please +// see the EIP-1559 specification for more details. +func (s *State) UpdateBaseGasPrice(params Params) (gasPrice math.LegacyDec) { + // Panic catch in case there is an overflow + defer func() { + if rec := recover(); rec != nil { + s.BaseGasPrice = params.MinBaseGasPrice + gasPrice = s.BaseGasPrice + } + }() + + // Calculate the new base gasPrice with the learning rate adjustment. + currentBlockSize := math.LegacyNewDecFromInt(math.NewIntFromUint64(s.Window[s.Index])) + targetBlockSize := math.LegacyNewDecFromInt(math.NewIntFromUint64(params.TargetBlockUtilization())) + utilization := (currentBlockSize.Sub(targetBlockSize)).Quo(targetBlockSize) + + // Truncate the learning rate adjustment to an integer. + // + // This is equivalent to + // 1 + (learningRate * (currentBlockSize - targetBlockSize) / targetBlockSize) + learningRateAdjustment := math.LegacyOneDec().Add(s.LearningRate.Mul(utilization)) + + // Calculate the delta adjustment. + net := math.LegacyNewDecFromInt(s.GetNetUtilization(params)).Mul(params.Delta) + + // Update the base gasPrice. + gasPrice = s.BaseGasPrice.Mul(learningRateAdjustment).Add(net) + + // Ensure the base gasPrice is greater than the minimum base gasPrice. + if gasPrice.LT(params.MinBaseGasPrice) { + gasPrice = params.MinBaseGasPrice + } + + s.BaseGasPrice = gasPrice + return s.BaseGasPrice +} + +// UpdateLearningRate updates the learning rate based on the AIMD +// learning rate adjustment algorithm. The learning rate is updated +// based on the average utilization of the block window. There are +// two cases that can occur: +// +// 1. The average utilization is above the target threshold. In this +// case, the learning rate is increased by the alpha parameter. This occurs +// when blocks are nearly full or empty. +// 2. The average utilization is below the target threshold. In this +// case, the learning rate is decreased by the beta parameter. This occurs +// when blocks are relatively close to the target block utilization. +// +// For more details, please see the EIP-1559 specification. +func (s *State) UpdateLearningRate(params Params) (lr math.LegacyDec) { + // Panic catch in case there is an overflow + defer func() { + if rec := recover(); rec != nil { + s.LearningRate = params.MinLearningRate + lr = s.LearningRate + } + }() + + // Calculate the average utilization of the block window. + avg := s.GetAverageUtilization(params) + + // Determine if the average utilization is above or below the target + // threshold and adjust the learning rate accordingly. + if avg.LTE(params.Gamma) || avg.GTE(math.LegacyOneDec().Sub(params.Gamma)) { + lr = params.Alpha.Add(s.LearningRate) + if lr.GT(params.MaxLearningRate) { + lr = params.MaxLearningRate + } + } else { + lr = s.LearningRate.Mul(params.Beta) + if lr.LT(params.MinLearningRate) { + lr = params.MinLearningRate + } + } + + // Update the current learning rate. + s.LearningRate = lr + return s.LearningRate +} + +// GetNetUtilization returns the net utilization of the block window. +func (s *State) GetNetUtilization(params Params) math.Int { + net := math.NewInt(0) + + targetUtilization := math.NewIntFromUint64(params.TargetBlockUtilization()) + for _, utilization := range s.Window { + diff := math.NewIntFromUint64(utilization).Sub(targetUtilization) + net = net.Add(diff) + } + + return net +} + +// GetAverageUtilization returns the average utilization of the block +// window. +func (s *State) GetAverageUtilization(params Params) math.LegacyDec { + var total uint64 + for _, utilization := range s.Window { + total += utilization + } + + sum := math.LegacyNewDecFromInt(math.NewIntFromUint64(total)) + + multiple := math.LegacyNewDecFromInt(math.NewIntFromUint64(uint64(len(s.Window)))) + divisor := math.LegacyNewDecFromInt(math.NewIntFromUint64(params.MaxBlockUtilization)).Mul(multiple) + + return sum.Quo(divisor) +} + +// ValidateBasic performs basic validation on the state. +func (s *State) ValidateBasic() error { + if s.Window == nil { + return fmt.Errorf("block utilization window cannot be nil or empty") + } + + if s.BaseGasPrice.IsNil() || s.BaseGasPrice.LTE(math.LegacyZeroDec()) { + return fmt.Errorf("base gas price must be positive") + } + + if s.LearningRate.IsNil() || s.LearningRate.LTE(math.LegacyZeroDec()) { + return fmt.Errorf("learning rate must be positive") + } + + return nil +} diff --git a/x/feemarket/types/state_fuzz_test.go b/x/feemarket/types/state_fuzz_test.go new file mode 100644 index 000000000000..8afb22896789 --- /dev/null +++ b/x/feemarket/types/state_fuzz_test.go @@ -0,0 +1,104 @@ +package types_test + +import ( + "testing" + + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + + "cosmossdk.io/x/feemarket/types" +) + +func FuzzDefaultFeeMarket(f *testing.F) { + testCases := []uint64{ + 0, + 1_000, + 10_000, + 100_000, + 1_000_000, + 10_000_000, + 100_000_000, + } + + for _, tc := range testCases { + f.Add(tc) + } + + defaultLR := math.LegacyMustNewDecFromStr("0.125") + + // Default fee market. + f.Fuzz(func(t *testing.T, blockGasUsed uint64) { + state := types.DefaultState() + params := types.DefaultParams() + + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("100") + state.BaseGasPrice = math.LegacyMustNewDecFromStr("200") + err := state.Update(blockGasUsed, params) + + if blockGasUsed > params.MaxBlockUtilization { + require.Error(t, err) + return + } + + require.NoError(t, err) + require.Equal(t, blockGasUsed, state.Window[state.Index]) + + // Ensure the learning rate is always the default learning rate. + lr := state.UpdateLearningRate( + params, + ) + require.Equal(t, defaultLR, lr) + + oldFee := state.BaseGasPrice + newFee := state.UpdateBaseGasPrice(params) + + if blockGasUsed > params.TargetBlockUtilization() { + require.True(t, newFee.GT(oldFee)) + } else { + require.True(t, newFee.LT(oldFee)) + } + }) +} + +func FuzzAIMDFeeMarket(f *testing.F) { + testCases := []uint64{ + 0, + 1_000, + 10_000, + 100_000, + 1_000_000, + 10_000_000, + 100_000_000, + } + + for _, tc := range testCases { + f.Add(tc) + } + + // Fee market with adjustable learning rate. + f.Fuzz(func(t *testing.T, blockGasUsed uint64) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("100") + state.BaseGasPrice = math.LegacyMustNewDecFromStr("200") + state.Window = make([]uint64, 1) + err := state.Update(blockGasUsed, params) + + if blockGasUsed > params.MaxBlockUtilization { + require.Error(t, err) + return + } + + require.NoError(t, err) + require.Equal(t, blockGasUsed, state.Window[state.Index]) + + oldFee := state.BaseGasPrice + newFee := state.UpdateBaseGasPrice(params) + + if blockGasUsed > params.TargetBlockUtilization() { + require.True(t, newFee.GT(oldFee)) + } else { + require.True(t, newFee.LT(oldFee)) + } + }) +} diff --git a/x/feemarket/types/state_test.go b/x/feemarket/types/state_test.go new file mode 100644 index 000000000000..b33f29f535ab --- /dev/null +++ b/x/feemarket/types/state_test.go @@ -0,0 +1,883 @@ +package types_test + +import ( + "math/rand" + "testing" + + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + + "cosmossdk.io/x/feemarket/types" +) + +var OneHundred = math.LegacyMustNewDecFromStr("100") + +func TestState_Update(t *testing.T) { + t.Run("can add to window", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + err := state.Update(100, params) + require.NoError(t, err) + require.Equal(t, uint64(100), state.Window[0]) + }) + + t.Run("can add several txs to window", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + err := state.Update(100, params) + require.NoError(t, err) + require.Equal(t, uint64(100), state.Window[0]) + + err = state.Update(200, params) + require.NoError(t, err) + require.Equal(t, uint64(300), state.Window[0]) + }) + + t.Run("errors when it exceeds max block utilization", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + err := state.Update(params.MaxBlockUtilization+1, params) + require.Error(t, err) + }) + + t.Run("can update with several blocks in default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + err := state.Update(100, params) + require.NoError(t, err) + require.Equal(t, uint64(100), state.Window[0]) + + state.IncrementHeight() + + err = state.Update(200, params) + require.NoError(t, err) + require.Equal(t, uint64(200), state.Window[0]) + + err = state.Update(300, params) + require.NoError(t, err) + require.Equal(t, uint64(500), state.Window[0]) + }) + + t.Run("can update with several blocks in default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + err := state.Update(100, params) + require.NoError(t, err) + require.Equal(t, uint64(100), state.Window[0]) + + state.IncrementHeight() + + err = state.Update(200, params) + require.NoError(t, err) + require.Equal(t, uint64(200), state.Window[1]) + + state.IncrementHeight() + + err = state.Update(300, params) + require.NoError(t, err) + require.Equal(t, uint64(300), state.Window[2]) + + state.IncrementHeight() + + err = state.Update(400, params) + require.NoError(t, err) + require.Equal(t, uint64(400), state.Window[3]) + }) + + t.Run("correctly wraps around with aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + state.Window = make([]uint64, 3) + + err := state.Update(100, params) + require.NoError(t, err) + require.Equal(t, uint64(100), state.Window[0]) + + state.IncrementHeight() + + err = state.Update(200, params) + require.NoError(t, err) + require.Equal(t, uint64(200), state.Window[1]) + + state.IncrementHeight() + + err = state.Update(300, params) + require.NoError(t, err) + require.Equal(t, uint64(300), state.Window[2]) + + state.IncrementHeight() + require.Equal(t, uint64(0), state.Window[0]) + + err = state.Update(400, params) + require.NoError(t, err) + require.Equal(t, uint64(400), state.Window[0]) + require.Equal(t, uint64(200), state.Window[1]) + require.Equal(t, uint64(300), state.Window[2]) + }) +} + +func TestState_UpdateBaseGasPrice(t *testing.T) { + t.Run("empty block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.BaseGasPrice = math.LegacyMustNewDecFromStr("1000") + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("125") + + newBaseGasPrice := state.UpdateBaseGasPrice(params) + expectedBaseGasPrice := math.LegacyMustNewDecFromStr("875") + require.True(t, expectedBaseGasPrice.Equal(newBaseGasPrice)) + }) + + t.Run("target block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.BaseGasPrice = math.LegacyMustNewDecFromStr("1000") + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("125") + + state.Window[0] = params.TargetBlockUtilization() + + newBaseGasPrice := state.UpdateBaseGasPrice(params) + expectedBaseGasPrice := math.LegacyMustNewDecFromStr("1000") + require.True(t, expectedBaseGasPrice.Equal(newBaseGasPrice)) + }) + + t.Run("full block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.BaseGasPrice = math.LegacyMustNewDecFromStr("1000") + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("125") + + state.Window[0] = params.MaxBlockUtilization + + newBaseGasPrice := state.UpdateBaseGasPrice(params) + expectedBaseGasPrice := math.LegacyMustNewDecFromStr("1125") + require.True(t, expectedBaseGasPrice.Equal(newBaseGasPrice)) + }) + + t.Run("empty block with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + state.BaseGasPrice = math.LegacyMustNewDecFromStr("1000") + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("125") + state.LearningRate = math.LegacyMustNewDecFromStr("0.125") + + state.UpdateLearningRate(params) + newBaseGasPrice := state.UpdateBaseGasPrice(params) + + expectedBaseGasPrice := math.LegacyMustNewDecFromStr("850") + require.True(t, expectedBaseGasPrice.Equal(newBaseGasPrice)) + }) + + t.Run("target block with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + state.BaseGasPrice = math.LegacyMustNewDecFromStr("1000") + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("125") + state.LearningRate = math.LegacyMustNewDecFromStr("0.125") + + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.TargetBlockUtilization() + } + + state.UpdateLearningRate(params) + newBaseGasPrice := state.UpdateBaseGasPrice(params) + + expectedBaseGasPrice := math.LegacyMustNewDecFromStr("1000") + require.True(t, expectedBaseGasPrice.Equal(newBaseGasPrice)) + }) + + t.Run("full blocks with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + state.BaseGasPrice = math.LegacyMustNewDecFromStr("1000") + params.MinBaseGasPrice = math.LegacyMustNewDecFromStr("125") + state.LearningRate = math.LegacyMustNewDecFromStr("0.125") + + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.MaxBlockUtilization + } + + state.UpdateLearningRate(params) + newBaseGasPrice := state.UpdateBaseGasPrice(params) + + expectedBaseGasPrice := math.LegacyMustNewDecFromStr("1150") + require.True(t, expectedBaseGasPrice.Equal(newBaseGasPrice)) + }) + + t.Run("never goes below min base gas price with default eip1599", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + // Empty block + newBaseGasPrice := state.UpdateBaseGasPrice(params) + expectedBaseGasPrice := params.MinBaseGasPrice + require.True(t, expectedBaseGasPrice.Equal(newBaseGasPrice)) + }) + + t.Run("never goes below min base gas price with default aimd eip1599", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + // Empty blocks + newBaseGasPrice := state.UpdateBaseGasPrice(params) + expectedBaseGasPrice := params.MinBaseGasPrice + require.True(t, expectedBaseGasPrice.Equal(newBaseGasPrice)) + }) + + t.Run("empty blocks with aimd eip1559 with a delta", func(t *testing.T) { + // Instantiate the params with a delta. + params := types.DefaultAIMDParams() + + paramsWithDelta := types.DefaultAIMDParams() + delta := math.LegacyNewDec(10) + paramsWithDelta.Delta = delta + + // Empty blocks + state := types.DefaultAIMDState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyMustNewDecFromStr("10")) + lr := state.UpdateLearningRate(params) + bgs := state.UpdateBaseGasPrice(params) + + state = types.DefaultAIMDState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyMustNewDecFromStr("10")) + lrWithDelta := state.UpdateLearningRate(paramsWithDelta) + bgsWithDelta := state.UpdateBaseGasPrice(paramsWithDelta) + + // Ensure that the learning rate is the same. + require.Equal(t, lr, lrWithDelta) + + // Ensure that the base gas price is less with the delta. + require.True(t, bgsWithDelta.LT(bgs)) + }) + + t.Run("full blocks with aimd eip1559 with a delta", func(t *testing.T) { + // Instantiate the params with a delta. + params := types.DefaultAIMDParams() + + paramsWithDelta := types.DefaultAIMDParams() + delta := math.LegacyNewDec(10) + paramsWithDelta.Delta = delta + + // Empty blocks + state := types.DefaultAIMDState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyMustNewDecFromStr("10")) + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.MaxBlockUtilization + } + + lr := state.UpdateLearningRate(params) + bgs := state.UpdateBaseGasPrice(params) + + state = types.DefaultAIMDState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyMustNewDecFromStr("10")) + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.MaxBlockUtilization + } + + lrWithDelta := state.UpdateLearningRate(paramsWithDelta) + bgsWithDelta := state.UpdateBaseGasPrice(paramsWithDelta) + + // Ensure that the learning rate is the same. + require.Equal(t, lr, lrWithDelta) + + // Ensure that the base gas price is greater with the delta. + require.True(t, bgsWithDelta.GT(bgs)) + }) + + t.Run("target blocks with aimd eip1559 with a delta", func(t *testing.T) { + // Instantiate the params with a delta. + params := types.DefaultAIMDParams() + + paramsWithDelta := types.DefaultAIMDParams() + delta := math.LegacyNewDec(10) + paramsWithDelta.Delta = delta + + // Empty blocks + state := types.DefaultAIMDState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyMustNewDecFromStr("10")) + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.TargetBlockUtilization() + } + + lr := state.UpdateLearningRate(params) + bgs := state.UpdateBaseGasPrice(params) + + state = types.DefaultAIMDState() + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyMustNewDecFromStr("10")) + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.TargetBlockUtilization() + } + + lrWithDelta := state.UpdateLearningRate(paramsWithDelta) + bgsWithDelta := state.UpdateBaseGasPrice(paramsWithDelta) + + // Ensure that the learning rate is the same. + require.Equal(t, lr, lrWithDelta) + + // Ensure that the base gas prices are equal. + require.Equal(t, bgs, bgsWithDelta) + }) + + t.Run("half target block size with aimd eip1559 with a delta", func(t *testing.T) { + state := types.DefaultAIMDState() + state.Window = make([]uint64, 1) + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyMustNewDecFromStr("10")) + prevBF := state.BaseGasPrice + + // Instantiate the params with a delta. + params := types.DefaultAIMDParams() + params.Window = 1 + params.Delta = math.LegacyNewDec(10) + + // 1/4th of the window is full. + state.Window[0] = params.TargetBlockUtilization() / 2 + + prevLR := state.LearningRate + lr := state.UpdateLearningRate(params) + bgs := state.UpdateBaseGasPrice(params) + + expectedUtilization := math.LegacyMustNewDecFromStr("-0.5") + expectedLR := prevLR.Add(params.Alpha) + expectedLRAdjustment := (expectedLR.Mul(expectedUtilization)).Add(math.LegacyOneDec()) + + expectedNetUtilization := math.LegacyNewDec(-1 * int64(params.TargetBlockUtilization()) / 2) + deltaDiff := expectedNetUtilization.Mul(params.Delta) + expectedGasPrice := prevBF.Mul(expectedLRAdjustment).Add(deltaDiff) + + require.Equal(t, expectedLR, lr) + require.Equal(t, expectedGasPrice, bgs) + }) + + t.Run("3/4 max block size with aimd eip1559 with a delta", func(t *testing.T) { + state := types.DefaultAIMDState() + state.Window = make([]uint64, 1) + state.BaseGasPrice = state.BaseGasPrice.Mul(math.LegacyMustNewDecFromStr("10")) + prevBGS := state.BaseGasPrice + + // Instantiate the params with a delta. + params := types.DefaultAIMDParams() + params.Window = 1 + params.Delta = math.LegacyNewDec(10) + + // 1/4th of the window is full. + state.Window[0] = params.MaxBlockUtilization / 4 * 3 + + prevLR := state.LearningRate + lr := state.UpdateLearningRate(params) + bgs := state.UpdateBaseGasPrice(params) + + expectedUtilization := math.LegacyMustNewDecFromStr("0.5") + expectedLR := prevLR.Add(params.Alpha) + expectedLRAdjustment := (expectedLR.Mul(expectedUtilization)).Add(math.LegacyOneDec()) + + expectedNetUtilization := math.LegacyNewDec(int64(params.MaxBlockUtilization) / 4) + deltaDiff := expectedNetUtilization.Mul(params.Delta) + expectedGasPrice := prevBGS.Mul(expectedLRAdjustment).Add(deltaDiff) + require.Equal(t, expectedLR, lr) + require.Equal(t, expectedGasPrice, bgs) + }) +} + +func TestState_UpdateLearningRate(t *testing.T) { + t.Run("empty block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.UpdateLearningRate(params) + expectedLearningRate := math.LegacyMustNewDecFromStr("0.125") + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("target block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.Window[0] = params.TargetBlockUtilization() + + state.UpdateLearningRate(params) + expectedLearningRate := math.LegacyMustNewDecFromStr("0.125") + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("full block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.Window[0] = params.MaxBlockUtilization + + state.UpdateLearningRate(params) + expectedLearningRate := math.LegacyMustNewDecFromStr("0.125") + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("between 0 and target with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.Window[0] = 50000 + + state.UpdateLearningRate(params) + expectedLearningRate := math.LegacyMustNewDecFromStr("0.125") + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("between target and max with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.Window[0] = params.TargetBlockUtilization() + 50000 + + state.UpdateLearningRate(params) + expectedLearningRate := math.LegacyMustNewDecFromStr("0.125") + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("random value with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + randomValue := rand.Int63n(1000000000) + state.Window[0] = uint64(randomValue) + + state.UpdateLearningRate(params) + expectedLearningRate := math.LegacyMustNewDecFromStr("0.125") + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("empty block with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + state.UpdateLearningRate(params) + expectedLearningRate := params.MinLearningRate.Add(params.Alpha) + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("target block with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + defaultLR := math.LegacyMustNewDecFromStr("0.125") + state.LearningRate = defaultLR + + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.TargetBlockUtilization() + } + + state.UpdateLearningRate(params) + expectedLearningRate := defaultLR.Mul(params.Beta) + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("full blocks with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + defaultLR := math.LegacyMustNewDecFromStr("0.125") + state.LearningRate = defaultLR + + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.MaxBlockUtilization + } + + state.UpdateLearningRate(params) + expectedLearningRate := defaultLR.Add(params.Alpha) + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("varying blocks with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + defaultLR := math.LegacyMustNewDecFromStr("0.125") + state.LearningRate = defaultLR + + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + if i%2 == 0 { + state.Window[i] = params.MaxBlockUtilization + } else { + state.Window[i] = 0 + } + } + + state.UpdateLearningRate(params) + expectedLearningRate := defaultLR.Mul(params.Beta) + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) + + t.Run("exceeds threshold with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + defaultLR := math.LegacyMustNewDecFromStr("0.125") + state.LearningRate = defaultLR + + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + if i%2 == 0 { + state.Window[i] = params.MaxBlockUtilization + } else { + state.Window[i] = params.TargetBlockUtilization() + 1 + } + } + + state.UpdateLearningRate(params) + expectedLearningRate := defaultLR.Add(params.Alpha) + require.True(t, expectedLearningRate.Equal(state.LearningRate)) + }) +} + +func TestState_GetNetUtilization(t *testing.T) { + t.Run("empty block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + netUtilization := state.GetNetUtilization(params) + expectedUtilization := math.NewInt(0).Sub(math.NewIntFromUint64(params.TargetBlockUtilization())) + require.True(t, expectedUtilization.Equal(netUtilization)) + }) + + t.Run("target block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.Window[0] = params.TargetBlockUtilization() + + netUtilization := state.GetNetUtilization(params) + expectedUtilization := math.NewInt(0) + require.True(t, expectedUtilization.Equal(netUtilization)) + }) + + t.Run("full block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.Window[0] = params.MaxBlockUtilization + + netUtilization := state.GetNetUtilization(params) + expectedUtilization := math.NewIntFromUint64(params.MaxBlockUtilization - params.TargetBlockUtilization()) + require.True(t, expectedUtilization.Equal(netUtilization)) + }) + + t.Run("empty block with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultParams() + + netUtilization := state.GetNetUtilization(params) + + multiple := math.NewIntFromUint64(uint64(len(state.Window))) + expectedUtilization := math.NewInt(0).Sub(math.NewIntFromUint64(params.TargetBlockUtilization())).Mul(multiple) + require.True(t, expectedUtilization.Equal(netUtilization)) + }) + + t.Run("full blocks with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.MaxBlockUtilization + } + + netUtilization := state.GetNetUtilization(params) + + multiple := math.NewIntFromUint64(uint64(len(state.Window))) + expectedUtilization := math.NewIntFromUint64(params.MaxBlockUtilization).Sub(math.NewIntFromUint64(params.TargetBlockUtilization())).Mul(multiple) + require.True(t, expectedUtilization.Equal(netUtilization)) + }) + + t.Run("varying blocks with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + if i%2 == 0 { + state.Window[i] = params.MaxBlockUtilization + } else { + state.Window[i] = 0 + } + } + + netUtilization := state.GetNetUtilization(params) + expectedUtilization := math.ZeroInt() + require.True(t, expectedUtilization.Equal(netUtilization)) + }) + + t.Run("exceeds target rate with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + if i%2 == 0 { + state.Window[i] = params.MaxBlockUtilization + } else { + state.Window[i] = params.TargetBlockUtilization() + } + } + + netUtilization := state.GetNetUtilization(params) + first := math.NewIntFromUint64(params.MaxBlockUtilization).Mul(math.NewIntFromUint64(params.Window / 2)) + second := math.NewIntFromUint64(params.TargetBlockUtilization()).Mul(math.NewIntFromUint64(params.Window / 2)) + expectedUtilization := first.Add(second).Sub(math.NewIntFromUint64(params.TargetBlockUtilization()).Mul(math.NewIntFromUint64(params.Window))) + require.True(t, expectedUtilization.Equal(netUtilization)) + }) + + t.Run("state with 4 entries in window with different updates", func(t *testing.T) { + state := types.DefaultAIMDState() + state.Window = make([]uint64, 4) + + params := types.DefaultAIMDParams() + params.MaxBlockUtilization = 200 + + state.Window[0] = 100 + state.Window[1] = 200 + state.Window[2] = 0 + state.Window[3] = 50 + + netUtilization := state.GetNetUtilization(params) + expectedUtilization := math.NewIntFromUint64(50).Mul(math.NewInt(-1)) + require.True(t, expectedUtilization.Equal(netUtilization)) + }) + + t.Run("state with 4 entries in window with monotonically increasing updates", func(t *testing.T) { + state := types.DefaultAIMDState() + state.Window = make([]uint64, 4) + + params := types.DefaultAIMDParams() + params.MaxBlockUtilization = 200 + + state.Window[0] = 0 + state.Window[1] = 25 + state.Window[2] = 50 + state.Window[3] = 75 + + netUtilization := state.GetNetUtilization(params) + expectedUtilization := math.NewIntFromUint64(250).Mul(math.NewInt(-1)) + require.True(t, expectedUtilization.Equal(netUtilization)) + }) +} + +func TestState_GetAverageUtilization(t *testing.T) { + t.Run("empty block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyZeroDec() + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("target block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.Window[0] = params.TargetBlockUtilization() + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyMustNewDecFromStr("0.5") + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("full block with default eip-1559", func(t *testing.T) { + state := types.DefaultState() + params := types.DefaultParams() + + state.Window[0] = params.MaxBlockUtilization + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyMustNewDecFromStr("1.0") + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("empty block with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyZeroDec() + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("target block with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.TargetBlockUtilization() + } + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyMustNewDecFromStr("0.5") + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("full blocks with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + state.Window[i] = params.MaxBlockUtilization + } + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyMustNewDecFromStr("1.0") + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("varying blocks with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + if i%2 == 0 { + state.Window[i] = params.MaxBlockUtilization + } else { + state.Window[i] = 0 + } + } + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyMustNewDecFromStr("0.5") + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("exceeds target rate with default aimd eip-1559", func(t *testing.T) { + state := types.DefaultAIMDState() + params := types.DefaultAIMDParams() + + for i := 0; i < len(state.Window); i++ { + if i%2 == 0 { + state.Window[i] = params.MaxBlockUtilization + } else { + state.Window[i] = params.TargetBlockUtilization() + } + } + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyMustNewDecFromStr("0.75") + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("state with 4 entries in window with different updates", func(t *testing.T) { + state := types.DefaultAIMDState() + state.Window = make([]uint64, 4) + + params := types.DefaultAIMDParams() + params.MaxBlockUtilization = 200 + + state.Window[0] = 100 + state.Window[1] = 200 + state.Window[2] = 0 + state.Window[3] = 50 + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyMustNewDecFromStr("0.4375") + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) + + t.Run("state with 4 entries in window with monotonically increasing updates", func(t *testing.T) { + state := types.DefaultAIMDState() + state.Window = make([]uint64, 4) + + params := types.DefaultAIMDParams() + params.Window = 4 + params.MaxBlockUtilization = 200 + + state.Window[0] = 0 + state.Window[1] = 25 + state.Window[2] = 50 + state.Window[3] = 75 + + avgUtilization := state.GetAverageUtilization(params) + expectedUtilization := math.LegacyMustNewDecFromStr("0.1875") + require.True(t, expectedUtilization.Equal(avgUtilization)) + }) +} + +func TestState_ValidateBasic(t *testing.T) { + testCases := []struct { + name string + state types.State + expectErr bool + }{ + { + name: "default base EIP-1559 state", + state: types.DefaultState(), + expectErr: false, + }, + { + name: "default AIMD EIP-1559 state", + state: types.DefaultAIMDState(), + expectErr: false, + }, + { + name: "invalid window", + state: types.State{}, + expectErr: true, + }, + { + name: "invalid negative base gas price", + state: types.State{ + Window: make([]uint64, 1), + BaseGasPrice: math.LegacyMustNewDecFromStr("-1"), + }, + expectErr: true, + }, + { + name: "invalid learning rate", + state: types.State{ + Window: make([]uint64, 1), + BaseGasPrice: math.LegacyMustNewDecFromStr("1"), + LearningRate: math.LegacyMustNewDecFromStr("-1.0"), + }, + expectErr: true, + }, + { + name: "valid other state", + state: types.State{ + Window: make([]uint64, 1), + BaseGasPrice: math.LegacyMustNewDecFromStr("1"), + LearningRate: math.LegacyMustNewDecFromStr("0.5"), + }, + expectErr: false, + }, + { + name: "invalid zero base gas price", + state: types.State{ + Window: make([]uint64, 1), + BaseGasPrice: math.LegacyZeroDec(), + LearningRate: math.LegacyMustNewDecFromStr("0.5"), + }, + expectErr: true, + }, + { + name: "invalid zero learning rate", + state: types.State{ + Window: make([]uint64, 1), + BaseGasPrice: math.LegacyMustNewDecFromStr("1"), + LearningRate: math.LegacyZeroDec(), + }, + expectErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := tc.state.ValidateBasic() + if tc.expectErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/feemarket/types/tx.pb.go b/x/feemarket/types/tx.pb.go new file mode 100644 index 000000000000..5fbe45be646e --- /dev/null +++ b/x/feemarket/types/tx.pb.go @@ -0,0 +1,592 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/feemarket/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// MsgParams defines the Msg/Params request type. It contains the +// new parameters for the feemarket module. +type MsgParams struct { + // Params defines the new parameters for the feemarket module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // Authority defines the authority that is updating the feemarket module + // parameters. + Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgParams) Reset() { *m = MsgParams{} } +func (m *MsgParams) String() string { return proto.CompactTextString(m) } +func (*MsgParams) ProtoMessage() {} +func (*MsgParams) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b860b11eced972, []int{0} +} +func (m *MsgParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgParams.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 *MsgParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgParams.Merge(m, src) +} +func (m *MsgParams) XXX_Size() int { + return m.Size() +} +func (m *MsgParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgParams proto.InternalMessageInfo + +func (m *MsgParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *MsgParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +// MsgParamsResponse defines the Msg/Params response type. +type MsgParamsResponse struct { +} + +func (m *MsgParamsResponse) Reset() { *m = MsgParamsResponse{} } +func (m *MsgParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgParamsResponse) ProtoMessage() {} +func (*MsgParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b860b11eced972, []int{1} +} +func (m *MsgParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgParamsResponse.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 *MsgParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgParamsResponse.Merge(m, src) +} +func (m *MsgParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgParams)(nil), "cosmos.feemarket.v1.MsgParams") + proto.RegisterType((*MsgParamsResponse)(nil), "cosmos.feemarket.v1.MsgParamsResponse") +} + +func init() { proto.RegisterFile("cosmos/feemarket/v1/tx.proto", fileDescriptor_e0b860b11eced972) } + +var fileDescriptor_e0b860b11eced972 = []byte{ + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x4f, 0x4b, 0x4d, 0xcd, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xd1, 0x2f, 0x33, 0xd4, + 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc8, 0xea, 0xc1, 0x65, 0xf5, + 0xca, 0x0c, 0xa5, 0x14, 0xb0, 0x69, 0x29, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x86, 0x68, 0x93, 0x92, + 0x84, 0xa8, 0x88, 0x07, 0xf3, 0xf4, 0xa1, 0x66, 0x40, 0xa4, 0xc4, 0xa1, 0x9a, 0x73, 0x8b, 0xd3, + 0x41, 0xda, 0x72, 0x8b, 0xd3, 0xa1, 0x12, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x10, 0x0d, 0x20, 0x16, + 0x44, 0x54, 0xa9, 0x8f, 0x91, 0x8b, 0xd3, 0xb7, 0x38, 0x3d, 0x00, 0x6c, 0xba, 0x90, 0x25, 0x17, + 0x1b, 0xc4, 0x1e, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x69, 0x3d, 0x2c, 0xee, 0xd3, 0x83, + 0x28, 0x76, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x08, 0xaa, 0x41, 0xc8, 0x8c, 0x8b, 0x33, 0xb1, + 0xb4, 0x24, 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0x52, 0x82, 0x49, 0x81, 0x51, 0x83, 0xd3, 0x49, 0xe2, + 0xd2, 0x16, 0x5d, 0x11, 0xa8, 0x01, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0xc1, 0x25, 0x45, + 0x99, 0x79, 0xe9, 0x41, 0x08, 0xa5, 0x56, 0x7c, 0x4d, 0xcf, 0x37, 0x68, 0x21, 0xf8, 0x4a, 0xc2, + 0x5c, 0x82, 0x70, 0xf7, 0x04, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x1a, 0xc5, 0x71, 0x31, + 0xfb, 0x16, 0xa7, 0x0b, 0x05, 0x70, 0xb1, 0x41, 0x1d, 0x2a, 0x87, 0xd5, 0x61, 0x70, 0x8d, 0x52, + 0x6a, 0xf8, 0xe5, 0x61, 0x06, 0x4b, 0xb1, 0x36, 0x3c, 0xdf, 0xa0, 0xc5, 0xe8, 0x64, 0x71, 0xe2, + 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, + 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x72, 0x10, 0x73, 0x8a, 0x53, 0xb2, 0xf5, + 0x32, 0xf3, 0xf5, 0x2b, 0x90, 0xe2, 0xa4, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x8c, + 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0x23, 0xc1, 0x16, 0xe7, 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 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // Params defines a method for updating the feemarket module parameters. + Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) { + out := new(MsgParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.feemarket.v1.Msg/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // Params defines a method for updating the feemarket module parameters. + Params(context.Context, *MsgParams) (*MsgParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) Params(ctx context.Context, req *MsgParams) (*MsgParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.feemarket.v1.Msg/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Params(ctx, req.(*MsgParams)) + } + return interceptor(ctx, in, info, handler) +} + +var Msg_serviceDesc = _Msg_serviceDesc +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.feemarket.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Msg_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/feemarket/v1/tx.proto", +} + +func (m *MsgParams) 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 *MsgParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgParamsResponse) 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 *MsgParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgParams) 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 ErrIntOverflowTx + } + 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: MsgParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgParamsResponse) 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 ErrIntOverflowTx + } + 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: MsgParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)