Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: record push stack as vec u256 #4077

Merged
merged 2 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl ParityTraceBuilder {

let maybe_execution = Some(VmExecutedOperation {
used: step.gas_cost,
push: step.new_stack.into_iter().map(|new_stack| new_stack.into()).collect(),
push: step.push_stack.clone().unwrap_or_default(),
mem: maybe_memory,
store: maybe_storage,
});
Expand Down
5 changes: 3 additions & 2 deletions crates/revm/revm-inspectors/src/tracing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl TracingInspector {
op,
contract: interp.contract.address,
stack,
new_stack: None,
push_stack: None,
memory,
memory_size: interp.memory.len(),
gas_remaining: self.gas_inspector.gas_remaining(),
Expand All @@ -302,7 +302,8 @@ impl TracingInspector {
let step = &mut self.traces.arena[trace_idx].trace.steps[step_idx];

if interp.stack.len() > step.stack.len() {
step.new_stack = interp.stack.data().last().copied();
// if the stack grew, we need to record the new values
step.push_stack = Some(interp.stack.data()[step.stack.len()..].to_vec());
}

if self.config.record_memory_snapshots {
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/revm-inspectors/src/tracing/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@ pub(crate) struct CallTraceStep {
pub(crate) contract: Address,
/// Stack before step execution
pub(crate) stack: Stack,
/// The new stack item placed by this step if any
pub(crate) new_stack: Option<U256>,
/// The new stack items placed by this step if any
pub(crate) push_stack: Option<Vec<U256>>,
/// All allocated memory in a step
///
/// This will be empty if memory capture is disabled
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-types/src/eth/trace/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ pub struct VmExecutedOperation {
/// The total gas used.
pub used: u64,
/// The stack item placed, if any.
pub push: Vec<H256>,
pub push: Vec<U256>,
/// If altered, the memory delta.
pub mem: Option<MemoryDelta>,
/// The altered storage value, if any.
Expand Down
Loading