Skip to content

Commit be218a1

Browse files
arpan-jainclaude
andauthored
fix: geometric retry escalation to keep mempool replacement valid (#28)
The previous linear `100 + 20·N` schedule causes the new/old gas ratio to fall below the 1.10 EIP-1559 mempool replacement floor around the 7th retry, silently triggering the `transaction-underpriced-multiplier` 50% bump path on top of the regular retry — effectively double-charging each subsequent retry. Geometric `1.20^N` keeps the retry/previous ratio at exactly 1.20 every attempt, so replacement always passes by a 20% margin. Reduces redundant retries during congestion and the resulting snowball cost. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3a93bdb commit be218a1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/executor/executor.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ export class Executor {
134134
]
135135

136136
if (bundle.submissionAttempts > 0) {
137-
const multiplier = 100n + BigInt(bundle.submissionAttempts) * 20n
137+
// Geometric: keeps retry/prev ratio at 1.20; linear `100+20·N`
138+
// drops below the 1.10 mempool replacement floor at N=7.
139+
let multiplier = 100n
140+
for (let i = 0; i < bundle.submissionAttempts; i++) {
141+
multiplier = (multiplier * 120n) / 100n
142+
}
138143

139144
networkMaxFeePerGas = scaleBigIntByPercent(
140145
networkMaxFeePerGas,

0 commit comments

Comments
 (0)