pub struct ProgramTestContext {
pub banks_client: BanksClient,
pub last_blockhash: Hash,
pub payer: Keypair,
/* private fields */
}
Fields§
§banks_client: BanksClient
§last_blockhash: Hash
§payer: Keypair
Implementations§
Source§impl ProgramTestContext
impl ProgramTestContext
pub fn genesis_config(&self) -> &GenesisConfig
Sourcepub fn increment_vote_account_credits(
&mut self,
vote_account_address: &Pubkey,
number_of_credits: u64,
)
pub fn increment_vote_account_credits( &mut self, vote_account_address: &Pubkey, number_of_credits: u64, )
Manually increment vote credits for the current epoch in the specified vote account to simulate validator voting activity
Sourcepub fn set_account(&mut self, address: &Pubkey, account: &AccountSharedData)
pub fn set_account(&mut self, address: &Pubkey, account: &AccountSharedData)
Create or overwrite an account, subverting normal runtime checks.
This method exists to make it easier to set up artificial situations that would be difficult to replicate by sending individual transactions. Beware that it can be used to create states that would not be reachable by sending transactions!
Sourcepub fn set_sysvar<T: SysvarId + Sysvar>(&self, sysvar: &T)
pub fn set_sysvar<T: SysvarId + Sysvar>(&self, sysvar: &T)
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!
Sourcepub fn warp_to_slot(&mut self, warp_slot: Slot) -> Result<(), ProgramTestError>
pub fn warp_to_slot(&mut self, warp_slot: Slot) -> Result<(), ProgramTestError>
Force the working bank ahead to a new slot
pub fn warp_to_epoch( &mut self, warp_epoch: Epoch, ) -> Result<(), ProgramTestError>
Sourcepub fn warp_forward_force_reward_interval_end(
&mut self,
) -> Result<(), ProgramTestError>
pub fn warp_forward_force_reward_interval_end( &mut self, ) -> Result<(), ProgramTestError>
warp forward one more slot and force reward interval end
Sourcepub async fn get_new_latest_blockhash(&mut self) -> Result<Hash>
pub async fn get_new_latest_blockhash(&mut self) -> Result<Hash>
Get a new latest blockhash, similar in spirit to RpcClient::get_latest_blockhash()
Sourcepub fn register_hard_fork(&mut self, hard_fork_slot: Slot)
pub fn register_hard_fork(&mut self, hard_fork_slot: Slot)
record a hard fork slot in working bank; should be in the past
Auto Trait Implementations§
impl Freeze for ProgramTestContext
impl RefUnwindSafe for ProgramTestContext
impl Send for ProgramTestContext
impl Sync for ProgramTestContext
impl Unpin for ProgramTestContext
impl UnwindSafe for ProgramTestContext
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more