Skip to content

Conversation

@md0x
Copy link
Contributor

@md0x md0x commented Dec 19, 2025

PR description

Adds a guardrail to the OO bot to detect nonce backlogs before running settlements.
If pending > latest, the bot skips settlements and attempts to clear the backlog by submitting a 0-value self-tx at nonce = latest. If it succeeds, it exits cleanly; if all attempts fail, it logs an error and exits early.

Why:
Submitting new settlements while txs are stuck can compound nonce issues. This makes the bot fail-safe, either self-healing or exiting loudly to avoid further damage.

@md0x md0x marked this pull request as ready for review December 19, 2025 15:26

const parsePositiveInt = (value: string | undefined, defaultValue: number): number => {
const parsed = Number(value);
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : defaultValue;
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 predictable if we only allow positive integers in the value (unless undefined) and throw if the value does not parse correctly. I would rather expect to use default value only when value was not passed in env

Comment on lines +23 to +24
replacementBumpNumerator: parsePositiveInt(env.NONCE_REPLACEMENT_BUMP_NUMERATOR, DEFAULT_REPLACEMENT_BUMP_NUMERATOR),
replacementBumpDenominator: parsePositiveInt(
Copy link
Contributor

Choose a reason for hiding this comment

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

there is no check that resulting numerator is larger than denominator that one would normally expect with fee bumps. Also, do we really need such high precision here? It might be simpler to have single integer percentage points bump (e.g. value of "20" would bump the fee up by 20%)

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