From c2ed756ab3af4d77ee4f77e9b84bc7330b36ceb6 Mon Sep 17 00:00:00 2001 From: weichweich Date: Thu, 7 Apr 2022 16:01:32 +0200 Subject: [PATCH 1/7] fix: even more features --- nodes/standalone/Cargo.toml | 6 +++--- pallets/delegation/Cargo.toml | 1 + pallets/pallet-inflation/Cargo.toml | 2 ++ pallets/pallet-web3-names/Cargo.toml | 7 +++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/nodes/standalone/Cargo.toml b/nodes/standalone/Cargo.toml index 32ac828f12..74aca394e6 100644 --- a/nodes/standalone/Cargo.toml +++ b/nodes/standalone/Cargo.toml @@ -20,7 +20,7 @@ mashnet-node-runtime = {path = "../../runtimes/standalone"} runtime-common = {path = "../../runtimes/common"} # External dependencies -clap = { version = "3.1", features = ["derive"] } +clap = {version = "3.1", features = ["derive"]} futures = "0.3" hex-literal = "0.3.4" log = "0.4" @@ -66,8 +66,8 @@ frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", branc # Runtime tests node-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} -pallet-conviction-voting = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} -pallet-referenda = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} +pallet-conviction-voting = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} +pallet-referenda = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} try-runtime-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} [features] diff --git a/pallets/delegation/Cargo.toml b/pallets/delegation/Cargo.toml index dfebf4842f..1a28cb886c 100644 --- a/pallets/delegation/Cargo.toml +++ b/pallets/delegation/Cargo.toml @@ -69,6 +69,7 @@ runtime-benchmarks = [ "sp-io", ] std = [ + "attestation/std", "codec/std", "ctype/std", "frame-support/std", diff --git a/pallets/pallet-inflation/Cargo.toml b/pallets/pallet-inflation/Cargo.toml index 9c919bb47c..7227eaad23 100644 --- a/pallets/pallet-inflation/Cargo.toml +++ b/pallets/pallet-inflation/Cargo.toml @@ -35,6 +35,8 @@ default = ["std"] runtime-benchmarks = [ "frame-benchmarking", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", ] std = [ diff --git a/pallets/pallet-web3-names/Cargo.toml b/pallets/pallet-web3-names/Cargo.toml index d6a9ecdcc6..b2d79fedee 100644 --- a/pallets/pallet-web3-names/Cargo.toml +++ b/pallets/pallet-web3-names/Cargo.toml @@ -41,6 +41,7 @@ runtime-benchmarks = [ "frame-benchmarking", "sp-io", "kilt-support/runtime-benchmarks", + "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", ] @@ -54,5 +55,7 @@ std = [ "sp-std/std", ] - -try-runtime = [] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", +] From 5e54aa77d633cf1f05c5564d32f541fcda699bad Mon Sep 17 00:00:00 2001 From: weichweich Date: Thu, 7 Apr 2022 16:33:36 +0200 Subject: [PATCH 2/7] fix: more features --- Cargo.lock | 1 - nodes/standalone/Cargo.toml | 3 +-- nodes/standalone/src/command.rs | 5 +---- pallets/pallet-did-lookup/Cargo.toml | 3 ++- pallets/pallet-web3-names/src/web3_name.rs | 2 -- runtimes/common/Cargo.toml | 3 +++ 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e42bcae0b..3d740e7435 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4475,7 +4475,6 @@ dependencies = [ "jsonrpc-core", "log", "mashnet-node-runtime", - "node-executor", "pallet-conviction-voting", "pallet-referenda", "pallet-transaction-payment-rpc", diff --git a/nodes/standalone/Cargo.toml b/nodes/standalone/Cargo.toml index 74aca394e6..38cd1d2698 100644 --- a/nodes/standalone/Cargo.toml +++ b/nodes/standalone/Cargo.toml @@ -65,7 +65,6 @@ frame-benchmarking = {git = "https://github.com/paritytech/substrate", branch = frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17"} # Runtime tests -node-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} pallet-conviction-voting = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} pallet-referenda = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} try-runtime-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true} @@ -76,9 +75,9 @@ runtime-benchmarks = [ "mashnet-node-runtime/runtime-benchmarks", "pallet-conviction-voting/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", + "runtime-common/runtime-benchmarks" ] try-runtime = [ "mashnet-node-runtime/try-runtime", - "node-executor", "try-runtime-cli", ] diff --git a/nodes/standalone/src/command.rs b/nodes/standalone/src/command.rs index 7f3cfc249d..c1e24968f5 100644 --- a/nodes/standalone/src/command.rs +++ b/nodes/standalone/src/command.rs @@ -25,9 +25,6 @@ use mashnet_node_runtime::opaque::Block; use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli}; use sc_service::PartialComponents; -#[cfg(feature = "try-runtime")] -use node_executor::ExecutorDispatch; - impl SubstrateCli for Cli { fn impl_name() -> String { "KILT Node".to_string() @@ -155,7 +152,7 @@ pub fn run() -> sc_cli::Result<()> { let task_manager = sc_service::TaskManager::new(config.tokio_handle.clone(), registry) .map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?; - Ok((cmd.run::(config), task_manager)) + Ok((cmd.run::(config), task_manager)) }) } #[cfg(not(feature = "try-runtime"))] diff --git a/pallets/pallet-did-lookup/Cargo.toml b/pallets/pallet-did-lookup/Cargo.toml index a0dc163330..65452994f9 100644 --- a/pallets/pallet-did-lookup/Cargo.toml +++ b/pallets/pallet-did-lookup/Cargo.toml @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] kilt-support = {features = ["mock"], path = "../../support"} pallet-balances = {branch = "polkadot-v0.9.17", default-features = false, git = "https://github.com/paritytech/substrate"} +sp-core = {branch = "polkadot-v0.9.17", default-features = false, git = "https://github.com/paritytech/substrate"} sp-io = {branch = "polkadot-v0.9.17", default-features = false, git = "https://github.com/paritytech/substrate"} sp-keystore = {branch = "polkadot-v0.9.17", default-features = false, git = "https://github.com/paritytech/substrate"} -sp-core = {branch = "polkadot-v0.9.17", default-features = false, git = "https://github.com/paritytech/substrate"} [dependencies] codec = {default-features = false, features = ["derive"], package = "parity-scale-codec", version = "2.3.1"} @@ -42,6 +42,7 @@ runtime-benchmarks = [ "frame-benchmarking", "sp-io", "kilt-support/runtime-benchmarks", + "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", ] diff --git a/pallets/pallet-web3-names/src/web3_name.rs b/pallets/pallet-web3-names/src/web3_name.rs index def58e9518..4b4b935e46 100644 --- a/pallets/pallet-web3-names/src/web3_name.rs +++ b/pallets/pallet-web3-names/src/web3_name.rs @@ -16,8 +16,6 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -#![cfg_attr(not(feature = "std"), no_std)] - use sp_std::{fmt::Debug, marker::PhantomData, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index 9595405452..9d13188c0e 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -30,6 +30,9 @@ sp-std = {git = "https://github.com/paritytech/substrate", default-features = fa default = ["std"] fast-gov = [] runtime-benchmarks = [ + "attestation/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "parachain-staking/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] std = [ From 597799c51de3e8491b127234ec1d3125d3d87512 Mon Sep 17 00:00:00 2001 From: weichweich Date: Thu, 7 Apr 2022 16:33:48 +0200 Subject: [PATCH 3/7] feat: add script for testing features --- scripts/all.fish | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 scripts/all.fish diff --git a/scripts/all.fish b/scripts/all.fish new file mode 100644 index 0000000000..74ad183daf --- /dev/null +++ b/scripts/all.fish @@ -0,0 +1,11 @@ +for features in "--all-features" "--features runtime-benchmarks" "--features try-runtime" + for package in (cargo workspaces list) + cargo build -p $package $features > /dev/null ^ /dev/null + if [ "$status" = "0" ] + echo -n "[ok] " + else + echo -n "[fail] " + end + echo cargo build -p $package $features + end +end From 3493d9758bad511a8df0c632e5bb98c7401e3533 Mon Sep 17 00:00:00 2001 From: weichweich Date: Fri, 8 Apr 2022 07:57:12 +0200 Subject: [PATCH 4/7] fix: benchmark in try-runtime !! --- runtimes/standalone/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtimes/standalone/Cargo.toml b/runtimes/standalone/Cargo.toml index 1c9502faf4..cfa768ea36 100644 --- a/runtimes/standalone/Cargo.toml +++ b/runtimes/standalone/Cargo.toml @@ -161,7 +161,7 @@ try-runtime = [ "pallet-session/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", - "pallet-web3-names/runtime-benchmarks", + "pallet-web3-names/try-runtime", "pallet-utility/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-vesting/try-runtime", From 677e9b42df70a1544b5824bc8b9963ebedf2bc1d Mon Sep 17 00:00:00 2001 From: weichweich Date: Fri, 8 Apr 2022 07:57:51 +0200 Subject: [PATCH 5/7] update script --- scripts/all.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/all.fish b/scripts/all.fish index 74ad183daf..976a73a8eb 100644 --- a/scripts/all.fish +++ b/scripts/all.fish @@ -1,11 +1,11 @@ for features in "--all-features" "--features runtime-benchmarks" "--features try-runtime" for package in (cargo workspaces list) - cargo build -p $package $features > /dev/null ^ /dev/null + cargo build -p $package (echo $features | string split " ") > /dev/null ^ /dev/null if [ "$status" = "0" ] echo -n "[ok] " else echo -n "[fail] " end - echo cargo build -p $package $features + echo cargo build -p $package (echo $features | string split " ") end end From c92232de4e9c0f16219dcc196cb662c5a03578e2 Mon Sep 17 00:00:00 2001 From: weichweich Date: Mon, 11 Apr 2022 15:18:10 +0200 Subject: [PATCH 6/7] doc: mention cargo-workspaces --- scripts/all.fish | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/all.fish b/scripts/all.fish index 976a73a8eb..6034c6b3c4 100644 --- a/scripts/all.fish +++ b/scripts/all.fish @@ -1,3 +1,7 @@ +#!/bin/env fish +# Check a few feature combinations for all crates. +# Requires `cargo-workspaces` to be installed. + for features in "--all-features" "--features runtime-benchmarks" "--features try-runtime" for package in (cargo workspaces list) cargo build -p $package (echo $features | string split " ") > /dev/null ^ /dev/null From 38018cb131ed10436f6752efa761b30fff8ef3e3 Mon Sep 17 00:00:00 2001 From: weichweich Date: Mon, 11 Apr 2022 15:38:21 +0200 Subject: [PATCH 7/7] check default features --- scripts/all.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/all.fish b/scripts/all.fish index 6034c6b3c4..57693e947d 100644 --- a/scripts/all.fish +++ b/scripts/all.fish @@ -2,7 +2,7 @@ # Check a few feature combinations for all crates. # Requires `cargo-workspaces` to be installed. -for features in "--all-features" "--features runtime-benchmarks" "--features try-runtime" +for features in "--features default" "--all-features" "--features runtime-benchmarks" "--features try-runtime" for package in (cargo workspaces list) cargo build -p $package (echo $features | string split " ") > /dev/null ^ /dev/null if [ "$status" = "0" ]