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 @@
//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit="256"]
@@ -40,7 +38,7 @@ pub use frame_support::{
},
};
/// Importing a template pallet
/// Import the template pallet.
pub use template;
/// An index to a block.
@@ -93,7 +91,6 @@ pub mod opaque {
}
}
/// This runtime version.
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("node-template"),
impl_name: create_runtime_str!("node-template"),
@@ -108,7 +105,7 @@ pub const MILLISECS_PER_BLOCK: u64 = 6000;
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
// These time units are defined in number of blocks.
// Time is measured by number of blocks.
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;
@@ -134,6 +131,8 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}
// Configure FRAME pallets to include in runtime.
impl system::Trait for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = ();
@@ -258,11 +257,12 @@ impl sudo::Trait for Runtime {
type Call = Call;
}
/// Used for the module template in `./template.rs`
/// Configure the pallet template in pallets/template.
impl template::Trait for Runtime {
type Event = Event;
}
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
Block = Block,
@@ -277,7 +277,7 @@ construct_runtime!(
Balances: balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: transaction_payment::{Module, Storage},
Sudo: sudo::{Module, Call, Config<T>, Storage, Event<T>},
// Used for the module template in `./template.rs`
// Include the custom logic from the template pallet in the runtime.
TemplateModule: template::{Module, Call, Storage, Event<T>},
}
);