Skip to content

fix(gas): enforce maxFeePerGas >= maxPriorityFeePerGas (EIP-1559 invariant)#42

Merged
IvanBelyakoff merged 1 commit into
mainfrom
fix/eip1559-feecap-tipcap
Jun 26, 2026
Merged

fix(gas): enforce maxFeePerGas >= maxPriorityFeePerGas (EIP-1559 invariant)#42
IvanBelyakoff merged 1 commit into
mainfrom
fix/eip1559-feecap-tipcap

Conversation

@IvanBelyakoff

Copy link
Copy Markdown
Contributor

Bug

gasFeeCap (maxFeePerGas) is computed as 2 × eth_gasPrice and clamped up to 2 × baseFee — but never to gasTipCap (maxPriorityFeePerGas). On a quiet chain eth_gasPrice decays 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_gasPrice stays high (valid); once blocks go empty, eth_gasPrice decays and every test fails until something lifts it.

Fix

Clamp gasFeeCap up to gasTipCap (the EIP-1559 invariant) before the existing 2×baseFee guard, in internal/loadgen/init.go.

Verification

On a stuck local chain (eth_gasPrice ≈ 0.001 gwei, default 1 gwei tip):

  • before: direct 200 TPS → confirmed=0, failed=5874, on-chain txCount=0
  • after: same run → confirmed=1824, failed=0, on-chain txCount=1824 (gasUsed 38.3M)

🤖 Generated with Claude Code

…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>
@IvanBelyakoff IvanBelyakoff merged commit 424c3a4 into main Jun 26, 2026
6 checks passed
@IvanBelyakoff IvanBelyakoff deleted the fix/eip1559-feecap-tipcap branch June 26, 2026 13:51
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