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
@@ -20,30 +20,28 @@
#![cfg(test)]
use sp_runtime::traits::IdentityLookup;
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;
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type Staking = pallet_staking::Module<Test>;
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 {
pallet_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},
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 = ();
@@ -59,10 +57,10 @@ impl frame_system::Config for Test {
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
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 = ();
@@ -75,7 +73,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;
@@ -123,7 +121,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 = ();
@@ -159,7 +157,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 = ();