move some pallet test to use construct_runtime (#8049)

* migrate some more pallets

* revert example-offcahin-worker as not straightforward

* fix mmr
This commit is contained in:
Guillaume Thiolliere
2021-02-04 16:57:59 +01:00
committed by GitHub
parent 6dea5494f3
commit 86498a1a0c
13 changed files with 212 additions and 226 deletions
@@ -16,11 +16,10 @@
// limitations under the License.
use crate::*;
use crate as pallet_mmr;
use codec::{Encode, Decode};
use frame_support::{
impl_outer_origin, parameter_types,
};
use frame_support::parameter_types;
use pallet_mmr_primitives::{LeafDataProvider, Compact};
use sp_core::H256;
use sp_runtime::{
@@ -32,19 +31,27 @@ use sp_runtime::{
use sp_std::cell::RefCell;
use sp_std::prelude::*;
impl_outer_origin! {
pub enum Origin for Test where system = frame_system {}
}
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
MMR: pallet_mmr::{Module, Call, Storage},
}
);
#[derive(Clone, Eq, PartialEq, Encode, Decode)]
pub struct Test;
parameter_types! {
pub const BlockHashCount: u64 = 250;
}
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = ();
type Call = Call;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -52,13 +59,13 @@ impl frame_system::Config for Test {
type AccountId = sp_core::sr25519::Public;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = ();
type Event = Event;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -102,5 +109,3 @@ impl LeafDataProvider for LeafData {
LEAF_DATA.with(|r| r.borrow().clone())
}
}
pub(crate) type MMR = Module<Test>;