Loading
fix(bifrost/xrp): read account sequence from chain for every sign (serialize-resync)
🔎 Visual review of257d8109: 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_QUEUEbacklog. - 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/tefALREADYaccept is treated as sent only when the exact tx hash is validated withtesSUCCESSon 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) returnsErrResignRequiredso 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
txnNotFoundnever 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+BroadcastTxso 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
LastLedgerSequenceon every outbound + a bounded re-sync. Also deferred: confirming a fresh submit-timetesSUCCESSbefore caching, and a terminal classification for permanenttec*codes. Tracked as a follow-up for develop.
Edited by Huginn Ai