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

Commit

Permalink
still unsure what to do with un-decodables
Browse files Browse the repository at this point in the history
  • Loading branch information
ruseinov committed Jan 13, 2023
1 parent 387b7b4 commit 9e561e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions frame/staking/src/pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,8 @@ pub mod pallet {
//
// Otherwise, if caller is the same as the controller, this is just like `chill`.

// TODO: This no longer works, we need nominations to be decodable, because we pass
// nominations to EventHandler for processing.
if Nominators::<T>::contains_key(&stash) && Nominators::<T>::get(&stash).is_none() {
Self::chill_stash(&stash);
return Ok(())
Expand Down
7 changes: 3 additions & 4 deletions frame/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5054,8 +5054,8 @@ fn min_commission_works() {

#[test]
#[ignore]
// TODO: This test should go away as we've decided that we don't cater for max_nominations decrease.
// If this ever happens it should be accompanied by a migration that fixes the storage.
// TODO: We can't chill un-decodable nominators as we need to take into account every validator they
// were backing.
fn change_of_max_nominations() {
use frame_election_provider_support::ElectionDataProvider;
ExtBuilder::default()
Expand Down Expand Up @@ -5143,8 +5143,7 @@ fn change_of_max_nominations() {
// or they can be chilled by any account.
assert!(Nominators::<Test>::contains_key(101));
assert!(Nominators::<Test>::get(101).is_none());
// TODO: This test now fails, because we don't want to be checking for un-decodables
// anymore as previously discussed. Shall we remove it?

assert_ok!(Staking::chill_other(RuntimeOrigin::signed(70), 100));
assert!(!Nominators::<Test>::contains_key(101));
assert!(Nominators::<Test>::get(101).is_none());
Expand Down

0 comments on commit 9e561e9

Please sign in to comment.