Commit 9b3c73a
fix(eth): use next-block base fee in simple EIP-1559 fee estimator
The simple fee-history estimator read `baseFeePerGas.first()`, which is
the oldest block of the eth_feeHistory window, not the latest: the array
is ordered oldest to newest and carries one extra trailing entry with
the next block's base fee. On chains with fast blocks (Gnosis: 5s), the
base fee can grow up to 12.5% per block, so a 5-block-stale base fee
made max_fee_per_gas fall below the current base fee during fee spikes.
Nethermind >= 1.36.0 strictly validates maxFeePerGas >= baseFee in
eth_estimateGas when fee fields are passed, rejecting such requests and
breaking order posting / trade preimage on Gnosis.
Use `.last()` (the next block's base fee on spec-compliant clients, or
the newest mined block on clients that omit the extra entry, e.g.
Avalanche and Fantom) and match Nethermind's pre-1.38.0 error message
"miner premium is negative" so it maps to GasFeeCapBelowBaseFee instead
of a raw transport error.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent e686ef3 commit 9b3c73a
2 files changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7562 | 7562 | | |
7563 | 7563 | | |
7564 | 7564 | | |
| 7565 | + | |
| 7566 | + | |
7565 | 7567 | | |
7566 | 7568 | | |
7567 | 7569 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
139 | 143 | | |
140 | 144 | | |
141 | | - | |
| 145 | + | |
142 | 146 | | |
143 | 147 | | |
144 | 148 | | |
| |||
0 commit comments