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

Staking Messages #21

Closed
wants to merge 2 commits into from
Closed
Changes from all 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
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ Where message `type` must be one of:
- `4`: `Transact`
- `5`: `RelayTo`
- `6`: `RelayedFrom`
- `7`: `HrmpNewChannelOpenRequest`
- `8`: `HrmpChannelAccepted`
- `9`: `HrmpChannelClosing`
- `10`: `HrmpInitOpenChannel`
- `11`: `HrmpAcceptOpenChannel`
- `12`: `HrmpCloseChannel`
- `13`: `Staking`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just put the different message types right in here.


Within XCM, there is an internal datatype `Order`, which encodes an operation on the holding account. It is defined as:

Expand Down Expand Up @@ -173,6 +180,62 @@ Kind: *Trusted Indication*.

Errors:

### `Staking`

Send staking related messages. All the messages should be executed sequentially and applied atomically.

- `messages: Vec<StakingMssage>`

Kind: *Meta*.

Errors:

#### `StakingMessage` Types

##### `Bond`

- `value: Compact`: The amount of token to bond.

Kind: *Instruction*.

##### `Unbond`

- `value: Compact`: The amount of token to unbond.

Kind: *Instruction*.

##### `Rebond`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI if the goal is to be general: this is assuming the existence of a bonding duration in which you can rebond your tokens. While unlikely, some chains might not have this. Or, if this applies also to the notion of delegators, they usually don't have any bonding duration applied.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XCM aims to be general, exhaustive and composable.


- `value: Compact`: The amount of token to bond.

Kind: *Instruction*.

##### `SetPayee`

- `payee: RewardDestination`: The destination account for payment.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are we going to define RewardDestination? Do we want to mimic the Substrate Staking pallet?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not very familiar with XCM: what are the assumptions? That we have two any arbitrary chains talking to each other, or two substrate based chains, or two FRAME-based chains?

If not the former, then the design of this can be reflected on pallet-staking, and we can make sure that things that are noted here will rarely change in pallet-staking.

Although, my guess is that this is totally generic over chain and we can't make an assumption about the existence of pallet-staking

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any two arbitrary chains.


TODO: How are we going to define RewardDestination type??

Kind: *Instruction*.

##### `WithdrawUnbonded`

Kind: *Instruction*.

##### `Nominate`

- `targets: Vec<MultiLocation>`: Declare the desire to nominate `targets`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is AccountId on Kusama / Polkadot. Not too sure how we going to define it here. This must be dest chain account type and MultiLocation allow people to enter all kinds of accounts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think of XCM as a language; there's no need for every sentence to be true or even to make sense. XCM just let's you express ideas in an unambiguous way - it's up to the destination chain to decide what those mean in its context.

In this case, it's perfectly reasonable for a substrate chain to require this MultiLocation to be specifically an AccountId32 type, and to bail on anything else.


Kind: *Instruction*.

##### `Chill`

Kind: *Instruction*.

##### `PayoutStakers`

Kind: *Instruction*.

## `Order` Types

### `Null`
Expand Down