Skip to content

Add admin dismissal for cross-chain setups that never got a quote - #11

Merged
Kenbak merged 1 commit into
mainfrom
new/crosschain-dismiss
Nov 15, 2026
Merged

Kenbak merged 1 commit into
mainfrom
new/crosschain-dismiss

Conversation

@Kenbak

@Kenbak Kenbak commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Why

Any cross-chain setup failure marks the attempt NEEDS_REVIEW and keeps the fee reservation, because the outcome might be ambiguous. Until now nothing could close such a review. The existing retry action refuses attempts that have no saved quote. So a setup that provably never produced a deposit address stayed flagged forever and kept /api/health at degraded.

Mainnet example: invoice 4f53e474…, a €1 USDC-on-Base checkout on 2026-10-24.

  • The attempt failed at stage="provider_quote", so no quote and no deposit address were issued.
  • 0 ZEC was received, with no detected transaction and no invoice_payments row.
  • The invoice expired at 11:37 UTC.

Change

  • New admin route: POST /api/admin/crosschain/{id}/dismiss with body {"reason": "..."}.
    • Requires X-Admin-Key.
    • The reason must be 3–500 characters.
  • Eligibility, checked inside BEGIN IMMEDIATE; anything else returns 409 with the reason:
    • the attempt is NEEDS_REVIEW or CREATING;
    • payload IS NULL (no quote was saved), and there is no send_token and no sent_txid;
    • the invoice is expired or cancelled, with received_zatoshis = 0 and no invoice_payments rows;
    • the fee row is still reserved, with no correlation_id.
  • Records: the dismissal is written to a new crosschain_dismissals table (invoice ID, prior state, reason, timestamp) through the tracked migration crosschain_dismissals_v2026_11_15. The attempt and fee rows are not modified or deleted.
  • Review list: operations::issues() skips dismissed invoices while they are unconfirmed. If the invoice later confirms, it reappears for review.
  • Checkout UI: unchanged. The attempt keeps NEEDS_REVIEW, so the buyer view still shows "setup not sent".
  • Setup-failure logs: these now carry a coarse kind: slot_timeout, below_minimum, provider_timeout, provider_connect, provider_decode, provider_http_<code>, provider_rejected, provider_request, database or other. Provider message text is still never logged.

Tests

  • Dismissing an eligible attempt: the dismissal succeeds and the invoice leaves the issues list. The attempt and fee rows are unchanged, a second dismissal is refused, and the invoice reappears once it confirms.
  • Refused cases: a saved quote, a started wallet send, a pending invoice, received ZEC, a bound fee row, a non-setup state and a missing attempt are each refused, and no dismissal row is written.
  • Error kinds: classification for a slot timeout, a below-minimum error, a provider rejection and other errors.
  • Checks: cargo test --locked: 140 passed, 3 fixture-only tests ignored. scripts/check-dependency-exposure.py and cargo audit with the current ignores pass.

Not deployed. Dismissing 4f53e474… on mainnet is a separate step, done after deploy.

POST /api/admin/crosschain/{id}/dismiss {reason} closes a setup review
only when the attempt has no saved quote and no wallet send, the invoice
is expired or cancelled with no received ZEC, and the fee reservation is
unbound. Under BEGIN IMMEDIATE it records the dismissal in a new
crosschain_dismissals table; the attempt and fee rows are not modified.
operations::issues() skips dismissed rows unless the invoice confirms.

Setup failures now also log a coarse error kind (slot_timeout,
provider_timeout, provider_http_<code>, provider_rejected, ...) without
provider message text.
@Kenbak
Kenbak merged commit 0f2f1fa into main Nov 15, 2026
4 checks passed
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.

1 participant