Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
83301f8
omni-node: chain is optional for benchmark pallet
iulianbarbu May 20, 2025
0f72176
benchmark-cli/omni-bencher cleanup
iulianbarbu May 21, 2025
d8b6ce1
Merge branch 'master' into ib-benchmark-parity
iulianbarbu May 21, 2025
8d29613
Update from github-actions[bot] running command 'prdoc'
github-actions[bot] May 21, 2025
45ff224
make it more explicit
iulianbarbu May 21, 2025
bb1a4ff
update prdoc
iulianbarbu May 21, 2025
4cd9ef5
Update cumulus/polkadot-omni-node/lib/src/command.rs
iulianbarbu May 21, 2025
fc23601
fix chain flag origin
iulianbarbu May 21, 2025
ac65b8c
Merge branch 'master' into ib-benchmark-parity
iulianbarbu May 21, 2025
99ed13e
return load spec error instead of run_with_spec's
iulianbarbu May 22, 2025
e9525f9
revert unneeded change
iulianbarbu May 22, 2025
566edb1
Merge branch 'master' into ib-benchmark-parity
iulianbarbu May 23, 2025
8fe8204
Merge branch 'master' into ib-benchmark-parity
iulianbarbu May 26, 2025
03e1ba0
Merge branch 'master' into ib-benchmark-parity
iulianbarbu May 26, 2025
101ba27
no need to feature guard benchmark subcommands
iulianbarbu Jun 2, 2025
35e23c6
Merge branch 'master' into ib-benchmark-parity
iulianbarbu Jun 2, 2025
a4e33b6
revert unwanted change
iulianbarbu Jun 2, 2025
a7d5c52
this shouldn't miss
iulianbarbu Jun 2, 2025
bc1c323
Merge branch 'master' into ib-benchmark-parity
iulianbarbu Jun 2, 2025
1e9a691
reverted the runtime-benchmarks feature guarding
iulianbarbu Jun 2, 2025
4a3f245
build polkadot-omni-node-lib and nodes with runtime-benchmarks
iulianbarbu Jun 3, 2025
689ce7e
Merge branch 'master' into ib-benchmark-parity
iulianbarbu Jun 3, 2025
c991d84
fix umbrella
iulianbarbu Jun 3, 2025
8dfae33
fixed toml
iulianbarbu Jun 3, 2025
763329a
some more fixes
iulianbarbu Jun 3, 2025
820539c
Revert "build polkadot-omni-node-lib and nodes with runtime-benchmarks"
iulianbarbu Jun 4, 2025
5afb0cd
remove leftovers
iulianbarbu Jun 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 49 additions & 26 deletions cumulus/polkadot-omni-node/lib/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,38 +227,61 @@ where
})
},
Some(Subcommand::Benchmark(cmd)) => {
let runner = cli.create_runner(cmd)?;

// Switch on the concrete benchmark sub-command-
match cmd {
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Pallet(cmd) => runner.sync_run(|config| {
cmd.run_with_spec::<HashingFor<Block<u32>>, ReclaimHostFunctions>(Some(
config.chain_spec,
))
}),
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
let node = new_node_spec(
&config,
&cmd_config.runtime_resolver,
&cli.node_extra_args(),
)?;
node.run_benchmark_block_cmd(config, cmd)
}),
BenchmarkCmd::Pallet(cmd) => {
let chain = cmd
.shared_params
.chain
.as_ref()
.map(|chain| cli.load_spec(&chain))
.transpose()?;
cmd.run_with_spec::<HashingFor<Block<u32>>, ReclaimHostFunctions>(chain)
},
BenchmarkCmd::Block(cmd) => {
// The command needs the full node configuration because it uses the node
// client and the database source, which in its turn has a dependency on the
// chain spec, given via the `--chain` flag.
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| {
let node = new_node_spec(
&config,
&cmd_config.runtime_resolver,
&cli.node_extra_args(),
)?;
node.run_benchmark_block_cmd(config, cmd)
})
},
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
let node = new_node_spec(
&config,
&cmd_config.runtime_resolver,
&cli.node_extra_args(),
)?;
node.run_benchmark_storage_cmd(config, cmd)
}),
BenchmarkCmd::Machine(cmd) =>
runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())),
BenchmarkCmd::Storage(cmd) => {
// The command needs the full node configuration because it uses the node
// client and the database API, storage and shared_trie_cache. It requires
// the `--chain` flag to be passed.
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| {
let node = new_node_spec(
&config,
&cmd_config.runtime_resolver,
&cli.node_extra_args(),
)?;
node.run_benchmark_storage_cmd(config, cmd)
})
},
BenchmarkCmd::Machine(cmd) => {
// The command needs the full node configuration, and implicitly a chain
// spec to be passed, even if it doesn't use it directly. The `--chain` flag is
// relevant in determining the database path, which is used for the disk
// benchmark.
//
// TODO: change `machine` subcommand to take instead a disk path we want to
// benchmark?.
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()))
},
#[allow(unreachable_patterns)]
_ => Err("Benchmarking sub-command unsupported or compilation feature missing. \
Make sure to compile with --features=runtime-benchmarks \
Make sure to compile omni-node with --features=runtime-benchmarks \
to enable all supported benchmarks."
.into()),
}
Expand Down
19 changes: 19 additions & 0 deletions prdoc/pr_8594.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
title: 'omni-node: fix `benchmark pallet` to work with `--runtime`'
doc:
- audience: Node Dev
description: |
`polkadot-omni-node benchmark pallet` can use one of `--runtime` or `--chain` now, like `frame-omni-bencher` does.

crates:
- name: polkadot-omni-node-lib
bump: patch
- name: frame-benchmarking-cli
bump: major
- name: frame-omni-bencher
bump: patch
- name: polkadot-sdk
bump: patch
- name: polkadot-omni-node
bump: patch
- name: polkadot-parachain-bin
bump: patch
15 changes: 0 additions & 15 deletions substrate/utils/frame/benchmarking-cli/src/pallet/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,6 @@ This could mean that you either did not build the node correctly with the \
not created by a node that was compiled with the flag";

impl PalletCmd {
/// Runs the command and benchmarks a pallet.
#[deprecated(
note = "`run` will be removed after December 2024. Use `run_with_spec` instead or \
completely remove the code and use the `frame-benchmarking-cli` instead (see \
https://github.com/paritytech/polkadot-sdk/pull/3512)."
)]
pub fn run<Hasher, ExtraHostFunctions>(&self, config: sc_service::Configuration) -> Result<()>
where
Hasher: Hash,
<Hasher as Hash>::Output: DecodeWithMemTracking,
ExtraHostFunctions: HostFunctions,
{
self.run_with_spec::<Hasher, ExtraHostFunctions>(Some(config.chain_spec))
}

fn state_handler_from_cli<HF: HostFunctions>(
&self,
chain_spec_from_api: Option<Box<dyn ChainSpec>>,
Expand Down
8 changes: 0 additions & 8 deletions substrate/utils/frame/omni-bencher/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,6 @@ impl V1SubCommand {
match self {
V1SubCommand::Benchmark(V1BenchmarkCommand { sub }) => match sub {
BenchmarkCmd::Pallet(pallet) => {
if let Some(spec) = pallet.shared_params.chain {
return Err(format!(
"Chain specs are not supported. Please remove `--chain={spec}` and use \
`--runtime=<PATH>` instead"
)
.into());
}

pallet.run_with_spec::<BlakeTwo256, HostFunctions>(None)
},
BenchmarkCmd::Overhead(overhead_cmd) =>
Expand Down