Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Staking::{bond, set_controller} to set controllers to stash only. #14039

Merged
merged 67 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
0811cb9
update set_controller
Apr 28, 2023
6f0be00
clone
Apr 28, 2023
75beff4
bond uses `stash`
May 3, 2023
74d34ea
remove controller from bond(), chill_other test works
May 3, 2023
fc11538
remove ctlr from testing_utils & dead ctlr -> dead payee
May 3, 2023
35d873c
mvs controllers to stashes for 3 tests
May 3, 2023
6e73503
migrate mock bond fns & fix 1 test
May 3, 2023
0379c65
mvs controllers to stashes for 7 tests
May 3, 2023
d29a6a5
mvs controllers to stashes for 9 tests
May 3, 2023
71289da
remove double_controlling_should_fail
May 3, 2023
5198f53
remove double_staking_should_fail
May 3, 2023
db89911
mvs controllers to stashes for 10 tests
May 3, 2023
d13643e
mvs controllers to stashes for 2 tests
May 3, 2023
79f9756
remove payout_creates_controller
May 3, 2023
b5d5426
mvs controllers to stashes for 27 tests
May 3, 2023
b2f0ae1
remove println!
May 3, 2023
9eeb647
fix rewards_should_work
May 3, 2023
93c012f
fix test_payout_stakers
May 3, 2023
efec776
fix bond benchmark
May 3, 2023
b3a1e3f
clone
May 3, 2023
ceb8637
rm unused import
May 3, 2023
24f8dd0
rm unused var
May 3, 2023
c3bf984
rm controller from create_offender
May 3, 2023
dd857e6
fix GenesisConfig stakers
May 4, 2023
6fb61f4
fix controllers in consensus pallets
May 4, 2023
17bba2c
fix unqiue controller in chain_spec
May 4, 2023
465bc13
fmt
May 4, 2023
0d5adaa
fix create_offender
May 4, 2023
7b978ea
fix set_controller benchmark
May 4, 2023
bd91aae
add TODO
May 4, 2023
d8a38ca
Merge remote-tracking branch 'origin/master' into rb-set-controller-t…
May 8, 2023
09cf1d8
Merge remote-tracking branch 'origin/master' into rb-set-controller-t…
May 9, 2023
ada3aeb
create_unique_stash_controller
May 9, 2023
d63f28f
staking benchmarks working
May 9, 2023
36fe69e
fmt
May 9, 2023
e74e8df
fix args
May 9, 2023
e5ce360
rm println
May 9, 2023
d8b0012
import
May 9, 2023
0009a84
import
May 9, 2023
177896e
fix fast unstake tests
May 9, 2023
76547e0
fix staking-tests-e2e
May 9, 2023
55cf31a
fix root-offenses
May 9, 2023
bed8298
fmt
May 9, 2023
8b7e46e
differentiate controller to stash
May 9, 2023
4772a72
bring back change_controller_works w. unique ctrl
May 9, 2023
813f460
bring back double_staking_should_fail
May 9, 2023
dbdb1a6
double_controlling_attempt_should_fail
May 9, 2023
74314f8
bring back payout_creates_controller
May 9, 2023
5243561
add commnet to controller balances
May 9, 2023
cd751a2
+ set_controller call description
May 9, 2023
7580e0d
fmt
May 9, 2023
ead11a9
rm clones
May 9, 2023
e43a676
fmt
May 9, 2023
d94fa54
clippy fixes
May 9, 2023
ba21e58
fmt
May 9, 2023
7b52879
update README
May 9, 2023
74b29aa
small fixes
May 9, 2023
63c9c14
Merge remote-tracking branch 'origin/master' into rb-set-controller-t…
May 9, 2023
106f163
Merge remote-tracking branch 'origin/master' into rb-set-controller-t…
May 10, 2023
701359c
Merge remote-tracking branch 'origin/master' into rb-set-controller-t…
May 10, 2023
6572712
use controller_to_be_deprecated
May 10, 2023
d949382
.comment
May 10, 2023
b5a765e
Merge remote-tracking branch 'origin/master' into rb-set-controller-t…
May 11, 2023
86505f0
comment
May 11, 2023
8c0ae32
Merge remote-tracking branch 'origin/master' into rb-set-controller-t…
May 11, 2023
8a3e876
bump zombienet version
pepoviola May 11, 2023
fa530a3
ci
May 11, 2023
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
2 changes: 1 addition & 1 deletion bin/node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ pub fn testnet_genesis(
let mut rng = rand::thread_rng();
let stakers = initial_authorities
.iter()
.map(|x| (x.0.clone(), x.1.clone(), STASH, StakerStatus::Validator))
.map(|x| (x.0.clone(), x.0.clone(), STASH, StakerStatus::Validator))
.chain(initial_nominators.iter().map(|x| {
use rand::{seq::SliceRandom, Rng};
let limit = (MaxNominations::get() as usize).min(initial_authorities.len());
Expand Down
6 changes: 3 additions & 3 deletions bin/node/testing/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec<AccountId>) -> Gen
},
staking: StakingConfig {
stakers: vec![
(dave(), alice(), 111 * DOLLARS, StakerStatus::Validator),
(eve(), bob(), 100 * DOLLARS, StakerStatus::Validator),
(ferdie(), charlie(), 100 * DOLLARS, StakerStatus::Validator),
(dave(), dave(), 111 * DOLLARS, StakerStatus::Validator),
(eve(), eve(), 100 * DOLLARS, StakerStatus::Validator),
(ferdie(), ferdie(), 100 * DOLLARS, StakerStatus::Validator),
],
validator_count: 3,
minimum_validator_count: 0,
Expand Down
6 changes: 2 additions & 4 deletions frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,9 @@ pub fn new_test_ext_raw_authorities(authorities: Vec<AuthorityId>) -> sp_io::Tes
.assimilate_storage(&mut t)
.unwrap();

// controllers are the index + 1000
// controllers are same as stash
let stakers: Vec<_> = (0..authorities.len())
.map(|i| {
(i as u64, i as u64 + 1000, 10_000, pallet_staking::StakerStatus::<u64>::Validator)
})
.map(|i| (i as u64, i as u64, 10_000, pallet_staking::StakerStatus::<u64>::Validator))
.collect();

let staking_config = pallet_staking::GenesisConfig::<Test> {
Expand Down
6 changes: 2 additions & 4 deletions frame/beefy/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,9 @@ pub fn new_test_ext_raw_authorities(authorities: Vec<BeefyId>) -> TestExternalit
.assimilate_storage(&mut t)
.unwrap();

// controllers are the index + 1000
// controllers are same as stash
let stakers: Vec<_> = (0..authorities.len())
.map(|i| {
(i as u64, i as u64 + 1000, 10_000, pallet_staking::StakerStatus::<u64>::Validator)
})
.map(|i| (i as u64, i as u64, 10_000, pallet_staking::StakerStatus::<u64>::Validator))
.collect();

let staking_config = pallet_staking::GenesisConfig::<Test> {
Expand Down
26 changes: 13 additions & 13 deletions frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,19 @@ impl Default for StakingExtBuilder {
let stakers = vec![
// (stash, ctrl, stake, status)
// these two will be elected in the default test where we elect 2.
(11, 10, 1000, StakerStatus::<AccountId>::Validator),
(21, 20, 1000, StakerStatus::<AccountId>::Validator),
// loser validatos if validator_count() is default.
(31, 30, 500, StakerStatus::<AccountId>::Validator),
(41, 40, 500, StakerStatus::<AccountId>::Validator),
(51, 50, 500, StakerStatus::<AccountId>::Validator),
(61, 60, 500, StakerStatus::<AccountId>::Validator),
(71, 70, 500, StakerStatus::<AccountId>::Validator),
(81, 80, 500, StakerStatus::<AccountId>::Validator),
(91, 90, 500, StakerStatus::<AccountId>::Validator),
(101, 100, 500, StakerStatus::<AccountId>::Validator),
(11, 11, 1000, StakerStatus::<AccountId>::Validator),
(21, 21, 1000, StakerStatus::<AccountId>::Validator),
// loser validators if validator_count() is default.
(31, 31, 500, StakerStatus::<AccountId>::Validator),
(41, 41, 1500, StakerStatus::<AccountId>::Validator),
(51, 51, 1500, StakerStatus::<AccountId>::Validator),
(61, 61, 1500, StakerStatus::<AccountId>::Validator),
(71, 71, 1500, StakerStatus::<AccountId>::Validator),
(81, 81, 1500, StakerStatus::<AccountId>::Validator),
(91, 91, 1500, StakerStatus::<AccountId>::Validator),
(101, 101, 500, StakerStatus::<AccountId>::Validator),
// an idle validator
(201, 200, 1000, StakerStatus::<AccountId>::Idle),
(201, 201, 1000, StakerStatus::<AccountId>::Idle),
];

Self {
Expand Down Expand Up @@ -439,7 +439,7 @@ impl Default for BalancesExtBuilder {
(2, 20),
(3, 300),
(4, 400),
// controllers
// controllers (still used in some tests. Soon to be deprecated).
(10, 100),
(20, 100),
(30, 100),
Expand Down
17 changes: 5 additions & 12 deletions frame/fast-unstake/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ impl Default for ExtBuilder {
fn default() -> Self {
Self {
unexposed: vec![
(1, 2, 7 + 100),
(3, 4, 7 + 100),
(5, 6, 7 + 100),
(7, 8, 7 + 100),
(9, 10, 7 + 100),
(1, 1, 7 + 100),
(3, 3, 7 + 100),
(5, 5, 7 + 100),
(7, 7, 7 + 100),
(9, 9, 7 + 100),
],
}
}
Expand Down Expand Up @@ -290,12 +290,6 @@ impl ExtBuilder {
.clone()
.into_iter()
.map(|(stash, _, balance)| (stash, balance * 2))
.chain(
self.unexposed
.clone()
.into_iter()
.map(|(_, ctrl, balance)| (ctrl, balance * 2)),
)
.chain(validators_range.clone().map(|x| (x, 7 + 100)))
.chain(nominators_range.clone().map(|x| (x, 7 + 100)))
.collect::<Vec<_>>(),
Expand Down Expand Up @@ -377,7 +371,6 @@ pub fn create_exposed_nominator(exposed: AccountId, era: u32) {
Balances::make_free_balance_be(&exposed, 100);
assert_ok!(Staking::bond(
RuntimeOrigin::signed(exposed),
exposed,
10,
pallet_staking::RewardDestination::Staked
));
Expand Down
Loading