@@ -27,6 +27,7 @@ impl frame_system::Config for Test {
27
27
28
28
thread_local ! {
29
29
static TIME : RefCell <u32 > = RefCell :: new( 0 ) ;
30
+ static MEMBERS : RefCell <Vec <AccountId >> = RefCell :: new( vec![ 1 , 2 , 3 ] ) ;
30
31
}
31
32
32
33
pub struct Timestamp ;
@@ -46,14 +47,28 @@ impl Timestamp {
46
47
47
48
parameter_types ! {
48
49
pub const RootOperatorAccountId : AccountId = 4 ;
49
- pub static OracleMembers : Vec < AccountId > = vec! [ 1 , 2 , 3 ] ;
50
+ pub const MaxFeedValues : u32 = 5 ;
50
51
}
51
52
52
53
pub struct Members ;
53
54
54
55
impl SortedMembers < AccountId > for Members {
55
56
fn sorted_members ( ) -> Vec < AccountId > {
56
- OracleMembers :: get ( )
57
+ MEMBERS . with ( |v| v. borrow ( ) . clone ( ) )
58
+ }
59
+
60
+ #[ cfg( feature = "runtime-benchmarks" ) ]
61
+ fn add ( who : & AccountId ) {
62
+ MEMBERS . with ( |v| v. borrow_mut ( ) . push ( * who) ) ;
63
+ }
64
+ }
65
+
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 ( )
57
72
}
58
73
}
59
74
@@ -68,7 +83,9 @@ impl Config for Test {
68
83
type Members = Members ;
69
84
type WeightInfo = ( ) ;
70
85
type MaxHasDispatchedSize = ConstU32 < 100 > ;
71
- type MaxFeedValues = ConstU32 < 5 > ;
86
+ type MaxFeedValues = MaxFeedValues ;
87
+ #[ cfg( feature = "runtime-benchmarks" ) ]
88
+ type BenchmarkHelper = BenchmarkHelper ;
72
89
}
73
90
74
91
type Block = frame_system:: mocking:: MockBlock < Test > ;
@@ -80,6 +97,10 @@ construct_runtime!(
80
97
}
81
98
) ;
82
99
100
+ pub fn set_members ( members : Vec < AccountId > ) {
101
+ MEMBERS . with ( |v| * v. borrow_mut ( ) = members) ;
102
+ }
103
+
83
104
// This function basically just builds a genesis storage key/value store
84
105
// according to our desired mockup.
85
106
pub fn new_test_ext ( ) -> sp_io:: TestExternalities {
0 commit comments