Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FRAME Core] remove unnecessary overrides while using derive_impl for frame_system #3317

Merged
merged 60 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
85f05a0
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
f09b699
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
e80290b
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
8edc003
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
7f60211
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
dbd68b7
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
8970e67
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
7e1f712
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
1d78113
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
7d8a201
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
ec8df66
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
85a03db
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
b16147e
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
5b257f8
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
776a366
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
2a9e553
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
979a5e8
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
dcc39fe
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
e4d14c4
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
22c1009
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
7998cf5
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
8d79e50
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
9b8fead
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
9990098
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
10a615b
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
86ec57d
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
4fe2797
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
87db743
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
8b50688
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
aab09d6
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
493669c
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
c7c7e87
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
5049726
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
b6cec53
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
a66c1c9
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
0ddc58e
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
a7ef555
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
9f7a041
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
358dc22
cleaning impl frame_system::Config for Test
Gilt0 Feb 13, 2024
bd2ce03
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
8e4e784
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
fd64652
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
91cd636
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
9d93479
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
e8a44b1
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
3551f7f
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
d9a1be8
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
5df22cf
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
93a76d1
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
d1b15b1
cleaning impl frame_system::Config for Test
Gilt0 Feb 14, 2024
fcd218b
fixing git actions
Gilt0 Feb 14, 2024
df4d4a1
Merge branch 'master' into issue-3237
Gilt0 Feb 14, 2024
2a0d20a
fixing git actions
Gilt0 Feb 14, 2024
2cb4010
fixing git actions
Gilt0 Feb 14, 2024
653c80e
fixing action test-linux-stable
Gilt0 Feb 14, 2024
c63b46b
Fixing actions - reverting change
Gilt0 Feb 14, 2024
db32489
keeping changes as it did not resolve the error
Gilt0 Feb 14, 2024
f25c735
".git/.scripts/commands/fmt/fmt.sh"
Feb 17, 2024
8ae44c6
Merge branch 'master' into issue-3237
codekitz Feb 17, 2024
9798646
Merge branch 'master' into issue-3237
codekitz Feb 19, 2024
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
24 changes: 2 additions & 22 deletions substrate/frame/asset-conversion/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ use frame_support::{
fungible::{NativeFromLeft, NativeOrWithId, UnionOf},
imbalance::ResolveAssetTo,
},
AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64,
AsEnsureOriginWithArg, ConstU128, ConstU32,
},
PalletId,
};
use frame_system::{EnsureSigned, EnsureSignedBy};
use sp_arithmetic::Permill;
use sp_core::H256;
use sp_runtime::{
traits::{AccountIdConversion, BlakeTwo256, IdentityLookup},
traits::{AccountIdConversion, IdentityLookup},
BuildStorage,
};

Expand All @@ -56,29 +55,10 @@ construct_runtime!(

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u128;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u128>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

impl pallet_balances::Config for Test {
Expand Down
32 changes: 2 additions & 30 deletions substrate/frame/asset-rate/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@
//! The crate's mock.

use crate as pallet_asset_rate;
use frame_support::{
derive_impl,
traits::{ConstU16, ConstU64},
};
use sp_core::H256;
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
use frame_support::{derive_impl, traits::ConstU64};
use sp_runtime::BuildStorage;

type Block = frame_system::mocking::MockBlock<Test>;

Expand All @@ -41,29 +34,8 @@ frame_support::construct_runtime!(

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

impl pallet_balances::Config for Test {
Expand Down
26 changes: 1 addition & 25 deletions substrate/frame/assets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ use frame_support::{
construct_runtime, derive_impl, parameter_types,
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64},
};
use sp_core::H256;
use sp_io::storage;
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
use sp_runtime::BuildStorage;

type Block = frame_system::mocking::MockBlock<Test>;

Expand All @@ -48,28 +44,8 @@ type AssetId = u32;

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<3>;
}

Expand Down
27 changes: 1 addition & 26 deletions substrate/frame/atomic-swap/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ use frame_support::{
derive_impl,
traits::{ConstU32, ConstU64},
};
use sp_core::H256;
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
use sp_runtime::BuildStorage;

type Block = frame_system::mocking::MockBlock<Test>;

Expand All @@ -43,29 +39,8 @@ frame_support::construct_runtime!(

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type Hash = H256;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

impl pallet_balances::Config for Test {
Expand Down
25 changes: 1 addition & 24 deletions substrate/frame/aura/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ use frame_support::{
traits::{ConstU32, ConstU64, DisabledValidators},
};
use sp_consensus_aura::{ed25519::AuthorityId, AuthorityIndex};
use sp_core::H256;
use sp_runtime::{testing::UintAuthorityId, traits::IdentityLookup, BuildStorage};
use sp_runtime::{testing::UintAuthorityId, BuildStorage};

type Block = frame_system::mocking::MockBlock<Test>;

Expand All @@ -43,29 +42,7 @@ frame_support::construct_runtime!(

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

impl pallet_timestamp::Config for Test {
Expand Down
27 changes: 2 additions & 25 deletions substrate/frame/authority-discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,10 @@ impl<T: Config> OneSessionHandler<T::AccountId> for Pallet<T> {
mod tests {
use super::*;
use crate as pallet_authority_discovery;
use frame_support::{
derive_impl, parameter_types,
traits::{ConstU32, ConstU64},
};
use frame_support::{derive_impl, parameter_types, traits::ConstU32};
use sp_application_crypto::Pair;
use sp_authority_discovery::AuthorityPair;
use sp_core::{crypto::key_types, H256};
use sp_core::crypto::key_types;
use sp_io::TestExternalities;
use sp_runtime::{
testing::UintAuthorityId,
Expand Down Expand Up @@ -227,29 +224,9 @@ mod tests {

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AuthorityId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

pub struct TestSessionHandler;
Expand Down
29 changes: 4 additions & 25 deletions substrate/frame/balances/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ use frame_support::{
dispatch::{DispatchInfo, GetDispatchInfo},
parameter_types,
traits::{
fungible, ConstU32, ConstU64, ConstU8, Imbalance as ImbalanceT, OnUnbalanced,
StorageMapShim, StoredMap, VariantCount, WhitelistedStorageKeys,
fungible, ConstU32, ConstU8, Imbalance as ImbalanceT, OnUnbalanced, StorageMapShim,
StoredMap, VariantCount, WhitelistedStorageKeys,
},
weights::{IdentityFee, Weight},
};
use frame_system::{self as system, RawOrigin};
use pallet_transaction_payment::{ChargeTransactionPayment, CurrencyAdapter, Multiplier};
use scale_info::TypeInfo;
use sp_core::{hexdisplay::HexDisplay, H256};
use sp_core::hexdisplay::HexDisplay;
use sp_io;
use sp_runtime::{
traits::{BadOrigin, IdentityLookup, SignedExtension, Zero},
traits::{BadOrigin, SignedExtension, Zero},
ArithmeticError, BuildStorage, DispatchError, DispatchResult, FixedPointNumber, RuntimeDebug,
TokenError,
};
Expand Down Expand Up @@ -92,29 +92,8 @@ parameter_types! {

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = BlockWeights;
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = super::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

impl pallet_transaction_payment::Config for Test {
Expand Down
22 changes: 1 addition & 21 deletions substrate/frame/bounties/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ use frame_support::{
PalletId,
};

use sp_core::H256;
use sp_runtime::{
traits::{BadOrigin, BlakeTwo256, IdentityLookup},
traits::{BadOrigin, IdentityLookup},
BuildStorage, Perbill, Storage,
};

Expand Down Expand Up @@ -61,29 +60,10 @@ type Balance = u64;

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u128; // u64 is not enough to hold bytes used to generate bounty account
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

impl pallet_balances::Config for Test {
Expand Down
Loading
Loading