Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
merge from cumulus release branch inc extra commit (#940)
Browse files Browse the repository at this point in the history
* Revert "Companion for substrate#10632 (#895)"

This reverts commit fd14576.

* Revert "Companion for paritytech/polkadot#4712 (#901)"

This reverts commit 9c977d6.

* Prepare branch

* Make sure to use `state_version = 0` for now

* Fix lock file

* Minimising changes to cargo lock

* updating to include weights update.

Co-authored-by: Bastian Köcher <info@kchr.de>
  • Loading branch information
gilescope and bkchr authored Feb 1, 2022
1 parent 7881fe6 commit 04c518d
Show file tree
Hide file tree
Showing 17 changed files with 181 additions and 239 deletions.
239 changes: 91 additions & 148 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

[dependencies]
clap = { version = "3.0", features = ["derive"] }
structopt = "0.3.3"

# Substrate dependencies
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" }
Expand Down
16 changes: 8 additions & 8 deletions client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#![warn(missing_docs)]

use clap::Parser;
use sc_cli;
use sc_service::{
config::{PrometheusConfig, TelemetryEndpoints},
Expand All @@ -29,20 +28,21 @@ use std::{
io::{self, Write},
net::SocketAddr,
};
use structopt::StructOpt;

/// The `purge-chain` command used to remove the whole chain: the parachain and the relay chain.
#[derive(Debug, Parser)]
#[derive(Debug, StructOpt)]
pub struct PurgeChainCmd {
/// The base struct of the purge-chain command.
#[clap(flatten)]
#[structopt(flatten)]
pub base: sc_cli::PurgeChainCmd,

/// Only delete the para chain database
#[clap(long, aliases = &["para"])]
#[structopt(long, aliases = &["para"])]
pub parachain: bool,

/// Only delete the relay chain database
#[clap(long, aliases = &["relay"])]
#[structopt(long, aliases = &["relay"])]
pub relaychain: bool,
}

Expand Down Expand Up @@ -120,16 +120,16 @@ impl sc_cli::CliConfiguration for PurgeChainCmd {
}

/// The `run` command used to run a node.
#[derive(Debug, Parser)]
#[derive(Debug, StructOpt)]
pub struct RunCmd {
/// The cumulus RunCmd inherents from sc_cli's
#[clap(flatten)]
#[structopt(flatten)]
pub base: sc_cli::RunCmd,

/// Run node as collator.
///
/// Note that this is the same as running with `--validator`.
#[clap(long, conflicts_with = "validator")]
#[structopt(long, conflicts_with = "validator")]
pub collator: bool,
}

Expand Down
8 changes: 4 additions & 4 deletions pallets/parachain-system/src/validate_block/implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ fn host_storage_clear(key: &[u8]) {
with_externalities(|ext| ext.place_storage(key.to_vec(), None))
}

fn host_storage_root(version: StateVersion) -> Vec<u8> {
with_externalities(|ext| ext.storage_root(version))
fn host_storage_root() -> Vec<u8> {
with_externalities(|ext| ext.storage_root(StateVersion::V0))
}

fn host_storage_clear_prefix(prefix: &[u8], limit: Option<u32>) -> KillStorageResult {
Expand Down Expand Up @@ -327,9 +327,9 @@ fn host_default_child_storage_clear_prefix(
})
}

fn host_default_child_storage_root(storage_key: &[u8], version: StateVersion) -> Vec<u8> {
fn host_default_child_storage_root(storage_key: &[u8]) -> Vec<u8> {
let child_info = ChildInfo::new_default(storage_key);
with_externalities(|ext| ext.child_storage_root(&child_info, version))
with_externalities(|ext| ext.child_storage_root(&child_info, StateVersion::V0))
}

fn host_default_child_storage_next_key(storage_key: &[u8], key: &[u8]) -> Option<Vec<u8>> {
Expand Down
4 changes: 2 additions & 2 deletions pallets/xcmp-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use sp_runtime::{
};
use xcm::prelude::*;
use xcm_builder::{
CurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsPreset,
CurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsDefault,
};
use xcm_executor::traits::ConvertOrigin;

Expand Down Expand Up @@ -132,7 +132,7 @@ pub type LocalAssetTransactor = CurrencyAdapter<
(),
>;

pub type LocationToAccountId = (ParentIsPreset<AccountId>,);
pub type LocationToAccountId = (ParentIsDefault<AccountId>,);

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
Expand Down
4 changes: 2 additions & 2 deletions parachain-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ path = "src/main.rs"

[features]
runtime-benchmarks = ["parachain-template-runtime/runtime-benchmarks"]
try-runtime = ["parachain-template-runtime/try-runtime"]
try-runtime = [ "parachain-template-runtime/try-runtime" ]

[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.132", features = ["derive"] }
hex-literal = "0.3.1"

Expand Down
46 changes: 23 additions & 23 deletions parachain-template/node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use crate::chain_spec;
use clap::{AppSettings, Parser};
use std::path::PathBuf;
use structopt::StructOpt;

/// Sub-commands supported by the collator.
#[derive(Debug, clap::Subcommand)]
#[derive(Debug, StructOpt)]
pub enum Subcommand {
/// Export the genesis state of the parachain.
#[clap(name = "export-genesis-state")]
#[structopt(name = "export-genesis-state")]
ExportGenesisState(ExportGenesisStateCommand),

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

/// Build a chain specification.
Expand All @@ -35,60 +35,60 @@ pub enum Subcommand {
Revert(sc_cli::RevertCmd),

/// The custom benchmark subcommmand benchmarking runtime pallets.
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some testing command against a specified runtime state.
TryRuntime(try_runtime_cli::TryRuntimeCmd),
}

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

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

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

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

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

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

#[derive(Debug, Parser)]
#[clap(setting(
AppSettings::PropagateVersion |
AppSettings::ArgsNegateSubcommands |
AppSettings::SubcommandsNegateReqs,
))]
#[derive(Debug, StructOpt)]
#[structopt(settings = &[
structopt::clap::AppSettings::GlobalVersion,
structopt::clap::AppSettings::ArgsNegateSubcommands,
structopt::clap::AppSettings::SubcommandsNegateReqs,
])]
pub struct Cli {
#[clap(subcommand)]
#[structopt(subcommand)]
pub subcommand: Option<Subcommand>,

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

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

Expand All @@ -113,6 +113,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("polkadot"));
Self { base_path, chain_id, base: polkadot_cli::RunCmd::parse_from(relay_chain_args) }
Self { base_path, chain_id, base: polkadot_cli::RunCmd::from_iter(relay_chain_args) }
}
}
10 changes: 5 additions & 5 deletions parachain-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use polkadot_runtime_common::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpd
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsPreset,
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsDefault,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents,
Expand Down Expand Up @@ -179,8 +179,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_version: 1,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
transaction_version: 0,
state_version: 0,
};

/// This determines the average expected block time that we are targeting.
Expand Down Expand Up @@ -395,8 +395,8 @@ parameter_types! {
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsPreset<AccountId>,
// The parent (Relay-chain) origin converts to the default `AccountId`.
ParentIsDefault<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ name = "polkadot-collator"
path = "src/main.rs"

[dependencies]
clap = { version = "3.0", features = ["derive"] }
futures = { version = "0.3.1", features = ["compat"] }
log = "0.4.8"
codec = { package = "parity-scale-codec", version = "2.3.0" }
structopt = "0.3.3"
serde = { version = "1.0.132", features = ["derive"] }
hex-literal = "0.2.1"
async-trait = "0.1.42"
Expand Down
6 changes: 3 additions & 3 deletions polkadot-parachains/rococo-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
};
Expand Down Expand Up @@ -283,8 +283,8 @@ parameter_types! {
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsPreset<AccountId>,
// The parent (Relay-chain) origin converts to the default `AccountId`.
ParentIsDefault<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/shell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub use sp_runtime::{Perbill, Permill};
use xcm::latest::prelude::*;
use xcm_builder::{
AllowUnpaidExecutionFrom, FixedWeightBounds, LocationInverter, ParentAsSuperuser,
ParentIsPreset, SovereignSignedViaLocation,
ParentIsDefault, SovereignSignedViaLocation,
};
use xcm_executor::{Config, XcmExecutor};

Expand Down Expand Up @@ -186,7 +186,7 @@ pub type XcmOriginToTransactDispatchOrigin = (
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
// foreign chains who want to have a local sovereign account on this chain which they control.
SovereignSignedViaLocation<ParentIsPreset<AccountId>, Origin>,
SovereignSignedViaLocation<ParentIsDefault<AccountId>, Origin>,
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
// transaction from the Root origin.
ParentAsSuperuser<Origin>,
Expand Down
Loading

0 comments on commit 04c518d

Please sign in to comment.