Skip to content

Commit dc22e48

Browse files
authored
Fix Rust features (paritytech#11976)
* Add std feature Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix features Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * WIP Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix features Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix features Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Impl function also in tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Make compile Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix sp-trie feature Something makes the bench regression guard fail, maybe this? Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add runtime-benchmarks feature to sc-service Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert "Fix sp-trie feature" This reverts commit f2cddfe. Was already fixed, only needed a CI retry. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
1 parent 7c2c0c1 commit dc22e48

File tree

84 files changed

+250
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+250
-110
lines changed

Cargo.lock

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node-template/node/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ substrate-build-script-utils = { version = "3.0.0", path = "../../../utils/build
6767

6868
[features]
6969
default = []
70-
runtime-benchmarks = ["node-template-runtime/runtime-benchmarks"]
70+
# Dependencies that are only required if runtime benchmarking should be build.
71+
runtime-benchmarks = [
72+
"node-template-runtime/runtime-benchmarks",
73+
"frame-benchmarking/runtime-benchmarks",
74+
"frame-benchmarking-cli/runtime-benchmarks",
75+
]
7176
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
7277
# in the near future.
7378
try-runtime = ["node-template-runtime/try-runtime", "try-runtime-cli"]

bin/node-template/node/src/command.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ pub fn run() -> sc_cli::Result<()> {
127127
let PartialComponents { client, .. } = service::new_partial(&config)?;
128128
cmd.run(client)
129129
},
130+
#[cfg(not(feature = "runtime-benchmarks"))]
131+
BenchmarkCmd::Storage(_) => Err(
132+
"Storage benchmarking can be enabled with `--features runtime-benchmarks`."
133+
.into(),
134+
),
135+
#[cfg(feature = "runtime-benchmarks")]
130136
BenchmarkCmd::Storage(cmd) => {
131137
let PartialComponents { client, backend, .. } =
132138
service::new_partial(&config)?;

bin/node-template/pallets/template/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ sp-runtime = { version = "6.0.0", default-features = false, path = "../../../../
3030
default = ["std"]
3131
std = [
3232
"codec/std",
33-
"frame-benchmarking/std",
33+
"frame-benchmarking?/std",
3434
"frame-support/std",
3535
"frame-system/std",
3636
"scale-info/std",

bin/node-template/runtime/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-bu
5757
[features]
5858
default = ["std"]
5959
std = [
60+
"frame-try-runtime?/std",
61+
"frame-system-benchmarking?/std",
62+
"frame-benchmarking?/std",
6063
"codec/std",
6164
"scale-info/std",
6265
"frame-executive/std",
@@ -88,7 +91,7 @@ std = [
8891
runtime-benchmarks = [
8992
"frame-benchmarking/runtime-benchmarks",
9093
"frame-support/runtime-benchmarks",
91-
"frame-system-benchmarking",
94+
"frame-system-benchmarking/runtime-benchmarks",
9295
"frame-system/runtime-benchmarks",
9396
"hex-literal",
9497
"pallet-balances/runtime-benchmarks",

bin/node/cli/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ cli = [
159159
"substrate-build-script-utils",
160160
"try-runtime-cli",
161161
]
162-
runtime-benchmarks = ["kitchensink-runtime/runtime-benchmarks", "frame-benchmarking-cli"]
162+
runtime-benchmarks = [
163+
"kitchensink-runtime/runtime-benchmarks",
164+
"frame-benchmarking-cli/runtime-benchmarks"
165+
]
163166
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
164167
# in the near future.
165168
try-runtime = ["kitchensink-runtime/try-runtime", "try-runtime-cli"]

bin/node/cli/src/command.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ pub fn run() -> Result<()> {
119119
let partial = new_partial(&config)?;
120120
cmd.run(partial.client)
121121
},
122+
#[cfg(not(feature = "runtime-benchmarks"))]
123+
BenchmarkCmd::Storage(_) => Err(
124+
"Storage benchmarking can be enabled with `--features runtime-benchmarks`."
125+
.into(),
126+
),
127+
#[cfg(feature = "runtime-benchmarks")]
122128
BenchmarkCmd::Storage(cmd) => {
123129
// ensure that we keep the task manager alive
124130
let partial = new_partial(&config)?;

bin/node/runtime/Cargo.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-bu
117117
default = ["std"]
118118
with-tracing = ["frame-executive/with-tracing"]
119119
std = [
120+
"sp-sandbox/std",
121+
"pallet-whitelist/std",
122+
"pallet-offences-benchmarking?/std",
123+
"pallet-election-provider-support-benchmarking?/std",
124+
"pallet-asset-tx-payment/std",
125+
"frame-system-benchmarking?/std",
126+
"frame-election-provider-support/std",
120127
"sp-authority-discovery/std",
121128
"pallet-assets/std",
122129
"pallet-authority-discovery/std",
@@ -148,6 +155,7 @@ std = [
148155
"pallet-multisig/std",
149156
"pallet-nomination-pools/std",
150157
"pallet-nomination-pools-runtime-api/std",
158+
"pallet-nomination-pools-benchmarking?/std",
151159
"pallet-identity/std",
152160
"pallet-scheduler/std",
153161
"node-primitives/std",
@@ -159,6 +167,7 @@ std = [
159167
"pallet-randomness-collective-flip/std",
160168
"sp-std/std",
161169
"pallet-session/std",
170+
"pallet-session-benchmarking?/std",
162171
"sp-api/std",
163172
"sp-runtime/std",
164173
"sp-staking/std",
@@ -167,7 +176,7 @@ std = [
167176
"sp-session/std",
168177
"pallet-sudo/std",
169178
"frame-support/std",
170-
"frame-benchmarking/std",
179+
"frame-benchmarking?/std",
171180
"frame-system-rpc-runtime-api/std",
172181
"frame-system/std",
173182
"pallet-election-provider-multi-phase/std",
@@ -188,7 +197,7 @@ std = [
188197
"pallet-uniques/std",
189198
"pallet-vesting/std",
190199
"log/std",
191-
"frame-try-runtime/std",
200+
"frame-try-runtime?/std",
192201
"sp-io/std",
193202
"pallet-child-bounties/std",
194203
"pallet-alliance/std",
@@ -221,16 +230,16 @@ runtime-benchmarks = [
221230
"pallet-membership/runtime-benchmarks",
222231
"pallet-mmr/runtime-benchmarks",
223232
"pallet-multisig/runtime-benchmarks",
224-
"pallet-nomination-pools-benchmarking",
225-
"pallet-offences-benchmarking",
233+
"pallet-nomination-pools-benchmarking/runtime-benchmarks",
234+
"pallet-offences-benchmarking/runtime-benchmarks",
226235
"pallet-preimage/runtime-benchmarks",
227236
"pallet-proxy/runtime-benchmarks",
228237
"pallet-scheduler/runtime-benchmarks",
229238
"pallet-ranked-collective/runtime-benchmarks",
230239
"pallet-referenda/runtime-benchmarks",
231240
"pallet-recovery/runtime-benchmarks",
232241
"pallet-remark/runtime-benchmarks",
233-
"pallet-session-benchmarking",
242+
"pallet-session-benchmarking/runtime-benchmarks",
234243
"pallet-society/runtime-benchmarks",
235244
"pallet-staking/runtime-benchmarks",
236245
"pallet-state-trie-migration/runtime-benchmarks",
@@ -242,7 +251,7 @@ runtime-benchmarks = [
242251
"pallet-uniques/runtime-benchmarks",
243252
"pallet-vesting/runtime-benchmarks",
244253
"pallet-whitelist/runtime-benchmarks",
245-
"frame-system-benchmarking",
254+
"frame-system-benchmarking/runtime-benchmarks",
246255
"hex-literal",
247256
]
248257
try-runtime = [

client/service/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ rocksdb = ["sc-client-db/rocksdb"]
2020
wasmtime = ["sc-executor/wasmtime"]
2121
# exposes the client type
2222
test-helpers = []
23+
runtime-benchmarks = ["sc-client-db/runtime-benchmarks"]
2324

2425
[dependencies]
2526
jsonrpsee = { version = "0.15.1", features = ["server"] }

frame/alliance/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ pallet-collective = { version = "4.0.0-dev", path = "../collective" }
4141
[features]
4242
default = ["std"]
4343
std = [
44+
"pallet-collective?/std",
45+
"frame-benchmarking?/std",
4446
"log/std",
4547
"codec/std",
4648
"scale-info/std",
@@ -55,7 +57,7 @@ std = [
5557
runtime-benchmarks = [
5658
"hex",
5759
"sha2",
58-
"frame-benchmarking",
60+
"frame-benchmarking/runtime-benchmarks",
5961
"sp-runtime/runtime-benchmarks",
6062
"frame-support/runtime-benchmarks",
6163
"frame-system/runtime-benchmarks",

0 commit comments

Comments
 (0)