Skip to content

Commit

Permalink
Bump Substrate/Polkadot/Cumulus refs (paritytech#1295)
Browse files Browse the repository at this point in the history
Substrate: 31d90c2
Polkadot: 60df3c5
Cumulus: a9630551c2cd877952ab769c862af4c81b0ccd3c
  • Loading branch information
svyatonik authored and serban300 committed Apr 8, 2024
1 parent a2782f4 commit 70a1e46
Show file tree
Hide file tree
Showing 43 changed files with 334 additions and 232 deletions.
2 changes: 1 addition & 1 deletion bridges/bin/millau/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion bridges/bin/millau/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl Alternative {
vec![],
None,
None,
None,
properties,
None,
),
Expand All @@ -119,6 +120,7 @@ impl Alternative {
vec![],
None,
None,
None,
properties,
None,
),
Expand Down Expand Up @@ -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()
Expand Down
7 changes: 4 additions & 3 deletions bridges/bin/millau/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

use clap::Parser;
use sc_cli::RunCmd;
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
#[derive(Debug, Parser)]
pub struct Cli {
#[structopt(subcommand)]
pub subcommand: Option<Subcommand>,
Expand All @@ -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.
Expand Down
45 changes: 36 additions & 9 deletions bridges/bin/millau/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) =
Expand Down Expand Up @@ -210,8 +211,27 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
};
}

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(),
Expand Down Expand Up @@ -245,8 +265,10 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
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::<Block>::channel();
let (beefy_best_block_link, beefy_best_block_stream) =
beefy_gadget::notification::BeefyBestBlockStream::<Block>::channel();

let rpc_extensions_builder = {
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
Expand Down Expand Up @@ -287,10 +309,12 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
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::<Block>::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(),
Expand Down Expand Up @@ -374,9 +398,11 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
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.
Expand All @@ -395,6 +421,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
keystore,
local_role: role,
telemetry: telemetry.as_ref().map(|x| x.handle()),
protocol_name: grandpa_protocol_name,
};

if enable_grandpa {
Expand Down
8 changes: 5 additions & 3 deletions bridges/bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {}
Expand Down Expand Up @@ -562,7 +564,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
>;

impl_runtime_apis! {
Expand Down Expand Up @@ -664,7 +666,7 @@ impl_runtime_apis! {
}

impl beefy_primitives::BeefyApi<Block> for Runtime {
fn validator_set() -> ValidatorSet<BeefyId> {
fn validator_set() -> Option<ValidatorSet<BeefyId>> {
Beefy::validator_set()
}
}
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion bridges/bin/rialto-parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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" }
Expand Down
4 changes: 3 additions & 1 deletion bridges/bin/rialto-parachain/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down
50 changes: 25 additions & 25 deletions bridges/bin/rialto-parachain/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

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.
Expand All @@ -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<PathBuf>,

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

/// 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<String>,
}

/// 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<PathBuf>,

/// 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<String>,
}

#[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<Subcommand>,

#[structopt(long)]
#[clap(long)]
pub parachain_id: Option<u32>,

#[structopt(flatten)]
#[clap(flatten)]
pub run: cumulus_client_cli::RunCmd,

/// Relaychain arguments
#[structopt(raw = true)]
#[clap(raw = true)]
pub relaychain_args: Vec<String>,
}

Expand All @@ -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) }
}
}
Loading

0 comments on commit 70a1e46

Please sign in to comment.