Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry committed Oct 25, 2022
1 parent c1d2352 commit e2a9e43
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ fn execute_transactions(
.into_iter()
.map(|ix| solana_transaction_status::InnerInstruction {
instruction: ix.instruction,
stack_height: ix.stack_height,
stack_height: Some(u32::from(ix.stack_height)),
})
.collect(),
})
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/transaction_status_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl TransactionStatusService {
.into_iter()
.map(|info| InnerInstruction {
instruction: info.instruction,
stack_height: info.stack_height,
stack_height: Some(u32::from(info.stack_height)),
})
.collect(),
})
Expand Down
17 changes: 8 additions & 9 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,8 @@ pub type InnerInstructions = Vec<InnerInstruction>;
pub struct InnerInstruction {
pub instruction: CompiledInstruction,
/// Invocation stack height of this instruction. Instruction stack height
/// starts at 1 for transaction instructions. This field is set to `None`
/// for transactions that were processed prior to stack height tracking.
pub stack_height: Option<u32>,
/// starts at 1 for transaction instructions.
pub stack_height: u8,
}

/// A list of compiled instructions that were invoked during each instruction of
Expand All @@ -524,7 +523,7 @@ pub fn inner_instructions_list_from_instruction_trace(
if stack_height == TRANSACTION_LEVEL_STACK_HEIGHT {
outer_instructions.push(Vec::new());
} else if let Some(inner_instructions) = outer_instructions.last_mut() {
let stack_height = u32::try_from(stack_height).unwrap_or(u32::MAX);
let stack_height = u8::try_from(stack_height).unwrap_or(u8::MAX);
let instruction = CompiledInstruction::new_from_raw_parts(
instruction_context
.get_index_of_program_account_in_transaction(
Expand All @@ -546,7 +545,7 @@ pub fn inner_instructions_list_from_instruction_trace(
);
inner_instructions.push(InnerInstruction {
instruction,
stack_height: Some(stack_height),
stack_height,
});
} else {
debug_assert!(false);
Expand Down Expand Up @@ -19293,21 +19292,21 @@ pub(crate) mod tests {
vec![
vec![InnerInstruction {
instruction: CompiledInstruction::new_from_raw_parts(0, vec![1], vec![]),
stack_height: Some(2),
stack_height: 2,
}],
vec![],
vec![
InnerInstruction {
instruction: CompiledInstruction::new_from_raw_parts(0, vec![4], vec![]),
stack_height: Some(2),
stack_height: 2,
},
InnerInstruction {
instruction: CompiledInstruction::new_from_raw_parts(0, vec![5], vec![]),
stack_height: Some(3),
stack_height: 3,
},
InnerInstruction {
instruction: CompiledInstruction::new_from_raw_parts(0, vec![6], vec![]),
stack_height: Some(2),
stack_height: 2,
},
]
]
Expand Down

0 comments on commit e2a9e43

Please sign in to comment.