Skip to content

Commit

Permalink
Mocks for pallet balances updated
Browse files Browse the repository at this point in the history
  • Loading branch information
grbIzl committed Jan 14, 2025
1 parent 765d44b commit a917cb9
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 97 deletions.
7 changes: 2 additions & 5 deletions chain-extensions/pallet-assets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@

use crate::AssetsExtension;
use frame_support::traits::{AsEnsureOriginWithArg, ConstU128, Currency, Randomness};
use frame_support::{
parameter_types,
traits::{ConstU32, ConstU64, Nothing},
weights::Weight,
};
use frame_support::{derive_impl, parameter_types, traits::{ConstU32, ConstU64, Nothing}, weights::Weight};
use frame_system::EnsureSigned;
use pallet_contracts::chain_extension::RegisteredChainExtension;
use pallet_contracts::{Config, DefaultAddressGenerator, Frame};
Expand Down Expand Up @@ -137,6 +133,7 @@ parameter_types! {
pub static ExistentialDeposit: u64 = 1;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = ();
Expand Down
7 changes: 2 additions & 5 deletions pallets/astar-xcm-benchmarks/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
use crate::{fungible, generic, *};
use astar_primitives::xcm::ReserveAssetFilter;
use frame_benchmarking::BenchmarkError;
use frame_support::{
assert_ok, parameter_types,
traits::{fungible::ItemOf, AsEnsureOriginWithArg, Everything, Nothing},
weights::Weight,
};
use frame_support::{assert_ok, derive_impl, parameter_types, traits::{fungible::ItemOf, AsEnsureOriginWithArg, Everything, Nothing}, weights::Weight};
use frame_system::{EnsureRoot, EnsureSigned};

use core::marker::PhantomData;
Expand Down Expand Up @@ -140,6 +136,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 10;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = ();
Expand Down
7 changes: 2 additions & 5 deletions pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@

use super::*;
use crate as collator_selection;
use frame_support::{
ord_parameter_types, parameter_types,
traits::{ConstU32, FindAuthor, ValidatorRegistration},
PalletId,
};
use frame_support::{derive_impl, ord_parameter_types, parameter_types, traits::{ConstU32, FindAuthor, ValidatorRegistration}, PalletId};
use frame_system as system;
use frame_system::EnsureSignedBy;
use sp_core::{ConstBool, H256};
Expand Down Expand Up @@ -88,6 +84,7 @@ parameter_types! {
pub const MaxReserves: u32 = 50;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type Balance = u64;
type RuntimeEvent = RuntimeEvent;
Expand Down
4 changes: 3 additions & 1 deletion pallets/collective-proxy/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use crate::{self as pallet_collective_proxy};

use astar_primitives::{Balance, BlockNumber};
use frame_support::{
construct_runtime, ord_parameter_types, parameter_types,
construct_runtime, derive_impl,
ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, InstanceFilter},
weights::Weight,
};
Expand Down Expand Up @@ -85,6 +86,7 @@ impl frame_system::Config for Test {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
1 change: 1 addition & 0 deletions pallets/dapp-staking/src/test/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ impl frame_system::Config for Test {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
7 changes: 2 additions & 5 deletions pallets/dynamic-evm-base-fee/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
use super::*;
use crate as pallet_dynamic_evm_base_fee;

use frame_support::{
construct_runtime, parameter_types, storage,
traits::{ConstU128, ConstU32, ConstU64, Get},
weights::constants::RocksDbWeight,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, storage, traits::{ConstU128, ConstU32, ConstU64, Get}, weights::constants::RocksDbWeight};
use parity_scale_codec::Encode;
use sp_core::H256;
use sp_io::TestExternalities;
Expand Down Expand Up @@ -74,6 +70,7 @@ impl frame_system::Config for TestRuntime {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
7 changes: 2 additions & 5 deletions pallets/ethereum-checked/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ use crate as pallet_ethereum_checked;

use ethereum_types::H256;

use frame_support::{
assert_ok, construct_runtime, parameter_types,
traits::{ConstU128, ConstU64, FindAuthor},
weights::Weight,
};
use frame_support::{assert_ok, construct_runtime, derive_impl, parameter_types, traits::{ConstU128, ConstU64, FindAuthor}, weights::Weight};
use pallet_ethereum::PostLogContent;
use pallet_evm::{AddressMapping, FeeCalculator};
use sp_io::{hashing::blake2_256, TestExternalities};
Expand Down Expand Up @@ -73,6 +69,7 @@ impl frame_system::Config for TestRuntime {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
8 changes: 2 additions & 6 deletions pallets/inflation/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ use crate::{
InflationParameters, InflationParams, PayoutPerBlock,
};

use frame_support::{
construct_runtime, parameter_types,
traits::{fungible::Balanced, ConstU128, ConstU32, Hooks},
weights::Weight,
PalletId,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::{fungible::Balanced, ConstU128, ConstU32, Hooks}, weights::Weight, PalletId};
use sp_core::H256;
use sp_io::TestExternalities;
use sp_runtime::{
Expand Down Expand Up @@ -89,6 +84,7 @@ impl frame_system::Config for Test {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
7 changes: 2 additions & 5 deletions pallets/price-aggregator/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ use crate::{
self as pallet_price_aggregator, AverageBlockValue, BlockNumberFor, IntermediateValueAggregator,
};

use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU128, ConstU32, Hooks},
weights::Weight,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::{ConstU128, ConstU32, Hooks}, weights::Weight};
use sp_core::H256;
use sp_io::TestExternalities;
use sp_runtime::{
Expand Down Expand Up @@ -75,6 +71,7 @@ impl frame_system::Config for Test {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
7 changes: 2 additions & 5 deletions pallets/static-price-provider/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@

use crate::{self as pallet_static_price_provider};

use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU128, ConstU32},
weights::Weight,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::{ConstU128, ConstU32}, weights::Weight};
use sp_core::H256;
use sp_io::TestExternalities;
use sp_runtime::{
Expand Down Expand Up @@ -73,6 +69,7 @@ impl frame_system::Config for Test {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
7 changes: 2 additions & 5 deletions pallets/unified-accounts/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
use super::*;
use crate as pallet_unified_accounts;
use astar_primitives::evm::HashedDefaultMappings;
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU64, FindAuthor},
weights::Weight,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::{ConstU64, FindAuthor}, weights::Weight};
use pallet_ethereum::PostLogContent;
use pallet_evm::FeeCalculator;
use sp_core::{keccak_256, H160, H256, U256};
Expand Down Expand Up @@ -73,6 +69,7 @@ impl frame_system::Config for TestRuntime {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
3 changes: 2 additions & 1 deletion pallets/xc-asset-config/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use crate::{self as pallet_xc_asset_config};

use frame_support::{construct_runtime, parameter_types, traits::ConstU32, weights::Weight};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::ConstU32, weights::Weight};
use sp_core::H256;

use sp_io::TestExternalities;
Expand Down Expand Up @@ -85,6 +85,7 @@ parameter_types! {
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = MaxLocks;
type MaxReserves = ();
Expand Down
7 changes: 2 additions & 5 deletions precompiles/assets-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@
use super::*;

use frame_support::{
construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, ConstU64, Everything},
weights::Weight,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::{AsEnsureOriginWithArg, ConstU64, Everything}, weights::Weight};

use frame_system::EnsureRoot;
use pallet_evm::{EnsureAddressNever, EnsureAddressRoot};
Expand Down Expand Up @@ -139,6 +135,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 1;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Runtime {
type MaxReserves = ();
type ReserveIdentifier = ();
Expand Down
13 changes: 5 additions & 8 deletions precompiles/dapp-staking/src/test/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@
use crate::*;

use fp_evm::{IsPrecompileResult, Precompile};
use frame_support::{
assert_ok, construct_runtime, parameter_types,
traits::{
fungible::{Mutate as FunMutate, Unbalanced as FunUnbalanced},
ConstBool, ConstU128, ConstU64, Hooks,
},
weights::{RuntimeDbWeight, Weight},
};
use frame_support::{assert_ok, construct_runtime, derive_impl, parameter_types, traits::{
fungible::{Mutate as FunMutate, Unbalanced as FunUnbalanced},
ConstBool, ConstU128, ConstU64, Hooks,
}, weights::{RuntimeDbWeight, Weight}};
use frame_system::RawOrigin;
use pallet_evm::{
AddressMapping, EnsureAddressNever, EnsureAddressRoot, PrecompileResult, PrecompileSet,
Expand Down Expand Up @@ -109,6 +105,7 @@ impl frame_system::Config for Test {
type PostTransactions = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
type MaxLocks = ConstU32<4>;
type MaxReserves = ();
Expand Down
3 changes: 2 additions & 1 deletion precompiles/dispatch-lockdrop/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::*;
use std::marker::PhantomData;

use fp_evm::{IsPrecompileResult, Precompile};
use frame_support::{construct_runtime, parameter_types, traits::ConstU64, weights::Weight};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::ConstU64, weights::Weight};
pub use pallet_evm::{
AddressMapping, EnsureAddressNever, EnsureAddressRoot, PrecompileResult, PrecompileSet,
};
Expand Down Expand Up @@ -127,6 +127,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 1;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type MaxReserves = ();
type ReserveIdentifier = ();
Expand Down
7 changes: 2 additions & 5 deletions precompiles/sr25519/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
use super::*;

use fp_evm::{IsPrecompileResult, Precompile};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, ConstU64, Everything},
weights::Weight,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::{ConstU32, ConstU64, Everything}, weights::Weight};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -179,6 +175,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 1;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Runtime {
type MaxReserves = ();
type ReserveIdentifier = ();
Expand Down
7 changes: 2 additions & 5 deletions precompiles/substrate-ecdsa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
use super::*;

use fp_evm::{IsPrecompileResult, Precompile};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, ConstU64, Everything},
weights::Weight,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::{ConstU32, ConstU64, Everything}, weights::Weight};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -179,6 +175,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 1;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Runtime {
type MaxReserves = ();
type ReserveIdentifier = ();
Expand Down
3 changes: 2 additions & 1 deletion precompiles/unified-accounts/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use super::*;

use fp_evm::{IsPrecompileResult, Precompile};
use frame_support::{construct_runtime, parameter_types, traits::ConstU64, weights::Weight};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::ConstU64, weights::Weight};
pub use pallet_evm::{EnsureAddressNever, EnsureAddressRoot, PrecompileResult, PrecompileSet};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
Expand Down Expand Up @@ -173,6 +173,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 1;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type MaxReserves = ();
type ReserveIdentifier = ();
Expand Down
7 changes: 2 additions & 5 deletions precompiles/xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
use super::*;

use fp_evm::{IsPrecompileResult, Precompile};
use frame_support::{
construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, ConstU64, Everything, Nothing},
weights::Weight,
};
use frame_support::{construct_runtime, derive_impl, parameter_types, traits::{AsEnsureOriginWithArg, ConstU64, Everything, Nothing}, weights::Weight};
use once_cell::unsync::Lazy;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
Expand Down Expand Up @@ -290,6 +286,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 1;
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Runtime {
type MaxReserves = ();
type ReserveIdentifier = ();
Expand Down
Loading

0 comments on commit a917cb9

Please sign in to comment.