Fix simulator using raw gas estimator without tip adjustments#4298
Merged
squadgazzz merged 2 commits intomainfrom Mar 27, 2026
Merged
Fix simulator using raw gas estimator without tip adjustments#4298squadgazzz merged 2 commits intomainfrom
squadgazzz merged 2 commits intomainfrom
Conversation
PR #4265 (Simulator crate) introduced a regression where the simulator receives the raw gas price estimator (without additional tip/min priority fee adjustments) instead of the wrapped one that the driver previously used. Before #4265, `Ethereum::simulation_gas_price()` called `GasPriceEstimator::estimate()` which adds a configurable tip buffer (default 3 Gwei or 5%) on top of the raw network estimate. After #4265, the simulator receives `eth.gas_estimator()` which returns `self.inner.gas.gas` — the raw inner estimator, bypassing the tip logic entirely. On fast-block chains like Arbitrum (~250ms blocks), the base fee changes frequently. Without the tip buffer, the simulation gas price lands right at the current base fee and often falls below it by the time the eth_call executes, causing "max fee per gas less than block base fee" errors. Fix: implement `GasPriceEstimating` for `GasPriceEstimator` and return the wrapped estimator from `gas_estimator()` so the simulator gets the same tip-adjusted estimates as before.
jmg-duarte
approved these changes
Mar 27, 2026
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces the as_estimating method to the GasPriceEstimator and implements the GasPriceEstimating trait for it, allowing for more accurate gas price estimation in components like the simulator. I have no feedback to provide as the identified medium-severity issue regarding error wrapping does not meet the repository's threshold for critical findings.
AryanGodara
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regression introduced in #4265 (Simulator crate) that caused frequent "max fee per gas less than block base fee" errors during settlement encoding, particularly on Arbitrum.
Root cause
Ethereum::gas_estimator()returnsself.inner.gas.gas— the rawdyn GasPriceEstimatingwithout tip adjustments. Before #4265,Ethereum::simulation_gas_price()calledGasPriceEstimator::estimate()which adds a configurable tip buffer (default 3 Gwei or 5%) on top of the raw estimate. After #4265, the simulator receives the raw estimator, so simulation gas prices land right at the base fee with no buffer.On Arbitrum (~250ms blocks), the base fee changes constantly. The tiny gap between estimation and
eth_callexecution is enough for the base fee to tick up past the estimated price.Fix
Implement
GasPriceEstimatingforGasPriceEstimatorand return the wrapped estimator fromgas_estimator(), so the simulator gets the same tip-adjusted estimates the driver used before #4265.Test plan
cargo check -p driverpasses