Skip to content

Commit 45d2880

Browse files
author
Bengt Lofgren
committed
rebase mistake amended and renamed accounts on new instruction to match comments
1 parent 18fa9ff commit 45d2880

File tree

3 files changed

+25
-124
lines changed

3 files changed

+25
-124
lines changed

solana/modules/matching-engine-testing/tests/shimful/shims_execute_order.rs

Lines changed: 12 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -286,116 +286,17 @@ pub fn create_cctp_accounts(
286286
)
287287
.0;
288288
let token_messenger_minter_event_authority =
289-
&Pubkey::find_program_address(&[EVENT_AUTHORITY_SEED], &TOKEN_MESSENGER_MINTER_PROGRAM_ID)
290-
.0;
291-
let post_message_sequence = wormhole_svm_definitions::find_emitter_sequence_address(
292-
&execute_order_fallback_accounts.custodian,
293-
&CORE_BRIDGE_PROGRAM_ID,
294-
)
295-
.0;
296-
let post_message_message = wormhole_svm_definitions::find_shim_message_address(
297-
&execute_order_fallback_accounts.custodian,
298-
&POST_MESSAGE_SHIM_PROGRAM_ID,
299-
)
300-
.0;
301-
let solver = config.actor_enum.get_actor(&testing_context.testing_actors);
302-
let executor_token = solver.token_account_address(&config.token_enum).unwrap();
303-
ExecuteOrderFallbackFixture {
304-
cctp_message,
305-
post_message_sequence,
306-
post_message_message,
307-
accounts: ExecuteOrderFallbackFixtureAccounts {
308-
local_token,
309-
token_messenger,
310-
remote_token_messenger,
311-
token_messenger_minter_sender_authority,
312-
token_messenger_minter_event_authority: *token_messenger_minter_event_authority,
313-
messenger_transmitter_config,
314-
token_minter,
315-
executor_token,
316-
},
317-
}
318-
}
319-
320-
pub fn create_execute_order_shim_accounts<'ix>(
321-
execute_order_fallback_accounts: &'ix ExecuteOrderFallbackAccounts,
322-
execute_order_fallback_fixture: &'ix ExecuteOrderFallbackFixture,
323-
clock_id: &'ix Pubkey,
324-
) -> ExecuteOrderShimAccounts<'ix> {
325-
ExecuteOrderShimAccounts {
326-
signer: &execute_order_fallback_accounts.signer, // 0
327-
cctp_message: &execute_order_fallback_fixture.cctp_message, // 1
328-
custodian: &execute_order_fallback_accounts.custodian, // 2
329-
fast_market_order: &execute_order_fallback_accounts.fast_market_order_address, // 3
330-
active_auction: &execute_order_fallback_accounts.active_auction, // 4
331-
active_auction_custody_token: &execute_order_fallback_accounts.active_auction_custody_token, // 5
332-
active_auction_config: &execute_order_fallback_accounts.active_auction_config, // 6
333-
active_auction_best_offer_token: &execute_order_fallback_accounts
334-
.active_auction_best_offer_token, // 7
335-
executor_token: &execute_order_fallback_fixture.accounts.executor_token, // 8
336-
initial_offer_token: &execute_order_fallback_accounts.initial_offer_token, // 9
337-
initial_participant: &execute_order_fallback_accounts.initial_participant, // 10
338-
to_router_endpoint: &execute_order_fallback_accounts.to_router_endpoint, // 11
339-
post_message_shim_program: &POST_MESSAGE_SHIM_PROGRAM_ID, // 12
340-
core_bridge_emitter_sequence: &execute_order_fallback_fixture.post_message_sequence, // 13
341-
post_shim_message: &execute_order_fallback_fixture.post_message_message, // 14
342-
cctp_deposit_for_burn_mint: &USDC_MINT, // 15
343-
cctp_deposit_for_burn_token_messenger_minter_sender_authority:
344-
&execute_order_fallback_fixture
345-
.accounts
346-
.token_messenger_minter_sender_authority, // 16
347-
cctp_deposit_for_burn_message_transmitter_config: &execute_order_fallback_fixture
348-
.accounts
349-
.messenger_transmitter_config, // 17
350-
cctp_deposit_for_burn_token_messenger: &execute_order_fallback_fixture
351-
.accounts
352-
.token_messenger, // 18
353-
cctp_deposit_for_burn_remote_token_messenger: &execute_order_fallback_fixture
354-
.accounts
355-
.remote_token_messenger, // 19
356-
cctp_deposit_for_burn_token_minter: &execute_order_fallback_fixture.accounts.token_minter, // 20
357-
cctp_deposit_for_burn_local_token: &execute_order_fallback_fixture.accounts.local_token, // 21
358-
cctp_deposit_for_burn_token_messenger_minter_event_authority:
359-
&execute_order_fallback_fixture
360-
.accounts
361-
.token_messenger_minter_event_authority, // 22
362-
cctp_deposit_for_burn_token_messenger_minter_program: &TOKEN_MESSENGER_MINTER_PROGRAM_ID, // 23
363-
cctp_deposit_for_burn_message_transmitter_program: &MESSAGE_TRANSMITTER_PROGRAM_ID, // 24
364-
core_bridge_program: &CORE_BRIDGE_PROGRAM_ID, // 25
365-
core_bridge_config: &CORE_BRIDGE_CONFIG, // 26
366-
core_bridge_fee_collector: &CORE_BRIDGE_FEE_COLLECTOR, // 27
367-
post_message_shim_event_authority: &POST_MESSAGE_SHIM_EVENT_AUTHORITY, // 28
368-
system_program: &solana_program::system_program::ID, // 29
369-
token_program: &spl_token::ID, // 30
370-
clock: clock_id, // 31
289+
Pubkey::find_program_address(&[EVENT_AUTHORITY_SEED], &TOKEN_MESSENGER_MINTER_PROGRAM_ID).0;
290+
CctpAccounts {
291+
mint: utils::constants::USDC_MINT,
292+
token_messenger,
293+
token_messenger_minter_sender_authority,
294+
token_messenger_minter_event_authority,
295+
message_transmitter_config,
296+
token_minter,
297+
local_token,
298+
remote_token_messenger,
299+
token_messenger_minter_program: TOKEN_MESSENGER_MINTER_PROGRAM_ID,
300+
message_transmitter_program: MESSAGE_TRANSMITTER_PROGRAM_ID,
371301
}
372302
}
373-
374-
pub async fn execute_order_shimful_test(
375-
testing_context: &TestingContext,
376-
test_context: &mut ProgramTestContext,
377-
current_state: &TestingEngineState,
378-
config: &ExecuteOrderInstructionConfig,
379-
) -> Option<ExecuteOrderFallbackFixture> {
380-
let expected_error = config.expected_error();
381-
let fixture_accounts = testing_context
382-
.get_fixture_accounts()
383-
.expect("Pre-made fixture accounts not found");
384-
let payer_signer = config
385-
.payer_signer
386-
.clone()
387-
.unwrap_or_else(|| testing_context.testing_actors.payer_signer.clone());
388-
let execute_order_fallback_accounts = ExecuteOrderFallbackAccounts::new(
389-
current_state,
390-
&payer_signer.pubkey(),
391-
&fixture_accounts,
392-
config.fast_market_order_address,
393-
);
394-
execute_order_shimful(
395-
testing_context,
396-
test_context,
397-
current_state,
398-
config,
399-
)
400-
.await
401-
}

solana/modules/matching-engine-testing/tests/shimful/shims_settle_auction_none.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl SettleAuctionNoneCctpShimAccountsOwned {
119119
SettleAuctionNoneCctpShimAccounts {
120120
payer: &self.payer,
121121
post_shim_message: &self.post_message_message,
122-
post_message_sequence: &self.post_message_sequence,
122+
core_bridge_emitter_sequence: &self.post_message_sequence,
123123
post_message_shim_event_authority: &self.post_message_shim_event_authority,
124124
post_message_shim_program: &self.post_message_shim_program,
125125
cctp_message: &self.cctp_message,

solana/programs/matching-engine/src/fallback/processor/settle_auction_none_cctp.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212

1313
use super::{
1414
burn_and_post::{burn_and_post, PostMessageAccounts, PostMessageDerivedAccounts},
15-
helpers::{check_account_length, create_account_reliably},
15+
helpers::{require_min_account_infos_len, create_account_reliably},
1616
};
1717

1818
#[derive(Copy, Clone)]
@@ -39,10 +39,10 @@ impl SettleAuctionNoneCctpShimData {
3939
pub struct SettleAuctionNoneCctpShimAccounts<'ix> {
4040
/// Payer of the account
4141
pub payer: &'ix Pubkey, // 0
42-
/// Post message message account
43-
pub post_message_message: &'ix Pubkey, // 1
44-
/// Post message sequence account
45-
pub post_message_sequence: &'ix Pubkey, // 2
42+
/// Post shim message account
43+
pub post_shim_message: &'ix Pubkey, // 1
44+
/// Core bridge emitter sequence account
45+
pub core_bridge_emitter_sequence: &'ix Pubkey, // 2
4646
/// Post message shim event authority CHECK: Mutable. Seeds must be \["core-msg", payer, payer_sequence.value\].
4747
pub post_message_shim_event_authority: &'ix Pubkey, // 3
4848
/// Post message shim program
@@ -101,8 +101,8 @@ impl<'ix> SettleAuctionNoneCctpShimAccounts<'ix> {
101101
pub fn to_account_metas(&self) -> Vec<AccountMeta> {
102102
vec![
103103
AccountMeta::new_readonly(*self.payer, true), // 0
104-
AccountMeta::new(*self.post_message_message, false), // 1
105-
AccountMeta::new(*self.post_message_sequence, false), // 2
104+
AccountMeta::new(*self.post_shim_message, false), // 1
105+
AccountMeta::new(*self.core_bridge_emitter_sequence, false), // 2
106106
AccountMeta::new_readonly(*self.post_message_shim_event_authority, false), // 3
107107
AccountMeta::new_readonly(*self.post_message_shim_program, false), // 4
108108
AccountMeta::new(*self.cctp_message, false), // 5
@@ -138,10 +138,10 @@ pub fn settle_auction_none_cctp_shim(
138138
data: SettleAuctionNoneCctpShimData,
139139
) -> Result<()> {
140140
let program_id = &crate::ID;
141-
check_account_length(accounts, 29)?;
141+
require_min_account_infos_len(accounts, 29)?;
142142
let payer = &accounts[0];
143-
let post_message_message = &accounts[1];
144-
let post_message_sequence = &accounts[2];
143+
let post_shim_message = &accounts[1];
144+
let core_bridge_emitter_sequence = &accounts[2];
145145
let _post_message_shim_event_authority = &accounts[3];
146146
let _post_message_shim_program = &accounts[4];
147147
let cctp_message = &accounts[5];
@@ -255,8 +255,8 @@ pub fn settle_auction_none_cctp_shim(
255255
emitter: custodian.key(),
256256
payer: payer.key(),
257257
derived: PostMessageDerivedAccounts {
258-
message: post_message_message.key(),
259-
sequence: post_message_sequence.key(),
258+
message: post_shim_message.key(),
259+
sequence: core_bridge_emitter_sequence.key(),
260260
},
261261
};
262262
burn_and_post(

0 commit comments

Comments
 (0)