Newer
Older
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
}
#[test]
fn deprecate_controller_batch_skips_unmigrated_controller_payees() {
ExtBuilder::default().build_and_execute(|| {
// Given:
let stash: u64 = 1000;
let ctlr: u64 = 1001;
Ledger::<Test>::insert(
ctlr,
StakingLedger { controller: None, ..StakingLedger::default_from(stash) },
);
Bonded::<Test>::insert(stash, ctlr);
#[allow(deprecated)]
Payee::<Test>::insert(stash, RewardDestination::Controller);
// When:
let bounded_controllers: BoundedVec<
_,
<Test as Config>::MaxControllersInDeprecationBatch,
> = BoundedVec::try_from(vec![ctlr]).unwrap();
let result =
Staking::deprecate_controller_batch(RuntimeOrigin::root(), bounded_controllers);
assert_ok!(result);
assert_eq!(
result.unwrap().actual_weight.unwrap(),
<Test as Config>::WeightInfo::deprecate_controller_batch(1 as u32)
);
// Then:
// Esure deprecation did not happen.
assert_eq!(Ledger::<Test>::get(ctlr).is_some(), true);
// Bonded still keyed by controller.
assert_eq!(Bonded::<Test>::get(stash), Some(ctlr));
// Ledger is still keyed by controller.
let ledger_updated = Ledger::<Test>::get(ctlr).unwrap();
assert_eq!(ledger_updated.stash, stash);
})
}