@@ -186,10 +186,8 @@ pub async fn test_place_initial_offer_shim_and_improve_offer_shimless() {
186
186
/// Test that place initial offer and create fast market order can be done in one transaction
187
187
#[ tokio:: test]
188
188
pub async fn test_place_initial_offer_and_create_fast_market_order_in_one_transaction ( ) {
189
- let config = Box :: new ( CombinedInstructionConfig :: create_fast_market_order_and_place_initial_offer ( ) ) ;
190
- let vaa_args =
191
- vec ! [ VaaArgs {
192
- post_vaa: false ,
189
+ let vaa_args = vec ! [ VaaArgs {
190
+ post_vaa: false ,
193
191
..VaaArgs :: default ( )
194
192
} ] ;
195
193
let ( testing_context, mut test_context) = setup_environment (
@@ -205,9 +203,23 @@ pub async fn test_place_initial_offer_and_create_fast_market_order_in_one_transa
205
203
CreateCctpRouterEndpointsInstructionConfig :: default ( ) ,
206
204
) ,
207
205
] ;
208
- let initial_state = testing_engine. execute ( & mut test_context, initialize_instruction_triggers, None ) . await ;
209
- let instruction_triggers = vec ! [ CombinationTrigger :: CreateFastMarketOrderAndPlaceInitialOffer ( config) ] ;
210
- testing_engine. execute ( & mut test_context, instruction_triggers, Some ( initial_state) ) . await ;
206
+ let initial_state = testing_engine
207
+ . execute ( & mut test_context, initialize_instruction_triggers, None )
208
+ . await ;
209
+ let config = Box :: new (
210
+ CombinedInstructionConfig :: create_fast_market_order_and_place_initial_offer (
211
+ & testing_engine. testing_context . testing_actors ,
212
+ & initial_state,
213
+ & testing_engine
214
+ . testing_context
215
+ . get_matching_engine_program_id ( ) ,
216
+ ) ,
217
+ ) ;
218
+ let instruction_triggers =
219
+ vec ! [ CombinationTrigger :: CreateFastMarketOrderAndPlaceInitialOffer ( config) ] ;
220
+ testing_engine
221
+ . execute ( & mut test_context, instruction_triggers, Some ( initial_state) )
222
+ . await ;
211
223
}
212
224
/*
213
225
Sad path tests section
@@ -267,7 +279,7 @@ pub async fn test_place_initial_offer_shimless_blocks_shim() {
267
279
InstructionTrigger :: PlaceInitialOfferShim ( PlaceInitialOfferInstructionConfig {
268
280
actor: TestingActorEnum :: Solver ( 1 ) ,
269
281
expected_error: Some ( ExpectedError {
270
- instruction_index: 0 ,
282
+ instruction_index: 2 ,
271
283
error_code: 0 ,
272
284
error_string: TransactionError :: AccountInUse . to_string( ) ,
273
285
} ) ,
@@ -326,7 +338,7 @@ pub async fn test_place_initial_offer_shim_blocks_shimless() {
326
338
#[ tokio:: test]
327
339
pub async fn test_place_initial_offer_shim_fails_usdt_token_account ( ) {
328
340
let expected_error = ExpectedError {
329
- instruction_index : 0 ,
341
+ instruction_index : 2 ,
330
342
error_code : 3 , // Token spl transfer error code when mint does not match
331
343
error_string : "Invalid argument" . to_string ( ) ,
332
344
} ;
@@ -346,7 +358,7 @@ pub async fn test_place_initial_shim_offer_fails_usdt_mint_address() {
346
358
..PlaceInitialOfferCustomAccounts :: default ( )
347
359
} ;
348
360
let expected_error = ExpectedError {
349
- instruction_index : 0 ,
361
+ instruction_index : 2 ,
350
362
error_code : u32:: from ( MatchingEngineError :: InvalidMint ) , // Token spl transfer error code when mint does not match
351
363
error_string : "Invalid mint" . to_string ( ) ,
352
364
} ;
@@ -390,7 +402,7 @@ pub async fn test_place_initial_offer_fails_if_fast_market_order_not_created() {
390
402
InstructionTrigger :: PlaceInitialOfferShim ( PlaceInitialOfferInstructionConfig {
391
403
fast_market_order_address: OverwriteCurrentState :: Some ( fake_fast_market_order_address) ,
392
404
expected_error: Some ( ExpectedError {
393
- instruction_index: 0 ,
405
+ instruction_index: 2 ,
394
406
error_code: u32 :: from( ErrorCode :: ConstraintOwner ) ,
395
407
error_string: "Fast market order account owner is invalid" . to_string( ) ,
396
408
} ) ,
@@ -421,7 +433,7 @@ pub async fn test_place_initial_offer_shim_fails_when_offer_greater_than_max_fee
421
433
. create_vaa_args_and_initial_offer_config ( ) ;
422
434
423
435
let expected_error = ExpectedError {
424
- instruction_index : 0 ,
436
+ instruction_index : 2 ,
425
437
error_code : u32:: from ( MatchingEngineError :: OfferPriceTooHigh ) ,
426
438
error_string : "Offer price is greater than max fee" . to_string ( ) ,
427
439
} ;
@@ -451,7 +463,7 @@ pub async fn test_place_initial_offer_shim_fails_when_amount_in_is_u64_max() {
451
463
. create_vaa_args_and_initial_offer_config ( ) ;
452
464
453
465
let expected_error = ExpectedError {
454
- instruction_index : 0 ,
466
+ instruction_index : 2 ,
455
467
error_code : u32:: from ( MatchingEngineError :: U64Overflow ) ,
456
468
error_string : "U64Overflow" . to_string ( ) ,
457
469
} ;
@@ -481,7 +493,7 @@ pub async fn test_place_initial_offer_shim_fails_when_max_fee_and_amount_in_sum_
481
493
. create_vaa_args_and_initial_offer_config ( ) ;
482
494
483
495
let expected_error = ExpectedError {
484
- instruction_index : 0 ,
496
+ instruction_index : 2 ,
485
497
error_code : u32:: from ( MatchingEngineError :: U64Overflow ) ,
486
498
error_string : "U64Overflow" . to_string ( ) ,
487
499
} ;
@@ -528,7 +540,7 @@ pub async fn test_place_initial_offer_shim_fails_when_vaa_is_expired() {
528
540
529
541
let place_initial_offer_config = PlaceInitialOfferInstructionConfig {
530
542
expected_error : Some ( ExpectedError {
531
- instruction_index : 0 ,
543
+ instruction_index : 2 ,
532
544
error_code : u32:: from ( MatchingEngineError :: FastMarketOrderExpired ) ,
533
545
error_string : "Fast market order has expired" . to_string ( ) ,
534
546
} ) ,
@@ -588,7 +600,7 @@ pub async fn test_place_initial_offer_shim_fails_custodian_is_paused() {
588
600
589
601
let place_initial_offer_config = PlaceInitialOfferInstructionConfig {
590
602
expected_error : Some ( ExpectedError {
591
- instruction_index : 0 ,
603
+ instruction_index : 2 ,
592
604
error_code : u32:: from ( MatchingEngineError :: Paused ) ,
593
605
error_string : "Fast market order account owner is invalid" . to_string ( ) ,
594
606
} ) ,
@@ -614,7 +626,7 @@ pub async fn test_place_initial_offer_shim_fails_back_to_back() {
614
626
. await ;
615
627
616
628
let expected_error = ExpectedError {
617
- instruction_index : 0 ,
629
+ instruction_index : 2 ,
618
630
error_code : 0 ,
619
631
error_string : "Already in use" . to_string ( ) ,
620
632
} ;
0 commit comments