mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 04:07:57 +00:00
Upgrade to substrate 2.0.0 (#173)
* Upgrade to substrate 2.0.0 * WIP implement Subcommand manually (see https://github.com/paritytech/substrate/pull/6894#issuecomment-676060197) * Add pallet-staking/std to the std feature * Sort out the subcommand impl * Sort out the module index (ty @ascjones) Sort out the RefCount type (ty @dvc94ch) Random tweaks to make test-node more similar to the vanilla node-template * obey the fmt * cleanup * more cleanup
This commit is contained in:
+19
-19
@@ -15,28 +15,28 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
futures = "0.3.5"
|
||||
log = "0.4.11"
|
||||
structopt = "0.3.16"
|
||||
structopt = "0.3.17"
|
||||
parking_lot = "0.11.0"
|
||||
|
||||
sc-cli = { version = "0.8.0-rc6", features = ["wasmtime"] }
|
||||
sp-core = "2.0.0-rc6"
|
||||
sc-executor = { version = "0.8.0-rc6", features = ["wasmtime"] }
|
||||
sc-service = { version = "0.8.0-rc6", features = ["wasmtime"] }
|
||||
sp-inherents = "2.0.0-rc6"
|
||||
sc-transaction-pool = "2.0.0-rc6"
|
||||
sp-transaction-pool = "2.0.0-rc6"
|
||||
sc-network = "0.8.0-rc6"
|
||||
sc-consensus-aura = "0.8.0-rc6"
|
||||
sp-consensus-aura = "0.8.0-rc6"
|
||||
sp-consensus = "0.8.0-rc6"
|
||||
sc-consensus = "0.8.0-rc6"
|
||||
sc-finality-grandpa = "0.8.0-rc6"
|
||||
sp-finality-grandpa = "2.0.0-rc6"
|
||||
sc-client-api = "2.0.0-rc6"
|
||||
sp-runtime = "2.0.0-rc6"
|
||||
sc-basic-authorship = "0.8.0-rc6"
|
||||
sc-cli = { version = "0.8.0", features = ["wasmtime"] }
|
||||
sp-core = "2.0.0"
|
||||
sc-executor = { version = "0.8.0", features = ["wasmtime"] }
|
||||
sc-service = { version = "0.8.0", features = ["wasmtime"] }
|
||||
sp-inherents = "2.0.0"
|
||||
sc-transaction-pool = "2.0.0"
|
||||
sp-transaction-pool = "2.0.0"
|
||||
sc-network = "0.8.0"
|
||||
sc-consensus-aura = "0.8.0"
|
||||
sp-consensus-aura = "0.8.0"
|
||||
sp-consensus = "0.8.0"
|
||||
sc-consensus = "0.8.0"
|
||||
sc-finality-grandpa = "0.8.0"
|
||||
sp-finality-grandpa = "2.0.0"
|
||||
sc-client-api = "2.0.0"
|
||||
sp-runtime = "2.0.0"
|
||||
sc-basic-authorship = "0.8.0"
|
||||
|
||||
test-node-runtime = { path = "runtime" }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-build-script-utils = "2.0.0-rc6"
|
||||
substrate-build-script-utils = "2.0.0"
|
||||
|
||||
@@ -11,32 +11,32 @@ repository = "https://github.com/paritytech/substrate/"
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "1.3.5", default-features = false, features = ["derive"] }
|
||||
|
||||
frame-executive = { version = "2.0.0-rc6", default-features = false }
|
||||
frame-support = { version = "2.0.0-rc6", default-features = false }
|
||||
frame-system = { version = "2.0.0-rc6", default-features = false }
|
||||
pallet-aura = { version = "2.0.0-rc6", default-features = false }
|
||||
pallet-balances = { version = "2.0.0-rc6", default-features = false }
|
||||
pallet-grandpa = { version = "2.0.0-rc6", default-features = false }
|
||||
pallet-randomness-collective-flip = { version = "2.0.0-rc6", default-features = false }
|
||||
pallet-staking = { version = "2.0.0-rc6", default-features = false }
|
||||
pallet-sudo = { version = "2.0.0-rc6", default-features = false }
|
||||
pallet-timestamp = { version = "2.0.0-rc6", default-features = false }
|
||||
pallet-transaction-payment = { version = "2.0.0-rc6", default-features = false }
|
||||
serde = { version = "1.0.115", optional = true, features = ["derive"] }
|
||||
sp-api = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-block-builder = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-consensus-aura = { version = "0.8.0-rc6", default-features = false }
|
||||
sp-core = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-inherents = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-io = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-offchain = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-runtime = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-session = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-std = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-transaction-pool = { version = "2.0.0-rc6", default-features = false }
|
||||
sp-version = { version = "2.0.0-rc6", default-features = false }
|
||||
frame-executive = { version = "2.0.0", default-features = false }
|
||||
frame-support = { version = "2.0.0", default-features = false }
|
||||
frame-system = { version = "2.0.0", default-features = false }
|
||||
pallet-aura = { version = "2.0.0", default-features = false }
|
||||
pallet-balances = { version = "2.0.0", default-features = false }
|
||||
pallet-grandpa = { version = "2.0.0", default-features = false }
|
||||
pallet-randomness-collective-flip = { version = "2.0.0", default-features = false }
|
||||
pallet-staking = { version = "2.0.0", default-features = false }
|
||||
pallet-sudo = { version = "2.0.0", default-features = false }
|
||||
pallet-timestamp = { version = "2.0.0", default-features = false }
|
||||
pallet-transaction-payment = { version = "2.0.0", default-features = false }
|
||||
serde = { version = "1.0.116", optional = true, features = ["derive"] }
|
||||
sp-api = { version = "2.0.0", default-features = false }
|
||||
sp-block-builder = { version = "2.0.0", default-features = false }
|
||||
sp-consensus-aura = { version = "0.8.0", default-features = false }
|
||||
sp-core = { version = "2.0.0", default-features = false }
|
||||
sp-inherents = { version = "2.0.0", default-features = false }
|
||||
sp-io = { version = "2.0.0", default-features = false }
|
||||
sp-offchain = { version = "2.0.0", default-features = false }
|
||||
sp-runtime = { version = "2.0.0", default-features = false }
|
||||
sp-session = { version = "2.0.0", default-features = false }
|
||||
sp-std = { version = "2.0.0", default-features = false }
|
||||
sp-transaction-pool = { version = "2.0.0", default-features = false }
|
||||
sp-version = { version = "2.0.0", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder-runner = "1.0.6"
|
||||
@@ -52,6 +52,7 @@ std = [
|
||||
"pallet-balances/std",
|
||||
"pallet-grandpa/std",
|
||||
"pallet-randomness-collective-flip/std",
|
||||
"pallet-staking/std",
|
||||
"pallet-sudo/std",
|
||||
"pallet-timestamp/std",
|
||||
"pallet-transaction-payment/std",
|
||||
|
||||
@@ -169,14 +169,16 @@ pub fn native_version() -> NativeVersion {
|
||||
}
|
||||
}
|
||||
|
||||
const AVERAGE_ON_INITIALIZE_WEIGHT: Perbill = Perbill::from_percent(10);
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: BlockNumber = 2400;
|
||||
/// We allow for 2 seconds of compute with a 6 second average block time.
|
||||
pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
/// Assume 10% of weight for average on_initialize calls.
|
||||
pub MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get()
|
||||
.saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get();
|
||||
pub MaximumExtrinsicWeight: Weight =
|
||||
AvailableBlockRatio::get().saturating_sub(AVERAGE_ON_INITIALIZE_WEIGHT)
|
||||
* MaximumBlockWeight::get();
|
||||
pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
}
|
||||
@@ -226,10 +228,6 @@ impl frame_system::Trait for Runtime {
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
/// Version of the runtime.
|
||||
type Version = Version;
|
||||
/// Converts a module to the index of the module in `construct_runtime!`.
|
||||
///
|
||||
/// This type is being generated by `construct_runtime!`.
|
||||
type ModuleToIndex = ModuleToIndex;
|
||||
/// What to do if a new account is created.
|
||||
type OnNewAccount = ();
|
||||
/// What to do if an account is fully reaped from the system.
|
||||
@@ -238,6 +236,8 @@ impl frame_system::Trait for Runtime {
|
||||
type AccountData = pallet_balances::AccountData<Balance>;
|
||||
/// Weight information for the extrinsics of this pallet.
|
||||
type SystemWeightInfo = ();
|
||||
/// Provides information about the pallet setup in the runtime.
|
||||
type PalletInfo = PalletInfo;
|
||||
}
|
||||
|
||||
impl pallet_aura::Trait for Runtime {
|
||||
@@ -259,6 +259,7 @@ impl pallet_grandpa::Trait for Runtime {
|
||||
)>>::IdentificationTuple;
|
||||
|
||||
type HandleEquivocation = ();
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -286,6 +287,7 @@ impl pallet_balances::Trait for Runtime {
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
type MaxLocks = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -101,7 +101,7 @@ pub fn development_config() -> Result<ChainSpec, String> {
|
||||
// Properties
|
||||
None,
|
||||
// Extensions
|
||||
None,
|
||||
Default::default(),
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
+10
-1
@@ -15,11 +15,20 @@
|
||||
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use sc_cli::{
|
||||
BuildSpecCmd,
|
||||
PurgeChainCmd,
|
||||
RunCmd,
|
||||
Subcommand,
|
||||
};
|
||||
use structopt::StructOpt;
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
pub enum Subcommand {
|
||||
/// Build a spec.json file, outputs to stdout.
|
||||
BuildSpec(BuildSpecCmd),
|
||||
/// Remove the whole chain data.
|
||||
PurgeChain(PurgeChainCmd),
|
||||
}
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
pub struct Cli {
|
||||
#[structopt(subcommand)]
|
||||
|
||||
+11
-14
@@ -16,7 +16,10 @@
|
||||
|
||||
use crate::{
|
||||
chain_spec,
|
||||
cli::Cli,
|
||||
cli::{
|
||||
Cli,
|
||||
Subcommand,
|
||||
},
|
||||
service,
|
||||
};
|
||||
use sc_cli::{
|
||||
@@ -25,7 +28,6 @@ use sc_cli::{
|
||||
RuntimeVersion,
|
||||
SubstrateCli,
|
||||
};
|
||||
use sc_service::PartialComponents;
|
||||
|
||||
impl SubstrateCli for Cli {
|
||||
fn impl_name() -> String {
|
||||
@@ -74,18 +76,13 @@ pub fn run() -> sc_cli::Result<()> {
|
||||
let cli = Cli::from_args();
|
||||
|
||||
match &cli.subcommand {
|
||||
Some(subcommand) => {
|
||||
let runner = cli.create_runner(subcommand)?;
|
||||
runner.run_subcommand(subcommand, |config| {
|
||||
let PartialComponents {
|
||||
client,
|
||||
backend,
|
||||
task_manager,
|
||||
import_queue,
|
||||
..
|
||||
} = service::new_partial(&config)?;
|
||||
Ok((client, backend, import_queue, task_manager))
|
||||
})
|
||||
Some(Subcommand::BuildSpec(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
|
||||
}
|
||||
Some(Subcommand::PurgeChain(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|config| cmd.run(config.database))
|
||||
}
|
||||
None => {
|
||||
let runner = cli.create_runner(&cli.run)?;
|
||||
|
||||
Reference in New Issue
Block a user