Struct solana_program_test::InvokeContext
source · [−]pub struct InvokeContext<'a> {
pub sysvar_cache: Cow<'a, SysvarCache>,
pub instruction_recorder: Option<&'a InstructionRecorder>,
pub feature_set: Arc<FeatureSet>,
pub timings: ExecuteDetailsTimings,
pub blockhash: Hash,
pub lamports_per_signature: u64,
pub return_data: (Pubkey, Vec<u8, Global>),
/* private fields */
}Fields
sysvar_cache: Cow<'a, SysvarCache>instruction_recorder: Option<&'a InstructionRecorder>feature_set: Arc<FeatureSet>timings: ExecuteDetailsTimingsblockhash: Hashlamports_per_signature: u64return_data: (Pubkey, Vec<u8, Global>)Implementations
pub fn new(
rent: Rent,
accounts: &'a [(Pubkey, Rc<RefCell<AccountSharedData>>)],
builtin_programs: &'a [BuiltinProgram],
sysvar_cache: Cow<'a, SysvarCache>,
log_collector: Option<Rc<RefCell<LogCollector>>>,
compute_budget: ComputeBudget,
executors: Rc<RefCell<HashMap<Pubkey, TransactionExecutor, RandomState>>>,
feature_set: Arc<FeatureSet>,
blockhash: Hash,
lamports_per_signature: u64,
current_accounts_data_len: u64
) -> InvokeContext<'a>
pub fn new_mock(
accounts: &'a [(Pubkey, Rc<RefCell<AccountSharedData>>)],
builtin_programs: &'a [BuiltinProgram]
) -> InvokeContext<'a>
Push a stack frame onto the invocation stack
Current depth of the invocation stack
Entrypoint for a cross-program invocation from a builtin program
Helper to prepare for process_instruction()
pub fn process_instruction(
&mut self,
message: &SanitizedMessage,
instruction: &CompiledInstruction,
program_indices: &[usize],
account_indices: &[usize],
caller_write_privileges: &[bool],
timings: &mut ExecuteTimings
) -> ProcessInstructionResult
pub fn process_instruction(
&mut self,
message: &SanitizedMessage,
instruction: &CompiledInstruction,
program_indices: &[usize],
account_indices: &[usize],
caller_write_privileges: &[bool],
timings: &mut ExecuteTimings
) -> ProcessInstructionResult
Processes a cross-program instruction and returns how many compute units were used
Get the program ID of the currently executing program
Get the owner of the currently executing program
👎 Deprecated since 1.9.0: To be removed together with remove_native_loader
To be removed together with remove_native_loader
Removes the first keyed account
Get the list of keyed accounts
pub fn get_instruction_keyed_accounts(
&self
) -> Result<&[KeyedAccount<'_>], InstructionError>
pub fn get_instruction_keyed_accounts(
&self
) -> Result<&[KeyedAccount<'_>], InstructionError>
Get the list of keyed accounts without the chain of program accounts
Note: This only contains the KeyedAccounts passed by the caller.
Get this invocation’s LogCollector
Get this invocation’s ComputeMeter
Get this invocation’s AccountsDataMeter
Cache an executor that wasn’t found in the cache
Cache an executor that has changed
Get the completed loader work that can be re-used across execution
pub fn get_account(
&self,
pubkey: &Pubkey
) -> Option<(usize, Rc<RefCell<AccountSharedData>>)>
pub fn get_account(
&self,
pubkey: &Pubkey
) -> Option<(usize, Rc<RefCell<AccountSharedData>>)>
Find an account_index and account by its key
Get this invocation’s compute budget
Get cached sysvars
Auto Trait Implementations
impl<'a> !RefUnwindSafe for InvokeContext<'a>
impl<'a> !Send for InvokeContext<'a>
impl<'a> !Sync for InvokeContext<'a>
impl<'a> Unpin for InvokeContext<'a>
impl<'a> !UnwindSafe for InvokeContext<'a>
Blanket Implementations
pub default fn example() -> T
Mutably borrows from an owned value. Read more
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more