Augmented node template docs (#6721)

This commit is contained in:
Dan Forbes
2020-07-24 06:30:48 -07:00
committed by GitHub
parent 9acb321f01
commit 68b2a09d21
7 changed files with 173 additions and 74 deletions
@@ -1,5 +1,3 @@
// Creating mock runtime here
use crate::{Module, Trait};
use sp_core::H256;
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
@@ -12,9 +10,8 @@ impl_outer_origin! {
pub enum Origin for Test {}
}
// For testing the pallet, we construct most of a mock runtime. This means
// first constructing a configuration type (`Test`) which `impl`s each of the
// configuration traits of pallets we want to use.
// Configure a mock runtime to test the pallet.
#[derive(Clone, Eq, PartialEq)]
pub struct Test;
parameter_types! {
@@ -23,6 +20,7 @@ parameter_types! {
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl system::Trait for Test {
type BaseCallFilter = ();
type Origin = Origin;
@@ -50,13 +48,14 @@ impl system::Trait for Test {
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
impl Trait for Test {
type Event = ();
}
pub type TemplateModule = Module<Test>;
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
// Build genesis storage according to the mock runtime.
pub fn new_test_ext() -> sp_io::TestExternalities {
system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
}