Use construct_runtime in tests (#8059)

* impl some more

* add serde

* remove unused

* fix staking fuzz

* fix system bench

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Guillaume Thiolliere
2021-02-06 21:12:46 +01:00
committed by GitHub
parent 4b1460f61f
commit 0ed683ca13
18 changed files with 446 additions and 445 deletions
+21 -23
View File
@@ -17,31 +17,29 @@
//! Mock file for staking fuzzing.
use frame_support::{impl_outer_origin, impl_outer_dispatch, parameter_types};
use frame_support::parameter_types;
type AccountId = u64;
type AccountIndex = u32;
type BlockNumber = u64;
type Balance = u64;
pub type System = frame_system::Module<Test>;
pub type Balances = pallet_balances::Module<Test>;
pub type Staking = pallet_staking::Module<Test>;
pub type Indices = pallet_indices::Module<Test>;
pub type Session = pallet_session::Module<Test>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
impl_outer_origin! {
pub enum Origin for Test where system = frame_system {}
}
impl_outer_dispatch! {
pub enum Call for Test where origin: Origin {
staking::Staking,
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
Staking: pallet_staking::{Module, Call, Config<T>, Storage, Event<T>, ValidateUnsigned},
Indices: pallet_indices::{Module, Call, Storage, Config<T>, Event<T>},
Session: pallet_session::{Module, Call, Storage, Event, Config<T>},
}
}
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct Test;
);
impl frame_system::Config for Test {
type BaseCallFilter = ();
@@ -57,10 +55,10 @@ impl frame_system::Config for Test {
type AccountId = AccountId;
type Lookup = Indices;
type Header = sp_runtime::testing::Header;
type Event = ();
type Event = Event;
type BlockHashCount = ();
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -73,7 +71,7 @@ parameter_types! {
impl pallet_balances::Config for Test {
type MaxLocks = ();
type Balance = Balance;
type Event = ();
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -81,7 +79,7 @@ impl pallet_balances::Config for Test {
}
impl pallet_indices::Config for Test {
type AccountIndex = AccountIndex;
type Event = ();
type Event = Event;
type Currency = Balances;
type Deposit = ();
type WeightInfo = ();
@@ -127,7 +125,7 @@ impl pallet_session::Config for Test {
type ShouldEndSession = pallet_session::PeriodicSessions<(), ()>;
type NextSessionRotation = pallet_session::PeriodicSessions<(), ()>;
type SessionHandler = TestSessionHandler;
type Event = ();
type Event = Event;
type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Test>;
type DisabledValidatorsThreshold = ();
@@ -163,7 +161,7 @@ impl pallet_staking::Config for Test {
type UnixTime = pallet_timestamp::Module<Self>;
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type RewardRemainder = ();
type Event = ();
type Event = Event;
type Slash = ();
type Reward = ();
type SessionsPerEra = ();