Skip to content

Commit 4fd8ed2

Browse files
author
Bengt Lofgren
committed
improvements from the call
1 parent e172c85 commit 4fd8ed2

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,6 @@ pub fn close_fast_market_order(accounts: &[AccountInfo]) -> Result<()> {
7575
);
7676
}
7777

78-
if fast_market_order_deserialized.close_account_refund_recipient
79-
!= close_account_refund_recipient.key()
80-
{
81-
return Err(MatchingEngineError::MismatchingCloseAccountRefundRecipient.into()).map_err(
82-
|e: Error| {
83-
e.with_pubkeys((
84-
fast_market_order_deserialized.close_account_refund_recipient,
85-
close_account_refund_recipient.key(),
86-
))
87-
},
88-
);
89-
}
90-
9178
// First, get the current lamports value
9279
let current_recipient_lamports = **close_account_refund_recipient.lamports.borrow();
9380

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ pub fn handle_execute_order_shim(accounts: &[AccountInfo]) -> Result<()> {
471471
.saturating_add(active_auction_info.security_deposit)
472472
.saturating_sub(user_reward);
473473

474-
msg!("Security deposit: {}", active_auction_info.security_deposit);
475474

476475
let penalized = penalty > 0;
477476

@@ -493,7 +492,6 @@ pub fn handle_execute_order_shim(accounts: &[AccountInfo]) -> Result<()> {
493492
if utils::checked_deserialize_token_account(initial_offer_token_account, &common::USDC_MINT)
494493
.is_some()
495494
{
496-
msg!("Initial offer token account exists");
497495
if active_auction_best_offer_token_account.key() != initial_offer_token_account.key() {
498496
// Pay the auction initiator their fee.
499497
let transfer_ix = spl_token::instruction::transfer(
@@ -505,10 +503,7 @@ pub fn handle_execute_order_shim(accounts: &[AccountInfo]) -> Result<()> {
505503
init_auction_fee,
506504
)
507505
.unwrap();
508-
msg!(
509-
"Sending init auction fee {} to initial offer token account",
510-
init_auction_fee
511-
);
506+
512507
invoke_signed_unchecked(&transfer_ix, accounts, &[auction_signer_seeds])?;
513508
// Because the initial offer token was paid this fee, we account for it here.
514509
remaining_custodied_amount =
@@ -518,7 +513,6 @@ pub fn handle_execute_order_shim(accounts: &[AccountInfo]) -> Result<()> {
518513
deposit_and_fee = deposit_and_fee
519514
.checked_add(init_auction_fee)
520515
.ok_or_else(|| MatchingEngineError::U64Overflow)?;
521-
msg!("New deposit and fee: {}", deposit_and_fee);
522516
}
523517
}
524518

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,12 @@ pub fn place_initial_offer_cctp_shim(
318318
return Err(MatchingEngineError::InvalidSourceRouter.into());
319319
}
320320

321+
// Check that the vaa emitter chain is equal to the from_endpoints chain
322+
if from_endpoint_account.chain != fast_market_order_zero_copy.vaa_emitter_chain {
323+
msg!("Vaa emitter chain is not equal to the from_endpoints chain");
324+
return Err(MatchingEngineError::InvalidSourceRouter.into());
325+
}
326+
321327
// Check that to endpoint chain is equal to the fast_market_order target_chain
322328
if to_endpoint_account.chain != fast_market_order_zero_copy.target_chain {
323329
msg!("To endpoint chain is not equal to the fast_market_order target_chain");

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,14 @@ pub fn prepare_order_response_cctp_shim(
295295
MatchingEngineError::InvalidTargetRouter
296296
);
297297

298+
// Check that the prepared order response pda is equal to the prepared order response account key
298299
require_eq!(
299300
prepared_order_response_pda,
300301
prepared_order_response.key(),
301302
MatchingEngineError::InvalidPda
302303
);
303304

305+
// Check that the prepared custody token pda is equal to the prepared custody token account key
304306
require_eq!(
305307
prepared_custody_token_pda,
306308
prepared_custody_token.key(),

solana/programs/matching-engine/src/state/fast_market_order.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub struct FastMarketOrder {
2929
/// The initial auction fee of the fast transfer
3030
pub init_auction_fee: u64,
3131
/// The redeemer message of the fast transfer
32+
/// NOTE: This value is based on the max redeemer length of 500 bytes that is specified in the token router program. If this changes in the future, this value must be updated.
3233
pub redeemer_message: [u8; 512],
3334
/// The refund recipient for the creator of the fast market order account
3435
pub close_account_refund_recipient: Pubkey,
@@ -38,7 +39,8 @@ pub struct FastMarketOrder {
3839
pub vaa_sequence: u64,
3940
/// The timestamp of the fast transfer vaa
4041
pub vaa_timestamp: u32,
41-
/// The vaa nonce, which is not used and can be set to 0
42+
/// The vaa nonce, which is not used and can be set to 0.
43+
// TODO: Can be taken out.
4244
pub vaa_nonce: u32,
4345
/// The source chain of the fast transfer vaa (represented as a wormhole chain id)
4446
pub vaa_emitter_chain: u16,

0 commit comments

Comments
 (0)