* 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>
39 lines
1.0 KiB
Rust
39 lines
1.0 KiB
Rust
#![cfg(feature = "test-bpf")]
|
|
|
|
use {
|
|
solana_program::{
|
|
instruction::{AccountMeta, Instruction},
|
|
pubkey::Pubkey,
|
|
sysvar,
|
|
},
|
|
solana_sdk::{signature::Signer, transaction::Transaction},
|
|
solana_validator::test_validator::*,
|
|
};
|
|
|
|
#[test]
|
|
fn no_panic() {
|
|
solana_logger::setup_with_default("solana_program_runtime=debug");
|
|
let program_id = Pubkey::new_unique();
|
|
|
|
let (test_validator, payer) = TestValidatorGenesis::default()
|
|
.add_program("solana_bpf_rust_simulation", program_id)
|
|
.start();
|
|
let rpc_client = test_validator.get_rpc_client();
|
|
let blockhash = rpc_client.get_latest_blockhash().unwrap();
|
|
|
|
let transaction = Transaction::new_signed_with_payer(
|
|
&[Instruction {
|
|
program_id,
|
|
accounts: vec![AccountMeta::new_readonly(sysvar::slot_history::id(), false)],
|
|
data: vec![],
|
|
}],
|
|
Some(&payer.pubkey()),
|
|
&[&payer],
|
|
blockhash,
|
|
);
|
|
|
|
rpc_client
|
|
.send_and_confirm_transaction(&transaction)
|
|
.unwrap();
|
|
}
|