bluealloy / revm

Rust implementation of the Ethereum Virtual Machine.
https://bluealloy.github.io/revm/
MIT License
1.67k stars 572 forks source link

Expose local_gas_limit to inspector #1688

Open bernard-wagner opened 3 months ago

bernard-wagner commented 3 months ago

It would be useful within the inspector hooks to know whether the gas_limit for a call was calculated or specified. Simply including gas_limit does not make this possible.

I recently encountered an issue when debugging a transaction that underspecified the gas limit for a nested call. Using foundry it was not possible to see this hardcoded gas limit in the traces.

By adding a flag or the original value to the CallInputs, it would be possible to optionally include the gas_limit in revm-inspectors traces. Always including the gas limit pollutes the traces with too much gas information.

For example:

[2348]  Counter::number{gas: 10000}()
└─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000000
DaniPopes commented 3 months ago

this should probably be in revm-inspectors, maybe set gas limit to None if >= gas*63/64, otherwise Some to display it. Not really worth tracking in revm because there is no distinction between "user specified" or not, as gas limit is a required argument to CALL