@@ -281,10 +281,7 @@ fn unstaking() {
281
281
) ;
282
282
283
283
// Advance time until the unbonding period is over
284
- app. update_block ( |block| {
285
- block. height += 1234 ;
286
- block. time = block. time . plus_seconds ( UNBONDING_PERIOD ) ;
287
- } ) ;
284
+ process_staking_unbondings ( & app) ;
288
285
289
286
// Check that the contract now has the funds
290
287
assert_eq ! (
@@ -296,6 +293,7 @@ fn unstaking() {
296
293
) ;
297
294
}
298
295
296
+
299
297
#[ test]
300
298
fn burning ( ) {
301
299
let owner = "vault_admin" ;
@@ -338,11 +336,9 @@ fn burning() {
338
336
coin( 0 , OSMO )
339
337
) ;
340
338
339
+
341
340
// Advance time until the unbonding period is over
342
- app. update_block ( |block| {
343
- block. height += 1234 ;
344
- block. time = block. time . plus_seconds ( UNBONDING_PERIOD ) ;
345
- } ) ;
341
+ process_staking_unbondings ( & app) ;
346
342
347
343
// Check that the contract now has the funds
348
344
assert_eq ! (
@@ -424,10 +420,7 @@ fn burning_multiple_delegations() {
424
420
) ;
425
421
426
422
// Advance time until the unbonding period is over
427
- app. update_block ( |block| {
428
- block. height += 1234 ;
429
- block. time = block. time . plus_seconds ( UNBONDING_PERIOD ) ;
430
- } ) ;
423
+ process_staking_unbondings ( & app) ;
431
424
432
425
// Check that the contract now has the funds
433
426
assert_eq ! (
@@ -482,10 +475,7 @@ fn releasing_unbonded() {
482
475
assert ! ( delegation. is_none( ) ) ;
483
476
484
477
// Advance time until the unbonding period is over
485
- app. update_block ( |block| {
486
- block. height += 12345 ;
487
- block. time = block. time . plus_seconds ( UNBONDING_PERIOD + 1 ) ;
488
- } ) ;
478
+ process_staking_unbondings ( & app) ;
489
479
490
480
// Release the unbonded funds
491
481
staking_proxy. release_unbonded ( ) . call ( user) . unwrap ( ) ;
@@ -551,3 +541,18 @@ fn withdrawing_rewards() {
551
541
. unwrap ( ) ;
552
542
assert_eq ! ( original_vault_funds, vault_funds) ;
553
543
}
544
+
545
+ fn process_staking_unbondings ( app : & App < MtApp > ) {
546
+ // Advance unbonding period
547
+ app. app_mut ( ) . update_block ( |block| {
548
+ block. time = block. time . plus_seconds ( UNBONDING_PERIOD ) ;
549
+ block. height += UNBONDING_PERIOD / 5 ;
550
+ } ) ;
551
+ // This is deprecated as unneeded, but tests fail if it isn't here. What's up???
552
+ app. app_mut ( )
553
+ . sudo ( cw_multi_test:: SudoMsg :: Staking (
554
+ cw_multi_test:: StakingSudo :: ProcessQueue { } ,
555
+ ) )
556
+ . unwrap ( ) ;
557
+ }
558
+
0 commit comments