1
+ use crate :: testing_engine:: config:: ExpectedLog ;
1
2
use crate :: testing_engine:: state:: TestingEngineState ;
2
3
use crate :: utils;
3
4
use crate :: utils:: cctp_message:: UsedNonces ;
@@ -27,6 +28,8 @@ pub struct PrepareOrderResponseFixture {
27
28
pub prepared_order_response : Pubkey ,
28
29
pub prepared_custody_token : Pubkey ,
29
30
}
31
+
32
+ #[ allow( clippy:: too_many_arguments) ]
30
33
pub async fn prepare_order_response (
31
34
testing_context : & TestingContext ,
32
35
payer_signer : & Rc < Keypair > ,
@@ -35,7 +38,7 @@ pub async fn prepare_order_response(
35
38
from_endpoint_address : & Pubkey ,
36
39
base_fee_token_address : & Pubkey ,
37
40
expected_error : Option < & ExpectedError > ,
38
- expected_log_message : Option < & String > ,
41
+ expected_log_message : Option < & Vec < ExpectedLog > > ,
39
42
) -> Option < PrepareOrderResponseFixture > {
40
43
let test_ctx = & testing_context. test_context ;
41
44
let matching_engine_program_id = & testing_context. get_matching_engine_program_id ( ) ;
@@ -49,7 +52,7 @@ pub async fn prepare_order_response(
49
52
let source_remote_token_messenger = match testing_context. testing_state . transfer_direction {
50
53
TransferDirection :: FromEthereumToArbitrum => {
51
54
utils:: router:: get_remote_token_messenger (
52
- test_ctx ,
55
+ testing_context ,
53
56
fixture_accounts. ethereum_remote_token_messenger ,
54
57
)
55
58
. await
@@ -95,10 +98,10 @@ pub async fn prepare_order_response(
95
98
fast_vaa : fast_transfer_liquidity_layer_vaa,
96
99
path : LiveRouterPath {
97
100
to_endpoint : LiveRouterEndpoint {
98
- endpoint : to_endpoint_address. clone ( ) ,
101
+ endpoint : * to_endpoint_address,
99
102
} ,
100
103
from_endpoint : LiveRouterEndpoint {
101
- endpoint : from_endpoint_address. clone ( ) ,
104
+ endpoint : * from_endpoint_address,
102
105
} ,
103
106
} ,
104
107
} ;
@@ -120,7 +123,7 @@ pub async fn prepare_order_response(
120
123
Pubkey :: find_program_address ( & prepared_custody_token_seeds, matching_engine_program_id) ;
121
124
122
125
let usdc = Usdc {
123
- mint : usdc_mint_address. clone ( ) ,
126
+ mint : * usdc_mint_address,
124
127
} ;
125
128
let ( used_nonces_pda, _used_nonces_bump) =
126
129
UsedNonces :: address ( source_remote_token_messenger. domain , cctp_nonce) ;
@@ -136,7 +139,7 @@ pub async fn prepare_order_response(
136
139
Pubkey :: find_program_address ( & [ EVENT_AUTHORITY_SEED ] , & TOKEN_MESSENGER_MINTER_PROGRAM_ID ) . 0 ;
137
140
138
141
let cctp_mint_recipient = CctpMintRecipientMut {
139
- mint_recipient : cctp_mint_recipient. clone ( ) ,
142
+ mint_recipient : * cctp_mint_recipient,
140
143
} ;
141
144
let cctp_message_transmitter_event_authority =
142
145
Pubkey :: find_program_address ( & [ EVENT_AUTHORITY_SEED ] , & MESSAGE_TRANSMITTER_PROGRAM_ID ) . 0 ;
@@ -151,30 +154,30 @@ pub async fn prepare_order_response(
151
154
} ;
152
155
let cctp = CctpReceiveMessage {
153
156
mint_recipient : cctp_mint_recipient,
154
- message_transmitter_authority : cctp_message_transmitter_authority. clone ( ) ,
155
- message_transmitter_config : message_transmitter_config_pubkey. clone ( ) ,
157
+ message_transmitter_authority : cctp_message_transmitter_authority,
158
+ message_transmitter_config : message_transmitter_config_pubkey,
156
159
used_nonces : used_nonces_pda,
157
160
message_transmitter_event_authority : cctp_message_transmitter_event_authority,
158
- token_messenger : fixture_accounts. token_messenger . clone ( ) ,
161
+ token_messenger : fixture_accounts. token_messenger ,
159
162
remote_token_messenger : cctp_remote_token_messenger,
160
- token_minter : fixture_accounts. token_minter . clone ( ) ,
161
- local_token : fixture_accounts. usdc_local_token . clone ( ) ,
162
- token_pair : fixture_accounts. usdc_token_pair . clone ( ) ,
163
- token_messenger_minter_custody_token : fixture_accounts. usdc_custody_token . clone ( ) ,
164
- token_messenger_minter_event_authority : token_messenger_minter_event_authority ,
163
+ token_minter : fixture_accounts. token_minter ,
164
+ local_token : fixture_accounts. usdc_local_token ,
165
+ token_pair : fixture_accounts. usdc_token_pair ,
166
+ token_messenger_minter_custody_token : fixture_accounts. usdc_custody_token ,
167
+ token_messenger_minter_event_authority,
165
168
token_messenger_minter_program : TOKEN_MESSENGER_MINTER_PROGRAM_ID ,
166
169
message_transmitter_program : MESSAGE_TRANSMITTER_PROGRAM_ID ,
167
170
} ;
168
171
let prepared_order_response_accounts = PrepareOrderResponseCctpAccounts {
169
172
payer : payer_signer. pubkey ( ) ,
170
173
custodian : checked_custodian,
171
- fast_order_path : fast_order_path ,
172
- finalized_vaa : finalized_vaa ,
174
+ fast_order_path,
175
+ finalized_vaa,
173
176
prepared_order_response : prepared_order_response_pda,
174
177
prepared_custody_token : prepared_custody_token_pda,
175
178
base_fee_token : * base_fee_token_address,
176
- usdc : usdc ,
177
- cctp : cctp ,
179
+ usdc,
180
+ cctp,
178
181
token_program : spl_token:: ID ,
179
182
system_program : system_program:: ID ,
180
183
} ;
@@ -188,7 +191,7 @@ pub async fn prepare_order_response(
188
191
. data ( ) ;
189
192
190
193
let instruction = Instruction {
191
- program_id : matching_engine_program_id. clone ( ) ,
194
+ program_id : * matching_engine_program_id,
192
195
accounts : prepared_order_response_accounts. to_account_metas ( None ) ,
193
196
data : prepare_order_response_ix_data,
194
197
} ;
@@ -209,8 +212,9 @@ pub async fn prepare_order_response(
209
212
"Expected error is not allowed when expected log message is provided"
210
213
) ;
211
214
testing_context
212
- . execute_and_verify_logs ( transaction, expected_log_message)
213
- . await ;
215
+ . simulate_and_verify_logs ( transaction, expected_log_message)
216
+ . await
217
+ . unwrap ( ) ;
214
218
} else {
215
219
testing_context
216
220
. execute_and_verify_transaction ( transaction, expected_error)
0 commit comments