Fix(evm): emit gas in ETHTransaction.toEstimate() when > 0 only#35
Merged
Merged
Conversation
Assert toEstimate() emits `gas` when gasLimit > 0 (the field strict op-geth nodes need to avoid "intrinsic gas too high") and omits it when gasLimit == 0 so the auto-fill payload is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Hi @mrtnetwork! |
This was referenced Jun 22, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
toEstimate()now adds agasfield to theeth_estimateGaspayload whengasLimit > 0. WhengasLimit == 0(auto-fill) the behavior is unchanged.Why
Optimism: without
gas, the node uses the block gas limit (~40M) as the upper bound.Strict op-geth nodes run an affordability pre-check on that bound
(
40M × gas_price > balance) and reject the request withintrinsic gas too high— breaking gas estimation for token transfers (legacy and EIP-1559). Withgasset, the bound becomes affordable and estimation succeeds.Verified against live OP Sepolia nodes (identical payload):
gasgassepolia.optimism.iointrinsic gas too high0xb173optimism-sepolia-rpc.publicnode.comintrinsic gas too high0xb173Important
The error currently shows up on testnet (OP Sepolia): its op-geth already
ships the stricter gas estimator. On mainnet the node still silently caps the
bound, so there is no error yet. Once the network upgrade reaches mainnet, the
same behavior is expected to appear there too — so we land this fix ahead of
time, as insurance.
On every other geth network the change is safe:
gasis added only whengasLimitis explicitly set.Tests
Tests added in
test/etherum/transaction_test.dart.