Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Oct 1, 2024
1 parent 573b487 commit 04b2363
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
10 changes: 8 additions & 2 deletions programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ use {
load_upgradeable_program_wrapper, set_upgrade_authority, upgrade_program,
},
},
solana_runtime_transaction::instructions_processor::process_compute_budget_instructions,
solana_runtime_transaction::{
instructions_processor::process_compute_budget_instructions,
runtime_transaction::RuntimeTransaction,
},
solana_sbf_rust_invoke_dep::*,
solana_sbf_rust_realloc_dep::*,
solana_sbf_rust_realloc_invoke_dep::*,
Expand Down Expand Up @@ -652,7 +655,10 @@ fn test_return_data_and_log_data_syscall() {
let blockhash = bank.last_blockhash();
let message = Message::new(&[instruction], Some(&mint_keypair.pubkey()));
let transaction = Transaction::new(&[&mint_keypair], message, blockhash);
let sanitized_tx = SanitizedTransaction::from_transaction_for_tests(transaction);
let sanitized_tx = RuntimeTransaction::try_from_sanitized_transaction(
SanitizedTransaction::from_transaction_for_tests(transaction),
)
.unwrap();

let result = bank.simulate_transaction(&sanitized_tx, false);

Expand Down
6 changes: 5 additions & 1 deletion programs/sbf/tests/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use {
genesis_utils::{create_genesis_config, GenesisConfigInfo},
loader_utils::load_upgradeable_program_and_advance_slot,
},
solana_runtime_transaction::runtime_transaction::RuntimeTransaction,
solana_sdk::{
instruction::{AccountMeta, Instruction},
message::Message,
Expand Down Expand Up @@ -50,7 +51,10 @@ fn test_no_panic_banks_client() {
let blockhash = bank.last_blockhash();
let message = Message::new(&[instruction], Some(&mint_keypair.pubkey()));
let transaction = Transaction::new(&[&mint_keypair], message, blockhash);
let sanitized_tx = SanitizedTransaction::from_transaction_for_tests(transaction);
let sanitized_tx = RuntimeTransaction::try_from_sanitized_transaction(
SanitizedTransaction::from_transaction_for_tests(transaction),
)
.unwrap();
let result = bank.simulate_transaction(&sanitized_tx, false);
assert!(result.result.is_ok());
}
Expand Down
6 changes: 5 additions & 1 deletion programs/sbf/tests/sysvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use {
genesis_utils::{create_genesis_config, GenesisConfigInfo},
loader_utils::load_upgradeable_program_and_advance_slot,
},
solana_runtime_transaction::runtime_transaction::RuntimeTransaction,
solana_sdk::{
instruction::{AccountMeta, Instruction},
message::Message,
Expand Down Expand Up @@ -74,7 +75,10 @@ fn test_sysvar_syscalls() {
let blockhash = bank.last_blockhash();
let message = Message::new(&[instruction], Some(&mint_keypair.pubkey()));
let transaction = Transaction::new(&[&mint_keypair], message, blockhash);
let sanitized_tx = SanitizedTransaction::from_transaction_for_tests(transaction);
let sanitized_tx = RuntimeTransaction::try_from_sanitized_transaction(
SanitizedTransaction::from_transaction_for_tests(transaction),
)
.unwrap();
let result = bank.simulate_transaction(&sanitized_tx, false);
assert!(result.result.is_ok());
}
Expand Down

0 comments on commit 04b2363

Please sign in to comment.