feat(bifrost/utxo): outbound-already-paid guard + observed-outbound query (parity C3)

🔎 Visual review of 8f8b151b: ⏳ out of date, newer commits were pushed. Updating it for 3734f800.

Public-develop parity cluster C3

Faithful port of the shipped-3.21.1 UTXO outbound guard and its supporting infrastructure from tag 7061c98d01b. Stacked on C2 (!5339); review that first.

The guard stops a UTXO vault re-signing an outbound a vault has already paid — whatever vault this attempt is scheduled on. The former-sender-vault case is covered only for a node that recorded the payment itself: a node that never observed it (e.g. a signer that joined after the sender vault left GetAsgardPubKeys) cannot confirm the historical sender and falls through to its own daemon check, so the guard neither helps nor harms it. See the open thread for the follow-up to track that case. It brings in the scanner-core vault-snapshot threading, a ctx-bounded RPC layer, a per-inbound observed-outbound index, and a thornode query surface + consensus-link index to feed it.

Commits (each compiles; read in order)

  1. scanner-core refactor — getOutput→getOutputWithAsgards, free-func isAsgardAddress, getGas(+knownTxs), getTxInWithVaultSender. No behaviour change on the normal scan path.
  2. query feature — QueryObservedTxVoter.observed_outbound_tx_ids (proto field 11 + regen + openapi), a consensus-only link index, and the queryTxVoters population (consensus/strong/borrowed ranking, bounded, capped 256).
  3. outbound guard + infra — existingOutboundPayment wired into SignTx; ctx-RPC base (CallContext/BatchCallContext/CallContextOnce/*Context); signercache observed-outbound index; GetObservedTxVoterUncached on the bridge interface.
  4. consensus-write — setObservedConsensusLinkFromMemo in applyTxOutAttestation (shared by the per-attestation and single-write quorum paths). Same key prefix (ob_link_consensus/) and encoding as shipped, so public state equals mainnet's; TestSingleWriteMatchesPerAttestationWrite confirms both paths match.

Review asks (@huginn-bot @zlyzol)

  • Commit 1: confirm the vault-snapshot threading is behaviour-preserving on the live scan path (getOutput/isAsgardAddress/getGas keep their old results when vaultSender=false).
  • Commit 4: confirm the consensus-link write point matches shipped so app state stays identical to mainnet.
  • Guard: confirm the network-reported candidates (observed_outbound_tx_ids) are only ever checked against the node's own daemon, never trusted directly.

Review fixes (since 8f8b151b)

  • Ported the signercache observed-outbound index tests (TestObservedOutbounds, TestConcurrentObservedOutbounds, TestObservedOutboundsWithoutIndex) and added a core/memo regression assertion that an observed outbound links back onto its inbound voter (observed_outbound_tx_ids).
  • Dropped the unused GetTransactionLocationContext/CallContextOnce/TransactionLocation RPC wrappers — they belong with the observation-validation code that is not ported here.

Notes

  • Builds mainnet+mocknet; utxo + querier + observed-tx + single-write tests green.
  • The one red LUVI test (TestErrataOfAddInboundUndoesTheDeposit) is inherited from C2 (!5339) and is that cluster's reviewer call, not C3.
  • mr-overlap-check: priv!197 / priv!191 / !4838 touch some of the same files for unrelated problems (rebase-risk only), no shared fix.
Edited by Huginn Ai

Merge request reports

Loading
Loading