Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps from v0.9.22 to v0.9.26 #720

Merged
merged 22 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,031 changes: 887 additions & 1,144 deletions Cargo.lock

Large diffs are not rendered by default.

108 changes: 54 additions & 54 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,69 +24,69 @@ log = "0.4.16"
serde = { version = "1.0.137", features = ["derive"] }

# Substrate frames
frame-benchmarking = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
frame-benchmarking-cli = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22", optional = true }
frame-benchmarking = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
frame-benchmarking-cli = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26", optional = true }

# RPC related dependencies
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22" }
jsonrpsee = { version = "0.13.0", features = ["server"] }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22" }
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
jsonrpsee = { version = "0.14.0", features = ["server"] }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }

# Substrate client dependencies
sc-basic-authorship = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-chain-spec = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-cli = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-client-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-executor = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-keystore = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22" }
sc-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-rpc-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-service = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22" }
sc-telemetry = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-tracing = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-transaction-pool = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sc-basic-authorship = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-chain-spec = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-cli = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-client-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-executor = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-keystore = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sc-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-rpc-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-service = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sc-telemetry = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-tracing = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sc-transaction-pool = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }

# Substrate primitives
sp-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-block-builder = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-blockchain = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-consensus-aura = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-core = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-inherents = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22" }
sp-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22" }
sp-offchain = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-runtime = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-session = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-timestamp = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
sp-transaction-pool = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.22" }
sp-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-block-builder = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-blockchain = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-consensus-aura = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-core = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-inherents = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-offchain = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-runtime = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-session = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-timestamp = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
sp-transaction-pool = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }

# Cumulus dependencies
cumulus-client-cli = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-client-consensus-aura = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-client-consensus-common = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-client-consensus-relay-chain = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-client-network = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-client-service = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-primitives-core = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-primitives-parachain-inherent = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-relay-chain-inprocess-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-relay-chain-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-relay-chain-rpc-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.22" }
cumulus-client-cli = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-client-consensus-aura = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-client-consensus-common = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-client-consensus-relay-chain = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-client-network = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-client-service = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
ghzlatarev marked this conversation as resolved.
Show resolved Hide resolved
cumulus-primitives-core = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-primitives-parachain-inherent = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-relay-chain-inprocess-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-relay-chain-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }
cumulus-relay-chain-rpc-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }

# Polkadot dependencies
polkadot-cli = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.22" }
polkadot-parachain = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.22" }
polkadot-primitives = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.22" }
polkadot-service = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.22" }
xcm = { git = "https://github.com/paritytech/polkadot.git", branch = "release-v0.9.22" }
polkadot-cli = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.26" }
polkadot-parachain = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.26" }
polkadot-primitives = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.26" }
polkadot-service = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.26" }
xcm = { git = "https://github.com/paritytech/polkadot.git", branch = "release-v0.9.26" }

# Self dependencies
calamari-runtime = { path = '../runtime/calamari' }
Expand All @@ -97,7 +97,7 @@ pallet-manta-pay = { path = '../pallets/manta-pay', features = ["rpc", "runtime"
session-key-primitives = { path = '../primitives/session-keys' }

[build-dependencies]
substrate-build-script-utils = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.22" }
substrate-build-script-utils = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.26" }

[features]
fast-runtime = [
Expand Down
56 changes: 8 additions & 48 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ use std::path::PathBuf;
/// Sub-commands supported by the collator.
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Export the genesis state of the parachain.
#[clap(name = "export-genesis-state")]
ExportGenesisState(ExportGenesisStateCommand),
ghzlatarev marked this conversation as resolved.
Show resolved Hide resolved

/// Export the genesis wasm of the parachain.
#[clap(name = "export-genesis-wasm")]
ExportGenesisWasm(ExportGenesisWasmCommand),

/// Build a chain specification.
BuildSpec(sc_cli::BuildSpecCmd),

Expand All @@ -46,11 +38,17 @@ pub enum Subcommand {
/// Import blocks.
ImportBlocks(sc_cli::ImportBlocksCmd),

/// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd),

/// Remove the whole chain.
PurgeChain(cumulus_client_cli::PurgeChainCmd),

/// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd),
/// Export the genesis state of the parachain.
ExportGenesisState(cumulus_client_cli::ExportGenesisStateCommand),

/// Export the genesis wasm of the parachain.
ExportGenesisWasm(cumulus_client_cli::ExportGenesisWasmCommand),

/// Sub-commands concerned with benchmarking.
/// The pallet benchmarking moved to the `pallet` sub-command.
Expand All @@ -67,44 +65,6 @@ pub enum Subcommand {
TryRuntime,
}

/// Command for exporting the genesis state of the parachain
#[derive(Debug, Parser)]
pub struct ExportGenesisStateCommand {
/// Output file name or stdout if unspecified.
#[clap(parse(from_os_str))]
pub output: Option<PathBuf>,

/// Id of the parachain this state is for.
///
/// Default: 2084
#[clap(long)]
pub parachain_id: Option<u32>,

/// Write output in binary. Default is to write in hex.
#[clap(short, long)]
pub raw: bool,

/// The name of the chain for that the genesis state should be exported.
#[clap(long)]
pub chain: Option<String>,
}

/// Command for exporting the genesis wasm file.
#[derive(Debug, Parser)]
pub struct ExportGenesisWasmCommand {
/// Output file name or stdout if unspecified.
#[clap(parse(from_os_str))]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
#[clap(short, long)]
pub raw: bool,

/// The name of the chain for that the genesis wasm file should be exported.
#[clap(long)]
pub chain: Option<String>,
}

/// Node CLI
#[derive(Debug, Parser)]
#[clap(
Expand Down
88 changes: 27 additions & 61 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@ use crate::{
service::{new_partial, CalamariRuntimeExecutor, DolphinRuntimeExecutor, MantaRuntimeExecutor},
};
use codec::Encode;
use cumulus_client_service::genesis::generate_genesis_block;
use cumulus_client_cli::generate_genesis_block;
use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
use manta_primitives::types::Header;
use polkadot_parachain::primitives::AccountIdConversion;
ghzlatarev marked this conversation as resolved.
Show resolved Hide resolved
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use session_key_primitives::AuraId;
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::{generic, traits::Block as BlockT, OpaqueExtrinsic};
use std::{io::Write, net::SocketAddr};
use sp_runtime::{
generic,
traits::{AccountIdConversion, Block as BlockT},
OpaqueExtrinsic,
};
use std::net::SocketAddr;

pub use sc_cli::Error;

Expand Down Expand Up @@ -214,15 +217,6 @@ impl SubstrateCli for RelayChainCli {
}
}

#[allow(clippy::borrowed_box)]
fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<Vec<u8>> {
let mut storage = chain_spec.build_storage()?;
storage
.top
.remove(sp_core::storage::well_known_keys::CODE)
.ok_or_else(|| "Could not find wasm file in genesis state!".into())
}

/// Creates partial components for the runtimes that are supported by the benchmarks.
macro_rules! construct_benchmark_partials {
($config:expr, |$partials:ident| $code:expr) => {
Expand Down Expand Up @@ -313,6 +307,11 @@ pub fn run_with(cli: Cli) -> Result {
Ok(cmd.run(components.client, components.import_queue))
})
}
Some(Subcommand::Revert(cmd)) => {
construct_async_run!(|components, cli, cmd, config| {
Ok(cmd.run(components.client, components.backend, None))
})
}
Some(Subcommand::PurgeChain(cmd)) => {
let runner = cli.create_runner(cmd)?;

Expand All @@ -334,53 +333,20 @@ pub fn run_with(cli: Cli) -> Result {
cmd.run(config, polkadot_config)
})
}
Some(Subcommand::Revert(cmd)) => construct_async_run!(|components, cli, cmd, config| {
Ok(cmd.run(components.client, components.backend, None))
}),
Some(Subcommand::ExportGenesisState(params)) => {
let mut builder = sc_cli::LoggerBuilder::new("");
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
let _ = builder.init();

let spec = load_spec(&params.chain.clone().unwrap_or_default())?;
let state_version = Cli::native_runtime_version(&spec).state_version();

let block: crate::service::Block = generate_genesis_block(&spec, state_version)?;
let raw_header = block.header().encode();
let output_buf = if params.raw {
raw_header
} else {
format!("0x{:?}", HexDisplay::from(&block.header().encode())).into_bytes()
};

if let Some(output) = &params.output {
std::fs::write(output, output_buf)?;
} else {
std::io::stdout().write_all(&output_buf)?;
}

Ok(())
Some(Subcommand::ExportGenesisState(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|_config| {
let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
let state_version = Cli::native_runtime_version(&spec).state_version();
cmd.run::<Block>(&*spec, state_version)
})
}
Some(Subcommand::ExportGenesisWasm(params)) => {
let mut builder = sc_cli::LoggerBuilder::new("");
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
let _ = builder.init();

let raw_wasm_blob =
extract_genesis_wasm(&cli.load_spec(&params.chain.clone().unwrap_or_default())?)?;
let output_buf = if params.raw {
raw_wasm_blob
} else {
format!("0x{:?}", HexDisplay::from(&raw_wasm_blob)).into_bytes()
};

if let Some(output) = &params.output {
std::fs::write(output, output_buf)?;
} else {
std::io::stdout().write_all(&output_buf)?;
}

Ok(())
Some(Subcommand::ExportGenesisWasm(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|_config| {
let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
cmd.run(&*spec)
})
}
Some(Subcommand::Benchmark(cmd)) => {
let runner = cli.create_runner(cmd)?;
Expand Down Expand Up @@ -483,13 +449,13 @@ pub fn run_with(cli: Cli) -> Result {
let id = ParaId::from(para_id);

let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account(&id);
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&id);

let state_version =
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();

let block: crate::service::Block =
generate_genesis_block(&config.chain_spec, state_version)
generate_genesis_block(&*config.chain_spec, state_version)
.map_err(|e| format!("{:?}", e))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));

Expand Down
Loading