This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add benchmark extrinsic command
#11456
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
051fa6e
Benchmark extrinsic
ggwpez 43cedac
Reduce warmup and repeat
ggwpez 5af2d41
Make ExistentialDeposit public
ggwpez 6d25d10
Add 'bechmark extrinsic' command
ggwpez b1d07ee
fmt
ggwpez d8e2cdc
Add --list and cleanup
ggwpez 10361dd
Merge branch 'master' into oty-bench-extrinsic
ggwpez 9a850ea
Merge remote-tracking branch 'origin/master' into oty-bench-extrinsic
ggwpez 4ecc0d3
Unrelated Clippy
ggwpez 603d0ae
Clippy
ggwpez a336902
Fix tests and doc
ggwpez b6d1f25
Merge remote-tracking branch 'origin/master' into oty-bench-extrinsic
ggwpez abf1326
Merge remote-tracking branch 'origin/master' into oty-bench-extrinsic
ggwpez 5efa7c1
Move implementations up + fmt
ggwpez fba7975
Dont use parameter_types macro
ggwpez 83f8fcf
Cache to_lowercase() call
ggwpez 3688b13
Spelling
ggwpez 58d7d3f
Use correct nightly for fmt...
ggwpez 7aea64b
Rename ED
ggwpez b5a193e
Fix compile
ggwpez 87136b1
Merge remote-tracking branch 'origin/master' into oty-bench-extrinsic
ggwpez a6eaec5
Subtract block base weight
ggwpez d94db3d
Fixes
ggwpez e51a14f
Merge remote-tracking branch 'origin/master' into oty-bench-extrinsic
ggwpez 8bc5762
Merge remote-tracking branch 'origin/master' into oty-bench-extrinsic
ggwpez 929eaa0
Use tmp folder for test
ggwpez f603a06
Fix test
ggwpez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // This file is part of Substrate. | ||
|
|
||
| // Copyright (C) 2022 Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 | ||
|
|
||
| // This program is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // This program is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| use assert_cmd::cargo::cargo_bin; | ||
| use std::process::Command; | ||
| use tempfile::tempdir; | ||
|
|
||
| /// Tests that the `benchmark extrinsic` command works for | ||
| /// remark and transfer_keep_alive within the substrate dev runtime. | ||
| #[test] | ||
| fn benchmark_extrinsic_works() { | ||
| benchmark_extrinsic("system", "remark"); | ||
| benchmark_extrinsic("balances", "transfer_keep_alive"); | ||
| } | ||
|
|
||
| /// Checks that the `benchmark extrinsic` command works for the given pallet and extrinsic. | ||
| fn benchmark_extrinsic(pallet: &str, extrinsic: &str) { | ||
| let base_dir = tempdir().expect("could not create a temp dir"); | ||
|
|
||
| let status = Command::new(cargo_bin("substrate")) | ||
| .args(&["benchmark", "extrinsic", "--dev"]) | ||
| .arg("-d") | ||
| .arg(base_dir.path()) | ||
| .args(&["--pallet", pallet, "--extrinsic", extrinsic]) | ||
| // Run with low repeats for faster execution. | ||
| .args(["--warmup=10", "--repeat=10", "--max-ext-per-block=10"]) | ||
| .status() | ||
| .unwrap(); | ||
|
|
||
| assert!(status.success()); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.