Skip to content

Commit e7abcd9

Browse files
committed
chore: other upgrade changes
1 parent e9e4939 commit e7abcd9

File tree

17 files changed

+138
-64
lines changed

17 files changed

+138
-64
lines changed

Cargo.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ members = [
3333
resolver = "2"
3434

3535
[workspace.dependencies]
36-
clap = { version = "4.4.18", features = [ "derive" ] }
36+
clap = { version = "4.5.1", features = [ "derive" ] }
3737
codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = [
3838
"derive",
3939
] }
4040
contract-build = "4.1.1"
41+
docify = "0.2.8"
4142
enumflags2 = "0.7.9"
4243
env_logger = "0.11.5"
43-
futures = "0.3.28"
44+
futures = "0.3.30"
4445
hex = "0.4.3"
4546
hex-literal = "0.4.1"
4647
impl-trait-for-tuples = "0.2.2"
@@ -51,12 +52,12 @@ scale-info = { version = "2.11.1", default-features = false, features = [
5152
"derive",
5253
] }
5354
serde = "1.0.197"
54-
serde_json = "1.0.114"
55+
serde_json = "1.0.121"
5556
smallvec = "1.11.2"
5657
subxt = "0.34.0"
5758
subxt-signer = "0.34.0"
5859
tokio = { version = "1.36", features = [ "macros", "rt-multi-thread", "time" ] }
59-
tracing-subscriber = { version = "0.3", default-features = false }
60+
tracing-subscriber = { version = "0.3.18", default-features = false }
6061

6162
# Build
6263
substrate-build-script-utils = "11.0.0"

node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ version = "0.2.0-alpha"
1313
[dependencies]
1414
clap.workspace = true
1515
codec.workspace = true
16+
docify.workspace = true
1617
futures.workspace = true
1718
jsonrpsee = { workspace = true, features = [ "server" ] }
1819
log.workspace = true

node/src/service.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ use std::{sync::Arc, time::Duration};
66
use cumulus_client_cli::CollatorOptions;
77
// Cumulus Imports
88
use cumulus_client_collator::service::CollatorService;
9+
#[docify::export(lookahead_collator)]
910
use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams};
1011
use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;
1112
use cumulus_client_consensus_proposer::Proposer;
1213
use cumulus_client_service::{
1314
build_network, build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks,
1415
BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, StartRelayChainTasksParams,
1516
};
17+
#[docify::export(cumulus_primitives)]
1618
use cumulus_primitives_core::{
1719
relay_chain::{CollatorPair, ValidationCode},
1820
ParaId,

runtime/common/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ version = "0.0.0"
1212
targets = [ "x86_64-unknown-linux-gnu" ]
1313

1414
[dependencies]
15-
codec = { workspace = true, default-features = false, features = [ "derive" ] }
16-
scale-info = { workspace = true, default-features = false, features = [ "derive" ] }
15+
codec = { workspace = true, features = [ "derive" ] }
16+
docify.workspace = true
17+
scale-info = { workspace = true, features = [ "derive" ] }
1718

1819
# Substrate
19-
frame-support = { workspace = true, default-features = false }
20-
sp-runtime = { workspace = true, default-features = false }
21-
sp-std = { workspace = true, default-features = false }
20+
frame-support.workspace = true
21+
sp-runtime.workspace = true
2222

23-
parachains-common = { workspace = true, default-features = false }
24-
polkadot-primitives = { workspace = true, default-features = false }
23+
parachains-common.workspace = true
24+
polkadot-primitives.workspace = true
2525

2626
[features]
2727
default = [ "std" ]

runtime/common/src/lib.rs

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ use sp_runtime::Perbill;
99
/// Nonce for an account
1010
pub type Nonce = u32;
1111

12-
/// This determines the average expected block time that we are targeting.
13-
/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`.
14-
/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked
15-
/// up by `pallet_aura` to implement `fn slot_duration()`.
16-
///
17-
/// Change this to adjust the block time.
18-
pub const MILLISECS_PER_BLOCK: u64 = 6000;
19-
20-
// NOTE: Currently it is not possible to change the slot duration after the chain has started.
21-
// Attempting to do so will brick block production.
22-
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
23-
24-
/// Relay chain slot duration, in milliseconds.
25-
// Value is 6000 millisecs. If `MILLISECS_PER_BLOCK` changes this needs addressing.
26-
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
12+
#[docify::export]
13+
mod block_times {
14+
/// This determines the average expected block time that we are targeting.
15+
/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`.
16+
/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked
17+
/// up by `pallet_aura` to implement `fn slot_duration()`.
18+
///
19+
/// Change this to adjust the block time.
20+
pub const MILLISECS_PER_BLOCK: u64 = 6000;
21+
/// The duration of a slot.
22+
// NOTE: Currently it is not possible to change the slot duration after the chain has started.
23+
// Attempting to do so will brick block production.
24+
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
25+
}
26+
pub use block_times::*;
2727

2828
// Time is measured by number of blocks.
2929
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);
3939
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
4040

4141
/// We allow for 2 seconds of compute with a 6-second average block.
42+
#[docify::export(max_block_weight)]
4243
pub const MAXIMUM_BLOCK_WEIGHT: Weight =
4344
Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), MAX_POV_SIZE as u64);
4445

@@ -55,14 +56,19 @@ pub const fn deposit(items: u32, bytes: u32) -> Balance {
5556
/// The existential deposit. Set to 1/1_000 of the Connected Relay Chain.
5657
pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT;
5758

58-
// Async backing
59-
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
60-
/// into the relay chain.
61-
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;
62-
63-
/// How many parachain blocks are processed by the relay chain per parent. Limits the
64-
/// number of blocks authored per slot.
65-
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
59+
#[docify::export]
60+
mod async_backing_params {
61+
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
62+
/// into the relay chain.
63+
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;
64+
/// How many parachain blocks are processed by the relay chain per parent. Limits the
65+
/// number of blocks authored per slot.
66+
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
67+
/// Relay chain slot duration, in milliseconds.
68+
// Value is 6000 millisecs. If `MILLISECS_PER_BLOCK` changes this needs addressing.
69+
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
70+
}
71+
pub use async_backing_params::*;
6672

6773
/// Proxy commons for Pop runtimes
6874
pub mod proxy {

runtime/devnet/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ substrate-wasm-builder.workspace = true
1616

1717
[dependencies]
1818
codec.workspace = true
19+
docify.workspace = true
1920
hex-literal.workspace = true
2021
log.workspace = true
2122
scale-info.workspace = true
@@ -66,7 +67,6 @@ sp-mmr-primitives.workspace = true
6667
sp-offchain.workspace = true
6768
sp-runtime.workspace = true
6869
sp-session.workspace = true
69-
sp-std.workspace = true
7070
sp-transaction-pool.workspace = true
7171
sp-version.workspace = true
7272

@@ -171,7 +171,6 @@ std = [
171171
"sp-offchain/std",
172172
"sp-runtime/std",
173173
"sp-session/std",
174-
"sp-std/std",
175174
"sp-transaction-pool/std",
176175
"sp-version/std",
177176
"xcm-builder/std",

runtime/devnet/src/config/api/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use alloc::vec::Vec;
12
use core::marker::PhantomData;
23

34
use codec::Decode;
@@ -7,7 +8,6 @@ pub(crate) use pallet_api::Extension;
78
use pallet_api::{extension::*, Read};
89
use sp_core::ConstU8;
910
use sp_runtime::DispatchError;
10-
use sp_std::vec::Vec;
1111
use versioning::*;
1212

1313
use crate::{

runtime/devnet/src/config/contracts.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use alloc::core::marker::PhantomData;
2+
13
use frame_support::{
24
parameter_types,
35
traits::{ConstBool, ConstU32, Nothing, Randomness},
@@ -22,7 +24,7 @@ fn schedule<T: pallet_contracts::Config>() -> pallet_contracts::Schedule<T> {
2224

2325
// randomness-collective-flip is insecure. Provide dummy randomness as placeholder for the
2426
// deprecated trait. https://github.com/paritytech/polkadot-sdk/blob/9bf1a5e23884921498b381728bfddaae93f83744/substrate/frame/contracts/mock-network/src/parachain/contracts_config.rs#L45
25-
pub struct DummyRandomness<T: pallet_contracts::Config>(sp_std::marker::PhantomData<T>);
27+
pub struct DummyRandomness<T: pallet_contracts::Config>(PhantomData<T>);
2628

2729
impl<T: pallet_contracts::Config> Randomness<T::Hash, BlockNumberFor<T>> for DummyRandomness<T> {
2830
fn random(_subject: &[u8]) -> (T::Hash, BlockNumberFor<T>) {

runtime/devnet/src/config/ismp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
use alloc::vec::Vec;
2+
13
use frame_support::traits::Get;
24
use frame_system::EnsureRoot;
35
use ismp::{error::Error, host::StateMachine, module::IsmpModule, router::IsmpRouter};
46
use ismp_parachain::ParachainConsensusClient;
5-
use sp_std::prelude::*;
67

78
use crate::{
89
AccountId, Balance, Balances, Ismp, IsmpParachain, ParachainInfo, Runtime, RuntimeEvent,

runtime/devnet/src/lib.rs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
1010
pub mod config;
1111
mod weights;
1212

13+
extern crate alloc;
14+
use alloc::vec::Vec;
15+
1316
// ISMP imports
1417
use ::ismp::{
1518
consensus::{ConsensusClientId, StateMachineHeight, StateMachineId},
@@ -65,7 +68,6 @@ use sp_runtime::{
6568
ApplyExtrinsicResult,
6669
};
6770
pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill};
68-
use sp_std::prelude::*;
6971
#[cfg(feature = "std")]
7072
use sp_version::NativeVersion;
7173
use sp_version::RuntimeVersion;
@@ -351,6 +353,7 @@ parameter_types! {
351353
pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
352354
}
353355

356+
#[docify::export]
354357
type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
355358
Runtime,
356359
RELAY_CHAIN_SLOT_DURATION_MILLIS,
@@ -439,6 +442,7 @@ impl pallet_session::Config for Runtime {
439442
type WeightInfo = ();
440443
}
441444

445+
#[docify::export(aura_config)]
442446
impl pallet_aura::Config for Runtime {
443447
type AllowMultipleBlocksPerSlot = ConstBool<true>;
444448
type AuthorityId = AuraId;
@@ -655,11 +659,27 @@ mod benches {
655659
);
656660
}
657661

662+
// We move some impls outside so we can easily use them with `docify`.
663+
impl Runtime {
664+
#[docify::export]
665+
fn impl_slot_duration() -> sp_consensus_aura::SlotDuration {
666+
sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
667+
}
668+
669+
#[docify::export]
670+
fn impl_can_build_upon(
671+
included_hash: <Block as BlockT>::Hash,
672+
slot: cumulus_primitives_aura::Slot,
673+
) -> bool {
674+
ConsensusHook::can_build_upon(included_hash, slot)
675+
}
676+
}
677+
658678
impl_runtime_apis! {
659679

660680
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
661681
fn slot_duration() -> sp_consensus_aura::SlotDuration {
662-
sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
682+
Runtime::impl_slot_duration()
663683
}
664684

665685
fn authorities() -> Vec<AuraId> {
@@ -866,7 +886,7 @@ impl_runtime_apis! {
866886
included_hash: <Block as BlockT>::Hash,
867887
slot: cumulus_primitives_aura::Slot,
868888
) -> bool {
869-
ConsensusHook::can_build_upon(included_hash, slot)
889+
Runtime::impl_can_build_upon(included_hash, slot)
870890
}
871891
}
872892

@@ -1064,10 +1084,9 @@ impl_runtime_apis! {
10641084
IsmpParachain::current_relay_chain_state()
10651085
}
10661086
}
1067-
1068-
10691087
}
10701088

1089+
#[docify::export(register_validate_block)]
10711090
cumulus_pallet_parachain_system::register_validate_block! {
10721091
Runtime = Runtime,
10731092
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,

runtime/mainnet/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ substrate-wasm-builder.workspace = true
1616

1717
[dependencies]
1818
codec.workspace = true
19+
docify.workspace = true
1920
scale-info.workspace = true
2021
smallvec.workspace = true
2122

@@ -55,7 +56,6 @@ sp-io.workspace = true
5556
sp-offchain.workspace = true
5657
sp-runtime.workspace = true
5758
sp-session.workspace = true
58-
sp-std.workspace = true
5959
sp-transaction-pool.workspace = true
6060
sp-version.workspace = true
6161

@@ -139,7 +139,6 @@ std = [
139139
"sp-offchain/std",
140140
"sp-runtime/std",
141141
"sp-session/std",
142-
"sp-std/std",
143142
"sp-transaction-pool/std",
144143
"sp-version/std",
145144
"xcm-builder/std",

0 commit comments

Comments
 (0)