Skip to content

Commit

Permalink
[Staking] Make exits manual, patch lack of delay for {increasing, dec…
Browse files Browse the repository at this point in the history
…reasing} bonds (#810)

* init

* stash

* checkpoint

* checkpoint

* checkpoint

* save middle of refactor

* save

* checkpoint

* clean

* clean

* clean

* clean init collator candidate helper functions

* checkpoint

* stash

* merged execute and cancel functions but kept events different for execution

* clean

* init unit test updates st tests compile now but 62 fail

* gradual progress

* fix origins according to review feedback, only a few more tests left

* 3 unit tests left

* 2

* all unit tests pass, update all runtime configs

* update existing precompile code

* update chainspecs

* update integration test imports

* update benchmarking wip

* update bond more bond less benchmarking

* more unit tests for new execute and leave extrinsics

* cancel delegation request unit tests for all delegation request types

* update unit test utils

* finish excecute and cancel extrinsic benchmarking with hardcoded uniform delay of 2 rounds

* nits and start adding schedule to prefix old extrinsic names because behavior changed

* fix constraints to allow making and executing delegation requests while candidate is leaving

* runtime upgrade first pass, needs unit tests

* clean

* finish runtime migration and add unit tests

* clean

* clean

* try partial update TS

* ts progress and change name of nominate extrinsic to delegate

* clean TS and remove duplicate tests

* try add ts types to types bundle

* fix

* fix

* fix

* fix

* fix

* try fix TS test

* fix

* fix

* move migration into pallet migrations and add pre checks and post checks

* fix

* cargo lock

* address most review comments

* improve readability of can_leave calls

* more

* revert mixing migrations

* remove unnecessary constraint to enable making and executing candidate bond requests if the candidate is scheduled to leave aka leaving

* fix merge

* more nominator - and nomination -

* revert mistake

* update precompile

* add execute and cancel fns to staking precompile

* more precompile unit coverage wip

* precompile unit test coverage

* finish updating precompiles with new extrinsic names and add tests for all new while preserving tests for old

* fix test utils to panic at line where error occurs instead of line in mock fn

* fix benchmarking code for execute leave candidates

* try fix benchmarking

* try

* try debug

* try again

* benchmark and weights for leave candidates extrinsics

* last todos

* update src contracts and revert unnecessary bench changes

* accept notlesh suggestions

* and update precompile tests with pallet changes just made

* compiled StakingDelegationAttaker contract

* prettier

* clean unit tests and fix bench again

* improve deprecated docs for StakingInterface.sol

* increase max block weight safety margin to 50 percent

* remove outdated comment
  • Loading branch information
4meta5 committed Nov 19, 2021
1 parent daceb1d commit 76f748a
Show file tree
Hide file tree
Showing 42 changed files with 9,963 additions and 6,503 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions node/service/src/chain_spec/moonbase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn development_chain_spec(mnemonic: Option<String>, num_accounts: Option<u32
get_from_seed::<NimbusId>("Alice"),
1_000 * UNIT,
)],
// Nominations
// Delegations
vec![],
accounts.clone(),
3_000_000 * UNIT,
Expand Down Expand Up @@ -133,7 +133,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
1_000 * UNIT,
),
],
// Nominations
// Delegations
vec![],
vec![
AccountId::from_str("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac").unwrap(),
Expand Down Expand Up @@ -186,7 +186,7 @@ pub fn testnet_genesis(
council_members: Vec<AccountId>,
tech_comittee_members: Vec<AccountId>,
candidates: Vec<(AccountId, NimbusId, Balance)>,
nominations: Vec<(AccountId, AccountId, Balance)>,
delegations: Vec<(AccountId, AccountId, Balance)>,
endowed_accounts: Vec<AccountId>,
crowdloan_fund_pot: Balance,
para_id: ParaId,
Expand Down Expand Up @@ -246,7 +246,7 @@ pub fn testnet_genesis(
.cloned()
.map(|(account, _, bond)| (account, bond))
.collect(),
nominations,
delegations,
inflation_config: moonbeam_inflation_config(),
},
council_collective: CouncilCollectiveConfig {
Expand Down
8 changes: 4 additions & 4 deletions node/service/src/chain_spec/moonbeam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn development_chain_spec(mnemonic: Option<String>, num_accounts: Option<u32
get_from_seed::<NimbusId>("Alice"),
1_000 * GLMR,
)],
// Nominations
// Delegations
vec![],
accounts.clone(),
3_000_000 * GLMR,
Expand Down Expand Up @@ -116,7 +116,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
1_000 * GLMR,
),
],
// Nominations
// Delegations
vec![],
vec![
AccountId::from_str("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac").unwrap(),
Expand Down Expand Up @@ -167,7 +167,7 @@ pub fn moonbeam_inflation_config() -> InflationInfo<Balance> {
pub fn testnet_genesis(
root_key: AccountId,
candidates: Vec<(AccountId, NimbusId, Balance)>,
nominations: Vec<(AccountId, AccountId, Balance)>,
delegations: Vec<(AccountId, AccountId, Balance)>,
endowed_accounts: Vec<AccountId>,
crowdloan_fund_pot: Balance,
para_id: ParaId,
Expand Down Expand Up @@ -227,7 +227,7 @@ pub fn testnet_genesis(
.cloned()
.map(|(account, _, bond)| (account, bond))
.collect(),
nominations,
delegations,
inflation_config: moonbeam_inflation_config(),
},
council_collective: CouncilCollectiveConfig {
Expand Down
8 changes: 4 additions & 4 deletions node/service/src/chain_spec/moonriver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn development_chain_spec(mnemonic: Option<String>, num_accounts: Option<u32
get_from_seed::<NimbusId>("Alice"),
1_000 * MOVR,
)],
// Nominations
// Delegations
vec![],
accounts.clone(),
3_000_000 * MOVR,
Expand Down Expand Up @@ -112,7 +112,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
1_000 * MOVR,
),
],
// Nominations
// Delegations
vec![],
vec![
AccountId::from_str("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac").unwrap(),
Expand Down Expand Up @@ -162,7 +162,7 @@ pub fn moonbeam_inflation_config() -> InflationInfo<Balance> {

pub fn testnet_genesis(
candidates: Vec<(AccountId, NimbusId, Balance)>,
nominations: Vec<(AccountId, AccountId, Balance)>,
delegations: Vec<(AccountId, AccountId, Balance)>,
endowed_accounts: Vec<AccountId>,
crowdloan_fund_pot: Balance,
para_id: ParaId,
Expand Down Expand Up @@ -221,7 +221,7 @@ pub fn testnet_genesis(
.cloned()
.map(|(account, _, bond)| (account, bond))
.collect(),
nominations,
delegations,
inflation_config: moonbeam_inflation_config(),
},
council_collective: CouncilCollectiveConfig {
Expand Down
2 changes: 1 addition & 1 deletion node/service/src/chain_spec/test_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn staking_spec(para_id: ParaId) -> ChainSpec {
1_000 * UNIT,
),
],
// Nominations
// Delegations
vec![],
// Endowed accounts (each minted 1 << 80 balance)
vec![
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "parachain-staking"
authors = [ "PureStake" ]
description = "parachain staking pallet for collator selection and reward distribution"
edition = "2018"
version = "2.1.1"
version = "3.0.0"

[dependencies]
log = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Implements Delegated Proof of Stake to

1. select the active set of eligible block producers
2. reward block authors
3. enable nominators and collators to participate in inflationary rewards
3. enable delegators and collators to participate in inflationary rewards

Links:

Expand Down
9 changes: 9 additions & 0 deletions pallets/parachain-staking/migrations.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Migration History

## Manual Exits and Patch Lack of Delay for bond\_{more, less}

- [Migration PR `#810`](https://github.com/PureStake/moonbeam/pull/810)
- [Migration Removal PR `#?`]()

## Purge Stale Storage

- [Migration PR `#970`](https://github.com/PureStake/moonbeam/pull/970)

## Delay nominator exits by changing NominatorState and ExitQueue

- [Migration PR `#610`](https://github.com/PureStake/moonbeam/pull/610)
Expand Down

0 comments on commit 76f748a

Please sign in to comment.