@@ -17,14 +17,26 @@ mod tests {
17
17
assert_ok,
18
18
impl_outer_origin,
19
19
parameter_types,
20
- traits:: EnsureOrigin ,
20
+ traits:: {
21
+ Contains ,
22
+ ContainsLengthBound ,
23
+ EnsureOrigin ,
24
+ } ,
21
25
weights:: {
22
26
IdentityFee ,
23
27
Weight ,
24
28
} ,
25
29
} ;
26
30
use frame_system:: EnsureRoot ;
27
31
32
+ use std:: cell:: RefCell ;
33
+ use sp_core:: {
34
+ u32_trait:: {
35
+ _2,
36
+ _3,
37
+ _4,
38
+ } ,
39
+ } ;
28
40
use sp_core:: H256 ;
29
41
use sp_runtime:: {
30
42
testing:: Header ,
@@ -82,6 +94,12 @@ mod tests {
82
94
Trait as MiningSamplingTokenTrait ,
83
95
} ;
84
96
use roaming_operators;
97
+ use datahighway_runtime:: {
98
+ AccountId ,
99
+ Balance ,
100
+ BlockNumber ,
101
+ DAYS ,
102
+ } ;
85
103
86
104
// pub fn origin_of(who: &AccountId) -> <Runtime as frame_system::Trait>::Origin {
87
105
// <Runtime as frame_system::Trait>::Origin::signed((*who).clone())
@@ -139,22 +157,50 @@ mod tests {
139
157
type MaxLocks = ( ) ;
140
158
type WeightInfo = ( ) ;
141
159
}
142
- type BlockNumber = u32 ;
143
160
impl pallet_transaction_payment:: Trait for Test {
144
161
type Currency = Balances ;
145
162
type FeeMultiplierUpdate = ( ) ;
146
163
type OnTransactionPayment = ( ) ;
147
164
type TransactionByteFee = ( ) ;
148
165
type WeightToFee = IdentityFee < u64 > ;
149
166
}
167
+
168
+ thread_local ! {
169
+ static TEN_TO_FOURTEEN : RefCell <Vec <u64 >> = RefCell :: new( vec![ 10 , 11 , 12 , 13 , 14 ] ) ;
170
+ }
171
+ pub struct TenToFourteen ;
172
+ impl Contains < u64 > for TenToFourteen {
173
+ fn sorted_members ( ) -> Vec < u64 > {
174
+ TEN_TO_FOURTEEN . with ( |v| v. borrow ( ) . clone ( ) )
175
+ }
176
+
177
+ #[ cfg( feature = "runtime-benchmarks" ) ]
178
+ fn add ( new : & u64 ) {
179
+ TEN_TO_FOURTEEN . with ( |v| {
180
+ let mut members = v. borrow_mut ( ) ;
181
+ members. push ( * new) ;
182
+ members. sort ( ) ;
183
+ } )
184
+ }
185
+ }
186
+ impl ContainsLengthBound for TenToFourteen {
187
+ fn max_len ( ) -> usize {
188
+ TEN_TO_FOURTEEN . with ( |v| v. borrow ( ) . len ( ) )
189
+ }
190
+
191
+ fn min_len ( ) -> usize {
192
+ 0
193
+ }
194
+ }
195
+
150
196
parameter_types ! {
151
197
pub const ProposalBond : Permill = Permill :: from_percent( 5 ) ;
152
- pub const ProposalBondMinimum : BlockNumber = 1_000_000_000_000_000_000 ;
153
- pub const SpendPeriod : BlockNumber = 1 ;
198
+ pub const ProposalBondMinimum : u64 = 1_000_000_000_000_000_000 ;
199
+ pub const SpendPeriod : BlockNumber = 1 * DAYS ;
154
200
pub const Burn : Permill = Permill :: from_percent( 0 ) ;
155
201
pub const TipCountdown : BlockNumber = 1 ;
156
202
pub const TipFindersFee : Percent = Percent :: from_percent( 20 ) ;
157
- pub const TipReportDepositBase : u32 = 1_000_000_000_000_000_000 ;
203
+ pub const TipReportDepositBase : u64 = 1_000_000_000_000_000_000 ;
158
204
pub const MaximumReasonLength : u32 = 16384 ;
159
205
pub const BountyValueMinimum : u64 = 1 ;
160
206
pub const BountyCuratorDeposit : Permill = Permill :: from_percent( 50 ) ;
@@ -183,15 +229,12 @@ mod tests {
183
229
type OnSlash = ( ) ;
184
230
type ProposalBond = ProposalBond ;
185
231
type ProposalBondMinimum = ProposalBondMinimum ;
186
- // type RejectOrigin = pallet_collective::EnsureMembers<_2, AccountId, GeneralCouncilInstance>;
187
232
type RejectOrigin = EnsureRoot < u64 > ;
188
233
type SpendPeriod = SpendPeriod ;
189
234
type TipCountdown = TipCountdown ;
190
235
type TipFindersFee = TipFindersFee ;
191
236
type TipReportDepositBase = TipReportDepositBase ;
192
- // FIXME - upgrade to Substrate 3 since does not use Tippers, only then
193
- // can we add tests for the eligibility/proxy code
194
- // type Tippers = GeneralCouncilProvider;
237
+ type Tippers = TenToFourteen ;
195
238
type WeightInfo = ( ) ;
196
239
}
197
240
// FIXME - remove this when figure out how to use these types within mining-speed-boost runtime module itself
0 commit comments