Skip to content

Commit d8a1b4a

Browse files
committed
fixed runtime-benchmarking feature
1 parent bcb682d commit d8a1b4a

6 files changed

Lines changed: 26 additions & 5 deletions

File tree

node/src/command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use sc_service::{
1414
};
1515
use sp_core::hexdisplay::HexDisplay;
1616
use sp_runtime::{
17-
traits::{AccountIdConversion, Block as BlockT, Hash as HashT, Header as HeaderT, Zero},
17+
traits::{AccountIdConversion, Block as BlockT, Hash as HashT, Header as HeaderT, HashingFor, Zero},
1818
StateVersion,
1919
};
2020
use std::io::Write;
@@ -321,7 +321,7 @@ pub fn run() -> sc_cli::Result<()> {
321321
BenchmarkCmd::Pallet(cmd) => {
322322
with_runtime_or_err!(chain_spec, {
323323
runner.sync_run(|config| {
324-
cmd.run::<Block, parachain::ExtHostFunctions>(config)
324+
cmd.run_with_spec::<HashingFor<Block>, parachain::ExtHostFunctions>(Some(config.chain_spec))
325325
})
326326
})
327327
},

runtime/common/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,13 @@ std = [
5757
"zenlink-protocol/std",
5858
"xc-asset-config/std",
5959
]
60+
runtime-benchmarks = [
61+
"frame-support/runtime-benchmarks",
62+
"frame-system/runtime-benchmarks",
63+
"sp-runtime/runtime-benchmarks",
64+
"pallet-block-reward/runtime-benchmarks",
65+
"pallet-assets/runtime-benchmarks",
66+
"xc-asset-config/runtime-benchmarks",
67+
68+
"xcm-builder/runtime-benchmarks",
69+
]

runtime/common/src/payment.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ where
156156
}
157157
Ok(())
158158
}
159+
160+
// These two are unused but must satisfy the trait impl
161+
#[cfg(feature = "runtime-benchmarks")]
162+
fn endow_account(_who: &<T>::AccountId, _amount: Self::Balance) {}
163+
#[cfg(feature = "runtime-benchmarks")]
164+
fn minimum_balance() -> Self::Balance {
165+
Self::Balance::zero()
166+
}
159167
}
160168

161169
/// Individual trait to handle payments in non-local currencies. The intention is to keep it as

runtime/krest/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ runtime-benchmarks = [
174174
"peaq-pallet-storage/runtime-benchmarks",
175175
"inflation-manager/runtime-benchmarks",
176176
"pallet-scheduler/runtime-benchmarks",
177-
"pallet-preimage/runtime-benchmarks"
177+
"pallet-preimage/runtime-benchmarks",
178+
"runtime-common/runtime-benchmarks",
178179
]
179180

180181
std = [

runtime/peaq-dev/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ runtime-benchmarks = [
176176
"peaq-pallet-mor/runtime-benchmarks",
177177
"inflation-manager/runtime-benchmarks",
178178
"pallet-scheduler/runtime-benchmarks",
179-
"pallet-preimage/runtime-benchmarks"
179+
"pallet-preimage/runtime-benchmarks",
180+
"runtime-common/runtime-benchmarks",
180181
]
181182

182183
std = [

runtime/peaq/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ runtime-benchmarks = [
173173
"peaq-pallet-storage/runtime-benchmarks",
174174
"inflation-manager/runtime-benchmarks",
175175
"pallet-scheduler/runtime-benchmarks",
176-
"pallet-preimage/runtime-benchmarks"
176+
"pallet-preimage/runtime-benchmarks",
177+
"runtime-common/runtime-benchmarks",
177178
]
178179

179180
std = [

0 commit comments

Comments
 (0)