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>
This commit is contained in:
Michael Vines
2022-02-15 04:09:59 -08:00
committed by GitHub
parent d2a407a9a7
commit c42b80f099
11 changed files with 2824 additions and 166 deletions

View File

@@ -199,9 +199,16 @@ impl Accounts {
}
}
pub fn new_from_parent(parent: &Accounts, slot: Slot, parent_slot: Slot) -> Self {
pub fn new_from_parent(
parent: &Accounts,
slot: Slot,
parent_slot: Slot,
simulation_bank: bool,
) -> Self {
let accounts_db = parent.accounts_db.clone();
accounts_db.set_hash(slot, parent_slot);
if !simulation_bank {
accounts_db.set_hash(slot, parent_slot);
}
Self {
accounts_db,
account_locks: Mutex::new(AccountLocks::default()),