pub struct InvokeContext<'a> {Show 16 fields
pub transaction_context: &'a mut TransactionContext,
rent: Rent,
pre_accounts: Vec<PreAccount>,
builtin_programs: &'a [BuiltinProgram],
sysvar_cache: &'a SysvarCache,
log_collector: Option<Rc<RefCell<LogCollector>>>,
compute_budget: ComputeBudget,
current_compute_budget: ComputeBudget,
compute_meter: RefCell<u64>,
accounts_data_meter: AccountsDataMeter,
pub tx_executor_cache: Rc<RefCell<TransactionExecutorCache>>,
pub feature_set: Arc<FeatureSet>,
pub timings: ExecuteDetailsTimings,
pub blockhash: Hash,
pub lamports_per_signature: u64,
pub syscall_context: Vec<Option<SyscallContext>>,
}
Fields§
§transaction_context: &'a mut TransactionContext
§rent: Rent
§pre_accounts: Vec<PreAccount>
§builtin_programs: &'a [BuiltinProgram]
§sysvar_cache: &'a SysvarCache
§log_collector: Option<Rc<RefCell<LogCollector>>>
§compute_budget: ComputeBudget
§current_compute_budget: ComputeBudget
§compute_meter: RefCell<u64>
§accounts_data_meter: AccountsDataMeter
§tx_executor_cache: Rc<RefCell<TransactionExecutorCache>>
§feature_set: Arc<FeatureSet>
§timings: ExecuteDetailsTimings
§blockhash: Hash
§lamports_per_signature: u64
§syscall_context: Vec<Option<SyscallContext>>
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: &'a SysvarCache, log_collector: Option<Rc<RefCell<LogCollector>>>, compute_budget: ComputeBudget, tx_executor_cache: Rc<RefCell<TransactionExecutorCache>>, feature_set: Arc<FeatureSet>, blockhash: Hash, lamports_per_signature: u64, prev_accounts_data_len: u64 ) -> Self
sourcepub fn push(&mut self) -> Result<(), InstructionError>
pub fn push(&mut self) -> 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
sourcefn verify(
&mut self,
instruction_accounts: &[InstructionAccount],
program_indices: &[IndexOfAccount]
) -> Result<(), InstructionError>
fn verify( &mut self, instruction_accounts: &[InstructionAccount], program_indices: &[IndexOfAccount] ) -> Result<(), InstructionError>
Verify the results of an instruction
Note: instruction_accounts
must be the same as passed to InvokeContext::push()
,
so that they match the order of pre_accounts
.
sourcefn verify_and_update(
&mut self,
instruction_accounts: &[InstructionAccount],
before_instruction_context_push: bool
) -> Result<(), InstructionError>
fn verify_and_update( &mut self, instruction_accounts: &[InstructionAccount], before_instruction_context_push: bool ) -> Result<(), InstructionError>
Verify and update PreAccount state based on program execution
Note: instruction_accounts
must be the same as passed to InvokeContext::push()
,
so that they match the order of pre_accounts
.
sourcepub fn native_invoke(
&mut self,
instruction: StableInstruction,
signers: &[Pubkey]
) -> Result<(), InstructionError>
pub fn native_invoke( &mut self, instruction: StableInstruction, signers: &[Pubkey] ) -> Result<(), InstructionError>
Entrypoint for a cross-program invocation from a builtin program
sourcepub fn prepare_instruction(
&mut self,
instruction: &StableInstruction,
signers: &[Pubkey]
) -> Result<(Vec<InstructionAccount>, Vec<IndexOfAccount>), InstructionError>
pub fn prepare_instruction( &mut self, instruction: &StableInstruction, signers: &[Pubkey] ) -> Result<(Vec<InstructionAccount>, Vec<IndexOfAccount>), InstructionError>
Helper to prepare for process_instruction()
sourcepub fn process_instruction(
&mut self,
instruction_data: &[u8],
instruction_accounts: &[InstructionAccount],
program_indices: &[IndexOfAccount],
compute_units_consumed: &mut u64,
timings: &mut ExecuteTimings
) -> Result<(), InstructionError>
pub fn process_instruction( &mut self, instruction_data: &[u8], instruction_accounts: &[InstructionAccount], program_indices: &[IndexOfAccount], compute_units_consumed: &mut u64, timings: &mut ExecuteTimings ) -> Result<(), InstructionError>
Processes an instruction and returns how many compute units were used
sourcefn process_executable_chain(
&mut self,
compute_units_consumed: &mut u64,
timings: &mut ExecuteTimings
) -> Result<(), InstructionError>
fn process_executable_chain( &mut self, compute_units_consumed: &mut u64, timings: &mut ExecuteTimings ) -> Result<(), InstructionError>
Calls the instruction’s program entrypoint method
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_accounts_data_meter(&self) -> &AccountsDataMeter
pub fn get_accounts_data_meter(&self) -> &AccountsDataMeter
Get this invocation’s AccountsDataMeter
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