Skip to content

Commit 288218c

Browse files
authored
impl BenchmarkHelper for () (#997)
1 parent e576f86 commit 288218c

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

oracle/src/benchmarking.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ use frame_benchmarking::v2::*;
55

66
use frame_support::assert_ok;
77
use frame_system::{Pallet as System, RawOrigin};
8-
use sp_std::vec;
98

109
#[instance_benchmarks]
1110
mod benchmarks {
1211
use super::*;
1312

1413
#[benchmark]
15-
fn feed_values(x: Linear<1, { T::BenchmarkHelper::get_currency_id_value_pairs().len() as u32 }>) {
14+
fn feed_values(x: Linear<0, { T::BenchmarkHelper::get_currency_id_value_pairs().len() as u32 }>) {
1615
// Register the caller
1716
let caller: T::AccountId = whitelisted_caller();
1817
T::Members::add(&caller);

oracle/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ pub trait BenchmarkHelper<OracleKey, OracleValue, L: Get<u32>> {
6363
fn get_currency_id_value_pairs() -> BoundedVec<(OracleKey, OracleValue), L>;
6464
}
6565

66+
#[cfg(feature = "runtime-benchmarks")]
67+
impl<OracleKey, OracleValue, L: Get<u32>> BenchmarkHelper<OracleKey, OracleValue, L> for () {
68+
fn get_currency_id_value_pairs() -> BoundedVec<(OracleKey, OracleValue), L> {
69+
BoundedVec::default()
70+
}
71+
}
72+
6673
#[frame_support::pallet]
6774
pub mod module {
6875
use super::*;

oracle/src/mock.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@ impl SortedMembers<AccountId> for Members {
6363
}
6464
}
6565

66-
#[cfg(feature = "runtime-benchmarks")]
67-
pub struct BenchmarkHelper;
68-
#[cfg(feature = "runtime-benchmarks")]
69-
impl crate::BenchmarkHelper<Key, Value, MaxFeedValues> for BenchmarkHelper {
70-
fn get_currency_id_value_pairs() -> BoundedVec<(Key, Value), MaxFeedValues> {
71-
vec![(1, 1), (2, 2), (3, 3)].try_into().unwrap()
72-
}
73-
}
74-
7566
impl Config for Test {
7667
type RuntimeEvent = RuntimeEvent;
7768
type OnNewData = ();
@@ -85,7 +76,7 @@ impl Config for Test {
8576
type MaxHasDispatchedSize = ConstU32<100>;
8677
type MaxFeedValues = MaxFeedValues;
8778
#[cfg(feature = "runtime-benchmarks")]
88-
type BenchmarkHelper = BenchmarkHelper;
79+
type BenchmarkHelper = ();
8980
}
9081

9182
type Block = frame_system::mocking::MockBlock<Test>;

0 commit comments

Comments
 (0)