Struct solana_sdk::process_instruction::MockInvokeContext
source · [−]pub struct MockInvokeContext<'a> {
pub invoke_stack: Vec<InvokeContextStackFrame<'a>>,
pub logger: MockLogger,
pub bpf_compute_budget: BpfComputeBudget,
pub compute_meter: MockComputeMeter,
pub programs: Vec<(Pubkey, ProcessInstructionWithContext)>,
pub accounts: Vec<(Pubkey, Rc<RefCell<AccountSharedData>>)>,
pub sysvar_cache: Cow<'a, SysvarCache>,
pub disabled_features: HashSet<Pubkey>,
pub return_data: Option<(Pubkey, Vec<u8>)>,
pub execute_timings: ExecuteDetailsTimings,
}
Fields
invoke_stack: Vec<InvokeContextStackFrame<'a>>
logger: MockLogger
bpf_compute_budget: BpfComputeBudget
compute_meter: MockComputeMeter
programs: Vec<(Pubkey, ProcessInstructionWithContext)>
accounts: Vec<(Pubkey, Rc<RefCell<AccountSharedData>>)>
sysvar_cache: Cow<'a, SysvarCache>
disabled_features: HashSet<Pubkey>
return_data: Option<(Pubkey, Vec<u8>)>
execute_timings: ExecuteDetailsTimings
Implementations
sourceimpl<'a> MockInvokeContext<'a>
impl<'a> MockInvokeContext<'a>
pub fn new(keyed_accounts: Vec<KeyedAccount<'a>>) -> Self
Trait Implementations
sourceimpl<'a> InvokeContext for MockInvokeContext<'a>
impl<'a> InvokeContext for MockInvokeContext<'a>
sourcefn push(
&mut self,
key: &Pubkey,
keyed_accounts: &[(bool, bool, &Pubkey, &RefCell<AccountSharedData>)]
) -> Result<(), InstructionError>
fn push(
&mut self,
key: &Pubkey,
keyed_accounts: &[(bool, bool, &Pubkey, &RefCell<AccountSharedData>)]
) -> Result<(), InstructionError>
Push a stack frame onto the invocation stack Read more
sourcefn invoke_depth(&self) -> usize
fn invoke_depth(&self) -> usize
Current depth of the invocation stake
sourcefn verify_and_update(
&mut self,
_instruction: &CompiledInstruction,
_accounts: &[(Pubkey, Rc<RefCell<AccountSharedData>>)],
_write_pivileges: &[bool]
) -> Result<(), InstructionError>
fn verify_and_update(
&mut self,
_instruction: &CompiledInstruction,
_accounts: &[(Pubkey, Rc<RefCell<AccountSharedData>>)],
_write_pivileges: &[bool]
) -> Result<(), InstructionError>
Verify and update PreAccount state based on program execution
sourcefn get_caller(&self) -> Result<&Pubkey, InstructionError>
fn get_caller(&self) -> Result<&Pubkey, InstructionError>
Get the program ID of the currently executing program
sourcefn remove_first_keyed_account(&mut self) -> Result<(), InstructionError>
fn remove_first_keyed_account(&mut self) -> Result<(), InstructionError>
Removes the first keyed account
sourcefn get_keyed_accounts(&self) -> Result<&[KeyedAccount<'_>], InstructionError>
fn get_keyed_accounts(&self) -> Result<&[KeyedAccount<'_>], InstructionError>
Get the list of keyed accounts
sourcefn get_programs(&self) -> &[(Pubkey, ProcessInstructionWithContext)]
fn get_programs(&self) -> &[(Pubkey, ProcessInstructionWithContext)]
Get a list of built-in programs
sourcefn get_logger(&self) -> Rc<RefCell<dyn Logger>>
fn get_logger(&self) -> Rc<RefCell<dyn Logger>>
Get this invocation’s logger
sourcefn get_bpf_compute_budget(&self) -> &BpfComputeBudget
fn get_bpf_compute_budget(&self) -> &BpfComputeBudget
Get this invocation’s compute budget
sourcefn get_compute_meter(&self) -> Rc<RefCell<dyn ComputeMeter>>
fn get_compute_meter(&self) -> Rc<RefCell<dyn ComputeMeter>>
Get this invocation’s compute meter
sourcefn 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 Read more
sourcefn 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
sourcefn get_executor(&self, _pubkey: &Pubkey) -> Option<Arc<dyn Executor>>
fn get_executor(&self, _pubkey: &Pubkey) -> Option<Arc<dyn Executor>>
Get the completed loader work that can be re-used across executions
sourcefn record_instruction(&self, _instruction: &Instruction)
fn record_instruction(&self, _instruction: &Instruction)
Record invoked instruction
sourcefn is_feature_active(&self, feature_id: &Pubkey) -> bool
fn is_feature_active(&self, feature_id: &Pubkey) -> bool
Get the bank’s active feature set
sourcefn 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
sourcefn update_timing(
&mut self,
_serialize_us: u64,
_create_vm_us: u64,
_execute_us: u64,
_deserialize_us: u64
)
fn update_timing(
&mut self,
_serialize_us: u64,
_create_vm_us: u64,
_execute_us: u64,
_deserialize_us: u64
)
Update timing
sourcefn get_sysvar_cache(&self) -> &SysvarCache
fn get_sysvar_cache(&self) -> &SysvarCache
Get sysvar cache
sourcefn get_timings(&mut self) -> &mut ExecuteDetailsTimings
fn get_timings(&mut self) -> &mut ExecuteDetailsTimings
Get timings
Auto Trait Implementations
impl<'a> !RefUnwindSafe for MockInvokeContext<'a>
impl<'a> !Send for MockInvokeContext<'a>
impl<'a> !Sync for MockInvokeContext<'a>
impl<'a> Unpin for MockInvokeContext<'a>
impl<'a> !UnwindSafe for MockInvokeContext<'a>
Blanket Implementations
sourceimpl<T> AbiExample for T
impl<T> AbiExample for T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more