Skip to content

Commit

Permalink
use mock structs (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjj9219 authored Feb 18, 2021
1 parent 1e74be9 commit 266768b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 30 deletions.
4 changes: 2 additions & 2 deletions auction/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl Config for Runtime {
type WeightInfo = ();
}

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;

construct_runtime!(
pub enum Runtime where
Expand Down
6 changes: 3 additions & 3 deletions authority/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,16 @@ impl Config for Runtime {
type WeightInfo = ();
}

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, u64, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;

frame_support::construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Module, Call, Event<T>},
System: frame_system::{Module, Call, Config, Event<T>},
Authority: authority::{Module, Call, Origin<T>, Event<T>},
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>},
}
Expand Down
7 changes: 3 additions & 4 deletions currencies/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![cfg(test)]

use super::*;
use frame_support::{construct_runtime, parameter_types, traits::GenesisBuild};
use frame_support::{construct_runtime, parameter_types};
use orml_traits::parameter_type_with_key;
use sp_core::H256;
use sp_runtime::{
Expand Down Expand Up @@ -98,8 +98,8 @@ impl Config for Runtime {
pub type NativeCurrency = NativeCurrencyOf<Runtime>;
pub type AdaptedBasicCurrency = BasicCurrencyAdapter<Runtime, PalletBalances, i64, u64>;

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;

construct_runtime!(
pub enum Runtime where
Expand All @@ -111,7 +111,6 @@ construct_runtime!(
Currencies: currencies::{Module, Call, Event<T>},
Tokens: orml_tokens::{Module, Storage, Event<T>, Config<T>},
PalletBalances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},

}
);

Expand Down
4 changes: 2 additions & 2 deletions gradually-update/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ impl Config for Runtime {
type WeightInfo = ();
}

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;

construct_runtime!(
pub enum Runtime where
Expand Down
5 changes: 2 additions & 3 deletions nft/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ impl Config for Runtime {
type TokenData = ();
}

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;

construct_runtime!(
pub enum Runtime where
Expand All @@ -60,7 +60,6 @@ construct_runtime!(
{
System: frame_system::{Module, Call, Storage, Config, Event<T>},
NonFungibleTokenModule: nft::{Module, Storage, Config<T>},

}
);

Expand Down
7 changes: 3 additions & 4 deletions oracle/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use super::*;

use frame_support::{construct_runtime, parameter_types, traits::GenesisBuild};
use frame_support::{construct_runtime, parameter_types};
use sp_core::H256;
use sp_runtime::{
testing::Header,
Expand Down Expand Up @@ -83,8 +83,8 @@ impl Config for Test {
type WeightInfo = ();
}

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;

construct_runtime!(
pub enum Test where
Expand All @@ -94,7 +94,6 @@ construct_runtime!(
{
System: frame_system::{Module, Call, Storage, Config, Event<T>},
ModuleOracle: oracle::{Module, Storage, Call, Config<T>, Event<T>},

}
);

Expand Down
5 changes: 2 additions & 3 deletions rewards/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ impl Config for Runtime {
type WeightInfo = ();
}

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;

construct_runtime!(
pub enum Runtime where
Expand All @@ -120,7 +120,6 @@ construct_runtime!(
{
System: frame_system::{Module, Call, Storage, Config, Event<T>},
RewardsModule: rewards::{Module, Storage, Call},

}
);

Expand Down
6 changes: 3 additions & 3 deletions tokens/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use super::*;
use frame_support::{
construct_runtime, parameter_types,
traits::{ChangeMembers, Contains, ContainsLengthBound, GenesisBuild, SaturatingCurrencyToVote},
traits::{ChangeMembers, Contains, ContainsLengthBound, SaturatingCurrencyToVote},
};
use orml_traits::parameter_type_with_key;
use sp_core::H256;
Expand Down Expand Up @@ -217,8 +217,8 @@ impl Config for Runtime {
}
pub type TreasuryCurrencyAdapter = <Runtime as pallet_treasury::Config>::Currency;

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;

construct_runtime!(
pub enum Runtime where
Expand Down
9 changes: 3 additions & 6 deletions vesting/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
#![cfg(test)]

use super::*;
use frame_support::{
construct_runtime, parameter_types,
traits::{EnsureOrigin, GenesisBuild},
};
use frame_support::{construct_runtime, parameter_types, traits::EnsureOrigin};
use frame_system::RawOrigin;
use sp_core::H256;
use sp_runtime::{testing::Header, traits::IdentityLookup};
Expand Down Expand Up @@ -86,8 +83,8 @@ impl Config for Runtime {
type WeightInfo = ();
}

pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;

construct_runtime!(
pub enum Runtime where
Expand Down

0 comments on commit 266768b

Please sign in to comment.