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)
This commit is contained in:
Sai Kumar 2022-04-05 15:31:13 +05:30 committed by GitHub
parent 6fa9252f3d
commit 5bde3686c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 2412 additions and 171 deletions

View File

@ -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.

File diff suppressed because it is too large Load Diff

View File

@ -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",

View File

@ -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{}

View File

@ -17,6 +17,7 @@ const (
DefaultWeightMsgDelegate int = 100
DefaultWeightMsgUndelegate int = 100
DefaultWeightMsgBeginRedelegate int = 100
DefaultWeightMsgCancelUnbondingDelegation int = 100
DefaultWeightCommunitySpendProposal int = 5
DefaultWeightTextProposal int = 5

View File

@ -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)

View File

@ -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.

View File

@ -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() {

View File

@ -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",

View File

@ -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
}

View File

@ -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)
}
})
}
}

View File

@ -24,7 +24,7 @@ import (
)
const (
consensusVersion uint64 = 3
consensusVersion uint64 = 4
)
var (

View File

@ -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(

View File

@ -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) {

View File

@ -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),

View File

@ -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

View File

@ -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
}

View File

@ -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, 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6f, 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, 0x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 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