Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(staking): add cancel-unbond delegations spec #11473

Merged
merged 14 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions x/staking/spec/02_state_transitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ Delegation may be called.
shares from the `BondedPool` to the `NotBondedPool` `ModuleAccount`
* remove the validator if it is unbonded and there are no more delegation shares.

### Cancel an `UnbondingDelegation` Entry
When a `cancel unbond delegation` occures both the `validator` and the `delegation` and an `UnbondingDelegationQueue` state will be affected
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
* if cancel unbonding delegation amount equals to an `UnbondingDelegation` Entry `balance` then an `UnbondingDelegation` Entry deleted from `UnbondingDelegationQueue`.
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
* if cancel unbonding delegation amount is less then an `UnbondingDelegation` Entry balance then an `UnbondingDelegation` Entry updated with new balance to the `UnbondingDelegationQueue`.
* cancel `amount` is [Delegated](02_state_transitions.md#delegations) back to previous `validator`
gsk967 marked this conversation as resolved.
Show resolved Hide resolved

### Complete Unbonding

For undelegations which do not complete immediately, the following operations
Expand Down
21 changes: 21 additions & 0 deletions x/staking/spec/03_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@ When this message is processed the following actions occur:

![Unbond sequence](../../../docs/uml/svg/unbond_sequence.svg)

## MsgCancelUnbondingDelegation
The `MsgCancelUnbondingDelegation` message allows delegators to cancel the `unbondingDelegation` entry and re-deleagate back to previous validator.
gsk967 marked this conversation as resolved.
Show resolved Hide resolved

+++ https://github.com/cosmos/cosmos-sdk/blob/28243eb41c16ecfc95631ac2bb266dd28ed5c317/proto/cosmos/staking/v1beta1/tx.proto#L36-L38

+++ https://github.com/cosmos/cosmos-sdk/blob/28243eb41c16ecfc95631ac2bb266dd28ed5c317/proto/cosmos/staking/v1beta1/tx.proto#L144-L154

+++ https://github.com/cosmos/cosmos-sdk/blob/28243eb41c16ecfc95631ac2bb266dd28ed5c317/proto/cosmos/staking/v1beta1/tx.proto#L156-L157


This message is expected to fail if:
* if an `unbondingDelegation` entry is already processed
* if cancel unbonding delegation amount is greater than the `unbondingDelegation` entry balance
* if cancel unbonding delegation height is not exists in the `unbondingDelegationQueue` of the delegator
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
gsk967 marked this conversation as resolved.
Show resolved Hide resolved

When this message is processed the following actions occur:
* if delegator `unbondingDelegation` entry is not processed
* if cancel `unbondingDelegation` amount is less than or equal to the `unbondingDelegation` entry of delegator
* if cancel unbonding delegation height is exists in the `unbondingDelegation` queue of the delegator
gsk967 marked this conversation as resolved.
Show resolved Hide resolved


## MsgBeginRedelegate

The redelegation command allows delegators to instantly switch validators. Once
Expand Down
12 changes: 12 additions & 0 deletions x/staking/spec/07_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ The staking module emits the following events:

* [0] Time is formatted in the RFC3339 standard

### MsgCancelUnbondingDelegation

| Type | Attribute Key | Attribute Value |
| ----------------------------- | ------------------ | ------------------------------------|
| cancel_unbonding_delegation | validator | {validatorAddress} |
| cancel_unbonding_delegation | delegator | {delegatorAddress} |
| cancel_unbonding_delegation | amount | {cancelUnbondingDelegationAmount} |
| cancel_unbonding_delegation | creation_height | {unbondingCreationHeight} |
| message | module | staking |
| message | action | cancel_unbond |
| message | sender | {senderAddress} |

### MsgBeginRedelegate

| Type | Attribute Key | Attribute Value |
Expand Down
13 changes: 13 additions & 0 deletions x/staking/spec/09_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,19 @@ Example:
```bash
simd tx staking unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake --from mykey
```
#### cancel unbond
The command `cancel-unbond` allow users to cancel unbonding delegation entry and re-delegate back to previous validator.
gsk967 marked this conversation as resolved.
Show resolved Hide resolved

Usage:
```bash
simd tx staking cancel-unbond [validator-addr] [amount] [creation-height]
```

Example:
```bash
simd tx staking cancel-unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake 123123 --from mykey
```


## gRPC

Expand Down
1 change: 1 addition & 0 deletions x/staking/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ network.
* [MsgEditValidator](03_messages.md#msgeditvalidator)
* [MsgDelegate](03_messages.md#msgdelegate)
* [MsgUndelegate](03_messages.md#msgundelegate)
* [MsgCancelUnbondingDelegation](03_messages.md#msgcancelunbondingdelegation)
* [MsgBeginRedelegate](03_messages.md#msgbeginredelegate)
4. **[Begin-Block](04_begin_block.md)**
* [Historical Info Tracking](04_begin_block.md#historical-info-tracking)
Expand Down