From 8fd0bc9b3dbecaaca9a22d5b4e7cbf53a4e4adef Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Wed, 18 Dec 2024 13:24:51 +0100 Subject: [PATCH] chore: other upgrade changes --- Cargo.lock | 9 +++-- Cargo.toml | 9 +++-- node/Cargo.toml | 1 + node/src/service.rs | 2 + runtime/common/Cargo.toml | 14 +++---- runtime/common/src/lib.rs | 52 ++++++++++++++----------- runtime/devnet/Cargo.toml | 3 +- runtime/devnet/src/config/api/mod.rs | 2 +- runtime/devnet/src/config/contracts.rs | 4 +- runtime/devnet/src/config/ismp.rs | 3 +- runtime/devnet/src/lib.rs | 25 +++++++++++- runtime/mainnet/Cargo.toml | 3 +- runtime/mainnet/src/lib.rs | 31 ++++++++++++--- runtime/testnet/Cargo.toml | 3 +- runtime/testnet/src/config/api/mod.rs | 2 +- runtime/testnet/src/config/contracts.rs | 4 +- runtime/testnet/src/lib.rs | 31 ++++++++++++--- 17 files changed, 137 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 60bf1785d..7b6b601f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12902,6 +12902,7 @@ dependencies = [ "cumulus-primitives-core 0.15.0", "cumulus-primitives-parachain-inherent 0.15.0", "cumulus-relay-chain-interface 0.17.0", + "docify", "frame-benchmarking 37.0.0", "frame-benchmarking-cli", "futures", @@ -12970,13 +12971,13 @@ dependencies = [ name = "pop-runtime-common" version = "0.0.0" dependencies = [ + "docify", "frame-support 37.0.1", "parachains-common 17.0.0", "parity-scale-codec", "polkadot-primitives 15.0.0", "scale-info", "sp-runtime 39.0.3", - "sp-std", ] [[package]] @@ -12992,6 +12993,7 @@ dependencies = [ "cumulus-primitives-core 0.15.0", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility 0.16.0", + "docify", "enumflags2", "env_logger 0.11.5", "frame-benchmarking 37.0.0", @@ -13052,7 +13054,6 @@ dependencies = [ "sp-offchain 34.0.0", "sp-runtime 39.0.3", "sp-session 35.0.0", - "sp-std", "sp-transaction-pool 34.0.0", "sp-version 37.0.0", "staging-parachain-info 0.16.0", @@ -13075,6 +13076,7 @@ dependencies = [ "cumulus-primitives-core 0.15.0", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility 0.16.0", + "docify", "enumflags2", "env_logger 0.11.5", "frame-benchmarking 37.0.0", @@ -13119,7 +13121,6 @@ dependencies = [ "sp-offchain 34.0.0", "sp-runtime 39.0.3", "sp-session 35.0.0", - "sp-std", "sp-transaction-pool 34.0.0", "sp-version 37.0.0", "staging-parachain-info 0.16.0", @@ -13142,6 +13143,7 @@ dependencies = [ "cumulus-primitives-core 0.15.0", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility 0.16.0", + "docify", "enumflags2", "env_logger 0.11.5", "frame-benchmarking 37.0.0", @@ -13196,7 +13198,6 @@ dependencies = [ "sp-offchain 34.0.0", "sp-runtime 39.0.3", "sp-session 35.0.0", - "sp-std", "sp-transaction-pool 34.0.0", "sp-version 37.0.0", "staging-parachain-info 0.16.0", diff --git a/Cargo.toml b/Cargo.toml index 5bc475440..7a66c4777 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,14 +33,15 @@ members = [ resolver = "2" [workspace.dependencies] -clap = { version = "4.4.18", features = [ "derive" ] } +clap = { version = "4.5.1", features = [ "derive" ] } codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = [ "derive", ] } contract-build = "4.1.1" +docify = "0.2.8" enumflags2 = "0.7.9" env_logger = "0.11.5" -futures = "0.3.28" +futures = "0.3.30" hex = "0.4.3" hex-literal = "0.4.1" impl-trait-for-tuples = "0.2.2" @@ -51,12 +52,12 @@ scale-info = { version = "2.11.1", default-features = false, features = [ "derive", ] } serde = "1.0.197" -serde_json = "1.0.114" +serde_json = "1.0.121" smallvec = "1.11.2" subxt = "0.34.0" subxt-signer = "0.34.0" tokio = { version = "1.36", features = [ "macros", "rt-multi-thread", "time" ] } -tracing-subscriber = { version = "0.3", default-features = false } +tracing-subscriber = { version = "0.3.18", default-features = false } # Build substrate-build-script-utils = "11.0.0" diff --git a/node/Cargo.toml b/node/Cargo.toml index 4948cb183..b0c10a67d 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -13,6 +13,7 @@ version = "0.2.0-alpha" [dependencies] clap.workspace = true codec.workspace = true +docify.workspace = true futures.workspace = true jsonrpsee = { workspace = true, features = [ "server" ] } log.workspace = true diff --git a/node/src/service.rs b/node/src/service.rs index 5e29a3725..8aba861d4 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -6,6 +6,7 @@ use std::{sync::Arc, time::Duration}; use cumulus_client_cli::CollatorOptions; // Cumulus Imports use cumulus_client_collator::service::CollatorService; +#[docify::export(lookahead_collator)] use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams}; use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport; use cumulus_client_consensus_proposer::Proposer; @@ -13,6 +14,7 @@ use cumulus_client_service::{ build_network, build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks, BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, StartRelayChainTasksParams, }; +#[docify::export(cumulus_primitives)] use cumulus_primitives_core::{ relay_chain::{CollatorPair, ValidationCode}, ParaId, diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 395abd246..5703b026e 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -12,16 +12,16 @@ version = "0.0.0" targets = [ "x86_64-unknown-linux-gnu" ] [dependencies] -codec = { workspace = true, default-features = false, features = [ "derive" ] } -scale-info = { workspace = true, default-features = false, features = [ "derive" ] } +codec = { workspace = true, features = [ "derive" ] } +docify.workspace = true +scale-info = { workspace = true, features = [ "derive" ] } # Substrate -frame-support = { workspace = true, default-features = false } -sp-runtime = { workspace = true, default-features = false } -sp-std = { workspace = true, default-features = false } +frame-support.workspace = true +sp-runtime.workspace = true -parachains-common = { workspace = true, default-features = false } -polkadot-primitives = { workspace = true, default-features = false } +parachains-common.workspace = true +polkadot-primitives.workspace = true [features] default = [ "std" ] diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index f20ea377e..0b8042da2 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -9,21 +9,21 @@ use sp_runtime::Perbill; /// Nonce for an account pub type Nonce = u32; -/// This determines the average expected block time that we are targeting. -/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. -/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked -/// up by `pallet_aura` to implement `fn slot_duration()`. -/// -/// Change this to adjust the block time. -pub const MILLISECS_PER_BLOCK: u64 = 6000; - -// NOTE: Currently it is not possible to change the slot duration after the chain has started. -// Attempting to do so will brick block production. -pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; - -/// Relay chain slot duration, in milliseconds. -// Value is 6000 millisecs. If `MILLISECS_PER_BLOCK` changes this needs addressing. -pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; +#[docify::export] +mod block_times { + /// This determines the average expected block time that we are targeting. + /// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. + /// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked + /// up by `pallet_aura` to implement `fn slot_duration()`. + /// + /// Change this to adjust the block time. + pub const MILLISECS_PER_BLOCK: u64 = 6000; + /// The duration of a slot. + // NOTE: Currently it is not possible to change the slot duration after the chain has started. + // Attempting to do so will brick block production. + pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; +} +pub use block_times::*; // Time is measured by number of blocks. pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); @@ -39,6 +39,7 @@ pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 2 seconds of compute with a 6-second average block. +#[docify::export(max_block_weight)] pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), MAX_POV_SIZE as u64); @@ -55,14 +56,19 @@ pub const fn deposit(items: u32, bytes: u32) -> Balance { /// The existential deposit. Set to 1/1_000 of the Connected Relay Chain. pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; -// Async backing -/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included -/// into the relay chain. -pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; - -/// How many parachain blocks are processed by the relay chain per parent. Limits the -/// number of blocks authored per slot. -pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; +#[docify::export] +mod async_backing_params { + /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included + /// into the relay chain. + pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; + /// How many parachain blocks are processed by the relay chain per parent. Limits the + /// number of blocks authored per slot. + pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; + /// Relay chain slot duration, in milliseconds. + // Value is 6000 millisecs. If `MILLISECS_PER_BLOCK` changes this needs addressing. + pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; +} +pub use async_backing_params::*; /// Proxy commons for Pop runtimes pub mod proxy { diff --git a/runtime/devnet/Cargo.toml b/runtime/devnet/Cargo.toml index 2b4fe41c9..509bdc037 100644 --- a/runtime/devnet/Cargo.toml +++ b/runtime/devnet/Cargo.toml @@ -16,6 +16,7 @@ substrate-wasm-builder.workspace = true [dependencies] codec.workspace = true +docify.workspace = true hex-literal.workspace = true log.workspace = true scale-info.workspace = true @@ -66,7 +67,6 @@ sp-mmr-primitives.workspace = true sp-offchain.workspace = true sp-runtime.workspace = true sp-session.workspace = true -sp-std.workspace = true sp-transaction-pool.workspace = true sp-version.workspace = true @@ -171,7 +171,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "xcm-builder/std", diff --git a/runtime/devnet/src/config/api/mod.rs b/runtime/devnet/src/config/api/mod.rs index 035a6014f..8d635b0c5 100644 --- a/runtime/devnet/src/config/api/mod.rs +++ b/runtime/devnet/src/config/api/mod.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use core::marker::PhantomData; use codec::Decode; @@ -7,7 +8,6 @@ pub(crate) use pallet_api::Extension; use pallet_api::{extension::*, Read}; use sp_core::ConstU8; use sp_runtime::DispatchError; -use sp_std::vec::Vec; use versioning::*; use crate::{ diff --git a/runtime/devnet/src/config/contracts.rs b/runtime/devnet/src/config/contracts.rs index 8dc3cffd5..c9dd5cac5 100644 --- a/runtime/devnet/src/config/contracts.rs +++ b/runtime/devnet/src/config/contracts.rs @@ -1,3 +1,5 @@ +use alloc::core::marker::PhantomData; + use frame_support::{ parameter_types, traits::{ConstBool, ConstU32, Nothing, Randomness}, @@ -22,7 +24,7 @@ fn schedule() -> pallet_contracts::Schedule { // randomness-collective-flip is insecure. Provide dummy randomness as placeholder for the // deprecated trait. https://github.com/paritytech/polkadot-sdk/blob/9bf1a5e23884921498b381728bfddaae93f83744/substrate/frame/contracts/mock-network/src/parachain/contracts_config.rs#L45 -pub struct DummyRandomness(sp_std::marker::PhantomData); +pub struct DummyRandomness(PhantomData); impl Randomness> for DummyRandomness { fn random(_subject: &[u8]) -> (T::Hash, BlockNumberFor) { diff --git a/runtime/devnet/src/config/ismp.rs b/runtime/devnet/src/config/ismp.rs index 896b996f9..05f44057d 100644 --- a/runtime/devnet/src/config/ismp.rs +++ b/runtime/devnet/src/config/ismp.rs @@ -1,8 +1,9 @@ +use alloc::vec::Vec; + use frame_support::traits::Get; use frame_system::EnsureRoot; use ismp::{error::Error, host::StateMachine, module::IsmpModule, router::IsmpRouter}; use ismp_parachain::ParachainConsensusClient; -use sp_std::prelude::*; use crate::{ AccountId, Balance, Balances, Ismp, IsmpParachain, ParachainInfo, Runtime, RuntimeEvent, diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index f539cbdee..cd2f56d51 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -10,6 +10,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod config; mod weights; +extern crate alloc; +use alloc::vec::Vec; + // ISMP imports use ::ismp::{ consensus::{ConsensusClientId, StateMachineHeight, StateMachineId}, @@ -65,7 +68,6 @@ use sp_runtime::{ ApplyExtrinsicResult, }; pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -351,6 +353,7 @@ parameter_types! { pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent; } +#[docify::export] type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< Runtime, RELAY_CHAIN_SLOT_DURATION_MILLIS, @@ -439,6 +442,7 @@ impl pallet_session::Config for Runtime { type WeightInfo = (); } +#[docify::export(aura_config)] impl pallet_aura::Config for Runtime { type AllowMultipleBlocksPerSlot = ConstBool; type AuthorityId = AuraId; @@ -655,11 +659,27 @@ mod benches { ); } +// We move some impls outside so we can easily use them with `docify`. +impl Runtime { + #[docify::export] + fn impl_slot_duration() -> sp_consensus_aura::SlotDuration { + sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION) + } + + #[docify::export] + fn impl_can_build_upon( + included_hash: ::Hash, + slot: cumulus_primitives_aura::Slot, + ) -> bool { + ConsensusHook::can_build_upon(included_hash, slot) + } +} + impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { - sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION) + Runtime::impl_slot_duration() } fn authorities() -> Vec { @@ -1068,6 +1088,7 @@ impl_runtime_apis! { } +#[docify::export(register_validate_block)] cumulus_pallet_parachain_system::register_validate_block! { Runtime = Runtime, BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, diff --git a/runtime/mainnet/Cargo.toml b/runtime/mainnet/Cargo.toml index a3ddf745c..fdebf0ea8 100644 --- a/runtime/mainnet/Cargo.toml +++ b/runtime/mainnet/Cargo.toml @@ -16,6 +16,7 @@ substrate-wasm-builder.workspace = true [dependencies] codec.workspace = true +docify.workspace = true scale-info.workspace = true smallvec.workspace = true @@ -55,7 +56,6 @@ sp-io.workspace = true sp-offchain.workspace = true sp-runtime.workspace = true sp-session.workspace = true -sp-std.workspace = true sp-transaction-pool.workspace = true sp-version.workspace = true @@ -139,7 +139,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "xcm-builder/std", diff --git a/runtime/mainnet/src/lib.rs b/runtime/mainnet/src/lib.rs index 536396afa..aa5363322 100644 --- a/runtime/mainnet/src/lib.rs +++ b/runtime/mainnet/src/lib.rs @@ -9,6 +9,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod config; mod weights; +extern crate alloc; +use alloc::vec::Vec; + use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; @@ -55,7 +58,6 @@ use sp_runtime::{ ApplyExtrinsicResult, }; pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -395,6 +397,7 @@ parameter_types! { pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent; } +#[docify::export] type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< Runtime, RELAY_CHAIN_SLOT_DURATION_MILLIS, @@ -483,6 +486,7 @@ impl pallet_session::Config for Runtime { type WeightInfo = (); } +#[docify::export(aura_config)] impl pallet_aura::Config for Runtime { type AllowMultipleBlocksPerSlot = ConstBool; type AuthorityId = AuraId; @@ -677,11 +681,27 @@ mod benches { ); } +// We move some impls outside so we can easily use them with `docify`. +impl Runtime { + #[docify::export] + fn impl_slot_duration() -> sp_consensus_aura::SlotDuration { + sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION) + } + + #[docify::export] + fn impl_can_build_upon( + included_hash: ::Hash, + slot: cumulus_primitives_aura::Slot, + ) -> bool { + ConsensusHook::can_build_upon(included_hash, slot) + } +} + impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { - sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION) + Runtime::impl_slot_duration() } fn authorities() -> Vec { @@ -712,7 +732,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> Vec { Runtime::metadata_versions() } } @@ -821,7 +841,7 @@ impl_runtime_apis! { included_hash: ::Hash, slot: cumulus_primitives_aura::Slot, ) -> bool { - ConsensusHook::can_build_upon(included_hash, slot) + Runtime::impl_can_build_upon(included_hash, slot) } } @@ -875,7 +895,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } @@ -915,6 +935,7 @@ impl_runtime_apis! { } } +#[docify::export(register_validate_block)] cumulus_pallet_parachain_system::register_validate_block! { Runtime = Runtime, BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, diff --git a/runtime/testnet/Cargo.toml b/runtime/testnet/Cargo.toml index 909f870a4..d3cd2c7b8 100644 --- a/runtime/testnet/Cargo.toml +++ b/runtime/testnet/Cargo.toml @@ -16,6 +16,7 @@ substrate-wasm-builder.workspace = true [dependencies] codec.workspace = true +docify.workspace = true hex-literal.workspace = true log.workspace = true scale-info.workspace = true @@ -65,7 +66,6 @@ sp-io.workspace = true sp-offchain.workspace = true sp-runtime.workspace = true sp-session.workspace = true -sp-std.workspace = true sp-transaction-pool.workspace = true sp-version.workspace = true @@ -158,7 +158,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "xcm-builder/std", diff --git a/runtime/testnet/src/config/api/mod.rs b/runtime/testnet/src/config/api/mod.rs index 035a6014f..8d635b0c5 100644 --- a/runtime/testnet/src/config/api/mod.rs +++ b/runtime/testnet/src/config/api/mod.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use core::marker::PhantomData; use codec::Decode; @@ -7,7 +8,6 @@ pub(crate) use pallet_api::Extension; use pallet_api::{extension::*, Read}; use sp_core::ConstU8; use sp_runtime::DispatchError; -use sp_std::vec::Vec; use versioning::*; use crate::{ diff --git a/runtime/testnet/src/config/contracts.rs b/runtime/testnet/src/config/contracts.rs index d5ccbf19b..7dd23b733 100644 --- a/runtime/testnet/src/config/contracts.rs +++ b/runtime/testnet/src/config/contracts.rs @@ -1,3 +1,5 @@ +use alloc::core::marker::PhantomData; + use frame_support::{ parameter_types, traits::{ConstBool, ConstU32, Nothing, Randomness}, @@ -22,7 +24,7 @@ fn schedule() -> pallet_contracts::Schedule { // randomness-collective-flip is insecure. Provide dummy randomness as placeholder for the // deprecated trait. https://github.com/paritytech/polkadot-sdk/blob/9bf1a5e23884921498b381728bfddaae93f83744/substrate/frame/contracts/mock-network/src/parachain/contracts_config.rs#L45 -pub struct DummyRandomness(sp_std::marker::PhantomData); +pub struct DummyRandomness(PhantomData); impl Randomness> for DummyRandomness { fn random(_subject: &[u8]) -> (T::Hash, BlockNumberFor) { diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index 2585ab0b0..6df756a23 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -10,6 +10,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod config; mod weights; +extern crate alloc; +use alloc::vec::Vec; + use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; @@ -58,7 +61,6 @@ use sp_runtime::{ ApplyExtrinsicResult, }; pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -353,6 +355,7 @@ parameter_types! { pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent; } +#[docify::export] type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< Runtime, RELAY_CHAIN_SLOT_DURATION_MILLIS, @@ -446,6 +449,7 @@ impl pallet_session::Config for Runtime { type WeightInfo = (); } +#[docify::export(aura_config)] impl pallet_aura::Config for Runtime { type AllowMultipleBlocksPerSlot = ConstBool; type AuthorityId = AuraId; @@ -658,11 +662,27 @@ mod benches { ); } +// We move some impls outside so we can easily use them with `docify`. +impl Runtime { + #[docify::export] + fn impl_slot_duration() -> sp_consensus_aura::SlotDuration { + sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION) + } + + #[docify::export] + fn impl_can_build_upon( + included_hash: ::Hash, + slot: cumulus_primitives_aura::Slot, + ) -> bool { + ConsensusHook::can_build_upon(included_hash, slot) + } +} + impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { - sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION) + Runtime::impl_slot_duration() } fn authorities() -> Vec { @@ -693,7 +713,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> Vec { Runtime::metadata_versions() } } @@ -869,7 +889,7 @@ impl_runtime_apis! { included_hash: ::Hash, slot: cumulus_primitives_aura::Slot, ) -> bool { - ConsensusHook::can_build_upon(included_hash, slot) + Runtime::impl_can_build_upon(included_hash, slot) } } @@ -967,7 +987,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } @@ -1007,6 +1027,7 @@ impl_runtime_apis! { } } +#[docify::export(register_validate_block)] cumulus_pallet_parachain_system::register_validate_block! { Runtime = Runtime, BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::,