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

Commit 443ad34

Browse files
sam0x17bkchr
authored andcommitted
migrate new benchmarking syntax from frame_support::benchmarking to frame_benchmarking::v2 (#13235)
* * re-export frame_support::benchmarking in frame_benchmarking:: * prefer use frame_benchmarking::*; in examples, etc * switch to frame_benchmarking::v2 * completely migrate new benchmarking code out of frame_support * fix doc links * remove unneeded return Co-authored-by: Bastian Köcher <[email protected]> * remove another unneeded return Co-authored-by: Bastian Köcher <[email protected]> * properly export all macros in v1 * refactor existing frame_benchmarking imports to use ::v1 --------- Co-authored-by: Bastian Köcher <[email protected]>
1 parent e07ad51 commit 443ad34

File tree

69 files changed

+2291
-2240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2291
-2240
lines changed

Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node-template/pallets/template/src/benchmarking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::*;
44

55
#[allow(unused)]
66
use crate::Pallet as Template;
7-
use frame_benchmarking::{benchmarks, whitelisted_caller};
7+
use frame_benchmarking::v1::{benchmarks, whitelisted_caller};
88
use frame_system::RawOrigin;
99

1010
benchmarks! {

frame/alliance/src/benchmarking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use sp_std::{
2525
prelude::*,
2626
};
2727

28-
use frame_benchmarking::{account, benchmarks_instance_pallet};
28+
use frame_benchmarking::v1::{account, benchmarks_instance_pallet};
2929
use frame_support::traits::{EnsureOrigin, Get, UnfilteredDispatchable};
3030
use frame_system::{Pallet as System, RawOrigin as SystemOrigin};
3131

frame/assets/src/benchmarking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#![cfg(feature = "runtime-benchmarks")]
2121

2222
use super::*;
23-
use frame_benchmarking::{
23+
use frame_benchmarking::v1::{
2424
account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller,
2525
};
2626
use frame_support::{

frame/babe/src/benchmarking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#![cfg(feature = "runtime-benchmarks")]
2121

2222
use super::*;
23-
use frame_benchmarking::benchmarks;
23+
use frame_benchmarking::v1::benchmarks;
2424

2525
type Header = sp_runtime::generic::Header<u64, sp_runtime::traits::BlakeTwo256>;
2626

frame/bags-list/src/benchmarks.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
2020
use super::*;
2121
use crate::list::List;
22-
use frame_benchmarking::{account, whitelist_account, whitelisted_caller};
22+
use frame_benchmarking::v1::{
23+
account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller,
24+
};
2325
use frame_election_provider_support::ScoreProvider;
2426
use frame_support::{assert_ok, traits::Get};
2527
use frame_system::RawOrigin as SystemOrigin;
2628
use sp_runtime::traits::One;
2729

28-
frame_benchmarking::benchmarks_instance_pallet! {
30+
benchmarks_instance_pallet! {
2931
rebag_non_terminal {
3032
// An expensive case for rebag-ing (rebag a non-terminal node):
3133
//

frame/balances/src/benchmarking.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
use super::*;
2323
use crate::Pallet as Balances;
2424

25-
use frame_benchmarking::{account, impl_benchmark_test_suite, whitelisted_caller};
26-
use frame_support::benchmarking::*;
25+
use frame_benchmarking::v2::*;
2726
use frame_system::RawOrigin;
2827

2928
const SEED: u32 = 0;

frame/benchmarking/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ paste = "1.0"
2020
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
2121
serde = { version = "1.0.136", optional = true }
2222
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
23+
frame-support-procedural = { version = "4.0.0-dev", default-features = false, path = "../support/procedural" }
2324
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
2425
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../primitives/api" }
2526
sp-application-crypto = { version = "7.0.0", default-features = false, path = "../../primitives/application-crypto" }
@@ -29,6 +30,7 @@ sp-runtime = { version = "7.0.0", default-features = false, path = "../../primit
2930
sp-runtime-interface = { version = "7.0.0", default-features = false, path = "../../primitives/runtime-interface" }
3031
sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" }
3132
sp-storage = { version = "7.0.0", default-features = false, path = "../../primitives/storage" }
33+
static_assertions = "1.1.0"
3234

3335
[dev-dependencies]
3436
array-bytes = "4.1"

0 commit comments

Comments
 (0)