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

Commit

Permalink
Fixes after conflict resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
gpestana committed May 15, 2023
1 parent 96f9267 commit 7f71737
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
30 changes: 15 additions & 15 deletions frame/election-provider-multi-phase/test-staking-e2e/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,45 +232,45 @@ fn set_validation_intention_after_chilled() {
.build_and_execute(|| {
assert_eq!(active_era(), 0);
// validator is part of the validator set.
assert!(Session::validators().contains(&11));
assert!(<Runtime as pallet_staking::Config>::VoterList::contains(&11));
assert!(Session::validators().contains(&81));
assert!(<Runtime as pallet_staking::Config>::VoterList::contains(&81));

// nominate validator 11.
assert_ok!(Staking::nominate(RuntimeOrigin::signed(20), vec![11]));
assert_eq!(Nominators::<Runtime>::get(21).unwrap().targets, vec![11]);
// nominate validator 81.
assert_ok!(Staking::nominate(RuntimeOrigin::signed(21), vec![81]));
assert_eq!(Nominators::<Runtime>::get(21).unwrap().targets, vec![81]);

// validator is slashed. it is removed from the `VoterList` through chilling but in the
// current era, the validator is still part of the active validator set.
add_slash(&11);
assert!(Session::validators().contains(&11));
assert!(!<Runtime as pallet_staking::Config>::VoterList::contains(&11));
add_slash(&81);
assert!(Session::validators().contains(&81));
assert!(!<Runtime as pallet_staking::Config>::VoterList::contains(&81));
assert_eq!(
staking_events(),
[
Event::Chilled { stash: 11 },
Event::Chilled { stash: 81 },
Event::ForceEra { mode: Forcing::ForceNew },
Event::SlashReported {
validator: 11,
validator: 81,
slash_era: 0,
fraction: Perbill::from_percent(10)
}
],
);

// after the nominator is slashed and chilled, the nominations remain.
assert_eq!(Nominators::<Runtime>::get(21).unwrap().targets, vec![11]);
assert_eq!(Nominators::<Runtime>::get(21).unwrap().targets, vec![81]);

// validator sets intention to stake again in the same era it was chilled.
assert_ok!(Staking::validate(RuntimeOrigin::signed(10), Default::default()));
assert_ok!(Staking::validate(RuntimeOrigin::signed(81), Default::default()));

// progress era and check that the slashed validator is still part of the validator
// set.
assert!(start_next_active_era().is_ok());
assert_eq!(active_era(), 1);
assert!(Session::validators().contains(&11));
assert!(<Runtime as pallet_staking::Config>::VoterList::contains(&11));
assert!(Session::validators().contains(&81));
assert!(<Runtime as pallet_staking::Config>::VoterList::contains(&81));

// nominations are still active as before the slash.
assert_eq!(Nominators::<Runtime>::get(21).unwrap().targets, vec![11]);
assert_eq!(Nominators::<Runtime>::get(21).unwrap().targets, vec![81]);
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,10 @@ impl pallet_balances::Config for Runtime {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type MaxHolds = ConstU32<1>;
type MaxFreezes = ();
type MaxFreezes = traits::ConstU32<1>;
type HoldIdentifier = ();
type FreezeIdentifier = ();
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = traits::ConstU32<1>;
type MaxFreezes = traits::ConstU32<1>;
}

impl pallet_timestamp::Config for Runtime {
Expand Down

0 comments on commit 7f71737

Please sign in to comment.