Skip to content

Commit 65c2c0c

Browse files
svyatonikbkchr
authored andcommitted
Update Substrate/Polkadot/Cumulus references (#1353)
* cumulus: 4e952282914719fafd2df450993ccc2ce9395415 polkadot: 975e780 substrate: 89fcb3e * fix refs * sync changes from paritytech/polkadot#3828 * sync changes from paritytech/polkadot#4387 * sync changes from paritytech/polkadot#3940 * sync with changes from paritytech/polkadot#4493 * sync with changes from paritytech/polkadot#4958 * sync with changes from paritytech/polkadot#3889 * sync with changes from paritytech/polkadot#5033 * sync with changes from paritytech/polkadot#5065 * compilation fixes * fixed prometheus endpoint startup (it now requires to be spawned within tokio context)
1 parent ed2a308 commit 65c2c0c

File tree

66 files changed

+473
-286
lines changed

Some content is hidden

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

66 files changed

+473
-286
lines changed

bridges/bin/millau/node/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
1010
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
1111

1212
[dependencies]
13-
clap = { version = "3.0", features = ["derive"] }
13+
clap = { version = "3.1", features = ["derive"] }
1414
jsonrpc-core = "18.0"
1515
serde_json = "1.0.59"
1616

bridges/bin/millau/node/src/service.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use sc_finality_grandpa::SharedVoterState;
3737
use sc_keystore::LocalKeystore;
3838
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
3939
use sc_telemetry::{Telemetry, TelemetryWorker};
40-
use sp_consensus::SlotData;
4140
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
4241
use std::{sync::Arc, time::Duration};
4342

@@ -141,7 +140,7 @@ pub fn new_partial(
141140
telemetry.as_ref().map(|x| x.handle()),
142141
)?;
143142

144-
let slot_duration = sc_consensus_aura::slot_duration(&*client)?.slot_duration();
143+
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
145144

146145
let import_queue =
147146
sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(ImportQueueParams {
@@ -152,7 +151,7 @@ pub fn new_partial(
152151
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
153152

154153
let slot =
155-
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
154+
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
156155
*timestamp,
157156
slot_duration,
158157
);
@@ -349,7 +348,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
349348
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
350349

351350
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
352-
let raw_slot_duration = slot_duration.slot_duration();
353351

354352
let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _, _, _>(
355353
StartAuraParams {
@@ -362,9 +360,9 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
362360
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
363361

364362
let slot =
365-
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
363+
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
366364
*timestamp,
367-
raw_slot_duration,
365+
slot_duration,
368366
);
369367

370368
Ok((timestamp, slot))

bridges/bin/millau/runtime/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
99

1010
[dependencies]
1111
hex-literal = "0.3"
12-
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] }
12+
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
1313
libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] }
14-
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
14+
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
1515
serde = { version = "1.0", optional = true, features = ["derive"] }
1616

1717
# Bridge dependencies
@@ -124,7 +124,7 @@ std = [
124124
]
125125
runtime-benchmarks = [
126126
"bridge-runtime-common/runtime-benchmarks",
127-
"frame-benchmarking",
127+
"frame-benchmarking/runtime-benchmarks",
128128
"frame-support/runtime-benchmarks",
129129
"frame-system/runtime-benchmarks",
130130
"libsecp256k1",

bridges/bin/millau/runtime/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#![recursion_limit = "256"]
2222
// Runtime-generated enums
2323
#![allow(clippy::large_enum_variant)]
24-
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
25-
#![allow(clippy::unnecessary_mut_passed)]
2624
// From construct_runtime macro
2725
#![allow(clippy::from_over_into)]
2826

@@ -543,6 +541,7 @@ pub type SignedBlock = generic::SignedBlock<Block>;
543541
pub type BlockId = generic::BlockId<Block>;
544542
/// The SignedExtension to the basic transaction logic.
545543
pub type SignedExtra = (
544+
frame_system::CheckNonZeroSender<Runtime>,
546545
frame_system::CheckSpecVersion<Runtime>,
547546
frame_system::CheckTxVersion<Runtime>,
548547
frame_system::CheckGenesis<Runtime>,
@@ -913,7 +912,6 @@ impl_runtime_apis! {
913912
add_benchmark!(params, batches, pallet_bridge_grandpa, BridgeRialtoGrandpa);
914913
add_benchmark!(params, batches, pallet_bridge_token_swap, BridgeRialtoTokenSwap);
915914

916-
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
917915
Ok(batches)
918916
}
919917
}

bridges/bin/rialto-parachain/node/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ default = []
1818
runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks']
1919

2020
[dependencies]
21-
clap = { version = "3.0", features = ["derive"] }
21+
clap = { version = "3.1", features = ["derive"] }
2222
derive_more = '0.99.2'
2323
log = '0.4.14'
24-
codec = { package = 'parity-scale-codec', version = '2.0.0' }
24+
codec = { package = 'parity-scale-codec', version = '3.0.0' }
2525
serde = { version = '1.0', features = ['derive'] }
2626
hex-literal = '0.3.1'
2727

@@ -81,7 +81,7 @@ cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch
8181
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master" }
8282
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "master" }
8383
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
84-
cumulus-relay-chain-local = { git = "https://github.com/paritytech/cumulus", branch = "master" }
84+
cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
8585

8686
# Polkadot dependencies
8787
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }

bridges/bin/rialto-parachain/node/src/cli.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
1616

1717
use crate::chain_spec;
18-
use clap::{AppSettings, Parser};
18+
use clap::Parser;
1919
use std::path::PathBuf;
2020

2121
/// Sub-commands supported by the collator.
@@ -94,11 +94,11 @@ pub struct ExportGenesisWasmCommand {
9494
}
9595

9696
#[derive(Debug, Parser)]
97-
#[clap(setting(
98-
AppSettings::PropagateVersion |
99-
AppSettings::ArgsNegateSubcommands |
100-
AppSettings::SubcommandsNegateReqs,
101-
))]
97+
#[clap(
98+
propagate_version = true,
99+
args_conflicts_with_subcommands = true,
100+
subcommand_negates_reqs = true
101+
)]
102102
pub struct Cli {
103103
#[clap(subcommand)]
104104
pub subcommand: Option<Subcommand>,

bridges/bin/rialto-parachain/node/src/command.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ pub fn run() -> Result<()> {
265265
},
266266
None => {
267267
let runner = cli.create_runner(&cli.run.normalize())?;
268+
let collator_options = cli.run.collator_options();
268269

269270
runner.run_node_until_exit(|config| async move {
270271
let para_id =
@@ -278,7 +279,7 @@ pub fn run() -> Result<()> {
278279
let id = ParaId::from(cli.parachain_id.or(para_id).expect("Missing ParaId"));
279280

280281
let parachain_account =
281-
AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);
282+
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account(&id);
282283

283284
let state_version =
284285
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
@@ -298,7 +299,7 @@ pub fn run() -> Result<()> {
298299
info!("Parachain genesis state: {}", genesis_state);
299300
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
300301

301-
crate::service::start_node(config, polkadot_config, id)
302+
crate::service::start_node(config, polkadot_config, collator_options, id)
302303
.await
303304
.map(|r| r.0)
304305
.map_err(Into::into)

bridges/bin/rialto-parachain/node/src/service.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ use std::{sync::Arc, time::Duration};
2828
use rialto_parachain_runtime::RuntimeApi;
2929

3030
// Cumulus Imports
31+
use cumulus_client_cli::CollatorOptions;
3132
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
3233
use cumulus_client_consensus_common::ParachainConsensus;
3334
use cumulus_client_network::BlockAnnounceValidator;
3435
use cumulus_client_service::{
3536
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
3637
};
3738
use cumulus_primitives_core::ParaId;
38-
use cumulus_relay_chain_interface::RelayChainInterface;
39-
use cumulus_relay_chain_local::build_relay_chain_interface;
39+
use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
40+
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface};
4041

4142
// Substrate Imports
4243
use sc_client_api::ExecutorProvider;
@@ -45,7 +46,6 @@ use sc_network::NetworkService;
4546
use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager};
4647
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
4748
use sp_api::ConstructRuntimeApi;
48-
use sp_consensus::SlotData;
4949
use sp_keystore::SyncCryptoStorePtr;
5050
use sp_runtime::traits::BlakeTwo256;
5151
use substrate_prometheus_endpoint::Registry;
@@ -195,6 +195,7 @@ where
195195
async fn start_node_impl<RuntimeApi, Executor, RB, BIQ, BIC>(
196196
parachain_config: Configuration,
197197
polkadot_config: Configuration,
198+
collator_options: CollatorOptions,
198199
id: ParaId,
199200
rpc_ext_builder: RB,
200201
build_import_queue: BIQ,
@@ -270,12 +271,16 @@ where
270271
let (mut telemetry, telemetry_worker_handle) = params.other;
271272

272273
let mut task_manager = params.task_manager;
273-
let (relay_chain_interface, collator_key) =
274-
build_relay_chain_interface(polkadot_config, telemetry_worker_handle, &mut task_manager)
275-
.map_err(|e| match e {
276-
polkadot_service::Error::Sub(x) => x,
277-
s => format!("{}", s).into(),
278-
})?;
274+
let (relay_chain_interface, collator_key) = build_inprocess_relay_chain(
275+
polkadot_config,
276+
&parachain_config,
277+
telemetry_worker_handle,
278+
&mut task_manager,
279+
)
280+
.map_err(|e| match e {
281+
RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x,
282+
s => s.to_string().into(),
283+
})?;
279284

280285
let client = params.client.clone();
281286
let backend = params.backend.clone();
@@ -350,7 +355,7 @@ where
350355
spawner,
351356
parachain_consensus,
352357
import_queue,
353-
collator_key,
358+
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
354359
relay_chain_slot_duration,
355360
};
356361

@@ -364,6 +369,7 @@ where
364369
relay_chain_interface,
365370
relay_chain_slot_duration,
366371
import_queue,
372+
collator_options,
367373
};
368374

369375
start_full_node(params)?;
@@ -405,9 +411,9 @@ pub fn parachain_build_import_queue(
405411
let time = sp_timestamp::InherentDataProvider::from_system_time();
406412

407413
let slot =
408-
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
414+
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
409415
*time,
410-
slot_duration.slot_duration(),
416+
slot_duration,
411417
);
412418

413419
Ok((time, slot))
@@ -424,6 +430,7 @@ pub fn parachain_build_import_queue(
424430
pub async fn start_node(
425431
parachain_config: Configuration,
426432
polkadot_config: Configuration,
433+
collator_options: CollatorOptions,
427434
id: ParaId,
428435
) -> sc_service::error::Result<(
429436
TaskManager,
@@ -432,6 +439,7 @@ pub async fn start_node(
432439
start_node_impl::<RuntimeApi, ParachainRuntimeExecutor, _, _, _>(
433440
parachain_config,
434441
polkadot_config,
442+
collator_options,
435443
id,
436444
|deny_unsafe, client, pool| {
437445
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
@@ -481,9 +489,9 @@ pub async fn start_node(
481489
).await;
482490
let time = sp_timestamp::InherentDataProvider::from_system_time();
483491

484-
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
492+
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
485493
*time,
486-
slot_duration.slot_duration(),
494+
slot_duration,
487495
);
488496

489497
let parachain_inherent = parachain_inherent.ok_or_else(|| {

bridges/bin/rialto-parachain/runtime/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
1111
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
1212

1313
[dependencies]
14-
codec = { package = 'parity-scale-codec', version = '2.0.0', default-features = false, features = ['derive']}
14+
codec = { package = 'parity-scale-codec', version = '3.0.0', default-features = false, features = ['derive']}
1515
log = { version = "0.4.14", default-features = false }
16-
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
16+
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
1717
serde = { version = '1.0', optional = true, features = ['derive'] }
1818

1919
# Bridge depedencies

bridges/bin/rialto-parachain/runtime/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use sp_version::RuntimeVersion;
4242

4343
// A few exports that help ease life for downstream crates.
4444
pub use frame_support::{
45-
construct_runtime, match_type, parameter_types,
45+
construct_runtime, match_types, parameter_types,
4646
traits::{Everything, IsInVec, Randomness},
4747
weights::{
4848
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
@@ -86,6 +86,7 @@ pub type SignedBlock = generic::SignedBlock<Block>;
8686
pub type BlockId = generic::BlockId<Block>;
8787
/// The SignedExtension to the basic transaction logic.
8888
pub type SignedExtra = (
89+
frame_system::CheckNonZeroSender<Runtime>,
8990
frame_system::CheckSpecVersion<Runtime>,
9091
frame_system::CheckGenesis<Runtime>,
9192
frame_system::CheckEra<Runtime>,
@@ -350,7 +351,7 @@ parameter_types! {
350351
pub const MaxAuthorities: u32 = 100_000;
351352
}
352353

353-
match_type! {
354+
match_types! {
354355
pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
355356
MultiLocation { parents: 1, interior: Here } |
356357
MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
@@ -423,6 +424,9 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
423424
type ChannelInfo = ParachainSystem;
424425
type VersionWrapper = ();
425426
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
427+
type ControllerOrigin = EnsureRoot<AccountId>;
428+
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
429+
type WeightInfo = ();
426430
}
427431

428432
impl cumulus_pallet_dmp_queue::Config for Runtime {
@@ -613,7 +617,6 @@ impl_runtime_apis! {
613617
add_benchmark!(params, batches, pallet_balances, Balances);
614618
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
615619

616-
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
617620
Ok(batches)
618621
}
619622
}

0 commit comments

Comments
 (0)