Trait solana_sdk::process_instruction::InvokeContext
source · [−]pub trait InvokeContext {
Show 22 methods
fn push(
&mut self,
key: &Pubkey,
keyed_accounts: &[(bool, bool, &Pubkey, &RefCell<AccountSharedData>)]
) -> Result<(), InstructionError>;
fn pop(&mut self);
fn invoke_depth(&self) -> usize;
fn verify_and_update(
&mut self,
instruction: &CompiledInstruction,
accounts: &[(Pubkey, Rc<RefCell<AccountSharedData>>)],
write_privileges: &[bool]
) -> Result<(), InstructionError>;
fn get_caller(&self) -> Result<&Pubkey, InstructionError>;
fn remove_first_keyed_account(&mut self) -> Result<(), InstructionError>;
fn get_keyed_accounts(
&self
) -> Result<&[KeyedAccount<'_>], InstructionError>;
fn get_programs(&self) -> &[(Pubkey, ProcessInstructionWithContext)];
fn get_logger(&self) -> Rc<RefCell<dyn Logger>>;
fn get_bpf_compute_budget(&self) -> &BpfComputeBudget;
fn get_compute_meter(&self) -> Rc<RefCell<dyn ComputeMeter>>;
fn add_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>);
fn update_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>);
fn get_executor(&self, pubkey: &Pubkey) -> Option<Arc<dyn Executor>>;
fn record_instruction(&self, instruction: &Instruction);
fn is_feature_active(&self, feature_id: &Pubkey) -> bool;
fn get_account(
&self,
pubkey: &Pubkey
) -> Option<Rc<RefCell<AccountSharedData>>>;
fn update_timing(
&mut self,
serialize_us: u64,
create_vm_us: u64,
execute_us: u64,
deserialize_us: u64
);
fn get_sysvar_data(&self, id: &Pubkey) -> Option<Rc<Vec<u8>>>;
fn set_return_data(&mut self, return_data: Option<(Pubkey, Vec<u8>)>);
fn get_return_data(&self) -> &Option<(Pubkey, Vec<u8>)>;
fn get_timings(&mut self) -> &mut ExecuteDetailsTimings;
}
Expand description
Invocation context passed to loaders
Required methods
Push a stack frame onto the invocation stack
Used in MessageProcessor::process_cross_program_instruction
Pop a stack frame from the invocation stack
Used in MessageProcessor::process_cross_program_instruction
fn invoke_depth(&self) -> usize
fn invoke_depth(&self) -> usize
Current depth of the invocation stake
fn verify_and_update(
&mut self,
instruction: &CompiledInstruction,
accounts: &[(Pubkey, Rc<RefCell<AccountSharedData>>)],
write_privileges: &[bool]
) -> Result<(), InstructionError>
fn verify_and_update(
&mut self,
instruction: &CompiledInstruction,
accounts: &[(Pubkey, Rc<RefCell<AccountSharedData>>)],
write_privileges: &[bool]
) -> Result<(), InstructionError>
Verify and update PreAccount state based on program execution
fn get_caller(&self) -> Result<&Pubkey, InstructionError>
fn get_caller(&self) -> Result<&Pubkey, InstructionError>
Get the program ID of the currently executing program
fn remove_first_keyed_account(&mut self) -> Result<(), InstructionError>
fn remove_first_keyed_account(&mut self) -> Result<(), InstructionError>
Removes the first keyed account
fn get_keyed_accounts(&self) -> Result<&[KeyedAccount<'_>], InstructionError>
fn get_keyed_accounts(&self) -> Result<&[KeyedAccount<'_>], InstructionError>
Get the list of keyed accounts
fn get_programs(&self) -> &[(Pubkey, ProcessInstructionWithContext)]
fn get_programs(&self) -> &[(Pubkey, ProcessInstructionWithContext)]
Get a list of built-in programs
fn get_logger(&self) -> Rc<RefCell<dyn Logger>>
fn get_logger(&self) -> Rc<RefCell<dyn Logger>>
Get this invocation’s logger
fn get_bpf_compute_budget(&self) -> &BpfComputeBudget
fn get_bpf_compute_budget(&self) -> &BpfComputeBudget
Get this invocation’s compute budget
fn get_compute_meter(&self) -> Rc<RefCell<dyn ComputeMeter>>
fn get_compute_meter(&self) -> Rc<RefCell<dyn ComputeMeter>>
Get this invocation’s compute meter
fn add_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>)
fn add_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>)
Loaders may need to do work in order to execute a program. Cache the work that can be re-used across executions
fn update_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>)
fn update_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>)
Cache an executor that has changed
Get the completed loader work that can be re-used across executions
fn record_instruction(&self, instruction: &Instruction)
fn record_instruction(&self, instruction: &Instruction)
Record invoked instruction
fn is_feature_active(&self, feature_id: &Pubkey) -> bool
fn is_feature_active(&self, feature_id: &Pubkey) -> bool
Get the bank’s active feature set
fn get_account(&self, pubkey: &Pubkey) -> Option<Rc<RefCell<AccountSharedData>>>
fn get_account(&self, pubkey: &Pubkey) -> Option<Rc<RefCell<AccountSharedData>>>
Get an account by its key
Update timing
fn get_timings(&mut self) -> &mut ExecuteDetailsTimings
fn get_timings(&mut self) -> &mut ExecuteDetailsTimings
Get timings