Skip to content

Commit

Permalink
support runtime-benchmarking in runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
lemunozm committed Mar 25, 2024
1 parent 43d2b2b commit d9c8aa6
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions pallets/block-rewards/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use frame_support::{
};
use frame_system::RawOrigin;
use sp_runtime::traits::Zero;
use sp_std::vec; // required for #[benchmarks]

use super::*;
use crate::{pallet::Config, Pallet as BlockRewards};
Expand Down
1 change: 1 addition & 0 deletions pallets/investments/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use frame_benchmarking::{account, impl_benchmark_test_suite, v2::*, whitelisted_
use frame_support::traits::fungibles::Mutate;
use frame_system::RawOrigin;
use sp_runtime::{traits::One, Perquintill};
use sp_std::vec; // required for #[benchmarks]

use crate::{Call, Config, CurrencyOf, Pallet};

Expand Down
1 change: 1 addition & 0 deletions pallets/oracle-collection/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use cfg_traits::{
};
use frame_benchmarking::{v2::*, whitelisted_caller};
use frame_system::RawOrigin;
use sp_std::vec; // required for #[benchmarks]

use crate::{
pallet::{Call, Collection, Config, Pallet},
Expand Down
1 change: 1 addition & 0 deletions pallets/oracle-feed/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use frame_benchmarking::{v2::*, whitelisted_caller};
use frame_support::traits::OriginTrait;
use frame_system::RawOrigin;
use parity_scale_codec::Decode;
use sp_std::vec; // required for #[benchmarks]

use crate::pallet::{Call, Config, Pallet};

Expand Down
1 change: 1 addition & 0 deletions pallets/order-book/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use sp_runtime::{
traits::{checked_pow, Zero},
FixedPointNumber,
};
use sp_std::vec; // required for #[benchmarks]

use super::*;

Expand Down
1 change: 1 addition & 0 deletions pallets/pool-fees/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use cfg_traits::{
use cfg_types::pools::PoolFeeEditor;
use frame_benchmarking::v2::*;
use frame_support::{assert_ok, dispatch::RawOrigin};
use sp_std::vec; // required for #[benchmarks]

use super::*;
use crate::{types::Change, Pallet as PoolFees};
Expand Down
1 change: 1 addition & 0 deletions pallets/token-mux/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use frame_support::traits::fungibles::{Inspect, Mutate};
use frame_system::RawOrigin;
use orml_traits::asset_registry::{Inspect as OrmlInspect, Mutate as OrmlMutate};
use sp_arithmetic::traits::{One, Zero};
use sp_std::vec; // required for #[benchmarks]

use super::*;

Expand Down
3 changes: 2 additions & 1 deletion runtime/altair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2705,9 +2705,10 @@ impl_runtime_apis! {
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, add_benchmark};
use frame_system_benchmarking::Pallet as SystemBench;
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
use frame_support::traits::TrackedStorageKey;

impl frame_system_benchmarking::Config for Runtime {}
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
Expand Down
3 changes: 2 additions & 1 deletion runtime/centrifuge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2756,8 +2756,9 @@ impl_runtime_apis! {
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, add_benchmark};
use frame_system_benchmarking::Pallet as SystemBench;
use frame_support::traits::TrackedStorageKey;
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;

impl frame_system_benchmarking::Config for Runtime {}
Expand Down
3 changes: 2 additions & 1 deletion runtime/development/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2739,7 +2739,8 @@ impl_runtime_apis! {
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, add_benchmark};
use frame_support::traits::TrackedStorageKey;
use frame_system_benchmarking::Pallet as SystemBench;
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;

Expand Down

0 comments on commit d9c8aa6

Please sign in to comment.