Add address lookup table program (#21616)

* Add address lookup table program

* feedback
This commit is contained in:
Justin Starry
2021-12-10 16:02:16 -05:00
committed by GitHub
parent a5a0dabe7b
commit 9b41ddd9ba
21 changed files with 1665 additions and 4 deletions

View File

@ -41,7 +41,7 @@ use {
sysvar::{
clock, epoch_schedule,
fees::{self},
rent, Sysvar,
rent, Sysvar, SysvarId,
},
},
solana_vote_program::vote_state::{VoteState, VoteStateVersions},
@ -1045,6 +1045,18 @@ impl ProgramTestContext {
bank.store_account(address, account);
}
/// Create or overwrite a sysvar, subverting normal runtime checks.
///
/// This method exists to make it easier to set up artificial situations
/// that would be difficult to replicate on a new test cluster. Beware
/// that it can be used to create states that would not be reachable
/// under normal conditions!
pub fn set_sysvar<T: SysvarId + Sysvar>(&self, sysvar: &T) {
let bank_forks = self.bank_forks.read().unwrap();
let bank = bank_forks.working_bank();
bank.set_sysvar_for_tests(sysvar);
}
/// Force the working bank ahead to a new slot
pub fn warp_to_slot(&mut self, warp_slot: Slot) -> Result<(), ProgramTestError> {
let mut bank_forks = self.bank_forks.write().unwrap();