From 3ae3b2428827ba670917bddd35fa9a4b28a1c536 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Mar 2021 13:04:08 +0000 Subject: [PATCH 1/7] tmp add upgrade file --- frame/indices/src/upgrade.rs | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 frame/indices/src/upgrade.rs diff --git a/frame/indices/src/upgrade.rs b/frame/indices/src/upgrade.rs new file mode 100644 index 0000000000000..e69de29bb2d1d From 7fe823f309482af0f26183665bd73ce021f676f4 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Mar 2021 14:41:54 +0000 Subject: [PATCH 2/7] Migrate pallet-indices to `pallet!` --- frame/indices/src/lib.rs | 187 +++++++++++++++++++++-------------- frame/indices/src/upgrade.rs | 112 +++++++++++++++++++++ 2 files changed, 227 insertions(+), 72 deletions(-) diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index c925d3a0533e0..27b064d83e5d1 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -39,76 +39,44 @@ pub use weights::WeightInfo; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -/// The module's config trait. -pub trait Config: frame_system::Config { - /// Type used for storing an account's index; implies the maximum number of accounts the system - /// can hold. - type AccountIndex: Parameter + Member + Codec + Default + AtLeast32Bit + Copy; +pub use pallet::*; - /// The currency trait. - type Currency: ReservableCurrency; +#[frame_support::pallet] +pub mod pallet { + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + use super::*; - /// The deposit needed for reserving an index. - type Deposit: Get>; + /// The module's config trait. + #[pallet::config] + pub trait Config: frame_system::Config { + /// Type used for storing an account's index; implies the maximum number of accounts the system + /// can hold. + type AccountIndex: Parameter + Member + Codec + Default + AtLeast32Bit + Copy; - /// The overarching event type. - type Event: From> + Into<::Event>; + /// The currency trait. + type Currency: ReservableCurrency; - /// Weight information for extrinsics in this pallet. - type WeightInfo: WeightInfo; -} - -decl_storage! { - trait Store for Module as Indices { - /// The lookup from index to account. - pub Accounts build(|config: &GenesisConfig| - config.indices.iter() - .cloned() - .map(|(a, b)| (a, (b, Zero::zero(), false))) - .collect::>() - ): map hasher(blake2_128_concat) T::AccountIndex => Option<(T::AccountId, BalanceOf, bool)>; - } - add_extra_genesis { - config(indices): Vec<(T::AccountIndex, T::AccountId)>; - } -} + /// The deposit needed for reserving an index. + #[pallet::constant] + type Deposit: Get>; -decl_event!( - pub enum Event where - ::AccountId, - ::AccountIndex - { - /// A account index was assigned. \[index, who\] - IndexAssigned(AccountId, AccountIndex), - /// A account index has been freed up (unassigned). \[index\] - IndexFreed(AccountIndex), - /// A account index has been frozen to its current account ID. \[index, who\] - IndexFrozen(AccountIndex, AccountId), - } -); + /// The overarching event type. + type Event: From> + Into<::Event>; -decl_error! { - pub enum Error for Module { - /// The index was not already assigned. - NotAssigned, - /// The index is assigned to another account. - NotOwner, - /// The index was not available. - InUse, - /// The source and destination accounts are identical. - NotTransfer, - /// The index is permanent and may not be freed/changed. - Permanent, + /// Weight information for extrinsics in this pallet. + type WeightInfo: WeightInfo; } -} -decl_module! { - pub struct Module for enum Call where origin: T::Origin, system = frame_system { - /// The deposit needed for reserving an index. - const Deposit: BalanceOf = T::Deposit::get(); + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(PhantomData); - fn deposit_event() = default; + #[pallet::hooks] + impl Hooks> for Pallet {} + #[pallet::call] + impl Pallet { /// Assign an previously unassigned index. /// /// Payment: `Deposit` is reserved from the sender account. @@ -127,8 +95,8 @@ decl_module! { /// ------------------- /// - DB Weight: 1 Read/Write (Accounts) /// # - #[weight = T::WeightInfo::claim()] - fn claim(origin, index: T::AccountIndex) { + #[weight(T::WeightInfo::claim())] + fn claim(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| { @@ -137,6 +105,7 @@ decl_module! { T::Currency::reserve(&who, T::Deposit::get()) })?; Self::deposit_event(RawEvent::IndexAssigned(who, index)); + Ok(()) } /// Assign an index already owned by the sender to another account. The balance reservation @@ -159,8 +128,12 @@ decl_module! { /// - Reads: Indices Accounts, System Account (recipient) /// - Writes: Indices Accounts, System Account (recipient) /// # - #[weight = T::WeightInfo::transfer()] - fn transfer(origin, new: T::AccountId, index: T::AccountIndex) { + #[weight(T::WeightInfo::transfer())] + fn transfer( + origin: OriginFor, + new: T::AccountId, + index: T::AccountIndex, + ) -> DispatchResult { let who = ensure_signed(origin)?; ensure!(who != new, Error::::NotTransfer); @@ -173,6 +146,7 @@ decl_module! { Ok(()) })?; Self::deposit_event(RawEvent::IndexAssigned(new, index)); + Ok(()) } /// Free up an index owned by the sender. @@ -193,8 +167,8 @@ decl_module! { /// ------------------- /// - DB Weight: 1 Read/Write (Accounts) /// # - #[weight = T::WeightInfo::free()] - fn free(origin, index: T::AccountIndex) { + #[weight(T::WeightInfo::free())] + fn free(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { @@ -205,6 +179,7 @@ decl_module! { Ok(()) })?; Self::deposit_event(RawEvent::IndexFreed(index)); + Ok(()) } /// Force an index to an account. This doesn't require a deposit. If the index is already @@ -228,8 +203,13 @@ decl_module! { /// - Reads: Indices Accounts, System Account (original owner) /// - Writes: Indices Accounts, System Account (original owner) /// # - #[weight = T::WeightInfo::force_transfer()] - fn force_transfer(origin, new: T::AccountId, index: T::AccountIndex, freeze: bool) { + #[weight(T::WeightInfo::force_transfer())] + fn force_transfer( + origin: OriginFor, + new: T::AccountId, + index: T::AccountIndex, + freeze: bool, + ) -> DispatchResult { ensure_root(origin)?; Accounts::::mutate(index, |maybe_value| { @@ -239,6 +219,7 @@ decl_module! { *maybe_value = Some((new.clone(), Zero::zero(), freeze)); }); Self::deposit_event(RawEvent::IndexAssigned(new, index)); + Ok(()) } /// Freeze an index so it will always point to the sender account. This consumes the deposit. @@ -258,8 +239,8 @@ decl_module! { /// ------------------- /// - DB Weight: 1 Read/Write (Accounts) /// # - #[weight = T::WeightInfo::freeze()] - fn freeze(origin, index: T::AccountIndex) { + #[weight(T::WeightInfo::freeze())] + fn freeze(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { @@ -271,11 +252,73 @@ decl_module! { Ok(()) })?; Self::deposit_event(RawEvent::IndexFrozen(index, who)); + Ok(()) + } + } + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + #[pallet::metadata(T::AccountId = "AccountId", T::AccountIndex = "AccountIndex")] + pub enum Event { + /// A account index was assigned. \[index, who\] + IndexAssigned(T::AccountId, T::AccountIndex), + /// A account index has been freed up (unassigned). \[index\] + IndexFreed(T::AccountIndex), + /// A account index has been frozen to its current account ID. \[index, who\] + IndexFrozen(T::AccountIndex, T::AccountId), + } + + /// Old name generated by `decl_event`. + #[deprecated(note="use `Event` instead")] + pub type RawEvent = Event; + + #[pallet::error] + pub enum Error { + /// The index was not already assigned. + NotAssigned, + /// The index is assigned to another account. + NotOwner, + /// The index was not available. + InUse, + /// The source and destination accounts are identical. + NotTransfer, + /// The index is permanent and may not be freed/changed. + Permanent, + } + + /// The lookup from index to account. + #[pallet::storage] + pub type Accounts = StorageMap< + _, Blake2_128Concat, + T::AccountIndex, + (T::AccountId, BalanceOf, bool) + >; + + #[pallet::genesis_config] + pub struct GenesisConfig { + pub indices: Vec<(T::AccountIndex, T::AccountId)>, + } + + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + Self { + indices: Default::default(), + } + } + } + + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + for (a, b) in &self.indices { + >::insert(a, (b, Zero::zero(), false)) + } } } } -impl Module { +impl Pallet { // PUBLIC IMMUTABLES /// Lookup an T::AccountIndex to get an Id, if there's one there. @@ -295,7 +338,7 @@ impl Module { } } -impl StaticLookup for Module { +impl StaticLookup for Pallet { type Source = MultiAddress; type Target = T::AccountId; diff --git a/frame/indices/src/upgrade.rs b/frame/indices/src/upgrade.rs index e69de29bb2d1d..f13d4e4063010 100644 --- a/frame/indices/src/upgrade.rs +++ b/frame/indices/src/upgrade.rs @@ -0,0 +1,112 @@ + +// Template for pallet upgrade for Indices + +pub use pallet::*; + +#[frame_support::pallet] +pub mod pallet { + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config + // TODO_MAYBE_ADDITIONAL_BOUNDS_AND_WHERE_CLAUSE + { + // TODO_ASSOCIATED_TYPE_AND_CONSTANTS + } + + + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(PhantomData); + + #[pallet::hooks] + impl Hooks> for Pallet + // TODO_MAYBE_WHERE_CLAUSE + { + // TODO_ON_FINALIZE + // TODO_ON_INITIALIZE + // TODO_ON_RUNTIME_UPGRADE + // TODO_INTEGRITY_TEST + // TODO_OFFCHAIN_WORKER + } + + #[pallet::call] + impl Pallet + // TODO_MAYBE_WHERE_CLAUSE + { + // TODO_UPGRADE_DISPATCHABLES + } + + #[pallet::inherent] + // TODO_INHERENT + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + // TODO_EVENT + + // TODO_REMOVE_IF_NO_EVENT + /// Old name generated by `decl_event`. + #[deprecated(note="use `Event` instead")] + pub type RawEvent /* TODO_PUT_EVENT_GENERICS */ = Event /* TODO_PUT_EVENT_GENERICS */; + + #[pallet::error] + // TODO_ERROR + + #[pallet::origin] + // TODO_ORIGIN + + #[pallet::validate_unsigned] + // TODO_VALIDATE_UNSIGNED + + + + /// The lookup from index to account. + #[pallet::storage] + pub type Accounts = StorageMap<_, Blake2_128Concat, T::AccountIndex, (T::AccountId, BalanceOf, bool)>; + + + #[pallet::genesis_config] + pub struct GenesisConfig + // TODO_MAYBE_WHERE_CLAUSE + { + pub indices: Vec<(T::AccountIndex, T::AccountId)>, + } + + #[cfg(feature = "std")] + impl Default for GenesisConfig + // TODO_MAYBE_WHERE_CLAUSE + { + fn default() -> Self { + Self { + indices: Default::default(), + } + } + } + + + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig + // TODO_MAYBE_WHERE_CLAUSE + { + fn build(&self) { + { + let builder : fn(& Self) -> _ = | config : & GenesisConfig | config + . indices . iter() . cloned() . + map(|(a, b) |(a,(b, Zero::zero(), false))) . collect::> + (); let data = & builder(self); let data : & frame_support::sp_std:: + vec::Vec<(T::AccountIndex,(T::AccountId, BalanceOf, bool)) + > = data; data . iter() . + for_each(|(k, v) | + { + as frame_support::storage::StorageMap< + T::AccountIndex,(T::AccountId, BalanceOf, bool)> + >::insert::<& T::AccountIndex, & + (T::AccountId, BalanceOf, bool)>(k, v); + }); +} + } + } +} From 0a22ee4613191562362a8916fa9f24401472ce27 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Mar 2021 14:49:01 +0000 Subject: [PATCH 3/7] Delete temp upgrade file --- frame/indices/src/upgrade.rs | 112 ----------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 frame/indices/src/upgrade.rs diff --git a/frame/indices/src/upgrade.rs b/frame/indices/src/upgrade.rs deleted file mode 100644 index f13d4e4063010..0000000000000 --- a/frame/indices/src/upgrade.rs +++ /dev/null @@ -1,112 +0,0 @@ - -// Template for pallet upgrade for Indices - -pub use pallet::*; - -#[frame_support::pallet] -pub mod pallet { - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; - use super::*; - - #[pallet::config] - pub trait Config: frame_system::Config - // TODO_MAYBE_ADDITIONAL_BOUNDS_AND_WHERE_CLAUSE - { - // TODO_ASSOCIATED_TYPE_AND_CONSTANTS - } - - - - #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] - pub struct Pallet(PhantomData); - - #[pallet::hooks] - impl Hooks> for Pallet - // TODO_MAYBE_WHERE_CLAUSE - { - // TODO_ON_FINALIZE - // TODO_ON_INITIALIZE - // TODO_ON_RUNTIME_UPGRADE - // TODO_INTEGRITY_TEST - // TODO_OFFCHAIN_WORKER - } - - #[pallet::call] - impl Pallet - // TODO_MAYBE_WHERE_CLAUSE - { - // TODO_UPGRADE_DISPATCHABLES - } - - #[pallet::inherent] - // TODO_INHERENT - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - // TODO_EVENT - - // TODO_REMOVE_IF_NO_EVENT - /// Old name generated by `decl_event`. - #[deprecated(note="use `Event` instead")] - pub type RawEvent /* TODO_PUT_EVENT_GENERICS */ = Event /* TODO_PUT_EVENT_GENERICS */; - - #[pallet::error] - // TODO_ERROR - - #[pallet::origin] - // TODO_ORIGIN - - #[pallet::validate_unsigned] - // TODO_VALIDATE_UNSIGNED - - - - /// The lookup from index to account. - #[pallet::storage] - pub type Accounts = StorageMap<_, Blake2_128Concat, T::AccountIndex, (T::AccountId, BalanceOf, bool)>; - - - #[pallet::genesis_config] - pub struct GenesisConfig - // TODO_MAYBE_WHERE_CLAUSE - { - pub indices: Vec<(T::AccountIndex, T::AccountId)>, - } - - #[cfg(feature = "std")] - impl Default for GenesisConfig - // TODO_MAYBE_WHERE_CLAUSE - { - fn default() -> Self { - Self { - indices: Default::default(), - } - } - } - - - #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig - // TODO_MAYBE_WHERE_CLAUSE - { - fn build(&self) { - { - let builder : fn(& Self) -> _ = | config : & GenesisConfig | config - . indices . iter() . cloned() . - map(|(a, b) |(a,(b, Zero::zero(), false))) . collect::> - (); let data = & builder(self); let data : & frame_support::sp_std:: - vec::Vec<(T::AccountIndex,(T::AccountId, BalanceOf, bool)) - > = data; data . iter() . - for_each(|(k, v) | - { - as frame_support::storage::StorageMap< - T::AccountIndex,(T::AccountId, BalanceOf, bool)> - >::insert::<& T::AccountIndex, & - (T::AccountId, BalanceOf, bool)>(k, v); - }); -} - } - } -} From 5ca9a98b9b2bd53e28154b18ca187342df9b8825 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Mar 2021 14:52:49 +0000 Subject: [PATCH 4/7] Fix some migration errors --- frame/indices/src/lib.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index 27b064d83e5d1..47ba70ec34ae2 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -62,7 +62,7 @@ pub mod pallet { type Deposit: Get>; /// The overarching event type. - type Event: From> + Into<::Event>; + type Event: From> + IsType<::Event>; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; @@ -95,8 +95,8 @@ pub mod pallet { /// ------------------- /// - DB Weight: 1 Read/Write (Accounts) /// # - #[weight(T::WeightInfo::claim())] - fn claim(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { + #[pallet::weight(T::WeightInfo::claim())] + pub(crate) fn claim(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| { @@ -128,8 +128,8 @@ pub mod pallet { /// - Reads: Indices Accounts, System Account (recipient) /// - Writes: Indices Accounts, System Account (recipient) /// # - #[weight(T::WeightInfo::transfer())] - fn transfer( + #[pallet::weight(T::WeightInfo::transfer())] + pub(crate) fn transfer( origin: OriginFor, new: T::AccountId, index: T::AccountIndex, @@ -167,8 +167,8 @@ pub mod pallet { /// ------------------- /// - DB Weight: 1 Read/Write (Accounts) /// # - #[weight(T::WeightInfo::free())] - fn free(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { + #[pallet::weight(T::WeightInfo::free())] + pub(crate) fn free(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { @@ -203,8 +203,8 @@ pub mod pallet { /// - Reads: Indices Accounts, System Account (original owner) /// - Writes: Indices Accounts, System Account (original owner) /// # - #[weight(T::WeightInfo::force_transfer())] - fn force_transfer( + #[pallet::weight(T::WeightInfo::force_transfer())] + pub(crate) fn force_transfer( origin: OriginFor, new: T::AccountId, index: T::AccountIndex, @@ -239,8 +239,8 @@ pub mod pallet { /// ------------------- /// - DB Weight: 1 Read/Write (Accounts) /// # - #[weight(T::WeightInfo::freeze())] - fn freeze(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { + #[pallet::weight(T::WeightInfo::freeze())] + pub(crate) fn freeze(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { @@ -259,7 +259,7 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::metadata(T::AccountId = "AccountId", T::AccountIndex = "AccountIndex")] - pub enum Event { + pub enum Event { /// A account index was assigned. \[index, who\] IndexAssigned(T::AccountId, T::AccountIndex), /// A account index has been freed up (unassigned). \[index\] From 79287fe160fdcaee793700ed51e3cbc2a6be195e Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Mar 2021 14:59:28 +0000 Subject: [PATCH 5/7] Fix some warnings --- frame/indices/src/lib.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index 47ba70ec34ae2..a1b11f17f4680 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -29,12 +29,9 @@ use sp_std::prelude::*; use codec::Codec; use sp_runtime::MultiAddress; use sp_runtime::traits::{ - StaticLookup, Member, LookupError, Zero, Saturating, AtLeast32Bit + StaticLookup, LookupError, Zero, Saturating, AtLeast32Bit }; -use frame_support::{Parameter, decl_module, decl_error, decl_event, decl_storage, ensure}; -use frame_support::dispatch::DispatchResult; -use frame_support::traits::{Currency, ReservableCurrency, Get, BalanceStatus::Reserved}; -use frame_system::{ensure_signed, ensure_root}; +use frame_support::traits::{Currency, ReservableCurrency, BalanceStatus::Reserved}; pub use weights::WeightInfo; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; @@ -104,7 +101,7 @@ pub mod pallet { *maybe_value = Some((who.clone(), T::Deposit::get(), false)); T::Currency::reserve(&who, T::Deposit::get()) })?; - Self::deposit_event(RawEvent::IndexAssigned(who, index)); + Self::deposit_event(Event::IndexAssigned(who, index)); Ok(()) } @@ -145,7 +142,7 @@ pub mod pallet { *maybe_value = Some((new.clone(), amount.saturating_sub(lost), false)); Ok(()) })?; - Self::deposit_event(RawEvent::IndexAssigned(new, index)); + Self::deposit_event(Event::IndexAssigned(new, index)); Ok(()) } @@ -178,7 +175,7 @@ pub mod pallet { T::Currency::unreserve(&who, amount); Ok(()) })?; - Self::deposit_event(RawEvent::IndexFreed(index)); + Self::deposit_event(Event::IndexFreed(index)); Ok(()) } @@ -218,7 +215,7 @@ pub mod pallet { } *maybe_value = Some((new.clone(), Zero::zero(), freeze)); }); - Self::deposit_event(RawEvent::IndexAssigned(new, index)); + Self::deposit_event(Event::IndexAssigned(new, index)); Ok(()) } @@ -251,7 +248,7 @@ pub mod pallet { *maybe_value = Some((account, Zero::zero(), true)); Ok(()) })?; - Self::deposit_event(RawEvent::IndexFrozen(index, who)); + Self::deposit_event(Event::IndexFrozen(index, who)); Ok(()) } } From e7175712dbd1343925b9148a4f1b734f9f7f6aac Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Mar 2021 15:25:29 +0000 Subject: [PATCH 6/7] Add serde bound, explicit balance type --- frame/indices/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index a1b11f17f4680..19697f2d941bb 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -49,7 +49,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// Type used for storing an account's index; implies the maximum number of accounts the system /// can hold. - type AccountIndex: Parameter + Member + Codec + Default + AtLeast32Bit + Copy; + type AccountIndex: Parameter + Member + MaybeSerializeDeserialize + Codec + Default + AtLeast32Bit + Copy; /// The currency trait. type Currency: ReservableCurrency; @@ -309,7 +309,7 @@ pub mod pallet { impl GenesisBuild for GenesisConfig { fn build(&self) { for (a, b) in &self.indices { - >::insert(a, (b, Zero::zero(), false)) + >::insert(a, (b, >::zero(), false)) } } } From d701aa9ee72b8dd63f3aeca921111bf4e7570e16 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Mar 2021 15:55:41 +0000 Subject: [PATCH 7/7] Module -> Pallet --- frame/indices/src/benchmarking.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/indices/src/benchmarking.rs b/frame/indices/src/benchmarking.rs index 6ea39e9ccc23e..625a994af38f6 100644 --- a/frame/indices/src/benchmarking.rs +++ b/frame/indices/src/benchmarking.rs @@ -24,7 +24,7 @@ use frame_system::RawOrigin; use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark_test_suite}; use sp_runtime::traits::Bounded; -use crate::Module as Indices; +use crate::Pallet as Indices; const SEED: u32 = 0;