Skip to content

fix: prevent GasTracker used gas underflow - #3813

Merged
rakita merged 1 commit into
bluealloy:mainfrom
1sgtpepper:fix/gas-tracker-excess-used-gas
Jul 22, 2026
Merged

rakita merged 1 commit into
bluealloy:mainfrom
1sgtpepper:fix/gas-tracker-excess-used-gas

Conversation

@1sgtpepper

@1sgtpepper 1sgtpepper commented Jul 22, 2026 •

Copy link
Copy Markdown

Summary

  • Saturate GasTracker::new_used_gas remaining gas at zero when used_gas exceeds gas_limit, avoiding debug panics and release-mode wraparound.
  • Document the boundary behavior and cover values below, equal to, and above the limit while preserving the reservoir.

Fixes #3793.

Testing

  • Fork CI: GitHub Actions ci success (Rust 1.91, stable, and nightly; default, no-default, and all features; clippy, fmt, docs, no-std, feature, and Ethereum test jobs)

@1sgtpepper
1sgtpepper marked this pull request as ready for review July 22, 2026 11:00
@1sgtpepper
1sgtpepper force-pushed the fix/gas-tracker-excess-used-gas branch from 5ff69e2 to 93f27ad Compare July 22, 2026 11:05
@codspeed

codspeed Bot commented Jul 22, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 181 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing 1sgtpepper:fix/gas-tracker-excess-used-gas (93f27ad) with main (5199506)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩

@rakita
rakita merged commit 5e6f91f into bluealloy:main Jul 22, 2026
33 checks passed
This was referenced Jul 22, 2026
RealiCZ added a commit to megaeth-labs/revm that referenced this pull request Sep 16, 2026
@RealiCZ RealiCZ mentioned this pull request Sep 18, 2026
43 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GasTracker::new_used_gas underflows when used_gas exceeds gas_limit

2 participants