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:
Justin Starry
2020-09-24 22:36:22 +08:00
committed by GitHub
parent 860ecdd376
commit 6601ec8f26
19 changed files with 429 additions and 98 deletions

View File

@ -275,6 +275,7 @@ mod tests {
account::Account,
entrypoint_native::{ComputeBudget, Logger, ProcessInstruction},
instruction::CompiledInstruction,
instruction::Instruction,
message::Message,
rent::Rent,
};
@ -360,6 +361,7 @@ mod tests {
fn get_executor(&mut self, _pubkey: &Pubkey) -> Option<Arc<dyn Executor>> {
None
}
fn record_instruction(&self, _instruction: &Instruction) {}
}
struct TestInstructionMeter {
@ -587,6 +589,7 @@ mod tests {
max_invoke_depth: 2,
},
Rc::new(RefCell::new(Executors::default())),
None,
);
assert_eq!(
Err(InstructionError::Custom(194969602)),

View File

@ -1020,6 +1020,7 @@ fn call<'a>(
ro_regions,
)?;
verify_instruction(syscall, &instruction, &signers)?;
invoke_context.record_instruction(&instruction);
let message = Message::new(&[instruction], None);
let callee_program_id_index = message.instructions[0].program_id_index as usize;
let callee_program_id = message.account_keys[callee_program_id_index];