Skip to content

Commit 004946e

Browse files
author
Bengt Lofgren
committed
more comments
1 parent e0dc8b5 commit 004946e

File tree

13 files changed

+1181
-320
lines changed

13 files changed

+1181
-320
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
pub mod process_instruction;
22
pub use process_instruction::*;
3-
pub mod burn_and_post;
3+
// pub mod burn_and_post;
44
pub mod close_fast_market_order;
5-
pub mod execute_order;
5+
// pub mod execute_order;
66
pub mod initialise_fast_market_order;
77
pub mod place_initial_offer;
8-
pub mod prepare_order_response;
8+
// pub mod prepare_order_response;
99

1010
pub mod helpers;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ impl PlaceInitialOfferCctpShim<'_> {
9898
}
9999
}
100100

101+
/// VaaMessageBodyHeader for the digest calculation
102+
///
103+
/// This is the header of the vaa message body. It is used to calculate the digest of the fast market order.
101104
#[derive(Debug)]
102105
pub struct VaaMessageBodyHeader {
103106
pub consistency_level: u8,

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

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
use super::close_fast_market_order::close_fast_market_order;
2-
use super::execute_order::handle_execute_order_shim;
2+
// use super::execute_order::handle_execute_order_shim;
33
use super::initialise_fast_market_order::{
44
initialise_fast_market_order, InitialiseFastMarketOrderData,
55
};
6-
use super::place_initial_offer::place_initial_offer_cctp_shim;
7-
use super::place_initial_offer::PlaceInitialOfferCctpShimData;
8-
use super::prepare_order_response::prepare_order_response_cctp_shim;
9-
use super::prepare_order_response::PrepareOrderResponseCctpShimData;
6+
use super::place_initial_offer::{place_initial_offer_cctp_shim, PlaceInitialOfferCctpShimData};
7+
// use super::prepare_order_response::prepare_order_response_cctp_shim;
8+
// use super::prepare_order_response::PrepareOrderResponseCctpShimData;
109
use crate::ID;
1110
use anchor_lang::prelude::*;
1211
use wormhole_svm_definitions::make_anchor_discriminator;
@@ -28,8 +27,8 @@ pub enum FallbackMatchingEngineInstruction<'ix> {
2827
InitialiseFastMarketOrder(&'ix InitialiseFastMarketOrderData),
2928
CloseFastMarketOrder,
3029
PlaceInitialOfferCctpShim(&'ix PlaceInitialOfferCctpShimData),
31-
ExecuteOrderCctpShim,
32-
PrepareOrderResponseCctpShim(PrepareOrderResponseCctpShimData),
30+
// ExecuteOrderCctpShim,
31+
// PrepareOrderResponseCctpShim(PrepareOrderResponseCctpShimData),
3332
}
3433

3534
pub fn process_instruction(
@@ -51,13 +50,12 @@ pub fn process_instruction(
5150
}
5251
FallbackMatchingEngineInstruction::PlaceInitialOfferCctpShim(data) => {
5352
place_initial_offer_cctp_shim(accounts, &data)
54-
}
55-
FallbackMatchingEngineInstruction::ExecuteOrderCctpShim => {
56-
handle_execute_order_shim(accounts)
57-
}
58-
FallbackMatchingEngineInstruction::PrepareOrderResponseCctpShim(data) => {
59-
prepare_order_response_cctp_shim(accounts, data)
60-
}
53+
} // FallbackMatchingEngineInstruction::ExecuteOrderCctpShim => {
54+
// handle_execute_order_shim(accounts)
55+
// }
56+
// FallbackMatchingEngineInstruction::PrepareOrderResponseCctpShim(data) => {
57+
// prepare_order_response_cctp_shim(accounts, data)
58+
// }
6159
}
6260
}
6361

@@ -73,20 +71,21 @@ impl<'ix> FallbackMatchingEngineInstruction<'ix> {
7371
&PlaceInitialOfferCctpShimData::from_bytes(&instruction_data[8..]).unwrap(),
7472
))
7573
}
76-
FallbackMatchingEngineInstruction::EXECUTE_ORDER_CCTP_SHIM_SELECTOR => {
77-
Some(Self::ExecuteOrderCctpShim)
78-
}
74+
7975
FallbackMatchingEngineInstruction::INITIALISE_FAST_MARKET_ORDER_SELECTOR => Some(
8076
Self::InitialiseFastMarketOrder(&bytemuck::from_bytes(&instruction_data[8..])),
8177
),
8278
FallbackMatchingEngineInstruction::CLOSE_FAST_MARKET_ORDER_SELECTOR => {
8379
Some(Self::CloseFastMarketOrder)
8480
}
85-
FallbackMatchingEngineInstruction::PREPARE_ORDER_RESPONSE_CCTP_SHIM_SELECTOR => {
86-
Some(Self::PrepareOrderResponseCctpShim(
87-
PrepareOrderResponseCctpShimData::from_bytes(&instruction_data[8..]).unwrap(),
88-
))
89-
}
81+
// FallbackMatchingEngineInstruction::EXECUTE_ORDER_CCTP_SHIM_SELECTOR => {
82+
// Some(Self::ExecuteOrderCctpShim)
83+
// }
84+
// FallbackMatchingEngineInstruction::PREPARE_ORDER_RESPONSE_CCTP_SHIM_SELECTOR => {
85+
// Some(Self::PrepareOrderResponseCctpShim(
86+
// PrepareOrderResponseCctpShimData::from_bytes(&instruction_data[8..]).unwrap(),
87+
// ))
88+
// }
9089
_ => None,
9190
}
9291
}
@@ -113,17 +112,17 @@ impl FallbackMatchingEngineInstruction<'_> {
113112

114113
out
115114
}
116-
Self::ExecuteOrderCctpShim => {
117-
let total_capacity = 8; // 8 for the selector (no data)
115+
// Self::ExecuteOrderCctpShim => {
116+
// let total_capacity = 8; // 8 for the selector (no data)
118117

119-
let mut out = Vec::with_capacity(total_capacity);
118+
// let mut out = Vec::with_capacity(total_capacity);
120119

121-
out.extend_from_slice(
122-
&FallbackMatchingEngineInstruction::EXECUTE_ORDER_CCTP_SHIM_SELECTOR,
123-
);
120+
// out.extend_from_slice(
121+
// &FallbackMatchingEngineInstruction::EXECUTE_ORDER_CCTP_SHIM_SELECTOR,
122+
// );
124123

125-
out
126-
}
124+
// out
125+
// }
127126
Self::InitialiseFastMarketOrder(data) => {
128127
let data_slice = bytemuck::bytes_of(*data);
129128
let total_capacity = 8 + data_slice.len(); // 8 for the selector, plus the data length
@@ -147,21 +146,19 @@ impl FallbackMatchingEngineInstruction<'_> {
147146
);
148147

149148
out
150-
}
151-
152-
Self::PrepareOrderResponseCctpShim(data) => {
153-
let data_slice = data.to_bytes();
154-
let total_capacity = 8 + data_slice.len(); // 8 for the selector, plus the data length
149+
} // Self::PrepareOrderResponseCctpShim(data) => {
150+
// let data_slice = data.to_bytes();
151+
// let total_capacity = 8 + data_slice.len(); // 8 for the selector, plus the data length
155152

156-
let mut out = Vec::with_capacity(total_capacity);
153+
// let mut out = Vec::with_capacity(total_capacity);
157154

158-
out.extend_from_slice(
159-
&FallbackMatchingEngineInstruction::PREPARE_ORDER_RESPONSE_CCTP_SHIM_SELECTOR,
160-
);
161-
out.extend_from_slice(&data_slice);
155+
// out.extend_from_slice(
156+
// &FallbackMatchingEngineInstruction::PREPARE_ORDER_RESPONSE_CCTP_SHIM_SELECTOR,
157+
// );
158+
// out.extend_from_slice(&data_slice);
162159

163-
out
164-
}
160+
// out
161+
// }
165162
}
166163
}
167164
}

solana/programs/matching-engine/tests/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ The `TestingEngine` is initialised with a `TestingContext`. The `TestingContext`
1212

1313
The `TestingEngine` is used to execute the instruction triggers in the order they are provided. See the `testing_engine/engine.rs` file for more details.
1414

15-
1615
## Integration Tests
1716

1817
### Initialize program
@@ -21,6 +20,12 @@ What is expected:
2120
- Program is initialised
2221
- Router endpoints are created
2322

23+
24+
### Create CCTP router endpoints
25+
26+
What is expected:
27+
- CCTP router endpoints are created
28+
2429
### Create fast market order
2530

2631
What is expected:

0 commit comments

Comments
 (0)