From 4bb487985a4ba3f2d78fb4db3f106e0d519099f9 Mon Sep 17 00:00:00 2001 From: Shaun W Date: Thu, 22 Jul 2021 21:19:58 +1200 Subject: [PATCH] Migrate slots pallet to pallet attribute macro. (#3218) Co-authored-by: Shawn Tabrizi --- .../runtime/common/src/integration_tests.rs | 1 - polkadot/runtime/common/src/slots.rs | 453 +++++++++++------- 2 files changed, 269 insertions(+), 185 deletions(-) diff --git a/polkadot/runtime/common/src/integration_tests.rs b/polkadot/runtime/common/src/integration_tests.rs index f0cf951396..ba7a497bb1 100644 --- a/polkadot/runtime/common/src/integration_tests.rs +++ b/polkadot/runtime/common/src/integration_tests.rs @@ -28,7 +28,6 @@ use sp_keystore::{KeystoreExt, testing::KeyStore}; use primitives::v1::{BlockNumber, Header, Id as ParaId, ValidationCode, HeadData, LOWEST_PUBLIC_ID}; use frame_support::{ parameter_types, assert_ok, assert_noop, PalletId, - storage::StorageMap, traits::{Currency, OnInitialize, OnFinalize, KeyOwnerProofSystem}, }; use frame_system::EnsureRoot; diff --git a/polkadot/runtime/common/src/slots.rs b/polkadot/runtime/common/src/slots.rs index 2fb0c47be2..96909b75d7 100644 --- a/polkadot/runtime/common/src/slots.rs +++ b/polkadot/runtime/common/src/slots.rs @@ -21,17 +21,20 @@ //! This doesn't handle the mechanics of determining which para ID actually ends up with a parachain lease. This //! must handled by a separately, through the trait interface that this pallet provides or the root dispatchables. -use sp_std::prelude::*; -use sp_runtime::traits::{CheckedSub, Zero, CheckedConversion, Saturating}; +use crate::traits::{LeaseError, Leaser, Registrar}; use frame_support::{ - decl_module, decl_storage, decl_event, decl_error, dispatch::DispatchResult, - traits::{Currency, ReservableCurrency, Get}, weights::Weight, + pallet_prelude::*, + traits::{Currency, ReservableCurrency}, + weights::Weight, }; +use frame_system::pallet_prelude::*; +pub use pallet::*; use primitives::v1::Id as ParaId; -use frame_system::{ensure_signed, ensure_root}; -use crate::traits::{Leaser, LeaseError, Registrar}; +use sp_runtime::traits::{CheckedConversion, CheckedSub, Saturating, Zero}; +use sp_std::prelude::*; -type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; +type BalanceOf = + <::Currency as Currency<::AccountId>>::Balance; type LeasePeriodOf = ::BlockNumber; pub trait WeightInfo { @@ -43,87 +46,102 @@ pub trait WeightInfo { pub struct TestWeightInfo; impl WeightInfo for TestWeightInfo { - fn force_lease() -> Weight { 0 } - fn manage_lease_period_start(_c: u32, _t:u32) -> Weight { 0 } - fn clear_all_leases() -> Weight { 0 } - fn trigger_onboard() -> Weight { 0 } -} - -/// The module's configuration trait. -pub trait Config: frame_system::Config { - /// The overarching event type. - type Event: From> + Into<::Event>; - - /// The currency type used for bidding. - type Currency: ReservableCurrency; - - /// The parachain registrar type. - type Registrar: Registrar; - - /// The number of blocks over which a single period lasts. - type LeasePeriod: Get; - - /// Weight Information for the Extrinsics in the Pallet - type WeightInfo: WeightInfo; -} - -// This module's storage items. -decl_storage! { - trait Store for Module as Slots { - /// Amounts held on deposit for each (possibly future) leased parachain. - /// - /// The actual amount locked on its behalf by any account at any time is the maximum of the second values - /// of the items in this list whose first value is the account. - /// - /// The first item in the list is the amount locked for the current Lease Period. Following - /// items are for the subsequent lease periods. - /// - /// The default value (an empty list) implies that the parachain no longer exists (or never - /// existed) as far as this module is concerned. - /// - /// If a parachain doesn't exist *yet* but is scheduled to exist in the future, then it - /// will be left-padded with one or more `None`s to denote the fact that nothing is held on - /// deposit for the non-existent chain currently, but is held at some point in the future. - /// - /// It is illegal for a `None` value to trail in the list. - pub Leases get(fn lease): map hasher(twox_64_concat) ParaId => Vec)>>; + fn force_lease() -> Weight { + 0 + } + fn manage_lease_period_start(_c: u32, _t: u32) -> Weight { + 0 + } + fn clear_all_leases() -> Weight { + 0 + } + fn trigger_onboard() -> Weight { + 0 } } -decl_event!( - pub enum Event where - AccountId = ::AccountId, - LeasePeriod = LeasePeriodOf, - ParaId = ParaId, - Balance = BalanceOf, - { +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config { + /// The overarching event type. + type Event: From> + IsType<::Event>; + + /// The currency type used for bidding. + type Currency: ReservableCurrency; + + /// The parachain registrar type. + type Registrar: Registrar; + + /// The number of blocks over which a single period lasts. + #[pallet::constant] + type LeasePeriod: Get; + + /// Weight Information for the Extrinsics in the Pallet + type WeightInfo: WeightInfo; + } + + /// Amounts held on deposit for each (possibly future) leased parachain. + /// + /// The actual amount locked on its behalf by any account at any time is the maximum of the second values + /// of the items in this list whose first value is the account. + /// + /// The first item in the list is the amount locked for the current Lease Period. Following + /// items are for the subsequent lease periods. + /// + /// The default value (an empty list) implies that the parachain no longer exists (or never + /// existed) as far as this pallet is concerned. + /// + /// If a parachain doesn't exist *yet* but is scheduled to exist in the future, then it + /// will be left-padded with one or more `None`s to denote the fact that nothing is held on + /// deposit for the non-existent chain currently, but is held at some point in the future. + /// + /// It is illegal for a `None` value to trail in the list. + #[pallet::storage] + #[pallet::getter(fn lease)] + pub type Leases = + StorageMap<_, Twox64Concat, ParaId, Vec)>>, ValueQuery>; + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + #[pallet::metadata( + T::AccountId = "AccountId", + LeasePeriodOf = "LeasePeriod", + BalanceOf = "Balance", + )] + pub enum Event { /// A new `[lease_period]` is beginning. - NewLeasePeriod(LeasePeriod), + NewLeasePeriod(LeasePeriodOf), /// A para has won the right to a continuous set of lease periods as a parachain. /// First balance is any extra amount reserved on top of the para's existing deposit. /// Second balance is the total amount reserved. /// `[parachain_id, leaser, period_begin, period_count, extra_reserved, total_amount]` - Leased(ParaId, AccountId, LeasePeriod, LeasePeriod, Balance, Balance), + Leased( + ParaId, + T::AccountId, + LeasePeriodOf, + LeasePeriodOf, + BalanceOf, + BalanceOf, + ), } -); -decl_error! { - pub enum Error for Module { + #[pallet::error] + pub enum Error { /// The parachain ID is not onboarding. ParaNotOnboarding, /// There was an error with the lease. LeaseError, } -} - -decl_module! { - pub struct Module for enum Call where origin: T::Origin { - type Error = Error; - - const LeasePeriod: T::BlockNumber = T::LeasePeriod::get(); - - fn deposit_event() = default; + #[pallet::hooks] + impl Hooks> for Pallet { fn on_initialize(n: T::BlockNumber) -> Weight { // If we're beginning a new lease period then handle that. let lease_period = T::LeasePeriod::get(); @@ -134,13 +152,17 @@ decl_module! { 0 } } + } - /// Just a connect to the `lease_out` call, in case Root wants to force some lease to happen + #[pallet::call] + impl Pallet { + /// Just a connect into the `lease_out` call, in case Root wants to force some lease to happen /// independently of any other on-chain mechanism to use it. /// /// Can only be called by the Root origin. - #[weight = T::WeightInfo::force_lease()] - pub fn force_lease(origin, + #[pallet::weight(T::WeightInfo::force_lease())] + pub fn force_lease( + origin: OriginFor, para: ParaId, leaser: T::AccountId, amount: BalanceOf, @@ -156,8 +178,8 @@ decl_module! { /// Clear all leases for a Para Id, refunding any deposits back to the original owners. /// /// Can only be called by the Root origin. - #[weight = T::WeightInfo::clear_all_leases()] - pub fn clear_all_leases(origin, para: ParaId) -> DispatchResult { + #[pallet::weight(T::WeightInfo::clear_all_leases())] + pub fn clear_all_leases(origin: OriginFor, para: ParaId) -> DispatchResult { ensure_root(origin)?; let deposits = Self::all_deposits_held(para); @@ -178,16 +200,14 @@ decl_module! { /// let them onboard from here. /// /// Origin must be signed, but can be called by anyone. - #[weight = T::WeightInfo::trigger_onboard()] - pub fn trigger_onboard(origin, para: ParaId) -> DispatchResult { + #[pallet::weight(T::WeightInfo::trigger_onboard())] + pub fn trigger_onboard(origin: OriginFor, para: ParaId) -> DispatchResult { let _ = ensure_signed(origin)?; let leases = Leases::::get(para); match leases.first() { // If the first element in leases is present, then it has a lease! // We can try to onboard it. - Some(Some(_lease_info)) => { - T::Registrar::make_parachain(para)? - }, + Some(Some(_lease_info)) => T::Registrar::make_parachain(para)?, // Otherwise, it does not have a lease. Some(None) | None => { return Err(Error::::ParaNotOnboarding.into()); @@ -198,20 +218,22 @@ decl_module! { } } -impl Module { +impl Pallet { /// A new lease period is beginning. We're at the start of the first block of it. /// /// We need to on-board and off-board parachains as needed. We should also handle reducing/ /// returning deposits. fn manage_lease_period_start(lease_period_index: LeasePeriodOf) -> Weight { - Self::deposit_event(RawEvent::NewLeasePeriod(lease_period_index)); + Self::deposit_event(Event::::NewLeasePeriod(lease_period_index)); let old_parachains = T::Registrar::parachains(); // Figure out what chains need bringing on. let mut parachains = Vec::new(); for (para, mut lease_periods) in Leases::::iter() { - if lease_periods.is_empty() { continue } + if lease_periods.is_empty() { + continue; + } // ^^ should never be empty since we would have deleted the entry otherwise. if lease_periods.len() == 1 { @@ -283,41 +305,31 @@ impl Module { // you all the balances you need to unreserve. fn all_deposits_held(para: ParaId) -> Vec<(T::AccountId, BalanceOf)> { let mut tracker = sp_std::collections::btree_map::BTreeMap::new(); - Leases::::get(para) - .into_iter() - .for_each(|lease| { - match lease { - Some((who, amount)) => { - match tracker.get(&who) { - Some(prev_amount) => { - if amount > *prev_amount { - tracker.insert(who, amount); - } - }, - None => { - tracker.insert(who, amount); - } - } - }, - None => {}, + Leases::::get(para).into_iter().for_each(|lease| match lease { + Some((who, amount)) => match tracker.get(&who) { + Some(prev_amount) => { + if amount > *prev_amount { + tracker.insert(who, amount); + } } - }); + None => { + tracker.insert(who, amount); + } + }, + None => {} + }); tracker.into_iter().collect() } } -impl crate::traits::OnSwap for Module { +impl crate::traits::OnSwap for Pallet { fn on_swap(one: ParaId, other: ParaId) { - Leases::::mutate(one, |x| - Leases::::mutate(other, |y| - sp_std::mem::swap(x, y) - ) - ) + Leases::::mutate(one, |x| Leases::::mutate(other, |y| sp_std::mem::swap(x, y))) } } -impl Leaser for Module { +impl Leaser for Pallet { type AccountId = T::AccountId; type LeasePeriod = T::BlockNumber; type Currency = T::Currency; @@ -347,12 +359,12 @@ impl Leaser for Module { Leases::::try_mutate(para, |d| { // Left-pad with `None`s as necessary. if d.len() < offset { - d.resize_with(offset, || { None }); + d.resize_with(offset, || None); } - let period_count_usize = period_count.checked_into::() - .ok_or(LeaseError::AlreadyEnded)?; + let period_count_usize = + period_count.checked_into::().ok_or(LeaseError::AlreadyEnded)?; // Then place the deposit values for as long as the chain should exist. - for i in offset .. (offset + period_count_usize) { + for i in offset..(offset + period_count_usize) { if d.len() > i { // Already exists but it's `None`. That means a later slot was already leased. // No problem. @@ -391,24 +403,34 @@ impl Leaser for Module { let _ = T::Registrar::make_parachain(para); } - Self::deposit_event( - RawEvent::Leased(para, leaser.clone(), period_begin, period_count, reserved, amount) - ); + Self::deposit_event(Event::::Leased( + para, + leaser.clone(), + period_begin, + period_count, + reserved, + amount, + )); Ok(()) }) } - fn deposit_held(para: ParaId, leaser: &Self::AccountId) -> >::Balance { + fn deposit_held( + para: ParaId, + leaser: &Self::AccountId, + ) -> >::Balance { Leases::::get(para) .into_iter() - .map(|lease| { - match lease { - Some((who, amount)) => { - if &who == leaser { amount } else { Zero::zero() } - }, - None => Zero::zero(), + .map(|lease| match lease { + Some((who, amount)) => { + if &who == leaser { + amount + } else { + Zero::zero() + } } + None => Zero::zero(), }) .max() .unwrap_or_else(Zero::zero) @@ -446,10 +468,10 @@ impl Leaser for Module { // Get the leases, and check each item in the vec which is part of the range we are checking. let leases = Leases::::get(para_id); - for slot in offset ..= offset + period_count { + for slot in offset..=offset + period_count { if let Some(Some(_)) = leases.get(slot) { // If there exists any lease period, we exit early and return true. - return true + return true; } } @@ -458,21 +480,17 @@ impl Leaser for Module { } } - -/// tests for this module +/// tests for this pallet #[cfg(test)] mod tests { use super::*; - use sp_core::H256; - use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; - use frame_support::{ - parameter_types, assert_ok, assert_noop, - traits::{OnInitialize, OnFinalize} - }; + use crate::{mock::TestRegistrar, slots}; + use frame_support::{assert_noop, assert_ok, parameter_types}; use pallet_balances; use primitives::v1::{BlockNumber, Header}; - use crate::{slots, mock::TestRegistrar}; + use sp_core::H256; + use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; @@ -553,7 +571,9 @@ mod tests { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], - }.assimilate_storage(&mut t).unwrap(); + } + .assimilate_storage(&mut t) + .unwrap(); t.into() } @@ -587,7 +607,12 @@ mod tests { new_test_ext().execute_with(|| { run_to_block(1); - assert_ok!(TestRegistrar::::register(1, ParaId::from(1), Default::default(), Default::default())); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(1), + Default::default(), + Default::default() + )); assert_ok!(Slots::lease_out(1.into(), &1, 1, 1, 1)); assert_eq!(Slots::deposit_held(1.into(), &1), 1); @@ -601,10 +626,10 @@ mod tests { assert_eq!(Slots::deposit_held(1.into(), &1), 0); assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(TestRegistrar::::operations(), vec![ - (1.into(), 10, true), - (1.into(), 20, false), - ]); + assert_eq!( + TestRegistrar::::operations(), + vec![(1.into(), 10, true), (1.into(), 20, false),] + ); }); } @@ -613,7 +638,12 @@ mod tests { new_test_ext().execute_with(|| { run_to_block(1); - assert_ok!(TestRegistrar::::register(1, ParaId::from(1), Default::default(), Default::default())); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(1), + Default::default(), + Default::default() + )); assert_ok!(Slots::lease_out(1.into(), &1, 6, 1, 1)); assert_ok!(Slots::lease_out(1.into(), &1, 4, 3, 1)); @@ -634,12 +664,15 @@ mod tests { assert_eq!(Slots::deposit_held(1.into(), &1), 0); assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(TestRegistrar::::operations(), vec![ - (1.into(), 10, true), - (1.into(), 20, false), - (1.into(), 30, true), - (1.into(), 40, false), - ]); + assert_eq!( + TestRegistrar::::operations(), + vec![ + (1.into(), 10, true), + (1.into(), 20, false), + (1.into(), 30, true), + (1.into(), 40, false), + ] + ); }); } @@ -648,7 +681,12 @@ mod tests { new_test_ext().execute_with(|| { run_to_block(1); - assert_ok!(TestRegistrar::::register(1, ParaId::from(1), Default::default(), Default::default())); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(1), + Default::default(), + Default::default() + )); assert!(Slots::lease_out(1.into(), &1, 6, 1, 1).is_ok()); assert!(Slots::lease_out(1.into(), &2, 4, 2, 1).is_ok()); @@ -681,10 +719,10 @@ mod tests { assert_eq!(Slots::deposit_held(1.into(), &2), 0); assert_eq!(Balances::reserved_balance(2), 0); - assert_eq!(TestRegistrar::::operations(), vec![ - (1.into(), 10, true), - (1.into(), 30, false), - ]); + assert_eq!( + TestRegistrar::::operations(), + vec![(1.into(), 10, true), (1.into(), 30, false),] + ); }); } @@ -693,7 +731,12 @@ mod tests { new_test_ext().execute_with(|| { run_to_block(1); - assert_ok!(TestRegistrar::::register(1, ParaId::from(1), Default::default(), Default::default())); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(1), + Default::default(), + Default::default() + )); assert!(Slots::lease_out(1.into(), &1, 4, 1, 1).is_ok()); assert_eq!(Slots::deposit_held(1.into(), &1), 4); @@ -711,10 +754,10 @@ mod tests { assert_eq!(Slots::deposit_held(1.into(), &1), 0); assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(TestRegistrar::::operations(), vec![ - (1.into(), 10, true), - (1.into(), 30, false), - ]); + assert_eq!( + TestRegistrar::::operations(), + vec![(1.into(), 10, true), (1.into(), 30, false),] + ); }); } @@ -723,7 +766,12 @@ mod tests { new_test_ext().execute_with(|| { run_to_block(1); - assert_ok!(TestRegistrar::::register(1, ParaId::from(1), Default::default(), Default::default())); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(1), + Default::default(), + Default::default() + )); assert!(Slots::lease_out(1.into(), &1, 6, 1, 1).is_ok()); assert_eq!(Slots::deposit_held(1.into(), &1), 6); @@ -749,10 +797,10 @@ mod tests { assert_eq!(Slots::deposit_held(1.into(), &1), 0); assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(TestRegistrar::::operations(), vec![ - (1.into(), 10, true), - (1.into(), 30, false), - ]); + assert_eq!( + TestRegistrar::::operations(), + vec![(1.into(), 10, true), (1.into(), 30, false),] + ); }); } @@ -761,12 +809,17 @@ mod tests { new_test_ext().execute_with(|| { run_to_block(1); - assert_ok!(TestRegistrar::::register(1, ParaId::from(1), Default::default(), Default::default())); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(1), + Default::default(), + Default::default() + )); let max_num = 5u32; // max_num different people are reserved for leases to Para ID 1 - for i in 1u32 ..= max_num { + for i in 1u32..=max_num { let j: u64 = i.into(); assert_ok!(Slots::lease_out(1.into(), &j, j * 10, i * i, i)); assert_eq!(Slots::deposit_held(1.into(), &j), j * 10); @@ -776,7 +829,7 @@ mod tests { assert_ok!(Slots::clear_all_leases(Origin::root(), 1.into())); // Balances cleaned up correctly - for i in 1u32 ..= max_num { + for i in 1u32..=max_num { let j: u64 = i.into(); assert_eq!(Slots::deposit_held(1.into(), &j), 0); assert_eq!(Balances::reserved_balance(j), 0); @@ -792,8 +845,18 @@ mod tests { new_test_ext().execute_with(|| { run_to_block(1); - assert_ok!(TestRegistrar::::register(1, ParaId::from(1), Default::default(), Default::default())); - assert_ok!(TestRegistrar::::register(1, ParaId::from(2), Default::default(), Default::default())); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(1), + Default::default(), + Default::default() + )); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(2), + Default::default(), + Default::default() + )); run_to_block(20); assert_eq!(Slots::lease_period_index(), 2); @@ -804,9 +867,7 @@ mod tests { // Lease in the future doesn't assert_ok!(Slots::lease_out(2.into(), &1, 1, 3, 1)); - assert_eq!(TestRegistrar::::operations(), vec![ - (1.into(), 20, true), - ]); + assert_eq!(TestRegistrar::::operations(), vec![(1.into(), 20, true),]); }); } @@ -814,9 +875,24 @@ mod tests { fn trigger_onboard_works() { new_test_ext().execute_with(|| { run_to_block(1); - assert_ok!(TestRegistrar::::register(1, ParaId::from(1), Default::default(), Default::default())); - assert_ok!(TestRegistrar::::register(1, ParaId::from(2), Default::default(), Default::default())); - assert_ok!(TestRegistrar::::register(1, ParaId::from(3), Default::default(), Default::default())); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(1), + Default::default(), + Default::default() + )); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(2), + Default::default(), + Default::default() + )); + assert_ok!(TestRegistrar::::register( + 1, + ParaId::from(3), + Default::default(), + Default::default() + )); // We will directly manipulate leases to emulate some kind of failure in the system. // Para 1 will have no leases @@ -826,20 +902,24 @@ mod tests { Leases::::insert(ParaId::from(3), vec![None, None, Some((0, 0))]); // Para 1 should fail cause they don't have any leases - assert_noop!(Slots::trigger_onboard(Origin::signed(1), 1.into()), Error::::ParaNotOnboarding); + assert_noop!( + Slots::trigger_onboard(Origin::signed(1), 1.into()), + Error::::ParaNotOnboarding + ); // Para 2 should succeed assert_ok!(Slots::trigger_onboard(Origin::signed(1), 2.into())); // Para 3 should fail cause their lease is in the future - assert_noop!(Slots::trigger_onboard(Origin::signed(1), 3.into()), Error::::ParaNotOnboarding); + assert_noop!( + Slots::trigger_onboard(Origin::signed(1), 3.into()), + Error::::ParaNotOnboarding + ); // Trying Para 2 again should fail cause they are not currently a parathread assert!(Slots::trigger_onboard(Origin::signed(1), 2.into()).is_err()); - assert_eq!(TestRegistrar::::operations(), vec![ - (2.into(), 1, true), - ]); + assert_eq!(TestRegistrar::::operations(), vec![(2.into(), 1, true),]); }); } } @@ -847,13 +927,13 @@ mod tests { #[cfg(feature = "runtime-benchmarks")] mod benchmarking { use super::*; - use frame_system::RawOrigin; use frame_support::assert_ok; + use frame_system::RawOrigin; use sp_runtime::traits::Bounded; - use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark_test_suite}; + use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller}; - use crate::slots::Module as Slots; + use crate::slots::Pallet as Slots; fn assert_last_event(generic_event: ::Event) { let events = frame_system::Pallet::::events(); @@ -870,7 +950,12 @@ mod benchmarking { let worst_head_data = T::Registrar::worst_head_data(); let worst_validation_code = T::Registrar::worst_validation_code(); - assert_ok!(T::Registrar::register(leaser.clone(), para, worst_head_data, worst_validation_code)); + assert_ok!(T::Registrar::register( + leaser.clone(), + para, + worst_head_data, + worst_validation_code + )); T::Registrar::execute_pending_transitions(); (para, leaser) @@ -886,7 +971,7 @@ mod benchmarking { let period_count = 3u32.into(); }: _(RawOrigin::Root, para, leaser.clone(), amount, period_begin, period_count) verify { - assert_last_event::(RawEvent::Leased(para, leaser, period_begin, period_count, amount, amount).into()); + assert_last_event::(Event::::Leased(para, leaser, period_begin, period_count, amount, amount).into()); } // Worst case scenario, T parathreads onboard, and C parachains offboard.