Replace free for all collation in cumulus runtimes (#1251)

Partially fixes #103 

This PR removes instances of "free for all" collation in the `glutton`,
`shell`, and `seedling` runtimes and replaces them with Aura instances.
Aura is configured without a session manager, so the initial authority
set cannot be changed later on.

---------

Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
This commit is contained in:
georgepisaltu
2023-09-18 18:17:14 +03:00
committed by GitHub
parent e6f5e23b0f
commit a181ced46b
12 changed files with 378 additions and 43 deletions
Generated
+14
View File
@@ -5788,9 +5788,11 @@ dependencies = [
name = "glutton-runtime" name = "glutton-runtime"
version = "1.0.0" version = "1.0.0"
dependencies = [ dependencies = [
"cumulus-pallet-aura-ext",
"cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system",
"cumulus-pallet-xcm", "cumulus-pallet-xcm",
"cumulus-primitives-core", "cumulus-primitives-core",
"cumulus-primitives-timestamp",
"frame-benchmarking", "frame-benchmarking",
"frame-executive", "frame-executive",
"frame-support", "frame-support",
@@ -5798,14 +5800,17 @@ dependencies = [
"frame-system-benchmarking", "frame-system-benchmarking",
"frame-system-rpc-runtime-api", "frame-system-rpc-runtime-api",
"frame-try-runtime", "frame-try-runtime",
"pallet-aura",
"pallet-glutton", "pallet-glutton",
"pallet-sudo", "pallet-sudo",
"pallet-timestamp",
"parachain-info", "parachain-info",
"parachains-common", "parachains-common",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
"sp-api", "sp-api",
"sp-block-builder", "sp-block-builder",
"sp-consensus-aura",
"sp-core", "sp-core",
"sp-inherents", "sp-inherents",
"sp-offchain", "sp-offchain",
@@ -16058,20 +16063,25 @@ dependencies = [
name = "seedling-runtime" name = "seedling-runtime"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"cumulus-pallet-aura-ext",
"cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system",
"cumulus-pallet-solo-to-para", "cumulus-pallet-solo-to-para",
"cumulus-primitives-core", "cumulus-primitives-core",
"cumulus-primitives-timestamp",
"frame-executive", "frame-executive",
"frame-support", "frame-support",
"frame-system", "frame-system",
"pallet-aura",
"pallet-balances", "pallet-balances",
"pallet-sudo", "pallet-sudo",
"pallet-timestamp",
"parachain-info", "parachain-info",
"parachains-common", "parachains-common",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
"sp-api", "sp-api",
"sp-block-builder", "sp-block-builder",
"sp-consensus-aura",
"sp-core", "sp-core",
"sp-inherents", "sp-inherents",
"sp-offchain", "sp-offchain",
@@ -16302,6 +16312,7 @@ dependencies = [
name = "shell-runtime" name = "shell-runtime"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"cumulus-pallet-aura-ext",
"cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system",
"cumulus-pallet-xcm", "cumulus-pallet-xcm",
"cumulus-primitives-core", "cumulus-primitives-core",
@@ -16309,12 +16320,15 @@ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
"frame-try-runtime", "frame-try-runtime",
"pallet-aura",
"pallet-timestamp",
"parachain-info", "parachain-info",
"parachains-common", "parachains-common",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
"sp-api", "sp-api",
"sp-block-builder", "sp-block-builder",
"sp-consensus-aura",
"sp-core", "sp-core",
"sp-inherents", "sp-inherents",
"sp-offchain", "sp-offchain",
@@ -16,10 +16,13 @@ frame-system = { path = "../../../../../substrate/frame/system", default-feature
frame-system-rpc-runtime-api = { path = "../../../../../substrate/frame/system/rpc/runtime-api", default-features = false} frame-system-rpc-runtime-api = { path = "../../../../../substrate/frame/system/rpc/runtime-api", default-features = false}
frame-system-benchmarking = { path = "../../../../../substrate/frame/system/benchmarking", default-features = false, optional = true} frame-system-benchmarking = { path = "../../../../../substrate/frame/system/benchmarking", default-features = false, optional = true}
frame-try-runtime = { path = "../../../../../substrate/frame/try-runtime", default-features = false, optional = true} frame-try-runtime = { path = "../../../../../substrate/frame/try-runtime", default-features = false, optional = true}
pallet-aura = { path = "../../../../../substrate/frame/aura", default-features = false}
pallet-glutton = { path = "../../../../../substrate/frame/glutton", default-features = false, optional = true} pallet-glutton = { path = "../../../../../substrate/frame/glutton", default-features = false, optional = true}
pallet-sudo = { path = "../../../../../substrate/frame/sudo", default-features = false, optional = true} pallet-sudo = { path = "../../../../../substrate/frame/sudo", default-features = false, optional = true}
pallet-timestamp = { path = "../../../../../substrate/frame/timestamp", default-features = false }
sp-api = { path = "../../../../../substrate/primitives/api", default-features = false} sp-api = { path = "../../../../../substrate/primitives/api", default-features = false}
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false} sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false }
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false} sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false} sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false} sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
@@ -36,9 +39,11 @@ xcm-builder = { package = "staging-xcm-builder", path = "../../../../../polkadot
xcm-executor = { package = "staging-xcm-executor", path = "../../../../../polkadot/xcm/xcm-executor", default-features = false} xcm-executor = { package = "staging-xcm-executor", path = "../../../../../polkadot/xcm/xcm-executor", default-features = false}
# Cumulus # Cumulus
cumulus-pallet-aura-ext = { path = "../../../../pallets/aura-ext", default-features = false }
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook",] } cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook",] }
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false } cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false } cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
parachain-info = { path = "../../../pallets/parachain-info", default-features = false } parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false } parachains-common = { path = "../../../common", default-features = false }
@@ -55,6 +60,7 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks", "frame-system/runtime-benchmarks",
"pallet-glutton/runtime-benchmarks", "pallet-glutton/runtime-benchmarks",
"pallet-sudo?/runtime-benchmarks", "pallet-sudo?/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"parachains-common/runtime-benchmarks", "parachains-common/runtime-benchmarks",
"sp-runtime/runtime-benchmarks", "sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks", "xcm-builder/runtime-benchmarks",
@@ -62,9 +68,11 @@ runtime-benchmarks = [
] ]
std = [ std = [
"codec/std", "codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-parachain-system/std", "cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcm/std", "cumulus-pallet-xcm/std",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
"cumulus-primitives-timestamp/std",
"frame-benchmarking?/std", "frame-benchmarking?/std",
"frame-executive/std", "frame-executive/std",
"frame-support/std", "frame-support/std",
@@ -72,13 +80,16 @@ std = [
"frame-system-rpc-runtime-api/std", "frame-system-rpc-runtime-api/std",
"frame-system/std", "frame-system/std",
"frame-try-runtime?/std", "frame-try-runtime?/std",
"pallet-aura/std",
"pallet-glutton/std", "pallet-glutton/std",
"pallet-sudo/std", "pallet-sudo/std",
"pallet-timestamp/std",
"parachain-info/std", "parachain-info/std",
"parachains-common/std", "parachains-common/std",
"scale-info/std", "scale-info/std",
"sp-api/std", "sp-api/std",
"sp-block-builder/std", "sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std", "sp-core/std",
"sp-inherents/std", "sp-inherents/std",
"sp-offchain/std", "sp-offchain/std",
@@ -93,14 +104,19 @@ std = [
"xcm/std", "xcm/std",
] ]
try-runtime = [ try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-parachain-system/try-runtime", "cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcm/try-runtime",
"frame-executive/try-runtime", "frame-executive/try-runtime",
"frame-support/try-runtime", "frame-support/try-runtime",
"frame-system/try-runtime", "frame-system/try-runtime",
"frame-try-runtime/try-runtime", "frame-try-runtime/try-runtime",
"pallet-aura/try-runtime",
"pallet-glutton/try-runtime", "pallet-glutton/try-runtime",
"pallet-sudo/try-runtime", "pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"parachain-info/try-runtime", "parachain-info/try-runtime",
"sp-runtime/try-runtime", "sp-runtime/try-runtime",
] ]
experimental = [ "pallet-aura/experimental" ]
@@ -46,11 +46,12 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod weights; pub mod weights;
pub mod xcm_config; pub mod xcm_config;
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT}, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT},
transaction_validity::{TransactionSource, TransactionValidity}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, ApplyExtrinsicResult,
@@ -64,24 +65,37 @@ pub use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
parameter_types, parameter_types,
traits::{Everything, IsInVec, Randomness}, traits::{
ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, IsInVec, Randomness,
},
weights::{ weights::{
constants::{ constants::{
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
}, },
IdentityFee, Weight, IdentityFee, Weight,
}, },
StorageValue, PalletId, StorageValue,
}; };
use frame_system::{ use frame_system::{
limits::{BlockLength, BlockWeights}, limits::{BlockLength, BlockWeights},
EnsureRoot, EnsureRoot,
}; };
use parachains_common::{AccountId, Signature}; use parachains_common::{
kusama::consensus::{
BLOCK_PROCESSING_VELOCITY, RELAY_CHAIN_SLOT_DURATION_MILLIS, UNINCLUDED_SEGMENT_CAPACITY,
},
AccountId, Signature, SLOT_DURATION,
};
#[cfg(any(feature = "std", test))] #[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage; pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill}; pub use sp_runtime::{Perbill, Permill};
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
}
#[sp_version::runtime_version] #[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion { pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("glutton"), spec_name: create_runtime_str!("glutton"),
@@ -178,12 +192,35 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type ReservedDmpWeight = ReservedDmpWeight; type ReservedDmpWeight = ReservedDmpWeight;
type XcmpMessageHandler = (); type XcmpMessageHandler = ();
type ReservedXcmpWeight = (); type ReservedXcmpWeight = ();
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
type ConsensusHook = cumulus_pallet_parachain_system::consensus_hook::ExpectParentIncluded; type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
Runtime,
RELAY_CHAIN_SLOT_DURATION_MILLIS,
BLOCK_PROCESSING_VELOCITY,
UNINCLUDED_SEGMENT_CAPACITY,
>;
} }
impl parachain_info::Config for Runtime {} impl parachain_info::Config for Runtime {}
impl cumulus_pallet_aura_ext::Config for Runtime {}
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Aura;
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
}
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>;
type AllowMultipleBlocksPerSlot = ConstBool<false>;
#[cfg(feature = "experimental")]
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Self>;
}
impl pallet_glutton::Config for Runtime { impl pallet_glutton::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_glutton::WeightInfo<Runtime>; type WeightInfo = weights::pallet_glutton::WeightInfo<Runtime>;
@@ -204,6 +241,7 @@ construct_runtime! {
Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned, Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned,
} = 1, } = 1,
ParachainInfo: parachain_info::{Pallet, Storage, Config<T>} = 2, ParachainInfo: parachain_info::{Pallet, Storage, Config<T>} = 2,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
// DMP handler. // DMP handler.
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin} = 10, CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin} = 10,
@@ -211,6 +249,10 @@ construct_runtime! {
// The main stage. // The main stage.
Glutton: pallet_glutton::{Pallet, Call, Storage, Event, Config<T>} = 20, Glutton: pallet_glutton::{Pallet, Call, Storage, Event, Config<T>} = 20,
// Collator support
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 30,
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config<T>} = 31,
// Sudo. // Sudo.
Sudo: pallet_sudo::{Pallet, Call, Storage, Event<T>, Config<T>} = 255, Sudo: pallet_sudo::{Pallet, Call, Storage, Event<T>, Config<T>} = 255,
} }
@@ -295,6 +337,16 @@ impl_runtime_apis! {
} }
} }
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> sp_consensus_aura::SlotDuration {
sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
}
fn authorities() -> Vec<AuraId> {
Aura::authorities().into_inner()
}
}
impl sp_block_builder::BlockBuilder<Block> for Runtime { impl sp_block_builder::BlockBuilder<Block> for Runtime {
fn apply_extrinsic( fn apply_extrinsic(
extrinsic: <Block as BlockT>::Extrinsic, extrinsic: <Block as BlockT>::Extrinsic,
@@ -332,12 +384,14 @@ impl_runtime_apis! {
} }
impl sp_session::SessionKeys<Block> for Runtime { impl sp_session::SessionKeys<Block> for Runtime {
fn decode_session_keys(_: Vec<u8>) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> { fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
Some(Vec::new()) SessionKeys::generate(seed)
} }
fn generate_session_keys(_: Option<Vec<u8>>) -> Vec<u8> { fn decode_session_keys(
Vec::new() encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
SessionKeys::decode_into_raw_public_keys(&encoded)
} }
} }
@@ -402,5 +456,5 @@ impl_runtime_apis! {
cumulus_pallet_parachain_system::register_validate_block! { cumulus_pallet_parachain_system::register_validate_block! {
Runtime = Runtime, Runtime = Runtime,
BlockExecutor = Executive, BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
} }
@@ -15,3 +15,4 @@
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>. // along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub mod pallet_glutton; pub mod pallet_glutton;
pub mod pallet_timestamp;
@@ -0,0 +1,75 @@
// Copyright Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_timestamp`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-kusama-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-kusama-dev
// --wasm-execution=compiled
// --pallet=pallet_timestamp
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-kusama/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_timestamp`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_timestamp::WeightInfo for WeightInfo<T> {
/// Storage: `Timestamp::Now` (r:1 w:1)
/// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Aura::CurrentSlot` (r:1 w:0)
/// Proof: `Aura::CurrentSlot` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
fn set() -> Weight {
// Proof Size summary in bytes:
// Measured: `86`
// Estimated: `1493`
// Minimum execution time: 9_313_000 picoseconds.
Weight::from_parts(9_775_000, 0)
.saturating_add(Weight::from_parts(0, 1493))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
fn on_finalize() -> Weight {
// Proof Size summary in bytes:
// Measured: `57`
// Estimated: `0`
// Minimum execution time: 3_322_000 picoseconds.
Weight::from_parts(3_577_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}
@@ -12,10 +12,13 @@ scale-info = { version = "2.9.0", default-features = false, features = ["derive"
frame-executive = { path = "../../../../../substrate/frame/executive", default-features = false} frame-executive = { path = "../../../../../substrate/frame/executive", default-features = false}
frame-support = { path = "../../../../../substrate/frame/support", default-features = false} frame-support = { path = "../../../../../substrate/frame/support", default-features = false}
frame-system = { path = "../../../../../substrate/frame/system", default-features = false} frame-system = { path = "../../../../../substrate/frame/system", default-features = false}
pallet-aura = { path = "../../../../../substrate/frame/aura", default-features = false}
pallet-balances = { path = "../../../../../substrate/frame/balances", default-features = false} pallet-balances = { path = "../../../../../substrate/frame/balances", default-features = false}
pallet-sudo = { path = "../../../../../substrate/frame/sudo", default-features = false} pallet-sudo = { path = "../../../../../substrate/frame/sudo", default-features = false}
pallet-timestamp = { path = "../../../../../substrate/frame/timestamp", default-features = false }
sp-api = { path = "../../../../../substrate/primitives/api", default-features = false} sp-api = { path = "../../../../../substrate/primitives/api", default-features = false}
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false} sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false }
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false} sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false} sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false} sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
@@ -26,11 +29,13 @@ sp-transaction-pool = { path = "../../../../../substrate/primitives/transaction-
sp-version = { path = "../../../../../substrate/primitives/version", default-features = false} sp-version = { path = "../../../../../substrate/primitives/version", default-features = false}
# Cumulus # Cumulus
cumulus-pallet-aura-ext = { path = "../../../../pallets/aura-ext", default-features = false }
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook",] } cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook",] }
cumulus-pallet-solo-to-para = { path = "../../../../pallets/solo-to-para", default-features = false } cumulus-pallet-solo-to-para = { path = "../../../../pallets/solo-to-para", default-features = false }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
parachain-info = { path = "../../../pallets/parachain-info", default-features = false } parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false } parachains-common = { path = "../../../common", default-features = false }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
[build-dependencies] [build-dependencies]
substrate-wasm-builder = { path = "../../../../../substrate/utils/wasm-builder", optional = true } substrate-wasm-builder = { path = "../../../../../substrate/utils/wasm-builder", optional = true }
@@ -39,19 +44,24 @@ substrate-wasm-builder = { path = "../../../../../substrate/utils/wasm-builder",
default = [ "std" ] default = [ "std" ]
std = [ std = [
"codec/std", "codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-parachain-system/std", "cumulus-pallet-parachain-system/std",
"cumulus-pallet-solo-to-para/std", "cumulus-pallet-solo-to-para/std",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
"cumulus-primitives-timestamp/std",
"frame-executive/std", "frame-executive/std",
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"pallet-aura/std",
"pallet-balances/std", "pallet-balances/std",
"pallet-sudo/std", "pallet-sudo/std",
"pallet-timestamp/std",
"parachain-info/std", "parachain-info/std",
"parachains-common/std", "parachains-common/std",
"scale-info/std", "scale-info/std",
"sp-api/std", "sp-api/std",
"sp-block-builder/std", "sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std", "sp-core/std",
"sp-inherents/std", "sp-inherents/std",
"sp-offchain/std", "sp-offchain/std",
@@ -62,3 +72,5 @@ std = [
"sp-version/std", "sp-version/std",
"substrate-wasm-builder", "substrate-wasm-builder",
] ]
experimental = [ "pallet-aura/experimental" ]
@@ -27,11 +27,12 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT}, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT},
transaction_validity::{TransactionSource, TransactionValidity}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, ApplyExtrinsicResult,
@@ -46,7 +47,7 @@ pub use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
parameter_types, parameter_types,
traits::{IsInVec, Randomness}, traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, IsInVec, Randomness},
weights::{ weights::{
constants::{ constants::{
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
@@ -61,6 +62,12 @@ use parachains_common::{AccountId, Signature};
pub use sp_runtime::BuildStorage; pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill}; pub use sp_runtime::{Perbill, Permill};
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
}
/// This runtime version. /// This runtime version.
#[sp_version::runtime_version] #[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion { pub const VERSION: RuntimeVersion = RuntimeVersion {
@@ -80,6 +87,15 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
} }
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers. /// We assume that ~10% of the block weight is consumed by `on_initialize` handlers.
/// This is used to limit the maximal weight of a single extrinsic. /// This is used to limit the maximal weight of a single extrinsic.
const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
@@ -174,23 +190,49 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type ReservedDmpWeight = (); type ReservedDmpWeight = ();
type XcmpMessageHandler = (); type XcmpMessageHandler = ();
type ReservedXcmpWeight = (); type ReservedXcmpWeight = ();
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
type ConsensusHook = cumulus_pallet_parachain_system::consensus_hook::ExpectParentIncluded; type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
Runtime,
RELAY_CHAIN_SLOT_DURATION_MILLIS,
BLOCK_PROCESSING_VELOCITY,
UNINCLUDED_SEGMENT_CAPACITY,
>;
} }
impl parachain_info::Config for Runtime {} impl parachain_info::Config for Runtime {}
impl cumulus_pallet_aura_ext::Config for Runtime {}
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>;
type AllowMultipleBlocksPerSlot = ConstBool<false>;
#[cfg(feature = "experimental")]
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Self>;
}
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Aura;
type MinimumPeriod = ConstU64<0>;
type WeightInfo = ();
}
construct_runtime! { construct_runtime! {
pub enum Runtime pub enum Runtime
{ {
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>}, Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
ParachainSystem: cumulus_pallet_parachain_system::{ ParachainSystem: cumulus_pallet_parachain_system::{
Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned, Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned,
}, },
ParachainInfo: parachain_info::{Pallet, Storage, Config<T>}, ParachainInfo: parachain_info::{Pallet, Storage, Config<T>},
SoloToPara: cumulus_pallet_solo_to_para::{Pallet, Call, Storage, Event}, SoloToPara: cumulus_pallet_solo_to_para::{Pallet, Call, Storage, Event},
Aura: pallet_aura::{Pallet, Storage, Config<T>},
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config<T>},
} }
} }
@@ -233,6 +275,16 @@ pub type Executive = frame_executive::Executive<
>; >;
impl_runtime_apis! { impl_runtime_apis! {
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> sp_consensus_aura::SlotDuration {
sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
}
fn authorities() -> Vec<AuraId> {
Aura::authorities().into_inner()
}
}
impl sp_api::Core<Block> for Runtime { impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion { fn version() -> RuntimeVersion {
VERSION VERSION
@@ -298,12 +350,14 @@ impl_runtime_apis! {
} }
impl sp_session::SessionKeys<Block> for Runtime { impl sp_session::SessionKeys<Block> for Runtime {
fn decode_session_keys(_: Vec<u8>) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> { fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
Some(Vec::new()) SessionKeys::generate(seed)
} }
fn generate_session_keys(_: Option<Vec<u8>>) -> Vec<u8> { fn decode_session_keys(
Vec::new() encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
SessionKeys::decode_into_raw_public_keys(&encoded)
} }
} }
@@ -316,5 +370,5 @@ impl_runtime_apis! {
cumulus_pallet_parachain_system::register_validate_block! { cumulus_pallet_parachain_system::register_validate_block! {
Runtime = Runtime, Runtime = Runtime,
BlockExecutor = Executive, BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
} }
@@ -13,8 +13,11 @@ frame-executive = { path = "../../../../../substrate/frame/executive", default-f
frame-support = { path = "../../../../../substrate/frame/support", default-features = false} frame-support = { path = "../../../../../substrate/frame/support", default-features = false}
frame-system = { path = "../../../../../substrate/frame/system", default-features = false} frame-system = { path = "../../../../../substrate/frame/system", default-features = false}
frame-try-runtime = { path = "../../../../../substrate/frame/try-runtime", default-features = false, optional = true } frame-try-runtime = { path = "../../../../../substrate/frame/try-runtime", default-features = false, optional = true }
pallet-aura = { path = "../../../../../substrate/frame/aura", default-features = false}
pallet-timestamp = { path = "../../../../../substrate/frame/timestamp", default-features = false }
sp-api = { path = "../../../../../substrate/primitives/api", default-features = false} sp-api = { path = "../../../../../substrate/primitives/api", default-features = false}
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false} sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false }
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false} sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false} sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false} sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
@@ -30,6 +33,7 @@ xcm-builder = { package = "staging-xcm-builder", path = "../../../../../polkadot
xcm-executor = { package = "staging-xcm-executor", path = "../../../../../polkadot/xcm/xcm-executor", default-features = false} xcm-executor = { package = "staging-xcm-executor", path = "../../../../../polkadot/xcm/xcm-executor", default-features = false}
# Cumulus # Cumulus
cumulus-pallet-aura-ext = { path = "../../../../pallets/aura-ext", default-features = false }
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook",] } cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook",] }
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false } cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false } cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
@@ -43,6 +47,7 @@ substrate-wasm-builder = { path = "../../../../../substrate/utils/wasm-builder",
default = [ "std" ] default = [ "std" ]
std = [ std = [
"codec/std", "codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-parachain-system/std", "cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcm/std", "cumulus-pallet-xcm/std",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
@@ -50,11 +55,14 @@ std = [
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"frame-try-runtime?/std", "frame-try-runtime?/std",
"pallet-aura/std",
"pallet-timestamp/std",
"parachain-info/std", "parachain-info/std",
"parachains-common/std", "parachains-common/std",
"scale-info/std", "scale-info/std",
"sp-api/std", "sp-api/std",
"sp-block-builder/std", "sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std", "sp-core/std",
"sp-inherents/std", "sp-inherents/std",
"sp-offchain/std", "sp-offchain/std",
@@ -69,12 +77,17 @@ std = [
"xcm/std", "xcm/std",
] ]
try-runtime = [ try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-parachain-system/try-runtime", "cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcm/try-runtime",
"frame-executive/try-runtime", "frame-executive/try-runtime",
"frame-support/try-runtime", "frame-support/try-runtime",
"frame-system/try-runtime", "frame-system/try-runtime",
"frame-try-runtime/try-runtime", "frame-try-runtime/try-runtime",
"pallet-aura/try-runtime",
"pallet-timestamp/try-runtime",
"parachain-info/try-runtime", "parachain-info/try-runtime",
"sp-runtime/try-runtime", "sp-runtime/try-runtime",
] ]
experimental = [ "pallet-aura/experimental" ]
@@ -32,13 +32,14 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod xcm_config; pub mod xcm_config;
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use frame_support::unsigned::TransactionValidityError; use frame_support::unsigned::TransactionValidityError;
use scale_info::TypeInfo; use scale_info::TypeInfo;
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, DispatchInfoOf}, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, DispatchInfoOf},
transaction_validity::{TransactionSource, TransactionValidity}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, ApplyExtrinsicResult,
@@ -53,7 +54,7 @@ pub use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
parameter_types, parameter_types,
traits::{Everything, IsInVec, Randomness}, traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, IsInVec, Randomness},
weights::{ weights::{
constants::{ constants::{
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
@@ -68,6 +69,12 @@ use parachains_common::{AccountId, Signature};
pub use sp_runtime::BuildStorage; pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill}; pub use sp_runtime::{Perbill, Permill};
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
}
/// This runtime version. /// This runtime version.
#[sp_version::runtime_version] #[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion { pub const VERSION: RuntimeVersion = RuntimeVersion {
@@ -87,6 +94,15 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
} }
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers. /// We assume that ~10% of the block weight is consumed by `on_initialize` handlers.
/// This is used to limit the maximal weight of a single extrinsic. /// This is used to limit the maximal weight of a single extrinsic.
const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
@@ -177,16 +193,41 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type ReservedDmpWeight = ReservedDmpWeight; type ReservedDmpWeight = ReservedDmpWeight;
type XcmpMessageHandler = (); type XcmpMessageHandler = ();
type ReservedXcmpWeight = (); type ReservedXcmpWeight = ();
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
type ConsensusHook = cumulus_pallet_parachain_system::consensus_hook::ExpectParentIncluded; type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
Runtime,
RELAY_CHAIN_SLOT_DURATION_MILLIS,
BLOCK_PROCESSING_VELOCITY,
UNINCLUDED_SEGMENT_CAPACITY,
>;
} }
impl parachain_info::Config for Runtime {} impl parachain_info::Config for Runtime {}
impl cumulus_pallet_aura_ext::Config for Runtime {}
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>;
type AllowMultipleBlocksPerSlot = ConstBool<false>;
#[cfg(feature = "experimental")]
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Self>;
}
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Aura;
type MinimumPeriod = ConstU64<0>;
type WeightInfo = ();
}
construct_runtime! { construct_runtime! {
pub enum Runtime pub enum Runtime
{ {
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
ParachainSystem: cumulus_pallet_parachain_system::{ ParachainSystem: cumulus_pallet_parachain_system::{
Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned, Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned,
}, },
@@ -194,6 +235,9 @@ construct_runtime! {
// DMP handler. // DMP handler.
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin}, CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},
Aura: pallet_aura::{Pallet, Storage, Config<T>},
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config<T>},
} }
} }
@@ -263,6 +307,16 @@ pub type Executive = frame_executive::Executive<
>; >;
impl_runtime_apis! { impl_runtime_apis! {
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> sp_consensus_aura::SlotDuration {
sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
}
fn authorities() -> Vec<AuraId> {
Aura::authorities().into_inner()
}
}
impl sp_api::Core<Block> for Runtime { impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion { fn version() -> RuntimeVersion {
VERSION VERSION
@@ -328,12 +382,14 @@ impl_runtime_apis! {
} }
impl sp_session::SessionKeys<Block> for Runtime { impl sp_session::SessionKeys<Block> for Runtime {
fn decode_session_keys(_: Vec<u8>) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> { fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
Some(Vec::new()) SessionKeys::generate(seed)
} }
fn generate_session_keys(_: Option<Vec<u8>>) -> Vec<u8> { fn decode_session_keys(
Vec::new() encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
SessionKeys::decode_into_raw_public_keys(&encoded)
} }
} }
@@ -346,5 +402,5 @@ impl_runtime_apis! {
cumulus_pallet_parachain_system::register_validate_block! { cumulus_pallet_parachain_system::register_validate_block! {
Runtime = Runtime, Runtime = Runtime,
BlockExecutor = Executive, BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
} }
@@ -16,9 +16,12 @@
use crate::chain_spec::{get_account_id_from_seed, Extensions}; use crate::chain_spec::{get_account_id_from_seed, Extensions};
use cumulus_primitives_core::ParaId; use cumulus_primitives_core::ParaId;
use parachains_common::AuraId;
use sc_service::ChainType; use sc_service::ChainType;
use sp_core::sr25519; use sp_core::sr25519;
use super::get_collator_keys_from_seed;
/// Specialized `ChainSpec` for the Glutton parachain runtime. /// Specialized `ChainSpec` for the Glutton parachain runtime.
pub type GluttonChainSpec = pub type GluttonChainSpec =
sc_service::GenericChainSpec<glutton_runtime::RuntimeGenesisConfig, Extensions>; sc_service::GenericChainSpec<glutton_runtime::RuntimeGenesisConfig, Extensions>;
@@ -30,7 +33,7 @@ pub fn glutton_development_config(para_id: ParaId) -> GluttonChainSpec {
// ID // ID
"glutton_dev", "glutton_dev",
ChainType::Local, ChainType::Local,
move || glutton_genesis(para_id), move || glutton_genesis(para_id, vec![get_collator_keys_from_seed::<AuraId>("Alice")]),
Vec::new(), Vec::new(),
None, None,
None, None,
@@ -47,7 +50,15 @@ pub fn glutton_local_config(para_id: ParaId) -> GluttonChainSpec {
// ID // ID
"glutton_local", "glutton_local",
ChainType::Local, ChainType::Local,
move || glutton_genesis(para_id), move || {
glutton_genesis(
para_id,
vec![
get_collator_keys_from_seed::<AuraId>("Alice"),
get_collator_keys_from_seed::<AuraId>("Bob"),
],
)
},
Vec::new(), Vec::new(),
None, None,
None, None,
@@ -67,7 +78,15 @@ pub fn glutton_config(para_id: ParaId) -> GluttonChainSpec {
// ID // ID
format!("glutton-kusama-{}", para_id).as_str(), format!("glutton-kusama-{}", para_id).as_str(),
ChainType::Live, ChainType::Live,
move || glutton_genesis(para_id), move || {
glutton_genesis(
para_id,
vec![
get_collator_keys_from_seed::<AuraId>("Alice"),
get_collator_keys_from_seed::<AuraId>("Bob"),
],
)
},
Vec::new(), Vec::new(),
None, None,
// Protocol ID // Protocol ID
@@ -78,7 +97,10 @@ pub fn glutton_config(para_id: ParaId) -> GluttonChainSpec {
) )
} }
fn glutton_genesis(parachain_id: ParaId) -> glutton_runtime::RuntimeGenesisConfig { fn glutton_genesis(
parachain_id: ParaId,
collators: Vec<AuraId>,
) -> glutton_runtime::RuntimeGenesisConfig {
glutton_runtime::RuntimeGenesisConfig { glutton_runtime::RuntimeGenesisConfig {
system: glutton_runtime::SystemConfig { system: glutton_runtime::SystemConfig {
code: glutton_runtime::WASM_BINARY code: glutton_runtime::WASM_BINARY
@@ -94,6 +116,8 @@ fn glutton_genesis(parachain_id: ParaId) -> glutton_runtime::RuntimeGenesisConfi
trash_data_count: Default::default(), trash_data_count: Default::default(),
..Default::default() ..Default::default()
}, },
aura: glutton_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
sudo: glutton_runtime::SudoConfig { sudo: glutton_runtime::SudoConfig {
key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")), key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
}, },
@@ -16,10 +16,12 @@
use crate::chain_spec::{get_account_id_from_seed, Extensions}; use crate::chain_spec::{get_account_id_from_seed, Extensions};
use cumulus_primitives_core::ParaId; use cumulus_primitives_core::ParaId;
use parachains_common::AccountId; use parachains_common::{AccountId, AuraId};
use sc_service::ChainType; use sc_service::ChainType;
use sp_core::sr25519; use sp_core::sr25519;
use super::get_collator_keys_from_seed;
/// Specialized `ChainSpec` for the seedling parachain runtime. /// Specialized `ChainSpec` for the seedling parachain runtime.
pub type SeedlingChainSpec = pub type SeedlingChainSpec =
sc_service::GenericChainSpec<seedling_runtime::RuntimeGenesisConfig, Extensions>; sc_service::GenericChainSpec<seedling_runtime::RuntimeGenesisConfig, Extensions>;
@@ -33,6 +35,7 @@ pub fn get_seedling_chain_spec() -> SeedlingChainSpec {
seedling_testnet_genesis( seedling_testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"), get_account_id_from_seed::<sr25519::Public>("Alice"),
2000.into(), 2000.into(),
vec![get_collator_keys_from_seed::<AuraId>("Alice")],
) )
}, },
Vec::new(), Vec::new(),
@@ -47,6 +50,7 @@ pub fn get_seedling_chain_spec() -> SeedlingChainSpec {
fn seedling_testnet_genesis( fn seedling_testnet_genesis(
root_key: AccountId, root_key: AccountId,
parachain_id: ParaId, parachain_id: ParaId,
collators: Vec<AuraId>,
) -> seedling_runtime::RuntimeGenesisConfig { ) -> seedling_runtime::RuntimeGenesisConfig {
seedling_runtime::RuntimeGenesisConfig { seedling_runtime::RuntimeGenesisConfig {
system: seedling_runtime::SystemConfig { system: seedling_runtime::SystemConfig {
@@ -61,5 +65,7 @@ fn seedling_testnet_genesis(
..Default::default() ..Default::default()
}, },
parachain_system: Default::default(), parachain_system: Default::default(),
aura: seedling_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
} }
} }
@@ -16,8 +16,11 @@
use crate::chain_spec::Extensions; use crate::chain_spec::Extensions;
use cumulus_primitives_core::ParaId; use cumulus_primitives_core::ParaId;
use parachains_common::AuraId;
use sc_service::ChainType; use sc_service::ChainType;
use super::get_collator_keys_from_seed;
/// Specialized `ChainSpec` for the shell parachain runtime. /// Specialized `ChainSpec` for the shell parachain runtime.
pub type ShellChainSpec = pub type ShellChainSpec =
sc_service::GenericChainSpec<shell_runtime::RuntimeGenesisConfig, Extensions>; sc_service::GenericChainSpec<shell_runtime::RuntimeGenesisConfig, Extensions>;
@@ -27,7 +30,9 @@ pub fn get_shell_chain_spec() -> ShellChainSpec {
"Shell Local Testnet", "Shell Local Testnet",
"shell_local_testnet", "shell_local_testnet",
ChainType::Local, ChainType::Local,
move || shell_testnet_genesis(1000.into()), move || {
shell_testnet_genesis(1000.into(), vec![get_collator_keys_from_seed::<AuraId>("Alice")])
},
Vec::new(), Vec::new(),
None, None,
None, None,
@@ -37,7 +42,10 @@ pub fn get_shell_chain_spec() -> ShellChainSpec {
) )
} }
fn shell_testnet_genesis(parachain_id: ParaId) -> shell_runtime::RuntimeGenesisConfig { fn shell_testnet_genesis(
parachain_id: ParaId,
collators: Vec<AuraId>,
) -> shell_runtime::RuntimeGenesisConfig {
shell_runtime::RuntimeGenesisConfig { shell_runtime::RuntimeGenesisConfig {
system: shell_runtime::SystemConfig { system: shell_runtime::SystemConfig {
code: shell_runtime::WASM_BINARY code: shell_runtime::WASM_BINARY
@@ -47,5 +55,7 @@ fn shell_testnet_genesis(parachain_id: ParaId) -> shell_runtime::RuntimeGenesisC
}, },
parachain_info: shell_runtime::ParachainInfoConfig { parachain_id, ..Default::default() }, parachain_info: shell_runtime::ParachainInfoConfig { parachain_id, ..Default::default() },
parachain_system: Default::default(), parachain_system: Default::default(),
aura: shell_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
} }
} }