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 */
}Expand description
Main pipeline from runtime to program execution.
Fields§
§transaction_context: &'a mut TransactionContext<'ix_data>Information about the currently executing transaction.
program_cache_for_tx_batch: &'a mut ProgramCacheForTxBatchThe local program cache for the transaction batch.
environment_config: EnvironmentConfig<'a>Runtime configurations used to provision the invocation environment.
execute_time: Option<Measure>Latest measurement not yet accumulated in ExecuteDetailsTimings::execute_us
timings: ExecuteDetailsTimings§syscall_context: Vec<Option<SyscallContext>>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, ) -> InvokeContext<'a, 'ix_data>
Sourcepub fn push(&mut self) -> Result<(), InstructionError>
pub fn push(&mut self) -> Result<(), InstructionError>
Push a stack frame onto the invocation stack
Sourcepub fn get_stack_height(&self) -> usize
pub fn get_stack_height(&self) -> usize
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: &[Address],
) -> Result<(), InstructionError>
pub fn native_invoke( &mut self, instruction: Instruction, signers: &[Address], ) -> Result<(), InstructionError>
Entrypoint for a cross-program invocation from a builtin program
Sourcepub fn prepare_next_instruction(
&mut self,
instruction: Instruction,
signers: &[Address],
) -> Result<(), InstructionError>
pub fn prepare_next_instruction( &mut self, instruction: Instruction, signers: &[Address], ) -> Result<(), InstructionError>
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: u16,
data: &'ix_data [u8],
) -> Result<(), InstructionError>
pub fn prepare_next_top_level_instruction( &mut self, message: &impl SVMMessage, instruction: &SVMInstruction<'_>, program_account_index: u16, data: &'ix_data [u8], ) -> Result<(), InstructionError>
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>
pub fn process_instruction( &mut self, compute_units_consumed: &mut u64, timings: &mut ExecuteTimings, ) -> Result<(), InstructionError>
Processes an instruction and returns how many compute units were used
Sourcepub fn process_precompile(
&mut self,
program_id: &Address,
instruction_data: &[u8],
message_instruction_datas_iter: impl Iterator<Item = &'ix_data [u8]>,
) -> Result<(), InstructionError>
pub fn process_precompile( &mut self, program_id: &Address, instruction_data: &[u8], message_instruction_datas_iter: impl Iterator<Item = &'ix_data [u8]>, ) -> Result<(), InstructionError>
Processes a precompile instruction
Sourcepub fn get_log_collector(&self) -> Option<Rc<RefCell<LogCollector>>>
pub fn get_log_collector(&self) -> Option<Rc<RefCell<LogCollector>>>
Get this invocation’s LogCollector
Sourcepub fn mock_set_remaining(&self, remaining: u64)
pub fn mock_set_remaining(&self, remaining: u64)
Set compute units
Only use for tests and benchmarks
Sourcepub fn get_compute_budget(&self) -> &SVMTransactionExecutionBudget
pub fn get_compute_budget(&self) -> &SVMTransactionExecutionBudget
Get this invocation’s compute budget
Sourcepub fn get_execution_cost(&self) -> &SVMTransactionExecutionCost
pub fn get_execution_cost(&self) -> &SVMTransactionExecutionCost
Get this invocation’s compute budget
Sourcepub fn get_feature_set(&self) -> &SVMFeatureSet
pub fn get_feature_set(&self) -> &SVMFeatureSet
Get the current feature set.
pub fn get_program_runtime_environments_for_deployment( &self, ) -> &ProgramRuntimeEnvironments
pub fn is_stake_raise_minimum_delegation_to_1_sol_active(&self) -> bool
pub fn is_deprecate_legacy_vote_ixs_active(&self) -> bool
Sourcepub fn get_sysvar_cache(&self) -> &SysvarCache
pub fn get_sysvar_cache(&self) -> &SysvarCache
Get cached sysvars
Sourcepub fn get_epoch_stake(&self) -> u64
pub fn get_epoch_stake(&self) -> u64
Get cached epoch total stake.
Sourcepub fn get_epoch_stake_for_vote_account(&self, pubkey: &'a Address) -> u64
pub fn get_epoch_stake_for_vote_account(&self, pubkey: &'a Address) -> u64
Get cached stake for the epoch vote account.
pub fn is_precompile(&self, pubkey: &Address) -> bool
pub fn get_check_aligned(&self) -> bool
pub fn set_syscall_context( &mut self, syscall_context: SyscallContext, ) -> Result<(), InstructionError>
pub fn get_syscall_context(&self) -> Result<&SyscallContext, InstructionError>
pub fn get_syscall_context_mut( &mut self, ) -> Result<&mut SyscallContext, InstructionError>
Sourcepub fn insert_register_trace(&mut self, register_trace: Vec<[u64; 12]>)
pub fn insert_register_trace(&mut self, register_trace: Vec<[u64; 12]>)
Insert a VM register trace
Sourcepub fn iterate_vm_traces(
&self,
callback: &dyn Fn(InstructionContext<'_, '_>, &Executable<InvokeContext<'static, 'static>>, &[[u64; 12]]),
)
pub fn iterate_vm_traces( &self, callback: &dyn Fn(InstructionContext<'_, '_>, &Executable<InvokeContext<'static, 'static>>, &[[u64; 12]]), )
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> !UnwindSafe for InvokeContext<'a, 'ix_data>
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.