-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: pallet benchmarking interactive UI #420
base: chungquantin/feat-pop_bench_command
Are you sure you want to change the base?
feat: pallet benchmarking interactive UI #420
Conversation
* feat: add bench subcommand * feat: integrates frame-benchmarking-cli * refactor: PalletCmd run with spec * feat: set RUST_LOG=info for benchmarking display * feat: add CLI messages and tests * feat: add benchmark runtime wasm test * chore: fix comment * fix: operator cannot be applied to type * chore: display error and refactor test file * chore: rename `bench` file * chore: clippy warning * refactor: parachain feature in bench command * feat: add bench subcommand * feat: integrates frame-benchmarking-cli * refactor: PalletCmd run with spec * feat: add CLI messages and tests * feat: add benchmark runtime wasm test * chore: fix comment * fix: operator cannot be applied to type * chore: display error and refactor test file * chore: rename `bench` file * chore: clippy warning * refactor: parachain feature in bench command * chore: revert mod.rs * feat: add bench subcommand * chore: revert mod.rs * feat: add bench subcommand * feat: integrates frame-benchmarking-cli * refactor: PalletCmd run with spec * feat: set RUST_LOG=info for benchmarking display * feat: add CLI messages and tests * feat: add benchmark runtime wasm test * chore: fix comment * fix: operator cannot be applied to type * chore: display error and refactor test file * chore: rename `bench` file * chore: clippy warning * refactor: parachain feature in bench command * feat: add bench subcommand * feat: integrates frame-benchmarking-cli * refactor: PalletCmd run with spec * feat: add CLI messages and tests * feat: add benchmark runtime wasm test * chore: fix comment * fix: operator cannot be applied to type * chore: display error and refactor test file * chore: rename `bench` file * chore: clippy warning * refactor: parachain feature in bench command * chore: revert mod.rs * feat: add bench subcommand * chore: revert mod.rs * chore: revert changes * feat: benchmark existing runtime binary and select policy, presets (#411) * feat: add bench subcommand * feat: integrates frame-benchmarking-cli * refactor: PalletCmd run with spec * feat: set RUST_LOG=info for benchmarking display * feat: add CLI messages and tests * feat: add benchmark runtime wasm test * chore: fix comment * fix: operator cannot be applied to type * chore: display error and refactor test file * feat: auto detect wasm blob and build runtime * feat: build runtime wasm blob * refactor: build binary path method * fix: runtime path test * refactor: feature gating for benchmarking feature * chore: remove unused argument * fix: comment * chore: rename `bench` file * chore: rename `bench` file * feat: auto detect wasm blob and build runtime * feat: build runtime wasm blob * refactor: build binary path method * feat: list and select runtimes * chore: remove unused code * feat: auto detect wasm blob and build runtime * feat: build runtime wasm blob * refactor: build binary path method * chore: removed duplicate code * chore: remove spinner * chore: clippy warning * chore: clippy warning * refactor: parachain feature in bench command * chore: reorder imports * feat: select genesis builder * refactor: test helpers * chore: remove output display * chore: update parse genesis builder comment * fix: locate runtime and help command * chore: clippy warning * chore: display error message on binary check * fix: comment * feat: add genesis preset check (#422) * feat: add genesis preset check * feat: update_genesis_preset * refactor: constant name & add tests for preset * refactor: get_runtime_path * refactor: code order * refactor: test files * chore: clippy warning * refactor: list presets instead of manual input * feat: default to `none` if no presets found * refactor: build project test instead of runtime
…feat-pallet_bench_ui
* refactor: use filter_mode to fuzzy search pallets * chore: update cargo-deny-action@v2 * chore: rebase * chore: revert not relevant changes * chore: delete conflicting file * feat: add confirm input to extrinsics selection
…feat-pallet_bench_ui
Some(temp_file.as_file()), | ||
vec
Resolved by not throwing error anymore. Listing pallets for non runtime-benchmarks
feature runtime binary works normally.
pop bench pallet
:

@chungquantin Resolved:
pop bench pallet --runtime=runtime --pallet= --extrinsic=
inpop-node
folder:

@chungquantin Resolved:
|
||
/// Comma separated list of pallets that should be excluded from the benchmark. | ||
#[arg(long, value_parser, num_args = 1.., value_delimiter = ',')] | ||
pub exclude_pallets: Vec<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this one is used in combination with the below flag or pallet=*
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes correct, this is only used when pallet=*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And with the flag all
? If that is not allowed we could add the conflicts_with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, Tin! The searcher is running smoothly, so cool!
I left a few comments, but they’re all minor and not blockers. Approved! 🎉
match option.update_arguments(self, &mut registry, cli).await { | ||
Ok(true) => break, | ||
Ok(false) => continue, | ||
Err(e) => cli.info(e)?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not requesting a change, just a question, an info
message here is better than an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throws error here would panic and cancel the loop. The idea is whenever there's an error, we log the error and display the menu again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean to throw an error, it was more about the message cliclack::log::error
or maybe a cliclack::log::warning
instead of an info
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, apologies I did not aware of the feature in cliclack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some UX improvements / suggestions, but wow what an amazing PR!
Description
The PR is a part of a bigger PR #424. It implements the full flow of the
pop bench pallet
including new key features:frame-omni-bencher
binary feat: add code to source omni bencher #428. This is required to list pallets and extrinsics. Explained herePalletCmd
(calledBenchmarkPallet
) instead offrame-benchmarking-cli::PalletCmd
due to required parameters issue. Explained hereHow to test the PR?
If arguments are provided like
We skip the runtime, the pallet and the extrinsic.
To skip the parameter menu, user can specify flag
--skip
then the parameter menu can be skipped and go directly to run the bencmarking.Test single line command
Help command
Full flow breakdown
Note: If
--list
or--json-output
is provided, we run the command byframe-benchmarking-cli
directly instead of go through the implementation in pop-cli.Stage 1: Locate runtime or input runtime path manually
runtime
orruntimes
(Hyperbridge) folder. This falls to the first stage "Stage 1: Locating and building a runtime binary | Scenario 1" of the previous PR.runtime
orruntimes
(Hyperbridge) folder. This falls to the first stage "Stage 1: Locating and building a runtime binary | Scenario 2" of the previous PR.NOTE: After the path is located and there is no WASM file found in the
target/<profile>/wbuild/<runtime-name>.wasm
, we will build the runtime withruntime-benchmarks
feature first.Stage 2: Select genesis builder policy & preset
See full breakdown in #411
Stage 3: Select pallets (Single Select) & extrinsics (Multiple Select)
At this stage, we will check if the binary of
frame-omni-bencher
exists on the user's machine. Explained hereNote: We only call
frame-omni-bencher
to load pallets and extrinsics once a session.For the extrinsic selection, we only allow user to select if there are pallet specified. If all pallet are selected (
--pallet=*
), we skip the next step.Stage 4: Parameter menu
User can update the parameters by selecting an option in the parameter menu. Some arguments will be disabled depend on the status of other parameters. See
is_disabled
method. For example:GenesisBuilderPolicy::None
Stage 5: Input the output path
This stage is optional, if no value is provided, we don't write to any file.
Stage 6: Print the single line command
[sc-2882]