diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b8e796d8d98..f99936eafda 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -722,14 +722,6 @@ jobs: run: | cd x/accounts/defaults/lockup go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./... - - name: sonarcloud - if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - with: - projectBaseDir: x/accounts/defaults/lockup/ test-x-tx: runs-on: ubuntu-latest diff --git a/api/cosmos/accounts/defaults/lockup/tx.pulsar.go b/api/cosmos/accounts/defaults/lockup/tx.pulsar.go index 082db8883c5..5483fe9c096 100644 --- a/api/cosmos/accounts/defaults/lockup/tx.pulsar.go +++ b/api/cosmos/accounts/defaults/lockup/tx.pulsar.go @@ -3072,6 +3072,490 @@ func (x *fastReflection_MsgUndelegate) ProtoMethods() *protoiface.Methods { } } +var ( + md_MsgWithdrawReward protoreflect.MessageDescriptor + fd_MsgWithdrawReward_sender protoreflect.FieldDescriptor + fd_MsgWithdrawReward_validator_address protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_accounts_defaults_lockup_tx_proto_init() + md_MsgWithdrawReward = File_cosmos_accounts_defaults_lockup_tx_proto.Messages().ByName("MsgWithdrawReward") + fd_MsgWithdrawReward_sender = md_MsgWithdrawReward.Fields().ByName("sender") + fd_MsgWithdrawReward_validator_address = md_MsgWithdrawReward.Fields().ByName("validator_address") +} + +var _ protoreflect.Message = (*fastReflection_MsgWithdrawReward)(nil) + +type fastReflection_MsgWithdrawReward MsgWithdrawReward + +func (x *MsgWithdrawReward) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgWithdrawReward)(x) +} + +func (x *MsgWithdrawReward) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgWithdrawReward_messageType fastReflection_MsgWithdrawReward_messageType +var _ protoreflect.MessageType = fastReflection_MsgWithdrawReward_messageType{} + +type fastReflection_MsgWithdrawReward_messageType struct{} + +func (x fastReflection_MsgWithdrawReward_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgWithdrawReward)(nil) +} +func (x fastReflection_MsgWithdrawReward_messageType) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawReward) +} +func (x fastReflection_MsgWithdrawReward_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawReward +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgWithdrawReward) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawReward +} + +// 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_MsgWithdrawReward) Type() protoreflect.MessageType { + return _fastReflection_MsgWithdrawReward_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgWithdrawReward) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawReward) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgWithdrawReward) Interface() protoreflect.ProtoMessage { + return (*MsgWithdrawReward)(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_MsgWithdrawReward) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgWithdrawReward_sender, value) { + return + } + } + if x.ValidatorAddress != "" { + value := protoreflect.ValueOfString(x.ValidatorAddress) + if !f(fd_MsgWithdrawReward_validator_address, 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_MsgWithdrawReward) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.sender": + return x.Sender != "" + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.validator_address": + return x.ValidatorAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.lockup.MsgWithdrawReward")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.lockup.MsgWithdrawReward 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_MsgWithdrawReward) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.sender": + x.Sender = "" + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.validator_address": + x.ValidatorAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.lockup.MsgWithdrawReward")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.lockup.MsgWithdrawReward 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_MsgWithdrawReward) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.validator_address": + value := x.ValidatorAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.lockup.MsgWithdrawReward")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.lockup.MsgWithdrawReward 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_MsgWithdrawReward) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.sender": + x.Sender = value.Interface().(string) + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.validator_address": + x.ValidatorAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.lockup.MsgWithdrawReward")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.lockup.MsgWithdrawReward 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_MsgWithdrawReward) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.sender": + panic(fmt.Errorf("field sender of message cosmos.accounts.defaults.lockup.MsgWithdrawReward is not mutable")) + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.validator_address": + panic(fmt.Errorf("field validator_address of message cosmos.accounts.defaults.lockup.MsgWithdrawReward is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.lockup.MsgWithdrawReward")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.lockup.MsgWithdrawReward 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_MsgWithdrawReward) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.sender": + return protoreflect.ValueOfString("") + case "cosmos.accounts.defaults.lockup.MsgWithdrawReward.validator_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.lockup.MsgWithdrawReward")) + } + panic(fmt.Errorf("message cosmos.accounts.defaults.lockup.MsgWithdrawReward 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_MsgWithdrawReward) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.accounts.defaults.lockup.MsgWithdrawReward", 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_MsgWithdrawReward) 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_MsgWithdrawReward) 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_MsgWithdrawReward) 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_MsgWithdrawReward) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgWithdrawReward) + 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.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ValidatorAddress) + 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().(*MsgWithdrawReward) + 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.ValidatorAddress) > 0 { + i -= len(x.ValidatorAddress) + copy(dAtA[i:], x.ValidatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + 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().(*MsgWithdrawReward) + 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: MsgWithdrawReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawReward: 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 Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = 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 _ protoreflect.List = (*_MsgSend_3_list)(nil) type _MsgSend_3_list struct { @@ -3147,7 +3631,7 @@ func (x *MsgSend) ProtoReflect() protoreflect.Message { } func (x *MsgSend) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[6] + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3765,7 +4249,7 @@ func (x *MsgExecuteMessagesResponse) ProtoReflect() protoreflect.Message { } func (x *MsgExecuteMessagesResponse) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[7] + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4258,7 +4742,7 @@ func (x *MsgWithdraw) ProtoReflect() protoreflect.Message { } func (x *MsgWithdraw) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[8] + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4869,7 +5353,7 @@ func (x *MsgWithdrawResponse) ProtoReflect() protoreflect.Message { } func (x *MsgWithdrawResponse) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[9] + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5638,6 +6122,50 @@ func (x *MsgUndelegate) GetAmount() *v1beta1.Coin { return nil } +// MsgWithdrawReward defines a message that enable lockup account to execute withdraw reward message +type MsgWithdrawReward struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` +} + +func (x *MsgWithdrawReward) Reset() { + *x = MsgWithdrawReward{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgWithdrawReward) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgWithdrawReward) ProtoMessage() {} + +// Deprecated: Use MsgWithdrawReward.ProtoReflect.Descriptor instead. +func (*MsgWithdrawReward) Descriptor() ([]byte, []int) { + return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgWithdrawReward) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *MsgWithdrawReward) GetValidatorAddress() string { + if x != nil { + return x.ValidatorAddress + } + return "" +} + // MsgSend defines a message that enable lockup account to execute send message type MsgSend struct { state protoimpl.MessageState @@ -5652,7 +6180,7 @@ type MsgSend struct { func (x *MsgSend) Reset() { *x = MsgSend{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[6] + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5666,7 +6194,7 @@ func (*MsgSend) ProtoMessage() {} // Deprecated: Use MsgSend.ProtoReflect.Descriptor instead. func (*MsgSend) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{6} + return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{7} } func (x *MsgSend) GetSender() string { @@ -5702,7 +6230,7 @@ type MsgExecuteMessagesResponse struct { func (x *MsgExecuteMessagesResponse) Reset() { *x = MsgExecuteMessagesResponse{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[7] + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5716,7 +6244,7 @@ func (*MsgExecuteMessagesResponse) ProtoMessage() {} // Deprecated: Use MsgExecuteMessagesResponse.ProtoReflect.Descriptor instead. func (*MsgExecuteMessagesResponse) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{7} + return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{8} } func (x *MsgExecuteMessagesResponse) GetResponses() []*anypb.Any { @@ -5741,7 +6269,7 @@ type MsgWithdraw struct { func (x *MsgWithdraw) Reset() { *x = MsgWithdraw{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[8] + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5755,7 +6283,7 @@ func (*MsgWithdraw) ProtoMessage() {} // Deprecated: Use MsgWithdraw.ProtoReflect.Descriptor instead. func (*MsgWithdraw) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{8} + return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{9} } func (x *MsgWithdraw) GetWithdrawer() string { @@ -5792,7 +6320,7 @@ type MsgWithdrawResponse struct { func (x *MsgWithdrawResponse) Reset() { *x = MsgWithdrawResponse{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[9] + mi := &file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5806,7 +6334,7 @@ func (*MsgWithdrawResponse) ProtoMessage() {} // Deprecated: Use MsgWithdrawResponse.ProtoReflect.Descriptor instead. func (*MsgWithdrawResponse) Descriptor() ([]byte, []int) { - return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{9} + return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP(), []int{10} } func (x *MsgWithdrawResponse) GetReceiver() string { @@ -5913,70 +6441,81 @@ var file_cosmos_accounts_defaults_lockup_tx_proto_rawDesc = []byte{ 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x13, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x22, 0x84, 0x02, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x12, - 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x73, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x12, 0x37, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, - 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, - 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x13, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, - 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x50, 0x0a, 0x1a, 0x4d, 0x73, - 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0xb1, 0x01, 0x0a, - 0x0b, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x12, 0x38, 0x0a, 0x0a, - 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 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, 0x0a, 0x77, 0x69, 0x74, 0x68, - 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x73, 0x3a, 0x17, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, - 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, - 0x22, 0xd8, 0x01, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, - 0x69, 0x76, 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, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x8a, - 0x01, 0x0a, 0x0f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, - 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x42, 0x80, 0x02, 0x0a, 0x23, - 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x73, 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x6c, 0x6f, 0x63, - 0x6b, 0x75, 0x70, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, - 0x2f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, - 0xa2, 0x02, 0x04, 0x43, 0x41, 0x44, 0x4c, 0xaa, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0xca, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0xe2, 0x02, 0x2b, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x3a, 0x3a, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x65, 0x72, 0x22, 0xaa, 0x01, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, + 0x72, 0x61, 0x77, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, + 0x64, 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, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x11, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x13, 0x88, 0xa0, 0x1f, + 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x22, 0x84, 0x02, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x30, 0x0a, 0x06, + 0x73, 0x65, 0x6e, 0x64, 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, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x37, + 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x74, 0x6f, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, + 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, + 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x3a, 0x13, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x50, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x45, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0xb1, 0x01, 0x0a, 0x0b, 0x4d, 0x73, + 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x12, 0x38, 0x0a, 0x0a, 0x77, 0x69, 0x74, + 0x68, 0x64, 0x72, 0x61, 0x77, 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, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, + 0x77, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, + 0x6e, 0x6f, 0x6d, 0x73, 0x3a, 0x17, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, + 0xb0, 0x2a, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, 0x22, 0xd8, 0x01, + 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 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, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x8a, 0x01, 0x0a, 0x0f, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, + 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, + 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, + 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x42, 0x80, 0x02, 0x0a, 0x23, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, + 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0xa2, 0x02, 0x04, + 0x43, 0x41, 0x44, 0x4c, 0xaa, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, + 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0xca, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x5c, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0xe2, 0x02, 0x2b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x5c, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x73, 0x3a, 0x3a, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -5991,7 +6530,7 @@ func file_cosmos_accounts_defaults_lockup_tx_proto_rawDescGZIP() []byte { return file_cosmos_accounts_defaults_lockup_tx_proto_rawDescData } -var file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_cosmos_accounts_defaults_lockup_tx_proto_goTypes = []interface{}{ (*MsgInitLockupAccount)(nil), // 0: cosmos.accounts.defaults.lockup.MsgInitLockupAccount (*MsgInitLockupAccountResponse)(nil), // 1: cosmos.accounts.defaults.lockup.MsgInitLockupAccountResponse @@ -5999,25 +6538,26 @@ var file_cosmos_accounts_defaults_lockup_tx_proto_goTypes = []interface{}{ (*MsgInitPeriodicLockingAccountResponse)(nil), // 3: cosmos.accounts.defaults.lockup.MsgInitPeriodicLockingAccountResponse (*MsgDelegate)(nil), // 4: cosmos.accounts.defaults.lockup.MsgDelegate (*MsgUndelegate)(nil), // 5: cosmos.accounts.defaults.lockup.MsgUndelegate - (*MsgSend)(nil), // 6: cosmos.accounts.defaults.lockup.MsgSend - (*MsgExecuteMessagesResponse)(nil), // 7: cosmos.accounts.defaults.lockup.MsgExecuteMessagesResponse - (*MsgWithdraw)(nil), // 8: cosmos.accounts.defaults.lockup.MsgWithdraw - (*MsgWithdrawResponse)(nil), // 9: cosmos.accounts.defaults.lockup.MsgWithdrawResponse - (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp - (*Period)(nil), // 11: cosmos.accounts.defaults.lockup.Period - (*v1beta1.Coin)(nil), // 12: cosmos.base.v1beta1.Coin - (*anypb.Any)(nil), // 13: google.protobuf.Any + (*MsgWithdrawReward)(nil), // 6: cosmos.accounts.defaults.lockup.MsgWithdrawReward + (*MsgSend)(nil), // 7: cosmos.accounts.defaults.lockup.MsgSend + (*MsgExecuteMessagesResponse)(nil), // 8: cosmos.accounts.defaults.lockup.MsgExecuteMessagesResponse + (*MsgWithdraw)(nil), // 9: cosmos.accounts.defaults.lockup.MsgWithdraw + (*MsgWithdrawResponse)(nil), // 10: cosmos.accounts.defaults.lockup.MsgWithdrawResponse + (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp + (*Period)(nil), // 12: cosmos.accounts.defaults.lockup.Period + (*v1beta1.Coin)(nil), // 13: cosmos.base.v1beta1.Coin + (*anypb.Any)(nil), // 14: google.protobuf.Any } var file_cosmos_accounts_defaults_lockup_tx_proto_depIdxs = []int32{ - 10, // 0: cosmos.accounts.defaults.lockup.MsgInitLockupAccount.end_time:type_name -> google.protobuf.Timestamp - 10, // 1: cosmos.accounts.defaults.lockup.MsgInitLockupAccount.start_time:type_name -> google.protobuf.Timestamp - 10, // 2: cosmos.accounts.defaults.lockup.MsgInitPeriodicLockingAccount.start_time:type_name -> google.protobuf.Timestamp - 11, // 3: cosmos.accounts.defaults.lockup.MsgInitPeriodicLockingAccount.locking_periods:type_name -> cosmos.accounts.defaults.lockup.Period - 12, // 4: cosmos.accounts.defaults.lockup.MsgDelegate.amount:type_name -> cosmos.base.v1beta1.Coin - 12, // 5: cosmos.accounts.defaults.lockup.MsgUndelegate.amount:type_name -> cosmos.base.v1beta1.Coin - 12, // 6: cosmos.accounts.defaults.lockup.MsgSend.amount:type_name -> cosmos.base.v1beta1.Coin - 13, // 7: cosmos.accounts.defaults.lockup.MsgExecuteMessagesResponse.responses:type_name -> google.protobuf.Any - 12, // 8: cosmos.accounts.defaults.lockup.MsgWithdrawResponse.amount_received:type_name -> cosmos.base.v1beta1.Coin + 11, // 0: cosmos.accounts.defaults.lockup.MsgInitLockupAccount.end_time:type_name -> google.protobuf.Timestamp + 11, // 1: cosmos.accounts.defaults.lockup.MsgInitLockupAccount.start_time:type_name -> google.protobuf.Timestamp + 11, // 2: cosmos.accounts.defaults.lockup.MsgInitPeriodicLockingAccount.start_time:type_name -> google.protobuf.Timestamp + 12, // 3: cosmos.accounts.defaults.lockup.MsgInitPeriodicLockingAccount.locking_periods:type_name -> cosmos.accounts.defaults.lockup.Period + 13, // 4: cosmos.accounts.defaults.lockup.MsgDelegate.amount:type_name -> cosmos.base.v1beta1.Coin + 13, // 5: cosmos.accounts.defaults.lockup.MsgUndelegate.amount:type_name -> cosmos.base.v1beta1.Coin + 13, // 6: cosmos.accounts.defaults.lockup.MsgSend.amount:type_name -> cosmos.base.v1beta1.Coin + 14, // 7: cosmos.accounts.defaults.lockup.MsgExecuteMessagesResponse.responses:type_name -> google.protobuf.Any + 13, // 8: cosmos.accounts.defaults.lockup.MsgWithdrawResponse.amount_received:type_name -> cosmos.base.v1beta1.Coin 9, // [9:9] is the sub-list for method output_type 9, // [9:9] is the sub-list for method input_type 9, // [9:9] is the sub-list for extension type_name @@ -6105,7 +6645,7 @@ func file_cosmos_accounts_defaults_lockup_tx_proto_init() { } } file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgSend); i { + switch v := v.(*MsgWithdrawReward); i { case 0: return &v.state case 1: @@ -6117,7 +6657,7 @@ func file_cosmos_accounts_defaults_lockup_tx_proto_init() { } } file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgExecuteMessagesResponse); i { + switch v := v.(*MsgSend); i { case 0: return &v.state case 1: @@ -6129,7 +6669,7 @@ func file_cosmos_accounts_defaults_lockup_tx_proto_init() { } } file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgWithdraw); i { + switch v := v.(*MsgExecuteMessagesResponse); i { case 0: return &v.state case 1: @@ -6141,6 +6681,18 @@ func file_cosmos_accounts_defaults_lockup_tx_proto_init() { } } file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgWithdraw); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_accounts_defaults_lockup_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgWithdrawResponse); i { case 0: return &v.state @@ -6159,7 +6711,7 @@ func file_cosmos_accounts_defaults_lockup_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_accounts_defaults_lockup_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/tests/e2e/accounts/lockup/continous_lockup_test_suite.go b/tests/e2e/accounts/lockup/continous_lockup_test_suite.go index 36749f7f410..e331579cb6c 100644 --- a/tests/e2e/accounts/lockup/continous_lockup_test_suite.go +++ b/tests/e2e/accounts/lockup/continous_lockup_test_suite.go @@ -40,6 +40,10 @@ func (s *E2ETestSuite) TestContinuousLockingAccount() { addr, err := app.AuthKeeper.AddressCodec().BytesToString(randAcc) require.NoError(t, err) + vals, err := app.StakingKeeper.GetAllValidators(ctx) + require.NoError(t, err) + val := vals[0] + t.Run("error - execute message, wrong sender", func(t *testing.T) { msg := &types.MsgSend{ Sender: addr, @@ -109,9 +113,6 @@ func (s *E2ETestSuite) TestContinuousLockingAccount() { require.True(t, balance.Amount.Equal(math.NewInt(100))) }) t.Run("ok - execute delegate message", func(t *testing.T) { - vals, err := app.StakingKeeper.GetAllValidators(ctx) - require.NoError(t, err) - val := vals[0] msg := &types.MsgDelegate{ Sender: ownerAddrStr, ValidatorAddress: val.OperatorAddress, @@ -128,6 +129,19 @@ func (s *E2ETestSuite) TestContinuousLockingAccount() { ) require.NoError(t, err) require.NotNil(t, del) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.NewInt(100))) + }) + t.Run("ok - execute withdraw reward message", func(t *testing.T) { + msg := &types.MsgWithdrawReward{ + Sender: ownerAddrStr, + ValidatorAddress: val.OperatorAddress, + } + err = s.executeTx(ctx, msg, app, accountAddr, accOwner) + require.NoError(t, err) }) t.Run("ok - execute undelegate message", func(t *testing.T) { vals, err := app.StakingKeeper.GetAllValidators(ctx) @@ -148,5 +162,42 @@ func (s *E2ETestSuite) TestContinuousLockingAccount() { ) require.NoError(t, err) require.Equal(t, len(ubd.Entries), 1) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt())) + }) + + // Update context time to end time + ctx = ctx.WithHeaderInfo(header.Info{ + Time: currentTime.Add(time.Minute), + }) + + // test if tracking delegate work perfectly + t.Run("ok - execute delegate message", func(t *testing.T) { + msg := &types.MsgDelegate{ + Sender: ownerAddrStr, + ValidatorAddress: val.OperatorAddress, + Amount: sdk.NewCoin("stake", math.NewInt(100)), + } + err = s.executeTx(ctx, msg, app, accountAddr, accOwner) + require.NoError(t, err) + + valbz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.OperatorAddress) + require.NoError(t, err) + + del, err := app.StakingKeeper.Delegations.Get( + ctx, collections.Join(sdk.AccAddress(accountAddr), sdk.ValAddress(valbz)), + ) + require.NoError(t, err) + require.NotNil(t, del) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt())) + delFree := lockupAccountInfoResponse.DelegatedFree + require.True(t, delFree.AmountOf("stake").Equal(math.NewInt(100))) }) } diff --git a/tests/e2e/accounts/lockup/delayed_lockup_test_suite.go b/tests/e2e/accounts/lockup/delayed_lockup_test_suite.go index 73254b7f3b3..1b5a8784eeb 100644 --- a/tests/e2e/accounts/lockup/delayed_lockup_test_suite.go +++ b/tests/e2e/accounts/lockup/delayed_lockup_test_suite.go @@ -39,6 +39,10 @@ func (s *E2ETestSuite) TestDelayedLockingAccount() { addr, err := app.AuthKeeper.AddressCodec().BytesToString(randAcc) require.NoError(t, err) + vals, err := app.StakingKeeper.GetAllValidators(ctx) + require.NoError(t, err) + val := vals[0] + t.Run("error - execute message, wrong sender", func(t *testing.T) { msg := &types.MsgSend{ Sender: addr, @@ -71,9 +75,6 @@ func (s *E2ETestSuite) TestDelayedLockingAccount() { require.NotNil(t, err) }) t.Run("ok - execute delegate message", func(t *testing.T) { - vals, err := app.StakingKeeper.GetAllValidators(ctx) - require.NoError(t, err) - val := vals[0] msg := &types.MsgDelegate{ Sender: ownerAddrStr, ValidatorAddress: val.OperatorAddress, @@ -90,6 +91,19 @@ func (s *E2ETestSuite) TestDelayedLockingAccount() { ) require.NoError(t, err) require.NotNil(t, del) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.NewInt(100))) + }) + t.Run("ok - execute withdraw reward message", func(t *testing.T) { + msg := &types.MsgWithdrawReward{ + Sender: ownerAddrStr, + ValidatorAddress: val.OperatorAddress, + } + err = s.executeTx(ctx, msg, app, accountAddr, accOwner) + require.NoError(t, err) }) t.Run("ok - execute undelegate message", func(t *testing.T) { vals, err := app.StakingKeeper.GetAllValidators(ctx) @@ -110,6 +124,11 @@ func (s *E2ETestSuite) TestDelayedLockingAccount() { ) require.NoError(t, err) require.Equal(t, len(ubd.Entries), 1) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt())) }) // Update context time diff --git a/tests/e2e/accounts/lockup/periodic_lockup_test_suite.go b/tests/e2e/accounts/lockup/periodic_lockup_test_suite.go index 11647e7c94c..33be5172452 100644 --- a/tests/e2e/accounts/lockup/periodic_lockup_test_suite.go +++ b/tests/e2e/accounts/lockup/periodic_lockup_test_suite.go @@ -1,6 +1,7 @@ package lockup import ( + "fmt" "testing" "time" @@ -40,13 +41,21 @@ func (s *E2ETestSuite) TestPeriodicLockingAccount() { Amount: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(500))), Length: time.Minute, }, + { + Amount: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(500))), + Length: time.Minute, + }, }, - }, sdk.Coins{sdk.NewCoin("stake", math.NewInt(1000))}) + }, sdk.Coins{sdk.NewCoin("stake", math.NewInt(1500))}) require.NoError(t, err) addr, err := app.AuthKeeper.AddressCodec().BytesToString(randAcc) require.NoError(t, err) + vals, err := app.StakingKeeper.GetAllValidators(ctx) + require.NoError(t, err) + val := vals[0] + t.Run("error - execute message, wrong sender", func(t *testing.T) { msg := &types.MsgSend{ Sender: addr, @@ -125,13 +134,7 @@ func (s *E2ETestSuite) TestPeriodicLockingAccount() { require.True(t, balance.Amount.Equal(math.NewInt(500))) }) - // Fund acc since we withdraw all the funds - s.fundAccount(app, ctx, accountAddr, sdk.Coins{sdk.NewCoin("stake", math.NewInt(100))}) - t.Run("ok - execute delegate message", func(t *testing.T) { - vals, err := app.StakingKeeper.GetAllValidators(ctx) - require.NoError(t, err) - val := vals[0] msg := &types.MsgDelegate{ Sender: ownerAddrStr, ValidatorAddress: val.OperatorAddress, @@ -148,6 +151,20 @@ func (s *E2ETestSuite) TestPeriodicLockingAccount() { ) require.NoError(t, err) require.NotNil(t, del) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + fmt.Println(lockupAccountInfoResponse) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.NewInt(100))) + }) + t.Run("ok - execute withdraw reward message", func(t *testing.T) { + msg := &types.MsgWithdrawReward{ + Sender: ownerAddrStr, + ValidatorAddress: val.OperatorAddress, + } + err = s.executeTx(ctx, msg, app, accountAddr, accOwner) + require.NoError(t, err) }) t.Run("ok - execute undelegate message", func(t *testing.T) { vals, err := app.StakingKeeper.GetAllValidators(ctx) @@ -168,5 +185,40 @@ func (s *E2ETestSuite) TestPeriodicLockingAccount() { ) require.NoError(t, err) require.Equal(t, len(ubd.Entries), 1) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt())) + }) + + // Update context time + // After third period 1500stake should be unlock + ctx = ctx.WithHeaderInfo(header.Info{ + Time: currentTime.Add(time.Minute * 3), + }) + + t.Run("ok - execute delegate message", func(t *testing.T) { + msg := &types.MsgDelegate{ + Sender: ownerAddrStr, + ValidatorAddress: val.OperatorAddress, + Amount: sdk.NewCoin("stake", math.NewInt(100)), + } + err = s.executeTx(ctx, msg, app, accountAddr, accOwner) + require.NoError(t, err) + + valbz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.OperatorAddress) + require.NoError(t, err) + + del, err := app.StakingKeeper.Delegations.Get( + ctx, collections.Join(sdk.AccAddress(accountAddr), sdk.ValAddress(valbz)), + ) + require.NoError(t, err) + require.NotNil(t, del) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delFree := lockupAccountInfoResponse.DelegatedFree + require.True(t, delFree.AmountOf("stake").Equal(math.NewInt(100))) }) } diff --git a/tests/e2e/accounts/lockup/permanent_lockup_test_suite.go b/tests/e2e/accounts/lockup/permanent_lockup_test_suite.go index a376f018865..2ddec4ddf30 100644 --- a/tests/e2e/accounts/lockup/permanent_lockup_test_suite.go +++ b/tests/e2e/accounts/lockup/permanent_lockup_test_suite.go @@ -36,6 +36,10 @@ func (s *E2ETestSuite) TestPermanentLockingAccount() { addr, err := app.AuthKeeper.AddressCodec().BytesToString(randAcc) require.NoError(t, err) + vals, err := app.StakingKeeper.GetAllValidators(ctx) + require.NoError(t, err) + val := vals[0] + t.Run("error - execute message, wrong sender", func(t *testing.T) { msg := &types.MsgSend{ Sender: addr, @@ -55,9 +59,6 @@ func (s *E2ETestSuite) TestPermanentLockingAccount() { require.NotNil(t, err) }) t.Run("ok - execute delegate message", func(t *testing.T) { - vals, err := app.StakingKeeper.GetAllValidators(ctx) - require.NoError(t, err) - val := vals[0] msg := &types.MsgDelegate{ Sender: ownerAddrStr, ValidatorAddress: val.OperatorAddress, @@ -74,6 +75,19 @@ func (s *E2ETestSuite) TestPermanentLockingAccount() { ) require.NoError(t, err) require.NotNil(t, del) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.NewInt(100))) + }) + t.Run("ok - execute withdraw reward message", func(t *testing.T) { + msg := &types.MsgWithdrawReward{ + Sender: ownerAddrStr, + ValidatorAddress: val.OperatorAddress, + } + err = s.executeTx(ctx, msg, app, accountAddr, accOwner) + require.NoError(t, err) }) t.Run("ok - execute undelegate message", func(t *testing.T) { vals, err := app.StakingKeeper.GetAllValidators(ctx) @@ -94,6 +108,11 @@ func (s *E2ETestSuite) TestPermanentLockingAccount() { ) require.NoError(t, err) require.Equal(t, len(ubd.Entries), 1) + + // check if tracking is updated accordingly + lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr) + delLocking := lockupAccountInfoResponse.DelegatedLocking + require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt())) }) s.fundAccount(app, ctx, accountAddr, sdk.Coins{sdk.NewCoin("stake", math.NewInt(1000))}) diff --git a/tests/e2e/accounts/lockup/utils.go b/tests/e2e/accounts/lockup/utils.go index d486b33d38e..f636459dd06 100644 --- a/tests/e2e/accounts/lockup/utils.go +++ b/tests/e2e/accounts/lockup/utils.go @@ -5,14 +5,18 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "google.golang.org/protobuf/runtime/protoiface" "cosmossdk.io/simapp" + "cosmossdk.io/x/accounts/defaults/lockup/types" "cosmossdk.io/x/bank/testutil" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" ) +type ProtoMsg = protoiface.MessageV1 + var ( ownerAddr = secp256k1.GenPrivKey().PubKey().Address() accOwner = sdk.AccAddress(ownerAddr) @@ -48,6 +52,23 @@ func (s *E2ETestSuite) executeTx(ctx sdk.Context, msg sdk.Msg, app *simapp.SimAp return err } +func (s *E2ETestSuite) queryAcc(ctx sdk.Context, req sdk.Msg, app *simapp.SimApp, accAddr []byte) (ProtoMsg, error) { + resp, err := app.AccountsKeeper.Query(ctx, accAddr, req) + return resp, err +} + func (s *E2ETestSuite) fundAccount(app *simapp.SimApp, ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) { require.NoError(s.T(), testutil.FundAccount(ctx, app.BankKeeper, addr, amt)) } + +func (s *E2ETestSuite) queryLockupAccInfo(t *testing.T, ctx sdk.Context, app *simapp.SimApp, accAddr []byte) *types.QueryLockupAccountInfoResponse { + req := &types.QueryLockupAccountInfoRequest{} + resp, err := s.queryAcc(ctx, req, app, accAddr) + require.NoError(t, err) + require.NotNil(t, resp) + + lockupAccountInfoResponse, ok := resp.(*types.QueryLockupAccountInfoResponse) + require.True(t, ok) + + return lockupAccountInfoResponse +} diff --git a/x/accounts/defaults/lockup/continuous_locking_account.go b/x/accounts/defaults/lockup/continuous_locking_account.go index aa705aa4c7e..c90b909cf6c 100644 --- a/x/accounts/defaults/lockup/continuous_locking_account.go +++ b/x/accounts/defaults/lockup/continuous_locking_account.go @@ -41,7 +41,7 @@ func (cva ContinuousLockingAccount) Init(ctx context.Context, msg *lockuptypes.M return nil, sdkerrors.ErrInvalidRequest.Wrapf("invalid end time %s", msg.EndTime.String()) } - if msg.EndTime.Before(msg.StartTime) || msg.EndTime.Equal(msg.StartTime) { + if !msg.EndTime.After(msg.StartTime) { return nil, sdkerrors.ErrInvalidRequest.Wrap("invalid start and end time (must be start before end)") } @@ -66,12 +66,6 @@ func (cva *ContinuousLockingAccount) Delegate(ctx context.Context, msg *lockupty return cva.BaseLockup.Delegate(ctx, msg, cva.GetLockedCoinsWithDenoms) } -func (cva *ContinuousLockingAccount) Undelegate(ctx context.Context, msg *lockuptypes.MsgUndelegate) ( - *lockuptypes.MsgExecuteMessagesResponse, error, -) { - return cva.BaseLockup.Undelegate(ctx, msg) -} - func (cva *ContinuousLockingAccount) SendCoins(ctx context.Context, msg *lockuptypes.MsgSend) ( *lockuptypes.MsgExecuteMessagesResponse, error, ) { @@ -89,36 +83,20 @@ func (cva ContinuousLockingAccount) GetLockCoinsInfo(ctx context.Context, blockT unlockedCoins = sdk.Coins{} lockedCoins = sdk.Coins{} - // We must handle the case where the start time for a lockup account has - // been set into the future or when the start of the chain is not exactly - // known. - startTime, err := cva.StartTime.Get(ctx) - if err != nil { - return nil, nil, err - } - endTime, err := cva.EndTime.Get(ctx) - if err != nil { - return nil, nil, err - } - var originalVesting sdk.Coins + var originalLocking sdk.Coins err = cva.IterateCoinEntries(ctx, cva.OriginalLocking, func(key string, value math.Int) (stop bool, err error) { - originalVesting = append(originalVesting, sdk.NewCoin(key, value)) - vestedCoin, vestingCoin, err := cva.GetLockCoinInfoWithDenom(ctx, blockTime, key) + originalLocking = append(originalLocking, sdk.NewCoin(key, value)) + unlockedCoin, lockedCoin, err := cva.GetLockCoinInfoWithDenom(ctx, blockTime, key) if err != nil { return true, err } - unlockedCoins = append(unlockedCoins, *vestedCoin) - lockedCoins = append(lockedCoins, *vestingCoin) + unlockedCoins = append(unlockedCoins, *unlockedCoin) + lockedCoins = append(lockedCoins, *lockedCoin) return false, nil }) if err != nil { return nil, nil, err } - if startTime.After(blockTime) { - return unlockedCoins, originalVesting, nil - } else if endTime.Before(blockTime) { - return originalVesting, lockedCoins, nil - } return unlockedCoins, lockedCoins, nil } @@ -215,9 +193,9 @@ func (cva ContinuousLockingAccount) RegisterInitHandler(builder *accountstd.Init func (cva ContinuousLockingAccount) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) { accountstd.RegisterExecuteHandler(builder, cva.Delegate) - accountstd.RegisterExecuteHandler(builder, cva.Undelegate) accountstd.RegisterExecuteHandler(builder, cva.SendCoins) accountstd.RegisterExecuteHandler(builder, cva.WithdrawUnlockedCoins) + cva.BaseLockup.RegisterExecuteHandlers(builder) } func (cva ContinuousLockingAccount) RegisterQueryHandlers(builder *accountstd.QueryBuilder) { diff --git a/x/accounts/defaults/lockup/delayed_locking_account.go b/x/accounts/defaults/lockup/delayed_locking_account.go index deb8361d5dc..057a9900144 100644 --- a/x/accounts/defaults/lockup/delayed_locking_account.go +++ b/x/accounts/defaults/lockup/delayed_locking_account.go @@ -43,12 +43,6 @@ func (dva *DelayedLockingAccount) Delegate(ctx context.Context, msg *lockuptypes return dva.BaseLockup.Delegate(ctx, msg, dva.GetLockedCoinsWithDenoms) } -func (dva *DelayedLockingAccount) Undelegate(ctx context.Context, msg *lockuptypes.MsgUndelegate) ( - *lockuptypes.MsgExecuteMessagesResponse, error, -) { - return dva.BaseLockup.Undelegate(ctx, msg) -} - func (dva *DelayedLockingAccount) SendCoins(ctx context.Context, msg *lockuptypes.MsgSend) ( *lockuptypes.MsgExecuteMessagesResponse, error, ) { @@ -148,9 +142,9 @@ func (dva DelayedLockingAccount) RegisterInitHandler(builder *accountstd.InitBui func (dva DelayedLockingAccount) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) { accountstd.RegisterExecuteHandler(builder, dva.Delegate) - accountstd.RegisterExecuteHandler(builder, dva.Undelegate) accountstd.RegisterExecuteHandler(builder, dva.SendCoins) accountstd.RegisterExecuteHandler(builder, dva.WithdrawUnlockedCoins) + dva.BaseLockup.RegisterExecuteHandlers(builder) } func (dva DelayedLockingAccount) RegisterQueryHandlers(builder *accountstd.QueryBuilder) { diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index 8eabfe8d0f0..b75eb01b50a 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -7,6 +7,8 @@ require ( cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 + cosmossdk.io/x/distribution v0.0.0-00010101000000-000000000000 + cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.12 ) @@ -20,7 +22,6 @@ require ( cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.0 // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.13.3 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect diff --git a/x/accounts/defaults/lockup/lockup.go b/x/accounts/defaults/lockup/lockup.go index c33aace8547..08f22b30496 100644 --- a/x/accounts/defaults/lockup/lockup.go +++ b/x/accounts/defaults/lockup/lockup.go @@ -17,6 +17,7 @@ import ( "cosmossdk.io/x/accounts/accountstd" lockuptypes "cosmossdk.io/x/accounts/defaults/lockup/types" banktypes "cosmossdk.io/x/bank/types" + distrtypes "cosmossdk.io/x/distribution/types" stakingtypes "cosmossdk.io/x/staking/types" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -99,18 +100,23 @@ func (bva *BaseLockup) Init(ctx context.Context, msg *lockuptypes.MsgInitLockupA if err != nil { return nil, err } + } - // Set initial value for all locked token - err = bva.DelegatedFree.Set(ctx, coin.Denom, math.ZeroInt()) - if err != nil { - return nil, err - } + bondDenom, err := getStakingDenom(ctx) + if err != nil { + return nil, err + } - // Set initial value for all locked token - err = bva.DelegatedLocking.Set(ctx, coin.Denom, math.ZeroInt()) - if err != nil { - return nil, err - } + // Set initial value for all locked token + err = bva.DelegatedFree.Set(ctx, bondDenom, math.ZeroInt()) + if err != nil { + return nil, err + } + + // Set initial value for all locked token + err = bva.DelegatedLocking.Set(ctx, bondDenom, math.ZeroInt()) + if err != nil { + return nil, err } err = bva.EndTime.Set(ctx, msg.EndTime) @@ -146,6 +152,7 @@ func (bva *BaseLockup) Delegate( if err != nil { return nil, err } + err = bva.TrackDelegation( ctx, sdk.Coins{*balance}, @@ -155,17 +162,18 @@ func (bva *BaseLockup) Delegate( if err != nil { return nil, err } + msgDelegate := &stakingtypes.MsgDelegate{ DelegatorAddress: delegatorAddress, ValidatorAddress: msg.ValidatorAddress, Amount: msg.Amount, } - responses, err := sendMessage(ctx, msgDelegate) + resp, err := sendMessage(ctx, msgDelegate) if err != nil { return nil, err } - return &lockuptypes.MsgExecuteMessagesResponse{Responses: responses}, nil + return &lockuptypes.MsgExecuteMessagesResponse{Responses: resp}, nil } func (bva *BaseLockup) Undelegate( @@ -183,17 +191,44 @@ func (bva *BaseLockup) Undelegate( return nil, err } + err = bva.TrackUndelegation(ctx, sdk.Coins{msg.Amount}) + if err != nil { + return nil, err + } + msgUndelegate := &stakingtypes.MsgUndelegate{ DelegatorAddress: delegatorAddress, ValidatorAddress: msg.ValidatorAddress, Amount: msg.Amount, } - responses, err := sendMessage(ctx, msgUndelegate) + resp, err := sendMessage(ctx, msgUndelegate) if err != nil { return nil, err } - err = bva.TrackUndelegation(ctx, sdk.Coins{msg.Amount}) + return &lockuptypes.MsgExecuteMessagesResponse{Responses: resp}, nil +} + +func (bva *BaseLockup) WithdrawReward( + ctx context.Context, msg *lockuptypes.MsgWithdrawReward, +) ( + *lockuptypes.MsgExecuteMessagesResponse, error, +) { + err := bva.checkSender(ctx, msg.Sender) + if err != nil { + return nil, err + } + whoami := accountstd.Whoami(ctx) + delegatorAddress, err := bva.addressCodec.BytesToString(whoami) + if err != nil { + return nil, err + } + + msgWithdraw := &distrtypes.MsgWithdrawDelegatorReward{ + DelegatorAddress: delegatorAddress, + ValidatorAddress: msg.ValidatorAddress, + } + responses, err := sendMessage(ctx, msgWithdraw) if err != nil { return nil, err } @@ -233,12 +268,12 @@ func (bva *BaseLockup) SendCoins( ToAddress: msg.ToAddress, Amount: msg.Amount, } - responses, err := sendMessage(ctx, msgSend) + resp, err := sendMessage(ctx, msgSend) if err != nil { return nil, err } - return &lockuptypes.MsgExecuteMessagesResponse{Responses: responses}, nil + return &lockuptypes.MsgExecuteMessagesResponse{Responses: resp}, nil } // WithdrawUnlockedCoins allow owner to withdraw the unlocked token for a specific denoms to an @@ -265,6 +300,7 @@ func (bva *BaseLockup) WithdrawUnlockedCoins( } amount := sdk.Coins{} + for _, denom := range msg.Denoms { balance, err := bva.getBalance(ctx, fromAddress, denom) if err != nil { @@ -321,6 +357,7 @@ func (bva *BaseLockup) WithdrawUnlockedCoins( ToAddress: msg.ToAddress, Amount: amount, } + _, err = sendMessage(ctx, msgSend) if err != nil { return nil, err @@ -362,6 +399,17 @@ func sendMessage(ctx context.Context, msg proto.Message) ([]*codectypes.Any, err return []*codectypes.Any{respAny}, nil } +func getStakingDenom(ctx context.Context) (string, error) { + // Query account balance for the sent denom + paramsQueryReq := &stakingtypes.QueryParamsRequest{} + resp, err := accountstd.QueryModule[stakingtypes.QueryParamsResponse](ctx, paramsQueryReq) + if err != nil { + return "", err + } + + return resp.Params.BondDenom, nil +} + // TrackDelegation tracks a delegation amount for any given lockup account type // given the amount of coins currently being locked and the current account balance // of the delegation denominations. @@ -371,49 +419,54 @@ func sendMessage(ctx context.Context, msg proto.Message) ([]*codectypes.Any, err func (bva *BaseLockup) TrackDelegation( ctx context.Context, balance, lockedCoins, amount sdk.Coins, ) error { - for _, coin := range amount { - baseAmt := balance.AmountOf(coin.Denom) - // return error if the delegation amount is zero or if the base coins does not - // exceed the desired delegation amount. - if coin.IsZero() || baseAmt.LT(coin.Amount) { - return sdkerrors.ErrInvalidCoins.Wrap("delegation attempt with zero coins or insufficient funds") - } + bondDenom, err := getStakingDenom(ctx) + if err != nil { + return err + } - lockedAmt := lockedCoins.AmountOf(coin.Denom) - delLockingAmt, err := bva.DelegatedLocking.Get(ctx, coin.Denom) + delAmt := amount.AmountOf(bondDenom) + baseAmt := balance.AmountOf(bondDenom) + + // return error if the delegation amount is zero or if the base coins does not + // exceed the desired delegation amount. + if delAmt.IsZero() || baseAmt.LT(delAmt) { + return sdkerrors.ErrInvalidCoins.Wrap("delegation attempt with zero coins for staking denom or insufficient funds") + } + + lockedAmt := lockedCoins.AmountOf(bondDenom) + delLockingAmt, err := bva.DelegatedLocking.Get(ctx, bondDenom) + if err != nil { + return err + } + delFreeAmt, err := bva.DelegatedFree.Get(ctx, bondDenom) + if err != nil { + return err + } + + // compute x and y per the specification, where: + // X := min(max(V - DV, 0), D) + // Y := D - X + x := math.MinInt(math.MaxInt(lockedAmt.Sub(delLockingAmt), math.ZeroInt()), delAmt) + y := delAmt.Sub(x) + + delLockingCoin := sdk.NewCoin(bondDenom, delLockingAmt) + delFreeCoin := sdk.NewCoin(bondDenom, delFreeAmt) + if !x.IsZero() { + xCoin := sdk.NewCoin(bondDenom, x) + newDelLocking := delLockingCoin.Add(xCoin) + err = bva.DelegatedLocking.Set(ctx, bondDenom, newDelLocking.Amount) if err != nil { return err } - delFreeAmt, err := bva.DelegatedFree.Get(ctx, coin.Denom) + } + + if !y.IsZero() { + yCoin := sdk.NewCoin(bondDenom, y) + newDelFree := delFreeCoin.Add(yCoin) + err = bva.DelegatedFree.Set(ctx, bondDenom, newDelFree.Amount) if err != nil { return err } - - // compute x and y per the specification, where: - // X := min(max(V - DV, 0), D) - // Y := D - X - x := math.MinInt(math.MaxInt(lockedAmt.Sub(delLockingAmt), math.ZeroInt()), coin.Amount) - y := coin.Amount.Sub(x) - - delLockingCoin := sdk.NewCoin(coin.Denom, delLockingAmt) - delFreeCoin := sdk.NewCoin(coin.Denom, delFreeAmt) - if !x.IsZero() { - xCoin := sdk.NewCoin(coin.Denom, x) - newDelLocking := delLockingCoin.Add(xCoin) - err = bva.DelegatedLocking.Set(ctx, newDelLocking.Denom, newDelLocking.Amount) - if err != nil { - return err - } - } - - if !y.IsZero() { - yCoin := sdk.NewCoin(coin.Denom, y) - newDelFree := delFreeCoin.Add(yCoin) - err = bva.DelegatedFree.Set(ctx, newDelFree.Denom, newDelFree.Amount) - if err != nil { - return err - } - } } return nil @@ -430,46 +483,48 @@ func (bva *BaseLockup) TrackDelegation( // // CONTRACT: The account's coins and undelegation coins must be sorted. func (bva *BaseLockup) TrackUndelegation(ctx context.Context, amount sdk.Coins) error { - for _, coin := range amount { - // return error if the undelegation amount is zero - if coin.IsZero() { - return sdkerrors.ErrInvalidCoins.Wrap("undelegation attempt with zero coins") - } + bondDenom, err := getStakingDenom(ctx) + if err != nil { + return err + } + delAmt := amount.AmountOf(bondDenom) + // return error if the undelegation amount is zero + if delAmt.IsZero() { + return sdkerrors.ErrInvalidCoins.Wrap("undelegation attempt with zero coins for staking denom") + } + delFreeAmt, err := bva.DelegatedFree.Get(ctx, bondDenom) + if err != nil { + return err + } + delLockingAmt, err := bva.DelegatedLocking.Get(ctx, bondDenom) + if err != nil { + return err + } - delFreeAmt, err := bva.DelegatedFree.Get(ctx, coin.Denom) + // compute x and y per the specification, where: + // X := min(DF, D) + // Y := min(DV, D - X) + x := math.MinInt(delFreeAmt, delAmt) + y := math.MinInt(delLockingAmt, delAmt.Sub(x)) + + delLockingCoin := sdk.NewCoin(bondDenom, delLockingAmt) + delFreeCoin := sdk.NewCoin(bondDenom, delFreeAmt) + if !x.IsZero() { + xCoin := sdk.NewCoin(bondDenom, x) + newDelFree := delFreeCoin.Sub(xCoin) + err = bva.DelegatedFree.Set(ctx, bondDenom, newDelFree.Amount) if err != nil { return err } - delLockingAmt, err := bva.DelegatedLocking.Get(ctx, coin.Denom) + } + + if !y.IsZero() { + yCoin := sdk.NewCoin(bondDenom, y) + newDelLocking := delLockingCoin.Sub(yCoin) + err = bva.DelegatedLocking.Set(ctx, bondDenom, newDelLocking.Amount) if err != nil { return err } - - // compute x and y per the specification, where: - // X := min(DF, D) - // Y := min(DV, D - X) - x := math.MinInt(delFreeAmt, coin.Amount) - y := math.MinInt(delLockingAmt, coin.Amount.Sub(x)) - - delLockingCoin := sdk.NewCoin(coin.Denom, delLockingAmt) - delFreeCoin := sdk.NewCoin(coin.Denom, delFreeAmt) - if !x.IsZero() { - xCoin := sdk.NewCoin(coin.Denom, x) - newDelFree := delFreeCoin.Sub(xCoin) - err = bva.DelegatedFree.Set(ctx, newDelFree.Denom, newDelFree.Amount) - if err != nil { - return err - } - } - - if !y.IsZero() { - yCoin := sdk.NewCoin(coin.Denom, y) - newDelLocking := delLockingCoin.Sub(yCoin) - err = bva.DelegatedLocking.Set(ctx, newDelLocking.Denom, newDelLocking.Amount) - if err != nil { - return err - } - } } return nil @@ -522,7 +577,7 @@ func (bva BaseLockup) checkTokensSendable(ctx context.Context, sender string, am return nil } -// IterateSendEnabledEntries iterates over all the SendEnabled entries. +// IterateCoinEntries iterates over all the CoinEntries entries. func (bva BaseLockup) IterateCoinEntries( ctx context.Context, entries collections.Map[string, math.Int], @@ -537,6 +592,16 @@ func (bva BaseLockup) IterateCoinEntries( // GetNotBondedLockedCoin returns the coin that are not spendable that are not bonded by denom // for a lockup account. If the coin by the provided denom are not locked, an coin with zero amount is returned. func (bva BaseLockup) GetNotBondedLockedCoin(ctx context.Context, lockedCoin sdk.Coin, denom string) (sdk.Coin, error) { + bondDenom, err := getStakingDenom(ctx) + if err != nil { + return sdk.Coin{}, err + } + + // if not bond denom then return the full locked coin + if bondDenom != denom { + return lockedCoin, nil + } + delegatedLockingAmt, err := bva.DelegatedLocking.Get(ctx, denom) if err != nil { return sdk.Coin{}, err @@ -576,23 +641,22 @@ func (bva BaseLockup) QueryLockupAccountBaseInfo(ctx context.Context, _ *lockupt return nil, err } - delegatedLocking := sdk.Coins{} - err = bva.IterateCoinEntries(ctx, bva.DelegatedLocking, func(key string, value math.Int) (stop bool, err error) { - delegatedLocking = append(delegatedLocking, sdk.NewCoin(key, value)) - return false, nil - }) + bondDenom, err := getStakingDenom(ctx) if err != nil { return nil, err } - delegatedFree := sdk.Coins{} - err = bva.IterateCoinEntries(ctx, bva.DelegatedFree, func(key string, value math.Int) (stop bool, err error) { - delegatedFree = append(delegatedFree, sdk.NewCoin(key, value)) - return false, nil - }) + delegatedLockingAmt, err := bva.DelegatedLocking.Get(ctx, bondDenom) if err != nil { return nil, err } + delegatedLocking := sdk.NewCoins(sdk.NewCoin(bondDenom, delegatedLockingAmt)) + + delegatedFreeAmt, err := bva.DelegatedFree.Get(ctx, bondDenom) + if err != nil { + return nil, err + } + delegatedFree := sdk.NewCoins(sdk.NewCoin(bondDenom, delegatedFreeAmt)) return &lockuptypes.QueryLockupAccountInfoResponse{ Owner: ownerAddress, @@ -602,3 +666,8 @@ func (bva BaseLockup) QueryLockupAccountBaseInfo(ctx context.Context, _ *lockupt EndTime: &endTime, }, nil } + +func (bva BaseLockup) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) { + accountstd.RegisterExecuteHandler(builder, bva.Undelegate) + accountstd.RegisterExecuteHandler(builder, bva.WithdrawReward) +} diff --git a/x/accounts/defaults/lockup/lockup_test.go b/x/accounts/defaults/lockup/lockup_test.go index 25477bc9c54..c76b16bf882 100644 --- a/x/accounts/defaults/lockup/lockup_test.go +++ b/x/accounts/defaults/lockup/lockup_test.go @@ -129,7 +129,7 @@ func TestTrackingDelegation(t *testing.T) { nil, nil, nil, - sdkerrors.ErrInvalidCoins.Wrap("delegation attempt with zero coins or insufficient funds"), + sdkerrors.ErrInvalidCoins.Wrap("delegation attempt with zero coins for staking denom or insufficient funds"), }, { "zero amount", @@ -138,7 +138,7 @@ func TestTrackingDelegation(t *testing.T) { nil, nil, nil, - sdkerrors.ErrInvalidCoins.Wrap("delegation attempt with zero coins or insufficient funds"), + sdkerrors.ErrInvalidCoins.Wrap("delegation attempt with zero coins for staking denom or insufficient funds"), }, } @@ -201,7 +201,7 @@ func TestTrackingUnDelegation(t *testing.T) { sdk.Coins{sdk.NewCoin("test", math.NewInt(0))}, nil, nil, - sdkerrors.ErrInvalidCoins.Wrap("undelegation attempt with zero coins"), + sdkerrors.ErrInvalidCoins.Wrap("undelegation attempt with zero coins for staking denom"), }, } diff --git a/x/accounts/defaults/lockup/periodic_locking_account.go b/x/accounts/defaults/lockup/periodic_locking_account.go index c4c45142fd1..71013980d9d 100644 --- a/x/accounts/defaults/lockup/periodic_locking_account.go +++ b/x/accounts/defaults/lockup/periodic_locking_account.go @@ -87,18 +87,23 @@ func (pva PeriodicLockingAccount) Init(ctx context.Context, msg *lockuptypes.Msg if err != nil { return nil, err } + } - // Set initial value for all delegated free token - err = pva.DelegatedFree.Set(ctx, coin.Denom, math.ZeroInt()) - if err != nil { - return nil, err - } + bondDenom, err := getStakingDenom(ctx) + if err != nil { + return nil, err + } - // Set initial value for all delegated locking token - err = pva.DelegatedLocking.Set(ctx, coin.Denom, math.ZeroInt()) - if err != nil { - return nil, err - } + // Set initial value for all locked token + err = pva.DelegatedFree.Set(ctx, bondDenom, math.ZeroInt()) + if err != nil { + return nil, err + } + + // Set initial value for all locked token + err = pva.DelegatedLocking.Set(ctx, bondDenom, math.ZeroInt()) + if err != nil { + return nil, err } err = pva.StartTime.Set(ctx, msg.StartTime) @@ -123,12 +128,6 @@ func (pva *PeriodicLockingAccount) Delegate(ctx context.Context, msg *lockuptype return pva.BaseLockup.Delegate(ctx, msg, pva.GetLockedCoinsWithDenoms) } -func (pva *PeriodicLockingAccount) Undelegate(ctx context.Context, msg *lockuptypes.MsgUndelegate) ( - *lockuptypes.MsgExecuteMessagesResponse, error, -) { - return pva.BaseLockup.Undelegate(ctx, msg) -} - func (pva *PeriodicLockingAccount) SendCoins(ctx context.Context, msg *lockuptypes.MsgSend) ( *lockuptypes.MsgExecuteMessagesResponse, error, ) { @@ -141,7 +140,7 @@ func (pva *PeriodicLockingAccount) WithdrawUnlockedCoins(ctx context.Context, ms return pva.BaseLockup.WithdrawUnlockedCoins(ctx, msg, pva.GetLockedCoinsWithDenoms) } -// IterateSendEnabledEntries iterates over all the SendEnabled entries. +// IteratePeriods iterates over all the Periods entries. func (pva PeriodicLockingAccount) IteratePeriods( ctx context.Context, cb func(value lockuptypes.Period) (bool, error), @@ -201,10 +200,7 @@ func (pva PeriodicLockingAccount) GetLockCoinsInfo(ctx context.Context, blockTim unlockedCoins = unlockedCoins.Add(period.Amount...) // update the start time of the next period - err = pva.StartTime.Set(ctx, currentPeriodStartTime.Add(period.Length)) - if err != nil { - return true, err - } + currentPeriodStartTime = currentPeriodStartTime.Add(period.Length) return false, nil }) if err != nil { @@ -268,10 +264,7 @@ func (pva PeriodicLockingAccount) GetLockCoinInfoWithDenom(ctx context.Context, unlocked = unlocked.Add(sdk.NewCoin(denom, period.Amount.AmountOf(denom))) // update the start time of the next period - err = pva.StartTime.Set(ctx, currentPeriodStartTime.Add(period.Length)) - if err != nil { - return true, err - } + currentPeriodStartTime = currentPeriodStartTime.Add(period.Length) return false, nil }) if err != nil { @@ -342,9 +335,9 @@ func (pva PeriodicLockingAccount) RegisterInitHandler(builder *accountstd.InitBu func (pva PeriodicLockingAccount) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) { accountstd.RegisterExecuteHandler(builder, pva.Delegate) - accountstd.RegisterExecuteHandler(builder, pva.Undelegate) accountstd.RegisterExecuteHandler(builder, pva.SendCoins) accountstd.RegisterExecuteHandler(builder, pva.WithdrawUnlockedCoins) + pva.BaseLockup.RegisterExecuteHandlers(builder) } func (pva PeriodicLockingAccount) RegisterQueryHandlers(builder *accountstd.QueryBuilder) { diff --git a/x/accounts/defaults/lockup/permanent_locking_account.go b/x/accounts/defaults/lockup/permanent_locking_account.go index 70a8b98dd1d..2ca615c15ba 100644 --- a/x/accounts/defaults/lockup/permanent_locking_account.go +++ b/x/accounts/defaults/lockup/permanent_locking_account.go @@ -100,8 +100,8 @@ func (plva PermanentLockingAccount) RegisterInitHandler(builder *accountstd.Init func (plva PermanentLockingAccount) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) { accountstd.RegisterExecuteHandler(builder, plva.Delegate) - accountstd.RegisterExecuteHandler(builder, plva.Undelegate) accountstd.RegisterExecuteHandler(builder, plva.SendCoins) + plva.BaseLockup.RegisterExecuteHandlers(builder) } func (plva PermanentLockingAccount) RegisterQueryHandlers(builder *accountstd.QueryBuilder) { diff --git a/x/accounts/defaults/lockup/sonar-project.properties b/x/accounts/defaults/lockup/sonar-project.properties deleted file mode 100644 index 84929aa7ef1..00000000000 --- a/x/accounts/defaults/lockup/sonar-project.properties +++ /dev/null @@ -1,15 +0,0 @@ -sonar.projectKey=cosmos-sdk-x-accounts-lockup -sonar.organization=cosmos - -sonar.projectName=Cosmos SDK - x/accounts/defaults/lockup -sonar.project.monorepo.enabled=true - -sonar.sources=. -sonar.exclusions=**/*_test.go -sonar.tests=. -sonar.test.inclusions=**/*_test.go -sonar.go.coverage.reportPaths=coverage.out - -sonar.sourceEncoding=UTF-8 -sonar.scm.provider=git -sonar.pullrequest.github.summary_comment=true \ No newline at end of file diff --git a/x/accounts/defaults/lockup/types/tx.pb.go b/x/accounts/defaults/lockup/types/tx.pb.go index c50ab2f5c36..6a4383e31c7 100644 --- a/x/accounts/defaults/lockup/types/tx.pb.go +++ b/x/accounts/defaults/lockup/types/tx.pb.go @@ -318,6 +318,45 @@ func (m *MsgUndelegate) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUndelegate proto.InternalMessageInfo +// MsgWithdrawReward defines a message that enable lockup account to execute withdraw reward message +type MsgWithdrawReward struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` +} + +func (m *MsgWithdrawReward) Reset() { *m = MsgWithdrawReward{} } +func (m *MsgWithdrawReward) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawReward) ProtoMessage() {} +func (*MsgWithdrawReward) Descriptor() ([]byte, []int) { + return fileDescriptor_e5f39108a4d67f92, []int{6} +} +func (m *MsgWithdrawReward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawReward.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 *MsgWithdrawReward) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawReward.Merge(m, src) +} +func (m *MsgWithdrawReward) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawReward) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawReward.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawReward proto.InternalMessageInfo + // MsgSend defines a message that enable lockup account to execute send message type MsgSend struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` @@ -329,7 +368,7 @@ func (m *MsgSend) Reset() { *m = MsgSend{} } func (m *MsgSend) String() string { return proto.CompactTextString(m) } func (*MsgSend) ProtoMessage() {} func (*MsgSend) Descriptor() ([]byte, []int) { - return fileDescriptor_e5f39108a4d67f92, []int{6} + return fileDescriptor_e5f39108a4d67f92, []int{7} } func (m *MsgSend) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -367,7 +406,7 @@ func (m *MsgExecuteMessagesResponse) Reset() { *m = MsgExecuteMessagesRe func (m *MsgExecuteMessagesResponse) String() string { return proto.CompactTextString(m) } func (*MsgExecuteMessagesResponse) ProtoMessage() {} func (*MsgExecuteMessagesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e5f39108a4d67f92, []int{7} + return fileDescriptor_e5f39108a4d67f92, []int{8} } func (m *MsgExecuteMessagesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -415,7 +454,7 @@ func (m *MsgWithdraw) Reset() { *m = MsgWithdraw{} } func (m *MsgWithdraw) String() string { return proto.CompactTextString(m) } func (*MsgWithdraw) ProtoMessage() {} func (*MsgWithdraw) Descriptor() ([]byte, []int) { - return fileDescriptor_e5f39108a4d67f92, []int{8} + return fileDescriptor_e5f39108a4d67f92, []int{9} } func (m *MsgWithdraw) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -454,7 +493,7 @@ func (m *MsgWithdrawResponse) Reset() { *m = MsgWithdrawResponse{} } func (m *MsgWithdrawResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawResponse) ProtoMessage() {} func (*MsgWithdrawResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e5f39108a4d67f92, []int{9} + return fileDescriptor_e5f39108a4d67f92, []int{10} } func (m *MsgWithdrawResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -504,6 +543,7 @@ func init() { proto.RegisterType((*MsgInitPeriodicLockingAccountResponse)(nil), "cosmos.accounts.defaults.lockup.MsgInitPeriodicLockingAccountResponse") proto.RegisterType((*MsgDelegate)(nil), "cosmos.accounts.defaults.lockup.MsgDelegate") proto.RegisterType((*MsgUndelegate)(nil), "cosmos.accounts.defaults.lockup.MsgUndelegate") + proto.RegisterType((*MsgWithdrawReward)(nil), "cosmos.accounts.defaults.lockup.MsgWithdrawReward") proto.RegisterType((*MsgSend)(nil), "cosmos.accounts.defaults.lockup.MsgSend") proto.RegisterType((*MsgExecuteMessagesResponse)(nil), "cosmos.accounts.defaults.lockup.MsgExecuteMessagesResponse") proto.RegisterType((*MsgWithdraw)(nil), "cosmos.accounts.defaults.lockup.MsgWithdraw") @@ -515,57 +555,58 @@ func init() { } var fileDescriptor_e5f39108a4d67f92 = []byte{ - // 797 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x3d, 0x4f, 0x1b, 0x49, - 0x18, 0xf6, 0xda, 0x3a, 0x83, 0x87, 0x03, 0x8e, 0xc5, 0x3a, 0x8c, 0x75, 0xec, 0x72, 0x96, 0x10, - 0x96, 0x75, 0xde, 0x3d, 0xb8, 0x93, 0xee, 0x64, 0x5d, 0x83, 0x8f, 0x7c, 0x49, 0x71, 0x84, 0x4c, - 0x3e, 0xa4, 0xa4, 0xb0, 0xd6, 0xbb, 0xc3, 0xb0, 0xc2, 0x3b, 0x63, 0xed, 0x8c, 0x0d, 0xee, 0xa2, - 0x28, 0x45, 0x44, 0x45, 0x9d, 0x8a, 0x2a, 0x8a, 0x52, 0x39, 0x12, 0x3f, 0x82, 0x12, 0x51, 0x51, - 0x85, 0xc8, 0x44, 0x32, 0x3f, 0x23, 0x9a, 0x9d, 0x59, 0x62, 0x3e, 0x02, 0x8e, 0x8b, 0x14, 0x69, - 0xbc, 0x33, 0xf3, 0x3e, 0xef, 0xfb, 0x3e, 0xcf, 0x33, 0x1f, 0x32, 0xc8, 0xda, 0x84, 0x7a, 0x84, - 0x9a, 0x96, 0x6d, 0x93, 0x06, 0x66, 0xd4, 0x74, 0xe0, 0x9a, 0xd5, 0xa8, 0x31, 0x6a, 0xd6, 0x88, - 0xbd, 0xd1, 0xa8, 0x9b, 0x6c, 0xcb, 0xa8, 0xfb, 0x84, 0x11, 0x55, 0x17, 0x48, 0x23, 0x44, 0x1a, - 0x21, 0xd2, 0x10, 0xc8, 0xf4, 0x84, 0xe5, 0xb9, 0x98, 0x98, 0xc1, 0xaf, 0xc8, 0x49, 0x6b, 0xb2, - 0x7a, 0xd5, 0xa2, 0xd0, 0x6c, 0x2e, 0x54, 0x21, 0xb3, 0x16, 0x4c, 0x9b, 0xb8, 0x58, 0xc6, 0xff, - 0xb8, 0xa9, 0xbb, 0xf8, 0x48, 0xf4, 0x94, 0x44, 0x7b, 0x14, 0x99, 0xcd, 0x05, 0xfe, 0x91, 0x81, - 0x69, 0x11, 0xa8, 0x04, 0x33, 0x53, 0xf2, 0x14, 0xa1, 0x24, 0x22, 0x88, 0x88, 0x75, 0x3e, 0x0a, - 0x13, 0x10, 0x21, 0xa8, 0x06, 0xcd, 0x60, 0x56, 0x6d, 0xac, 0x99, 0x16, 0x6e, 0xc9, 0x90, 0x7e, - 0x31, 0xc4, 0x5c, 0x0f, 0x52, 0x66, 0x79, 0x92, 0x45, 0xe6, 0x79, 0x14, 0x24, 0x4b, 0x14, 0xdd, - 0xc3, 0x2e, 0xbb, 0x1f, 0xb0, 0x5b, 0x12, 0xe4, 0x55, 0x03, 0xfc, 0x44, 0x36, 0x31, 0xf4, 0x53, - 0xca, 0xac, 0x92, 0x4d, 0x14, 0x53, 0x87, 0x7b, 0xf9, 0xa4, 0xe4, 0xb2, 0xe4, 0x38, 0x3e, 0xa4, - 0x74, 0x95, 0xf9, 0x2e, 0x46, 0x65, 0x01, 0x53, 0x97, 0xc1, 0x30, 0xc4, 0x4e, 0x85, 0xd7, 0x4f, - 0x45, 0x67, 0x95, 0xec, 0xc8, 0x62, 0xda, 0x10, 0xcd, 0x8d, 0xb0, 0xb9, 0xf1, 0x30, 0x6c, 0x5e, - 0x1c, 0xdd, 0xff, 0xa0, 0x47, 0x76, 0x8e, 0x75, 0xe5, 0x6d, 0xb7, 0x9d, 0x53, 0xca, 0x43, 0x10, - 0x3b, 0x3c, 0xa8, 0xde, 0x05, 0x80, 0x32, 0xcb, 0x67, 0xa2, 0x4e, 0xec, 0x5b, 0xeb, 0x24, 0x82, - 0x64, 0x1e, 0x2e, 0x64, 0x4f, 0x77, 0x75, 0x65, 0xbb, 0xdb, 0xce, 0xc9, 0x9d, 0xce, 0x53, 0x67, - 0xc3, 0xbc, 0x4a, 0x69, 0x46, 0x03, 0xbf, 0x5d, 0xb5, 0x5e, 0x86, 0xb4, 0x4e, 0x30, 0x85, 0x99, - 0x37, 0x51, 0x30, 0x23, 0x01, 0x2b, 0xd0, 0x77, 0x89, 0xe3, 0xda, 0x1c, 0xe8, 0x62, 0x34, 0xa8, - 0x57, 0xe7, 0x55, 0x46, 0x07, 0x57, 0xa9, 0x3e, 0x03, 0xe3, 0x35, 0xc1, 0xa5, 0x52, 0x0f, 0xb8, - 0xd1, 0x54, 0x6c, 0x36, 0x96, 0x1d, 0x59, 0x9c, 0x37, 0x6e, 0x38, 0xe0, 0x86, 0xd0, 0x52, 0x4c, - 0xf0, 0xda, 0xa2, 0xee, 0x98, 0x2c, 0x25, 0x22, 0xb4, 0x60, 0x9c, 0xee, 0xea, 0x11, 0x6e, 0xe1, - 0xdc, 0x65, 0x0b, 0x05, 0xe6, 0xbc, 0x91, 0xf3, 0x60, 0xee, 0x5a, 0x9f, 0xce, 0x1c, 0xed, 0x28, - 0x60, 0xa4, 0x44, 0xd1, 0x32, 0xac, 0x41, 0x64, 0x31, 0xa8, 0xfe, 0x09, 0xe2, 0x14, 0x62, 0xa7, - 0x0f, 0x03, 0x25, 0x4e, 0x7d, 0x00, 0x26, 0x9a, 0x56, 0xcd, 0x75, 0x2c, 0x46, 0xfc, 0x8a, 0x25, - 0x20, 0x81, 0x91, 0x89, 0xe2, 0xef, 0x87, 0x7b, 0xf9, 0x19, 0x99, 0xfc, 0x38, 0xc4, 0x9c, 0xaf, - 0xf2, 0x4b, 0xf3, 0xc2, 0xba, 0xfa, 0x1f, 0x88, 0x5b, 0x1e, 0xe7, 0x28, 0xcf, 0xdc, 0x74, 0x68, - 0x1f, 0xbf, 0xeb, 0x86, 0xbc, 0xeb, 0xc6, 0xff, 0xc4, 0xc5, 0xbd, 0x86, 0xc9, 0x9c, 0xc2, 0xe4, - 0xab, 0x5d, 0x3d, 0xc2, 0xcd, 0x7a, 0xd1, 0x6d, 0xe7, 0x24, 0xc5, 0xcc, 0x27, 0x05, 0x8c, 0x96, - 0x28, 0x7a, 0x84, 0x9d, 0x1f, 0x5a, 0xe6, 0xcb, 0x28, 0x18, 0x2a, 0x51, 0xb4, 0x0a, 0xb1, 0x33, - 0x80, 0xc0, 0x7f, 0x00, 0x60, 0xe4, 0x82, 0xb2, 0xaf, 0x67, 0x25, 0x18, 0x09, 0x95, 0xb4, 0x7a, - 0x94, 0xc4, 0xae, 0x57, 0x72, 0x9b, 0x2b, 0x79, 0x77, 0xac, 0x67, 0x91, 0xcb, 0xd6, 0x1b, 0x55, - 0xc3, 0x26, 0x9e, 0x7c, 0x55, 0xcd, 0x9e, 0x73, 0xcd, 0x5a, 0x75, 0x48, 0x83, 0x04, 0xfa, 0xba, - 0xdb, 0xce, 0xfd, 0xcc, 0xf7, 0xcc, 0x6e, 0x55, 0xf8, 0xf3, 0x4e, 0xfb, 0xb0, 0x61, 0x05, 0xa4, - 0x4b, 0x14, 0xdd, 0xda, 0x82, 0x76, 0x83, 0xc1, 0x12, 0xa4, 0xd4, 0x42, 0x90, 0x86, 0x07, 0x5e, - 0x5d, 0x04, 0x09, 0x5f, 0x8e, 0x69, 0x4a, 0x09, 0x08, 0x27, 0x2f, 0xdd, 0xf7, 0x25, 0xdc, 0x2a, - 0x7f, 0x81, 0x65, 0xde, 0x8b, 0x4b, 0xf2, 0xc4, 0x65, 0xeb, 0x8e, 0x6f, 0x6d, 0xaa, 0xff, 0x02, - 0xb0, 0x29, 0xc7, 0x7d, 0x18, 0xdc, 0x83, 0x1d, 0xdc, 0xe4, 0x5f, 0x41, 0xdc, 0x81, 0x98, 0x78, - 0xe2, 0x51, 0x49, 0x94, 0xe5, 0xac, 0x30, 0xd5, 0xeb, 0x40, 0x4f, 0xa7, 0xcc, 0x91, 0x02, 0x26, - 0x7b, 0x38, 0x9f, 0xe9, 0xff, 0x1b, 0x0c, 0xfb, 0xd0, 0x86, 0x6e, 0xb3, 0x0f, 0xe6, 0x67, 0x48, - 0x75, 0x5b, 0x01, 0xe3, 0xc2, 0xf3, 0x8a, 0x5c, 0x73, 0x52, 0xd1, 0xef, 0xb5, 0xdb, 0x63, 0xa2, - 0x73, 0x59, 0x36, 0x2e, 0xde, 0xd9, 0xef, 0x68, 0xca, 0x41, 0x47, 0x53, 0x3e, 0x76, 0x34, 0x65, - 0xe7, 0x44, 0x8b, 0x1c, 0x9c, 0x68, 0x91, 0xa3, 0x13, 0x2d, 0xf2, 0x34, 0x2f, 0xea, 0x52, 0x67, - 0xc3, 0x70, 0x89, 0xb9, 0x75, 0xcd, 0x9f, 0x0f, 0xde, 0xb4, 0x1a, 0x0f, 0x36, 0xfc, 0xaf, 0xcf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xf7, 0xd7, 0x1d, 0x22, 0xac, 0x08, 0x00, 0x00, + // 816 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcf, 0x4f, 0x1b, 0x47, + 0x14, 0xf6, 0xda, 0xaa, 0xc1, 0x43, 0x81, 0xb2, 0x58, 0xc5, 0x58, 0x65, 0x97, 0x5a, 0x42, 0x58, + 0x56, 0xbd, 0x5b, 0x68, 0xa5, 0x56, 0x56, 0x2f, 0xb8, 0xf4, 0x97, 0x54, 0x57, 0xc8, 0xf4, 0x87, + 0xd4, 0x1c, 0xac, 0xf1, 0xee, 0x30, 0xac, 0xf0, 0xce, 0x58, 0x3b, 0x63, 0x1b, 0xdf, 0xa2, 0x28, + 0x87, 0x88, 0x13, 0xe7, 0x9c, 0x38, 0x45, 0x11, 0x27, 0x47, 0xe2, 0x8f, 0xe0, 0x88, 0x38, 0x71, + 0x0a, 0x91, 0x89, 0x64, 0xfe, 0x8c, 0x68, 0x77, 0x66, 0x89, 0x0d, 0x04, 0x1c, 0x1f, 0x12, 0x29, + 0x17, 0xef, 0xcc, 0xbc, 0xef, 0xbd, 0xf7, 0xbd, 0x6f, 0xde, 0xdb, 0x35, 0xc8, 0x5a, 0x94, 0xb9, + 0x94, 0x99, 0xd0, 0xb2, 0x68, 0x83, 0x70, 0x66, 0xda, 0x68, 0x0b, 0x36, 0x6a, 0x9c, 0x99, 0x35, + 0x6a, 0xed, 0x34, 0xea, 0x26, 0xdf, 0x35, 0xea, 0x1e, 0xe5, 0x54, 0xd5, 0x05, 0xd2, 0x08, 0x91, + 0x46, 0x88, 0x34, 0x04, 0x32, 0x3d, 0x03, 0x5d, 0x87, 0x50, 0x33, 0xf8, 0x15, 0x3e, 0x69, 0x4d, + 0x46, 0xaf, 0x42, 0x86, 0xcc, 0xe6, 0x4a, 0x15, 0x71, 0xb8, 0x62, 0x5a, 0xd4, 0x21, 0xd2, 0xfe, + 0xcd, 0x7d, 0xd9, 0xc5, 0x43, 0xa2, 0xe7, 0x24, 0xda, 0x65, 0xd8, 0x6c, 0xae, 0xf8, 0x0f, 0x69, + 0x98, 0x17, 0x86, 0x4a, 0xb0, 0x33, 0x25, 0x4f, 0x61, 0x4a, 0x62, 0x8a, 0xa9, 0x38, 0xf7, 0x57, + 0xa1, 0x03, 0xa6, 0x14, 0xd7, 0x90, 0x19, 0xec, 0xaa, 0x8d, 0x2d, 0x13, 0x92, 0xb6, 0x34, 0xe9, + 0xd7, 0x4d, 0xdc, 0x71, 0x11, 0xe3, 0xd0, 0x95, 0x2c, 0x32, 0x0f, 0xa3, 0x20, 0x59, 0x62, 0xf8, + 0x0f, 0xe2, 0xf0, 0x3f, 0x03, 0x76, 0x6b, 0x82, 0xbc, 0x6a, 0x80, 0xcf, 0x68, 0x8b, 0x20, 0x2f, + 0xa5, 0x2c, 0x2a, 0xd9, 0x44, 0x31, 0x75, 0x7a, 0x94, 0x4f, 0x4a, 0x2e, 0x6b, 0xb6, 0xed, 0x21, + 0xc6, 0x36, 0xb9, 0xe7, 0x10, 0x5c, 0x16, 0x30, 0x75, 0x1d, 0x8c, 0x23, 0x62, 0x57, 0xfc, 0xf8, + 0xa9, 0xe8, 0xa2, 0x92, 0x9d, 0x58, 0x4d, 0x1b, 0x22, 0xb9, 0x11, 0x26, 0x37, 0xfe, 0x0e, 0x93, + 0x17, 0x27, 0x8f, 0x5f, 0xea, 0x91, 0xfd, 0x73, 0x5d, 0x79, 0xde, 0xeb, 0xe4, 0x94, 0xf2, 0x18, + 0x22, 0xb6, 0x6f, 0x54, 0x7f, 0x07, 0x80, 0x71, 0xe8, 0x71, 0x11, 0x27, 0xf6, 0xbe, 0x71, 0x12, + 0x81, 0xb3, 0x6f, 0x2e, 0x64, 0x2f, 0x0f, 0x74, 0x65, 0xaf, 0xd7, 0xc9, 0xc9, 0x9b, 0xce, 0x33, + 0x7b, 0xc7, 0xbc, 0xad, 0xd2, 0x8c, 0x06, 0xbe, 0xba, 0xed, 0xbc, 0x8c, 0x58, 0x9d, 0x12, 0x86, + 0x32, 0xcf, 0xa2, 0x60, 0x41, 0x02, 0x36, 0x90, 0xe7, 0x50, 0xdb, 0xb1, 0x7c, 0xa0, 0x43, 0xf0, + 0xa8, 0x5a, 0x0d, 0x56, 0x19, 0x1d, 0xbd, 0x4a, 0xf5, 0x01, 0x98, 0xae, 0x09, 0x2e, 0x95, 0x7a, + 0xc0, 0x8d, 0xa5, 0x62, 0x8b, 0xb1, 0xec, 0xc4, 0xea, 0xb2, 0x71, 0x4f, 0x83, 0x1b, 0xa2, 0x96, + 0x62, 0xc2, 0x8f, 0x2d, 0xe2, 0x4e, 0xc9, 0x50, 0xc2, 0xc2, 0x0a, 0xc6, 0xe5, 0x81, 0x1e, 0xf1, + 0x25, 0x5c, 0xba, 0x29, 0xa1, 0xc0, 0x0c, 0x0a, 0xb9, 0x0c, 0x96, 0xee, 0xd4, 0xe9, 0x4a, 0xd1, + 0xae, 0x02, 0x26, 0x4a, 0x0c, 0xaf, 0xa3, 0x1a, 0xc2, 0x90, 0x23, 0xf5, 0x5b, 0x10, 0x67, 0x88, + 0xd8, 0x43, 0x08, 0x28, 0x71, 0xea, 0x5f, 0x60, 0xa6, 0x09, 0x6b, 0x8e, 0x0d, 0x39, 0xf5, 0x2a, + 0x50, 0x40, 0x02, 0x21, 0x13, 0xc5, 0xaf, 0x4f, 0x8f, 0xf2, 0x0b, 0xd2, 0xf9, 0xdf, 0x10, 0x33, + 0x18, 0xe5, 0x8b, 0xe6, 0xb5, 0x73, 0xf5, 0x27, 0x10, 0x87, 0xae, 0xcf, 0x51, 0xf6, 0xdc, 0x7c, + 0x28, 0x9f, 0x3f, 0xeb, 0x86, 0x9c, 0x75, 0xe3, 0x67, 0xea, 0x90, 0x7e, 0xc1, 0xa4, 0x4f, 0x61, + 0xf6, 0xc9, 0x81, 0x1e, 0xf1, 0xc5, 0x7a, 0xd4, 0xeb, 0xe4, 0x24, 0xc5, 0xcc, 0x6b, 0x05, 0x4c, + 0x96, 0x18, 0xfe, 0x87, 0xd8, 0x9f, 0x74, 0x99, 0x87, 0x0a, 0x98, 0x29, 0x31, 0xfc, 0x9f, 0xc3, + 0xb7, 0x6d, 0x0f, 0xb6, 0xca, 0xa8, 0x05, 0x3d, 0xfb, 0xe3, 0x97, 0x7a, 0x3b, 0xd9, 0xc7, 0x51, + 0x30, 0x56, 0x62, 0x78, 0x13, 0x91, 0x51, 0x28, 0xfe, 0x00, 0x00, 0xa7, 0xd7, 0xb8, 0xbd, 0xdb, + 0x2b, 0xc1, 0x69, 0x28, 0x7b, 0xbb, 0x4f, 0xf6, 0xd8, 0xdd, 0xb2, 0xff, 0xea, 0xcb, 0x7e, 0x78, + 0xae, 0x67, 0xb1, 0xc3, 0xb7, 0x1b, 0x55, 0xc3, 0xa2, 0xae, 0xfc, 0x04, 0x98, 0x7d, 0x43, 0xc8, + 0xdb, 0x75, 0xc4, 0x02, 0x07, 0xf6, 0xb4, 0xd7, 0xc9, 0x7d, 0xee, 0x37, 0x98, 0xd5, 0xae, 0xf8, + 0xdf, 0x22, 0x36, 0xc4, 0x9d, 0x6d, 0x80, 0x74, 0x89, 0xe1, 0x5f, 0x76, 0x91, 0xd5, 0xe0, 0xa8, + 0x84, 0x18, 0x83, 0x18, 0xb1, 0x70, 0x3a, 0xd5, 0x55, 0x90, 0xf0, 0xe4, 0x9a, 0xa5, 0x94, 0x80, + 0x70, 0xf2, 0xc6, 0xcb, 0x69, 0x8d, 0xb4, 0xcb, 0x6f, 0x61, 0x99, 0x17, 0x62, 0xa2, 0xc3, 0x2e, + 0x50, 0x7f, 0x04, 0xa0, 0x25, 0xd7, 0x43, 0x08, 0xdc, 0x87, 0x1d, 0x5d, 0xe4, 0x2f, 0x41, 0xdc, + 0x46, 0x84, 0xba, 0xe2, 0x0d, 0x98, 0x28, 0xcb, 0x5d, 0x61, 0xae, 0x5f, 0x81, 0xbe, 0x4c, 0x99, + 0x33, 0x05, 0xcc, 0x0e, 0x74, 0xae, 0xac, 0xff, 0x7b, 0x30, 0xee, 0x21, 0x0b, 0x39, 0xcd, 0x21, + 0x98, 0x5f, 0x21, 0xd5, 0x3d, 0x05, 0x4c, 0x0b, 0xcd, 0x2b, 0xf2, 0xcc, 0x4e, 0x45, 0x3f, 0xd4, + 0x6d, 0x4f, 0x89, 0xcc, 0x65, 0x99, 0xb8, 0xf8, 0xdb, 0x71, 0x57, 0x53, 0x4e, 0xba, 0x9a, 0xf2, + 0xaa, 0xab, 0x29, 0xfb, 0x17, 0x5a, 0xe4, 0xe4, 0x42, 0x8b, 0x9c, 0x5d, 0x68, 0x91, 0xff, 0xf3, + 0x22, 0x2e, 0xb3, 0x77, 0x0c, 0x87, 0x9a, 0xbb, 0x77, 0xfc, 0x53, 0xf2, 0x93, 0x56, 0xe3, 0xc1, + 0x85, 0x7f, 0xf7, 0x26, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xb6, 0xac, 0x3d, 0x59, 0x09, 0x00, 0x00, } func (this *MsgInitLockupAccount) Equal(that interface{}) bool { @@ -836,6 +877,43 @@ func (m *MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgWithdrawReward) 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 *MsgWithdrawReward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MsgSend) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1119,6 +1197,23 @@ func (m *MsgUndelegate) Size() (n int) { return n } +func (m *MsgWithdrawReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgSend) Size() (n int) { if m == nil { return 0 @@ -1896,6 +1991,120 @@ func (m *MsgUndelegate) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgWithdrawReward) 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: MsgWithdrawReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawReward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = 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 *MsgSend) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/accounts/defaults/lockup/utils_test.go b/x/accounts/defaults/lockup/utils_test.go index 23702b051a7..6dd435512eb 100644 --- a/x/accounts/defaults/lockup/utils_test.go +++ b/x/accounts/defaults/lockup/utils_test.go @@ -13,6 +13,7 @@ import ( "cosmossdk.io/math" "cosmossdk.io/x/accounts/accountstd" banktypes "cosmossdk.io/x/bank/types" + stakingtypes "cosmossdk.io/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -61,13 +62,23 @@ func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { return nil, nil }, func(ctx context.Context, req, resp ProtoMsg) error { _, ok := req.(*banktypes.QueryBalanceRequest) - require.True(t, ok) + if !ok { + _, ok = req.(*stakingtypes.QueryParamsRequest) + require.True(t, ok) + gogoproto.Merge(resp.(gogoproto.Message), &stakingtypes.QueryParamsResponse{ + Params: stakingtypes.Params{ + BondDenom: "test", + }, + }) + return nil + } gogoproto.Merge(resp.(gogoproto.Message), &banktypes.QueryBalanceResponse{ Balance: &sdk.Coin{ Denom: "test", Amount: math.NewInt(5), }, }) + return nil }, ) diff --git a/x/accounts/proto/cosmos/accounts/defaults/lockup/tx.proto b/x/accounts/proto/cosmos/accounts/defaults/lockup/tx.proto index a0a6e1a07ae..c13cec55b16 100644 --- a/x/accounts/proto/cosmos/accounts/defaults/lockup/tx.proto +++ b/x/accounts/proto/cosmos/accounts/defaults/lockup/tx.proto @@ -79,6 +79,17 @@ message MsgUndelegate { cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } +// MsgWithdrawReward defines a message that enable lockup account to execute withdraw reward message +message MsgWithdrawReward { + option (cosmos.msg.v1.signer) = "sender"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; +} + // MsgSend defines a message that enable lockup account to execute send message message MsgSend { option (cosmos.msg.v1.signer) = "sender";