diff --git a/solana/programs/matching-engine/src/composite/mod.rs b/solana/programs/matching-engine/src/composite/mod.rs index 9a62b0f0..1fd6ee79 100644 --- a/solana/programs/matching-engine/src/composite/mod.rs +++ b/solana/programs/matching-engine/src/composite/mod.rs @@ -97,7 +97,7 @@ pub struct CheckedCustodian<'info> { seeds = [Custodian::SEED_PREFIX], bump = Custodian::BUMP, )] - pub custodian: Account<'info, Custodian>, + pub custodian: Box>, } impl<'info> Deref for CheckedCustodian<'info> { @@ -138,7 +138,7 @@ pub struct OwnerOnlyMut<'info> { seeds = [Custodian::SEED_PREFIX], bump = Custodian::BUMP, )] - pub custodian: Account<'info, Custodian>, + pub custodian: Box>, } #[derive(Accounts)] @@ -171,7 +171,7 @@ pub struct AdminMut<'info> { seeds = [Custodian::SEED_PREFIX], bump = Custodian::BUMP, )] - pub custodian: Account<'info, Custodian>, + pub custodian: Box>, } #[derive(Accounts)] @@ -195,7 +195,7 @@ pub struct LocalTokenRouter<'info> { associated_token::mint = common::USDC_MINT, associated_token::authority = token_router_emitter, )] - pub token_router_mint_recipient: Account<'info, token::TokenAccount>, + pub token_router_mint_recipient: Box>, } #[derive(Accounts)] @@ -208,7 +208,7 @@ pub struct ExistingMutRouterEndpoint<'info> { ], bump = endpoint.bump, )] - pub endpoint: Account<'info, RouterEndpoint>, + pub endpoint: Box>, } impl<'info> Deref for ExistingMutRouterEndpoint<'info> { @@ -644,7 +644,7 @@ pub struct ReserveFastFillSequence<'info> { // This check makes sure that the auction account did not exist before this // instruction was called. require!( - auction.vaa_hash == [0; 32], + auction.vaa_hash == <[u8; 32]>::default(), MatchingEngineError::AuctionExists, ); diff --git a/solana/programs/matching-engine/src/events/auction_settled.rs b/solana/programs/matching-engine/src/events/auction_settled.rs index bda0fd33..aa31d359 100644 --- a/solana/programs/matching-engine/src/events/auction_settled.rs +++ b/solana/programs/matching-engine/src/events/auction_settled.rs @@ -11,7 +11,7 @@ pub struct SettledTokenAccountInfo { #[derive(Debug)] pub struct AuctionSettled { /// The pubkey of the auction that was settled. - pub auction: Pubkey, + pub fast_vaa_hash: [u8; 32], /// If there was an active auction, this field will have the pubkey of the best offer token that /// was paid back and its balance after repayment. diff --git a/solana/programs/matching-engine/src/events/auction_updated.rs b/solana/programs/matching-engine/src/events/auction_updated.rs index 6ac2c6a9..3bd13f81 100644 --- a/solana/programs/matching-engine/src/events/auction_updated.rs +++ b/solana/programs/matching-engine/src/events/auction_updated.rs @@ -5,7 +5,7 @@ use anchor_lang::prelude::*; #[derive(Debug)] pub struct AuctionUpdated { pub config_id: u32, - pub auction: Pubkey, + pub fast_vaa_hash: [u8; 32], pub vaa: Option, pub source_chain: u16, pub target_protocol: MessageProtocol, diff --git a/solana/programs/matching-engine/src/events/fast_fill_redeemed.rs b/solana/programs/matching-engine/src/events/fast_fill_redeemed.rs index 02c7057f..123b5b2d 100644 --- a/solana/programs/matching-engine/src/events/fast_fill_redeemed.rs +++ b/solana/programs/matching-engine/src/events/fast_fill_redeemed.rs @@ -1,7 +1,9 @@ use anchor_lang::prelude::*; +use crate::state::FastFillSeeds; + #[event] pub struct FastFillRedeemed { pub prepared_by: Pubkey, - pub fast_fill: Pubkey, + pub fast_fill: FastFillSeeds, } diff --git a/solana/programs/matching-engine/src/events/fast_fill_sequence_reserved.rs b/solana/programs/matching-engine/src/events/fast_fill_sequence_reserved.rs index 41326b9f..bb07a6f2 100644 --- a/solana/programs/matching-engine/src/events/fast_fill_sequence_reserved.rs +++ b/solana/programs/matching-engine/src/events/fast_fill_sequence_reserved.rs @@ -4,5 +4,5 @@ use anchor_lang::prelude::*; #[event] pub struct FastFillSequenceReserved { pub fast_vaa_hash: [u8; 32], - pub fast_fill_seeds: FastFillSeeds, + pub fast_fill: FastFillSeeds, } diff --git a/solana/programs/matching-engine/src/events/order_executed.rs b/solana/programs/matching-engine/src/events/order_executed.rs index a5a7c07c..55edf8a6 100644 --- a/solana/programs/matching-engine/src/events/order_executed.rs +++ b/solana/programs/matching-engine/src/events/order_executed.rs @@ -4,7 +4,7 @@ use anchor_lang::prelude::*; #[event] #[derive(Debug)] pub struct OrderExecuted { - pub auction: Pubkey, + pub fast_vaa_hash: [u8; 32], pub vaa: Pubkey, pub source_chain: u16, pub target_protocol: MessageProtocol, diff --git a/solana/programs/matching-engine/src/processor/auction/execute_fast_order/mod.rs b/solana/programs/matching-engine/src/processor/auction/execute_fast_order/mod.rs index 8399d89c..935596c0 100644 --- a/solana/programs/matching-engine/src/processor/auction/execute_fast_order/mod.rs +++ b/solana/programs/matching-engine/src/processor/auction/execute_fast_order/mod.rs @@ -214,7 +214,7 @@ fn handle_execute_fast_order<'info>( execute_penalty: if penalized { penalty.into() } else { None }, }, OrderExecuted { - auction: auction.key(), + fast_vaa_hash: auction.vaa_hash, vaa: fast_vaa.key(), source_chain: auction_info.source_chain, target_protocol: auction.target_protocol, diff --git a/solana/programs/matching-engine/src/processor/auction/offer/improve.rs b/solana/programs/matching-engine/src/processor/auction/offer/improve.rs index a869fe8e..b99dc4d7 100644 --- a/solana/programs/matching-engine/src/processor/auction/offer/improve.rs +++ b/solana/programs/matching-engine/src/processor/auction/offer/improve.rs @@ -137,7 +137,7 @@ pub fn improve_offer(ctx: Context, offer_price: u64) -> Result<()> // Emit event for auction participants to listen to. emit_cpi!(crate::utils::log_emit(crate::events::AuctionUpdated { config_id: info.config_id, - auction: auction.key(), + fast_vaa_hash: auction.vaa_hash, vaa: Default::default(), source_chain: info.source_chain, target_protocol: auction.target_protocol, diff --git a/solana/programs/matching-engine/src/processor/auction/offer/place_initial/cctp.rs b/solana/programs/matching-engine/src/processor/auction/offer/place_initial/cctp.rs index 9bd02637..fab8c53b 100644 --- a/solana/programs/matching-engine/src/processor/auction/offer/place_initial/cctp.rs +++ b/solana/programs/matching-engine/src/processor/auction/offer/place_initial/cctp.rs @@ -169,7 +169,7 @@ pub fn place_initial_offer_cctp( // Emit event for auction participants to listen to. emit_cpi!(crate::utils::log_emit(crate::events::AuctionUpdated { config_id: info.config_id, - auction: ctx.accounts.auction.key(), + fast_vaa_hash: ctx.accounts.auction.vaa_hash, vaa: ctx.accounts.fast_order_path.fast_vaa.key().into(), source_chain: info.source_chain, target_protocol: ctx.accounts.auction.target_protocol, diff --git a/solana/programs/matching-engine/src/processor/auction/settle/complete.rs b/solana/programs/matching-engine/src/processor/auction/settle/complete.rs index 22e680d6..f9249645 100644 --- a/solana/programs/matching-engine/src/processor/auction/settle/complete.rs +++ b/solana/programs/matching-engine/src/processor/auction/settle/complete.rs @@ -249,7 +249,7 @@ fn handle_settle_auction_complete( }; emit_cpi!(crate::events::AuctionSettled { - auction: ctx.accounts.auction.key(), + fast_vaa_hash: ctx.accounts.auction.vaa_hash, best_offer_token: settled_best_offer_result, base_fee_token: settled_base_fee_result, with_execute: Default::default(), diff --git a/solana/programs/matching-engine/src/processor/auction/settle/none/mod.rs b/solana/programs/matching-engine/src/processor/auction/settle/none/mod.rs index 85acbde8..9c8233cc 100644 --- a/solana/programs/matching-engine/src/processor/auction/settle/none/mod.rs +++ b/solana/programs/matching-engine/src/processor/auction/settle/none/mod.rs @@ -84,7 +84,7 @@ fn settle_none_and_prepare_fill(accounts: SettleNoneAndPrepareFill<'_, '_>) -> R }; let auction_settled_event = AuctionSettled { - auction: auction.key(), + fast_vaa_hash: auction.vaa_hash, best_offer_token: Default::default(), base_fee_token: crate::events::SettledTokenAccountInfo { key: fee_recipient_token.key(), diff --git a/solana/programs/matching-engine/src/processor/fast_fill/complete.rs b/solana/programs/matching-engine/src/processor/fast_fill/complete.rs index e27e14c2..c5afdd08 100644 --- a/solana/programs/matching-engine/src/processor/fast_fill/complete.rs +++ b/solana/programs/matching-engine/src/processor/fast_fill/complete.rs @@ -31,7 +31,7 @@ pub struct CompleteFastFill<'info> { bump = fast_fill.seeds.bump, constraint = !fast_fill.redeemed @ MatchingEngineError::FastFillAlreadyRedeemed, )] - fast_fill: Account<'info, FastFill>, + fast_fill: Box>, /// Only the registered local Token Router program can call this instruction. It is allowed to /// invoke this instruction by using its emitter (i.e. its Custodian account) as a signer. We @@ -43,7 +43,7 @@ pub struct CompleteFastFill<'info> { mut, token::mint = local_custody_token.mint, )] - token_router_custody_token: Account<'info, token::TokenAccount>, + token_router_custody_token: Box>, #[account( constraint = { @@ -84,7 +84,7 @@ pub fn complete_fast_fill(ctx: Context) -> Result<()> { // Emit event that the fast fill is redeemed. Listeners can close this account. emit_cpi!(crate::events::FastFillRedeemed { prepared_by: ctx.accounts.fast_fill.info.prepared_by, - fast_fill: ctx.accounts.fast_fill.key(), + fast_fill: ctx.accounts.fast_fill.seeds, }); // Finally transfer to local token router's token account. diff --git a/solana/programs/matching-engine/src/processor/fast_fill/reserve_sequence/mod.rs b/solana/programs/matching-engine/src/processor/fast_fill/reserve_sequence/mod.rs index 4c214aeb..7cc3a906 100644 --- a/solana/programs/matching-engine/src/processor/fast_fill/reserve_sequence/mod.rs +++ b/solana/programs/matching-engine/src/processor/fast_fill/reserve_sequence/mod.rs @@ -81,6 +81,6 @@ fn set_reserved_sequence_data( // easily execute local orders. Ok(FastFillSequenceReserved { fast_vaa_hash, - fast_fill_seeds, + fast_fill: fast_fill_seeds, }) } diff --git a/solana/ts/src/idl/json/matching_engine.json b/solana/ts/src/idl/json/matching_engine.json index 866b97b0..1900ecb7 100644 --- a/solana/ts/src/idl/json/matching_engine.json +++ b/solana/ts/src/idl/json/matching_engine.json @@ -3535,11 +3535,16 @@ "kind": "struct", "fields": [ { - "name": "auction", + "name": "fast_vaa_hash", "docs": [ "The pubkey of the auction that was settled." ], - "type": "pubkey" + "type": { + "array": [ + "u8", + 32 + ] + } }, { "name": "best_offer_token", @@ -3640,8 +3645,13 @@ "type": "u32" }, { - "name": "auction", - "type": "pubkey" + "name": "fast_vaa_hash", + "type": { + "array": [ + "u8", + 32 + ] + } }, { "name": "vaa", @@ -3911,7 +3921,11 @@ }, { "name": "fast_fill", - "type": "pubkey" + "type": { + "defined": { + "name": "FastFillSeeds" + } + } } ] } @@ -3973,7 +3987,7 @@ } }, { - "name": "fast_fill_seeds", + "name": "fast_fill", "type": { "defined": { "name": "FastFillSeeds" @@ -4115,8 +4129,13 @@ "kind": "struct", "fields": [ { - "name": "auction", - "type": "pubkey" + "name": "fast_vaa_hash", + "type": { + "array": [ + "u8", + 32 + ] + } }, { "name": "vaa", diff --git a/solana/ts/src/idl/ts/matching_engine.ts b/solana/ts/src/idl/ts/matching_engine.ts index 9406379e..7ccf19c6 100644 --- a/solana/ts/src/idl/ts/matching_engine.ts +++ b/solana/ts/src/idl/ts/matching_engine.ts @@ -3541,11 +3541,16 @@ export type MatchingEngine = { "kind": "struct", "fields": [ { - "name": "auction", + "name": "fastVaaHash", "docs": [ "The pubkey of the auction that was settled." ], - "type": "pubkey" + "type": { + "array": [ + "u8", + 32 + ] + } }, { "name": "bestOfferToken", @@ -3646,8 +3651,13 @@ export type MatchingEngine = { "type": "u32" }, { - "name": "auction", - "type": "pubkey" + "name": "fastVaaHash", + "type": { + "array": [ + "u8", + 32 + ] + } }, { "name": "vaa", @@ -3917,7 +3927,11 @@ export type MatchingEngine = { }, { "name": "fastFill", - "type": "pubkey" + "type": { + "defined": { + "name": "fastFillSeeds" + } + } } ] } @@ -3979,7 +3993,7 @@ export type MatchingEngine = { } }, { - "name": "fastFillSeeds", + "name": "fastFill", "type": { "defined": { "name": "fastFillSeeds" @@ -4121,8 +4135,13 @@ export type MatchingEngine = { "kind": "struct", "fields": [ { - "name": "auction", - "type": "pubkey" + "name": "fastVaaHash", + "type": { + "array": [ + "u8", + 32 + ] + } }, { "name": "vaa", diff --git a/solana/ts/src/matchingEngine/index.ts b/solana/ts/src/matchingEngine/index.ts index 7c37d21d..74422e34 100644 --- a/solana/ts/src/matchingEngine/index.ts +++ b/solana/ts/src/matchingEngine/index.ts @@ -147,7 +147,7 @@ export type SettledTokenAccountInfo = { }; export type AuctionSettled = { - auction: PublicKey; + fastVaaHash: Array; bestOfferToken: SettledTokenAccountInfo | null; baseFeeToken: SettledTokenAccountInfo | null; withExecute: MessageProtocol | null; @@ -155,7 +155,7 @@ export type AuctionSettled = { export type AuctionUpdated = { configId: number; - auction: PublicKey; + fastVaaHash: Array; vaa: PublicKey | null; sourceChain: number; targetProtocol: MessageProtocol; @@ -169,7 +169,7 @@ export type AuctionUpdated = { }; export type OrderExecuted = { - auction: PublicKey; + fastVaaHash: Array; vaa: PublicKey; targetProtocol: MessageProtocol; }; @@ -190,12 +190,12 @@ export type LocalFastOrderFilled = { export type FastFillSequenceReserved = { fastVaaHash: Array; - fastFillSeeds: FastFillSeeds; + fastFill: FastFillSeeds; }; export type FastFillRedeemed = { preparedBy: PublicKey; - fastFill: PublicKey; + fastFill: FastFillSeeds; }; export type MatchingEngineEvent = {