mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 08:41:01 +00:00
[Fix] Make sure pool metadata is removed on pool dissolve (#12154)
* [Fix] Make sure pool metadata is removed on pool dissolve * add migration * remove_metadata helper removed * fix typo and add a comment * fix pre_upgrade * fix migration * Update frame/nomination-pools/src/migration.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/nomination-pools/src/migration.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * address comments * fix comments * Update frame/nomination-pools/src/migration.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * address comments * permissions fix Co-authored-by: parity-processbot <> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -47,6 +47,7 @@ fn test_setup_works() {
|
||||
assert_eq!(SubPoolsStorage::<Runtime>::count(), 0);
|
||||
assert_eq!(PoolMembers::<Runtime>::count(), 1);
|
||||
assert_eq!(StakingMock::bonding_duration(), 3);
|
||||
assert!(Metadata::<T>::contains_key(1));
|
||||
|
||||
let last_pool = LastPoolId::<Runtime>::get();
|
||||
assert_eq!(
|
||||
@@ -1928,6 +1929,7 @@ mod claim_payout {
|
||||
]
|
||||
);
|
||||
|
||||
assert!(!Metadata::<T>::contains_key(1));
|
||||
// original ed + ed put into reward account + reward + bond + dust.
|
||||
assert_eq!(Balances::free_balance(&10), 35 + 5 + 13 + 10 + 1);
|
||||
})
|
||||
@@ -3159,6 +3161,7 @@ mod withdraw_unbonded {
|
||||
Event::Destroyed { pool_id: 1 }
|
||||
]
|
||||
);
|
||||
assert!(!Metadata::<T>::contains_key(1));
|
||||
assert_eq!(
|
||||
balances_events_since_last_call(),
|
||||
vec![
|
||||
@@ -3269,6 +3272,10 @@ mod withdraw_unbonded {
|
||||
|
||||
CurrentEra::set(CurrentEra::get() + 3);
|
||||
|
||||
// set metadata to check that it's being removed on dissolve
|
||||
assert_ok!(Pools::set_metadata(Origin::signed(900), 1, vec![1, 1]));
|
||||
assert!(Metadata::<T>::contains_key(1));
|
||||
|
||||
// when
|
||||
assert_ok!(Pools::withdraw_unbonded(Origin::signed(10), 10, 0));
|
||||
|
||||
@@ -3287,6 +3294,7 @@ mod withdraw_unbonded {
|
||||
Event::Destroyed { pool_id: 1 }
|
||||
]
|
||||
);
|
||||
assert!(!Metadata::<T>::contains_key(1));
|
||||
assert_eq!(
|
||||
balances_events_since_last_call(),
|
||||
vec![
|
||||
@@ -3797,6 +3805,7 @@ mod withdraw_unbonded {
|
||||
Event::Destroyed { pool_id: 1 },
|
||||
]
|
||||
);
|
||||
assert!(!Metadata::<T>::contains_key(1));
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -4039,7 +4048,7 @@ mod set_state {
|
||||
// Then
|
||||
assert_eq!(BondedPool::<Runtime>::get(1).unwrap().state, PoolState::Destroying);
|
||||
|
||||
// If the pool is not ok to be open, it cannot be permissionleslly set to a state that
|
||||
// If the pool is not ok to be open, it cannot be permissionlessly set to a state that
|
||||
// isn't destroying
|
||||
unsafe_set_state(1, PoolState::Open);
|
||||
assert_noop!(
|
||||
|
||||
Reference in New Issue
Block a user