Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 1 addition & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

178 changes: 28 additions & 150 deletions templates/parachain/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,180 +20,58 @@ docify = { workspace = true }
codec = { features = [
"derive",
], workspace = true }
hex-literal = { optional = true, workspace = true, default-features = true }
log = { workspace = true }
scale-info = { features = [
"derive",
], workspace = true }
smallvec = { workspace = true, default-features = true }
docify = { workspace = true }
serde_json = { workspace = true, default-features = false }
polkadot-sdk = { workspace = true, features = [
"experimental",
"runtime", # TODO: We only need this to enable `polkadot-sdk-frame?/runtime`.
"runtime-full",
"pallet-aura",
"pallet-authorship",
"pallet-balances",
"pallet-message-queue",
"pallet-session",
"pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
] }
cumulus-pallet-parachain-system = { workspace = true, default-features = false }

# Local
pallet-parachain-template = { workspace = true }

# Substrate / FRAME
frame-benchmarking = { optional = true, workspace = true }
frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-support = { features = ["experimental"], workspace = true }
frame-system = { workspace = true }
frame-system-benchmarking = { optional = true, workspace = true }
frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { optional = true, workspace = true }

# FRAME Pallets
pallet-aura = { workspace = true }
pallet-authorship = { workspace = true }
pallet-balances = { workspace = true }
pallet-message-queue = { workspace = true }
pallet-session = { workspace = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }

# Substrate Primitives
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-core = { workspace = true }
sp-genesis-builder = { workspace = true }
sp-inherents = { workspace = true }
sp-offchain = { workspace = true }
sp-runtime = { workspace = true }
sp-session = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }

# Polkadot
pallet-xcm = { workspace = true }
polkadot-parachain-primitives = { workspace = true }
polkadot-runtime-common = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-session-benchmarking = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
cumulus-primitives-aura = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-utility = { workspace = true }
cumulus-primitives-storage-weight-reclaim = { workspace = true }
pallet-collator-selection = { workspace = true }
parachains-common = { workspace = true }
parachain-info = { workspace = true }
hex-literal = { optional = true, workspace = true, default-features = true }
log = { workspace = true }
smallvec = { workspace = true, default-features = true }
docify = { workspace = true }
serde_json = { workspace = true, default-features = false }

[features]
default = ["std"]
std = [
"polkadot-sdk/std",
"codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-session-benchmarking/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
"cumulus-primitives-aura/std",
"cumulus-primitives-core/std",
"cumulus-primitives-storage-weight-reclaim/std",
"cumulus-primitives-utility/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"frame-try-runtime?/std",
"log/std",
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-message-queue/std",
"pallet-parachain-template/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-xcm/std",
"parachain-info/std",
"parachains-common/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"scale-info/std",
"serde_json/std",
"sp-api/std",
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
"sp-session/std",
"sp-transaction-pool/std",
"sp-version/std",
"substrate-wasm-builder",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
"cumulus-pallet-parachain-system/std",
"pallet-parachain-template/std"
]

runtime-benchmarks = [
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"cumulus-primitives-utility/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"polkadot-sdk/runtime-benchmarks",
"hex-literal",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-parachain-template/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"pallet-parachain-template/runtime-benchmarks"
]

try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
"polkadot-sdk/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-xcm/try-runtime",
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-parachain-template/try-runtime",
"pallet-session/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
"pallet-parachain-template/try-runtime"
]

# Enable the metadata hash generation.
Expand Down
2 changes: 2 additions & 0 deletions templates/parachain/runtime/src/apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

// External crates imports
use alloc::vec::Vec;
use polkadot_sdk::*;

use frame_support::{
genesis_builder_helper::{build_state, get_preset},
weights::Weight,
Expand Down
42 changes: 20 additions & 22 deletions templates/parachain/runtime/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,29 @@

mod xcm_config;

// Substrate and Polkadot dependencies
use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
use frame_support::{
derive_impl,
dispatch::DispatchClass,
parameter_types,
traits::{
ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, TransformOrigin, VariantCountOf,
// Polkadot-sdk dependencies
use frame::{
deps::{
frame_support::{weights::ConstantMultiplier, PalletId},
frame_system::limits::{BlockLength, BlockWeights},
},
weights::{ConstantMultiplier, Weight},
PalletId,
traits::{EitherOfDiverse, TransformOrigin, VariantCountOf},
};
use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot,
};
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
use polkadot_runtime_common::{
xcm_sender::NoPriceForMessageDelivery, BlockHashCount, SlowAdjustingFeeUpdate,
use polkadot_sdk::{
cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases,
cumulus_primitives_core::{AggregateMessageOrigin, ParaId},
pallet_xcm::{EnsureXcm, IsVoiceOfBody},
parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling},
polkadot_runtime_common::{
xcm_sender::NoPriceForMessageDelivery, BlockHashCount, SlowAdjustingFeeUpdate,
},
polkadot_sdk_frame::{self as frame, prelude::*, runtime::prelude::*},
sp_consensus_aura::sr25519::AuthorityId as AuraId,
sp_runtime::Perbill,
sp_version::RuntimeVersion,
staging_parachain_info as parachain_info, staging_xcm as xcm,
staging_xcm_builder as xcm_builder, staging_xcm_executor as xcm_executor, *,
};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_runtime::Perbill;
use sp_version::RuntimeVersion;
use xcm::latest::prelude::BodyId;

// Local module imports
Expand Down
12 changes: 6 additions & 6 deletions templates/parachain/runtime/src/configs/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use crate::{
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
use frame_support::{
parameter_types,
traits::{ConstU32, Contains, Everything, Nothing},
weights::Weight,
};
use frame_system::EnsureRoot;
use frame::traits::{Contains, Everything, Nothing};
use pallet_xcm::XcmPassthrough;
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use polkadot_sdk::{
polkadot_sdk_frame::{self as frame, prelude::*, runtime::prelude::*},
staging_xcm as xcm, staging_xcm_builder as xcm_builder, staging_xcm_executor as xcm_executor,
*,
};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
Expand Down
21 changes: 10 additions & 11 deletions templates/parachain/runtime/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use cumulus_primitives_core::ParaId;

pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use polkadot_sdk::{
cumulus_primitives_core::ParaId,
sp_consensus_aura::sr25519::AuthorityId as AuraId,
sp_core::{sr25519, Pair, Public},
sp_genesis_builder::{PresetId, DEV_RUNTIME_PRESET},
sp_runtime::traits::{IdentifyAccount, Verify},
staging_xcm as xcm,
};

use crate::{AccountId, SessionKeys, Signature, EXISTENTIAL_DEPOSIT};
use alloc::{format, vec, vec::Vec};
use serde_json::Value;
use sp_core::{sr25519, Pair, Public};
use sp_genesis_builder::PresetId;
use sp_runtime::traits::{IdentifyAccount, Verify};

/// Preset configuration name for a local testnet environment.
pub const PRESET_LOCAL_TESTNET: &str = "local_testnet";
Expand Down Expand Up @@ -150,7 +152,7 @@ fn development_config_genesis() -> Value {
pub fn get_preset(id: &PresetId) -> Option<vec::Vec<u8>> {
let patch = match id.try_into() {
Ok(PRESET_LOCAL_TESTNET) => local_testnet_genesis(),
Ok(sp_genesis_builder::DEV_RUNTIME_PRESET) => development_config_genesis(),
Ok(DEV_RUNTIME_PRESET) => development_config_genesis(),
_ => return None,
};
Some(
Expand All @@ -162,8 +164,5 @@ pub fn get_preset(id: &PresetId) -> Option<vec::Vec<u8>> {

/// List of supported presets.
pub fn preset_names() -> Vec<PresetId> {
vec![
PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET),
PresetId::from(PRESET_LOCAL_TESTNET),
]
vec![PresetId::from(DEV_RUNTIME_PRESET), PresetId::from(PRESET_LOCAL_TESTNET)]
}
Loading