Solana version = 1.16.8 rustc -V = 1.69.0 solana-cli = 1.16.8
The transaction will process successfully if it is type Transaction but not if it is type VersionedTransaction.
I need to use a VersionedTransaction because I am trying to test with lookup tables.
let mut test_builder = TestEnvironmentBuilder::new();
test_builder.add_account_with_lamports(
user.pubkey(),
solana_sdk::system_program::ID,
10_000_000_000_000,
);
/*
test_env is
pub struct TestEnvironment {
pub context: RefCell<ProgramTestContext>,
pub rent: Rent,
}
*/
let mut test_env = test_builder.start().await;
let mut context = test_env.context.borrow_mut();
//This is simple instruction to set compute units
let compute_ix = compute_instruction();
let transaction = Transaction::new_signed_with_payer(
&[compute_ix],
Some(&user.pubkey()),
&[&user],
context.last_blockhash,
);
let tx_result = context
.banks_client
.process_transaction_with_commitment(
transaction,
solana_sdk::commitment_config::CommitmentLevel::Processed,
)
.await;
println!("{:#?}", tx_result);
[2023-08-24T18:28:31.713669302Z DEBUG solana_runtime::message_processor::stable_log] Program ComputeBudget111111111111111111111111111111 invoke [1]
[2023-08-24T18:28:31.713750348Z DEBUG solana_runtime::message_processor::stable_log] Program ComputeBudget111111111111111111111111111111 success
Ok(
(),
)
When I replace with
let transaction = VersionedTransaction::try_new(
VersionedMessage::V0(v0::Message::try_compile(
&user.pubkey(),
&[compute_ix],
&[],
context.last_blockhash,
)?),
&[&user],
)?;
The tx_result is
Err(
RpcError(
DeadlineExceeded,
),
)
What is going on here and how to fix?