Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Sub-commands for benchmark #11164

Merged
merged 11 commits into from
Apr 7, 2022
Merged

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Apr 4, 2022

Changes:

  • 👉 Breaking: The pallet benchmarking was moved to the benchmark pallet sub-command.
  • Move shared code into a shared module
  • Add a test for benchmark block
  • Unify docs of sub-commands

Many of the changes are just moved files, the interesting part is in node/cli/src/.

The output of the benchmark command now looks like this:

Sub-commands concerned with benchmarking. The pallet benchmarking moved to the `pallet` sub-command

USAGE:
    substrate benchmark <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    block       Benchmark the execution time of historic blocks
    help        Print this message or the help of the given subcommand(s)
    overhead    Benchmark the execution overhead per-block and per-extrinsic
    pallet      Benchmark the extrinsic weight of FRAME Pallets
    storage     Benchmark the storage speed of a chain snapshot

Polkadot companion: paritytech/polkadot#5247
Cumulus companion: paritytech/cumulus#1156
Closes #11140, #11153

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Apr 4, 2022
@ggwpez ggwpez added A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels Apr 4, 2022
@ggwpez ggwpez requested a review from shawntabrizi April 4, 2022 12:11
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez added B5-clientnoteworthy C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Apr 4, 2022
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez
Copy link
Member Author

ggwpez commented Apr 6, 2022

bot rebase

@paritytech-processbot
Copy link

Rebasing

},
_ => Err("Sub-command is not supported".into()),
})
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add the other sub commands to the node template? Seems like they would be helpful if someone is basing a new project off the template

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that's a good follow-up, I'll put it in an issue. Just wanted to get it done faster 😄

The node-template currently uses the weights from frame_support, so even when you run the benchmarks yourself, it would require some updating to actually use them in the node-template.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I added it now in the last commit since @shawntabrizi also wanted it.
There is infrastructure missing in the node-template, therefore the copy&paste from the substrate node.

Copy link
Contributor

@emostov emostov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just had some optional suggestions

ggwpez and others added 2 commits April 6, 2022 18:42
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez
Copy link
Member Author

ggwpez commented Apr 7, 2022

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 174735e into master Apr 7, 2022
@paritytech-processbot paritytech-processbot bot deleted the oty-restructure-bench branch April 7, 2022 19:33
acatangiu pushed a commit to acatangiu/substrate that referenced this pull request Apr 8, 2022
* Restructure benchmark commands

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add benchmark block test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fixup imports

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* CI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Review fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Extend error message

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Apply suggestions from code review

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Review fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add commands to node-template

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
joao-paulo-parity pushed a commit to paritytech/bench-bot that referenced this pull request Apr 15, 2022
Needed after substrate `benchmark` sub-command change
PR paritytech/substrate#11164
wischli added a commit to KILTprotocol/kilt-node that referenced this pull request Apr 27, 2022
* chore: bump deps to Polkadot v0.9.19

* fix: LengthToFee

https://github.com/paritytech/substrate/pull/10785/files

* fix: remove u32_trait

paritytech/substrate#10850

* fix: client

paritytech/substrate#11164
paritytech/cumulus#963
paritytech/cumulus#1069
paritytech/substrate#10878

* fix: clippy runtime

* fix: clippy clone

* feat: add para runtime enum for client

* ci: bump paritytech/ci-linux image

* fix: clippy

* refactor: benchmark cmd match

* fix: peregrune runtime api
ntn-x2 pushed a commit to KILTprotocol/kilt-node that referenced this pull request Jun 23, 2022
* chore: bump deps to Polkadot v0.9.19

* fix: LengthToFee

https://github.com/paritytech/substrate/pull/10785/files

* fix: remove u32_trait

paritytech/substrate#10850

* fix: client

paritytech/substrate#11164
paritytech/cumulus#963
paritytech/cumulus#1069
paritytech/substrate#10878

* fix: clippy runtime

* fix: clippy clone

* feat: add para runtime enum for client

* ci: bump paritytech/ci-linux image

* fix: clippy

* refactor: benchmark cmd match

* fix: peregrune runtime api

(cherry picked from commit 6f2016b)
DaviRain-Su pushed a commit to octopus-network/substrate that referenced this pull request Aug 23, 2022
* Restructure benchmark commands

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add benchmark block test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fixup imports

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* CI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Review fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Extend error message

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Apply suggestions from code review

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Review fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add commands to node-template

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Restructure benchmark commands

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add benchmark block test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fixup imports

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* CI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Review fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Extend error message

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Apply suggestions from code review

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Review fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add commands to node-template

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D2-breaksapi D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
Development

Successfully merging this pull request may close these issues.

Refactor benchmark command structure
3 participants