Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update for new type
  • Loading branch information
shawntabrizi committed Sep 16, 2020
commit bfa00471fecf78f7de86b75977dfa3e8138f66d7
4 changes: 3 additions & 1 deletion bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ impl pallet_timestamp::Trait for Runtime {

parameter_types! {
pub const ExistentialDeposit: u128 = 500;
pub const MaxLocks: u32 = 50;
}

impl pallet_balances::Trait for Runtime {
type MaxLocks = MaxLocks;
/// The type for recording an account's balance.
type Balance = Balance;
/// The ubiquitous event type.
Expand Down Expand Up @@ -423,7 +425,7 @@ impl_runtime_apis! {
None
}
}

impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
System::account_nonce(account)
Expand Down
8 changes: 4 additions & 4 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,13 @@ impl pallet_indices::Trait for Runtime {

parameter_types! {
pub const ExistentialDeposit: Balance = 1 * DOLLARS;
// For weight estimation, we assume that the most locks on an individual account will be 50.
// This number may need to be adjusted in the future if this assumption no longer holds true.
pub const MaxLocks: u32 = 50;
}

impl pallet_balances::Trait for Runtime {
type MaxLocks = MaxLocks;
type Balance = Balance;
type DustRemoval = ();
type Event = Event;
Expand Down Expand Up @@ -849,17 +853,13 @@ impl pallet_society::Trait for Runtime {

parameter_types! {
pub const MinVestedTransfer: Balance = 100 * DOLLARS;
// For weight estimation, we assume that the most locks on an individual account will be 50.
// This number may need to be adjusted in the future if this assumption no longer holds true.
pub const MaxLocks: u32 = 50;
}

impl pallet_vesting::Trait for Runtime {
type Event = Event;
type Currency = Balances;
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type MaxLocks = MaxLocks;
type WeightInfo = weights::pallet_vesting::WeightInfo;
}

Expand Down
1 change: 1 addition & 0 deletions frame/atomic-swap/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type DustRemoval = ();
type Event = ();
Expand Down
1 change: 1 addition & 0 deletions frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ parameter_types! {
}

impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u128;
type DustRemoval = ();
type Event = ();
Expand Down
1 change: 1 addition & 0 deletions frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ impl frame_system::Trait for Test {
type SystemWeightInfo = ();
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = MetaEvent;
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/democracy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = Event;
type DustRemoval = ();
Expand Down
2 changes: 2 additions & 0 deletions frame/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,9 +1148,11 @@ mod tests {

parameter_types! {
pub const ExistentialDeposit: u64 = 1;
pub const MaxLocks: u32 = 10;
}

impl pallet_balances::Trait for Test {
type MaxLocks = MaxLocks;
type Balance = u64;
type Event = Event;
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/elections/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type DustRemoval = ();
type Event = Event;
Expand Down
1 change: 1 addition & 0 deletions frame/evm/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type DustRemoval = ();
type Event = ();
Expand Down
1 change: 1 addition & 0 deletions frame/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ mod tests {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type DustRemoval = ();
type Event = ();
Expand Down
2 changes: 2 additions & 0 deletions frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,10 @@ mod tests {
type Balance = u64;
parameter_types! {
pub const ExistentialDeposit: Balance = 1;
pub const MaxLocks: u32 = 10;
}
impl pallet_balances::Trait for Runtime {
type MaxLocks = MaxLocks;
type Balance = Balance;
type Event = MetaEvent;
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/identity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,7 @@ mod tests {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = ();
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/indices/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ parameter_types! {
}

impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type DustRemoval = ();
type Event = MetaEvent;
Expand Down
1 change: 1 addition & 0 deletions frame/multisig/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = TestEvent;
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/nicks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ mod tests {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = ();
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/offences/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ parameter_types! {
pub const ExistentialDeposit: Balance = 10;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = Balance;
type Event = Event;
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/proxy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = TestEvent;
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/recovery/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ parameter_types! {
}

impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u128;
type DustRemoval = ();
type Event = TestEvent;
Expand Down
1 change: 1 addition & 0 deletions frame/scored-pool/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl frame_system::Trait for Test {
}

impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = ();
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/session/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ parameter_types! {
pub const ExistentialDeposit: Balance = 10;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = Balance;
type Event = ();
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/society/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl frame_system::Trait for Test {
}

impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = ();
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/staking/fuzzer/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ parameter_types! {
pub const ExistentialDeposit: Balance = 10;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = Balance;
type Event = ();
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ impl frame_system::Trait for Test {
type SystemWeightInfo = ();
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = Balance;
type Event = MetaEvent;
type DustRemoval = ();
Expand Down
2 changes: 1 addition & 1 deletion frame/support/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ pub trait LockableCurrency<AccountId>: Currency<AccountId> {
type Moment;

/// The maximum number of locks a user should have on their account.
type MaxLocks;
type MaxLocks: Get<u32>;

/// Create a new balance lock on account `who`.
///
Expand Down
2 changes: 2 additions & 0 deletions frame/transaction-payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,11 @@ mod tests {

parameter_types! {
pub const ExistentialDeposit: u64 = 1;
pub const MaxLocks: u32 = 10;
}

impl pallet_balances::Trait for Runtime {
type MaxLocks = MaxLocks;
type Balance = u64;
type Event = Event;
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/treasury/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type Event = Event;
type DustRemoval = ();
Expand Down
1 change: 1 addition & 0 deletions frame/utility/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type DustRemoval = ();
type Event = TestEvent;
Expand Down
13 changes: 7 additions & 6 deletions frame/vesting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ decl_module! {
/// - Reads: Vesting Storage, Balances Locks, [Sender Account]
/// - Writes: Vesting Storage, Balances Locks, [Sender Account]
/// # </weight>
#[weight = T::WeightInfo::vest_locked(<MaxLocksOf<T> as Get<u32>>::get())
.max(T::WeightInfo::vest_unlocked(<MaxLocksOf<T> as Get<u32>>::get()))
#[weight = T::WeightInfo::vest_locked(MaxLocksOf::<T>::get())
.max(T::WeightInfo::vest_unlocked(MaxLocksOf::<T>::get()))
]
fn vest(origin) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand All @@ -232,8 +232,8 @@ decl_module! {
/// - Reads: Vesting Storage, Balances Locks, Target Account
/// - Writes: Vesting Storage, Balances Locks, Target Account
/// # </weight>
#[weight = T::WeightInfo::vest_other_locked(<MaxLocksOf<T> as Get<u32>>::get())
.max(T::WeightInfo::vest_other_unlocked(<MaxLocksOf<T> as Get<u32>>::get()))
#[weight = T::WeightInfo::vest_other_locked(MaxLocksOf::<T>::get())
.max(T::WeightInfo::vest_other_unlocked(MaxLocksOf::<T>::get()))
]
fn vest_other(origin, target: <T::Lookup as StaticLookup>::Source) -> DispatchResult {
ensure_signed(origin)?;
Expand All @@ -256,7 +256,7 @@ decl_module! {
/// - Reads: Vesting Storage, Balances Locks, Target Account, [Sender Account]
/// - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]
/// # </weight>
#[weight = T::WeightInfo::vested_transfer(<MaxLocksOf<T> as Get<u32>>::get())]
#[weight = T::WeightInfo::vested_transfer(MaxLocksOf::<T>::get())]
pub fn vested_transfer(
origin,
target: <T::Lookup as StaticLookup>::Source,
Expand Down Expand Up @@ -293,7 +293,7 @@ decl_module! {
/// - Reads: Vesting Storage, Balances Locks, Target Account, Source Account
/// - Writes: Vesting Storage, Balances Locks, Target Account, Source Account
/// # </weight>
#[weight = T::WeightInfo::force_vested_transfer(<MaxLocksOf<T> as Get<u32>>::get())]
#[weight = T::WeightInfo::force_vested_transfer(MaxLocksOf::<T>::get())]
pub fn force_vested_transfer(
origin,
source: <T::Lookup as StaticLookup>::Source,
Expand Down Expand Up @@ -454,6 +454,7 @@ mod tests {
pub const MaxLocks: u32 = 10;
}
impl pallet_balances::Trait for Test {
type MaxLocks = ();
type Balance = u64;
type DustRemoval = ();
type Event = ();
Expand Down