diff --git a/substrate/frame/delegated-staking/src/mock.rs b/substrate/frame/delegated-staking/src/mock.rs index 7399cb7a6e9b..1dd58a084cb3 100644 --- a/substrate/frame/delegated-staking/src/mock.rs +++ b/substrate/frame/delegated-staking/src/mock.rs @@ -32,8 +32,6 @@ use frame_election_provider_support::{ }; use frame_support::dispatch::RawOrigin; use pallet_staking::CurrentEra; -use sp_core::U256; -use sp_runtime::traits::Convert; use sp_staking::{Stake, StakingInterface}; pub type T = Runtime; @@ -293,13 +291,7 @@ parameter_types! { #[allow(unused)] pub(crate) fn events_since_last_call() -> Vec> { - let events = System::events() - .into_iter() - .map(|r| r.event) - .filter_map( - |e| if let RuntimeEvent::DelegatedStaking(inner) = e { Some(inner) } else { None }, - ) - .collect::>(); + let events = System::read_events_for_pallet::>(); let already_seen = ObservedEventsDelegatedStaking::get(); ObservedEventsDelegatedStaking::set(events.len()); events.into_iter().skip(already_seen).collect() diff --git a/substrate/frame/delegated-staking/src/tests.rs b/substrate/frame/delegated-staking/src/tests.rs index 46ec3e71ed2d..1f36f655beb8 100644 --- a/substrate/frame/delegated-staking/src/tests.rs +++ b/substrate/frame/delegated-staking/src/tests.rs @@ -229,11 +229,7 @@ fn agent_restrictions() { // agent cannot delegate to self assert_noop!( - DelegatedStaking::delegate_to_agent( - RawOrigin::Signed(agent_one).into(), - agent_one, - 10 - ), + DelegatedStaking::delegate_to_agent(RawOrigin::Signed(agent_one).into(), agent_one, 10), Error::::InvalidDelegation ); });