-
Notifications
You must be signed in to change notification settings - Fork 201
feat: adds a standalone transaction-clearer bot for recovering from nonce backlogs. #4915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Pablo Maldonado <pablo@umaproject.org>
| feeBumpNumerator: Number(env.FEE_BUMP_NUMERATOR) || 12, | ||
| feeBumpDenominator: Number(env.FEE_BUMP_DENOMINATOR) || 10, | ||
| replacementAttempts: Number(env.REPLACEMENT_ATTEMPTS) || 3, |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
- 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 <noreply@anthropic.com>
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 <pablo@umaproject.org>
828aa01 to
8744689
Compare
Signed-off-by: Pablo Maldonado <pablo@umaproject.org>
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
transaction-clearerbotbot-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