Refactor: Use instruction_trace instead of instruction_context_stack (#22988)
* Moves stack_height of the instruction_trace into InstructionContext. * Uses nesting_level instead of stack_height internally in transaction_context.rs * Uses the instruction_trace instead of the instruction_context_stack internally. * Adds feature gate: record_instruction_in_transaction_context_push.
This commit is contained in:
committed by
GitHub
parent
e545828fc5
commit
226a71f073
@ -103,7 +103,7 @@ fn create_inputs() -> TransactionContext {
|
||||
let mut transaction_context = TransactionContext::new(transaction_accounts, 1, 1);
|
||||
let instruction_data = vec![1u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
||||
transaction_context
|
||||
.push(&[0], &instruction_accounts, &instruction_data)
|
||||
.push(&[0], &instruction_accounts, &instruction_data, true)
|
||||
.unwrap();
|
||||
transaction_context
|
||||
}
|
||||
|
@ -3037,7 +3037,7 @@ impl<'a, 'b> SyscallObject<BpfError> for SyscallGetProcessedSiblingInstruction<'
|
||||
);
|
||||
|
||||
let stack_height = invoke_context.get_stack_height();
|
||||
let instruction_trace = invoke_context.get_instruction_trace();
|
||||
let instruction_trace = invoke_context.transaction_context.get_instruction_trace();
|
||||
let instruction_context = if stack_height == TRANSACTION_LEVEL_STACK_HEIGHT {
|
||||
// pick one of the top-level instructions
|
||||
instruction_trace
|
||||
@ -3050,8 +3050,8 @@ impl<'a, 'b> SyscallObject<BpfError> for SyscallGetProcessedSiblingInstruction<'
|
||||
// Walk the last list of inner instructions
|
||||
instruction_trace.last().and_then(|inners| {
|
||||
let mut current_index = 0;
|
||||
inners.iter().rev().skip(1).find(|(this_stack_height, _)| {
|
||||
if stack_height == *this_stack_height {
|
||||
inners.iter().rev().skip(1).find(|instruction_context| {
|
||||
if stack_height == instruction_context.get_stack_height() {
|
||||
if index == current_index {
|
||||
return true;
|
||||
} else {
|
||||
@ -3061,8 +3061,7 @@ impl<'a, 'b> SyscallObject<BpfError> for SyscallGetProcessedSiblingInstruction<'
|
||||
false
|
||||
})
|
||||
})
|
||||
}
|
||||
.map(|(_, instruction_context)| instruction_context);
|
||||
};
|
||||
|
||||
if let Some(instruction_context) = instruction_context {
|
||||
let ProcessedSiblingInstruction {
|
||||
|
Reference in New Issue
Block a user