From 4caecf13bb5ae3954a8ef7412b68a1e120f924fd Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Mon, 16 Oct 2023 19:28:06 +0300 Subject: [PATCH] feat(x/feegrant): Add limits to grant pruning and enable message to aid manually (#18047) --- api/cosmos/feegrant/v1beta1/tx.pulsar.go | 958 +++++++++++++++++++++- api/cosmos/feegrant/v1beta1/tx_grpc.pb.go | 39 + client/v2/go.mod | 2 +- client/v2/go.sum | 4 +- go.mod | 2 +- go.sum | 4 +- proto/cosmos/feegrant/v1beta1/tx.proto | 20 + simapp/go.mod | 2 +- simapp/go.sum | 4 +- simapp/gomod2nix.toml | 4 +- tests/go.mod | 2 +- tests/go.sum | 4 +- tests/starship/tests/go.mod | 2 +- tests/starship/tests/go.sum | 4 +- x/circuit/go.mod | 2 +- x/circuit/go.sum | 4 +- x/evidence/go.mod | 2 +- x/evidence/go.sum | 4 +- x/feegrant/CHANGELOG.md | 1 + x/feegrant/README.md | 8 + x/feegrant/events.go | 2 + x/feegrant/go.mod | 2 +- x/feegrant/go.sum | 4 +- x/feegrant/keeper/keeper.go | 28 +- x/feegrant/keeper/keeper_test.go | 11 +- x/feegrant/keeper/msg_server.go | 20 + x/feegrant/keeper/msg_server_test.go | 66 ++ x/feegrant/module/abci.go | 12 +- x/feegrant/module/abci_test.go | 4 +- x/feegrant/module/autocli.go | 7 + x/feegrant/module/module.go | 5 +- x/feegrant/tx.pb.go | 351 +++++++- x/nft/go.mod | 2 +- x/nft/go.sum | 4 +- x/params/go.mod | 2 +- x/params/go.sum | 4 +- x/protocolpool/go.mod | 2 +- x/protocolpool/go.sum | 4 +- x/upgrade/go.mod | 2 +- x/upgrade/go.sum | 4 +- 40 files changed, 1486 insertions(+), 122 deletions(-) diff --git a/api/cosmos/feegrant/v1beta1/tx.pulsar.go b/api/cosmos/feegrant/v1beta1/tx.pulsar.go index 07dbc09fafe6..c27b7c8e51c3 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,70 @@ func (*MsgRevokeAllowanceResponse) Descriptor() ([]byte, []int) { return file_cosmos_feegrant_v1beta1_tx_proto_rawDescGZIP(), []int{3} } +// MsgPruneAllowances prunes expired fee allowances. +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. +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 +2830,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 +2889,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 +2968,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 +2999,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..1bfb94127da1 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,8 @@ 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. + PruneAllowances(ctx context.Context, in *MsgPruneAllowances, opts ...grpc.CallOption) (*MsgPruneAllowancesResponse, error) } type msgClient struct { @@ -63,6 +66,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 +85,8 @@ 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. + PruneAllowances(context.Context, *MsgPruneAllowances) (*MsgPruneAllowancesResponse, error) mustEmbedUnimplementedMsgServer() } @@ -86,6 +100,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 +152,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 +185,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/client/v2/go.mod b/client/v2/go.mod index fb344da9eaef..4025d1e47379 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/client/v2 go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/x/tx v0.10.0 diff --git a/client/v2/go.sum b/client/v2/go.sum index 0aa30f3fa53f..97d1976de8c0 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/go.mod b/go.mod index fbe86ca182d1..ad4265b89291 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ toolchain go1.21.0 module github.com/cosmos/cosmos-sdk require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/go.sum b/go.sum index ccad68ed1441..4a5f735947c9 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= 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 2f1cc1377b6e..c5c8790207e2 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/simapp go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 diff --git a/simapp/go.sum b/simapp/go.sum index 511b0cf70672..75f441b6cce3 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/simapp/gomod2nix.toml b/simapp/gomod2nix.toml index ae686db8f826..4d83e446fa58 100644 --- a/simapp/gomod2nix.toml +++ b/simapp/gomod2nix.toml @@ -17,8 +17,8 @@ schema = 3 version = "v1.33.0" hash = "sha256-oW2OubL84ZHjw7/XD6Pjl6pdUPkAqtFS2bXQKVUec6A=" [mod."cosmossdk.io/api"] - version = "v0.7.2-0.20230927090904-9dd34510e273" - hash = "sha256-KRosrgOUbZeHDkLcSRLq4e4DHugXynj5vSHNrzGKEqs=" + version = "v0.7.2-0.20231016084709-1314de734f17" + hash = "sha256-AByjhMjt6dmx4mGr+ljAoFnBBeaDYnj71mgpnGbogys=" [mod."cosmossdk.io/collections"] version = "v0.4.0" hash = "sha256-minFyzgO/D+Oda4E3B1qvOAN5qd65SjS6nmjca4cp/8=" diff --git a/tests/go.mod b/tests/go.mod index bec6f0a55278..d348310661fd 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -3,7 +3,7 @@ module github.com/cosmos/cosmos-sdk/tests go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/tests/go.sum b/tests/go.sum index da2fe94c8aa4..e7bc9c53e47f 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/tests/starship/tests/go.mod b/tests/starship/tests/go.mod index 271da1ed90b3..38d16cbd4257 100644 --- a/tests/starship/tests/go.mod +++ b/tests/starship/tests/go.mod @@ -39,7 +39,7 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.3 // indirect cloud.google.com/go/storage v1.33.0 // indirect - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 // indirect + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 // indirect cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.12.0 // indirect diff --git a/tests/starship/tests/go.sum b/tests/starship/tests/go.sum index df8aa5397941..d3a8e81ebeaa 100644 --- a/tests/starship/tests/go.sum +++ b/tests/starship/tests/go.sum @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 1f457e113ce8..493de0bb2910 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/circuit go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 0aa30f3fa53f..97d1976de8c0 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 2e56a58fff78..beb51b7193eb 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/evidence go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 0aa30f3fa53f..97d1976de8c0 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/feegrant/CHANGELOG.md b/x/feegrant/CHANGELOG.md index 3b671d3bf36d..07efab6565ec 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/go.mod b/x/feegrant/go.mod index 003760fbc06f..227c3b7ec9d2 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/feegrant go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 4f53317f8b2f..f3ecc6b225af 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/feegrant/keeper/keeper.go b/x/feegrant/keeper/keeper.go index fa2bbcc94a27..1bb0c9dd264f 100644 --- a/x/feegrant/keeper/keeper.go +++ b/x/feegrant/keeper/keeper.go @@ -128,7 +128,7 @@ func (k Keeper) GrantAllowance(ctx context.Context, granter, grantee sdk.AccAddr // UpdateAllowance updates the existing grant. func (k Keeper) UpdateAllowance(ctx context.Context, granter, grantee sdk.AccAddress, feeAllowance feegrant.FeeAllowanceI) error { - _, err := k.getGrant(ctx, granter, grantee) + _, err := k.GetAllowance(ctx, granter, grantee) if err != nil { return err } @@ -215,16 +215,6 @@ func (k Keeper) GetAllowance(ctx context.Context, granter, grantee sdk.AccAddres return grant.GetGrant() } -// getGrant returns entire grant between both accounts -func (k Keeper) getGrant(ctx context.Context, granter, grantee sdk.AccAddress) (*feegrant.Grant, error) { - feegrant, err := k.FeeAllowance.Get(ctx, collections.Join(grantee, granter)) - if err != nil { - return nil, err - } - - return &feegrant, nil -} - // IterateAllFeeAllowances iterates over all the grants in the store. // Callback to get all data, returns true to stop, false to keep reading // Calling this without pagination is very expensive and only designed for export genesis @@ -245,12 +235,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 } @@ -334,9 +319,10 @@ func (k Keeper) ExportGenesis(ctx context.Context) (*feegrant.GenesisState, erro } // RemoveExpiredAllowances iterates grantsByExpiryQueue and deletes the expired grants. -func (k Keeper) RemoveExpiredAllowances(ctx context.Context) error { +func (k Keeper) RemoveExpiredAllowances(ctx context.Context, limit int) error { exp := sdk.UnwrapSDKContext(ctx).HeaderInfo().Time rng := collections.NewPrefixUntilTripleRange[time.Time, sdk.AccAddress, sdk.AccAddress](exp) + count := 0 err := k.FeeAllowanceQueue.Walk(ctx, rng, func(key collections.Triple[time.Time, sdk.AccAddress, sdk.AccAddress], value bool) (stop bool, err error) { grantee, granter := key.K2(), key.K3() @@ -349,6 +335,12 @@ func (k Keeper) RemoveExpiredAllowances(ctx context.Context) error { return true, err } + // limit the amount of iterations to avoid taking too much time + count++ + if count == limit { + return true, nil + } + return false, nil }) if err != nil { diff --git a/x/feegrant/keeper/keeper_test.go b/x/feegrant/keeper/keeper_test.go index f043a4df8fb5..272618a7121a 100644 --- a/x/feegrant/keeper/keeper_test.go +++ b/x/feegrant/keeper/keeper_test.go @@ -40,7 +40,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{}) @@ -48,10 +48,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() + } ac := codecaddress.NewBech32Codec("cosmos") suite.accountKeeper.EXPECT().AddressCodec().Return(ac).AnyTimes() @@ -416,7 +415,7 @@ func (suite *KeeperTestSuite) TestPruneGrants() { } err := suite.feegrantKeeper.GrantAllowance(suite.ctx, tc.granter, tc.grantee, tc.allowance) suite.NoError(err) - 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) diff --git a/x/feegrant/keeper/msg_server.go b/x/feegrant/keeper/msg_server.go index d700d6667cfe..f3c5319123ac 100644 --- a/x/feegrant/keeper/msg_server.go +++ b/x/feegrant/keeper/msg_server.go @@ -7,6 +7,7 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/x/feegrant" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -84,3 +85,22 @@ func (k msgServer) RevokeAllowance(ctx context.Context, msg *feegrant.MsgRevokeA 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 707b4264d80f..e368df88b66a 100644 --- a/x/feegrant/keeper/msg_server_test.go +++ b/x/feegrant/keeper/msg_server_test.go @@ -5,11 +5,13 @@ import ( "github.com/golang/mock/gomock" + "cosmossdk.io/collections" "cosmossdk.io/core/header" "cosmossdk.io/x/feegrant" codecaddress "github.com/cosmos/cosmos-sdk/codec/address" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -286,3 +288,67 @@ func (suite *KeeperTestSuite) TestRevokeAllowance() { }) } } + +func (suite *KeeperTestSuite) TestPruneAllowances() { + ctx := suite.ctx.WithHeaderInfo(header.Info{Time: time.Now()}) + oneYear := ctx.HeaderInfo().Time.AddDate(1, 0, 0) + + // We create 76 allowances, all expiring in one year + count := 0 + for i := 0; i < len(suite.encodedAddrs); i++ { + for j := 0; j < len(suite.encodedAddrs); j++ { + if count == 76 { + break + } + if suite.encodedAddrs[i] == suite.encodedAddrs[j] { + continue + } + + any, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{ + SpendLimit: suite.atom, + Expiration: &oneYear, + }) + suite.Require().NoError(err) + req := &feegrant.MsgGrantAllowance{ + Granter: suite.encodedAddrs[i], + Grantee: suite.encodedAddrs[j], + 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.FeeAllowance.Walk(ctx, nil, func(key collections.Pair[types.AccAddress, types.AccAddress], value feegrant.Grant) (stop bool, err error) { + count++ + return false, nil + }) + suite.Require().NoError(err) + suite.Require().Equal(76, count) + + // after a year and one day passes, they are all expired + oneYearAndADay := ctx.HeaderInfo().Time.AddDate(1, 0, 1) + ctx = suite.ctx.WithHeaderInfo(header.Info{Time: 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.FeeAllowance.Walk(ctx, nil, func(key collections.Pair[types.AccAddress, types.AccAddress], value feegrant.Grant) (stop bool, err error) { + count++ + + return false, nil + }) + 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 ff9c5b0fb4f3..34280ef68a88 100644 --- a/x/feegrant/module/abci_test.go +++ b/x/feegrant/module/abci_test.go @@ -83,7 +83,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)) granteeStr, err := ac.BytesToString(grantee) require.NoError(t, err) @@ -95,7 +95,7 @@ func TestFeegrantPruning(t *testing.T) { require.Len(t, res.Allowances, 2) testCtx.Ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Time: now.AddDate(0, 0, 2)}) - module.EndBlocker(testCtx.Ctx, feegrantKeeper) + require.NoError(t, module.EndBlocker(testCtx.Ctx, feegrantKeeper)) res, err = queryClient.Allowances(testCtx.Ctx.Context(), &feegrant.QueryAllowancesRequest{ Grantee: granteeStr, diff --git a/x/feegrant/module/autocli.go b/x/feegrant/module/autocli.go index 3ba095376ab1..818c3be9c3e6 100644 --- a/x/feegrant/module/autocli.go +++ b/x/feegrant/module/autocli.go @@ -63,6 +63,13 @@ You can find the fee-grant of a granter and grantee.`), {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 cc3d08cd06b0..97f30b7ef029 100644 --- a/x/feegrant/module/module.go +++ b/x/feegrant/module/module.go @@ -21,7 +21,6 @@ import ( sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) @@ -160,9 +159,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..7bc84761b388 100644 --- a/x/feegrant/tx.pb.go +++ b/x/feegrant/tx.pb.go @@ -225,17 +225,102 @@ func (m *MsgRevokeAllowanceResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRevokeAllowanceResponse proto.InternalMessageInfo +// MsgPruneAllowances prunes expired fee allowances. +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. +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 +339,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 +370,8 @@ 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. + PruneAllowances(ctx context.Context, in *MsgPruneAllowances, opts ...grpc.CallOption) (*MsgPruneAllowancesResponse, error) } type msgClient struct { @@ -310,6 +400,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 +417,8 @@ 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. + PruneAllowances(context.Context, *MsgPruneAllowances) (*MsgPruneAllowancesResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -330,6 +431,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 +475,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 +505,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 +646,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 +766,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 +1158,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 diff --git a/x/nft/go.mod b/x/nft/go.mod index a35da5fe986e..c1f0c7cff7d6 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/nft go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/nft/go.sum b/x/nft/go.sum index 0aa30f3fa53f..97d1976de8c0 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/params/go.mod b/x/params/go.mod index aecd6a2fa0e4..450b57708728 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/params go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/params/go.sum b/x/params/go.sum index 0aa30f3fa53f..97d1976de8c0 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 15c6850dffeb..1652d1b1ba85 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/protocolpool go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index f469d59e4bd0..de2b7cef8766 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 1e3b4a1cba36..5f644d1b8880 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/upgrade go 1.21 require ( - cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 + cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 0fec0db9d13b..cb25af4f21b5 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273 h1:rNTYK/OQQ5B8jNY0wGSOv+64Fwm7DG8Yke5eRmdTPqk= -cosmossdk.io/api v0.7.2-0.20230927090904-9dd34510e273/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17 h1:bCxnZ6XHFedjB1bT1twYfaLxY/uMkIxgFGOFtQ9xnt4= +cosmossdk.io/api v0.7.2-0.20231016084709-1314de734f17/go.mod h1:RgzIuGUBiX4E4imKHFyxl+uSKU+qs2v0W2ymVoGoyQQ= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU=