Skip to content

Commit c350549

Browse files
authored
Bump Substrate/Polkadot/Cumulus refs (paritytech#1295)
Substrate: 31d90c202d6df9ce3837ee55587b604619a912ba Polkadot: 60df3c55c711c2872872d6220f98b2611340e051 Cumulus: a963055
1 parent 643dbd6 commit c350549

File tree

43 files changed

+334
-232
lines changed

Some content is hidden

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

43 files changed

+334
-232
lines changed

bridges/bin/millau/node/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ 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"] }
1314
jsonrpc-core = "18.0"
14-
structopt = "0.3.21"
1515
serde_json = "1.0.59"
1616

1717
# Bridge dependencies

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ impl Alternative {
9595
vec![],
9696
None,
9797
None,
98+
None,
9899
properties,
99100
None,
100101
),
@@ -119,6 +120,7 @@ impl Alternative {
119120
vec![],
120121
None,
121122
None,
123+
None,
122124
properties,
123125
None,
124126
),
@@ -195,7 +197,7 @@ fn testnet_genesis(
195197
aura: AuraConfig { authorities: Vec::new() },
196198
beefy: BeefyConfig { authorities: Vec::new() },
197199
grandpa: GrandpaConfig { authorities: Vec::new() },
198-
sudo: SudoConfig { key: root_key },
200+
sudo: SudoConfig { key: Some(root_key) },
199201
session: SessionConfig {
200202
keys: initial_authorities
201203
.iter()

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
1616

17+
use clap::Parser;
1718
use sc_cli::RunCmd;
18-
use structopt::StructOpt;
1919

20-
#[derive(Debug, StructOpt)]
20+
#[derive(Debug, Parser)]
2121
pub struct Cli {
2222
#[structopt(subcommand)]
2323
pub subcommand: Option<Subcommand>,
@@ -27,9 +27,10 @@ pub struct Cli {
2727
}
2828

2929
/// Possible subcommands of the main binary.
30-
#[derive(Debug, StructOpt)]
30+
#[derive(Debug, Parser)]
3131
pub enum Subcommand {
3232
/// Key management CLI utilities
33+
#[clap(subcommand)]
3334
Key(sc_cli::KeySubcommand),
3435

3536
/// Verify a signature for a message, provided on `STDIN`, with a given (public or secret) key.

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

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
// =====================================================================================
3131

3232
use millau_runtime::{self, opaque::Block, RuntimeApi};
33-
use sc_client_api::ExecutorProvider;
33+
use sc_client_api::{BlockBackend, ExecutorProvider};
3434
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
3535
pub use sc_executor::NativeElseWasmExecutor;
3636
use sc_finality_grandpa::SharedVoterState;
@@ -108,6 +108,7 @@ pub fn new_partial(
108108
config.wasm_method,
109109
config.default_heap_pages,
110110
config.max_runtime_instances,
111+
config.runtime_cache_size,
111112
);
112113

113114
let (client, backend, keystore_container, task_manager) =
@@ -210,8 +211,27 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
210211
};
211212
}
212213

213-
config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config());
214-
config.network.extra_sets.push(beefy_gadget::beefy_peers_set_config());
214+
// Note: GrandPa is pushed before the Polkadot-specific protocols. This doesn't change
215+
// anything in terms of behaviour, but makes the logs more consistent with the other
216+
// Substrate nodes.
217+
let grandpa_protocol_name = sc_finality_grandpa::protocol_standard_name(
218+
&client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
219+
&config.chain_spec,
220+
);
221+
config
222+
.network
223+
.extra_sets
224+
.push(sc_finality_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()));
225+
226+
let beefy_protocol_name = beefy_gadget::protocol_standard_name(
227+
&client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
228+
&config.chain_spec,
229+
);
230+
config
231+
.network
232+
.extra_sets
233+
.push(beefy_gadget::beefy_peers_set_config(beefy_protocol_name.clone()));
234+
215235
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
216236
backend.clone(),
217237
grandpa_link.shared_authority_set().clone(),
@@ -245,8 +265,10 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
245265
let enable_grandpa = !config.disable_grandpa;
246266
let prometheus_registry = config.prometheus_registry().cloned();
247267
let shared_voter_state = SharedVoterState::empty();
248-
let (signed_commitment_sender, signed_commitment_stream) =
249-
beefy_gadget::notification::BeefySignedCommitmentStream::channel();
268+
let (beefy_commitment_link, beefy_commitment_stream) =
269+
beefy_gadget::notification::BeefySignedCommitmentStream::<Block>::channel();
270+
let (beefy_best_block_link, beefy_best_block_stream) =
271+
beefy_gadget::notification::BeefyBestBlockStream::<Block>::channel();
250272

251273
let rpc_extensions_builder = {
252274
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
@@ -287,10 +309,12 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
287309
finality_proof_provider.clone(),
288310
)));
289311
io.extend_with(beefy_gadget_rpc::BeefyApi::to_delegate(
290-
beefy_gadget_rpc::BeefyRpcHandler::new(
291-
signed_commitment_stream.clone(),
312+
beefy_gadget_rpc::BeefyRpcHandler::<Block>::new(
313+
beefy_commitment_stream.clone(),
314+
beefy_best_block_stream.clone(),
292315
subscription_executor,
293-
),
316+
)
317+
.map_err(|e| sc_service::Error::Other(format!("{}", e)))?,
294318
));
295319
io.extend_with(pallet_mmr_rpc::MmrApi::to_delegate(pallet_mmr_rpc::Mmr::new(
296320
client.clone(),
@@ -374,9 +398,11 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
374398
backend,
375399
key_store: keystore.clone(),
376400
network: network.clone(),
377-
signed_commitment_sender,
401+
signed_commitment_sender: beefy_commitment_link,
402+
beefy_best_block_sender: beefy_best_block_link,
378403
min_block_delta: 4,
379404
prometheus_registry: prometheus_registry.clone(),
405+
protocol_name: beefy_protocol_name,
380406
};
381407

382408
// Start the BEEFY bridge gadget.
@@ -395,6 +421,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
395421
keystore,
396422
local_role: role,
397423
telemetry: telemetry.as_ref().map(|x| x.handle()),
424+
protocol_name: grandpa_protocol_name,
398425
};
399426

400427
if enable_grandpa {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
138138
impl_version: 1,
139139
apis: RUNTIME_API_VERSIONS,
140140
transaction_version: 1,
141+
state_version: 0,
141142
};
142143

143144
/// The version information used to identify this runtime when compiled natively.
@@ -204,6 +205,7 @@ impl frame_system::Config for Runtime {
204205
type SS58Prefix = SS58Prefix;
205206
/// The set code logic, just the default since we're not a parachain.
206207
type OnSetCode = ();
208+
type MaxConsumers = frame_support::traits::ConstU32<16>;
207209
}
208210

209211
impl pallet_randomness_collective_flip::Config for Runtime {}
@@ -562,7 +564,7 @@ pub type Executive = frame_executive::Executive<
562564
Block,
563565
frame_system::ChainContext<Runtime>,
564566
Runtime,
565-
AllPallets,
567+
AllPalletsWithSystem,
566568
>;
567569

568570
impl_runtime_apis! {
@@ -664,7 +666,7 @@ impl_runtime_apis! {
664666
}
665667

666668
impl beefy_primitives::BeefyApi<Block> for Runtime {
667-
fn validator_set() -> ValidatorSet<BeefyId> {
669+
fn validator_set() -> Option<ValidatorSet<BeefyId>> {
668670
Beefy::validator_set()
669671
}
670672
}
@@ -841,7 +843,7 @@ impl_runtime_apis! {
841843
}
842844

843845
fn bridged_relayer_id() -> Self::InboundRelayer {
844-
Default::default()
846+
[0u8; 32].into()
845847
}
846848

847849
fn account_balance(account: &Self::AccountId) -> Self::OutboundMessageFee {

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

Lines changed: 3 additions & 1 deletion
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"] }
2122
derive_more = '0.99.2'
2223
log = '0.4.14'
2324
codec = { package = 'parity-scale-codec', version = '2.0.0' }
24-
structopt = '0.3.8'
2525
serde = { version = '1.0', features = ['derive'] }
2626
hex-literal = '0.3.1'
2727

@@ -80,6 +80,8 @@ cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch
8080
cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "master" }
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" }
83+
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" }
8385

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

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ pub fn development_config(id: ParaId) -> ChainSpec {
8989
None,
9090
None,
9191
None,
92+
None,
9293
Extensions {
9394
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
9495
para_id: id.into(),
@@ -133,6 +134,7 @@ pub fn local_testnet_config(id: ParaId) -> ChainSpec {
133134
None,
134135
None,
135136
None,
137+
None,
136138
Extensions {
137139
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
138140
para_id: id.into(),
@@ -155,7 +157,7 @@ fn testnet_genesis(
155157
balances: rialto_parachain_runtime::BalancesConfig {
156158
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
157159
},
158-
sudo: rialto_parachain_runtime::SudoConfig { key: root_key },
160+
sudo: rialto_parachain_runtime::SudoConfig { key: Some(root_key) },
159161
parachain_info: rialto_parachain_runtime::ParachainInfoConfig { parachain_id: id },
160162
aura: rialto_parachain_runtime::AuraConfig { authorities: initial_authorities },
161163
aura_ext: Default::default(),

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
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};
1819
use std::path::PathBuf;
19-
use structopt::StructOpt;
2020

2121
/// Sub-commands supported by the collator.
22-
#[derive(Debug, StructOpt)]
22+
#[derive(Debug, Parser)]
2323
pub enum Subcommand {
2424
/// Export the genesis state of the parachain.
25-
#[structopt(name = "export-genesis-state")]
25+
#[clap(name = "export-genesis-state")]
2626
ExportGenesisState(ExportGenesisStateCommand),
2727

2828
/// Export the genesis wasm of the parachain.
29-
#[structopt(name = "export-genesis-wasm")]
29+
#[clap(name = "export-genesis-wasm")]
3030
ExportGenesisWasm(ExportGenesisWasmCommand),
3131

3232
/// Build a chain specification.
@@ -51,66 +51,66 @@ pub enum Subcommand {
5151
Revert(sc_cli::RevertCmd),
5252

5353
/// The custom benchmark subcommmand benchmarking runtime pallets.
54-
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
54+
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
5555
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
5656
}
5757

5858
/// Command for exporting the genesis state of the parachain
59-
#[derive(Debug, StructOpt)]
59+
#[derive(Debug, Parser)]
6060
pub struct ExportGenesisStateCommand {
6161
/// Output file name or stdout if unspecified.
62-
#[structopt(parse(from_os_str))]
62+
#[clap(parse(from_os_str))]
6363
pub output: Option<PathBuf>,
6464

6565
/// Id of the parachain this state is for.
6666
///
6767
/// Default: 100
68-
#[structopt(long, conflicts_with = "chain")]
68+
#[clap(long, conflicts_with = "chain")]
6969
pub parachain_id: Option<u32>,
7070

7171
/// Write output in binary. Default is to write in hex.
72-
#[structopt(short, long)]
72+
#[clap(short, long)]
7373
pub raw: bool,
7474

7575
/// The name of the chain for that the genesis state should be exported.
76-
#[structopt(long, conflicts_with = "parachain-id")]
76+
#[clap(long, conflicts_with = "parachain-id")]
7777
pub chain: Option<String>,
7878
}
7979

8080
/// Command for exporting the genesis wasm file.
81-
#[derive(Debug, StructOpt)]
81+
#[derive(Debug, Parser)]
8282
pub struct ExportGenesisWasmCommand {
8383
/// Output file name or stdout if unspecified.
84-
#[structopt(parse(from_os_str))]
84+
#[clap(parse(from_os_str))]
8585
pub output: Option<PathBuf>,
8686

8787
/// Write output in binary. Default is to write in hex.
88-
#[structopt(short, long)]
88+
#[clap(short, long)]
8989
pub raw: bool,
9090

9191
/// The name of the chain for that the genesis wasm file should be exported.
92-
#[structopt(long)]
92+
#[clap(long)]
9393
pub chain: Option<String>,
9494
}
9595

96-
#[derive(Debug, StructOpt)]
97-
#[structopt(settings = &[
98-
structopt::clap::AppSettings::GlobalVersion,
99-
structopt::clap::AppSettings::ArgsNegateSubcommands,
100-
structopt::clap::AppSettings::SubcommandsNegateReqs,
101-
])]
96+
#[derive(Debug, Parser)]
97+
#[clap(setting(
98+
AppSettings::PropagateVersion |
99+
AppSettings::ArgsNegateSubcommands |
100+
AppSettings::SubcommandsNegateReqs,
101+
))]
102102
pub struct Cli {
103-
#[structopt(subcommand)]
103+
#[clap(subcommand)]
104104
pub subcommand: Option<Subcommand>,
105105

106-
#[structopt(long)]
106+
#[clap(long)]
107107
pub parachain_id: Option<u32>,
108108

109-
#[structopt(flatten)]
109+
#[clap(flatten)]
110110
pub run: cumulus_client_cli::RunCmd,
111111

112112
/// Relaychain arguments
113-
#[structopt(raw = true)]
113+
#[clap(raw = true)]
114114
pub relaychain_args: Vec<String>,
115115
}
116116

@@ -135,6 +135,6 @@ impl RelayChainCli {
135135
let extension = chain_spec::Extensions::try_get(&*para_config.chain_spec);
136136
let chain_id = extension.map(|e| e.relay_chain.clone());
137137
let base_path = para_config.base_path.as_ref().map(|x| x.path().join("rialto-bridge-node"));
138-
Self { base_path, chain_id, base: polkadot_cli::RunCmd::from_iter(relay_chain_args) }
138+
Self { base_path, chain_id, base: polkadot_cli::RunCmd::parse_from(relay_chain_args) }
139139
}
140140
}

0 commit comments

Comments
 (0)