Skip to content

Commit 09ce66a

Browse files
Bengt Lofgrena5-pickle
authored andcommitted
make lint
1 parent 5c2301a commit 09ce66a

File tree

10 files changed

+36
-40
lines changed

10 files changed

+36
-40
lines changed

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

Lines changed: 1 addition & 1 deletion
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,

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -316,19 +316,21 @@ pub struct CctpAccounts {
316316
pub message_transmitter_program: Pubkey,
317317
}
318318

319-
impl Into<CctpDepositForBurn> for CctpAccounts {
320-
fn into(self) -> CctpDepositForBurn {
321-
CctpDepositForBurn {
322-
mint: self.mint,
323-
local_token: self.local_token,
324-
token_messenger_minter_sender_authority: self.token_messenger_minter_sender_authority,
325-
message_transmitter_config: self.message_transmitter_config,
326-
token_messenger: self.token_messenger,
327-
remote_token_messenger: self.remote_token_messenger,
328-
token_minter: self.token_minter,
329-
token_messenger_minter_event_authority: self.token_messenger_minter_event_authority,
330-
message_transmitter_program: self.message_transmitter_program,
331-
token_messenger_minter_program: self.token_messenger_minter_program,
319+
impl From<CctpAccounts> for CctpDepositForBurn {
320+
fn from(cctp_accounts: CctpAccounts) -> Self {
321+
Self {
322+
mint: cctp_accounts.mint,
323+
local_token: cctp_accounts.local_token,
324+
token_messenger_minter_sender_authority: cctp_accounts
325+
.token_messenger_minter_sender_authority,
326+
message_transmitter_config: cctp_accounts.message_transmitter_config,
327+
token_messenger: cctp_accounts.token_messenger,
328+
remote_token_messenger: cctp_accounts.remote_token_messenger,
329+
token_minter: cctp_accounts.token_minter,
330+
token_messenger_minter_event_authority: cctp_accounts
331+
.token_messenger_minter_event_authority,
332+
message_transmitter_program: cctp_accounts.message_transmitter_program,
333+
token_messenger_minter_program: cctp_accounts.token_messenger_minter_program,
332334
}
333335
}
334336
}

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
@@ -639,6 +639,7 @@ pub struct BalanceChange {
639639
pub usdt: i32,
640640
}
641641

642+
#[derive(Default)]
642643
pub struct CombinedInstructionConfig {
643644
pub create_fast_market_order_config: Option<InitializeFastMarketOrderShimInstructionConfig>,
644645
pub place_initial_offer_config: Option<PlaceInitialOfferInstructionConfig>,
@@ -648,19 +649,6 @@ pub struct CombinedInstructionConfig {
648649
pub improve_offer_config: Option<ImproveOfferInstructionConfig>,
649650
}
650651

651-
impl Default for CombinedInstructionConfig {
652-
fn default() -> Self {
653-
Self {
654-
create_fast_market_order_config: None,
655-
place_initial_offer_config: None,
656-
execute_order_config: None,
657-
settle_auction_config: None,
658-
close_fast_market_order_config: None,
659-
improve_offer_config: None,
660-
}
661-
}
662-
}
663-
664652
impl CombinedInstructionConfig {
665653
pub fn create_fast_market_order_and_place_initial_offer(
666654
testing_actors: &TestingActors,

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
@@ -129,15 +129,19 @@ pub fn try_fast_market_order_account<'a>(
129129
return Err(ErrorCode::AccountDiscriminatorNotFound.into());
130130
}
131131

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

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

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

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
@@ -393,7 +393,7 @@ pub fn prepare_order_response_cctp_shim(
393393
&spl_token::ID,
394394
&CCTP_MINT_RECIPIENT,
395395
&expected_prepared_custody_key,
396-
&custodian_info.key,
396+
custodian_info.key,
397397
&[], // Apparently this is only for multi-sig accounts
398398
amount_in,
399399
)

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ impl FallbackMatchingEngineInstruction<'_> {
114114
match self {
115115
Self::InitializeFastMarketOrder(data) => {
116116
let mut out = Vec::with_capacity(
117-
SELECTOR_SIZE + std::mem::size_of::<InitializeFastMarketOrderData>(),
117+
SELECTOR_SIZE
118+
.saturating_add(std::mem::size_of::<InitializeFastMarketOrderData>()),
118119
);
119120

120121
out.extend_from_slice(
@@ -125,7 +126,8 @@ impl FallbackMatchingEngineInstruction<'_> {
125126
out
126127
}
127128
Self::PlaceInitialOfferCctpShim(data) => {
128-
let mut out = Vec::with_capacity(SELECTOR_SIZE + std::mem::size_of::<u64>());
129+
let mut out =
130+
Vec::with_capacity(SELECTOR_SIZE.saturating_add(std::mem::size_of::<u64>()));
129131

130132
out.extend_from_slice(
131133
&FallbackMatchingEngineInstruction::PLACE_INITIAL_OFFER_CCTP_SHIM_SELECTOR,
@@ -156,7 +158,8 @@ impl FallbackMatchingEngineInstruction<'_> {
156158
}
157159
FallbackMatchingEngineInstruction::SettleAuctionNoneCctpShim(data) => {
158160
let mut out = Vec::with_capacity(
159-
SELECTOR_SIZE + std::mem::size_of::<SettleAuctionNoneCctpShimData>(),
161+
SELECTOR_SIZE
162+
.saturating_add(std::mem::size_of::<SettleAuctionNoneCctpShimData>()),
160163
);
161164

162165
out.extend_from_slice(

0 commit comments

Comments
 (0)