fix(gas): enforce maxFeePerGas >= maxPriorityFeePerGas (EIP-1559 invariant)#42
Merged
Merged
Conversation
…riant) gasFeeCap was set to 2x eth_gasPrice and only clamped up to 2x baseFee — never to the tip. On a quiet chain eth_gasPrice decays to the floor (~0.001 gwei), so the auto fee cap (~0.002 gwei) fell below the default 1 gwei tip, producing invalid EIP-1559 txs (maxFeePerGas < maxPriorityFeePerGas) that the node rejects outright (0 mined, pendingTxCount=0). Bistable: once blocks go empty, gasPrice stays low and every test fails until something lifts it. Clamp gasFeeCap up to gasTipCap before the existing 2x-baseFee guard. Verified: on a stuck chain (gasPrice 0.001 gwei, default 1 gwei tip), a direct 200 TPS run went from confirmed=0/failed=5874 to confirmed=1824/failed=0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mandrigin
approved these changes
Jun 25, 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.
Bug
gasFeeCap(maxFeePerGas) is computed as2 × eth_gasPriceand clamped up to2 × baseFee— but never togasTipCap(maxPriorityFeePerGas). On a quiet chaineth_gasPricedecays to the floor (~0.001 gwei), so the auto fee cap (~0.002 gwei) falls below the default 1 gwei tip. That's an invalid EIP-1559 tx (maxFeePerGas < maxPriorityFeePerGas), which the node rejects at submission —pendingTxCount=0, nothing mined.It's bistable: while txs land paying a 1 gwei tip,
eth_gasPricestays high (valid); once blocks go empty,eth_gasPricedecays and every test fails until something lifts it.Fix
Clamp
gasFeeCapup togasTipCap(the EIP-1559 invariant) before the existing2×baseFeeguard, ininternal/loadgen/init.go.Verification
On a stuck local chain (
eth_gasPrice≈ 0.001 gwei, default 1 gwei tip):confirmed=0, failed=5874, on-chaintxCount=0confirmed=1824, failed=0, on-chaintxCount=1824(gasUsed 38.3M)🤖 Generated with Claude Code