Add address lookup table program (backport #21616) (#21789)

* Add address lookup table program (#21616)

* Add address lookup table program

* feedback

(cherry picked from commit 9b41ddd9ba)

# Conflicts:
#	runtime/Cargo.toml

* resolve conflicts

Co-authored-by: Justin Starry <justin@solana.com>
This commit is contained in:
mergify[bot]
2021-12-11 05:26:46 +00:00
committed by GitHub
parent 7782d34bbf
commit 5bf4445ae6
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();