fix(bifrost/xrp): read account sequence from chain for every sign (serialize-resync)

🔎 Visual review of 257d8109: explainer, review flags and prompts to ask an AI about the change

XRP signing/broadcast determinism (patch-level)

Makes XRP outbound signing deterministic across the keysign party and closes a funds-loss / double-pay gap in broadcast handling. Bifrost-only; no consensus state.

Signing sequence

  • Read the account sequence from the validated ledger, never the open/current ledger (whose tentatively-applied txs differ between nodes). This removes the per-node divergence behind the telCAN_NOT_QUEUE backlog.
  • A checkpoint from a prior attempt pins the sequence and is never moved: re-signing the exact same transaction can never double-spend. A malformed (non-positive) checkpoint self-heals to a fresh validated read.

Broadcast oracle ("sent" means delivered)

  • A tefPAST_SEQ / tefALREADY accept is treated as sent only when the exact tx hash is validated with tesSUCCESS on chain — never merely "the sequence is past" or "validated".
  • A validated tec* failure (the sequence is burned and the fee spent, but nothing is delivered) returns ErrResignRequired so the signer re-signs at the next free sequence. XRP sequences are strictly ordered, so the dead bytes can never later re-deliver — the re-sign is double-pay-safe. This also closes a pre-existing blind spot where a validated-but-failed payment was treated as delivered.
  • A bare txnNotFound never drives a re-sign: a pruned/lagging node can report not-found for a tx it actually delivered, so re-signing would double-pay. It retries and lets THORChain reschedule. The result parser fails safe (an unrecognized result is treated as unknown, never as a failure).

Ordering

  • A per-vault lock serializes SignTx+BroadcastTx so two same-vault outbounds cannot fresh-sign at the same account sequence and collide.

Follow-up (develop)

Full cross-node determinism and pipelining need a consensus-agreed validated snapshot

  • a LastLedgerSequence on every outbound + a bounded re-sync. Also deferred: confirming a fresh submit-time tesSUCCESS before caching, and a terminal classification for permanent tec* codes. Tracked as a follow-up for develop.
Edited by Huginn Ai

Merge request reports

Loading
Loading