Skip to content

Commit 3494ab2

Browse files
author
Bengt Lofgren
committed
make lint
1 parent d7ff1bf commit 3494ab2

File tree

10 files changed

+22
-28
lines changed

10 files changed

+22
-28
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
@@ -62,7 +62,7 @@ pub async fn initialize_fast_market_order_shimful(
6262
.clone()
6363
.unwrap_or_else(|| testing_context.testing_actors.payer_signer.clone());
6464
let guardian_signature_info = create_guardian_signatures(
65-
&testing_context,
65+
testing_context,
6666
test_context,
6767
&payer_signer,
6868
&fast_transfer_vaa.vaa_data,
@@ -166,7 +166,7 @@ pub fn initialize_fast_market_order_shimful_instruction(
166166
fast_market_order_account: &fast_market_order_account,
167167
guardian_set: &guardian_signature_info.guardian_set_pubkey,
168168
guardian_set_signatures: &guardian_signature_info.guardian_signatures_pubkey,
169-
from_endpoint: from_endpoint,
169+
from_endpoint,
170170
verify_vaa_shim_program: &WORMHOLE_VERIFY_VAA_SHIM_PID,
171171
system_program: &solana_program::system_program::ID,
172172
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub async fn evaluate_place_initial_offer_shimful_state(
164164
.get_active_auction()
165165
.unwrap();
166166
active_auction_state
167-
.verify_auction(&testing_context, test_context)
167+
.verify_auction(testing_context, test_context)
168168
.await
169169
.expect("Could not verify auction");
170170
let auction_accounts = initial_offer_placed_state.auction_accounts;

solana/modules/matching-engine-testing/tests/shimless/initialize.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ pub fn initialize_program_instruction(
143143
) -> Instruction {
144144
let program_id = testing_context.get_matching_engine_program_id();
145145
let usdc_mint_address = testing_context.get_usdc_mint_address();
146-
let initialize_addresses =
147-
InitializeAddresses::new(testing_context, &auction_parameters_config);
146+
let initialize_addresses = InitializeAddresses::new(testing_context, auction_parameters_config);
148147
let InitializeAddresses {
149148
custodian_address: custodian,
150149
auction_config_address: auction_config,

solana/modules/matching-engine-testing/tests/shimless/make_offer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pub async fn place_initial_offer_shimless(
275275
auction_state
276276
.get_active_auction()
277277
.unwrap()
278-
.verify_auction(&testing_context, test_context)
278+
.verify_auction(testing_context, test_context)
279279
.await
280280
.expect("Could not verify auction state");
281281
return TestingEngineState::InitialOfferPlaced {
@@ -413,7 +413,7 @@ pub async fn improve_offer(
413413
new_auction_state
414414
.get_active_auction()
415415
.unwrap()
416-
.verify_auction(&testing_context, test_context)
416+
.verify_auction(testing_context, test_context)
417417
.await
418418
.expect("Could not verify auction state");
419419
return TestingEngineState::OfferImproved {

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ pub struct BalanceChange {
624624
pub usdt: i32,
625625
}
626626

627+
#[derive(Default)]
627628
pub struct CombinedInstructionConfig {
628629
pub create_fast_market_order_config: Option<InitializeFastMarketOrderShimInstructionConfig>,
629630
pub place_initial_offer_config: Option<PlaceInitialOfferInstructionConfig>,
@@ -633,19 +634,6 @@ pub struct CombinedInstructionConfig {
633634
pub improve_offer_config: Option<ImproveOfferInstructionConfig>,
634635
}
635636

636-
impl Default for CombinedInstructionConfig {
637-
fn default() -> Self {
638-
Self {
639-
create_fast_market_order_config: None,
640-
place_initial_offer_config: None,
641-
execute_order_config: None,
642-
settle_auction_config: None,
643-
close_fast_market_order_config: None,
644-
improve_offer_config: None,
645-
}
646-
}
647-
}
648-
649637
impl CombinedInstructionConfig {
650638
pub fn create_fast_market_order_and_place_initial_offer(
651639
testing_actors: &TestingActors,

solana/modules/matching-engine-testing/tests/utils/router.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ impl Deref for TestRouterEndpoints {
9898
}
9999

100100
impl TestRouterEndpoints {
101-
102101
pub fn get_from_and_to_endpoint_addresses(
103102
&self,
104103
transfer_direction: TransferDirection,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ pub fn burn_and_post<'info>(
5353
payer,
5454
wormhole_program_id: &CORE_BRIDGE_PROGRAM_ID,
5555
derived: post_message::PostMessageDerivedAccounts {
56-
message: Some(&message),
57-
sequence: Some(&sequence),
56+
message: Some(message),
57+
sequence: Some(sequence),
5858
core_bridge_config: Some(&CORE_BRIDGE_CONFIG),
5959
fee_collector: Some(&CORE_BRIDGE_FEE_COLLECTOR),
6060
event_authority: Some(&POST_MESSAGE_SHIM_EVENT_AUTHORITY),

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,19 @@ pub fn try_fast_market_order_account<'a>(
128128
return Err(ErrorCode::AccountDiscriminatorNotFound.into());
129129
}
130130

131-
if &data[0..8] != &FastMarketOrder::DISCRIMINATOR {
131+
if data[0..8] != FastMarketOrder::DISCRIMINATOR {
132132
return Err(ErrorCode::AccountDiscriminatorMismatch.into());
133133
}
134134

135135
// TODO: Move up?
136136
super::helpers::require_owned_by_this_program(fast_market_order_info, "fast_market_order")?;
137137

138138
Ok(Ref::map(data, |data| {
139-
bytemuck::from_bytes(&data[8..8 + std::mem::size_of::<FastMarketOrder>()])
139+
bytemuck::from_bytes(
140+
&data[8..8_usize
141+
.checked_add(std::mem::size_of::<FastMarketOrder>())
142+
.unwrap()],
143+
)
140144
}))
141145
}
142146

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ pub fn prepare_order_response_cctp_shim(
403403
&spl_token::ID,
404404
&CCTP_MINT_RECIPIENT,
405405
&expected_prepared_custody_key,
406-
&custodian_info.key,
406+
custodian_info.key,
407407
&[], // Apparently this is only for multi-sig accounts
408408
amount_in,
409409
)

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ impl FallbackMatchingEngineInstruction<'_> {
102102
match self {
103103
Self::InitializeFastMarketOrder(data) => {
104104
let mut out = Vec::with_capacity(
105-
SELECTOR_SIZE + std::mem::size_of::<InitializeFastMarketOrderData>(),
105+
SELECTOR_SIZE
106+
.saturating_add(std::mem::size_of::<InitializeFastMarketOrderData>()),
106107
);
107108

108109
out.extend_from_slice(
@@ -113,7 +114,10 @@ impl FallbackMatchingEngineInstruction<'_> {
113114
out
114115
}
115116
Self::PlaceInitialOfferCctpShim(data) => {
116-
let mut out = Vec::with_capacity(SELECTOR_SIZE + std::mem::size_of::<u64>());
117+
let mut out = Vec::with_capacity(
118+
SELECTOR_SIZE
119+
.saturating_add(std::mem::size_of::<PlaceInitialOfferCctpShimData>()),
120+
);
117121

118122
out.extend_from_slice(
119123
&FallbackMatchingEngineInstruction::PLACE_INITIAL_OFFER_CCTP_SHIM_SELECTOR,

0 commit comments

Comments
 (0)