Skip to content

Commit f02aa83

Browse files
author
Bengt Lofgren
committed
close market refund recipient is pubkey instead of bytes
1 parent bcb8b05 commit f02aa83

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn initialise_fast_market_order_fallback_instruction(
9494
&[
9595
FastMarketOrderState::SEED_PREFIX,
9696
&fast_market_order.digest(),
97-
&fast_market_order.close_account_refund_recipient,
97+
&fast_market_order.close_account_refund_recipient.as_ref(),
9898
],
9999
program_id,
100100
)
@@ -217,7 +217,7 @@ pub fn create_fast_market_order_state_from_vaa_data(
217217
max_fee: order.max_fee,
218218
init_auction_fee: order.init_auction_fee,
219219
redeemer_message: redeemer_message_fixed_length,
220-
close_account_refund_recipient: close_account_refund_recipient.to_bytes(),
220+
close_account_refund_recipient,
221221
vaa_sequence: vaa_data.sequence,
222222
vaa_timestamp: vaa_data.vaa_time,
223223
vaa_nonce: vaa_data.nonce,

solana/modules/matching-engine-testing/tests/testing_engine/engine.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ impl TestingEngine {
497497
&[
498498
FastMarketOrder::SEED_PREFIX,
499499
&fast_market_order.digest(),
500-
&fast_market_order.close_account_refund_recipient,
500+
&fast_market_order.close_account_refund_recipient.as_ref(),
501501
],
502502
&self.testing_context.get_matching_engine_program_id(),
503503
);
@@ -521,10 +521,8 @@ impl TestingEngine {
521521
fast_market_order_address: fast_market_order_account,
522522
fast_market_order_bump,
523523
fast_market_order,
524-
close_account_refund_recipient: Pubkey::try_from_slice(
525-
&fast_market_order.close_account_refund_recipient,
526-
)
527-
.unwrap(),
524+
close_account_refund_recipient: fast_market_order
525+
.close_account_refund_recipient,
528526
},
529527
guardian_set_state: GuardianSetState {
530528
guardian_set_address: guardian_signature_info.guardian_set_pubkey,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,25 @@ pub fn close_fast_market_order(accounts: &[AccountInfo]) -> Result<()> {
6363
let fast_market_order_deserialized = FastMarketOrder::try_read(fast_market_order_data)?;
6464
// Check that the fast_market_order is owned by the close_account_refund_recipient
6565
if fast_market_order_deserialized.close_account_refund_recipient
66-
!= close_account_refund_recipient.key().as_ref()
66+
!= close_account_refund_recipient.key()
6767
{
6868
return Err(MatchingEngineError::MismatchingCloseAccountRefundRecipient.into()).map_err(
6969
|e: Error| {
7070
e.with_pubkeys((
71-
Pubkey::from(fast_market_order_deserialized.close_account_refund_recipient),
71+
fast_market_order_deserialized.close_account_refund_recipient,
7272
close_account_refund_recipient.key(),
7373
))
7474
},
7575
);
7676
}
7777

7878
if fast_market_order_deserialized.close_account_refund_recipient
79-
!= close_account_refund_recipient.key().as_ref()
79+
!= close_account_refund_recipient.key()
8080
{
8181
return Err(MatchingEngineError::MismatchingCloseAccountRefundRecipient.into()).map_err(
8282
|e: Error| {
8383
e.with_pubkeys((
84-
Pubkey::from(fast_market_order_deserialized.close_account_refund_recipient),
84+
fast_market_order_deserialized.close_account_refund_recipient,
8585
close_account_refund_recipient.key(),
8686
))
8787
},

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ pub fn create_account_reliably(
144144
/// * `data_len` - The length of the data to be written to the token account.
145145
/// * `accounts` - The accounts to be used in the CPI.
146146
/// * `signer_seeds` - The signer seeds to be used in the CPI.
147+
//TODO: Fix clippy warning
147148
#[allow(clippy::too_many_arguments)]
148149
pub fn create_token_account_reliably(
149150
payer_pubkey: &Pubkey,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ mod tests {
523523
max_fee: 0,
524524
init_auction_fee: 0,
525525
redeemer_message: [0_u8; 512],
526-
close_account_refund_recipient: [0_u8; 32],
526+
close_account_refund_recipient: Pubkey::default(),
527527
vaa_sequence: 0,
528528
vaa_timestamp: 0,
529529
vaa_nonce: 0,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct FastMarketOrder {
3131
/// The redeemer message of the fast transfer
3232
pub redeemer_message: [u8; 512],
3333
/// The refund recipient for the creator of the fast market order account
34-
pub close_account_refund_recipient: [u8; 32],
34+
pub close_account_refund_recipient: Pubkey,
3535
/// The emitter address of the fast transfer
3636
pub vaa_emitter_address: [u8; 32],
3737
/// The sequence of the fast transfer vaa
@@ -60,7 +60,7 @@ pub struct FastMarketOrderParams {
6060
pub max_fee: u64,
6161
pub init_auction_fee: u64,
6262
pub redeemer_message: [u8; 512],
63-
pub close_account_refund_recipient: [u8; 32],
63+
pub close_account_refund_recipient: Pubkey,
6464
pub vaa_sequence: u64,
6565
pub vaa_timestamp: u32,
6666
pub vaa_nonce: u32,

0 commit comments

Comments
 (0)