pub struct InvokeContext<'a> {
pub transaction_context: &'a mut TransactionContext,
pub sysvar_cache: Cow<'a, SysvarCache>,
pub feature_set: Arc<FeatureSet>,
pub timings: ExecuteDetailsTimings,
pub blockhash: Hash,
pub lamports_per_signature: u64,
/* private fields */
}
Fields§
§transaction_context: &'a mut TransactionContext
§sysvar_cache: Cow<'a, SysvarCache>
§feature_set: Arc<FeatureSet>
§timings: ExecuteDetailsTimings
§blockhash: Hash
§lamports_per_signature: u64
Implementations§
Source§impl<'a> InvokeContext<'a>
impl<'a> InvokeContext<'a>
pub fn new( transaction_context: &'a mut TransactionContext, rent: Rent, builtin_programs: &'a [BuiltinProgram], sysvar_cache: Cow<'a, SysvarCache>, log_collector: Option<Rc<RefCell<LogCollector>>>, compute_budget: ComputeBudget, executors: Rc<RefCell<HashMap<Pubkey, TransactionExecutor>>>, feature_set: Arc<FeatureSet>, blockhash: Hash, lamports_per_signature: u64, prev_accounts_data_len: u64, ) -> InvokeContext<'a>
pub fn new_mock( transaction_context: &'a mut TransactionContext, builtin_programs: &'a [BuiltinProgram], ) -> InvokeContext<'a>
Sourcepub fn push(
&mut self,
instruction_accounts: &[InstructionAccount],
program_indices: &[usize],
instruction_data: &[u8],
) -> Result<(), InstructionError>
pub fn push( &mut self, instruction_accounts: &[InstructionAccount], program_indices: &[usize], instruction_data: &[u8], ) -> Result<(), InstructionError>
Push a stack frame onto the invocation stack
Sourcepub fn pop(&mut self) -> Result<(), InstructionError>
pub fn pop(&mut self) -> Result<(), InstructionError>
Pop a stack frame from 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_sdk::instruction::TRANSACTION_LEVEL_STACK_HEIGHT
Sourcepub fn native_invoke(
&mut self,
instruction: Instruction,
signers: &[Pubkey],
) -> Result<(), InstructionError>
pub fn native_invoke( &mut self, instruction: Instruction, signers: &[Pubkey], ) -> Result<(), InstructionError>
Entrypoint for a cross-program invocation from a builtin program
Sourcepub fn prepare_instruction(
&mut self,
instruction: &Instruction,
signers: &[Pubkey],
) -> Result<(Vec<InstructionAccount>, Vec<usize>), InstructionError>
pub fn prepare_instruction( &mut self, instruction: &Instruction, signers: &[Pubkey], ) -> Result<(Vec<InstructionAccount>, Vec<usize>), InstructionError>
Helper to prepare for process_instruction()
Sourcepub fn process_instruction(
&mut self,
instruction_data: &[u8],
instruction_accounts: &[InstructionAccount],
program_indices: &[usize],
compute_units_consumed: &mut u64,
timings: &mut ExecuteTimings,
) -> Result<(), InstructionError>
pub fn process_instruction( &mut self, instruction_data: &[u8], instruction_accounts: &[InstructionAccount], program_indices: &[usize], compute_units_consumed: &mut u64, timings: &mut ExecuteTimings, ) -> Result<(), InstructionError>
Processes an instruction and returns how many compute units were used
Sourcepub fn get_keyed_accounts(
&self,
) -> Result<&[KeyedAccount<'_>], InstructionError>
👎Deprecated since 1.11.0: Please use BorrowedAccount instead of KeyedAccount
pub fn get_keyed_accounts( &self, ) -> Result<&[KeyedAccount<'_>], InstructionError>
Get the list of keyed accounts including the chain of program accounts
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 get_compute_meter(&self) -> Rc<RefCell<ComputeMeter>>
pub fn get_compute_meter(&self) -> Rc<RefCell<ComputeMeter>>
Get this invocation’s ComputeMeter
Sourcepub fn get_accounts_data_meter(&self) -> &AccountsDataMeter
pub fn get_accounts_data_meter(&self) -> &AccountsDataMeter
Get this invocation’s AccountsDataMeter
Sourcepub fn add_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>)
pub fn add_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>)
Cache an executor that wasn’t found in the cache
Sourcepub fn update_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>)
pub fn update_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>)
Cache an executor that has changed
Sourcepub fn get_executor(&self, pubkey: &Pubkey) -> Option<Arc<dyn Executor>>
pub fn get_executor(&self, pubkey: &Pubkey) -> Option<Arc<dyn Executor>>
Get the completed loader work that can be re-used across execution
Sourcepub fn get_compute_budget(&self) -> &ComputeBudget
pub fn get_compute_budget(&self) -> &ComputeBudget
Get this invocation’s compute budget
Sourcepub fn get_sysvar_cache(&self) -> &SysvarCache
pub fn get_sysvar_cache(&self) -> &SysvarCache
Get cached sysvars
pub fn get_key_of_account_at_index( &self, index_in_transaction: usize, ) -> Result<&Pubkey, InstructionError>
pub fn set_syscall_context( &mut self, check_aligned: bool, check_size: bool, orig_account_lengths: Vec<usize>, allocator: Rc<RefCell<dyn Alloc>>, ) -> Result<(), InstructionError>
pub fn get_check_aligned(&self) -> bool
pub fn get_check_size(&self) -> bool
Sourcepub fn get_orig_account_lengths(&self) -> Result<&[usize], InstructionError>
pub fn get_orig_account_lengths(&self) -> Result<&[usize], InstructionError>
Get the original account lengths
pub fn get_allocator(&self) -> Result<Rc<RefCell<dyn Alloc>>, InstructionError>
Auto Trait Implementations§
impl<'a> Freeze for InvokeContext<'a>
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§
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