Moves all test runtimes to use derive_impl (#2409)

Step in https://github.com/paritytech/polkadot-sdk/issues/171

This PR adds `derive_impl` on all `frame_system` config impls for mock
runtimes. The overridden configs are maintained as of now to ensure
minimal changes.

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
gupnik
2023-11-28 18:43:57 +05:30
committed by GitHub
parent 6a417eb9c2
commit cd8741c8b5
130 changed files with 433 additions and 261 deletions
@@ -636,7 +636,7 @@ mod tests {
use crate::{assigned_slots, mock::TestRegistrar, slots};
use ::test_helpers::{dummy_head_data, dummy_validation_code};
use frame_support::{assert_noop, assert_ok, parameter_types};
use frame_support::{assert_noop, assert_ok, derive_impl, parameter_types};
use frame_system::EnsureRoot;
use pallet_balances;
use primitives::BlockNumber;
@@ -679,6 +679,8 @@ mod tests {
parameter_types! {
pub const BlockHashCount: u32 = 250;
}
#[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 = ();
+4 -1
View File
@@ -677,7 +677,8 @@ mod tests {
use crate::{auctions, mock::TestRegistrar};
use ::test_helpers::{dummy_hash, dummy_head_data, dummy_validation_code};
use frame_support::{
assert_noop, assert_ok, assert_storage_noop, ord_parameter_types, parameter_types,
assert_noop, assert_ok, assert_storage_noop, derive_impl, ord_parameter_types,
parameter_types,
traits::{ConstU32, EitherOfDiverse, OnFinalize, OnInitialize},
};
use frame_system::{EnsureRoot, EnsureSignedBy};
@@ -705,6 +706,8 @@ mod tests {
parameter_types! {
pub const BlockHashCount: u32 = 250;
}
#[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 = ();
+3 -1
View File
@@ -710,7 +710,7 @@ mod tests {
use crate::claims;
use claims::Call as ClaimsCall;
use frame_support::{
assert_err, assert_noop, assert_ok,
assert_err, assert_noop, assert_ok, derive_impl,
dispatch::{GetDispatchInfo, Pays},
ord_parameter_types, parameter_types,
traits::{ConstU32, ExistenceRequirement, WithdrawReasons},
@@ -739,6 +739,8 @@ mod tests {
parameter_types! {
pub const BlockHashCount: u32 = 250;
}
#[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 = ();
+2 -1
View File
@@ -863,7 +863,7 @@ mod tests {
use super::*;
use frame_support::{
assert_noop, assert_ok, parameter_types,
assert_noop, assert_ok, derive_impl, parameter_types,
traits::{ConstU32, OnFinalize, OnInitialize},
};
use primitives::Id as ParaId;
@@ -900,6 +900,7 @@ mod tests {
type BlockNumber = 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 = ();
+2
View File
@@ -192,6 +192,7 @@ pub mod benchmarks {
mod tests {
use super::*;
use frame_support::{
derive_impl,
dispatch::DispatchClass,
parameter_types,
traits::{
@@ -237,6 +238,7 @@ mod tests {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type RuntimeOrigin = RuntimeOrigin;
@@ -25,7 +25,7 @@ use crate::{
traits::{AuctionStatus, Auctioneer, Leaser, Registrar as RegistrarT},
};
use frame_support::{
assert_noop, assert_ok, parameter_types,
assert_noop, assert_ok, derive_impl, parameter_types,
traits::{ConstU32, Currency, OnFinalize, OnInitialize},
weights::Weight,
PalletId,
@@ -114,6 +114,7 @@ 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;
@@ -699,7 +699,7 @@ mod tests {
mock::conclude_pvf_checking, paras_registrar, traits::Registrar as RegistrarTrait,
};
use frame_support::{
assert_noop, assert_ok,
assert_noop, assert_ok, derive_impl,
error::BadOrigin,
parameter_types,
traits::{ConstU32, OnFinalize, OnInitialize},
@@ -751,6 +751,7 @@ mod tests {
limits::BlockLength::max_with_normal_ratio(4 * 1024 * 1024, NORMAL_RATIO);
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type RuntimeOrigin = RuntimeOrigin;
+3 -1
View File
@@ -484,7 +484,7 @@ mod tests {
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required.
use crate::purchase;
use frame_support::{
assert_noop, assert_ok, ord_parameter_types, parameter_types,
assert_noop, assert_ok, derive_impl, ord_parameter_types, parameter_types,
traits::{Currency, WithdrawReasons},
};
use sp_runtime::{
@@ -511,6 +511,8 @@ mod tests {
parameter_types! {
pub const BlockHashCount: u32 = 250;
}
#[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 = ();
+3 -1
View File
@@ -505,7 +505,7 @@ mod tests {
use crate::{mock::TestRegistrar, slots};
use ::test_helpers::{dummy_head_data, dummy_validation_code};
use frame_support::{assert_noop, assert_ok, parameter_types};
use frame_support::{assert_noop, assert_ok, derive_impl, parameter_types};
use frame_system::EnsureRoot;
use pallet_balances;
use primitives::BlockNumber;
@@ -529,6 +529,8 @@ mod tests {
parameter_types! {
pub const BlockHashCount: u32 = 250;
}
#[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 = ();