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