Skip to content

fix(eth): avoid int64 overflow in on-chain base fee conversion#1605

Open
pragmaxim wants to merge 1 commit into
masterfrom
fix/eth-basefee-uint64-overflow
Open

fix(eth): avoid int64 overflow in on-chain base fee conversion#1605
pragmaxim wants to merge 1 commit into
masterfrom
fix/eth-basefee-uint64-overflow

Conversation

@pragmaxim

Copy link
Copy Markdown
Contributor

Severity: minor — theoretical today, but a cheap and correct fix worth taking.

The pull-path EIP-1559 estimate (EthereumTypeGetEip1559Fees) 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.

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 in attachBlockGas, which already handles it correctly.

Follow-up from review of the EIP-1559 fields work (already merged to master).

🤖 Generated with Claude Code

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>
@pragmaxim pragmaxim requested a review from cranycrane July 4, 2026 17:02

@cranycrane cranycrane left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

2 participants