Skip to content

Commit

Permalink
added derive macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Aideepakchaudhary committed Oct 16, 2024
1 parent 0cd65de commit 6a33e0d
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 91 deletions.
12 changes: 2 additions & 10 deletions pallets/chainbridge/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use frame_support::{
assert_ok, ord_parameter_types, parameter_types, traits::Everything, weights::Weight,
assert_ok, ord_parameter_types, parameter_types,derive_impl, traits::Everything, weights::Weight,
};
use frame_system::{self as system};
pub use pallet_balances as balances;
Expand All @@ -19,10 +19,9 @@ parameter_types! {
pub const MaxLocks: u32 = 50;
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type RuntimeTask = RuntimeTask;
Expand All @@ -34,17 +33,10 @@ impl frame_system::Config for Test {
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
type Version = ();
// type ModuleToIndex = ();
type PalletInfo = PalletInfo;
// type MaxLocks = MaxLocks;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

Expand Down
11 changes: 2 additions & 9 deletions pallets/ddc-clusters-gov/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ddc_primitives::{
StorageNodeParams, DOLLARS,
};
use frame_support::{
parameter_types,
parameter_types,derive_impl,
traits::{
fungible::HoldConsideration, ConstBool, ConstU32, ConstU64, EnsureOriginWithArg,
EqualPrivilegeOnly, Everything, LinearStoragePrice, Nothing,
Expand Down Expand Up @@ -85,10 +85,9 @@ impl Convert<Weight, BalanceOf<Self>> for Test {
}
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = RocksDbWeight;
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
Expand All @@ -101,14 +100,8 @@ impl frame_system::Config for Test {
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

Expand Down
11 changes: 2 additions & 9 deletions pallets/ddc-clusters/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ddc_primitives::{
ClusterId, NodePubKey,
};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime, parameter_types,derive_impl,
traits::{ConstBool, ConstU32, ConstU64, Everything, Nothing},
weights::constants::RocksDbWeight,
};
Expand Down Expand Up @@ -142,10 +142,9 @@ parameter_types! {
pub static ExistentialDeposit: Balance = 1;
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = RocksDbWeight;
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
Expand All @@ -157,14 +156,8 @@ impl frame_system::Config for Test {
type AccountId = AccountId;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
type Lookup = IdentityLookup<Self::AccountId>;
}
Expand Down
11 changes: 2 additions & 9 deletions pallets/ddc-customers/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ddc_primitives::{
ClusterProtocolParams, ClusterStatus, NodePubKey, NodeType,
};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime, parameter_types,derive_impl,
traits::{ConstU32, ConstU64, Everything},
weights::constants::RocksDbWeight,
};
Expand Down Expand Up @@ -42,10 +42,9 @@ parameter_types! {
pub static ExistentialDeposit: Balance = 1;
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = RocksDbWeight;
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
Expand All @@ -58,14 +57,8 @@ impl frame_system::Config for Test {
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

Expand Down
11 changes: 2 additions & 9 deletions pallets/ddc-nodes/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use ddc_primitives::traits::staking::{StakingVisitor, StakingVisitorError};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime, parameter_types,derive_impl,
traits::{ConstU32, ConstU64, Everything},
weights::constants::RocksDbWeight,
};
Expand Down Expand Up @@ -41,10 +41,9 @@ parameter_types! {
pub static ExistentialDeposit: Balance = 1;
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = RocksDbWeight;
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
Expand All @@ -57,14 +56,8 @@ impl frame_system::Config for Test {
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

Expand Down
11 changes: 2 additions & 9 deletions pallets/ddc-payouts/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use ddc_primitives::{
};
use frame_election_provider_support::SortedListProvider;
use frame_support::{
construct_runtime, parameter_types,
construct_runtime, parameter_types,derive_impl,
traits::{ConstU32, ConstU64, Everything, ExistenceRequirement, Randomness},
weights::constants::RocksDbWeight,
PalletId,
Expand Down Expand Up @@ -73,10 +73,9 @@ impl Randomness<H256, BlockNumber> for MockRandomness {
}
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = RocksDbWeight;
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
Expand All @@ -89,14 +88,8 @@ impl frame_system::Config for Test {
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

Expand Down
11 changes: 2 additions & 9 deletions pallets/ddc-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ddc_primitives::{
NodeParams, NodePubKey, StorageNodeParams, StorageNodePubKey,
};
use frame_support::{
construct_runtime,
construct_runtime,derive_impl,
traits::{ConstBool, ConstU32, ConstU64, Everything, Nothing},
weights::constants::RocksDbWeight,
};
Expand Down Expand Up @@ -64,10 +64,9 @@ type BalanceOf<T> = <<T as crate::pallet::Config>::Currency as Currency<
<T as frame_system::Config>::AccountId,
>>::Balance;

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = RocksDbWeight;
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
Expand All @@ -80,14 +79,8 @@ impl frame_system::Config for Test {
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

Expand Down
13 changes: 2 additions & 11 deletions pallets/erc20/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg(test)]

use chainbridge as bridge;
use frame_support::{ord_parameter_types, parameter_types, weights::Weight};
use frame_support::{ord_parameter_types,derive_impl, parameter_types, weights::Weight};
use frame_system::{self as system};
pub use pallet_balances as balances;
use sp_core::{hashing::blake2_128, H256};
Expand All @@ -21,8 +21,8 @@ parameter_types! {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = Call;
type Nonce = u64;
Expand All @@ -34,18 +34,9 @@ impl frame_system::Config for Test {
type Event = Event;
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type BlockExecutionWeight = ();
type ExtrinsicBaseWeight = ();
type MaximumExtrinsicWeight = ();
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}

parameter_types! {
Expand Down
12 changes: 2 additions & 10 deletions pallets/erc721/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg(test)]

use frame_support::{ord_parameter_types, parameter_types, traits::Everything, weights::Weight};
use frame_support::{ord_parameter_types,derive_impl, parameter_types, traits::Everything, weights::Weight};
use frame_system::{self as system};
pub use pallet_balances as balances;
use pallet_chainbridge as bridge;
Expand All @@ -20,10 +20,9 @@ parameter_types! {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type RuntimeTask = RuntimeTask;
Expand All @@ -35,15 +34,8 @@ impl frame_system::Config for Test {
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

Expand Down
5 changes: 2 additions & 3 deletions runtime/cere-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use frame_support::{
dispatch::DispatchClass,
pallet_prelude::Get,
parameter_types,
derive_impl,
traits::{
fungible::HoldConsideration,
tokens::{PayFromAccount, UnityAssetBalanceConversion},
Expand Down Expand Up @@ -222,6 +223,7 @@ parameter_types! {

const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type BaseCallFilter = Everything;
type BlockWeights = RuntimeBlockWeights;
Expand All @@ -241,11 +243,8 @@ impl frame_system::Config for Runtime {
type Version = Version;
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = frame_system::weights::SubstrateWeight<Runtime>;
type SS58Prefix = ConstU16<54>;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

Expand Down
5 changes: 2 additions & 3 deletions runtime/cere/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use frame_support::{
dispatch::DispatchClass,
pallet_prelude::Get,
parameter_types,
derive_impl,
traits::{
fungible::HoldConsideration,
tokens::{PayFromAccount, UnityAssetBalanceConversion},
Expand Down Expand Up @@ -217,6 +218,7 @@ parameter_types! {

const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type BaseCallFilter = Everything;
type BlockWeights = RuntimeBlockWeights;
Expand All @@ -236,11 +238,8 @@ impl frame_system::Config for Runtime {
type Version = Version;
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = frame_system::weights::SubstrateWeight<Runtime>;
type SS58Prefix = ConstU16<54>;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

Expand Down

0 comments on commit 6a33e0d

Please sign in to comment.