mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-04-21 23:47:56 +00:00
Use construct runtime v2 (#312)
* construct runtime macro updated to v2
This commit is contained in:
@@ -14,9 +14,8 @@ pub use precompiles::OpenZeppelinPrecompiles;
|
||||
mod types;
|
||||
mod weights;
|
||||
|
||||
use frame_support::{
|
||||
construct_runtime,
|
||||
weights::{WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial},
|
||||
use frame_support::weights::{
|
||||
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||
};
|
||||
use smallvec::smallvec;
|
||||
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
@@ -170,56 +169,97 @@ pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
// Create the runtime by composing the FRAME pallets that were previously
|
||||
// configured.
|
||||
construct_runtime!(
|
||||
pub enum Runtime
|
||||
{
|
||||
// System Support
|
||||
System: frame_system = 0,
|
||||
ParachainSystem: cumulus_pallet_parachain_system = 1,
|
||||
Timestamp: pallet_timestamp = 2,
|
||||
ParachainInfo: parachain_info = 3,
|
||||
Proxy: pallet_proxy = 4,
|
||||
Utility: pallet_utility = 5,
|
||||
Multisig: pallet_multisig = 6,
|
||||
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 7,
|
||||
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 8,
|
||||
#[frame_support::runtime]
|
||||
mod runtime {
|
||||
#[runtime::runtime]
|
||||
#[runtime::derive(
|
||||
RuntimeCall,
|
||||
RuntimeEvent,
|
||||
RuntimeError,
|
||||
RuntimeOrigin,
|
||||
RuntimeFreezeReason,
|
||||
RuntimeHoldReason,
|
||||
RuntimeSlashReason,
|
||||
RuntimeLockId,
|
||||
RuntimeTask
|
||||
)]
|
||||
pub struct Runtime;
|
||||
|
||||
// Monetary
|
||||
Balances: pallet_balances = 10,
|
||||
TransactionPayment: pallet_transaction_payment = 11,
|
||||
Assets: pallet_assets = 12,
|
||||
Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>} = 13,
|
||||
AssetManager: pallet_asset_manager = 14,
|
||||
#[runtime::pallet_index(0)]
|
||||
pub type System = frame_system;
|
||||
#[runtime::pallet_index(1)]
|
||||
pub type ParachainSystem = cumulus_pallet_parachain_system;
|
||||
#[runtime::pallet_index(2)]
|
||||
pub type Timestamp = pallet_timestamp;
|
||||
#[runtime::pallet_index(3)]
|
||||
pub type ParachainInfo = parachain_info;
|
||||
#[runtime::pallet_index(4)]
|
||||
pub type Proxy = pallet_proxy;
|
||||
#[runtime::pallet_index(5)]
|
||||
pub type Utility = pallet_utility;
|
||||
#[runtime::pallet_index(6)]
|
||||
pub type Multisig = pallet_multisig;
|
||||
#[runtime::pallet_index(7)]
|
||||
pub type Scheduler = pallet_scheduler;
|
||||
#[runtime::pallet_index(8)]
|
||||
pub type Preimage = pallet_preimage;
|
||||
|
||||
// Governance
|
||||
Sudo: pallet_sudo = 15,
|
||||
ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event<T>} = 16,
|
||||
Referenda: pallet_referenda::{Pallet, Call, Storage, Event<T>} = 17,
|
||||
Origins: pallet_custom_origins::{Origin} = 18,
|
||||
Whitelist: pallet_whitelist::{Pallet, Call, Storage, Event<T>} = 19,
|
||||
// Monetary stuff.
|
||||
#[runtime::pallet_index(10)]
|
||||
pub type Balances = pallet_balances;
|
||||
#[runtime::pallet_index(11)]
|
||||
pub type TransactionPayment = pallet_transaction_payment;
|
||||
#[runtime::pallet_index(12)]
|
||||
pub type Assets = pallet_assets;
|
||||
#[runtime::pallet_index(13)]
|
||||
pub type Treasury = pallet_treasury;
|
||||
#[runtime::pallet_index(14)]
|
||||
pub type AssetManager = pallet_asset_manager;
|
||||
|
||||
// Collator Support. The order of these 4 are important and shall not change.
|
||||
Authorship: pallet_authorship = 20,
|
||||
CollatorSelection: pallet_collator_selection = 21,
|
||||
Session: pallet_session = 22,
|
||||
Aura: pallet_aura = 23,
|
||||
AuraExt: cumulus_pallet_aura_ext = 24,
|
||||
// Governance
|
||||
#[runtime::pallet_index(15)]
|
||||
pub type Sudo = pallet_sudo;
|
||||
#[runtime::pallet_index(16)]
|
||||
pub type ConvictionVoting = pallet_conviction_voting;
|
||||
#[runtime::pallet_index(17)]
|
||||
pub type Referenda = pallet_referenda;
|
||||
#[runtime::pallet_index(18)]
|
||||
pub type Origins = pallet_custom_origins;
|
||||
#[runtime::pallet_index(19)]
|
||||
pub type Whitelist = pallet_whitelist;
|
||||
|
||||
// XCM Helpers
|
||||
XcmpQueue: cumulus_pallet_xcmp_queue = 30,
|
||||
PolkadotXcm: pallet_xcm = 31,
|
||||
CumulusXcm: cumulus_pallet_xcm = 32,
|
||||
MessageQueue: pallet_message_queue = 33,
|
||||
// Collator support. The order of these 4 are important and shall not change.
|
||||
#[runtime::pallet_index(20)]
|
||||
pub type Authorship = pallet_authorship;
|
||||
#[runtime::pallet_index(21)]
|
||||
pub type CollatorSelection = pallet_collator_selection;
|
||||
#[runtime::pallet_index(22)]
|
||||
pub type Session = pallet_session;
|
||||
#[runtime::pallet_index(23)]
|
||||
pub type Aura = pallet_aura;
|
||||
#[runtime::pallet_index(24)]
|
||||
pub type AuraExt = cumulus_pallet_aura_ext;
|
||||
|
||||
// EVM
|
||||
Ethereum: pallet_ethereum = 40,
|
||||
EVM: pallet_evm = 41,
|
||||
BaseFee: pallet_base_fee = 42,
|
||||
EVMChainId: pallet_evm_chain_id = 43,
|
||||
}
|
||||
);
|
||||
// XCM helpers.
|
||||
#[runtime::pallet_index(30)]
|
||||
pub type XcmpQueue = cumulus_pallet_xcmp_queue;
|
||||
#[runtime::pallet_index(31)]
|
||||
pub type PolkadotXcm = pallet_xcm;
|
||||
#[runtime::pallet_index(32)]
|
||||
pub type CumulusXcm = cumulus_pallet_xcm;
|
||||
#[runtime::pallet_index(33)]
|
||||
pub type MessageQueue = pallet_message_queue;
|
||||
|
||||
// EVM
|
||||
#[runtime::pallet_index(40)]
|
||||
pub type Ethereum = pallet_ethereum;
|
||||
#[runtime::pallet_index(41)]
|
||||
pub type EVM = pallet_evm;
|
||||
#[runtime::pallet_index(42)]
|
||||
pub type BaseFee = pallet_base_fee;
|
||||
#[runtime::pallet_index(43)]
|
||||
pub type EVMChainId = pallet_evm_chain_id;
|
||||
}
|
||||
|
||||
cumulus_pallet_parachain_system::register_validate_block! {
|
||||
Runtime = Runtime,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#![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"]
|
||||
|
||||
// Make the WASM binary available.
|
||||
@@ -12,9 +11,8 @@ pub mod constants;
|
||||
mod types;
|
||||
mod weights;
|
||||
|
||||
use frame_support::{
|
||||
construct_runtime,
|
||||
weights::{WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial},
|
||||
use frame_support::weights::{
|
||||
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||
};
|
||||
use smallvec::smallvec;
|
||||
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
@@ -107,49 +105,85 @@ pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
// Create the runtime by composing the FRAME pallets that were previously
|
||||
// configured.
|
||||
construct_runtime!(
|
||||
pub enum Runtime
|
||||
{
|
||||
// System Support
|
||||
System: frame_system = 0,
|
||||
ParachainSystem: cumulus_pallet_parachain_system = 1,
|
||||
Timestamp: pallet_timestamp = 2,
|
||||
ParachainInfo: parachain_info = 3,
|
||||
Proxy: pallet_proxy = 4,
|
||||
Utility: pallet_utility = 5,
|
||||
Multisig: pallet_multisig = 6,
|
||||
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 7,
|
||||
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 8,
|
||||
#[frame_support::runtime]
|
||||
mod runtime {
|
||||
#[runtime::runtime]
|
||||
#[runtime::derive(
|
||||
RuntimeCall,
|
||||
RuntimeEvent,
|
||||
RuntimeError,
|
||||
RuntimeOrigin,
|
||||
RuntimeFreezeReason,
|
||||
RuntimeHoldReason,
|
||||
RuntimeSlashReason,
|
||||
RuntimeLockId,
|
||||
RuntimeTask
|
||||
)]
|
||||
pub struct Runtime;
|
||||
|
||||
// Monetary
|
||||
Balances: pallet_balances = 10,
|
||||
TransactionPayment: pallet_transaction_payment = 11,
|
||||
Assets: pallet_assets = 12,
|
||||
Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>} = 13,
|
||||
#[runtime::pallet_index(0)]
|
||||
pub type System = frame_system;
|
||||
#[runtime::pallet_index(1)]
|
||||
pub type ParachainSystem = cumulus_pallet_parachain_system;
|
||||
#[runtime::pallet_index(2)]
|
||||
pub type Timestamp = pallet_timestamp;
|
||||
#[runtime::pallet_index(3)]
|
||||
pub type ParachainInfo = parachain_info;
|
||||
#[runtime::pallet_index(4)]
|
||||
pub type Proxy = pallet_proxy;
|
||||
#[runtime::pallet_index(5)]
|
||||
pub type Utility = pallet_utility;
|
||||
#[runtime::pallet_index(6)]
|
||||
pub type Multisig = pallet_multisig;
|
||||
#[runtime::pallet_index(7)]
|
||||
pub type Scheduler = pallet_scheduler;
|
||||
#[runtime::pallet_index(8)]
|
||||
pub type Preimage = pallet_preimage;
|
||||
|
||||
// Governance
|
||||
Sudo: pallet_sudo = 15,
|
||||
ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event<T>} = 16,
|
||||
Referenda: pallet_referenda::{Pallet, Call, Storage, Event<T>} = 17,
|
||||
Origins: pallet_custom_origins::{Origin} = 18,
|
||||
Whitelist: pallet_whitelist::{Pallet, Call, Storage, Event<T>} = 19,
|
||||
// Monetary stuff.
|
||||
#[runtime::pallet_index(10)]
|
||||
pub type Balances = pallet_balances;
|
||||
#[runtime::pallet_index(11)]
|
||||
pub type TransactionPayment = pallet_transaction_payment;
|
||||
#[runtime::pallet_index(12)]
|
||||
pub type Assets = pallet_assets;
|
||||
#[runtime::pallet_index(13)]
|
||||
pub type Treasury = pallet_treasury;
|
||||
|
||||
// Collator Support. The order of these 4 are important and shall not change.
|
||||
Authorship: pallet_authorship = 20,
|
||||
CollatorSelection: pallet_collator_selection = 21,
|
||||
Session: pallet_session = 22,
|
||||
Aura: pallet_aura = 23,
|
||||
AuraExt: cumulus_pallet_aura_ext = 24,
|
||||
// Governance
|
||||
#[runtime::pallet_index(15)]
|
||||
pub type Sudo = pallet_sudo;
|
||||
#[runtime::pallet_index(16)]
|
||||
pub type ConvictionVoting = pallet_conviction_voting;
|
||||
#[runtime::pallet_index(17)]
|
||||
pub type Referenda = pallet_referenda;
|
||||
#[runtime::pallet_index(18)]
|
||||
pub type Origins = pallet_custom_origins;
|
||||
#[runtime::pallet_index(19)]
|
||||
pub type Whitelist = pallet_whitelist;
|
||||
|
||||
// XCM Helpers
|
||||
XcmpQueue: cumulus_pallet_xcmp_queue = 30,
|
||||
PolkadotXcm: pallet_xcm = 31,
|
||||
CumulusXcm: cumulus_pallet_xcm = 32,
|
||||
MessageQueue: pallet_message_queue = 33,
|
||||
}
|
||||
);
|
||||
// Collator support. The order of these 4 are important and shall not change.
|
||||
#[runtime::pallet_index(20)]
|
||||
pub type Authorship = pallet_authorship;
|
||||
#[runtime::pallet_index(21)]
|
||||
pub type CollatorSelection = pallet_collator_selection;
|
||||
#[runtime::pallet_index(22)]
|
||||
pub type Session = pallet_session;
|
||||
#[runtime::pallet_index(23)]
|
||||
pub type Aura = pallet_aura;
|
||||
#[runtime::pallet_index(24)]
|
||||
pub type AuraExt = cumulus_pallet_aura_ext;
|
||||
|
||||
// XCM helpers.
|
||||
#[runtime::pallet_index(30)]
|
||||
pub type XcmpQueue = cumulus_pallet_xcmp_queue;
|
||||
#[runtime::pallet_index(31)]
|
||||
pub type PolkadotXcm = pallet_xcm;
|
||||
#[runtime::pallet_index(32)]
|
||||
pub type CumulusXcm = cumulus_pallet_xcm;
|
||||
#[runtime::pallet_index(33)]
|
||||
pub type MessageQueue = pallet_message_queue;
|
||||
}
|
||||
|
||||
cumulus_pallet_parachain_system::register_validate_block! {
|
||||
Runtime = Runtime,
|
||||
|
||||
Reference in New Issue
Block a user