Skip to content
Snippets Groups Projects
Unverified Commit 82bfe284 authored by Adrian Catangiu's avatar Adrian Catangiu Committed by GitHub
Browse files

frame: use derive-impl for beefy and mmr pallets (#1867)

Part of #171
parent 83206000
No related merge requests found
Pipeline #400332 passed with stages
in 38 minutes and 51 seconds
...@@ -19,16 +19,15 @@ use std::vec; ...@@ -19,16 +19,15 @@ use std::vec;
use codec::Encode; use codec::Encode;
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, derive_impl, parameter_types,
traits::{ConstU16, ConstU32, ConstU64}, traits::{ConstU32, ConstU64},
}; };
use sp_consensus_beefy::mmr::MmrLeafVersion; use sp_consensus_beefy::mmr::MmrLeafVersion;
use sp_core::H256;
use sp_io::TestExternalities; use sp_io::TestExternalities;
use sp_runtime::{ use sp_runtime::{
app_crypto::ecdsa::Public, app_crypto::ecdsa::Public,
impl_opaque_keys, impl_opaque_keys,
traits::{BlakeTwo256, ConvertInto, IdentityLookup, Keccak256, OpaqueKeys}, traits::{ConvertInto, Keccak256, OpaqueKeys},
BuildStorage, BuildStorage,
}; };
use sp_state_machine::BasicExternalities; use sp_state_machine::BasicExternalities;
...@@ -58,30 +57,9 @@ construct_runtime!( ...@@ -58,30 +57,9 @@ construct_runtime!(
} }
); );
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test { 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 Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
} }
impl pallet_session::Config for Test { impl pallet_session::Config for Test {
......
...@@ -22,19 +22,15 @@ use frame_election_provider_support::{ ...@@ -22,19 +22,15 @@ use frame_election_provider_support::{
onchain, SequentialPhragmen, onchain, SequentialPhragmen,
}; };
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, derive_impl, parameter_types,
traits::{ConstU16, ConstU32, ConstU64, KeyOwnerProofSystem, OnFinalize, OnInitialize}, traits::{ConstU32, ConstU64, KeyOwnerProofSystem, OnFinalize, OnInitialize},
}; };
use pallet_session::historical as pallet_session_historical; use pallet_session::historical as pallet_session_historical;
use sp_core::{crypto::KeyTypeId, ConstU128, H256}; use sp_core::{crypto::KeyTypeId, ConstU128};
use sp_io::TestExternalities; use sp_io::TestExternalities;
use sp_runtime::{ use sp_runtime::{
app_crypto::ecdsa::Public, app_crypto::ecdsa::Public, curve::PiecewiseLinear, impl_opaque_keys, testing::TestXt,
curve::PiecewiseLinear, traits::OpaqueKeys, BuildStorage, Perbill,
impl_opaque_keys,
testing::TestXt,
traits::{BlakeTwo256, IdentityLookup, OpaqueKeys},
BuildStorage, Perbill,
}; };
use sp_staking::{EraIndex, SessionIndex}; use sp_staking::{EraIndex, SessionIndex};
use sp_state_machine::BasicExternalities; use sp_state_machine::BasicExternalities;
...@@ -69,30 +65,10 @@ construct_runtime!( ...@@ -69,30 +65,10 @@ construct_runtime!(
} }
); );
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test { 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 Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u128>; type AccountData = pallet_balances::AccountData<u128>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
} }
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
......
...@@ -19,13 +19,9 @@ use crate as pallet_mmr; ...@@ -19,13 +19,9 @@ use crate as pallet_mmr;
use crate::*; use crate::*;
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::{ use frame_support::{derive_impl, parameter_types};
parameter_types,
traits::{ConstU32, ConstU64},
};
use sp_core::H256;
use sp_mmr_primitives::{Compact, LeafDataProvider}; use sp_mmr_primitives::{Compact, LeafDataProvider};
use sp_runtime::traits::{BlakeTwo256, IdentityLookup, Keccak256}; use sp_runtime::traits::Keccak256;
type Block = frame_system::mocking::MockBlock<Test>; type Block = frame_system::mocking::MockBlock<Test>;
...@@ -37,30 +33,9 @@ frame_support::construct_runtime!( ...@@ -37,30 +33,9 @@ frame_support::construct_runtime!(
} }
); );
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test { impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = sp_core::sr25519::Public;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block; type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
} }
impl Config for Test { impl Config for Test {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment