mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix: prevent child call out of bounds (#3920)
This commit is contained in:
@ -395,7 +395,6 @@ where
|
||||
if self.config.record_steps {
|
||||
self.gas_inspector.step_end(interp, data, is_static, eval);
|
||||
self.fill_step_on_step_end(interp, data, eval);
|
||||
return eval
|
||||
}
|
||||
InstructionResult::Continue
|
||||
}
|
||||
|
||||
@ -267,9 +267,12 @@ impl CallTraceNode {
|
||||
opcode::CALL |
|
||||
opcode::STATICCALL |
|
||||
opcode::CALLCODE => {
|
||||
let call_id = self.children[child_id];
|
||||
item.call_child_id = Some(call_id);
|
||||
child_id += 1;
|
||||
// The opcode of this step is a call but it's possible that this step resulted
|
||||
// in a revert or out of gas error in which case there's no actual child call executed and recorded: <https://github.com/paradigmxyz/reth/issues/3915>
|
||||
if let Some(call_id) = self.children.get(child_id).copied() {
|
||||
item.call_child_id = Some(call_id);
|
||||
child_id += 1;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@ -532,7 +535,9 @@ pub(crate) struct CallTraceStep {
|
||||
pub(crate) gas_cost: u64,
|
||||
/// Change of the contract state after step execution (effect of the SLOAD/SSTORE instructions)
|
||||
pub(crate) storage_change: Option<StorageChange>,
|
||||
/// Final status of the call
|
||||
/// Final status of the step
|
||||
///
|
||||
/// This is set after the step was executed.
|
||||
pub(crate) status: InstructionResult,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user