diff --git a/bridges/bin/millau/node/Cargo.toml b/bridges/bin/millau/node/Cargo.toml
index c4438d0cef..12a10ad6c2 100644
--- a/bridges/bin/millau/node/Cargo.toml
+++ b/bridges/bin/millau/node/Cargo.toml
@@ -10,8 +10,8 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
+clap = { version = "3.0", features = ["derive"] }
jsonrpc-core = "18.0"
-structopt = "0.3.21"
serde_json = "1.0.59"
# Bridge dependencies
diff --git a/bridges/bin/millau/node/src/chain_spec.rs b/bridges/bin/millau/node/src/chain_spec.rs
index ad424ba463..a7e3c7c877 100644
--- a/bridges/bin/millau/node/src/chain_spec.rs
+++ b/bridges/bin/millau/node/src/chain_spec.rs
@@ -95,6 +95,7 @@ impl Alternative {
vec![],
None,
None,
+ None,
properties,
None,
),
@@ -119,6 +120,7 @@ impl Alternative {
vec![],
None,
None,
+ None,
properties,
None,
),
@@ -195,7 +197,7 @@ fn testnet_genesis(
aura: AuraConfig { authorities: Vec::new() },
beefy: BeefyConfig { authorities: Vec::new() },
grandpa: GrandpaConfig { authorities: Vec::new() },
- sudo: SudoConfig { key: root_key },
+ sudo: SudoConfig { key: Some(root_key) },
session: SessionConfig {
keys: initial_authorities
.iter()
diff --git a/bridges/bin/millau/node/src/cli.rs b/bridges/bin/millau/node/src/cli.rs
index 086def633c..c3c3d134e3 100644
--- a/bridges/bin/millau/node/src/cli.rs
+++ b/bridges/bin/millau/node/src/cli.rs
@@ -14,10 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see .
+use clap::Parser;
use sc_cli::RunCmd;
-use structopt::StructOpt;
-#[derive(Debug, StructOpt)]
+#[derive(Debug, Parser)]
pub struct Cli {
#[structopt(subcommand)]
pub subcommand: Option,
@@ -27,9 +27,10 @@ pub struct Cli {
}
/// Possible subcommands of the main binary.
-#[derive(Debug, StructOpt)]
+#[derive(Debug, Parser)]
pub enum Subcommand {
/// Key management CLI utilities
+ #[clap(subcommand)]
Key(sc_cli::KeySubcommand),
/// Verify a signature for a message, provided on `STDIN`, with a given (public or secret) key.
diff --git a/bridges/bin/millau/node/src/service.rs b/bridges/bin/millau/node/src/service.rs
index 36e1b94875..db64af878f 100644
--- a/bridges/bin/millau/node/src/service.rs
+++ b/bridges/bin/millau/node/src/service.rs
@@ -30,7 +30,7 @@
// =====================================================================================
use millau_runtime::{self, opaque::Block, RuntimeApi};
-use sc_client_api::ExecutorProvider;
+use sc_client_api::{BlockBackend, ExecutorProvider};
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
pub use sc_executor::NativeElseWasmExecutor;
use sc_finality_grandpa::SharedVoterState;
@@ -108,6 +108,7 @@ pub fn new_partial(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
+ config.runtime_cache_size,
);
let (client, backend, keystore_container, task_manager) =
@@ -210,8 +211,27 @@ pub fn new_full(mut config: Configuration) -> Result
};
}
- config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config());
- config.network.extra_sets.push(beefy_gadget::beefy_peers_set_config());
+ // Note: GrandPa is pushed before the Polkadot-specific protocols. This doesn't change
+ // anything in terms of behaviour, but makes the logs more consistent with the other
+ // Substrate nodes.
+ let grandpa_protocol_name = sc_finality_grandpa::protocol_standard_name(
+ &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
+ &config.chain_spec,
+ );
+ config
+ .network
+ .extra_sets
+ .push(sc_finality_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()));
+
+ let beefy_protocol_name = beefy_gadget::protocol_standard_name(
+ &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
+ &config.chain_spec,
+ );
+ config
+ .network
+ .extra_sets
+ .push(beefy_gadget::beefy_peers_set_config(beefy_protocol_name.clone()));
+
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
@@ -245,8 +265,10 @@ pub fn new_full(mut config: Configuration) -> Result
let enable_grandpa = !config.disable_grandpa;
let prometheus_registry = config.prometheus_registry().cloned();
let shared_voter_state = SharedVoterState::empty();
- let (signed_commitment_sender, signed_commitment_stream) =
- beefy_gadget::notification::BeefySignedCommitmentStream::channel();
+ let (beefy_commitment_link, beefy_commitment_stream) =
+ beefy_gadget::notification::BeefySignedCommitmentStream::::channel();
+ let (beefy_best_block_link, beefy_best_block_stream) =
+ beefy_gadget::notification::BeefyBestBlockStream::::channel();
let rpc_extensions_builder = {
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
@@ -287,10 +309,12 @@ pub fn new_full(mut config: Configuration) -> Result
finality_proof_provider.clone(),
)));
io.extend_with(beefy_gadget_rpc::BeefyApi::to_delegate(
- beefy_gadget_rpc::BeefyRpcHandler::new(
- signed_commitment_stream.clone(),
+ beefy_gadget_rpc::BeefyRpcHandler::::new(
+ beefy_commitment_stream.clone(),
+ beefy_best_block_stream.clone(),
subscription_executor,
- ),
+ )
+ .map_err(|e| sc_service::Error::Other(format!("{}", e)))?,
));
io.extend_with(pallet_mmr_rpc::MmrApi::to_delegate(pallet_mmr_rpc::Mmr::new(
client.clone(),
@@ -374,9 +398,11 @@ pub fn new_full(mut config: Configuration) -> Result
backend,
key_store: keystore.clone(),
network: network.clone(),
- signed_commitment_sender,
+ signed_commitment_sender: beefy_commitment_link,
+ beefy_best_block_sender: beefy_best_block_link,
min_block_delta: 4,
prometheus_registry: prometheus_registry.clone(),
+ protocol_name: beefy_protocol_name,
};
// Start the BEEFY bridge gadget.
@@ -395,6 +421,7 @@ pub fn new_full(mut config: Configuration) -> Result
keystore,
local_role: role,
telemetry: telemetry.as_ref().map(|x| x.handle()),
+ protocol_name: grandpa_protocol_name,
};
if enable_grandpa {
diff --git a/bridges/bin/millau/runtime/src/lib.rs b/bridges/bin/millau/runtime/src/lib.rs
index 33839614e7..e0c3903621 100644
--- a/bridges/bin/millau/runtime/src/lib.rs
+++ b/bridges/bin/millau/runtime/src/lib.rs
@@ -138,6 +138,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
+ state_version: 0,
};
/// The version information used to identify this runtime when compiled natively.
@@ -204,6 +205,7 @@ impl frame_system::Config for Runtime {
type SS58Prefix = SS58Prefix;
/// The set code logic, just the default since we're not a parachain.
type OnSetCode = ();
+ type MaxConsumers = frame_support::traits::ConstU32<16>;
}
impl pallet_randomness_collective_flip::Config for Runtime {}
@@ -562,7 +564,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext,
Runtime,
- AllPallets,
+ AllPalletsWithSystem,
>;
impl_runtime_apis! {
@@ -664,7 +666,7 @@ impl_runtime_apis! {
}
impl beefy_primitives::BeefyApi for Runtime {
- fn validator_set() -> ValidatorSet {
+ fn validator_set() -> Option> {
Beefy::validator_set()
}
}
@@ -841,7 +843,7 @@ impl_runtime_apis! {
}
fn bridged_relayer_id() -> Self::InboundRelayer {
- Default::default()
+ [0u8; 32].into()
}
fn account_balance(account: &Self::AccountId) -> Self::OutboundMessageFee {
diff --git a/bridges/bin/rialto-parachain/node/Cargo.toml b/bridges/bin/rialto-parachain/node/Cargo.toml
index 8adc998e47..975d551b88 100644
--- a/bridges/bin/rialto-parachain/node/Cargo.toml
+++ b/bridges/bin/rialto-parachain/node/Cargo.toml
@@ -18,10 +18,10 @@ default = []
runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks']
[dependencies]
+clap = { version = "3.0", features = ["derive"] }
derive_more = '0.99.2'
log = '0.4.14'
codec = { package = 'parity-scale-codec', version = '2.0.0' }
-structopt = '0.3.8'
serde = { version = '1.0', features = ['derive'] }
hex-literal = '0.3.1'
@@ -80,6 +80,8 @@ cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch
cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "master" }
+cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
+cumulus-relay-chain-local = { git = "https://github.com/paritytech/cumulus", branch = "master" }
# Polkadot dependencies
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
diff --git a/bridges/bin/rialto-parachain/node/src/chain_spec.rs b/bridges/bin/rialto-parachain/node/src/chain_spec.rs
index 52012423fb..6a8e751677 100644
--- a/bridges/bin/rialto-parachain/node/src/chain_spec.rs
+++ b/bridges/bin/rialto-parachain/node/src/chain_spec.rs
@@ -89,6 +89,7 @@ pub fn development_config(id: ParaId) -> ChainSpec {
None,
None,
None,
+ None,
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: id.into(),
@@ -133,6 +134,7 @@ pub fn local_testnet_config(id: ParaId) -> ChainSpec {
None,
None,
None,
+ None,
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: id.into(),
@@ -155,7 +157,7 @@ fn testnet_genesis(
balances: rialto_parachain_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
- sudo: rialto_parachain_runtime::SudoConfig { key: root_key },
+ sudo: rialto_parachain_runtime::SudoConfig { key: Some(root_key) },
parachain_info: rialto_parachain_runtime::ParachainInfoConfig { parachain_id: id },
aura: rialto_parachain_runtime::AuraConfig { authorities: initial_authorities },
aura_ext: Default::default(),
diff --git a/bridges/bin/rialto-parachain/node/src/cli.rs b/bridges/bin/rialto-parachain/node/src/cli.rs
index 78c05f90c8..7abb72cb87 100644
--- a/bridges/bin/rialto-parachain/node/src/cli.rs
+++ b/bridges/bin/rialto-parachain/node/src/cli.rs
@@ -15,18 +15,18 @@
// along with Parity Bridges Common. If not, see .
use crate::chain_spec;
+use clap::{AppSettings, Parser};
use std::path::PathBuf;
-use structopt::StructOpt;
/// Sub-commands supported by the collator.
-#[derive(Debug, StructOpt)]
+#[derive(Debug, Parser)]
pub enum Subcommand {
/// Export the genesis state of the parachain.
- #[structopt(name = "export-genesis-state")]
+ #[clap(name = "export-genesis-state")]
ExportGenesisState(ExportGenesisStateCommand),
/// Export the genesis wasm of the parachain.
- #[structopt(name = "export-genesis-wasm")]
+ #[clap(name = "export-genesis-wasm")]
ExportGenesisWasm(ExportGenesisWasmCommand),
/// Build a chain specification.
@@ -51,66 +51,66 @@ pub enum Subcommand {
Revert(sc_cli::RevertCmd),
/// The custom benchmark subcommmand benchmarking runtime pallets.
- #[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
+ #[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
}
/// Command for exporting the genesis state of the parachain
-#[derive(Debug, StructOpt)]
+#[derive(Debug, Parser)]
pub struct ExportGenesisStateCommand {
/// Output file name or stdout if unspecified.
- #[structopt(parse(from_os_str))]
+ #[clap(parse(from_os_str))]
pub output: Option,
/// Id of the parachain this state is for.
///
/// Default: 100
- #[structopt(long, conflicts_with = "chain")]
+ #[clap(long, conflicts_with = "chain")]
pub parachain_id: Option,
/// Write output in binary. Default is to write in hex.
- #[structopt(short, long)]
+ #[clap(short, long)]
pub raw: bool,
/// The name of the chain for that the genesis state should be exported.
- #[structopt(long, conflicts_with = "parachain-id")]
+ #[clap(long, conflicts_with = "parachain-id")]
pub chain: Option,
}
/// Command for exporting the genesis wasm file.
-#[derive(Debug, StructOpt)]
+#[derive(Debug, Parser)]
pub struct ExportGenesisWasmCommand {
/// Output file name or stdout if unspecified.
- #[structopt(parse(from_os_str))]
+ #[clap(parse(from_os_str))]
pub output: Option,
/// Write output in binary. Default is to write in hex.
- #[structopt(short, long)]
+ #[clap(short, long)]
pub raw: bool,
/// The name of the chain for that the genesis wasm file should be exported.
- #[structopt(long)]
+ #[clap(long)]
pub chain: Option,
}
-#[derive(Debug, StructOpt)]
-#[structopt(settings = &[
- structopt::clap::AppSettings::GlobalVersion,
- structopt::clap::AppSettings::ArgsNegateSubcommands,
- structopt::clap::AppSettings::SubcommandsNegateReqs,
-])]
+#[derive(Debug, Parser)]
+#[clap(setting(
+ AppSettings::PropagateVersion |
+ AppSettings::ArgsNegateSubcommands |
+ AppSettings::SubcommandsNegateReqs,
+))]
pub struct Cli {
- #[structopt(subcommand)]
+ #[clap(subcommand)]
pub subcommand: Option,
- #[structopt(long)]
+ #[clap(long)]
pub parachain_id: Option,
- #[structopt(flatten)]
+ #[clap(flatten)]
pub run: cumulus_client_cli::RunCmd,
/// Relaychain arguments
- #[structopt(raw = true)]
+ #[clap(raw = true)]
pub relaychain_args: Vec,
}
@@ -135,6 +135,6 @@ impl RelayChainCli {
let extension = chain_spec::Extensions::try_get(&*para_config.chain_spec);
let chain_id = extension.map(|e| e.relay_chain.clone());
let base_path = para_config.base_path.as_ref().map(|x| x.path().join("rialto-bridge-node"));
- Self { base_path, chain_id, base: polkadot_cli::RunCmd::from_iter(relay_chain_args) }
+ Self { base_path, chain_id, base: polkadot_cli::RunCmd::parse_from(relay_chain_args) }
}
}
diff --git a/bridges/bin/rialto-parachain/node/src/command.rs b/bridges/bin/rialto-parachain/node/src/command.rs
index e4f52cc026..9a69042a80 100644
--- a/bridges/bin/rialto-parachain/node/src/command.rs
+++ b/bridges/bin/rialto-parachain/node/src/command.rs
@@ -211,10 +211,12 @@ pub fn run() -> Result<()> {
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
let _ = builder.init();
- let block: Block = generate_genesis_block(&load_spec(
+ let spec = load_spec(
¶ms.chain.clone().unwrap_or_default(),
params.parachain_id.expect("Missing ParaId").into(),
- )?)?;
+ )?;
+ let state_version = Cli::native_runtime_version(&spec).state_version();
+ let block: Block = generate_genesis_block(&spec, state_version)?;
let raw_header = block.header().encode();
let output_buf = if params.raw {
raw_header
@@ -278,8 +280,10 @@ pub fn run() -> Result<()> {
let parachain_account =
AccountIdConversion::::into_account(&id);
- let block: Block =
- generate_genesis_block(&config.chain_spec).map_err(|e| format!("{:?}", e))?;
+ let state_version =
+ RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
+ let block: Block = generate_genesis_block(&config.chain_spec, state_version)
+ .map_err(|e| format!("{:?}", e))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
let polkadot_config = SubstrateCli::create_configuration(
@@ -357,11 +361,24 @@ impl CliConfiguration for RelayChainCli {
self.base.base.rpc_ws(default_listen_port)
}
- fn prometheus_config(&self, default_listen_port: u16) -> Result