From 5bde3686c4538ce53356af6e9fe40b34e4ce4a06 Mon Sep 17 00:00:00 2001 From: Sai Kumar <17549398+gsk967@users.noreply.github.com> Date: Tue, 5 Apr 2022 15:31:13 +0530 Subject: [PATCH] feat: Cancel unbonding delegation entry (#10885) ## Description Closes: #577 This pull request contains `Canceling unbonding delegation entry` and `delegate back to previous validator` ### `Msg` Service ```protobuf= package cosmos.staking.v1beta1; service Msg { // CancelUnbondingDelegation rpc CancelUnbondingDelegation(MsgCancelUnbondingDelegation) returns (MsgCancelUnbondingDelegationResponse); } // MsgCancelUnbondingDelegation message MsgCancelUnbondingDelegation { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; // creation_height is the height which the unbonding took place. int64 creation_height = 4; } // MsgCancelUnbondingDelegationResponse message MsgCancelUnbondingDelegationResponse{ } ``` ### `Msg` Method Implementation ```go= func (k msgServer) CancelUnbondingDelegation(goCtx context.Context, msg *types.MsgCancelUnbondingDelegation) (*types.MsgCancelUnbondingDelegationResponse, error) { /* // checking the unbonding delegation at creation_height // get the unbonding delegations of delegatorAddress if ubdEntry balance is equal to msg.Amount remove the entry from ubd else update the specific entry with new balance if len(ubd.Entries) == 0 { k.RemoveUnbondingDelegation(ctx, ubd) } else { k.SetUnbondingDelegation(ctx, ubd) } */ // update the delegation back to validator // get validator validator, found := k.GetValidator(ctx, valAddr) if !found { return nil, types.ErrNoValidatorFound } // delegate the unbonding amount to validator back _, err = k.Keeper.Delegate(ctx, delegatorAddress, msg.Amount.Amount, types.Unbonding, validator, false) if err != nil { return nil, err } _, err := ms.Keeper.CancelUnbondingDelegation(ctx,delegatorAddress,validatorAddress,amount,creation_height) if err != nil { return nil, err } return &types.MsgCancelUnbondingDelegationResponse{}, nil } ``` #### `cli tx` Method ```bash= simd tx staking cancel-unbond [validator-address] [amount] [creation_height] --from [user] --chain-id [chain-id] Example: simd tx staking cancel-unbond cosmosvaloper1mqtyv4qux68r26mql2hjhgrvz72snjwpulq22m 100000stake 10280 --from test1 --chain-id test-chain ``` --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- CHANGELOG.md | 2 + api/cosmos/staking/v1beta1/tx.pulsar.go | 1294 ++++++++++++++++++++-- api/cosmos/staking/v1beta1/tx_grpc.pb.go | 40 + proto/cosmos/staking/v1beta1/tx.proto | 21 + simapp/params/weights.go | 1 + x/staking/client/cli/tx.go | 52 + x/staking/client/testutil/suite.go | 111 +- x/staking/keeper/delegation.go | 2 +- x/staking/keeper/keeper_test.go | 3 + x/staking/keeper/msg_server.go | 113 +- x/staking/keeper/msg_server_test.go | 146 +++ x/staking/module.go | 2 +- x/staking/simulation/operations.go | 99 +- x/staking/simulation/operations_test.go | 54 +- x/staking/types/codec.go | 2 + x/staking/types/events.go | 16 +- x/staking/types/msg.go | 66 +- x/staking/types/tx.pb.go | 559 +++++++++- 18 files changed, 2412 insertions(+), 171 deletions(-) create mode 100644 x/staking/keeper/msg_server_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9ba7a927ed..79b5c3169f71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -262,6 +262,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#10868](https://github.com/cosmos/cosmos-sdk/pull/10868) Bump gov to v1beta2. Both v1beta1 and v1beta2 queries and Msgs are accepted. * [\#11011](https://github.com/cosmos/cosmos-sdk/pull/11011) Remove burning of deposits when qourum is not reached on a governance proposal and when the deposit is not fully met. * [\#11019](https://github.com/cosmos/cosmos-sdk/pull/11019) Add `MsgCreatePermanentLockedAccount` and CLI method for creating permanent locked account +* (x/staking) [\#10885] (https://github.com/cosmos/cosmos-sdk/pull/10885) Add new `CancelUnbondingDelegation` + transaction to `x/staking` module. Delegators can now cancel unbonding delegation entry and re-delegate back to validator. * (x/feegrant) [\#10830](https://github.com/cosmos/cosmos-sdk/pull/10830) Expired allowances will be pruned from state. * (x/authz,x/feegrant) [\#11214](https://github.com/cosmos/cosmos-sdk/pull/11214) Fix Amino JSON encoding of authz and feegrant Msgs to be consistent with other modules. * (authz)[\#11060](https://github.com/cosmos/cosmos-sdk/pull/11060) Support grant with no expire time. diff --git a/api/cosmos/staking/v1beta1/tx.pulsar.go b/api/cosmos/staking/v1beta1/tx.pulsar.go index ef100a2f353f..61067f5c7468 100644 --- a/api/cosmos/staking/v1beta1/tx.pulsar.go +++ b/api/cosmos/staking/v1beta1/tx.pulsar.go @@ -5200,6 +5200,973 @@ func (x *fastReflection_MsgUndelegateResponse) ProtoMethods() *protoiface.Method } } +var ( + md_MsgCancelUnbondingDelegation protoreflect.MessageDescriptor + fd_MsgCancelUnbondingDelegation_delegator_address protoreflect.FieldDescriptor + fd_MsgCancelUnbondingDelegation_validator_address protoreflect.FieldDescriptor + fd_MsgCancelUnbondingDelegation_amount protoreflect.FieldDescriptor + fd_MsgCancelUnbondingDelegation_creation_height protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_staking_v1beta1_tx_proto_init() + md_MsgCancelUnbondingDelegation = File_cosmos_staking_v1beta1_tx_proto.Messages().ByName("MsgCancelUnbondingDelegation") + fd_MsgCancelUnbondingDelegation_delegator_address = md_MsgCancelUnbondingDelegation.Fields().ByName("delegator_address") + fd_MsgCancelUnbondingDelegation_validator_address = md_MsgCancelUnbondingDelegation.Fields().ByName("validator_address") + fd_MsgCancelUnbondingDelegation_amount = md_MsgCancelUnbondingDelegation.Fields().ByName("amount") + fd_MsgCancelUnbondingDelegation_creation_height = md_MsgCancelUnbondingDelegation.Fields().ByName("creation_height") +} + +var _ protoreflect.Message = (*fastReflection_MsgCancelUnbondingDelegation)(nil) + +type fastReflection_MsgCancelUnbondingDelegation MsgCancelUnbondingDelegation + +func (x *MsgCancelUnbondingDelegation) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCancelUnbondingDelegation)(x) +} + +func (x *MsgCancelUnbondingDelegation) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_staking_v1beta1_tx_proto_msgTypes[10] + 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_MsgCancelUnbondingDelegation_messageType fastReflection_MsgCancelUnbondingDelegation_messageType +var _ protoreflect.MessageType = fastReflection_MsgCancelUnbondingDelegation_messageType{} + +type fastReflection_MsgCancelUnbondingDelegation_messageType struct{} + +func (x fastReflection_MsgCancelUnbondingDelegation_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCancelUnbondingDelegation)(nil) +} +func (x fastReflection_MsgCancelUnbondingDelegation_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCancelUnbondingDelegation) +} +func (x fastReflection_MsgCancelUnbondingDelegation_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelUnbondingDelegation +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCancelUnbondingDelegation) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelUnbondingDelegation +} + +// 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_MsgCancelUnbondingDelegation) Type() protoreflect.MessageType { + return _fastReflection_MsgCancelUnbondingDelegation_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCancelUnbondingDelegation) New() protoreflect.Message { + return new(fastReflection_MsgCancelUnbondingDelegation) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCancelUnbondingDelegation) Interface() protoreflect.ProtoMessage { + return (*MsgCancelUnbondingDelegation)(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_MsgCancelUnbondingDelegation) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DelegatorAddress != "" { + value := protoreflect.ValueOfString(x.DelegatorAddress) + if !f(fd_MsgCancelUnbondingDelegation_delegator_address, value) { + return + } + } + if x.ValidatorAddress != "" { + value := protoreflect.ValueOfString(x.ValidatorAddress) + if !f(fd_MsgCancelUnbondingDelegation_validator_address, value) { + return + } + } + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_MsgCancelUnbondingDelegation_amount, value) { + return + } + } + if x.CreationHeight != int64(0) { + value := protoreflect.ValueOfInt64(x.CreationHeight) + if !f(fd_MsgCancelUnbondingDelegation_creation_height, 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_MsgCancelUnbondingDelegation) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.delegator_address": + return x.DelegatorAddress != "" + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.validator_address": + return x.ValidatorAddress != "" + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount": + return x.Amount != nil + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.creation_height": + return x.CreationHeight != int64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation 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_MsgCancelUnbondingDelegation) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.delegator_address": + x.DelegatorAddress = "" + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.validator_address": + x.ValidatorAddress = "" + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount": + x.Amount = nil + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.creation_height": + x.CreationHeight = int64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation 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_MsgCancelUnbondingDelegation) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.delegator_address": + value := x.DelegatorAddress + return protoreflect.ValueOfString(value) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.validator_address": + value := x.ValidatorAddress + return protoreflect.ValueOfString(value) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.creation_height": + value := x.CreationHeight + return protoreflect.ValueOfInt64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation 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_MsgCancelUnbondingDelegation) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.delegator_address": + x.DelegatorAddress = value.Interface().(string) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.validator_address": + x.ValidatorAddress = value.Interface().(string) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.creation_height": + x.CreationHeight = value.Int() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation 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_MsgCancelUnbondingDelegation) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.delegator_address": + panic(fmt.Errorf("field delegator_address of message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation is not mutable")) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.validator_address": + panic(fmt.Errorf("field validator_address of message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation is not mutable")) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.creation_height": + panic(fmt.Errorf("field creation_height of message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation 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_MsgCancelUnbondingDelegation) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.delegator_address": + return protoreflect.ValueOfString("") + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.validator_address": + return protoreflect.ValueOfString("") + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.creation_height": + return protoreflect.ValueOfInt64(int64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegation 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_MsgCancelUnbondingDelegation) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", 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_MsgCancelUnbondingDelegation) 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_MsgCancelUnbondingDelegation) 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_MsgCancelUnbondingDelegation) 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_MsgCancelUnbondingDelegation) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCancelUnbondingDelegation) + 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.DelegatorAddress) + 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.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.CreationHeight != 0 { + n += 1 + runtime.Sov(uint64(x.CreationHeight)) + } + 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().(*MsgCancelUnbondingDelegation) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.CreationHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.CreationHeight)) + i-- + dAtA[i] = 0x20 + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + 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.DelegatorAddress) > 0 { + i -= len(x.DelegatorAddress) + copy(dAtA[i:], x.DelegatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) + 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().(*MsgCancelUnbondingDelegation) + 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: MsgCancelUnbondingDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCancelUnbondingDelegation: 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 DelegatorAddress", 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.DelegatorAddress = 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 + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + x.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCancelUnbondingDelegationResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_staking_v1beta1_tx_proto_init() + md_MsgCancelUnbondingDelegationResponse = File_cosmos_staking_v1beta1_tx_proto.Messages().ByName("MsgCancelUnbondingDelegationResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCancelUnbondingDelegationResponse)(nil) + +type fastReflection_MsgCancelUnbondingDelegationResponse MsgCancelUnbondingDelegationResponse + +func (x *MsgCancelUnbondingDelegationResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCancelUnbondingDelegationResponse)(x) +} + +func (x *MsgCancelUnbondingDelegationResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_staking_v1beta1_tx_proto_msgTypes[11] + 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_MsgCancelUnbondingDelegationResponse_messageType fastReflection_MsgCancelUnbondingDelegationResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCancelUnbondingDelegationResponse_messageType{} + +type fastReflection_MsgCancelUnbondingDelegationResponse_messageType struct{} + +func (x fastReflection_MsgCancelUnbondingDelegationResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCancelUnbondingDelegationResponse)(nil) +} +func (x fastReflection_MsgCancelUnbondingDelegationResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCancelUnbondingDelegationResponse) +} +func (x fastReflection_MsgCancelUnbondingDelegationResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelUnbondingDelegationResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCancelUnbondingDelegationResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCancelUnbondingDelegationResponse +} + +// 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_MsgCancelUnbondingDelegationResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCancelUnbondingDelegationResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCancelUnbondingDelegationResponse) New() protoreflect.Message { + return new(fastReflection_MsgCancelUnbondingDelegationResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCancelUnbondingDelegationResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCancelUnbondingDelegationResponse)(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_MsgCancelUnbondingDelegationResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCancelUnbondingDelegationResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse 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_MsgCancelUnbondingDelegationResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse 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_MsgCancelUnbondingDelegationResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse 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_MsgCancelUnbondingDelegationResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse 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_MsgCancelUnbondingDelegationResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse 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_MsgCancelUnbondingDelegationResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse")) + } + panic(fmt.Errorf("message cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse 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_MsgCancelUnbondingDelegationResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", 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_MsgCancelUnbondingDelegationResponse) 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_MsgCancelUnbondingDelegationResponse) 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_MsgCancelUnbondingDelegationResponse) 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_MsgCancelUnbondingDelegationResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCancelUnbondingDelegationResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCancelUnbondingDelegationResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCancelUnbondingDelegationResponse) + 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: MsgCancelUnbondingDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCancelUnbondingDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -5681,6 +6648,95 @@ func (x *MsgUndelegateResponse) GetCompletionTime() *timestamppb.Timestamp { return nil } +// MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator +type MsgCancelUnbondingDelegation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + // amount is always less than or equal to unbonding delegation entry balance + Amount *v1beta1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` + // creation_height is the height which the unbonding took place. + CreationHeight int64 `protobuf:"varint,4,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` +} + +func (x *MsgCancelUnbondingDelegation) Reset() { + *x = MsgCancelUnbondingDelegation{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_staking_v1beta1_tx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCancelUnbondingDelegation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCancelUnbondingDelegation) ProtoMessage() {} + +// Deprecated: Use MsgCancelUnbondingDelegation.ProtoReflect.Descriptor instead. +func (*MsgCancelUnbondingDelegation) Descriptor() ([]byte, []int) { + return file_cosmos_staking_v1beta1_tx_proto_rawDescGZIP(), []int{10} +} + +func (x *MsgCancelUnbondingDelegation) GetDelegatorAddress() string { + if x != nil { + return x.DelegatorAddress + } + return "" +} + +func (x *MsgCancelUnbondingDelegation) GetValidatorAddress() string { + if x != nil { + return x.ValidatorAddress + } + return "" +} + +func (x *MsgCancelUnbondingDelegation) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +func (x *MsgCancelUnbondingDelegation) GetCreationHeight() int64 { + if x != nil { + return x.CreationHeight + } + return 0 +} + +// MsgCancelUnbondingDelegationResponse +type MsgCancelUnbondingDelegationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgCancelUnbondingDelegationResponse) Reset() { + *x = MsgCancelUnbondingDelegationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_staking_v1beta1_tx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCancelUnbondingDelegationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCancelUnbondingDelegationResponse) ProtoMessage() {} + +// Deprecated: Use MsgCancelUnbondingDelegationResponse.ProtoReflect.Descriptor instead. +func (*MsgCancelUnbondingDelegationResponse) Descriptor() ([]byte, []int) { + return file_cosmos_staking_v1beta1_tx_proto_rawDescGZIP(), []int{11} +} + var File_cosmos_staking_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_staking_v1beta1_tx_proto_rawDesc = []byte{ @@ -5834,56 +6890,87 @@ var file_cosmos_staking_v1beta1_tx_proto_rawDesc = []byte{ 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, - 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x32, 0x9a, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x71, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x6f, 0x72, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, - 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x1a, - 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x0d, 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x6f, 0x72, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, - 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x1a, 0x30, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x5c, 0x0a, 0x08, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x23, 0x2e, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xae, 0x02, 0x0a, 0x1c, 0x4d, 0x73, 0x67, + 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x10, + 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x45, 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, 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, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x37, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a, 0x1e, 0x88, 0xa0, 0x1f, 0x00, 0xe8, + 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, + 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x26, 0x0a, 0x24, 0x4d, 0x73, 0x67, + 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x32, 0xac, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, 0x0a, 0x0f, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x65, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, - 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, - 0x0a, 0x0f, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x65, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, - 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x65, - 0x67, 0x69, 0x6e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, 0x32, 0x2e, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x0d, + 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x52, - 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x62, 0x0a, 0x0a, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, - 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x08, 0x44, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, + 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x0f, 0x42, 0x65, 0x67, 0x69, 0x6e, + 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x64, 0x65, + 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x46, 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, 0x61, 0x70, - 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x16, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, - 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, - 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4d, 0x73, 0x67, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0a, 0x55, 0x6e, + 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x1a, + 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, + 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8f, + 0x01, 0x0a, 0x19, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, + 0x6e, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, + 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x1a, 0x3c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, + 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0xe7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, + 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 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, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x3b, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, + 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, + 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -5898,50 +6985,55 @@ func file_cosmos_staking_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_staking_v1beta1_tx_proto_rawDescData } -var file_cosmos_staking_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_cosmos_staking_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_cosmos_staking_v1beta1_tx_proto_goTypes = []interface{}{ - (*MsgCreateValidator)(nil), // 0: cosmos.staking.v1beta1.MsgCreateValidator - (*MsgCreateValidatorResponse)(nil), // 1: cosmos.staking.v1beta1.MsgCreateValidatorResponse - (*MsgEditValidator)(nil), // 2: cosmos.staking.v1beta1.MsgEditValidator - (*MsgEditValidatorResponse)(nil), // 3: cosmos.staking.v1beta1.MsgEditValidatorResponse - (*MsgDelegate)(nil), // 4: cosmos.staking.v1beta1.MsgDelegate - (*MsgDelegateResponse)(nil), // 5: cosmos.staking.v1beta1.MsgDelegateResponse - (*MsgBeginRedelegate)(nil), // 6: cosmos.staking.v1beta1.MsgBeginRedelegate - (*MsgBeginRedelegateResponse)(nil), // 7: cosmos.staking.v1beta1.MsgBeginRedelegateResponse - (*MsgUndelegate)(nil), // 8: cosmos.staking.v1beta1.MsgUndelegate - (*MsgUndelegateResponse)(nil), // 9: cosmos.staking.v1beta1.MsgUndelegateResponse - (*Description)(nil), // 10: cosmos.staking.v1beta1.Description - (*CommissionRates)(nil), // 11: cosmos.staking.v1beta1.CommissionRates - (*anypb.Any)(nil), // 12: google.protobuf.Any - (*v1beta1.Coin)(nil), // 13: cosmos.base.v1beta1.Coin - (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp + (*MsgCreateValidator)(nil), // 0: cosmos.staking.v1beta1.MsgCreateValidator + (*MsgCreateValidatorResponse)(nil), // 1: cosmos.staking.v1beta1.MsgCreateValidatorResponse + (*MsgEditValidator)(nil), // 2: cosmos.staking.v1beta1.MsgEditValidator + (*MsgEditValidatorResponse)(nil), // 3: cosmos.staking.v1beta1.MsgEditValidatorResponse + (*MsgDelegate)(nil), // 4: cosmos.staking.v1beta1.MsgDelegate + (*MsgDelegateResponse)(nil), // 5: cosmos.staking.v1beta1.MsgDelegateResponse + (*MsgBeginRedelegate)(nil), // 6: cosmos.staking.v1beta1.MsgBeginRedelegate + (*MsgBeginRedelegateResponse)(nil), // 7: cosmos.staking.v1beta1.MsgBeginRedelegateResponse + (*MsgUndelegate)(nil), // 8: cosmos.staking.v1beta1.MsgUndelegate + (*MsgUndelegateResponse)(nil), // 9: cosmos.staking.v1beta1.MsgUndelegateResponse + (*MsgCancelUnbondingDelegation)(nil), // 10: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation + (*MsgCancelUnbondingDelegationResponse)(nil), // 11: cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse + (*Description)(nil), // 12: cosmos.staking.v1beta1.Description + (*CommissionRates)(nil), // 13: cosmos.staking.v1beta1.CommissionRates + (*anypb.Any)(nil), // 14: google.protobuf.Any + (*v1beta1.Coin)(nil), // 15: cosmos.base.v1beta1.Coin + (*timestamppb.Timestamp)(nil), // 16: google.protobuf.Timestamp } var file_cosmos_staking_v1beta1_tx_proto_depIdxs = []int32{ - 10, // 0: cosmos.staking.v1beta1.MsgCreateValidator.description:type_name -> cosmos.staking.v1beta1.Description - 11, // 1: cosmos.staking.v1beta1.MsgCreateValidator.commission:type_name -> cosmos.staking.v1beta1.CommissionRates - 12, // 2: cosmos.staking.v1beta1.MsgCreateValidator.pubkey:type_name -> google.protobuf.Any - 13, // 3: cosmos.staking.v1beta1.MsgCreateValidator.value:type_name -> cosmos.base.v1beta1.Coin - 10, // 4: cosmos.staking.v1beta1.MsgEditValidator.description:type_name -> cosmos.staking.v1beta1.Description - 13, // 5: cosmos.staking.v1beta1.MsgDelegate.amount:type_name -> cosmos.base.v1beta1.Coin - 13, // 6: cosmos.staking.v1beta1.MsgBeginRedelegate.amount:type_name -> cosmos.base.v1beta1.Coin - 14, // 7: cosmos.staking.v1beta1.MsgBeginRedelegateResponse.completion_time:type_name -> google.protobuf.Timestamp - 13, // 8: cosmos.staking.v1beta1.MsgUndelegate.amount:type_name -> cosmos.base.v1beta1.Coin - 14, // 9: cosmos.staking.v1beta1.MsgUndelegateResponse.completion_time:type_name -> google.protobuf.Timestamp - 0, // 10: cosmos.staking.v1beta1.Msg.CreateValidator:input_type -> cosmos.staking.v1beta1.MsgCreateValidator - 2, // 11: cosmos.staking.v1beta1.Msg.EditValidator:input_type -> cosmos.staking.v1beta1.MsgEditValidator - 4, // 12: cosmos.staking.v1beta1.Msg.Delegate:input_type -> cosmos.staking.v1beta1.MsgDelegate - 6, // 13: cosmos.staking.v1beta1.Msg.BeginRedelegate:input_type -> cosmos.staking.v1beta1.MsgBeginRedelegate - 8, // 14: cosmos.staking.v1beta1.Msg.Undelegate:input_type -> cosmos.staking.v1beta1.MsgUndelegate - 1, // 15: cosmos.staking.v1beta1.Msg.CreateValidator:output_type -> cosmos.staking.v1beta1.MsgCreateValidatorResponse - 3, // 16: cosmos.staking.v1beta1.Msg.EditValidator:output_type -> cosmos.staking.v1beta1.MsgEditValidatorResponse - 5, // 17: cosmos.staking.v1beta1.Msg.Delegate:output_type -> cosmos.staking.v1beta1.MsgDelegateResponse - 7, // 18: cosmos.staking.v1beta1.Msg.BeginRedelegate:output_type -> cosmos.staking.v1beta1.MsgBeginRedelegateResponse - 9, // 19: cosmos.staking.v1beta1.Msg.Undelegate:output_type -> cosmos.staking.v1beta1.MsgUndelegateResponse - 15, // [15:20] is the sub-list for method output_type - 10, // [10:15] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 12, // 0: cosmos.staking.v1beta1.MsgCreateValidator.description:type_name -> cosmos.staking.v1beta1.Description + 13, // 1: cosmos.staking.v1beta1.MsgCreateValidator.commission:type_name -> cosmos.staking.v1beta1.CommissionRates + 14, // 2: cosmos.staking.v1beta1.MsgCreateValidator.pubkey:type_name -> google.protobuf.Any + 15, // 3: cosmos.staking.v1beta1.MsgCreateValidator.value:type_name -> cosmos.base.v1beta1.Coin + 12, // 4: cosmos.staking.v1beta1.MsgEditValidator.description:type_name -> cosmos.staking.v1beta1.Description + 15, // 5: cosmos.staking.v1beta1.MsgDelegate.amount:type_name -> cosmos.base.v1beta1.Coin + 15, // 6: cosmos.staking.v1beta1.MsgBeginRedelegate.amount:type_name -> cosmos.base.v1beta1.Coin + 16, // 7: cosmos.staking.v1beta1.MsgBeginRedelegateResponse.completion_time:type_name -> google.protobuf.Timestamp + 15, // 8: cosmos.staking.v1beta1.MsgUndelegate.amount:type_name -> cosmos.base.v1beta1.Coin + 16, // 9: cosmos.staking.v1beta1.MsgUndelegateResponse.completion_time:type_name -> google.protobuf.Timestamp + 15, // 10: cosmos.staking.v1beta1.MsgCancelUnbondingDelegation.amount:type_name -> cosmos.base.v1beta1.Coin + 0, // 11: cosmos.staking.v1beta1.Msg.CreateValidator:input_type -> cosmos.staking.v1beta1.MsgCreateValidator + 2, // 12: cosmos.staking.v1beta1.Msg.EditValidator:input_type -> cosmos.staking.v1beta1.MsgEditValidator + 4, // 13: cosmos.staking.v1beta1.Msg.Delegate:input_type -> cosmos.staking.v1beta1.MsgDelegate + 6, // 14: cosmos.staking.v1beta1.Msg.BeginRedelegate:input_type -> cosmos.staking.v1beta1.MsgBeginRedelegate + 8, // 15: cosmos.staking.v1beta1.Msg.Undelegate:input_type -> cosmos.staking.v1beta1.MsgUndelegate + 10, // 16: cosmos.staking.v1beta1.Msg.CancelUnbondingDelegation:input_type -> cosmos.staking.v1beta1.MsgCancelUnbondingDelegation + 1, // 17: cosmos.staking.v1beta1.Msg.CreateValidator:output_type -> cosmos.staking.v1beta1.MsgCreateValidatorResponse + 3, // 18: cosmos.staking.v1beta1.Msg.EditValidator:output_type -> cosmos.staking.v1beta1.MsgEditValidatorResponse + 5, // 19: cosmos.staking.v1beta1.Msg.Delegate:output_type -> cosmos.staking.v1beta1.MsgDelegateResponse + 7, // 20: cosmos.staking.v1beta1.Msg.BeginRedelegate:output_type -> cosmos.staking.v1beta1.MsgBeginRedelegateResponse + 9, // 21: cosmos.staking.v1beta1.Msg.Undelegate:output_type -> cosmos.staking.v1beta1.MsgUndelegateResponse + 11, // 22: cosmos.staking.v1beta1.Msg.CancelUnbondingDelegation:output_type -> cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse + 17, // [17:23] is the sub-list for method output_type + 11, // [11:17] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_cosmos_staking_v1beta1_tx_proto_init() } @@ -6071,6 +7163,30 @@ func file_cosmos_staking_v1beta1_tx_proto_init() { return nil } } + file_cosmos_staking_v1beta1_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCancelUnbondingDelegation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_staking_v1beta1_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCancelUnbondingDelegationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -6078,7 +7194,7 @@ func file_cosmos_staking_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_staking_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/staking/v1beta1/tx_grpc.pb.go b/api/cosmos/staking/v1beta1/tx_grpc.pb.go index 039dcf7126cd..e230b495d7c9 100644 --- a/api/cosmos/staking/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/staking/v1beta1/tx_grpc.pb.go @@ -35,6 +35,9 @@ type MsgClient interface { // Undelegate defines a method for performing an undelegation from a // delegate and a validator. Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) + // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + // and delegate back to previous validator. + CancelUnbondingDelegation(ctx context.Context, in *MsgCancelUnbondingDelegation, opts ...grpc.CallOption) (*MsgCancelUnbondingDelegationResponse, error) } type msgClient struct { @@ -90,6 +93,15 @@ func (c *msgClient) Undelegate(ctx context.Context, in *MsgUndelegate, opts ...g return out, nil } +func (c *msgClient) CancelUnbondingDelegation(ctx context.Context, in *MsgCancelUnbondingDelegation, opts ...grpc.CallOption) (*MsgCancelUnbondingDelegationResponse, error) { + out := new(MsgCancelUnbondingDelegationResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -107,6 +119,9 @@ type MsgServer interface { // Undelegate defines a method for performing an undelegation from a // delegate and a validator. Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) + // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + // and delegate back to previous validator. + CancelUnbondingDelegation(context.Context, *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) mustEmbedUnimplementedMsgServer() } @@ -129,6 +144,9 @@ func (UnimplementedMsgServer) BeginRedelegate(context.Context, *MsgBeginRedelega func (UnimplementedMsgServer) Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Undelegate not implemented") } +func (UnimplementedMsgServer) CancelUnbondingDelegation(context.Context, *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelUnbondingDelegation not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -232,6 +250,24 @@ func _Msg_Undelegate_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Msg_CancelUnbondingDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelUnbondingDelegation) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelUnbondingDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelUnbondingDelegation(ctx, req.(*MsgCancelUnbondingDelegation)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -259,6 +295,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "Undelegate", Handler: _Msg_Undelegate_Handler, }, + { + MethodName: "CancelUnbondingDelegation", + Handler: _Msg_CancelUnbondingDelegation_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/staking/v1beta1/tx.proto", diff --git a/proto/cosmos/staking/v1beta1/tx.proto b/proto/cosmos/staking/v1beta1/tx.proto index 6c8d40a76d9c..b7dac39861d8 100644 --- a/proto/cosmos/staking/v1beta1/tx.proto +++ b/proto/cosmos/staking/v1beta1/tx.proto @@ -32,6 +32,10 @@ service Msg { // Undelegate defines a method for performing an undelegation from a // delegate and a validator. rpc Undelegate(MsgUndelegate) returns (MsgUndelegateResponse); + + // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + // and delegate back to previous validator. + rpc CancelUnbondingDelegation(MsgCancelUnbondingDelegation) returns (MsgCancelUnbondingDelegationResponse); } // MsgCreateValidator defines a SDK message for creating a new validator. @@ -136,3 +140,20 @@ message MsgUndelegate { message MsgUndelegateResponse { google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } + +// MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator +message MsgCancelUnbondingDelegation{ + option (cosmos.msg.v1.signer) = "delegator_address"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // amount is always less than or equal to unbonding delegation entry balance + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + // creation_height is the height which the unbonding took place. + int64 creation_height = 4; +} + +// MsgCancelUnbondingDelegationResponse +message MsgCancelUnbondingDelegationResponse{} diff --git a/simapp/params/weights.go b/simapp/params/weights.go index 746e304de2be..340de0b24818 100644 --- a/simapp/params/weights.go +++ b/simapp/params/weights.go @@ -17,6 +17,7 @@ const ( DefaultWeightMsgDelegate int = 100 DefaultWeightMsgUndelegate int = 100 DefaultWeightMsgBeginRedelegate int = 100 + DefaultWeightMsgCancelUnbondingDelegation int = 100 DefaultWeightCommunitySpendProposal int = 5 DefaultWeightTextProposal int = 5 diff --git a/x/staking/client/cli/tx.go b/x/staking/client/cli/tx.go index 138bfa24930d..6a9d5393120f 100644 --- a/x/staking/client/cli/tx.go +++ b/x/staking/client/cli/tx.go @@ -3,6 +3,7 @@ package cli import ( "fmt" "os" + "strconv" "strings" "github.com/spf13/cobra" @@ -44,6 +45,7 @@ func NewTxCmd() *cobra.Command { NewDelegateCmd(), NewRedelegateCmd(), NewUnbondCmd(), + NewCancelUnbondingDelegation(), ) return stakingTxCmd @@ -277,6 +279,56 @@ $ %s tx staking unbond %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake --from return cmd } +func NewCancelUnbondingDelegation() *cobra.Command { + bech32PrefixValAddr := sdk.GetConfig().GetBech32ValidatorAddrPrefix() + + cmd := &cobra.Command{ + Use: "cancel-unbond [validator-addr] [amount] [creation-height]", + Short: "Cancel unbonding delegation and delegate back to the validator", + Args: cobra.ExactArgs(3), + Long: strings.TrimSpace( + fmt.Sprintf(`Cancel Unbonding Delegation and delegate back to the validator. + +Example: +$ %s tx staking cancel-unbond %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake 2 --from mykey +`, + version.AppName, bech32PrefixValAddr, + ), + ), + Example: fmt.Sprintf(`$ %s tx staking cancel-unbond %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake 2 --from mykey`, + version.AppName, bech32PrefixValAddr), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + delAddr := clientCtx.GetFromAddress() + valAddr, err := sdk.ValAddressFromBech32(args[0]) + if err != nil { + return err + } + + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + creationHeight, err := strconv.ParseInt(args[2], 10, 64) + if err != nil { + return sdkerrors.Wrap(fmt.Errorf("invalid height: %d", creationHeight), "invalid height") + } + + msg := types.NewMsgCancelUnbondingDelegation(delAddr, valAddr, creationHeight, amount) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + func newBuildCreateValidatorMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateValidator, error) { fAmount, _ := fs.GetString(FlagAmount) amount, err := sdk.ParseCoinNormalized(fAmount) diff --git a/x/staking/client/testutil/suite.go b/x/staking/client/testutil/suite.go index 5b40554b8a5c..e5ddab70b86a 100644 --- a/x/staking/client/testutil/suite.go +++ b/x/staking/client/testutil/suite.go @@ -19,6 +19,7 @@ import ( clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" "github.com/cosmos/cosmos-sdk/x/staking/client/cli" @@ -72,8 +73,11 @@ func (s *IntegrationTestSuite) SetupSuite() { _, err = s.network.WaitForHeight(1) s.Require().NoError(err) // unbonding - _, err = MsgUnbondExec(val.ClientCtx, val.Address, val.ValAddress, unbond) + out, err = MsgUnbondExec(val.ClientCtx, val.Address, val.ValAddress, unbond) s.Require().NoError(err) + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txRes)) + s.Require().Equal(uint32(0), txRes.Code) _, err = s.network.WaitForHeight(1) s.Require().NoError(err) @@ -1297,6 +1301,111 @@ func (s *IntegrationTestSuite) TestNewUnbondCmd() { } } +func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { + val := s.network.Validators[0] + + testCases := []struct { + name string + args []string + expectErr bool + expectedCode uint32 + respType proto.Message + }{ + { + "Without validator address", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + }, + true, 0, nil, + }, + { + "Without canceling unbond delegation amount", + []string{ + val.ValAddress.String(), + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + }, + true, 0, nil, + }, + { + "Without unbond creation height", + []string{ + val.ValAddress.String(), + sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + }, + true, 0, nil, + }, + { + "Wrong unbonding creation height", + []string{ + val.ValAddress.String(), + sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)).String(), + sdk.NewInt(10000).String(), + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + }, + false, sdkerrors.ErrNotFound.ABCICode(), &sdk.TxResponse{}, + }, + { + "Invalid unbonding amount (higher than the unbonding amount)", + []string{ + val.ValAddress.String(), + sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10000)).String(), + sdk.NewInt(3).String(), + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + }, + false, sdkerrors.ErrInvalidRequest.ABCICode(), &sdk.TxResponse{}, + }, + { + "valid transaction of canceling unbonding delegation", + []string{ + val.ValAddress.String(), + sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)).String(), + sdk.NewInt(3).String(), + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + }, + false, 0, &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.NewCancelUnbondingDelegation() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expectErr { + s.Require().Error(err) + } else { + s.Require().NoError(err, out.String()) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + + txResp := tc.respType.(*sdk.TxResponse) + s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + } + }) + } +} + // TestBlockResults tests that the validator updates correctly show when // calling the /block_results RPC endpoint. // ref: https://github.com/cosmos/cosmos-sdk/issues/7401. diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index f911ce047bc3..6a9f404262b5 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -302,7 +302,7 @@ func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (m store := ctx.KVStore(k.storeKey) // gets an iterator for all timeslices from time 0 until the current Blockheader time - unbondingTimesliceIterator := k.UBDQueueIterator(ctx, ctx.BlockHeader().Time) + unbondingTimesliceIterator := k.UBDQueueIterator(ctx, currTime) defer unbondingTimesliceIterator.Close() for ; unbondingTimesliceIterator.Valid(); unbondingTimesliceIterator.Next() { diff --git a/x/staking/keeper/keeper_test.go b/x/staking/keeper/keeper_test.go index f717528f40d0..f15074d63bb4 100644 --- a/x/staking/keeper/keeper_test.go +++ b/x/staking/keeper/keeper_test.go @@ -23,6 +23,7 @@ type KeeperTestSuite struct { addrs []sdk.AccAddress vals []types.Validator queryClient types.QueryClient + msgServer types.MsgServer } func (suite *KeeperTestSuite) SetupTest() { @@ -35,6 +36,8 @@ func (suite *KeeperTestSuite) SetupTest() { types.RegisterQueryServer(queryHelper, querier) queryClient := types.NewQueryClient(queryHelper) + suite.msgServer = keeper.NewMsgServerImpl(app.StakingKeeper) + addrs, _, validators := createValidators(suite.T(), ctx, app, []int64{9, 8, 7}) header := tmproto.Header{ ChainID: "HelloChain", diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index fcc16bb8e05f..3e4ad4417d1b 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -2,8 +2,12 @@ package keeper import ( "context" + "strconv" "time" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/armon/go-metrics" tmstrings "github.com/tendermint/tendermint/libs/strings" @@ -173,7 +177,7 @@ func (k msgServer) EditValidator(goCtx context.Context, msg *types.MsgEditValida return nil, types.ErrSelfDelegationBelowMinimum } - validator.MinSelfDelegation = (*msg.MinSelfDelegation) + validator.MinSelfDelegation = *msg.MinSelfDelegation } k.SetValidator(ctx, validator) @@ -381,3 +385,110 @@ func (k msgServer) Undelegate(goCtx context.Context, msg *types.MsgUndelegate) ( CompletionTime: completionTime, }, nil } + +// CancelUnbondingDelegation defines a method for canceling the unbonding delegation +// and delegate back to the validator. +func (k msgServer) CancelUnbondingDelegation(goCtx context.Context, msg *types.MsgCancelUnbondingDelegation) (*types.MsgCancelUnbondingDelegationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + return nil, err + } + + delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return nil, err + } + + bondDenom := k.BondDenom(ctx) + if msg.Amount.Denom != bondDenom { + return nil, sdkerrors.Wrapf( + sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Amount.Denom, bondDenom, + ) + } + + validator, found := k.GetValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + // In some situations, the exchange rate becomes invalid, e.g. if + // Validator loses all tokens due to slashing. In this case, + // make all future delegations invalid. + if validator.InvalidExRate() { + return nil, types.ErrDelegatorShareExRateInvalid + } + + if validator.IsJailed() { + return nil, types.ErrValidatorJailed + } + + ubd, found := k.GetUnbondingDelegation(ctx, delegatorAddress, valAddr) + if !found { + return nil, status.Errorf( + codes.NotFound, + "unbonding delegation with delegator %s not found for validator %s", + msg.DelegatorAddress, msg.ValidatorAddress, + ) + } + + var ( + unbondEntry types.UnbondingDelegationEntry + unbondEntryIndex int64 = -1 + ) + + for i, entry := range ubd.Entries { + if entry.CreationHeight == msg.CreationHeight { + unbondEntry = entry + unbondEntryIndex = int64(i) + break + } + } + if unbondEntryIndex == -1 { + return nil, sdkerrors.ErrNotFound.Wrapf("unbonding delegation entry is not found at block height %d", msg.CreationHeight) + } + + if unbondEntry.Balance.LT(msg.Amount.Amount) { + return nil, sdkerrors.ErrInvalidRequest.Wrap("amount is greater than the unbonding delegation entry balance") + } + + if unbondEntry.CompletionTime.Before(ctx.BlockTime()) { + return nil, sdkerrors.ErrInvalidRequest.Wrap("unbonding delegation is already processed") + } + + // delegate back the unbonding delegation amount to the validator + _, err = k.Keeper.Delegate(ctx, delegatorAddress, msg.Amount.Amount, types.Unbonding, validator, false) + if err != nil { + return nil, err + } + + amount := unbondEntry.Balance.Sub(msg.Amount.Amount) + if amount.IsZero() { + ubd.RemoveEntry(unbondEntryIndex) + } else { + // update the unbondingDelegationEntryBalance and InitialBalance for ubd entry + unbondEntry.Balance = amount + unbondEntry.InitialBalance = unbondEntry.InitialBalance.Sub(msg.Amount.Amount) + ubd.Entries[unbondEntryIndex] = unbondEntry + } + + // set the unbonding delegation or remove it if there are no more entries + if len(ubd.Entries) == 0 { + k.RemoveUnbondingDelegation(ctx, ubd) + } else { + k.SetUnbondingDelegation(ctx, ubd) + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeCancelUnbondingDelegation, + sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()), + sdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress), + sdk.NewAttribute(types.AttributeKeyDelegator, msg.DelegatorAddress), + sdk.NewAttribute(types.AttributeKeyCreationHeight, strconv.FormatInt(msg.CreationHeight, 10)), + ), + ) + + return &types.MsgCancelUnbondingDelegationResponse{}, nil +} diff --git a/x/staking/keeper/msg_server_test.go b/x/staking/keeper/msg_server_test.go new file mode 100644 index 000000000000..44538be4d4ae --- /dev/null +++ b/x/staking/keeper/msg_server_test.go @@ -0,0 +1,146 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank/testutil" + "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +) + +func TestCancelUnbondingDelegation(t *testing.T) { + // setup the app + app := simapp.Setup(t, false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + msgServer := keeper.NewMsgServerImpl(app.StakingKeeper) + bondDenom := app.StakingKeeper.BondDenom(ctx) + + // set the not bonded pool module account + notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) + startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 5) + + require.NoError(t, testutil.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), startTokens)))) + app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) + + moduleBalance := app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), app.StakingKeeper.BondDenom(ctx)) + require.Equal(t, sdk.NewInt64Coin(bondDenom, startTokens.Int64()), moduleBalance) + + // accounts + delAddrs := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(10000)) + validators := app.StakingKeeper.GetValidators(ctx, 10) + require.Equal(t, len(validators), 1) + + validatorAddr, err := sdk.ValAddressFromBech32(validators[0].OperatorAddress) + require.NoError(t, err) + delegatorAddr := delAddrs[0] + + // setting the ubd entry + unbondingAmount := sdk.NewInt64Coin(app.StakingKeeper.BondDenom(ctx), 5) + ubd := types.NewUnbondingDelegation( + delegatorAddr, validatorAddr, 10, + ctx.BlockTime().Add(time.Minute*10), + unbondingAmount.Amount, + ) + + // set and retrieve a record + app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + resUnbond, found := app.StakingKeeper.GetUnbondingDelegation(ctx, delegatorAddr, validatorAddr) + require.True(t, found) + require.Equal(t, ubd, resUnbond) + + testCases := []struct { + Name string + ExceptErr bool + req types.MsgCancelUnbondingDelegation + }{ + { + Name: "invalid height", + ExceptErr: true, + req: types.MsgCancelUnbondingDelegation{ + DelegatorAddress: resUnbond.DelegatorAddress, + ValidatorAddress: resUnbond.ValidatorAddress, + Amount: sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.NewInt(4)), + CreationHeight: 0, + }, + }, + { + Name: "invalid coin", + ExceptErr: true, + req: types.MsgCancelUnbondingDelegation{ + DelegatorAddress: resUnbond.DelegatorAddress, + ValidatorAddress: resUnbond.ValidatorAddress, + Amount: sdk.NewCoin("dump_coin", sdk.NewInt(4)), + CreationHeight: 0, + }, + }, + { + Name: "validator not exists", + ExceptErr: true, + req: types.MsgCancelUnbondingDelegation{ + DelegatorAddress: resUnbond.DelegatorAddress, + ValidatorAddress: sdk.ValAddress(sdk.AccAddress("asdsad")).String(), + Amount: unbondingAmount, + CreationHeight: 0, + }, + }, + { + Name: "invalid delegator address", + ExceptErr: true, + req: types.MsgCancelUnbondingDelegation{ + DelegatorAddress: "invalid_delegator_addrtess", + ValidatorAddress: resUnbond.ValidatorAddress, + Amount: unbondingAmount, + CreationHeight: 0, + }, + }, + { + Name: "invalid amount", + ExceptErr: true, + req: types.MsgCancelUnbondingDelegation{ + DelegatorAddress: resUnbond.DelegatorAddress, + ValidatorAddress: resUnbond.ValidatorAddress, + Amount: unbondingAmount.Add(sdk.NewInt64Coin(bondDenom, 10)), + CreationHeight: 10, + }, + }, + { + Name: "success", + ExceptErr: false, + req: types.MsgCancelUnbondingDelegation{ + DelegatorAddress: resUnbond.DelegatorAddress, + ValidatorAddress: resUnbond.ValidatorAddress, + Amount: unbondingAmount.Sub(sdk.NewInt64Coin(bondDenom, 1)), + CreationHeight: 10, + }, + }, + { + Name: "success", + ExceptErr: false, + req: types.MsgCancelUnbondingDelegation{ + DelegatorAddress: resUnbond.DelegatorAddress, + ValidatorAddress: resUnbond.ValidatorAddress, + Amount: unbondingAmount.Sub(unbondingAmount.Sub(sdk.NewInt64Coin(bondDenom, 1))), + CreationHeight: 10, + }, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.Name, func(t *testing.T) { + _, err := msgServer.CancelUnbondingDelegation(ctx, &testCase.req) + if testCase.ExceptErr { + require.Error(t, err) + } else { + require.NoError(t, err) + balanceForNotBondedPool := app.BankKeeper.GetBalance(ctx, sdk.AccAddress(notBondedPool.GetAddress()), bondDenom) + require.Equal(t, balanceForNotBondedPool, moduleBalance.Sub(testCase.req.Amount)) + moduleBalance = moduleBalance.Sub(testCase.req.Amount) + } + }) + } +} diff --git a/x/staking/module.go b/x/staking/module.go index ffe1e69fdd70..39665347c994 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -24,7 +24,7 @@ import ( ) const ( - consensusVersion uint64 = 3 + consensusVersion uint64 = 4 ) var ( diff --git a/x/staking/simulation/operations.go b/x/staking/simulation/operations.go index 7b0b3411ec62..8b3ce6e65337 100644 --- a/x/staking/simulation/operations.go +++ b/x/staking/simulation/operations.go @@ -16,11 +16,12 @@ import ( // Simulation operation weights constants const ( - OpWeightMsgCreateValidator = "op_weight_msg_create_validator" - OpWeightMsgEditValidator = "op_weight_msg_edit_validator" - OpWeightMsgDelegate = "op_weight_msg_delegate" - OpWeightMsgUndelegate = "op_weight_msg_undelegate" - OpWeightMsgBeginRedelegate = "op_weight_msg_begin_redelegate" + OpWeightMsgCreateValidator = "op_weight_msg_create_validator" + OpWeightMsgEditValidator = "op_weight_msg_edit_validator" + OpWeightMsgDelegate = "op_weight_msg_delegate" + OpWeightMsgUndelegate = "op_weight_msg_undelegate" + OpWeightMsgBeginRedelegate = "op_weight_msg_begin_redelegate" + OpWeightMsgCancelUnbondingDelegation = "op_weight_msg_cancel_unbonding_delegation" ) // WeightedOperations returns all the operations from the module with their respective weights @@ -29,11 +30,12 @@ func WeightedOperations( bk types.BankKeeper, k keeper.Keeper, ) simulation.WeightedOperations { var ( - weightMsgCreateValidator int - weightMsgEditValidator int - weightMsgDelegate int - weightMsgUndelegate int - weightMsgBeginRedelegate int + weightMsgCreateValidator int + weightMsgEditValidator int + weightMsgDelegate int + weightMsgUndelegate int + weightMsgBeginRedelegate int + weightMsgCancelUnbondingDelegation int ) appParams.GetOrGenerate(cdc, OpWeightMsgCreateValidator, &weightMsgCreateValidator, nil, @@ -66,6 +68,12 @@ func WeightedOperations( }, ) + appParams.GetOrGenerate(cdc, OpWeightMsgCancelUnbondingDelegation, &weightMsgCancelUnbondingDelegation, nil, + func(_ *rand.Rand) { + weightMsgCancelUnbondingDelegation = simappparams.DefaultWeightMsgCancelUnbondingDelegation + }, + ) + return simulation.WeightedOperations{ simulation.NewWeightedOperation( weightMsgCreateValidator, @@ -87,6 +95,10 @@ func WeightedOperations( weightMsgBeginRedelegate, SimulateMsgBeginRedelegate(ak, bk, k), ), + simulation.NewWeightedOperation( + weightMsgCancelUnbondingDelegation, + SimulateMsgCancelUnbondingDelegate(ak, bk, k), + ), } } @@ -370,6 +382,73 @@ func SimulateMsgUndelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper } } +// SimulateMsgCancelUnbondingDelegate generates a MsgCancelUnbondingDelegate with random values +func SimulateMsgCancelUnbondingDelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { + return func( + r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + if len(k.GetAllValidators(ctx)) == 0 { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgDelegate, "number of validators equal zero"), nil, nil + } + // get random account + simAccount, _ := simtypes.RandomAcc(r, accs) + // get random validator + validator, ok := keeper.RandomValidator(r, k, ctx) + if !ok { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgCancelUnbondingDelegation, "validator is not ok"), nil, nil + } + + if validator.IsJailed() || validator.InvalidExRate() { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgCancelUnbondingDelegation, "validator is jailed"), nil, nil + } + + valAddr := validator.GetOperator() + unbondingDelegation, found := k.GetUnbondingDelegation(ctx, simAccount.Address, valAddr) + if !found { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgCancelUnbondingDelegation, "account does have any unbonding delegation"), nil, nil + } + + // get random unbonding delegation entry at block height + unbondingDelegationEntry := unbondingDelegation.Entries[r.Intn(len(unbondingDelegation.Entries))] + + if !unbondingDelegationEntry.Balance.IsPositive() { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgCancelUnbondingDelegation, "delegator receiving balance is negative"), nil, nil + } + + cancelBondAmt, err := simtypes.RandPositiveInt(r, unbondingDelegationEntry.Balance) + if err != nil { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgCancelUnbondingDelegation, "invalid cancelBondAmt amount"), nil, err + } + + if cancelBondAmt.IsZero() { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgCancelUnbondingDelegation, "cancelBondAmt amount is zero"), nil, nil + } + + msg := types.NewMsgCancelUnbondingDelegation( + simAccount.Address, valAddr, unbondingDelegationEntry.CreationHeight, sdk.NewCoin(k.BondDenom(ctx), cancelBondAmt), + ) + + spendable := bk.SpendableCoins(ctx, simAccount.Address) + + txCtx := simulation.OperationInput{ + R: r, + App: app, + TxGen: simappparams.MakeTestEncodingConfig().TxConfig, + Cdc: nil, + Msg: msg, + MsgType: msg.Type(), + Context: ctx, + SimAccount: simAccount, + AccountKeeper: ak, + Bankkeeper: bk, + ModuleName: types.ModuleName, + CoinsSpentInMsg: spendable, + } + + return simulation.GenAndDeliverTxWithRandFees(txCtx) + } +} + // SimulateMsgBeginRedelegate generates a MsgBeginRedelegate with random values func SimulateMsgBeginRedelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( diff --git a/x/staking/simulation/operations_test.go b/x/staking/simulation/operations_test.go index ae93cf79008a..7ab52ee1a5b3 100644 --- a/x/staking/simulation/operations_test.go +++ b/x/staking/simulation/operations_test.go @@ -1,12 +1,13 @@ package simulation_test import ( - "github.com/cosmos/cosmos-sdk/codec/legacy" "math/big" "math/rand" "testing" "time" + "github.com/cosmos/cosmos-sdk/codec/legacy" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -52,6 +53,7 @@ func TestWeightedOperations(t *testing.T) { {simappparams.DefaultWeightMsgDelegate, types.ModuleName, types.TypeMsgDelegate}, {simappparams.DefaultWeightMsgUndelegate, types.ModuleName, types.TypeMsgUndelegate}, {simappparams.DefaultWeightMsgBeginRedelegate, types.ModuleName, types.TypeMsgBeginRedelegate}, + {simappparams.DefaultWeightMsgCancelUnbondingDelegation, types.ModuleName, types.TypeMsgCancelUnbondingDelegation}, } for i, w := range weightesOps { @@ -94,6 +96,56 @@ func TestSimulateMsgCreateValidator(t *testing.T) { require.Len(t, futureOperations, 0) } +// TestSimulateMsgCancelUnbondingDelegation tests the normal scenario of a valid message of type TypeMsgCancelUnbondingDelegation. +// Abonormal scenarios, where the message is +func TestSimulateMsgCancelUnbondingDelegation(t *testing.T) { + s := rand.NewSource(1) + r := rand.New(s) + app, ctx, accounts := createTestApp(t, false, r, 3) + + blockTime := time.Now().UTC() + ctx = ctx.WithBlockTime(blockTime) + + // remove genesis validator account + accounts = accounts[1:] + + // setup accounts[0] as validator + validator0 := getTestingValidator0(t, app, ctx, accounts) + + // setup delegation + delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 2) + validator0, issuedShares := validator0.AddTokensFromDel(delTokens) + delegator := accounts[1] + delegation := types.NewDelegation(delegator.Address, validator0.GetOperator(), issuedShares) + app.StakingKeeper.SetDelegation(ctx, delegation) + app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator0.GetOperator(), delegator.Address, distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200)) + + setupValidatorRewards(app, ctx, validator0.GetOperator()) + + // unbonding delegation + udb := types.NewUnbondingDelegation(delegator.Address, validator0.GetOperator(), app.LastBlockHeight(), blockTime.Add(2*time.Minute), delTokens) + app.StakingKeeper.SetUnbondingDelegation(ctx, udb) + setupValidatorRewards(app, ctx, validator0.GetOperator()) + + // begin a new block + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) + + // execute operation + op := simulation.SimulateMsgCancelUnbondingDelegate(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) + accounts = []simtypes.Account{accounts[1]} + operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") + require.NoError(t, err) + + var msg types.MsgCancelUnbondingDelegation + legacy.Cdc.UnmarshalJSON(operationMsg.Msg, &msg) + + require.True(t, operationMsg.OK) + require.Equal(t, types.TypeMsgCancelUnbondingDelegation, msg.Type()) + require.Equal(t, delegator.Address.String(), msg.DelegatorAddress) + require.Equal(t, validator0.GetOperator().String(), msg.ValidatorAddress) + require.Len(t, futureOperations, 0) +} + // TestSimulateMsgEditValidator tests the normal scenario of a valid message of type TypeMsgEditValidator. // Abonormal scenarios, where the message is created by an errors are not tested here. func TestSimulateMsgEditValidator(t *testing.T) { diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go index 4efb2d3aa212..ccc6ac358331 100644 --- a/x/staking/types/codec.go +++ b/x/staking/types/codec.go @@ -17,6 +17,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgDelegate{}, "cosmos-sdk/MsgDelegate") legacy.RegisterAminoMsg(cdc, &MsgUndelegate{}, "cosmos-sdk/MsgUndelegate") legacy.RegisterAminoMsg(cdc, &MsgBeginRedelegate{}, "cosmos-sdk/MsgBeginRedelegate") + legacy.RegisterAminoMsg(cdc, &MsgCancelUnbondingDelegation{}, "cosmos-sdk/MsgCancelUnbondingDelegation") cdc.RegisterInterface((*isStakeAuthorization_Validators)(nil), nil) cdc.RegisterConcrete(&StakeAuthorization_AllowList{}, "cosmos-sdk/StakeAuthorization/AllowList", nil) @@ -32,6 +33,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgDelegate{}, &MsgUndelegate{}, &MsgBeginRedelegate{}, + &MsgCancelUnbondingDelegation{}, ) registry.RegisterImplementations( (*authz.Authorization)(nil), diff --git a/x/staking/types/events.go b/x/staking/types/events.go index 99a0be1ad626..d8aa7303fcba 100644 --- a/x/staking/types/events.go +++ b/x/staking/types/events.go @@ -2,13 +2,14 @@ package types // staking module event types const ( - EventTypeCompleteUnbonding = "complete_unbonding" - EventTypeCompleteRedelegation = "complete_redelegation" - EventTypeCreateValidator = "create_validator" - EventTypeEditValidator = "edit_validator" - EventTypeDelegate = "delegate" - EventTypeUnbond = "unbond" - EventTypeRedelegate = "redelegate" + EventTypeCompleteUnbonding = "complete_unbonding" + EventTypeCompleteRedelegation = "complete_redelegation" + EventTypeCreateValidator = "create_validator" + EventTypeEditValidator = "edit_validator" + EventTypeDelegate = "delegate" + EventTypeUnbond = "unbond" + EventTypeCancelUnbondingDelegation = "cancel_unbonding_delegation" + EventTypeRedelegate = "redelegate" AttributeKeyValidator = "validator" AttributeKeyCommissionRate = "commission_rate" @@ -16,6 +17,7 @@ const ( AttributeKeySrcValidator = "source_validator" AttributeKeyDstValidator = "destination_validator" AttributeKeyDelegator = "delegator" + AttributeKeyCreationHeight = "creation_height" AttributeKeyCompletionTime = "completion_time" AttributeKeyNewShares = "new_shares" AttributeValueCategory = ModuleName diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index d755070e326f..2113f96207e5 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -10,11 +10,12 @@ import ( // staking message types const ( - TypeMsgUndelegate = "begin_unbonding" - TypeMsgEditValidator = "edit_validator" - TypeMsgCreateValidator = "create_validator" - TypeMsgDelegate = "delegate" - TypeMsgBeginRedelegate = "begin_redelegate" + TypeMsgUndelegate = "begin_unbonding" + TypeMsgCancelUnbondingDelegation = "cancel_unbond" + TypeMsgEditValidator = "edit_validator" + TypeMsgCreateValidator = "create_validator" + TypeMsgDelegate = "delegate" + TypeMsgBeginRedelegate = "begin_redelegate" ) var ( @@ -25,6 +26,7 @@ var ( _ sdk.Msg = &MsgDelegate{} _ sdk.Msg = &MsgUndelegate{} _ sdk.Msg = &MsgBeginRedelegate{} + _ sdk.Msg = &MsgCancelUnbondingDelegation{} ) // NewMsgCreateValidator creates a new MsgCreateValidator instance. @@ -337,3 +339,57 @@ func (msg MsgUndelegate) ValidateBasic() error { return nil } + +// NewMsgCancelUnbondingDelegation creates a new MsgCancelUnbondingDelegation instance. +//nolint:interfacer +func NewMsgCancelUnbondingDelegation(delAddr sdk.AccAddress, valAddr sdk.ValAddress, creationHeight int64, amount sdk.Coin) *MsgCancelUnbondingDelegation { + return &MsgCancelUnbondingDelegation{ + DelegatorAddress: delAddr.String(), + ValidatorAddress: valAddr.String(), + Amount: amount, + CreationHeight: creationHeight, + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) Type() string { return TypeMsgCancelUnbondingDelegation } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) GetSigners() []sdk.AccAddress { + delegator, _ := sdk.AccAddressFromBech32(msg.DelegatorAddress) + return []sdk.AccAddress{delegator} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) GetSignBytes() []byte { + return sdk.MustSortJSON(legacy.Cdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) + } + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return sdkerrors.Wrap( + sdkerrors.ErrInvalidRequest, + "invalid amount", + ) + } + + if msg.CreationHeight <= 0 { + return sdkerrors.Wrap( + sdkerrors.ErrInvalidRequest, + "invalid height", + ) + } + + return nil +} diff --git a/x/staking/types/tx.pb.go b/x/staking/types/tx.pb.go index b14118d4d1d2..750593b36f58 100644 --- a/x/staking/types/tx.pb.go +++ b/x/staking/types/tx.pb.go @@ -451,6 +451,86 @@ func (m *MsgUndelegateResponse) GetCompletionTime() time.Time { return time.Time{} } +// MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator +type MsgCancelUnbondingDelegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + // amount is always less than or equal to unbonding delegation entry balance + Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + // creation_height is the height which the unbonding took place. + CreationHeight int64 `protobuf:"varint,4,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` +} + +func (m *MsgCancelUnbondingDelegation) Reset() { *m = MsgCancelUnbondingDelegation{} } +func (m *MsgCancelUnbondingDelegation) String() string { return proto.CompactTextString(m) } +func (*MsgCancelUnbondingDelegation) ProtoMessage() {} +func (*MsgCancelUnbondingDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{10} +} +func (m *MsgCancelUnbondingDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelUnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelUnbondingDelegation.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 *MsgCancelUnbondingDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelUnbondingDelegation.Merge(m, src) +} +func (m *MsgCancelUnbondingDelegation) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelUnbondingDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelUnbondingDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelUnbondingDelegation proto.InternalMessageInfo + +// MsgCancelUnbondingDelegationResponse +type MsgCancelUnbondingDelegationResponse struct { +} + +func (m *MsgCancelUnbondingDelegationResponse) Reset() { *m = MsgCancelUnbondingDelegationResponse{} } +func (m *MsgCancelUnbondingDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCancelUnbondingDelegationResponse) ProtoMessage() {} +func (*MsgCancelUnbondingDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{11} +} +func (m *MsgCancelUnbondingDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelUnbondingDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelUnbondingDelegationResponse.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 *MsgCancelUnbondingDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelUnbondingDelegationResponse.Merge(m, src) +} +func (m *MsgCancelUnbondingDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelUnbondingDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelUnbondingDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelUnbondingDelegationResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateValidator)(nil), "cosmos.staking.v1beta1.MsgCreateValidator") proto.RegisterType((*MsgCreateValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgCreateValidatorResponse") @@ -462,66 +542,73 @@ func init() { proto.RegisterType((*MsgBeginRedelegateResponse)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegateResponse") proto.RegisterType((*MsgUndelegate)(nil), "cosmos.staking.v1beta1.MsgUndelegate") proto.RegisterType((*MsgUndelegateResponse)(nil), "cosmos.staking.v1beta1.MsgUndelegateResponse") + proto.RegisterType((*MsgCancelUnbondingDelegation)(nil), "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation") + proto.RegisterType((*MsgCancelUnbondingDelegationResponse)(nil), "cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse") } func init() { proto.RegisterFile("cosmos/staking/v1beta1/tx.proto", fileDescriptor_0926ef28816b35ab) } var fileDescriptor_0926ef28816b35ab = []byte{ - // 852 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4d, 0x4f, 0xd4, 0x40, - 0x18, 0xde, 0xb2, 0xcb, 0x8a, 0x43, 0x10, 0x28, 0xa0, 0x4b, 0x63, 0xba, 0x64, 0xf1, 0x83, 0xa0, - 0xdb, 0x15, 0xd4, 0x68, 0x88, 0x17, 0x96, 0x85, 0x84, 0xe0, 0x26, 0xa6, 0xa8, 0x07, 0x63, 0xb2, - 0xe9, 0xc7, 0x6c, 0x69, 0xb6, 0xed, 0x94, 0xce, 0x2c, 0x61, 0xaf, 0x9e, 0x3c, 0x92, 0x78, 0xf3, - 0xc4, 0x4f, 0xf0, 0xc0, 0x8f, 0x20, 0x9e, 0x08, 0x27, 0xe3, 0x01, 0x15, 0x0e, 0xfa, 0x03, 0x8c, - 0x67, 0xd3, 0x76, 0xda, 0xfd, 0xe8, 0xee, 0x5a, 0x12, 0x38, 0x79, 0x6a, 0xd3, 0xf7, 0x79, 0x9f, - 0x77, 0xe6, 0x79, 0x9f, 0x79, 0xa7, 0x20, 0xab, 0x20, 0x6c, 0x22, 0x5c, 0xc0, 0x44, 0xaa, 0xe9, - 0x96, 0x56, 0xd8, 0x59, 0x90, 0x21, 0x91, 0x16, 0x0a, 0x64, 0x57, 0xb0, 0x1d, 0x44, 0x10, 0x7b, - 0xdd, 0x07, 0x08, 0x14, 0x20, 0x50, 0x00, 0x37, 0xad, 0x21, 0xa4, 0x19, 0xb0, 0xe0, 0xa1, 0xe4, - 0x7a, 0xb5, 0x20, 0x59, 0x0d, 0x3f, 0x85, 0xcb, 0x76, 0x86, 0x88, 0x6e, 0x42, 0x4c, 0x24, 0xd3, - 0xa6, 0x80, 0x49, 0x0d, 0x69, 0xc8, 0x7b, 0x2d, 0xb8, 0x6f, 0xf4, 0xeb, 0xb4, 0x5f, 0xa9, 0xe2, - 0x07, 0x68, 0x59, 0x3f, 0xc4, 0xd3, 0x55, 0xca, 0x12, 0x86, 0xe1, 0x12, 0x15, 0xa4, 0x5b, 0x34, - 0x7e, 0xab, 0xc7, 0x2e, 0x82, 0x45, 0xfb, 0xa8, 0x1b, 0x14, 0x65, 0x62, 0x17, 0xe1, 0x3e, 0xfc, - 0x40, 0xee, 0x47, 0x0a, 0xb0, 0x65, 0xac, 0xad, 0x38, 0x50, 0x22, 0xf0, 0xb5, 0x64, 0xe8, 0xaa, - 0x44, 0x90, 0xc3, 0x6e, 0x80, 0x61, 0x15, 0x62, 0xc5, 0xd1, 0x6d, 0xa2, 0x23, 0x2b, 0xc3, 0xcc, - 0x30, 0x73, 0xc3, 0x8b, 0xb3, 0x42, 0x77, 0x41, 0x84, 0x52, 0x13, 0x5a, 0x4c, 0x1d, 0x9e, 0x64, - 0x13, 0x62, 0x6b, 0x36, 0x5b, 0x06, 0x40, 0x41, 0xa6, 0xa9, 0x63, 0xec, 0x72, 0x0d, 0x78, 0x5c, - 0x77, 0x7b, 0x71, 0xad, 0x84, 0x48, 0x51, 0x22, 0x10, 0x53, 0xbe, 0x16, 0x02, 0xd6, 0x00, 0x13, - 0xa6, 0x6e, 0x55, 0x30, 0x34, 0xaa, 0x15, 0x15, 0x1a, 0x50, 0x93, 0xbc, 0x35, 0x26, 0x67, 0x98, - 0xb9, 0xab, 0xc5, 0x67, 0x2e, 0xfc, 0xeb, 0x49, 0xf6, 0x8e, 0xa6, 0x93, 0xad, 0xba, 0x2c, 0x28, - 0xc8, 0xa4, 0x7a, 0xd2, 0x47, 0x1e, 0xab, 0xb5, 0x02, 0x69, 0xd8, 0x10, 0x0b, 0xeb, 0x16, 0x39, - 0x3e, 0xc8, 0x03, 0xba, 0x90, 0x75, 0x8b, 0x88, 0xe3, 0xa6, 0x6e, 0x6d, 0x42, 0xa3, 0x5a, 0x0a, - 0x69, 0xd9, 0x55, 0x30, 0x4e, 0x8b, 0x20, 0xa7, 0x22, 0xa9, 0xaa, 0x03, 0x31, 0xce, 0xa4, 0xbc, - 0x5a, 0x99, 0xe3, 0x83, 0xfc, 0x24, 0xcd, 0x5e, 0xf6, 0x23, 0x9b, 0xc4, 0xd1, 0x2d, 0x4d, 0x1c, - 0x0b, 0x53, 0xe8, 0x77, 0x97, 0x66, 0x27, 0x50, 0x37, 0xa4, 0x19, 0xfc, 0x17, 0x4d, 0x98, 0x12, - 0xd0, 0xac, 0x81, 0xb4, 0x5d, 0x97, 0x6b, 0xb0, 0x91, 0x49, 0x7b, 0x32, 0x4e, 0x0a, 0xbe, 0xe1, - 0x84, 0xc0, 0x70, 0xc2, 0xb2, 0xd5, 0x28, 0x66, 0x3e, 0x37, 0x19, 0x15, 0xa7, 0x61, 0x13, 0x24, - 0xbc, 0xa8, 0xcb, 0x1b, 0xb0, 0x21, 0xd2, 0x6c, 0xf6, 0x31, 0x18, 0xdc, 0x91, 0x8c, 0x3a, 0xcc, - 0x5c, 0xf1, 0x68, 0xa6, 0x83, 0x6e, 0xb8, 0x2e, 0x6b, 0x69, 0x85, 0x1e, 0xf4, 0xd3, 0x47, 0x2f, - 0x3d, 0x7a, 0xbf, 0x9f, 0x4d, 0xfc, 0xda, 0xcf, 0x26, 0xde, 0xfd, 0xfc, 0x34, 0x1f, 0xd5, 0xc5, - 0xfb, 0x1a, 0xd9, 0x66, 0xee, 0x26, 0xe0, 0xa2, 0x16, 0x13, 0x21, 0xb6, 0x91, 0x85, 0x61, 0xee, - 0x43, 0x12, 0x8c, 0x95, 0xb1, 0xb6, 0xaa, 0xea, 0xe4, 0x92, 0xfc, 0xd7, 0x55, 0xfb, 0x81, 0x73, - 0x6b, 0x2f, 0x81, 0xd1, 0xa6, 0x0b, 0x2b, 0x8e, 0x44, 0x20, 0xf5, 0xdc, 0xd3, 0x98, 0x7e, 0x2b, - 0x41, 0xa5, 0xc5, 0x6f, 0x25, 0xa8, 0x88, 0xd7, 0x94, 0x36, 0xb7, 0xb3, 0x5b, 0xdd, 0xad, 0x9d, - 0x3a, 0x57, 0x99, 0x38, 0xb6, 0x5e, 0xe2, 0xdb, 0x3a, 0x19, 0xed, 0x19, 0x07, 0x32, 0x9d, 0x4d, - 0x09, 0x3b, 0xf6, 0x9b, 0x01, 0xc3, 0x65, 0xac, 0x51, 0x36, 0xd8, 0xfd, 0x88, 0x30, 0x17, 0x73, - 0x44, 0xce, 0xdf, 0xa6, 0x27, 0x20, 0x2d, 0x99, 0xa8, 0x6e, 0x11, 0xaf, 0x3b, 0x31, 0xbc, 0x4d, - 0xe1, 0x1d, 0x92, 0x44, 0x76, 0x94, 0x9b, 0x02, 0x13, 0x2d, 0xbb, 0x0e, 0xd5, 0x38, 0x1a, 0xf0, - 0x26, 0x68, 0x11, 0x6a, 0xba, 0x25, 0x42, 0xf5, 0x82, 0x45, 0x79, 0x0e, 0xa6, 0x9a, 0xa2, 0x60, - 0x47, 0x89, 0x2d, 0xcc, 0x44, 0x98, 0xb6, 0xe9, 0x28, 0x5d, 0xd9, 0x54, 0x4c, 0x42, 0xb6, 0x64, - 0x6c, 0xb6, 0x12, 0x26, 0x51, 0xa5, 0x53, 0x17, 0xab, 0x74, 0xcd, 0x1b, 0x18, 0x1d, 0x8a, 0x06, - 0x82, 0xb3, 0x65, 0xef, 0x1c, 0xda, 0x06, 0x74, 0x8d, 0x5c, 0x71, 0x2f, 0x58, 0x3a, 0x1f, 0xb8, - 0xc8, 0x30, 0x7c, 0x19, 0xdc, 0xbe, 0xc5, 0x21, 0x77, 0x01, 0x7b, 0xdf, 0xb2, 0x8c, 0x77, 0xe6, - 0x68, 0xb2, 0x1b, 0xce, 0xfd, 0x61, 0xc0, 0x48, 0x19, 0x6b, 0xaf, 0x2c, 0xf5, 0x3f, 0xf3, 0x73, - 0x15, 0x4c, 0xb5, 0xed, 0xfb, 0x92, 0x04, 0x5e, 0xfc, 0x98, 0x02, 0xc9, 0x32, 0xd6, 0xd8, 0x6d, - 0x30, 0xda, 0xf9, 0x9b, 0x31, 0xdf, 0x6b, 0xa2, 0x47, 0xef, 0x0b, 0x6e, 0x31, 0x3e, 0x36, 0xdc, - 0x49, 0x0d, 0x8c, 0xb4, 0xdf, 0x2b, 0x73, 0x7d, 0x48, 0xda, 0x90, 0xdc, 0x83, 0xb8, 0xc8, 0xb0, - 0xd8, 0x5b, 0x30, 0x14, 0x8e, 0xc4, 0xd9, 0x3e, 0xd9, 0x01, 0x88, 0xbb, 0x17, 0x03, 0x14, 0xb2, - 0x6f, 0x83, 0xd1, 0xce, 0x11, 0xd3, 0x4f, 0xbd, 0x0e, 0x6c, 0x5f, 0xf5, 0x7a, 0x1d, 0x34, 0x19, - 0x80, 0x96, 0x53, 0x71, 0xbb, 0x0f, 0x43, 0x13, 0xc6, 0xe5, 0x63, 0xc1, 0x82, 0x1a, 0xc5, 0xb5, - 0xc3, 0x53, 0x9e, 0x39, 0x3a, 0xe5, 0x99, 0xef, 0xa7, 0x3c, 0xb3, 0x77, 0xc6, 0x27, 0x8e, 0xce, - 0xf8, 0xc4, 0x97, 0x33, 0x3e, 0xf1, 0xe6, 0x7e, 0xdf, 0xab, 0x6e, 0x37, 0xfc, 0xe1, 0xf5, 0x2e, - 0x3d, 0x39, 0xed, 0x59, 0xf2, 0xe1, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x9b, 0x4b, 0x7e, - 0xd5, 0x0b, 0x00, 0x00, + // 937 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xf6, 0xc6, 0x4e, 0x28, 0x13, 0xb5, 0x69, 0x37, 0x09, 0x38, 0xab, 0xca, 0xae, 0xdc, 0xd2, + 0x46, 0x85, 0xac, 0x69, 0x28, 0x02, 0x55, 0xbd, 0xd4, 0x75, 0x2b, 0xaa, 0x62, 0x09, 0x6d, 0x28, + 0x07, 0x84, 0x64, 0xcd, 0xee, 0x4e, 0x26, 0x23, 0xef, 0xce, 0xb8, 0x3b, 0xe3, 0xa8, 0xbe, 0x72, + 0xe2, 0x46, 0x25, 0xfe, 0x40, 0x7f, 0x00, 0x42, 0x1c, 0xfa, 0x23, 0x2a, 0x4e, 0x51, 0x4f, 0x88, + 0x43, 0x81, 0xe4, 0x00, 0x3f, 0x00, 0x71, 0x46, 0x3b, 0x3b, 0x3b, 0xfe, 0x58, 0x7b, 0xb3, 0x41, + 0xe9, 0x01, 0x71, 0xf2, 0x6a, 0xe6, 0x79, 0x9f, 0x99, 0x79, 0xde, 0x67, 0xde, 0x77, 0x0c, 0xea, + 0x1e, 0xe3, 0x21, 0xe3, 0x4d, 0x2e, 0x60, 0x8f, 0x50, 0xdc, 0xdc, 0xbf, 0xe1, 0x22, 0x01, 0x6f, + 0x34, 0xc5, 0x13, 0xbb, 0x1f, 0x31, 0xc1, 0xcc, 0xb7, 0x12, 0x80, 0xad, 0x00, 0xb6, 0x02, 0x58, + 0x1b, 0x98, 0x31, 0x1c, 0xa0, 0xa6, 0x44, 0xb9, 0x83, 0xdd, 0x26, 0xa4, 0xc3, 0x24, 0xc4, 0xaa, + 0x4f, 0x4f, 0x09, 0x12, 0x22, 0x2e, 0x60, 0xd8, 0x57, 0x80, 0x35, 0xcc, 0x30, 0x93, 0x9f, 0xcd, + 0xf8, 0x4b, 0x8d, 0x6e, 0x24, 0x2b, 0x75, 0x93, 0x09, 0xb5, 0x6c, 0x32, 0x55, 0x53, 0xbb, 0x74, + 0x21, 0x47, 0x7a, 0x8b, 0x1e, 0x23, 0x54, 0xcd, 0x5f, 0x99, 0x73, 0x8a, 0x74, 0xd3, 0x09, 0xea, + 0x6d, 0x85, 0x0a, 0x79, 0x8c, 0x88, 0x7f, 0x92, 0x89, 0xc6, 0xef, 0x15, 0x60, 0x76, 0x38, 0xbe, + 0x1b, 0x21, 0x28, 0xd0, 0x17, 0x30, 0x20, 0x3e, 0x14, 0x2c, 0x32, 0x1f, 0x82, 0x65, 0x1f, 0x71, + 0x2f, 0x22, 0x7d, 0x41, 0x18, 0xad, 0x1a, 0x97, 0x8c, 0xcd, 0xe5, 0xed, 0xcb, 0xf6, 0x6c, 0x41, + 0xec, 0xf6, 0x08, 0xda, 0xaa, 0xbc, 0x78, 0x55, 0x2f, 0x39, 0xe3, 0xd1, 0x66, 0x07, 0x00, 0x8f, + 0x85, 0x21, 0xe1, 0x3c, 0xe6, 0x5a, 0x90, 0x5c, 0xd7, 0xe6, 0x71, 0xdd, 0xd5, 0x48, 0x07, 0x0a, + 0xc4, 0x15, 0xdf, 0x18, 0x81, 0x19, 0x80, 0xd5, 0x90, 0xd0, 0x2e, 0x47, 0xc1, 0x6e, 0xd7, 0x47, + 0x01, 0xc2, 0x50, 0xee, 0xb1, 0x7c, 0xc9, 0xd8, 0x7c, 0xb3, 0x75, 0x3b, 0x86, 0xff, 0xf2, 0xaa, + 0x7e, 0x15, 0x13, 0xb1, 0x37, 0x70, 0x6d, 0x8f, 0x85, 0x4a, 0x4f, 0xf5, 0xb3, 0xc5, 0xfd, 0x5e, + 0x53, 0x0c, 0xfb, 0x88, 0xdb, 0x0f, 0xa8, 0x78, 0xf9, 0x7c, 0x0b, 0xa8, 0x8d, 0x3c, 0xa0, 0xc2, + 0xb9, 0x10, 0x12, 0xba, 0x83, 0x82, 0xdd, 0xb6, 0xa6, 0x35, 0xef, 0x81, 0x0b, 0x6a, 0x11, 0x16, + 0x75, 0xa1, 0xef, 0x47, 0x88, 0xf3, 0x6a, 0x45, 0xae, 0x55, 0x7d, 0xf9, 0x7c, 0x6b, 0x4d, 0x45, + 0xdf, 0x49, 0x66, 0x76, 0x44, 0x44, 0x28, 0x76, 0xce, 0xeb, 0x10, 0x35, 0x1e, 0xd3, 0xec, 0xa7, + 0xea, 0x6a, 0x9a, 0xc5, 0xe3, 0x68, 0x74, 0x48, 0x4a, 0x73, 0x1f, 0x2c, 0xf5, 0x07, 0x6e, 0x0f, + 0x0d, 0xab, 0x4b, 0x52, 0xc6, 0x35, 0x3b, 0x31, 0x9c, 0x9d, 0x1a, 0xce, 0xbe, 0x43, 0x87, 0xad, + 0xea, 0x4f, 0x23, 0x46, 0x2f, 0x1a, 0xf6, 0x05, 0xb3, 0x3f, 0x1b, 0xb8, 0x0f, 0xd1, 0xd0, 0x51, + 0xd1, 0xe6, 0x87, 0x60, 0x71, 0x1f, 0x06, 0x03, 0x54, 0x7d, 0x43, 0xd2, 0x6c, 0xa4, 0xd9, 0x88, + 0x5d, 0x36, 0x96, 0x0a, 0x92, 0xe6, 0x33, 0x41, 0xdf, 0xba, 0xf9, 0xcd, 0xb3, 0x7a, 0xe9, 0xcf, + 0x67, 0xf5, 0xd2, 0xd7, 0x7f, 0xfc, 0x78, 0x3d, 0xab, 0x8b, 0x1c, 0xcd, 0x1c, 0xb3, 0x71, 0x11, + 0x58, 0x59, 0x8b, 0x39, 0x88, 0xf7, 0x19, 0xe5, 0xa8, 0xf1, 0x5d, 0x19, 0x9c, 0xef, 0x70, 0x7c, + 0xcf, 0x27, 0xe2, 0x35, 0xf9, 0x6f, 0xa6, 0xf6, 0x0b, 0x27, 0xd6, 0x1e, 0x82, 0x95, 0x91, 0x0b, + 0xbb, 0x11, 0x14, 0x48, 0x79, 0xee, 0xe3, 0x82, 0x7e, 0x6b, 0x23, 0x6f, 0xcc, 0x6f, 0x6d, 0xe4, + 0x39, 0xe7, 0xbc, 0x09, 0xb7, 0x9b, 0x7b, 0xb3, 0xad, 0x5d, 0x39, 0xd1, 0x32, 0x45, 0x6c, 0x7d, + 0xab, 0x36, 0x91, 0xc9, 0x6c, 0xce, 0x2c, 0x50, 0x9d, 0x4e, 0x8a, 0xce, 0xd8, 0x5f, 0x06, 0x58, + 0xee, 0x70, 0xac, 0xd8, 0xd0, 0xec, 0x2b, 0x62, 0x9c, 0xce, 0x15, 0x39, 0x79, 0x9a, 0x3e, 0x02, + 0x4b, 0x30, 0x64, 0x03, 0x2a, 0x64, 0x76, 0x0a, 0x78, 0x5b, 0xc1, 0xa7, 0x24, 0xc9, 0x9c, 0xa8, + 0xb1, 0x0e, 0x56, 0xc7, 0x4e, 0xad, 0xd5, 0x38, 0x58, 0x90, 0x15, 0xb4, 0x85, 0x30, 0xa1, 0x0e, + 0xf2, 0x4f, 0x59, 0x94, 0x4f, 0xc1, 0xfa, 0x48, 0x14, 0x1e, 0x79, 0x85, 0x85, 0x59, 0xd5, 0x61, + 0x3b, 0x91, 0x37, 0x93, 0xcd, 0xe7, 0x42, 0xb3, 0x95, 0x0b, 0xb3, 0xb5, 0xb9, 0xc8, 0x2a, 0x5d, + 0x39, 0x5d, 0xa5, 0x7b, 0xb2, 0x60, 0x4c, 0x29, 0x9a, 0x0a, 0x6e, 0x76, 0xe4, 0x3d, 0xec, 0x07, + 0x28, 0x36, 0x72, 0x37, 0x6e, 0xb0, 0xaa, 0x3e, 0x58, 0x99, 0x62, 0xf8, 0x79, 0xda, 0x7d, 0x5b, + 0x67, 0xe2, 0x0d, 0x3c, 0xfd, 0xb5, 0x6e, 0xc8, 0x3b, 0xa7, 0x82, 0xe3, 0xe9, 0xc6, 0xdf, 0x06, + 0x38, 0xdb, 0xe1, 0xf8, 0x11, 0xf5, 0xff, 0x67, 0x7e, 0xde, 0x05, 0xeb, 0x13, 0xe7, 0x7e, 0x5d, + 0x02, 0xff, 0xb0, 0x00, 0x2e, 0xc6, 0xf5, 0x1f, 0x52, 0x0f, 0x05, 0x8f, 0xa8, 0xcb, 0xa8, 0x4f, + 0x28, 0x3e, 0xae, 0xc5, 0xfe, 0xe7, 0xf4, 0x36, 0xaf, 0x81, 0x15, 0x2f, 0xee, 0x71, 0xb1, 0x68, + 0x7b, 0x88, 0xe0, 0xbd, 0xe4, 0x5e, 0x94, 0x9d, 0x73, 0xe9, 0xf0, 0x27, 0x72, 0xf4, 0xd8, 0xc4, + 0x5c, 0x05, 0x57, 0xf2, 0xf4, 0x4a, 0xf3, 0xb4, 0xfd, 0xfd, 0x22, 0x28, 0x77, 0x38, 0x36, 0x1f, + 0x83, 0x95, 0xe9, 0xf7, 0xdb, 0xf5, 0x79, 0xad, 0x32, 0xdb, 0x88, 0xad, 0xed, 0xe2, 0x58, 0x6d, + 0x91, 0x1e, 0x38, 0x3b, 0xd9, 0xb0, 0x37, 0x73, 0x48, 0x26, 0x90, 0xd6, 0xfb, 0x45, 0x91, 0x7a, + 0xb1, 0xaf, 0xc0, 0x19, 0xdd, 0x6b, 0x2e, 0xe7, 0x44, 0xa7, 0x20, 0xeb, 0xdd, 0x02, 0x20, 0xcd, + 0xfe, 0x18, 0xac, 0x4c, 0xd7, 0xee, 0x3c, 0xf5, 0xa6, 0xb0, 0xb9, 0xea, 0xcd, 0xab, 0x60, 0x2e, + 0x00, 0x63, 0xe5, 0xe6, 0x9d, 0x1c, 0x86, 0x11, 0xcc, 0xda, 0x2a, 0x04, 0xd3, 0x6b, 0x7c, 0x6b, + 0x80, 0x8d, 0xf9, 0x57, 0xee, 0x66, 0x5e, 0xce, 0xe7, 0x45, 0x59, 0xb7, 0xff, 0x4d, 0x54, 0xba, + 0xa3, 0xd6, 0xfd, 0x17, 0x87, 0x35, 0xe3, 0xe0, 0xb0, 0x66, 0xfc, 0x76, 0x58, 0x33, 0x9e, 0x1e, + 0xd5, 0x4a, 0x07, 0x47, 0xb5, 0xd2, 0xcf, 0x47, 0xb5, 0xd2, 0x97, 0xef, 0xe5, 0xbe, 0x6a, 0x9e, + 0xe8, 0xff, 0x36, 0xf2, 0x7d, 0xe3, 0x2e, 0xc9, 0xea, 0xf3, 0xc1, 0x3f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x48, 0x6a, 0x50, 0xaf, 0xc0, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -549,6 +636,9 @@ type MsgClient interface { // Undelegate defines a method for performing an undelegation from a // delegate and a validator. Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) + // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + // and delegate back to previous validator. + CancelUnbondingDelegation(ctx context.Context, in *MsgCancelUnbondingDelegation, opts ...grpc.CallOption) (*MsgCancelUnbondingDelegationResponse, error) } type msgClient struct { @@ -604,6 +694,15 @@ func (c *msgClient) Undelegate(ctx context.Context, in *MsgUndelegate, opts ...g return out, nil } +func (c *msgClient) CancelUnbondingDelegation(ctx context.Context, in *MsgCancelUnbondingDelegation, opts ...grpc.CallOption) (*MsgCancelUnbondingDelegationResponse, error) { + out := new(MsgCancelUnbondingDelegationResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateValidator defines a method for creating a new validator. @@ -619,6 +718,9 @@ type MsgServer interface { // Undelegate defines a method for performing an undelegation from a // delegate and a validator. Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) + // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + // and delegate back to previous validator. + CancelUnbondingDelegation(context.Context, *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -640,6 +742,9 @@ func (*UnimplementedMsgServer) BeginRedelegate(ctx context.Context, req *MsgBegi func (*UnimplementedMsgServer) Undelegate(ctx context.Context, req *MsgUndelegate) (*MsgUndelegateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Undelegate not implemented") } +func (*UnimplementedMsgServer) CancelUnbondingDelegation(ctx context.Context, req *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelUnbondingDelegation not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -735,6 +840,24 @@ func _Msg_Undelegate_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Msg_CancelUnbondingDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelUnbondingDelegation) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelUnbondingDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelUnbondingDelegation(ctx, req.(*MsgCancelUnbondingDelegation)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.staking.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -759,6 +882,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Undelegate", Handler: _Msg_Undelegate_Handler, }, + { + MethodName: "CancelUnbondingDelegation", + Handler: _Msg_CancelUnbondingDelegation_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/staking/v1beta1/tx.proto", @@ -1196,6 +1323,81 @@ func (m *MsgUndelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgCancelUnbondingDelegation) 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 *MsgCancelUnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelUnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + 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.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCancelUnbondingDelegationResponse) 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 *MsgCancelUnbondingDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelUnbondingDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1369,6 +1571,37 @@ func (m *MsgUndelegateResponse) Size() (n int) { return n } +func (m *MsgCancelUnbondingDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + if m.CreationHeight != 0 { + n += 1 + sovTx(uint64(m.CreationHeight)) + } + return n +} + +func (m *MsgCancelUnbondingDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2634,6 +2867,222 @@ func (m *MsgUndelegateResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgCancelUnbondingDelegation) 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: MsgCancelUnbondingDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelUnbondingDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = 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 + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgCancelUnbondingDelegationResponse) 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: MsgCancelUnbondingDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelUnbondingDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0