Skip to content

Commit b1593e0

Browse files
committed
solana: auction pubkey -> fast vaa hash in events
1 parent 906b1aa commit b1593e0

File tree

16 files changed

+81
-41
lines changed

16 files changed

+81
-41
lines changed

solana/programs/matching-engine/src/composite/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub struct CheckedCustodian<'info> {
9797
seeds = [Custodian::SEED_PREFIX],
9898
bump = Custodian::BUMP,
9999
)]
100-
pub custodian: Account<'info, Custodian>,
100+
pub custodian: Box<Account<'info, Custodian>>,
101101
}
102102

103103
impl<'info> Deref for CheckedCustodian<'info> {
@@ -138,7 +138,7 @@ pub struct OwnerOnlyMut<'info> {
138138
seeds = [Custodian::SEED_PREFIX],
139139
bump = Custodian::BUMP,
140140
)]
141-
pub custodian: Account<'info, Custodian>,
141+
pub custodian: Box<Account<'info, Custodian>>,
142142
}
143143

144144
#[derive(Accounts)]
@@ -171,7 +171,7 @@ pub struct AdminMut<'info> {
171171
seeds = [Custodian::SEED_PREFIX],
172172
bump = Custodian::BUMP,
173173
)]
174-
pub custodian: Account<'info, Custodian>,
174+
pub custodian: Box<Account<'info, Custodian>>,
175175
}
176176

177177
#[derive(Accounts)]
@@ -195,7 +195,7 @@ pub struct LocalTokenRouter<'info> {
195195
associated_token::mint = common::USDC_MINT,
196196
associated_token::authority = token_router_emitter,
197197
)]
198-
pub token_router_mint_recipient: Account<'info, token::TokenAccount>,
198+
pub token_router_mint_recipient: Box<Account<'info, token::TokenAccount>>,
199199
}
200200

201201
#[derive(Accounts)]
@@ -208,7 +208,7 @@ pub struct ExistingMutRouterEndpoint<'info> {
208208
],
209209
bump = endpoint.bump,
210210
)]
211-
pub endpoint: Account<'info, RouterEndpoint>,
211+
pub endpoint: Box<Account<'info, RouterEndpoint>>,
212212
}
213213

214214
impl<'info> Deref for ExistingMutRouterEndpoint<'info> {
@@ -644,7 +644,7 @@ pub struct ReserveFastFillSequence<'info> {
644644
// This check makes sure that the auction account did not exist before this
645645
// instruction was called.
646646
require!(
647-
auction.vaa_hash == [0; 32],
647+
auction.vaa_hash == <[u8; 32]>::default(),
648648
MatchingEngineError::AuctionExists,
649649
);
650650

solana/programs/matching-engine/src/events/auction_settled.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct SettledTokenAccountInfo {
1111
#[derive(Debug)]
1212
pub struct AuctionSettled {
1313
/// The pubkey of the auction that was settled.
14-
pub auction: Pubkey,
14+
pub fast_vaa_hash: [u8; 32],
1515

1616
/// If there was an active auction, this field will have the pubkey of the best offer token that
1717
/// was paid back and its balance after repayment.

solana/programs/matching-engine/src/events/auction_updated.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use anchor_lang::prelude::*;
55
#[derive(Debug)]
66
pub struct AuctionUpdated {
77
pub config_id: u32,
8-
pub auction: Pubkey,
8+
pub fast_vaa_hash: [u8; 32],
99
pub vaa: Option<Pubkey>,
1010
pub source_chain: u16,
1111
pub target_protocol: MessageProtocol,
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use anchor_lang::prelude::*;
22

3+
use crate::state::FastFillSeeds;
4+
35
#[event]
46
pub struct FastFillRedeemed {
57
pub prepared_by: Pubkey,
6-
pub fast_fill: Pubkey,
8+
pub fast_fill: FastFillSeeds,
79
}

solana/programs/matching-engine/src/events/fast_fill_sequence_reserved.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ use anchor_lang::prelude::*;
44
#[event]
55
pub struct FastFillSequenceReserved {
66
pub fast_vaa_hash: [u8; 32],
7-
pub fast_fill_seeds: FastFillSeeds,
7+
pub fast_fill: FastFillSeeds,
88
}

solana/programs/matching-engine/src/events/order_executed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anchor_lang::prelude::*;
44
#[event]
55
#[derive(Debug)]
66
pub struct OrderExecuted {
7-
pub auction: Pubkey,
7+
pub fast_vaa_hash: [u8; 32],
88
pub vaa: Pubkey,
99
pub source_chain: u16,
1010
pub target_protocol: MessageProtocol,

solana/programs/matching-engine/src/processor/auction/execute_fast_order/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ fn handle_execute_fast_order<'info>(
214214
execute_penalty: if penalized { penalty.into() } else { None },
215215
},
216216
OrderExecuted {
217-
auction: auction.key(),
217+
fast_vaa_hash: auction.vaa_hash,
218218
vaa: fast_vaa.key(),
219219
source_chain: auction_info.source_chain,
220220
target_protocol: auction.target_protocol,

solana/programs/matching-engine/src/processor/auction/offer/improve.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub fn improve_offer(ctx: Context<ImproveOffer>, offer_price: u64) -> Result<()>
137137
// Emit event for auction participants to listen to.
138138
emit_cpi!(crate::utils::log_emit(crate::events::AuctionUpdated {
139139
config_id: info.config_id,
140-
auction: auction.key(),
140+
fast_vaa_hash: auction.vaa_hash,
141141
vaa: Default::default(),
142142
source_chain: info.source_chain,
143143
target_protocol: auction.target_protocol,

solana/programs/matching-engine/src/processor/auction/offer/place_initial/cctp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pub fn place_initial_offer_cctp(
169169
// Emit event for auction participants to listen to.
170170
emit_cpi!(crate::utils::log_emit(crate::events::AuctionUpdated {
171171
config_id: info.config_id,
172-
auction: ctx.accounts.auction.key(),
172+
fast_vaa_hash: ctx.accounts.auction.vaa_hash,
173173
vaa: ctx.accounts.fast_order_path.fast_vaa.key().into(),
174174
source_chain: info.source_chain,
175175
target_protocol: ctx.accounts.auction.target_protocol,

solana/programs/matching-engine/src/processor/auction/settle/complete.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ fn handle_settle_auction_complete(
249249
};
250250

251251
emit_cpi!(crate::events::AuctionSettled {
252-
auction: ctx.accounts.auction.key(),
252+
fast_vaa_hash: ctx.accounts.auction.vaa_hash,
253253
best_offer_token: settled_best_offer_result,
254254
base_fee_token: settled_base_fee_result,
255255
with_execute: Default::default(),

solana/programs/matching-engine/src/processor/auction/settle/none/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn settle_none_and_prepare_fill(accounts: SettleNoneAndPrepareFill<'_, '_>) -> R
8484
};
8585

8686
let auction_settled_event = AuctionSettled {
87-
auction: auction.key(),
87+
fast_vaa_hash: auction.vaa_hash,
8888
best_offer_token: Default::default(),
8989
base_fee_token: crate::events::SettledTokenAccountInfo {
9090
key: fee_recipient_token.key(),

solana/programs/matching-engine/src/processor/fast_fill/complete.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct CompleteFastFill<'info> {
3131
bump = fast_fill.seeds.bump,
3232
constraint = !fast_fill.redeemed @ MatchingEngineError::FastFillAlreadyRedeemed,
3333
)]
34-
fast_fill: Account<'info, FastFill>,
34+
fast_fill: Box<Account<'info, FastFill>>,
3535

3636
/// Only the registered local Token Router program can call this instruction. It is allowed to
3737
/// invoke this instruction by using its emitter (i.e. its Custodian account) as a signer. We
@@ -43,7 +43,7 @@ pub struct CompleteFastFill<'info> {
4343
mut,
4444
token::mint = local_custody_token.mint,
4545
)]
46-
token_router_custody_token: Account<'info, token::TokenAccount>,
46+
token_router_custody_token: Box<Account<'info, token::TokenAccount>>,
4747

4848
#[account(
4949
constraint = {
@@ -84,7 +84,7 @@ pub fn complete_fast_fill(ctx: Context<CompleteFastFill>) -> Result<()> {
8484
// Emit event that the fast fill is redeemed. Listeners can close this account.
8585
emit_cpi!(crate::events::FastFillRedeemed {
8686
prepared_by: ctx.accounts.fast_fill.info.prepared_by,
87-
fast_fill: ctx.accounts.fast_fill.key(),
87+
fast_fill: ctx.accounts.fast_fill.seeds,
8888
});
8989

9090
// Finally transfer to local token router's token account.

solana/programs/matching-engine/src/processor/fast_fill/reserve_sequence/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ fn set_reserved_sequence_data(
8181
// easily execute local orders.
8282
Ok(FastFillSequenceReserved {
8383
fast_vaa_hash,
84-
fast_fill_seeds,
84+
fast_fill: fast_fill_seeds,
8585
})
8686
}

solana/ts/src/idl/json/matching_engine.json

+27-8
Original file line numberDiff line numberDiff line change
@@ -3535,11 +3535,16 @@
35353535
"kind": "struct",
35363536
"fields": [
35373537
{
3538-
"name": "auction",
3538+
"name": "fast_vaa_hash",
35393539
"docs": [
35403540
"The pubkey of the auction that was settled."
35413541
],
3542-
"type": "pubkey"
3542+
"type": {
3543+
"array": [
3544+
"u8",
3545+
32
3546+
]
3547+
}
35433548
},
35443549
{
35453550
"name": "best_offer_token",
@@ -3640,8 +3645,13 @@
36403645
"type": "u32"
36413646
},
36423647
{
3643-
"name": "auction",
3644-
"type": "pubkey"
3648+
"name": "fast_vaa_hash",
3649+
"type": {
3650+
"array": [
3651+
"u8",
3652+
32
3653+
]
3654+
}
36453655
},
36463656
{
36473657
"name": "vaa",
@@ -3911,7 +3921,11 @@
39113921
},
39123922
{
39133923
"name": "fast_fill",
3914-
"type": "pubkey"
3924+
"type": {
3925+
"defined": {
3926+
"name": "FastFillSeeds"
3927+
}
3928+
}
39153929
}
39163930
]
39173931
}
@@ -3973,7 +3987,7 @@
39733987
}
39743988
},
39753989
{
3976-
"name": "fast_fill_seeds",
3990+
"name": "fast_fill",
39773991
"type": {
39783992
"defined": {
39793993
"name": "FastFillSeeds"
@@ -4115,8 +4129,13 @@
41154129
"kind": "struct",
41164130
"fields": [
41174131
{
4118-
"name": "auction",
4119-
"type": "pubkey"
4132+
"name": "fast_vaa_hash",
4133+
"type": {
4134+
"array": [
4135+
"u8",
4136+
32
4137+
]
4138+
}
41204139
},
41214140
{
41224141
"name": "vaa",

solana/ts/src/idl/ts/matching_engine.ts

+27-8
Original file line numberDiff line numberDiff line change
@@ -3541,11 +3541,16 @@ export type MatchingEngine = {
35413541
"kind": "struct",
35423542
"fields": [
35433543
{
3544-
"name": "auction",
3544+
"name": "fastVaaHash",
35453545
"docs": [
35463546
"The pubkey of the auction that was settled."
35473547
],
3548-
"type": "pubkey"
3548+
"type": {
3549+
"array": [
3550+
"u8",
3551+
32
3552+
]
3553+
}
35493554
},
35503555
{
35513556
"name": "bestOfferToken",
@@ -3646,8 +3651,13 @@ export type MatchingEngine = {
36463651
"type": "u32"
36473652
},
36483653
{
3649-
"name": "auction",
3650-
"type": "pubkey"
3654+
"name": "fastVaaHash",
3655+
"type": {
3656+
"array": [
3657+
"u8",
3658+
32
3659+
]
3660+
}
36513661
},
36523662
{
36533663
"name": "vaa",
@@ -3917,7 +3927,11 @@ export type MatchingEngine = {
39173927
},
39183928
{
39193929
"name": "fastFill",
3920-
"type": "pubkey"
3930+
"type": {
3931+
"defined": {
3932+
"name": "fastFillSeeds"
3933+
}
3934+
}
39213935
}
39223936
]
39233937
}
@@ -3979,7 +3993,7 @@ export type MatchingEngine = {
39793993
}
39803994
},
39813995
{
3982-
"name": "fastFillSeeds",
3996+
"name": "fastFill",
39833997
"type": {
39843998
"defined": {
39853999
"name": "fastFillSeeds"
@@ -4121,8 +4135,13 @@ export type MatchingEngine = {
41214135
"kind": "struct",
41224136
"fields": [
41234137
{
4124-
"name": "auction",
4125-
"type": "pubkey"
4138+
"name": "fastVaaHash",
4139+
"type": {
4140+
"array": [
4141+
"u8",
4142+
32
4143+
]
4144+
}
41264145
},
41274146
{
41284147
"name": "vaa",

solana/ts/src/matchingEngine/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ export type SettledTokenAccountInfo = {
147147
};
148148

149149
export type AuctionSettled = {
150-
auction: PublicKey;
150+
fastVaaHash: Array<number>;
151151
bestOfferToken: SettledTokenAccountInfo | null;
152152
baseFeeToken: SettledTokenAccountInfo | null;
153153
withExecute: MessageProtocol | null;
154154
};
155155

156156
export type AuctionUpdated = {
157157
configId: number;
158-
auction: PublicKey;
158+
fastVaaHash: Array<number>;
159159
vaa: PublicKey | null;
160160
sourceChain: number;
161161
targetProtocol: MessageProtocol;
@@ -169,7 +169,7 @@ export type AuctionUpdated = {
169169
};
170170

171171
export type OrderExecuted = {
172-
auction: PublicKey;
172+
fastVaaHash: Array<number>;
173173
vaa: PublicKey;
174174
targetProtocol: MessageProtocol;
175175
};
@@ -190,12 +190,12 @@ export type LocalFastOrderFilled = {
190190

191191
export type FastFillSequenceReserved = {
192192
fastVaaHash: Array<number>;
193-
fastFillSeeds: FastFillSeeds;
193+
fastFill: FastFillSeeds;
194194
};
195195

196196
export type FastFillRedeemed = {
197197
preparedBy: PublicKey;
198-
fastFill: PublicKey;
198+
fastFill: FastFillSeeds;
199199
};
200200

201201
export type MatchingEngineEvent = {

0 commit comments

Comments
 (0)