Skip to content

Commit

Permalink
Config mocks updated
Browse files Browse the repository at this point in the history
  • Loading branch information
grbIzl committed Jan 16, 2025
1 parent 765d44b commit 726aa43
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 20 deletions.
7 changes: 6 additions & 1 deletion chain-extensions/pallet-assets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use crate::AssetsExtension;
use frame_support::traits::{AsEnsureOriginWithArg, ConstU128, Currency, Randomness};
use frame_support::{
parameter_types,
derive_impl, parameter_types,
traits::{ConstU32, ConstU64, Nothing},
weights::Weight,
};
Expand Down Expand Up @@ -47,6 +47,7 @@ parameter_types! {
Weight::from_parts(2_000_000_000_000, u64::MAX),
);
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = BlockWeights;
Expand Down Expand Up @@ -96,6 +97,7 @@ impl Randomness<H256, BlockNumber> for DummyDeprecatedRandomness {
}
}

#[derive_impl(pallet_contracts::config_preludes::TestDefaultConfig)]
impl pallet_contracts::Config for Test {
type Time = Timestamp;
type Randomness = DummyDeprecatedRandomness;
Expand Down Expand Up @@ -137,6 +139,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 All @@ -153,13 +156,15 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ConstU32<0>;
}

#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)]
impl pallet_timestamp::Config for Test {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = ConstU64<1>;
type WeightInfo = ();
}

#[derive_impl(pallet_assets::config_preludes::TestDefaultConfig)]
impl pallet_assets::Config for Test {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
Expand Down
5 changes: 4 additions & 1 deletion pallets/astar-xcm-benchmarks/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{fungible, generic, *};
use astar_primitives::xcm::ReserveAssetFilter;
use frame_benchmarking::BenchmarkError;
use frame_support::{
assert_ok, parameter_types,
assert_ok, derive_impl, parameter_types,
traits::{fungible::ItemOf, AsEnsureOriginWithArg, Everything, Nothing},
weights::Weight,
};
Expand Down Expand Up @@ -104,6 +104,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, u64::MAX));
pub UniversalLocation: InteriorLocation = Here;
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -140,6 +141,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 All @@ -156,6 +158,7 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ConstU32<0>;
}

#[derive_impl(pallet_assets::config_preludes::TestDefaultConfig)]
impl pallet_assets::Config for Test {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
Expand Down
5 changes: 4 additions & 1 deletion pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use super::*;
use crate as collator_selection;
use frame_support::{
ord_parameter_types, parameter_types,
derive_impl, ord_parameter_types, parameter_types,
traits::{ConstU32, FindAuthor, ValidatorRegistration},
PalletId,
};
Expand Down Expand Up @@ -51,6 +51,7 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -88,6 +89,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 Expand Up @@ -123,6 +125,7 @@ parameter_types! {
pub const MinimumPeriod: u64 = 1;
}

#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)]
impl pallet_timestamp::Config for Test {
type Moment = u64;
type OnTimestampSet = Aura;
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,7 @@ 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 @@ -53,6 +53,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
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
2 changes: 2 additions & 0 deletions pallets/dapp-staking/src/test/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -98,6 +99,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
5 changes: 4 additions & 1 deletion pallets/dynamic-evm-base-fee/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use super::*;
use crate as pallet_dynamic_evm_base_fee;

use frame_support::{
construct_runtime, parameter_types, storage,
construct_runtime, derive_impl, parameter_types, storage,
traits::{ConstU128, ConstU32, ConstU64, Get},
weights::constants::RocksDbWeight,
};
Expand All @@ -42,6 +42,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -74,6 +75,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 All @@ -90,6 +92,7 @@ impl pallet_balances::Config for TestRuntime {
type MaxFreezes = ConstU32<0>;
}

#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)]
impl pallet_timestamp::Config for TestRuntime {
type Moment = u64;
type OnTimestampSet = ();
Expand Down
5 changes: 4 additions & 1 deletion pallets/ethereum-checked/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate as pallet_ethereum_checked;
use ethereum_types::H256;

use frame_support::{
assert_ok, construct_runtime, parameter_types,
assert_ok, construct_runtime, derive_impl, parameter_types,
traits::{ConstU128, ConstU64, FindAuthor},
weights::Weight,
};
Expand All @@ -41,6 +41,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -73,6 +74,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 All @@ -89,6 +91,7 @@ impl pallet_balances::Config for TestRuntime {
type MaxFreezes = ConstU32<0>;
}

#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)]
impl pallet_timestamp::Config for TestRuntime {
type Moment = u64;
type OnTimestampSet = ();
Expand Down
4 changes: 3 additions & 1 deletion pallets/inflation/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
};

use frame_support::{
construct_runtime, parameter_types,
construct_runtime, derive_impl, parameter_types,
traits::{fungible::Balanced, ConstU128, ConstU32, Hooks},
weights::Weight,
PalletId,
Expand Down Expand Up @@ -57,6 +57,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -89,6 +90,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
4 changes: 3 additions & 1 deletion pallets/price-aggregator/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
};

use frame_support::{
construct_runtime, parameter_types,
construct_runtime, derive_impl, parameter_types,
traits::{ConstU128, ConstU32, Hooks},
weights::Weight,
};
Expand All @@ -43,6 +43,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -75,6 +76,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
4 changes: 3 additions & 1 deletion pallets/static-price-provider/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use crate::{self as pallet_static_price_provider};

use frame_support::{
construct_runtime, parameter_types,
construct_runtime, derive_impl, parameter_types,
traits::{ConstU128, ConstU32},
weights::Weight,
};
Expand All @@ -41,6 +41,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -73,6 +74,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
5 changes: 4 additions & 1 deletion pallets/unified-accounts/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use super::*;
use crate as pallet_unified_accounts;
use astar_primitives::evm::HashedDefaultMappings;
use frame_support::{
construct_runtime, parameter_types,
construct_runtime, derive_impl, parameter_types,
traits::{ConstU64, FindAuthor},
weights::Weight,
};
Expand All @@ -41,6 +41,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 100;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -73,6 +74,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 All @@ -89,6 +91,7 @@ impl pallet_balances::Config for TestRuntime {
type MaxFreezes = ConstU32<0>;
}

#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)]
impl pallet_timestamp::Config for TestRuntime {
type Moment = u64;
type OnTimestampSet = ();
Expand Down
6 changes: 5 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,9 @@

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 @@ -48,6 +50,7 @@ parameter_types! {
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand Down Expand Up @@ -85,6 +88,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
6 changes: 5 additions & 1 deletion precompiles/assets-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
use super::*;

use frame_support::{
construct_runtime, parameter_types,
construct_runtime, derive_impl, parameter_types,
traits::{AsEnsureOriginWithArg, ConstU64, Everything},
weights::Weight,
};
Expand Down Expand Up @@ -92,6 +92,7 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Runtime {
type BaseCallFilter = Everything;
type DbWeight = ();
Expand Down Expand Up @@ -128,6 +129,7 @@ parameter_types! {
pub const MinimumPeriod: u64 = 5;
}

#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)]
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = ();
Expand All @@ -139,6 +141,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 Expand Up @@ -198,6 +201,7 @@ parameter_types! {
pub const MetadataDepositPerByte: Balance = 0;
}

#[derive_impl(pallet_assets::config_preludes::TestDefaultConfig)]
impl pallet_assets::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
Expand Down
Loading

0 comments on commit 726aa43

Please sign in to comment.