mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 18:41:03 +00:00
Use define_benchmarks! (#4760)
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
committed by
GitHub
parent
8756678a83
commit
cc1201ef27
@@ -556,6 +556,17 @@ pub type Executive = frame_executive::Executive<
|
||||
AllPallets,
|
||||
>;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
#[macro_use]
|
||||
extern crate frame_benchmarking;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benches {
|
||||
define_benchmarks!(
|
||||
[pallet_bridge_token_swap, BridgeRialtoTokenSwap]
|
||||
);
|
||||
}
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
@@ -802,22 +813,20 @@ impl_runtime_apis! {
|
||||
Vec<frame_benchmarking::BenchmarkList>,
|
||||
Vec<frame_support::traits::StorageInfo>,
|
||||
) {
|
||||
use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkList};
|
||||
use frame_support::traits::StorageInfoTrait;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
|
||||
list_benchmark!(list, extra, pallet_bridge_token_swap, BridgeRialtoTokenSwap);
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
let storage_info = AllPalletsWithSystem::storage_info();
|
||||
|
||||
return (list, storage_info)
|
||||
}
|
||||
|
||||
fn dispatch_benchmark(
|
||||
config: frame_benchmarking::BenchmarkConfig,
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, add_benchmark};
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
@@ -850,7 +859,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
add_benchmark!(params, batches, pallet_bridge_token_swap, BridgeRialtoTokenSwap);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
|
||||
@@ -472,6 +472,19 @@ construct_runtime!(
|
||||
}
|
||||
);
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
#[macro_use]
|
||||
extern crate frame_benchmarking;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benches {
|
||||
define_benchmarks!(
|
||||
[frame_system, SystemBench::<Runtime>]
|
||||
[pallet_balances, Balances]
|
||||
[pallet_timestamp, Timestamp]
|
||||
);
|
||||
}
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
@@ -586,7 +599,7 @@ impl_runtime_apis! {
|
||||
fn dispatch_benchmark(
|
||||
config: frame_benchmarking::BenchmarkConfig
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
||||
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
@@ -606,10 +619,7 @@ impl_runtime_apis! {
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
|
||||
add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
|
||||
add_benchmark!(params, batches, pallet_balances, Balances);
|
||||
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
|
||||
@@ -573,6 +573,19 @@ pub type Executive = frame_executive::Executive<
|
||||
AllPallets,
|
||||
>;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
#[macro_use]
|
||||
extern crate frame_benchmarking;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benches {
|
||||
define_benchmarks!(
|
||||
[pallet_bridge_messages,
|
||||
MessagesBench::<Runtime, WithMillauMessagesInstance>]
|
||||
[pallet_bridge_grandpa, BridgeMillauGrandpa]
|
||||
);
|
||||
}
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
@@ -947,18 +960,15 @@ impl_runtime_apis! {
|
||||
Vec<frame_benchmarking::BenchmarkList>,
|
||||
Vec<frame_support::traits::StorageInfo>,
|
||||
) {
|
||||
use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkList};
|
||||
use frame_support::traits::StorageInfoTrait;
|
||||
|
||||
use pallet_bridge_messages::benchmarking::Pallet as MessagesBench;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
|
||||
list_benchmark!(list, extra, pallet_bridge_messages, MessagesBench::<Runtime, WithMillauMessagesInstance>);
|
||||
list_benchmark!(list, extra, pallet_bridge_grandpa, BridgeMillauGrandpa);
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
let storage_info = AllPalletsWithSystem::storage_info();
|
||||
|
||||
return (list, storage_info)
|
||||
}
|
||||
|
||||
@@ -968,7 +978,7 @@ impl_runtime_apis! {
|
||||
Vec<frame_benchmarking::BenchmarkBatch>,
|
||||
sp_runtime::RuntimeString,
|
||||
> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
||||
use frame_support::traits::StorageInfoTrait;
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
@@ -1153,13 +1163,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
add_benchmark!(
|
||||
params,
|
||||
batches,
|
||||
pallet_bridge_messages,
|
||||
MessagesBench::<Runtime, WithMillauMessagesInstance>
|
||||
);
|
||||
add_benchmark!(params, batches, pallet_bridge_grandpa, BridgeMillauGrandpa);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
Ok(batches)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user