Skip to content

Conversation

@md0x
Copy link
Contributor

@md0x md0x commented Dec 19, 2025

Problem

When a transaction gets stuck (e.g., gas price too low during a spike), it blocks all subsequent transactions from the same wallet. The pending nonce can't advance until the stuck transaction is either mined or replaced.

Solution

transaction-clearer: Standalone bot that clears stuck transactions by submitting 0-value self-transactions at the stuck nonce with escalating gas fees.

Changes

  • Add standalone transaction-clearer bot
  • Shared clearing logic in bot-utils/transactionClearing.ts (reusable by other bots if needed)

Configuration (env vars)

  • NONCE_BACKLOG_THRESHOLD - minimum backlog to trigger clearing (default: 1)
  • NONCE_REPLACEMENT_BUMP_PERCENT - fee bump per attempt (default: 20%)
  • NONCE_REPLACEMENT_ATTEMPTS - max attempts per stuck nonce (default: 3)

Fixes UMA-3012

@md0x md0x marked this pull request as ready for review December 19, 2025 15:26
Comment on lines 23 to 25
feeBumpNumerator: Number(env.FEE_BUMP_NUMERATOR) || 12,
feeBumpDenominator: Number(env.FEE_BUMP_DENOMINATOR) || 10,
replacementAttempts: Number(env.REPLACEMENT_ATTEMPTS) || 3,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: these are named differently in bot-oo

export const initMonitoringParams = async (env: NodeJS.ProcessEnv): Promise<MonitoringParams> => {
const base = await initBaseMonitoringParams(env);

const nonceBacklogConfig: NonceBacklogConfig = {
Copy link
Contributor

Choose a reason for hiding this comment

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

bot-oo has some additional parsing checks that would be worth also using here and could reuse parsePositiveInt logic

return { latestNonce, pendingNonce };
}

export async function clearStuckTransactions(
Copy link
Contributor

Choose a reason for hiding this comment

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

might be more maintainable in the future if we have a single tx clearing module here and bot-oo would just reuse it

md0x and others added 3 commits January 19, 2026 13:14
- Revert bot-oo/index.ts to master (nonce handling moved to transaction-clearer)
- Replace feeBumpNumerator/Denominator with simpler feeBumpPercent (default 20%)
- Add parsePositiveInt that throws on invalid values instead of silently using defaults

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Move clearStuckTransactions and related helpers to bot-utils/transactionClearing.ts
so both transaction-clearer and bot-oo can reuse the same logic.

Signed-off-by: Pablo Maldonado <[email protected]>
@md0x md0x force-pushed the pablo/nonce-backlog-handling branch from 828aa01 to 8744689 Compare January 19, 2026 13:45
@md0x md0x changed the title feat(bot-oo): detect nonce backlog and attempt self-tx cancellation feat: adds a standalone transaction-clearer bot for recovering from nonce backlogs. Jan 19, 2026
@linear
Copy link

linear bot commented Jan 19, 2026

@md0x md0x requested a review from Reinis-FRP January 19, 2026 14:02
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.

3 participants