Skip to content

Commit 57cfcab

Browse files
committed
Merge remote-tracking branch 'origin/master' into bko-bridges-backports-and-nits
2 parents b784e82 + 7f7f5fa commit 57cfcab

File tree

70 files changed

+219
-196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+219
-196
lines changed

.github/workflows/release-30_publish_release_draft.yml

+8-12
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
runs-on: ubuntu-latest
3232
strategy:
3333
matrix:
34-
binary: [ frame-omni-bencher, chain-spec-builder ]
34+
# Tuples of [package, binary-name]
35+
binary: [ [frame-omni-bencher, frame-omni-bencher], [staging-chain-spec-builder, chain-spec-builder] ]
3536
steps:
3637
- name: Checkout sources
3738
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
@@ -41,21 +42,16 @@ jobs:
4142
sudo apt update
4243
sudo apt install -y protobuf-compiler
4344
44-
- name: Build ${{ matrix.binary }} binary
45+
- name: Build ${{ matrix.binary[1] }} binary
4546
run: |
46-
if [[ ${{ matrix.binary }} =~ chain-spec-builder ]]; then
47-
cargo build --locked --profile=production -p staging-${{ matrix.binary }} --bin ${{ matrix.binary }}
48-
target/production/${{ matrix.binary }} -h
49-
else
50-
cargo build --locked --profile=production -p ${{ matrix.binary }}
51-
target/production/${{ matrix.binary }} --version
52-
fi
47+
cargo build --locked --profile=production -p ${{ matrix.binary[0] }} --bin ${{ matrix.binary[1] }}
48+
target/production/${{ matrix.binary[1] }} --version
5349
54-
- name: Upload ${{ matrix.binary }} binary
50+
- name: Upload ${{ matrix.binary[1] }} binary
5551
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
5652
with:
57-
name: ${{ matrix.binary }}
58-
path: target/production/${{ matrix.binary }}
53+
name: ${{ matrix.binary[1] }}
54+
path: target/production/${{ matrix.binary[1] }}
5955

6056

6157
publish-release-draft:

cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
118118
spec_name: create_runtime_str!("statemine"),
119119
impl_name: create_runtime_str!("statemine"),
120120
authoring_version: 1,
121-
spec_version: 1_012_000,
121+
spec_version: 1_013_000,
122122
impl_version: 0,
123123
apis: RUNTIME_API_VERSIONS,
124124
transaction_version: 16,

cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
117117
spec_name: create_runtime_str!("westmint"),
118118
impl_name: create_runtime_str!("westmint"),
119119
authoring_version: 1,
120-
spec_version: 1_012_000,
120+
spec_version: 1_013_000,
121121
impl_version: 0,
122122
apis: RUNTIME_API_VERSIONS,
123123
transaction_version: 16,

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
214214
spec_name: create_runtime_str!("bridge-hub-rococo"),
215215
impl_name: create_runtime_str!("bridge-hub-rococo"),
216216
authoring_version: 1,
217-
spec_version: 1_012_000,
217+
spec_version: 1_013_000,
218218
impl_version: 0,
219219
apis: RUNTIME_API_VERSIONS,
220220
transaction_version: 5,

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
189189
spec_name: create_runtime_str!("bridge-hub-westend"),
190190
impl_name: create_runtime_str!("bridge-hub-westend"),
191191
authoring_version: 1,
192-
spec_version: 1_012_000,
192+
spec_version: 1_013_000,
193193
impl_version: 0,
194194
apis: RUNTIME_API_VERSIONS,
195195
transaction_version: 5,

cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_data/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pub fn prepare_inbound_xcm<InnerXcmRuntimeCall>(
3939
xcm_message: Xcm<InnerXcmRuntimeCall>,
4040
destination: InteriorLocation,
4141
) -> Vec<u8> {
42-
let location = xcm::VersionedInteriorLocation::V4(destination);
43-
let xcm = xcm::VersionedXcm::<InnerXcmRuntimeCall>::V4(xcm_message);
42+
let location = xcm::VersionedInteriorLocation::from(destination);
43+
let xcm = xcm::VersionedXcm::<InnerXcmRuntimeCall>::from(xcm_message);
4444
// this is the `BridgeMessage` from polkadot xcm builder, but it has no constructor
4545
// or public fields, so just tuple
4646
// (double encoding, because `.encode()` is called on original Xcm BLOB when it is pushed

cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
122122
spec_name: create_runtime_str!("collectives-westend"),
123123
impl_name: create_runtime_str!("collectives-westend"),
124124
authoring_version: 1,
125-
spec_version: 1_012_000,
125+
spec_version: 1_013_000,
126126
impl_version: 0,
127127
apis: RUNTIME_API_VERSIONS,
128128
transaction_version: 6,

cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
142142
spec_name: create_runtime_str!("contracts-rococo"),
143143
impl_name: create_runtime_str!("contracts-rococo"),
144144
authoring_version: 1,
145-
spec_version: 1_012_000,
145+
spec_version: 1_013_000,
146146
impl_version: 0,
147147
apis: RUNTIME_API_VERSIONS,
148148
transaction_version: 7,

cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
142142
spec_name: create_runtime_str!("coretime-rococo"),
143143
impl_name: create_runtime_str!("coretime-rococo"),
144144
authoring_version: 1,
145-
spec_version: 1_012_000,
145+
spec_version: 1_013_000,
146146
impl_version: 0,
147147
apis: RUNTIME_API_VERSIONS,
148148
transaction_version: 1,

cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
141141
spec_name: create_runtime_str!("coretime-westend"),
142142
impl_name: create_runtime_str!("coretime-westend"),
143143
authoring_version: 1,
144-
spec_version: 1_012_000,
144+
spec_version: 1_013_000,
145145
impl_version: 0,
146146
apis: RUNTIME_API_VERSIONS,
147147
transaction_version: 1,

cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
100100
spec_name: create_runtime_str!("glutton-westend"),
101101
impl_name: create_runtime_str!("glutton-westend"),
102102
authoring_version: 1,
103-
spec_version: 1_012_000,
103+
spec_version: 1_013_000,
104104
impl_version: 0,
105105
apis: RUNTIME_API_VERSIONS,
106106
transaction_version: 1,

cumulus/parachains/runtimes/people/people-rococo/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
132132
spec_name: create_runtime_str!("people-rococo"),
133133
impl_name: create_runtime_str!("people-rococo"),
134134
authoring_version: 1,
135-
spec_version: 1_012_000,
135+
spec_version: 1_013_000,
136136
impl_version: 0,
137137
apis: RUNTIME_API_VERSIONS,
138138
transaction_version: 1,

cumulus/parachains/runtimes/people/people-westend/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
132132
spec_name: create_runtime_str!("people-westend"),
133133
impl_name: create_runtime_str!("people-westend"),
134134
authoring_version: 1,
135-
spec_version: 1_012_000,
135+
spec_version: 1_013_000,
136136
impl_version: 0,
137137
apis: RUNTIME_API_VERSIONS,
138138
transaction_version: 1,

cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
107107
spec_name: create_runtime_str!("test-parachain"),
108108
impl_name: create_runtime_str!("test-parachain"),
109109
authoring_version: 1,
110-
spec_version: 1_012_000,
110+
spec_version: 1_013_000,
111111
impl_version: 0,
112112
apis: RUNTIME_API_VERSIONS,
113113
transaction_version: 6,

cumulus/polkadot-parachain/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ path = "src/main.rs"
1818
async-trait = "0.1.79"
1919
clap = { version = "4.5.3", features = ["derive"] }
2020
codec = { package = "parity-scale-codec", version = "3.6.12" }
21+
color-print = "0.3.4"
2122
futures = "0.3.28"
2223
hex-literal = "0.4.1"
2324
log = { workspace = true, default-features = true }
@@ -111,7 +112,6 @@ cumulus-client-service = { path = "../client/service" }
111112
cumulus-primitives-aura = { path = "../primitives/aura" }
112113
cumulus-primitives-core = { path = "../primitives/core" }
113114
cumulus-relay-chain-interface = { path = "../client/relay-chain-interface" }
114-
color-print = "0.3.4"
115115

116116
[build-dependencies]
117117
substrate-build-script-utils = { path = "../../substrate/utils/build-script-utils" }

cumulus/polkadot-parachain/src/cli.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
1616

17+
use clap::{CommandFactory, FromArgMatches};
1718
use std::path::PathBuf;
1819

1920
/// Sub-commands supported by the collator.
@@ -108,18 +109,19 @@ pub struct RelayChainCli {
108109
}
109110

110111
impl RelayChainCli {
111-
/// Parse the relay chain CLI parameters using the para chain `Configuration`.
112+
/// Parse the relay chain CLI parameters using the parachain `Configuration`.
112113
pub fn new<'a>(
113114
para_config: &sc_service::Configuration,
114115
relay_chain_args: impl Iterator<Item = &'a String>,
115116
) -> Self {
117+
let polkadot_cmd = polkadot_cli::RunCmd::command().no_binary_name(true);
118+
let matches = polkadot_cmd.get_matches_from(relay_chain_args);
119+
let base = FromArgMatches::from_arg_matches(&matches).unwrap_or_else(|e| e.exit());
120+
116121
let extension = crate::chain_spec::Extensions::try_get(&*para_config.chain_spec);
117122
let chain_id = extension.map(|e| e.relay_chain.clone());
123+
118124
let base_path = para_config.base_path.path().join("polkadot");
119-
Self {
120-
base_path: Some(base_path),
121-
chain_id,
122-
base: clap::Parser::parse_from(relay_chain_args),
123-
}
125+
Self { base, chain_id, base_path: Some(base_path) }
124126
}
125127
}

cumulus/polkadot-parachain/src/command.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,9 @@ pub fn run() -> Result<()> {
530530
}),
531531
Some(Subcommand::PurgeChain(cmd)) => {
532532
let runner = cli.create_runner(cmd)?;
533+
let polkadot_cli = RelayChainCli::new(runner.config(), cli.relaychain_args.iter());
533534

534535
runner.sync_run(|config| {
535-
let polkadot_cli = RelayChainCli::new(
536-
&config,
537-
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
538-
);
539-
540536
let polkadot_config = SubstrateCli::create_configuration(
541537
&polkadot_cli,
542538
&polkadot_cli,
@@ -603,6 +599,7 @@ pub fn run() -> Result<()> {
603599
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
604600
None => {
605601
let runner = cli.create_runner(&cli.run.normalize())?;
602+
let polkadot_cli = RelayChainCli::new(runner.config(), cli.relaychain_args.iter());
606603
let collator_options = cli.run.collator_options();
607604

608605
runner.run_node_until_exit(|config| async move {
@@ -648,11 +645,6 @@ pub fn run() -> Result<()> {
648645
.map(|e| e.para_id)
649646
.ok_or("Could not find parachain extension in chain-spec.")?;
650647

651-
let polkadot_cli = RelayChainCli::new(
652-
&config,
653-
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
654-
);
655-
656648
let id = ParaId::from(para_id);
657649

658650
let parachain_account =
@@ -667,7 +659,7 @@ pub fn run() -> Result<()> {
667659
info!("Parachain Account: {}", parachain_account);
668660
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
669661

670-
match polkadot_config.network.network_backend {
662+
match config.network.network_backend {
671663
sc_network::config::NetworkBackendType::Libp2p =>
672664
start_node::<sc_network::NetworkWorker<_, _>>(
673665
config,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright (C) Parity Technologies (UK) Ltd.
2+
// This file is part of Cumulus.
3+
4+
// Cumulus is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Cumulus is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
16+
17+
//! Aura-related primitives for cumulus parachain collators.
18+
19+
use codec::Codec;
20+
use cumulus_primitives_aura::AuraUnincludedSegmentApi;
21+
use cumulus_primitives_core::BlockT;
22+
use sp_consensus_aura::AuraApi;
23+
use sp_runtime::app_crypto::{AppCrypto, AppPair, AppSignature, Pair};
24+
25+
/// Convenience trait for defining the basic bounds of an `AuraId`.
26+
pub trait AuraIdT: AppCrypto<Pair = Self::BoundedPair> + Codec + Send {
27+
/// Extra bounds for the `Pair`.
28+
type BoundedPair: AppPair + AppCrypto<Signature = Self::BoundedSignature>;
29+
30+
/// Extra bounds for the `Signature`.
31+
type BoundedSignature: AppSignature
32+
+ TryFrom<Vec<u8>>
33+
+ std::hash::Hash
34+
+ sp_runtime::traits::Member
35+
+ Codec;
36+
}
37+
38+
impl<T> AuraIdT for T
39+
where
40+
T: AppCrypto + Codec + Send + Sync,
41+
<<T as AppCrypto>::Pair as AppCrypto>::Signature:
42+
TryFrom<Vec<u8>> + std::hash::Hash + sp_runtime::traits::Member + Codec,
43+
{
44+
type BoundedPair = <T as AppCrypto>::Pair;
45+
type BoundedSignature = <<T as AppCrypto>::Pair as AppCrypto>::Signature;
46+
}
47+
48+
/// Convenience trait for defining the basic bounds of a parachain runtime that supports
49+
/// the Aura consensus.
50+
pub trait AuraRuntimeApi<Block: BlockT, AuraId: AuraIdT>:
51+
sp_api::ApiExt<Block>
52+
+ AuraApi<Block, <AuraId::BoundedPair as Pair>::Public>
53+
+ AuraUnincludedSegmentApi<Block>
54+
+ Sized
55+
{
56+
/// Check if the runtime has the Aura API.
57+
fn has_aura_api(&self, at: Block::Hash) -> bool {
58+
self.has_api::<dyn AuraApi<Block, <AuraId::BoundedPair as Pair>::Public>>(at)
59+
.unwrap_or(false)
60+
}
61+
}
62+
63+
impl<T, Block: BlockT, AuraId: AuraIdT> AuraRuntimeApi<Block, AuraId> for T where
64+
T: sp_api::ApiExt<Block>
65+
+ AuraApi<Block, <AuraId::BoundedPair as Pair>::Public>
66+
+ AuraUnincludedSegmentApi<Block>
67+
{
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright (C) Parity Technologies (UK) Ltd.
2+
// This file is part of Cumulus.
3+
4+
// Cumulus is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Cumulus is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
16+
17+
//! Cumulus parachain collator primitives.
18+
19+
#![warn(missing_docs)]
20+
21+
pub mod aura;
22+
23+
use cumulus_primitives_core::CollectCollationInfo;
24+
use sp_api::{ApiExt, CallApiAt, ConstructRuntimeApi, Metadata};
25+
use sp_block_builder::BlockBuilder;
26+
use sp_runtime::traits::Block as BlockT;
27+
use sp_session::SessionKeys;
28+
use sp_transaction_pool::runtime_api::TaggedTransactionQueue;
29+
30+
/// Convenience trait that defines the basic bounds for the `RuntimeApi` of a parachain node.
31+
pub trait NodeRuntimeApi<Block: BlockT>:
32+
ApiExt<Block>
33+
+ Metadata<Block>
34+
+ SessionKeys<Block>
35+
+ BlockBuilder<Block>
36+
+ TaggedTransactionQueue<Block>
37+
+ CollectCollationInfo<Block>
38+
+ Sized
39+
{
40+
}
41+
42+
impl<T, Block: BlockT> NodeRuntimeApi<Block> for T where
43+
T: ApiExt<Block>
44+
+ Metadata<Block>
45+
+ SessionKeys<Block>
46+
+ BlockBuilder<Block>
47+
+ TaggedTransactionQueue<Block>
48+
+ CollectCollationInfo<Block>
49+
{
50+
}
51+
52+
/// Convenience trait that defines the basic bounds for the `ConstructRuntimeApi` of a parachain
53+
/// node.
54+
pub trait ConstructNodeRuntimeApi<Block: BlockT, C: CallApiAt<Block>>:
55+
ConstructRuntimeApi<Block, C, RuntimeApi = Self::BoundedRuntimeApi> + Send + Sync + 'static
56+
{
57+
/// Basic bounds for the `RuntimeApi` of a parachain node.
58+
type BoundedRuntimeApi: NodeRuntimeApi<Block>;
59+
}
60+
61+
impl<T, Block: BlockT, C: CallApiAt<Block>> ConstructNodeRuntimeApi<Block, C> for T
62+
where
63+
T: ConstructRuntimeApi<Block, C> + Send + Sync + 'static,
64+
T::RuntimeApi: NodeRuntimeApi<Block>,
65+
{
66+
type BoundedRuntimeApi = T::RuntimeApi;
67+
}

0 commit comments

Comments
 (0)