Skip to content

Commit

Permalink
Addresses review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gupnik committed Nov 27, 2023
1 parent 6e68edb commit 6656ae7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 77 deletions.
40 changes: 5 additions & 35 deletions cumulus/parachain-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,43 +273,13 @@ parameter_types! {
pub const SS58Prefix: u16 = 42;
}

// Configure FRAME pallets to include in runtime.
/// Configure FRAME pallets to include in runtime.
///
/// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from
/// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`),
/// but overridden as needed.
#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
/// The following are being injected by [`derive_impl`](`frame_support::derive_impl`) from
/// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`),
/// but can be overridden if needed.
///
/// The aggregated dispatch type that is available for extrinsics.
/// type RuntimeCall = RuntimeCall;
///
/// The ubiquitous event type.
/// type RuntimeEvent = RuntimeEvent;
///
/// The ubiquitous origin type.
/// type RuntimeOrigin = RuntimeOrigin;
///
/// Converts a module to an index of this module in the runtime.
/// type PalletInfo = PalletInfo;
///
/// The basic call filter to use in dispatchable.
/// type BaseCallFilter = Everything;
///
/// Weight information for the extrinsics of this pallet.
/// type SystemWeightInfo = ();
///
/// What to do if a new account is created.
/// type OnNewAccount = ();
///
/// What to do if an account is fully reaped from the system.
/// type OnKilledAccount = ();
///
/// The hashing algorithm used.
/// type Hashing = BlakeTwo256;
///
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
/// type Lookup = AccountIdLookup<AccountId, ()>;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The index type for storing how many extrinsics an account has signed.
Expand Down
48 changes: 6 additions & 42 deletions substrate/bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, One, Verify,
},
traits::{BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, One, Verify},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, MultiSignature,
};
Expand Down Expand Up @@ -151,45 +149,13 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}

// Configure FRAME pallets to include in runtime.

/// Configure FRAME pallets to include in runtime.
///
/// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from
/// [`SoloChainDefaultConfig`](`struct@frame_system::config_preludes::SolochainDefaultConfig`),
/// but overridden as needed.
#[derive_impl(frame_system::config_preludes::SolochainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
/// The following are being injected by [`derive_impl`](`frame_support::derive_impl`) from
/// [`SoloChainDefaultConfig`](`struct@frame_system::config_preludes::SolochainDefaultConfig`),
/// but can be overridden if needed.
///
/// The ubiquitous event type.
/// type RuntimeEvent = RuntimeEvent;
///
/// The aggregated dispatch type that is available for extrinsics.
/// type RuntimeCall = RuntimeCall;
///
/// The ubiquitous origin type.
/// type RuntimeOrigin = RuntimeOrigin;
///
/// Converts a module to the index of the module in `construct_runtime!`.
///
/// This type is being generated by `construct_runtime!`.
/// type PalletInfo = PalletInfo;
///
/// What to do if a new account is created.
/// type OnNewAccount = ();
///
/// What to do if an account is fully reaped from the system.
/// type OnKilledAccount = ();
///
/// The set code logic, just the default since we're not a parachain.
/// type OnSetCode = ();
///
/// The hashing algorithm used.
/// type Hashing = BlakeTwo256;
///
/// Weight information for the extrinsics of this pallet.
/// type SystemWeightInfo = ();
/// The basic call filter to use in dispatchable.
type BaseCallFilter = frame_support::traits::Everything;
/// The block type for the runtime.
type Block = Block;
/// Block & extrinsics weights: base values and limits.
Expand All @@ -198,8 +164,6 @@ impl frame_system::Config for Runtime {
type BlockLength = BlockLength;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
/// The type for storing how many extrinsics an account has signed.
type Nonce = Nonce;
/// The type for hashing blocks and tries.
Expand Down
45 changes: 45 additions & 0 deletions substrate/frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,31 +263,76 @@ pub mod pallet {

#[frame_support::register_default_impl(SolochainDefaultConfig)]
impl DefaultConfig for SolochainDefaultConfig {
/// The default type for storing how many extrinsics an account has signed.
type Nonce = u32;

/// The default type for hashing blocks and tries.
type Hash = sp_core::hash::H256;

/// The default hashing algorithm used.
type Hashing = sp_runtime::traits::BlakeTwo256;

/// The default identifier used to distinguish between accounts.
type AccountId = sp_runtime::AccountId32;

/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = sp_runtime::traits::AccountIdLookup<Self::AccountId, ()>;

/// The maximum number of consumers allowed on a single account. Using 128 as default.
type MaxConsumers = frame_support::traits::ConstU32<128>;

/// The default data to be stored in an account.
type AccountData = crate::AccountInfo<Self::Nonce, ()>;

/// What to do if a new account is created.
type OnNewAccount = ();

/// What to do if an account is fully reaped from the system.
type OnKilledAccount = ();

/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();

/// This is used as an identifier of the chain.
type SS58Prefix = ();

/// Version of the runtime.
type Version = ();

/// Block & extrinsics weights: base values and limits.
type BlockWeights = ();

/// The maximum length of a block (in bytes).
type BlockLength = ();

/// The weight of database operations that the runtime can invoke.
type DbWeight = ();

/// The ubiquitous event type injected by `construct_runtime!`.
#[inject_runtime_type]
type RuntimeEvent = ();

/// The ubiquitous origin type injected by `construct_runtime!`.
#[inject_runtime_type]
type RuntimeOrigin = ();

/// The aggregated dispatch type available for extrinsics, injected by
/// `construct_runtime!`.
#[inject_runtime_type]
type RuntimeCall = ();

/// Converts a module to the index of the module, injected by `construct_runtime!`.
#[inject_runtime_type]
type PalletInfo = ();

/// The basic call filter to use in dispatchable. Supports everything as the default.
type BaseCallFilter = frame_support::traits::Everything;

/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
/// Using 256 as default.
type BlockHashCount = frame_support::traits::ConstU32<256>;

/// The set code logic, just the default since we're not a parachain.
type OnSetCode = ();
}

Expand Down

0 comments on commit 6656ae7

Please sign in to comment.