mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 00:17:56 +00:00
Properly defer slashes (#11823)
* initial draft of fixing slashing * fix test * Update frame/staking/src/tests.rs Co-authored-by: Piotr Mikołajczyk <piomiko41@gmail.com> * last touches * add more detail about unbonding * add migration * fmt Co-authored-by: Piotr Mikołajczyk <piomiko41@gmail.com> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -549,6 +549,7 @@ impl ExtBuilder {
|
||||
ext
|
||||
}
|
||||
pub fn build_and_execute(self, test: impl FnOnce() -> ()) {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut ext = self.build();
|
||||
ext.execute_with(test);
|
||||
ext.execute_with(post_conditions);
|
||||
@@ -884,6 +885,20 @@ pub(crate) fn staking_events() -> Vec<crate::Event<Test>> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
static StakingEventsIndex: usize = 0;
|
||||
}
|
||||
|
||||
pub(crate) fn staking_events_since_last_call() -> Vec<crate::Event<Test>> {
|
||||
let all: Vec<_> = System::events()
|
||||
.into_iter()
|
||||
.filter_map(|r| if let Event::Staking(inner) = r.event { Some(inner) } else { None })
|
||||
.collect();
|
||||
let seen = StakingEventsIndex::get();
|
||||
StakingEventsIndex::set(all.len());
|
||||
all.into_iter().skip(seen).collect()
|
||||
}
|
||||
|
||||
pub(crate) fn balances(who: &AccountId) -> (Balance, Balance) {
|
||||
(Balances::free_balance(who), Balances::reserved_balance(who))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user