diff --git a/api/cosmos/feegrant/v1beta1/tx.pulsar.go b/api/cosmos/feegrant/v1beta1/tx.pulsar.go index 07dbc09fafe6..70056e9cbde3 100644 --- a/api/cosmos/feegrant/v1beta1/tx.pulsar.go +++ b/api/cosmos/feegrant/v1beta1/tx.pulsar.go @@ -1775,6 +1775,782 @@ func (x *fastReflection_MsgRevokeAllowanceResponse) ProtoMethods() *protoiface.M } } +var ( + md_MsgPruneAllowances protoreflect.MessageDescriptor + fd_MsgPruneAllowances_pruner protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_feegrant_v1beta1_tx_proto_init() + md_MsgPruneAllowances = File_cosmos_feegrant_v1beta1_tx_proto.Messages().ByName("MsgPruneAllowances") + fd_MsgPruneAllowances_pruner = md_MsgPruneAllowances.Fields().ByName("pruner") +} + +var _ protoreflect.Message = (*fastReflection_MsgPruneAllowances)(nil) + +type fastReflection_MsgPruneAllowances MsgPruneAllowances + +func (x *MsgPruneAllowances) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgPruneAllowances)(x) +} + +func (x *MsgPruneAllowances) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feegrant_v1beta1_tx_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_MsgPruneAllowances_messageType fastReflection_MsgPruneAllowances_messageType +var _ protoreflect.MessageType = fastReflection_MsgPruneAllowances_messageType{} + +type fastReflection_MsgPruneAllowances_messageType struct{} + +func (x fastReflection_MsgPruneAllowances_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgPruneAllowances)(nil) +} +func (x fastReflection_MsgPruneAllowances_messageType) New() protoreflect.Message { + return new(fastReflection_MsgPruneAllowances) +} +func (x fastReflection_MsgPruneAllowances_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgPruneAllowances +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgPruneAllowances) Descriptor() protoreflect.MessageDescriptor { + return md_MsgPruneAllowances +} + +// 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_MsgPruneAllowances) Type() protoreflect.MessageType { + return _fastReflection_MsgPruneAllowances_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgPruneAllowances) New() protoreflect.Message { + return new(fastReflection_MsgPruneAllowances) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgPruneAllowances) Interface() protoreflect.ProtoMessage { + return (*MsgPruneAllowances)(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_MsgPruneAllowances) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pruner != "" { + value := protoreflect.ValueOfString(x.Pruner) + if !f(fd_MsgPruneAllowances_pruner, 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_MsgPruneAllowances) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.feegrant.v1beta1.MsgPruneAllowances.pruner": + return x.Pruner != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowances")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowances 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_MsgPruneAllowances) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.feegrant.v1beta1.MsgPruneAllowances.pruner": + x.Pruner = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowances")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowances 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_MsgPruneAllowances) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.feegrant.v1beta1.MsgPruneAllowances.pruner": + value := x.Pruner + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowances")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowances 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_MsgPruneAllowances) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.feegrant.v1beta1.MsgPruneAllowances.pruner": + x.Pruner = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowances")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowances 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_MsgPruneAllowances) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feegrant.v1beta1.MsgPruneAllowances.pruner": + panic(fmt.Errorf("field pruner of message cosmos.feegrant.v1beta1.MsgPruneAllowances is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowances")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowances 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_MsgPruneAllowances) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.feegrant.v1beta1.MsgPruneAllowances.pruner": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowances")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowances 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_MsgPruneAllowances) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feegrant.v1beta1.MsgPruneAllowances", 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_MsgPruneAllowances) 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_MsgPruneAllowances) 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_MsgPruneAllowances) 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_MsgPruneAllowances) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgPruneAllowances) + 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.Pruner) + 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().(*MsgPruneAllowances) + 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.Pruner) > 0 { + i -= len(x.Pruner) + copy(dAtA[i:], x.Pruner) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Pruner))) + 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().(*MsgPruneAllowances) + 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: MsgPruneAllowances: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgPruneAllowances: 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 Pruner", 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.Pruner = 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_MsgPruneAllowancesResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_feegrant_v1beta1_tx_proto_init() + md_MsgPruneAllowancesResponse = File_cosmos_feegrant_v1beta1_tx_proto.Messages().ByName("MsgPruneAllowancesResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgPruneAllowancesResponse)(nil) + +type fastReflection_MsgPruneAllowancesResponse MsgPruneAllowancesResponse + +func (x *MsgPruneAllowancesResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgPruneAllowancesResponse)(x) +} + +func (x *MsgPruneAllowancesResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_feegrant_v1beta1_tx_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_MsgPruneAllowancesResponse_messageType fastReflection_MsgPruneAllowancesResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgPruneAllowancesResponse_messageType{} + +type fastReflection_MsgPruneAllowancesResponse_messageType struct{} + +func (x fastReflection_MsgPruneAllowancesResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgPruneAllowancesResponse)(nil) +} +func (x fastReflection_MsgPruneAllowancesResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgPruneAllowancesResponse) +} +func (x fastReflection_MsgPruneAllowancesResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgPruneAllowancesResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgPruneAllowancesResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgPruneAllowancesResponse +} + +// 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_MsgPruneAllowancesResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgPruneAllowancesResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgPruneAllowancesResponse) New() protoreflect.Message { + return new(fastReflection_MsgPruneAllowancesResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgPruneAllowancesResponse) Interface() protoreflect.ProtoMessage { + return (*MsgPruneAllowancesResponse)(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_MsgPruneAllowancesResponse) 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_MsgPruneAllowancesResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse 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_MsgPruneAllowancesResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse 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_MsgPruneAllowancesResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse 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_MsgPruneAllowancesResponse) 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.feegrant.v1beta1.MsgPruneAllowancesResponse")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse 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_MsgPruneAllowancesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse 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_MsgPruneAllowancesResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse")) + } + panic(fmt.Errorf("message cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse 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_MsgPruneAllowancesResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", 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_MsgPruneAllowancesResponse) 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_MsgPruneAllowancesResponse) 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_MsgPruneAllowancesResponse) 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_MsgPruneAllowancesResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgPruneAllowancesResponse) + 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().(*MsgPruneAllowancesResponse) + 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().(*MsgPruneAllowancesResponse) + 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: MsgPruneAllowancesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgPruneAllowancesResponse: 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, + } +} + // Since: cosmos-sdk 0.43 // Code generated by protoc-gen-go. DO NOT EDIT. @@ -1946,6 +2722,74 @@ func (*MsgRevokeAllowanceResponse) Descriptor() ([]byte, []int) { return file_cosmos_feegrant_v1beta1_tx_proto_rawDescGZIP(), []int{3} } +// MsgPruneAllowances prunes expired fee allowances. +// +// Since cosmos-sdk 0.50 +type MsgPruneAllowances struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // pruner is the address of the user pruning expired allowances. + Pruner string `protobuf:"bytes,1,opt,name=pruner,proto3" json:"pruner,omitempty"` +} + +func (x *MsgPruneAllowances) Reset() { + *x = MsgPruneAllowances{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feegrant_v1beta1_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgPruneAllowances) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgPruneAllowances) ProtoMessage() {} + +// Deprecated: Use MsgPruneAllowances.ProtoReflect.Descriptor instead. +func (*MsgPruneAllowances) Descriptor() ([]byte, []int) { + return file_cosmos_feegrant_v1beta1_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgPruneAllowances) GetPruner() string { + if x != nil { + return x.Pruner + } + return "" +} + +// MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. +// +// Since cosmos-sdk 0.50 +type MsgPruneAllowancesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgPruneAllowancesResponse) Reset() { + *x = MsgPruneAllowancesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_feegrant_v1beta1_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgPruneAllowancesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgPruneAllowancesResponse) ProtoMessage() {} + +// Deprecated: Use MsgPruneAllowancesResponse.ProtoReflect.Descriptor instead. +func (*MsgPruneAllowancesResponse) Descriptor() ([]byte, []int) { + return file_cosmos_feegrant_v1beta1_tx_proto_rawDescGZIP(), []int{5} +} + var File_cosmos_feegrant_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_feegrant_v1beta1_tx_proto_rawDesc = []byte{ @@ -1990,37 +2834,51 @@ var file_cosmos_feegrant_v1beta1_tx_proto_rawDesc = []byte{ 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x32, 0xf3, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x70, 0x0a, 0x0e, 0x47, - 0x72, 0x61, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x2a, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, - 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, - 0x77, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, - 0x0f, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, - 0x12, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, + 0x6e, 0x73, 0x65, 0x22, 0x53, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x41, + 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x72, 0x75, + 0x6e, 0x65, 0x72, 0x18, 0x01, 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, 0x06, 0x70, 0x72, 0x75, 0x6e, 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, + 0x2a, 0x06, 0x70, 0x72, 0x75, 0x6e, 0x65, 0x72, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x50, + 0x72, 0x75, 0x6e, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xe8, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x70, + 0x0a, 0x0e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, + 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, + 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, + 0x61, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x1a, 0x32, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x41, + 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x73, 0x0a, 0x0f, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, + 0x6e, 0x63, 0x65, 0x12, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, + 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, + 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, - 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x1a, 0x33, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, - 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xde, 0x01, 0x0a, 0x1b, 0x63, 0x6f, - 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, - 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 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, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x66, - 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, - 0x03, 0x43, 0x46, 0x58, 0xaa, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x46, 0x65, - 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, - 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, - 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x5c, 0x46, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x46, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, - 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, 0x0f, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x41, 0x6c, + 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, + 0x61, 0x6e, 0x63, 0x65, 0x73, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x66, + 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, + 0x01, 0x42, 0xde, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 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, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2f, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x66, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x46, 0x58, 0xaa, 0x02, 0x17, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x46, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x46, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0xe2, 0x02, 0x23, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x46, 0x65, 0x65, 0x67, 0x72, 0x61, + 0x6e, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x46, 0x65, 0x65, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2035,22 +2893,26 @@ func file_cosmos_feegrant_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_feegrant_v1beta1_tx_proto_rawDescData } -var file_cosmos_feegrant_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_cosmos_feegrant_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_cosmos_feegrant_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgGrantAllowance)(nil), // 0: cosmos.feegrant.v1beta1.MsgGrantAllowance (*MsgGrantAllowanceResponse)(nil), // 1: cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse (*MsgRevokeAllowance)(nil), // 2: cosmos.feegrant.v1beta1.MsgRevokeAllowance (*MsgRevokeAllowanceResponse)(nil), // 3: cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse - (*anypb.Any)(nil), // 4: google.protobuf.Any + (*MsgPruneAllowances)(nil), // 4: cosmos.feegrant.v1beta1.MsgPruneAllowances + (*MsgPruneAllowancesResponse)(nil), // 5: cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse + (*anypb.Any)(nil), // 6: google.protobuf.Any } var file_cosmos_feegrant_v1beta1_tx_proto_depIdxs = []int32{ - 4, // 0: cosmos.feegrant.v1beta1.MsgGrantAllowance.allowance:type_name -> google.protobuf.Any + 6, // 0: cosmos.feegrant.v1beta1.MsgGrantAllowance.allowance:type_name -> google.protobuf.Any 0, // 1: cosmos.feegrant.v1beta1.Msg.GrantAllowance:input_type -> cosmos.feegrant.v1beta1.MsgGrantAllowance 2, // 2: cosmos.feegrant.v1beta1.Msg.RevokeAllowance:input_type -> cosmos.feegrant.v1beta1.MsgRevokeAllowance - 1, // 3: cosmos.feegrant.v1beta1.Msg.GrantAllowance:output_type -> cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse - 3, // 4: cosmos.feegrant.v1beta1.Msg.RevokeAllowance:output_type -> cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse - 3, // [3:5] is the sub-list for method output_type - 1, // [1:3] is the sub-list for method input_type + 4, // 3: cosmos.feegrant.v1beta1.Msg.PruneAllowances:input_type -> cosmos.feegrant.v1beta1.MsgPruneAllowances + 1, // 4: cosmos.feegrant.v1beta1.Msg.GrantAllowance:output_type -> cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse + 3, // 5: cosmos.feegrant.v1beta1.Msg.RevokeAllowance:output_type -> cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse + 5, // 6: cosmos.feegrant.v1beta1.Msg.PruneAllowances:output_type -> cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] 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 @@ -2110,6 +2972,30 @@ func file_cosmos_feegrant_v1beta1_tx_proto_init() { return nil } } + file_cosmos_feegrant_v1beta1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgPruneAllowances); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_feegrant_v1beta1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgPruneAllowancesResponse); 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{ @@ -2117,7 +3003,7 @@ func file_cosmos_feegrant_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_feegrant_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/feegrant/v1beta1/tx_grpc.pb.go b/api/cosmos/feegrant/v1beta1/tx_grpc.pb.go index 47ddb7a8329b..76637c5e0777 100644 --- a/api/cosmos/feegrant/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/feegrant/v1beta1/tx_grpc.pb.go @@ -23,6 +23,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( Msg_GrantAllowance_FullMethodName = "/cosmos.feegrant.v1beta1.Msg/GrantAllowance" Msg_RevokeAllowance_FullMethodName = "/cosmos.feegrant.v1beta1.Msg/RevokeAllowance" + Msg_PruneAllowances_FullMethodName = "/cosmos.feegrant.v1beta1.Msg/PruneAllowances" ) // MsgClient is the client API for Msg service. @@ -35,6 +36,10 @@ type MsgClient interface { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, opts ...grpc.CallOption) (*MsgRevokeAllowanceResponse, error) + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 + PruneAllowances(ctx context.Context, in *MsgPruneAllowances, opts ...grpc.CallOption) (*MsgPruneAllowancesResponse, error) } type msgClient struct { @@ -63,6 +68,15 @@ func (c *msgClient) RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, return out, nil } +func (c *msgClient) PruneAllowances(ctx context.Context, in *MsgPruneAllowances, opts ...grpc.CallOption) (*MsgPruneAllowancesResponse, error) { + out := new(MsgPruneAllowancesResponse) + err := c.cc.Invoke(ctx, Msg_PruneAllowances_FullMethodName, in, out, opts...) + 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 @@ -73,6 +87,10 @@ type MsgServer interface { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. RevokeAllowance(context.Context, *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error) + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 + PruneAllowances(context.Context, *MsgPruneAllowances) (*MsgPruneAllowancesResponse, error) mustEmbedUnimplementedMsgServer() } @@ -86,6 +104,9 @@ func (UnimplementedMsgServer) GrantAllowance(context.Context, *MsgGrantAllowance func (UnimplementedMsgServer) RevokeAllowance(context.Context, *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RevokeAllowance not implemented") } +func (UnimplementedMsgServer) PruneAllowances(context.Context, *MsgPruneAllowances) (*MsgPruneAllowancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PruneAllowances not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -135,6 +156,24 @@ func _Msg_RevokeAllowance_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_PruneAllowances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPruneAllowances) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).PruneAllowances(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_PruneAllowances_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).PruneAllowances(ctx, req.(*MsgPruneAllowances)) + } + 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) @@ -150,6 +189,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "RevokeAllowance", Handler: _Msg_RevokeAllowance_Handler, }, + { + MethodName: "PruneAllowances", + Handler: _Msg_PruneAllowances_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/feegrant/v1beta1/tx.proto", diff --git a/proto/cosmos/feegrant/v1beta1/tx.proto b/proto/cosmos/feegrant/v1beta1/tx.proto index 37e505c4e9a2..a45eec3ba368 100644 --- a/proto/cosmos/feegrant/v1beta1/tx.proto +++ b/proto/cosmos/feegrant/v1beta1/tx.proto @@ -20,6 +20,11 @@ service Msg { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. rpc RevokeAllowance(MsgRevokeAllowance) returns (MsgRevokeAllowanceResponse); + + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 + rpc PruneAllowances(MsgPruneAllowances) returns (MsgPruneAllowancesResponse); } // MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -55,3 +60,18 @@ message MsgRevokeAllowance { // MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. message MsgRevokeAllowanceResponse {} + +// MsgPruneAllowances prunes expired fee allowances. +// +// Since cosmos-sdk 0.50 +message MsgPruneAllowances { + option (cosmos.msg.v1.signer) = "pruner"; + + // pruner is the address of the user pruning expired allowances. + string pruner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. +// +// Since cosmos-sdk 0.50 +message MsgPruneAllowancesResponse {} \ No newline at end of file diff --git a/simapp/go.mod b/simapp/go.mod index d689d8055633..4de28a6e1f57 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -14,7 +14,7 @@ require ( cosmossdk.io/tools/confix v0.0.0-20230925151519-64e0e8980834 cosmossdk.io/x/circuit v0.0.0-20231006095526-33390754f9fe cosmossdk.io/x/evidence v0.0.0-20230925151519-64e0e8980834 - cosmossdk.io/x/feegrant v0.0.0-20231009114728-5259373edec8 + cosmossdk.io/x/feegrant v0.0.0-20231020161330-8acf4f8853ca cosmossdk.io/x/nft v0.0.0-20231006095526-33390754f9fe cosmossdk.io/x/tx v0.11.0 cosmossdk.io/x/upgrade v0.0.0-20230925151519-64e0e8980834 diff --git a/simapp/go.sum b/simapp/go.sum index 98c21cee5325..a69aa96f3d9f 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -211,8 +211,8 @@ cosmossdk.io/x/circuit v0.0.0-20231006095526-33390754f9fe h1:xcQTAlbv1l8PBHXI5/x cosmossdk.io/x/circuit v0.0.0-20231006095526-33390754f9fe/go.mod h1:syo6njNlaE1KLXRFd1gZQr/7pMstANp2zMqVUC+u4h4= cosmossdk.io/x/evidence v0.0.0-20230925151519-64e0e8980834 h1:h4ooSV3X5BxEfl3EUbOlXNFMnEc/mXTXF5mdl17CQLg= cosmossdk.io/x/evidence v0.0.0-20230925151519-64e0e8980834/go.mod h1:yUgv71a56ZEJu7c8BXWCliDrQ7Ag+FCZ//rYKw9S93U= -cosmossdk.io/x/feegrant v0.0.0-20231009114728-5259373edec8 h1:e3JUrisu36fIf+EzppkSeryOocs7oUue4e1IepdhMMI= -cosmossdk.io/x/feegrant v0.0.0-20231009114728-5259373edec8/go.mod h1:nnIKdJKz1Os+sOlJHrjgMOh1WAlle0aV7Y+0x434OyI= +cosmossdk.io/x/feegrant v0.0.0-20231020161330-8acf4f8853ca h1:YuagGZRMuE6lg913jEVGHTf6b4cWjt+gJdnhTmFQ1LA= +cosmossdk.io/x/feegrant v0.0.0-20231020161330-8acf4f8853ca/go.mod h1:vmiW+2cIfGZULh6ReN03sawbhn8UUGrttNMxiIiduKI= cosmossdk.io/x/nft v0.0.0-20231006095526-33390754f9fe h1:xDWsbJp/9Tdwh2w8/KT7E0sxb52ASTn1M+UO4pq6kko= cosmossdk.io/x/nft v0.0.0-20231006095526-33390754f9fe/go.mod h1:QQROAXjZWeJzH6dNHUNCPhs7zHrYjknH8gYynf0IvXs= cosmossdk.io/x/tx v0.11.0 h1:Ak2LIC06bXqPbpMIEorkQbwVddRvRys1sL3Cjm+KPfs= diff --git a/tests/go.mod b/tests/go.mod index 66e1e93d9f31..c96b043c9d20 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -12,7 +12,7 @@ require ( cosmossdk.io/simapp v0.0.0-20230620040119-e078f1a49e8b cosmossdk.io/store v1.0.0-rc.0 cosmossdk.io/x/evidence v0.0.0-20230925151519-64e0e8980834 - cosmossdk.io/x/feegrant v0.0.0-20231009114728-5259373edec8 + cosmossdk.io/x/feegrant v0.0.0-20231020161330-8acf4f8853ca cosmossdk.io/x/nft v0.0.0-20231006095526-33390754f9fe // indirect cosmossdk.io/x/tx v0.11.0 cosmossdk.io/x/upgrade v0.0.0-20230925151519-64e0e8980834 diff --git a/tests/go.sum b/tests/go.sum index 75d5eb88f69e..2d56d1aea891 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -209,8 +209,8 @@ cosmossdk.io/x/circuit v0.0.0-20231006095526-33390754f9fe h1:xcQTAlbv1l8PBHXI5/x cosmossdk.io/x/circuit v0.0.0-20231006095526-33390754f9fe/go.mod h1:syo6njNlaE1KLXRFd1gZQr/7pMstANp2zMqVUC+u4h4= cosmossdk.io/x/evidence v0.0.0-20230925151519-64e0e8980834 h1:h4ooSV3X5BxEfl3EUbOlXNFMnEc/mXTXF5mdl17CQLg= cosmossdk.io/x/evidence v0.0.0-20230925151519-64e0e8980834/go.mod h1:yUgv71a56ZEJu7c8BXWCliDrQ7Ag+FCZ//rYKw9S93U= -cosmossdk.io/x/feegrant v0.0.0-20231009114728-5259373edec8 h1:e3JUrisu36fIf+EzppkSeryOocs7oUue4e1IepdhMMI= -cosmossdk.io/x/feegrant v0.0.0-20231009114728-5259373edec8/go.mod h1:nnIKdJKz1Os+sOlJHrjgMOh1WAlle0aV7Y+0x434OyI= +cosmossdk.io/x/feegrant v0.0.0-20231020161330-8acf4f8853ca h1:YuagGZRMuE6lg913jEVGHTf6b4cWjt+gJdnhTmFQ1LA= +cosmossdk.io/x/feegrant v0.0.0-20231020161330-8acf4f8853ca/go.mod h1:vmiW+2cIfGZULh6ReN03sawbhn8UUGrttNMxiIiduKI= cosmossdk.io/x/nft v0.0.0-20231006095526-33390754f9fe h1:xDWsbJp/9Tdwh2w8/KT7E0sxb52ASTn1M+UO4pq6kko= cosmossdk.io/x/nft v0.0.0-20231006095526-33390754f9fe/go.mod h1:QQROAXjZWeJzH6dNHUNCPhs7zHrYjknH8gYynf0IvXs= cosmossdk.io/x/tx v0.11.0 h1:Ak2LIC06bXqPbpMIEorkQbwVddRvRys1sL3Cjm+KPfs= diff --git a/x/feegrant/CHANGELOG.md b/x/feegrant/CHANGELOG.md index 9dabfb6fa994..e6a1e9e04ea4 100644 --- a/x/feegrant/CHANGELOG.md +++ b/x/feegrant/CHANGELOG.md @@ -27,6 +27,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* [#18047](https://github.com/cosmos/cosmos-sdk/pull/18047) Added a limit of 200 grants pruned per EndBlock and the method PruneAllowances that prunes 75 expired grants on every run. * [#14649](https://github.com/cosmos/cosmos-sdk/pull/14649) The `x/feegrant` module is extracted to have a separate go.mod file which allows it to be a standalone module. ### API Breaking Changes diff --git a/x/feegrant/README.md b/x/feegrant/README.md index 9fcd1e476d6f..07524449a862 100644 --- a/x/feegrant/README.md +++ b/x/feegrant/README.md @@ -206,6 +206,14 @@ The feegrant module emits the following events: | message | granter | {granterAddress} | | message | grantee | {granteeAddress} | +### Prune fee allowances + +| Type | Attribute Key | Attribute Value | +| ------- | ------------- | ---------------- | +| message | action | prune_feegrant | +| message | pruner | {prunerAddress} | + + ## Client ### CLI diff --git a/x/feegrant/events.go b/x/feegrant/events.go index d5f047612370..70cb6990f0cd 100644 --- a/x/feegrant/events.go +++ b/x/feegrant/events.go @@ -6,7 +6,9 @@ const ( EventTypeRevokeFeeGrant = "revoke_feegrant" EventTypeSetFeeGrant = "set_feegrant" EventTypeUpdateFeeGrant = "update_feegrant" + EventTypePruneFeeGrant = "prune_feegrant" AttributeKeyGranter = "granter" AttributeKeyGrantee = "grantee" + AttributeKeyPruner = "pruner" ) diff --git a/x/feegrant/keeper/keeper.go b/x/feegrant/keeper/keeper.go index aa491665366d..37f46d97a215 100644 --- a/x/feegrant/keeper/keeper.go +++ b/x/feegrant/keeper/keeper.go @@ -233,12 +233,7 @@ func (k Keeper) IterateAllFeeAllowances(ctx context.Context, cb func(grant feegr // UseGrantedFees will try to pay the given fee from the granter's account as requested by the grantee func (k Keeper) UseGrantedFees(ctx context.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error { - f, err := k.getGrant(ctx, granter, grantee) - if err != nil { - return err - } - - grant, err := f.GetGrant() + grant, err := k.GetAllowance(ctx, granter, grantee) if err != nil { return err } @@ -322,10 +317,11 @@ func (k Keeper) addToFeeAllowanceQueue(ctx context.Context, grantKey []byte, exp } // RemoveExpiredAllowances iterates grantsByExpiryQueue and deletes the expired grants. -func (k Keeper) RemoveExpiredAllowances(ctx context.Context) error { +func (k Keeper) RemoveExpiredAllowances(ctx context.Context, limit int32) error { exp := sdk.UnwrapSDKContext(ctx).BlockTime() store := k.storeService.OpenKVStore(ctx) iterator, err := store.Iterator(feegrant.FeeAllowanceQueueKeyPrefix, storetypes.InclusiveEndBytes(feegrant.AllowanceByExpTimeKey(&exp))) + var count int32 if err != nil { return err } @@ -342,6 +338,12 @@ func (k Keeper) RemoveExpiredAllowances(ctx context.Context) error { if err != nil { return err } + + // limit the amount of iterations to avoid taking too much time + count++ + if count == limit { + return nil + } } return nil } diff --git a/x/feegrant/keeper/keeper_test.go b/x/feegrant/keeper/keeper_test.go index de527485fefd..fcfb5df2a5d5 100644 --- a/x/feegrant/keeper/keeper_test.go +++ b/x/feegrant/keeper/keeper_test.go @@ -38,7 +38,7 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *KeeperTestSuite) SetupTest() { - suite.addrs = simtestutil.CreateIncrementalAccounts(4) + suite.addrs = simtestutil.CreateIncrementalAccounts(20) key := storetypes.NewKVStoreKey(feegrant.StoreKey) testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(module.AppModuleBasic{}) @@ -46,10 +46,9 @@ func (suite *KeeperTestSuite) SetupTest() { // setup gomock and initialize some globally expected executions ctrl := gomock.NewController(suite.T()) suite.accountKeeper = feegranttestutil.NewMockAccountKeeper(ctrl) - suite.accountKeeper.EXPECT().GetAccount(gomock.Any(), suite.addrs[0]).Return(authtypes.NewBaseAccountWithAddress(suite.addrs[0])).AnyTimes() - suite.accountKeeper.EXPECT().GetAccount(gomock.Any(), suite.addrs[1]).Return(authtypes.NewBaseAccountWithAddress(suite.addrs[1])).AnyTimes() - suite.accountKeeper.EXPECT().GetAccount(gomock.Any(), suite.addrs[2]).Return(authtypes.NewBaseAccountWithAddress(suite.addrs[2])).AnyTimes() - suite.accountKeeper.EXPECT().GetAccount(gomock.Any(), suite.addrs[3]).Return(authtypes.NewBaseAccountWithAddress(suite.addrs[3])).AnyTimes() + for i := 0; i < len(suite.addrs); i++ { + suite.accountKeeper.EXPECT().GetAccount(gomock.Any(), suite.addrs[i]).Return(authtypes.NewBaseAccountWithAddress(suite.addrs[i])).AnyTimes() + } suite.accountKeeper.EXPECT().AddressCodec().Return(codecaddress.NewBech32Codec("cosmos")).AnyTimes() @@ -395,7 +394,9 @@ func (suite *KeeperTestSuite) TestPruneGrants() { } err := suite.feegrantKeeper.GrantAllowance(suite.ctx, tc.granter, tc.grantee, tc.allowance) suite.NoError(err) - suite.feegrantKeeper.RemoveExpiredAllowances(tc.ctx) + err = suite.feegrantKeeper.RemoveExpiredAllowances(tc.ctx, 5) + suite.NoError(err) + grant, err := suite.feegrantKeeper.GetAllowance(tc.ctx, tc.granter, tc.grantee) if tc.expErrMsg != "" { suite.Error(err) diff --git a/x/feegrant/keeper/msg_server.go b/x/feegrant/keeper/msg_server.go index 1b15208da6ff..966f25054562 100644 --- a/x/feegrant/keeper/msg_server.go +++ b/x/feegrant/keeper/msg_server.go @@ -89,3 +89,22 @@ func (k msgServer) RevokeAllowance(goCtx context.Context, msg *feegrant.MsgRevok return &feegrant.MsgRevokeAllowanceResponse{}, nil } + +// PruneAllowances removes expired allowances from the store. +func (k msgServer) PruneAllowances(ctx context.Context, req *feegrant.MsgPruneAllowances) (*feegrant.MsgPruneAllowancesResponse, error) { + // 75 is an arbitrary value, we can change it later if needed + err := k.RemoveExpiredAllowances(ctx, 75) + if err != nil { + return nil, err + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvent( + sdk.NewEvent( + feegrant.EventTypePruneFeeGrant, + sdk.NewAttribute(feegrant.AttributeKeyPruner, req.Pruner), + ), + ) + + return &feegrant.MsgPruneAllowancesResponse{}, nil +} diff --git a/x/feegrant/keeper/msg_server_test.go b/x/feegrant/keeper/msg_server_test.go index ea1a6e523aae..b3abaaedfd26 100644 --- a/x/feegrant/keeper/msg_server_test.go +++ b/x/feegrant/keeper/msg_server_test.go @@ -284,3 +284,66 @@ func (suite *KeeperTestSuite) TestRevokeAllowance() { }) } } + +func (suite *KeeperTestSuite) TestPruneAllowances() { + ctx := suite.ctx.WithBlockTime(time.Now()) + oneYear := ctx.BlockTime().AddDate(1, 0, 0) + + // We create 76 allowances, all expiring in one year + count := 0 + for i := 0; i < len(suite.addrs); i++ { + for j := 0; j < len(suite.addrs); j++ { + if count == 76 { + break + } + if suite.addrs[i].String() == suite.addrs[j].String() { + continue + } + + any, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{ + SpendLimit: suite.atom, + Expiration: &oneYear, + }) + suite.Require().NoError(err) + req := &feegrant.MsgGrantAllowance{ + Granter: suite.addrs[i].String(), + Grantee: suite.addrs[j].String(), + Allowance: any, + } + + _, err = suite.msgSrvr.GrantAllowance(ctx, req) + if err != nil { + // do not fail, just try with another pair + continue + } + + count++ + } + } + + // we have 76 allowances + count = 0 + err := suite.feegrantKeeper.IterateAllFeeAllowances(ctx, func(grant feegrant.Grant) bool { + count++ + return false + }) + suite.Require().NoError(err) + suite.Require().Equal(76, count) + + // after a year and one day passes, they are all expired + oneYearAndADay := ctx.BlockTime().AddDate(1, 0, 1) + ctx = suite.ctx.WithBlockTime(oneYearAndADay) + + // we prune them, but currently only 75 will be pruned + _, err = suite.msgSrvr.PruneAllowances(ctx, &feegrant.MsgPruneAllowances{}) + suite.Require().NoError(err) + + // we have 1 allowance left + count = 0 + err = suite.feegrantKeeper.IterateAllFeeAllowances(ctx, func(grant feegrant.Grant) bool { + count++ + return false + }) + suite.Require().NoError(err) + suite.Require().Equal(1, count) +} diff --git a/x/feegrant/module/abci.go b/x/feegrant/module/abci.go index 4dbab056a9a3..6f14eee3137c 100644 --- a/x/feegrant/module/abci.go +++ b/x/feegrant/module/abci.go @@ -1,14 +1,12 @@ package module import ( - "cosmossdk.io/x/feegrant/keeper" + "context" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/x/feegrant/keeper" ) -func EndBlocker(ctx sdk.Context, k keeper.Keeper) { - err := k.RemoveExpiredAllowances(ctx) - if err != nil { - panic(err) - } +func EndBlocker(ctx context.Context, k keeper.Keeper) error { + // 200 is an arbitrary value, we can change it later if needed + return k.RemoveExpiredAllowances(ctx, 200) } diff --git a/x/feegrant/module/abci_test.go b/x/feegrant/module/abci_test.go index 6e9b1f81ac1a..5c91de02fb7a 100644 --- a/x/feegrant/module/abci_test.go +++ b/x/feegrant/module/abci_test.go @@ -77,7 +77,7 @@ func TestFeegrantPruning(t *testing.T) { feegrant.RegisterQueryServer(queryHelper, feegrantKeeper) queryClient := feegrant.NewQueryClient(queryHelper) - module.EndBlocker(testCtx.Ctx, feegrantKeeper) + require.NoError(t, module.EndBlocker(testCtx.Ctx, feegrantKeeper)) res, err := queryClient.Allowances(testCtx.Ctx.Context(), &feegrant.QueryAllowancesRequest{ Grantee: grantee.String(), diff --git a/x/feegrant/module/autocli.go b/x/feegrant/module/autocli.go index 57e1ae4f21c7..f3bbd0597728 100644 --- a/x/feegrant/module/autocli.go +++ b/x/feegrant/module/autocli.go @@ -60,6 +60,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { {ProtoField: "grantee"}, }, }, + { + RpcMethod: "PruneAllowances", + Use: "prune", + Short: "Prune expired allowances", + Long: "Prune up to 75 expired allowances in order to reduce the size of the store when the number of expired allowances is large.", + Example: fmt.Sprintf(`$ %s tx feegrant prune --from [mykey]`, version.AppName), + }, }, EnhanceCustomCommand: true, }, diff --git a/x/feegrant/module/module.go b/x/feegrant/module/module.go index 82103c7a81cd..23ae96afce70 100644 --- a/x/feegrant/module/module.go +++ b/x/feegrant/module/module.go @@ -162,9 +162,7 @@ func (AppModule) ConsensusVersion() uint64 { return 2 } // EndBlock returns the end blocker for the feegrant module. It returns no validator // updates. func (am AppModule) EndBlock(ctx context.Context) error { - c := sdk.UnwrapSDKContext(ctx) - EndBlocker(c, am.keeper) - return nil + return EndBlocker(ctx, am.keeper) } func init() { diff --git a/x/feegrant/tx.pb.go b/x/feegrant/tx.pb.go index f0dcf66635f2..7646b28741a1 100644 --- a/x/feegrant/tx.pb.go +++ b/x/feegrant/tx.pb.go @@ -225,17 +225,106 @@ func (m *MsgRevokeAllowanceResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRevokeAllowanceResponse proto.InternalMessageInfo +// MsgPruneAllowances prunes expired fee allowances. +// +// Since cosmos-sdk 0.50 +type MsgPruneAllowances struct { + // pruner is the address of the user pruning expired allowances. + Pruner string `protobuf:"bytes,1,opt,name=pruner,proto3" json:"pruner,omitempty"` +} + +func (m *MsgPruneAllowances) Reset() { *m = MsgPruneAllowances{} } +func (m *MsgPruneAllowances) String() string { return proto.CompactTextString(m) } +func (*MsgPruneAllowances) ProtoMessage() {} +func (*MsgPruneAllowances) Descriptor() ([]byte, []int) { + return fileDescriptor_dd44ad7946dad783, []int{4} +} +func (m *MsgPruneAllowances) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPruneAllowances) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPruneAllowances.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 *MsgPruneAllowances) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPruneAllowances.Merge(m, src) +} +func (m *MsgPruneAllowances) XXX_Size() int { + return m.Size() +} +func (m *MsgPruneAllowances) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPruneAllowances.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPruneAllowances proto.InternalMessageInfo + +func (m *MsgPruneAllowances) GetPruner() string { + if m != nil { + return m.Pruner + } + return "" +} + +// MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. +// +// Since cosmos-sdk 0.50 +type MsgPruneAllowancesResponse struct { +} + +func (m *MsgPruneAllowancesResponse) Reset() { *m = MsgPruneAllowancesResponse{} } +func (m *MsgPruneAllowancesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPruneAllowancesResponse) ProtoMessage() {} +func (*MsgPruneAllowancesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dd44ad7946dad783, []int{5} +} +func (m *MsgPruneAllowancesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPruneAllowancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPruneAllowancesResponse.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 *MsgPruneAllowancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPruneAllowancesResponse.Merge(m, src) +} +func (m *MsgPruneAllowancesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPruneAllowancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPruneAllowancesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPruneAllowancesResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgGrantAllowance)(nil), "cosmos.feegrant.v1beta1.MsgGrantAllowance") proto.RegisterType((*MsgGrantAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse") proto.RegisterType((*MsgRevokeAllowance)(nil), "cosmos.feegrant.v1beta1.MsgRevokeAllowance") proto.RegisterType((*MsgRevokeAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse") + proto.RegisterType((*MsgPruneAllowances)(nil), "cosmos.feegrant.v1beta1.MsgPruneAllowances") + proto.RegisterType((*MsgPruneAllowancesResponse)(nil), "cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse") } func init() { proto.RegisterFile("cosmos/feegrant/v1beta1/tx.proto", fileDescriptor_dd44ad7946dad783) } var fileDescriptor_dd44ad7946dad783 = []byte{ - // 409 bytes of a gzipped FileDescriptorProto + // 455 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0x4b, 0x4d, 0x4d, 0x2f, 0x4a, 0xcc, 0x2b, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x87, 0xa8, @@ -254,14 +343,17 @@ var fileDescriptor_dd44ad7946dad783 = []byte{ 0xb2, 0xf5, 0x31, 0x7c, 0xad, 0x24, 0xcd, 0x25, 0x89, 0x21, 0x18, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0xaa, 0xb4, 0x86, 0x91, 0x4b, 0xc8, 0xb7, 0x38, 0x3d, 0x28, 0xb5, 0x2c, 0x3f, 0x3b, 0x95, 0xee, 0x21, 0x65, 0xa5, 0x87, 0xee, 0x15, 0x59, 0x54, 0xaf, 0xa0, 0xb9, 0x4b, 0x49, 0x86, - 0x4b, 0x0a, 0x53, 0x14, 0xe6, 0x19, 0xa3, 0xcf, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x05, - 0x5c, 0x7c, 0x68, 0x31, 0xaf, 0xa5, 0x87, 0x2b, 0x94, 0x31, 0x82, 0x46, 0xca, 0x88, 0x78, 0xb5, - 0x30, 0x9b, 0x85, 0x8a, 0xb9, 0xf8, 0xd1, 0x83, 0x50, 0x1b, 0x9f, 0x31, 0x68, 0x8a, 0xa5, 0x8c, - 0x49, 0x50, 0x0c, 0xb3, 0x54, 0x8a, 0xb5, 0xe1, 0xf9, 0x06, 0x2d, 0x46, 0x27, 0xc3, 0x13, 0x8f, - 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, - 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x82, 0xe6, 0x98, 0xe2, 0x94, 0x6c, 0xbd, 0xcc, - 0x7c, 0xfd, 0x0a, 0x78, 0x56, 0x4d, 0x62, 0x03, 0xa7, 0x42, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x3f, 0x13, 0x6c, 0x2e, 0xc4, 0x03, 0x00, 0x00, + 0x4b, 0x0a, 0x53, 0x14, 0xee, 0x99, 0x60, 0xb0, 0x5f, 0x02, 0x8a, 0x4a, 0xf3, 0x10, 0x92, 0xc5, + 0x42, 0x06, 0x5c, 0x6c, 0x05, 0x20, 0x21, 0xc2, 0x5e, 0x81, 0xaa, 0xb3, 0xe2, 0x06, 0xb9, 0x0a, + 0xca, 0x81, 0x5a, 0x89, 0x66, 0x28, 0xcc, 0x4a, 0xa3, 0x17, 0x4c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, + 0x42, 0x05, 0x5c, 0x7c, 0x68, 0x89, 0x4d, 0x4b, 0x0f, 0x57, 0xc4, 0x62, 0xc4, 0x86, 0x94, 0x11, + 0xf1, 0x6a, 0x61, 0x36, 0x0b, 0x15, 0x73, 0xf1, 0xa3, 0xc7, 0x9a, 0x36, 0x3e, 0x63, 0xd0, 0x14, + 0x4b, 0x19, 0x93, 0xa0, 0x18, 0xd9, 0x52, 0xf4, 0xe0, 0xc5, 0x6b, 0x29, 0x9a, 0x62, 0xfc, 0x96, + 0xe2, 0x08, 0x63, 0x29, 0xd6, 0x86, 0xe7, 0x1b, 0xb4, 0x18, 0x9d, 0x0c, 0x4f, 0x3c, 0x92, 0x63, + 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, + 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x0a, 0x5a, 0x32, 0x14, 0xa7, 0x64, 0xeb, 0x65, 0xe6, 0xeb, + 0x57, 0xc0, 0x8b, 0xa4, 0x24, 0x36, 0x70, 0x6e, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8d, + 0x04, 0xdd, 0xf4, 0xac, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -282,6 +374,10 @@ type MsgClient interface { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, opts ...grpc.CallOption) (*MsgRevokeAllowanceResponse, error) + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 + PruneAllowances(ctx context.Context, in *MsgPruneAllowances, opts ...grpc.CallOption) (*MsgPruneAllowancesResponse, error) } type msgClient struct { @@ -310,6 +406,15 @@ func (c *msgClient) RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, return out, nil } +func (c *msgClient) PruneAllowances(ctx context.Context, in *MsgPruneAllowances, opts ...grpc.CallOption) (*MsgPruneAllowancesResponse, error) { + out := new(MsgPruneAllowancesResponse) + err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Msg/PruneAllowances", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // GrantAllowance grants fee allowance to the grantee on the granter's @@ -318,6 +423,10 @@ type MsgServer interface { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. RevokeAllowance(context.Context, *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error) + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 + PruneAllowances(context.Context, *MsgPruneAllowances) (*MsgPruneAllowancesResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -330,6 +439,9 @@ func (*UnimplementedMsgServer) GrantAllowance(ctx context.Context, req *MsgGrant func (*UnimplementedMsgServer) RevokeAllowance(ctx context.Context, req *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RevokeAllowance not implemented") } +func (*UnimplementedMsgServer) PruneAllowances(ctx context.Context, req *MsgPruneAllowances) (*MsgPruneAllowancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PruneAllowances not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -371,6 +483,24 @@ func _Msg_RevokeAllowance_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_PruneAllowances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPruneAllowances) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).PruneAllowances(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.feegrant.v1beta1.Msg/PruneAllowances", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).PruneAllowances(ctx, req.(*MsgPruneAllowances)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.feegrant.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -383,6 +513,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RevokeAllowance", Handler: _Msg_RevokeAllowance_Handler, }, + { + MethodName: "PruneAllowances", + Handler: _Msg_PruneAllowances_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/feegrant/v1beta1/tx.proto", @@ -520,6 +654,59 @@ func (m *MsgRevokeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *MsgPruneAllowances) 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 *MsgPruneAllowances) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPruneAllowances) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Pruner) > 0 { + i -= len(m.Pruner) + copy(dAtA[i:], m.Pruner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Pruner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPruneAllowancesResponse) 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 *MsgPruneAllowancesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPruneAllowancesResponse) 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 @@ -587,6 +774,28 @@ func (m *MsgRevokeAllowanceResponse) Size() (n int) { return n } +func (m *MsgPruneAllowances) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Pruner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgPruneAllowancesResponse) 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 } @@ -957,6 +1166,138 @@ func (m *MsgRevokeAllowanceResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgPruneAllowances) 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: MsgPruneAllowances: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPruneAllowances: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pruner", 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.Pruner = 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 *MsgPruneAllowancesResponse) 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: MsgPruneAllowancesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPruneAllowancesResponse: 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