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