Record and store invoked instructions in transaction meta (#12311)
* Record invoked instructions and store in transaction meta * Enable cpi recording if transaction sender is some * Rename invoked to innerInstructions
This commit is contained in:
@ -3,8 +3,10 @@
|
||||
#[cfg(RUSTC_WITH_SPECIALIZATION)]
|
||||
use crate::abi_example::AbiExample;
|
||||
use crate::{
|
||||
account::Account, account::KeyedAccount, instruction::CompiledInstruction,
|
||||
instruction::InstructionError, message::Message, pubkey::Pubkey,
|
||||
account::{Account, KeyedAccount},
|
||||
instruction::{CompiledInstruction, Instruction, InstructionError},
|
||||
message::Message,
|
||||
pubkey::Pubkey,
|
||||
};
|
||||
use std::{cell::RefCell, rc::Rc, sync::Arc};
|
||||
|
||||
@ -225,6 +227,8 @@ pub trait InvokeContext {
|
||||
fn add_executor(&mut self, pubkey: &Pubkey, executor: Arc<dyn Executor>);
|
||||
/// Get the completed loader work that can be re-used across executions
|
||||
fn get_executor(&mut self, pubkey: &Pubkey) -> Option<Arc<dyn Executor>>;
|
||||
/// Record invoked instruction
|
||||
fn record_instruction(&self, instruction: &Instruction);
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
@ -272,6 +272,10 @@ impl Message {
|
||||
Self::new(&instructions, payer)
|
||||
}
|
||||
|
||||
pub fn compile_instruction(&self, ix: &Instruction) -> CompiledInstruction {
|
||||
compile_instruction(ix, &self.account_keys)
|
||||
}
|
||||
|
||||
pub fn serialize(&self) -> Vec<u8> {
|
||||
bincode::serialize(self).unwrap()
|
||||
}
|
||||
|
Reference in New Issue
Block a user