@@ -369,10 +369,10 @@ impl pallet_multisig::Config for Runtime {
369369}
370370
371371#[ cfg( feature = "runtime-benchmarks" ) ]
372- pub struct BenchmarkHelper < SC , ACC > ( sp_std:: marker:: PhantomData < ( SC , ACC ) > ) ;
372+ pub struct DAppStakingBenchmarkHelper < SC , ACC > ( sp_std:: marker:: PhantomData < ( SC , ACC ) > ) ;
373373#[ cfg( feature = "runtime-benchmarks" ) ]
374374impl pallet_dapp_staking_v3:: BenchmarkHelper < SmartContract < AccountId > , AccountId >
375- for BenchmarkHelper < SmartContract < AccountId > , AccountId >
375+ for DAppStakingBenchmarkHelper < SmartContract < AccountId > , AccountId >
376376{
377377 fn get_smart_contract ( id : u32 ) -> SmartContract < AccountId > {
378378 let id_bytes = id. to_le_bytes ( ) ;
@@ -388,15 +388,6 @@ impl pallet_dapp_staking_v3::BenchmarkHelper<SmartContract<AccountId>, AccountId
388388 . expect ( "Must succeed in test/benchmark environment." ) ;
389389 }
390390}
391- #[ cfg( feature = "runtime-benchmarks" ) ]
392- impl < SC , ACC > orml_oracle:: BenchmarkHelper < CurrencyId , Price , ConstU32 < 2 > >
393- for BenchmarkHelper < SC , ACC >
394- {
395- fn get_currency_id_value_pairs ( ) -> sp_runtime:: BoundedVec < ( CurrencyId , Price ) , ConstU32 < 2 > > {
396- sp_runtime:: BoundedVec :: try_from ( vec ! [ ( CurrencyId :: ASTR , Price :: from_rational( 15 , 100 ) ) ] )
397- . expect ( "out of bounds" )
398- }
399- }
400391
401392pub struct AccountCheck ;
402393impl DappStakingAccountCheck < AccountId > for AccountCheck {
@@ -446,7 +437,7 @@ impl pallet_dapp_staking_v3::Config for Runtime {
446437 type RankingEnabled = ConstBool < true > ;
447438 type WeightInfo = weights:: pallet_dapp_staking_v3:: SubstrateWeight < Runtime > ;
448439 #[ cfg( feature = "runtime-benchmarks" ) ]
449- type BenchmarkHelper = BenchmarkHelper < SmartContract < AccountId > , AccountId > ;
440+ type BenchmarkHelper = DAppStakingBenchmarkHelper < SmartContract < AccountId > , AccountId > ;
450441}
451442
452443pub struct InflationPayoutPerBlock ;
@@ -1109,6 +1100,19 @@ impl pallet_price_aggregator::Config for Runtime {
11091100 type WeightInfo = pallet_price_aggregator:: weights:: SubstrateWeight < Runtime > ;
11101101}
11111102
1103+ #[ cfg( feature = "runtime-benchmarks" ) ]
1104+ pub struct OracleBenchmarkHelper ;
1105+ #[ cfg( feature = "runtime-benchmarks" ) ]
1106+ impl orml_oracle:: BenchmarkHelper < CurrencyId , Price , ConstU32 < 2 > > for OracleBenchmarkHelper {
1107+ fn get_currency_id_value_pairs ( ) -> sp_runtime:: BoundedVec < ( CurrencyId , Price ) , ConstU32 < 2 > > {
1108+ sp_runtime:: BoundedVec :: try_from ( vec ! [
1109+ ( CurrencyId :: ASTR , Price :: from_rational( 15 , 100 ) ) ,
1110+ ( CurrencyId :: ASTR , Price :: from_rational( 15 , 100 ) ) ,
1111+ ] )
1112+ . expect ( "out of bounds" )
1113+ }
1114+ }
1115+
11121116parameter_types ! {
11131117 // Cannot specify `Root` so need to do it like this, unfortunately.
11141118 pub RootOperatorAccountId : AccountId = AccountId :: from( [ 0xffu8 ; 32 ] ) ;
@@ -1122,6 +1126,9 @@ impl orml_oracle::Config for Runtime {
11221126 type OracleKey = CurrencyId ;
11231127 type OracleValue = Price ;
11241128 type RootOperatorAccountId = RootOperatorAccountId ;
1129+ #[ cfg( feature = "runtime-benchmarks" ) ]
1130+ type Members = OracleMembershipWrapper ;
1131+ #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
11251132 type Members = OracleMembership ;
11261133 type MaxHasDispatchedSize = ConstU32 < 8 > ;
11271134 type WeightInfo = oracle_benchmarks:: weights:: SubstrateWeight < Runtime > ;
@@ -1130,7 +1137,7 @@ impl orml_oracle::Config for Runtime {
11301137 #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
11311138 type MaxFeedValues = ConstU32 < 1 > ;
11321139 #[ cfg( feature = "runtime-benchmarks" ) ]
1133- type BenchmarkHelper = BenchmarkHelper < SmartContract < AccountId > , AccountId > ;
1140+ type BenchmarkHelper = OracleBenchmarkHelper ;
11341141}
11351142
11361143impl pallet_membership:: Config < OracleMembershipInst > for Runtime {
@@ -1147,6 +1154,24 @@ impl pallet_membership::Config<OracleMembershipInst> for Runtime {
11471154 type WeightInfo = pallet_membership:: weights:: SubstrateWeight < Runtime > ;
11481155}
11491156
1157+ /// OracleMembership wrapper used by benchmarks
1158+ #[ cfg( feature = "runtime-benchmarks" ) ]
1159+ pub struct OracleMembershipWrapper ;
1160+
1161+ #[ cfg( feature = "runtime-benchmarks" ) ]
1162+ impl frame_support:: traits:: SortedMembers < AccountId > for OracleMembershipWrapper {
1163+ fn sorted_members ( ) -> Vec < AccountId > {
1164+ OracleMembership :: sorted_members ( )
1165+ }
1166+
1167+ fn add ( account : & AccountId ) {
1168+ frame_support:: assert_ok!( OracleMembership :: add_member(
1169+ frame_system:: RawOrigin :: Root . into( ) ,
1170+ account. to_owned( ) . into( )
1171+ ) ) ;
1172+ }
1173+ }
1174+
11501175construct_runtime ! (
11511176 pub struct Runtime
11521177 {
0 commit comments