Skip to content

Commit cc8039f

Browse files
author
Bengt Lofgren
committed
lut and compute limit mistake ammended
1 parent 7a784a7 commit cc8039f

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
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
@@ -17,7 +17,6 @@ use utils::constants::*;
1717

1818
use matching_engine::state::{FastMarketOrder as FastMarketOrderState, FastMarketOrderParams};
1919
use solana_program_test::ProgramTestContext;
20-
use solana_sdk::transaction::VersionedTransaction;
2120
use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction};
2221
use std::rc::Rc;
2322
use wormhole_io::TypePrefixedPayload;
@@ -56,6 +55,7 @@ pub async fn initialise_fast_market_order_fallback(
5655
);
5756
let transaction = testing_context
5857
.create_transaction(
58+
test_context,
5959
&[initialise_fast_market_order_ix],
6060
Some(&payer_signer.pubkey()),
6161
&[payer_signer],

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ pub fn create_execute_order_shim_accounts<'ix>(
235235
initial_participant: &execute_order_fallback_accounts.initial_participant, // 10
236236
to_router_endpoint: &execute_order_fallback_accounts.to_router_endpoint, // 11
237237
post_message_shim_program: &POST_MESSAGE_SHIM_PROGRAM_ID, // 12
238-
post_message_sequence: &execute_order_fallback_fixture.post_message_sequence, // 13
239-
post_message_message: &execute_order_fallback_fixture.post_message_message, // 14
238+
core_bridge_emitter_sequence: &execute_order_fallback_fixture.post_message_sequence, // 13
239+
post_shim_message: &execute_order_fallback_fixture.post_message_message, // 14
240240
cctp_deposit_for_burn_mint: &USDC_MINT, // 15
241241
cctp_deposit_for_burn_token_messenger_minter_sender_authority:
242242
&execute_order_fallback_fixture

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
@@ -124,7 +124,7 @@ pub async fn place_initial_offer_fallback(
124124
.get_token_account_balance(test_context, &config.spl_token_enum)
125125
.await;
126126

127-
let place_initial_offer_ix_data = PlaceInitialOfferCctpShimFallbackData::new(offer_price);
127+
let place_initial_offer_ix_data = PlaceInitialOfferCctpShimFallbackData { offer_price };
128128

129129
let (from_router_endpoint, to_router_endpoint) =
130130
config.get_from_and_to_router_endpoints(current_state);

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use matching_engine::{CCTP_MINT_RECIPIENT, ID as PROGRAM_ID};
3939
use solana_program_test::{BanksClientError, ProgramTest, ProgramTestContext};
4040
use solana_sdk::clock::Clock;
4141
use solana_sdk::compute_budget::ComputeBudgetInstruction;
42-
use solana_sdk::instruction::InstructionError;
42+
use solana_sdk::instruction::{Instruction, InstructionError};
4343
use solana_sdk::transaction::{TransactionError, VersionedTransaction};
4444
use solana_sdk::{
4545
pubkey::Pubkey,
@@ -380,23 +380,23 @@ impl TestingContext {
380380

381381
pub async fn create_transaction(
382382
&self,
383+
test_context: &mut ProgramTestContext,
383384
instructions: &[Instruction],
384385
payer: Option<&Pubkey>,
385386
signers: &[&Keypair],
386387
compute_unit_price: u64,
387-
compute_unit_limit: u64,
388-
) -> VersionedTransaction {
389-
let last_blockhash = self.get_new_latest_blockhash(test_context).await;
388+
compute_unit_limit: u32,
389+
) -> Transaction {
390+
let last_blockhash = self.get_new_latest_blockhash(test_context).await.unwrap();
390391
let compute_budget_price =
391392
ComputeBudgetInstruction::set_compute_unit_price(compute_unit_price);
392393
let compute_budget_limit =
393394
ComputeBudgetInstruction::set_compute_unit_limit(compute_unit_limit);
394-
let instructions = [
395-
&compute_budget_price,
396-
&compute_budget_limit,
397-
instructions.to_vec(),
398-
];
399-
Transaction::new_signed_with_payer(instructions, payer, signers, last_blockhash)
395+
let mut all_instructions = Vec::with_capacity(instructions.len() + 2);
396+
all_instructions.push(compute_budget_price.clone());
397+
all_instructions.push(compute_budget_limit.clone());
398+
all_instructions.extend_from_slice(instructions);
399+
Transaction::new_signed_with_payer(&all_instructions, payer, signers, last_blockhash)
400400
}
401401

402402
// TODO: Edit to handle multiple instructions in a single transaction

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! It includes methods for creating accounts and for reading a keypair from a JSON fixture file.
55
//! These accounts are located in the `tests/fixtures/accounts` directory.
66
7-
use anchor_lang::prelude::{pubkey, Pubkey};
7+
use anchor_lang::prelude::Pubkey;
88
use anyhow::Result as AnyhowResult;
99
use serde_json::Value;
1010
use solana_program_test::ProgramTest;
@@ -70,7 +70,7 @@ impl FixtureAccounts {
7070
///
7171
/// * `program_test` - The program test instance
7272
pub fn add_lookup_table_hack(program_test: &mut ProgramTest) {
73-
let filename = "tests/fixtures/lup.json";
73+
let filename = "tests/fixtures/lut.json";
7474
let account_fixture = read_account_from_file(filename).unwrap();
7575
program_test.add_account_with_file_data(
7676
account_fixture.address,

0 commit comments

Comments
 (0)