Skip to content

Use accurate refund counter #267

Description

@mattsse

as described here

paradigmxyz/reth#14783

we're incorrectly tracking refunds because revm's refund function returns the refund per call which can go negative.

but we want the total refund counter.

to fix this we need to change the type to an i64 because this can go negative:

/// Gas refund counter before step execution
pub gas_refund_counter: u64,

and move this

gas_refund_counter: interp.gas.refunded() as u64,

to the step_end function, here:

step.gas_cost = step.gas_remaining.saturating_sub(interp.gas.remaining());

this now only tracks the refund snapshot on call level, so what we need to do on call_end is to compute the total refund counter by looking at the previous calls

fn fill_trace_on_call_end<DB: Database>(

and compute the real refund counters

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions