* Add simulation detection countermeasure (#22880)
* Add simulation detection countermeasures
* Add program and test using TestValidator
* Remove incinerator deposit
* Remove incinerator
* Update Cargo.lock
* Add more features to simulation bank
* Update Cargo.lock per rebase
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
(cherry picked from commit c42b80f099
)
# Conflicts:
# programs/bpf/Cargo.lock
# programs/bpf/Cargo.toml
* Update Cargo.lock
Co-authored-by: Michael Vines <mvines@gmail.com>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
This commit is contained in:
41
programs/bpf/rust/simulation/tests/lib.rs
Normal file
41
programs/bpf/rust/simulation/tests/lib.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
#![cfg(feature = "test-bpf")]
|
||||
|
||||
use {
|
||||
solana_bpf_rust_simulation::process_instruction,
|
||||
solana_program_test::{processor, tokio, ProgramTest},
|
||||
solana_sdk::{
|
||||
instruction::{AccountMeta, Instruction},
|
||||
pubkey::Pubkey,
|
||||
signature::Signer,
|
||||
sysvar,
|
||||
transaction::Transaction,
|
||||
},
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
async fn no_panic() {
|
||||
let program_id = Pubkey::new_unique();
|
||||
let program_test = ProgramTest::new(
|
||||
"solana_bpf_rust_simulation",
|
||||
program_id,
|
||||
processor!(process_instruction),
|
||||
);
|
||||
|
||||
let mut context = program_test.start_with_context().await;
|
||||
let transaction = Transaction::new_signed_with_payer(
|
||||
&[Instruction {
|
||||
program_id,
|
||||
accounts: vec![AccountMeta::new_readonly(sysvar::slot_history::id(), false)],
|
||||
data: vec![],
|
||||
}],
|
||||
Some(&context.payer.pubkey()),
|
||||
&[&context.payer],
|
||||
context.last_blockhash,
|
||||
);
|
||||
|
||||
context
|
||||
.banks_client
|
||||
.process_transaction_with_preflight(transaction)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
Reference in New Issue
Block a user