fix(eth): avoid int64 overflow in on-chain base fee conversion#1605
Open
pragmaxim wants to merge 1 commit into
Open
fix(eth): avoid int64 overflow in on-chain base fee conversion#1605pragmaxim wants to merge 1 commit into
pragmaxim wants to merge 1 commit into
Conversation
The pull-path EIP-1559 estimate decoded baseFeePerGas as uint64 and then cast it to int64 for big.NewInt. A value above math.MaxInt64 (~9.22e18 wei) would wrap to a negative big.Int. Unreachable on mainnet today but possible on high-fee L2s. Use new(big.Int).SetUint64() instead, matching the header path in attachBlockGas. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Severity: minor — theoretical today, but a cheap and correct fix worth taking.
The pull-path EIP-1559 estimate (
EthereumTypeGetEip1559Fees) decodedbaseFeePerGasasuint64and then cast it toint64forbig.NewInt. A value abovemath.MaxInt64(~9.22e18 wei) would wrap to a negativebig.Int.Not reachable on Ethereum mainnet today, but possible on high-fee L2s. Switching to
new(big.Int).SetUint64()also makes this consistent with the header path inattachBlockGas, which already handles it correctly.Follow-up from review of the EIP-1559 fields work (already merged to master).
🤖 Generated with Claude Code