pub struct InvokeContext<'a, 'ix_data> {
pub transaction_context: &'a mut TransactionContext<'ix_data>,
pub program_cache_for_tx_batch: &'a mut ProgramCacheForTxBatch,
pub environment_config: EnvironmentConfig<'a>,
pub execute_time: Option<Measure>,
pub timings: ExecuteDetailsTimings,
pub syscall_context: Vec<Option<SyscallContext>>,
/* private fields */
}This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Expand description
Main pipeline from runtime to program execution.
Fields§
§transaction_context: &'a mut TransactionContext<'ix_data>This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Information about the currently executing transaction.
program_cache_for_tx_batch: &'a mut ProgramCacheForTxBatchThis crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
The local program cache for the transaction batch.
environment_config: EnvironmentConfig<'a>This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Runtime configurations used to provision the invocation environment.
execute_time: Option<Measure>This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Latest measurement not yet accumulated in ExecuteDetailsTimings::execute_us
timings: ExecuteDetailsTimingsThis crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
syscall_context: Vec<Option<SyscallContext>>This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Implementations§
Source§impl<'a, 'ix_data> InvokeContext<'a, 'ix_data>
impl<'a, 'ix_data> InvokeContext<'a, 'ix_data>
pub fn new( transaction_context: &'a mut TransactionContext<'ix_data>, program_cache_for_tx_batch: &'a mut ProgramCacheForTxBatch, environment_config: EnvironmentConfig<'a>, log_collector: Option<Rc<RefCell<LogCollector>>>, compute_budget: SVMTransactionExecutionBudget, execution_cost: SVMTransactionExecutionCost, ) -> Self
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Sourcepub fn push(&mut self) -> Result<(), InstructionError>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn push(&mut self) -> Result<(), InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Push a stack frame onto the invocation stack
Sourcepub fn get_stack_height(&self) -> usize
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_stack_height(&self) -> usize
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Current height of the invocation stack, top level instructions are height
solana_instruction::TRANSACTION_LEVEL_STACK_HEIGHT
Sourcepub fn native_invoke(
&mut self,
instruction: Instruction,
signers: &[Pubkey],
) -> Result<(), InstructionError>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn native_invoke( &mut self, instruction: Instruction, signers: &[Pubkey], ) -> Result<(), InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Entrypoint for a cross-program invocation from a builtin program
Sourcepub fn prepare_next_instruction(
&mut self,
instruction: Instruction,
signers: &[Pubkey],
) -> Result<(), InstructionError>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn prepare_next_instruction( &mut self, instruction: Instruction, signers: &[Pubkey], ) -> Result<(), InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Helper to prepare for process_instruction() when the instruction is not a top level one,
and depends on AccountMetas
Sourcepub fn prepare_next_top_level_instruction(
&mut self,
message: &impl SVMMessage,
instruction: &SVMInstruction<'_>,
program_account_index: IndexOfAccount,
data: &'ix_data [u8],
) -> Result<(), InstructionError>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn prepare_next_top_level_instruction( &mut self, message: &impl SVMMessage, instruction: &SVMInstruction<'_>, program_account_index: IndexOfAccount, data: &'ix_data [u8], ) -> Result<(), InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Helper to prepare for process_instruction()/process_precompile() when the instruction is a top level one
Sourcepub fn process_instruction(
&mut self,
compute_units_consumed: &mut u64,
timings: &mut ExecuteTimings,
) -> Result<(), InstructionError>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn process_instruction( &mut self, compute_units_consumed: &mut u64, timings: &mut ExecuteTimings, ) -> Result<(), InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Processes an instruction and returns how many compute units were used
Sourcepub fn process_precompile(
&mut self,
program_id: &Pubkey,
instruction_data: &[u8],
message_instruction_datas_iter: impl Iterator<Item = &'ix_data [u8]>,
) -> Result<(), InstructionError>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn process_precompile( &mut self, program_id: &Pubkey, instruction_data: &[u8], message_instruction_datas_iter: impl Iterator<Item = &'ix_data [u8]>, ) -> Result<(), InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Processes a precompile instruction
Sourcepub fn get_log_collector(&self) -> Option<Rc<RefCell<LogCollector>>>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_log_collector(&self) -> Option<Rc<RefCell<LogCollector>>>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Get this invocation’s LogCollector
Sourcepub fn consume_checked(&self, amount: u64) -> Result<(), Box<dyn Error>>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn consume_checked(&self, amount: u64) -> Result<(), Box<dyn Error>>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Consume compute units
Sourcepub fn mock_set_remaining(&self, remaining: u64)
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn mock_set_remaining(&self, remaining: u64)
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Set compute units
Only use for tests and benchmarks
Sourcepub fn get_compute_budget(&self) -> &SVMTransactionExecutionBudget
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_compute_budget(&self) -> &SVMTransactionExecutionBudget
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Get this invocation’s compute budget
Sourcepub fn get_execution_cost(&self) -> &SVMTransactionExecutionCost
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_execution_cost(&self) -> &SVMTransactionExecutionCost
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Get this invocation’s compute budget
Sourcepub fn get_feature_set(&self) -> &SVMFeatureSet
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_feature_set(&self) -> &SVMFeatureSet
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Get the current feature set.
pub fn get_program_runtime_environments_for_deployment( &self, ) -> &ProgramRuntimeEnvironments
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn is_stake_raise_minimum_delegation_to_1_sol_active(&self) -> bool
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn is_deprecate_legacy_vote_ixs_active(&self) -> bool
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Sourcepub fn get_sysvar_cache(&self) -> &SysvarCache
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_sysvar_cache(&self) -> &SysvarCache
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Get cached sysvars
Sourcepub fn get_epoch_stake(&self) -> u64
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_epoch_stake(&self) -> u64
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Get cached epoch total stake.
Sourcepub fn get_epoch_stake_for_vote_account(&self, pubkey: &'a Pubkey) -> u64
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_epoch_stake_for_vote_account(&self, pubkey: &'a Pubkey) -> u64
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Get cached stake for the epoch vote account.
pub fn is_precompile(&self, pubkey: &Pubkey) -> bool
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_check_aligned(&self) -> bool
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn set_syscall_context( &mut self, syscall_context: SyscallContext, ) -> Result<(), InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_syscall_context(&self) -> Result<&SyscallContext, InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn get_syscall_context_mut( &mut self, ) -> Result<&mut SyscallContext, InstructionError>
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Sourcepub fn insert_register_trace(&mut self, register_trace: Vec<[u64; 12]>)
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn insert_register_trace(&mut self, register_trace: Vec<[u64; 12]>)
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Insert a VM register trace
Sourcepub fn iterate_vm_traces(
&self,
callback: &dyn Fn(InstructionContext<'_, '_>, &Executable, RegisterTrace<'_>),
)
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn iterate_vm_traces( &self, callback: &dyn Fn(InstructionContext<'_, '_>, &Executable, RegisterTrace<'_>), )
This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Iterates over all VM register traces (including CPI)
Trait Implementations§
Source§impl ContextObject for InvokeContext<'_, '_>
impl ContextObject for InvokeContext<'_, '_>
Auto Trait Implementations§
impl<'a, 'ix_data> !Freeze for InvokeContext<'a, 'ix_data>
impl<'a, 'ix_data> !RefUnwindSafe for InvokeContext<'a, 'ix_data>
impl<'a, 'ix_data> !Send for InvokeContext<'a, 'ix_data>
impl<'a, 'ix_data> !Sync for InvokeContext<'a, 'ix_data>
impl<'a, 'ix_data> Unpin for InvokeContext<'a, 'ix_data>
impl<'a, 'ix_data> UnsafeUnpin for InvokeContext<'a, 'ix_data>
impl<'a, 'ix_data> !UnwindSafe for InvokeContext<'a, 'ix_data>
Blanket Implementations§
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> 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