24
24
update_clock_slot,
25
25
AccountSetup ,
26
26
} ,
27
- validator:: {
28
- self ,
29
- } ,
27
+ validator,
30
28
} ,
31
29
solana_program:: {
32
30
program_error:: ProgramError ,
@@ -122,22 +120,12 @@ fn test_upd_price_with_validator() {
122
120
}
123
121
124
122
// We aggregate the price at the end of each slot now.
125
- validator:: aggregate_price (
126
- 1 ,
127
- 101 ,
128
- price_account. key ,
129
- & mut * price_account. data . borrow_mut ( ) ,
130
- )
131
- . unwrap ( ) ;
123
+ validator:: aggregate_price ( 1 , 101 , price_account. key , * price_account. data . borrow_mut ( ) )
124
+ . unwrap ( ) ;
132
125
update_clock_slot ( & mut clock_account, 2 ) ;
133
126
134
- validator:: aggregate_price (
135
- 2 ,
136
- 102 ,
137
- price_account. key ,
138
- & mut * price_account. data . borrow_mut ( ) ,
139
- )
140
- . unwrap ( ) ;
127
+ validator:: aggregate_price ( 2 , 102 , price_account. key , * price_account. data . borrow_mut ( ) )
128
+ . unwrap ( ) ;
141
129
update_clock_slot ( & mut clock_account, 3 ) ;
142
130
// add next price in new slot triggering snapshot and aggregate calc
143
131
populate_instruction ( & mut instruction_data, 81 , 2 , 2 ) ;
@@ -168,13 +156,8 @@ fn test_upd_price_with_validator() {
168
156
169
157
// next price doesn't change but slot does
170
158
populate_instruction ( & mut instruction_data, 81 , 2 , 3 ) ;
171
- validator:: aggregate_price (
172
- 3 ,
173
- 103 ,
174
- price_account. key ,
175
- & mut * price_account. data . borrow_mut ( ) ,
176
- )
177
- . unwrap ( ) ;
159
+ validator:: aggregate_price ( 3 , 103 , price_account. key , * price_account. data . borrow_mut ( ) )
160
+ . unwrap ( ) ;
178
161
update_clock_slot ( & mut clock_account, 4 ) ;
179
162
assert ! ( process_instruction(
180
163
& program_id,
@@ -201,13 +184,8 @@ fn test_upd_price_with_validator() {
201
184
202
185
// next price doesn't change and neither does aggregate but slot does
203
186
populate_instruction ( & mut instruction_data, 81 , 2 , 4 ) ;
204
- validator:: aggregate_price (
205
- 4 ,
206
- 104 ,
207
- price_account. key ,
208
- & mut * price_account. data . borrow_mut ( ) ,
209
- )
210
- . unwrap ( ) ;
187
+ validator:: aggregate_price ( 4 , 104 , price_account. key , * price_account. data . borrow_mut ( ) )
188
+ . unwrap ( ) ;
211
189
update_clock_slot ( & mut clock_account, 5 ) ;
212
190
213
191
assert ! ( process_instruction(
@@ -263,13 +241,8 @@ fn test_upd_price_with_validator() {
263
241
}
264
242
265
243
populate_instruction ( & mut instruction_data, 50 , 20 , 5 ) ;
266
- validator:: aggregate_price (
267
- 5 ,
268
- 105 ,
269
- price_account. key ,
270
- & mut * price_account. data . borrow_mut ( ) ,
271
- )
272
- . unwrap ( ) ;
244
+ validator:: aggregate_price ( 5 , 105 , price_account. key , * price_account. data . borrow_mut ( ) )
245
+ . unwrap ( ) ;
273
246
update_clock_slot ( & mut clock_account, 6 ) ;
274
247
275
248
// Publishing a wide CI results in a status of unknown.
@@ -306,13 +279,8 @@ fn test_upd_price_with_validator() {
306
279
// Crank one more time and aggregate should be unknown
307
280
populate_instruction ( & mut instruction_data, 50 , 20 , 6 ) ;
308
281
309
- validator:: aggregate_price (
310
- 6 ,
311
- 106 ,
312
- price_account. key ,
313
- & mut * price_account. data . borrow_mut ( ) ,
314
- )
315
- . unwrap ( ) ;
282
+ validator:: aggregate_price ( 6 , 106 , price_account. key , * price_account. data . borrow_mut ( ) )
283
+ . unwrap ( ) ;
316
284
update_clock_slot ( & mut clock_account, 7 ) ;
317
285
318
286
@@ -341,13 +309,8 @@ fn test_upd_price_with_validator() {
341
309
342
310
// Negative prices are accepted
343
311
populate_instruction ( & mut instruction_data, -100 , 1 , 7 ) ;
344
- validator:: aggregate_price (
345
- 7 ,
346
- 107 ,
347
- price_account. key ,
348
- & mut * price_account. data . borrow_mut ( ) ,
349
- )
350
- . unwrap ( ) ;
312
+ validator:: aggregate_price ( 7 , 107 , price_account. key , * price_account. data . borrow_mut ( ) )
313
+ . unwrap ( ) ;
351
314
update_clock_slot ( & mut clock_account, 8 ) ;
352
315
353
316
@@ -376,13 +339,8 @@ fn test_upd_price_with_validator() {
376
339
377
340
// Crank again for aggregate
378
341
populate_instruction ( & mut instruction_data, -100 , 1 , 8 ) ;
379
- validator:: aggregate_price (
380
- 8 ,
381
- 108 ,
382
- price_account. key ,
383
- & mut * price_account. data . borrow_mut ( ) ,
384
- )
385
- . unwrap ( ) ;
342
+ validator:: aggregate_price ( 8 , 108 , price_account. key , * price_account. data . borrow_mut ( ) )
343
+ . unwrap ( ) ;
386
344
update_clock_slot ( & mut clock_account, 9 ) ;
387
345
388
346
0 commit comments