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

Fix tests of Staking for Crab #331

Merged
merged 8 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
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
153 changes: 153 additions & 0 deletions frame/staking/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# CHANGELOG(v2.0.0.alpha.3)

## Core

Some concepts should have some explaination for the changing from substrate

### power

power is a mixture of ring and kton.

+ For *RING*: `power = ring_ratio * POWER_COUNT / 2`
+ For *KTON*: `power = kton_ratio * POWER_COUNT / 2`

### rebond

The darwinia style `rebond` implementation.


### withdraw

What should happen after all balances being unbonded?(the locked balance)


## Moudle
+ delete `withdraw_unbond`
+ delete `slashable_balance_of`
hackfisher marked this conversation as resolved.
Show resolved Hide resolved
+ use `power_of`
+ use `stake_of`

## Structs

### Exposure

A snapshot of the stake backing a single validator in the system.

> darwinia

```rust
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, Default, RuntimeDebug)]
pub struct Exposure<AccountId, RingBalance, KtonBalance>
where
RingBalance: HasCompact,
KtonBalance: HasCompact,
{
#[codec(compact)]
pub own_ring_balance: RingBalance,
#[codec(compact)]
pub own_kton_balance: KtonBalance,
pub own_power: Power,
pub total_power: Power,
pub others: Vec<IndividualExposure<AccountId, RingBalance, KtonBalance>>,
}
```

> substrate

```rust
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, Default, RuntimeDebug)]
pub struct Exposure<AccountId, Balance: HasCompact> {
/// The total balance backing this validator.
#[codec(compact)]
pub total: Balance,
/// The validator's own stash that is exposed.
#[codec(compact)]
pub own: Balance,
/// The portions of nominators stashes that are exposed.
pub others: Vec<IndividualExposure<AccountId, Balance>>,
}
```

### IndividualExposure

The amount of exposure (to slashing) than an individual nominator has.

> darwinia

```rust
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, RuntimeDebug)]
pub struct IndividualExposure<AccountId, RingBalance, KtonBalance>
where
RingBalance: HasCompact,
KtonBalance: HasCompact,
{
who: AccountId,
#[codec(compact)]
ring_balance: RingBalance,
#[codec(compact)]
kton_balance: KtonBalance,
power: Power,
}
```

> substrate
```rust
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, RuntimeDebug)]
pub struct IndividualExposure<AccountId, Balance: HasCompact> {
/// The stash account of the nominator in question.
who: AccountId,
/// Amount of funds exposed.
#[codec(compact)]
value: Balance,
}
```


### StakingLedger

The ledger of a (bonded) stash.

+ annotated `rebond`
hackfisher marked this conversation as resolved.
Show resolved Hide resolved

Currently we don't have this requirement.

> darwinia
```rust
#[derive(PartialEq, Eq, Clone, Default, Encode, Decode, RuntimeDebug)]
pub struct StakingLedger<AccountId, RingBalance, KtonBalance, BlockNumber, Timestamp>
where
RingBalance: HasCompact,
KtonBalance: HasCompact,
{
pub stash: AccountId,
#[codec(compact)]
pub active_ring: RingBalance,
#[codec(compact)]
pub active_deposit_ring: RingBalance,
#[codec(compact)]
pub active_kton: KtonBalance,
pub deposit_items: Vec<TimeDepositItem<RingBalance, Timestamp>>,
pub ring_staking_lock: StakingLock<RingBalance, BlockNumber>,
pub kton_staking_lock: StakingLock<KtonBalance, BlockNumber>,
}
```

> substrate

```rust
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)]
pub struct StakingLedger<AccountId, Balance: HasCompact> {
pub stash: AccountId,
/// The total amount of the stash's balance that we are currently accounting for.
/// It's just `active` plus all the `unlocking` balances.
#[codec(compact)]
pub total: Balance,
/// The total amount of the stash's balance that will be at stake in any forthcoming
/// rounds.
#[codec(compact)]
pub active: Balance,
/// Any balance that is becoming free, which may eventually be transferred out
/// of the stash (assuming it doesn't get slashed first).
pub unlocking: Vec<UnlockChunk<Balance>>,
}
```
Loading