feat(payin): verification-gated admin recovery for SendUncertain sends#4265
Merged
Conversation
Collaborator
Author
|
Ready-for-review checks complete: one review pass across two independent dimensions (conformance/completeness and logic/fund-safety), 0 findings — no changes were required. Verified before pushing: |
TaprootFreak
marked this pull request as ready for review
July 18, 2026 11:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4264.
Summary
Adds a verification-gated, admin-only recovery endpoint for pay-ins stranded in
SendUncertain.#4263/#4249fail closed when a pay-in send fails ambiguously at or after broadcast: the pay-in isleft in
Sendingand the cron escalates it toSendUncertain, because re-broadcasting coulddouble-pay the customer. Until now there was no recovery path — such a pay-in was neither
forwarded/returned nor retryable, and
returnPayInrejects an in-flight-send status, so the fundsstayed frozen until a manual DB edit.
This mirrors the payout side, which already solved the equivalent problem in #4231
(
retryUncertainPayout→POST payout/retry), one-to-one.Endpoint
POST payIn/retry(admin-only,@ApiExcludeEndpoint, same guards as the existing admin pay-in routes).Body (
RetryPayInSendDto):id— the pay-in to recovernoBroadcastVerified— explicit operator attestation that on-chain absence was verified (must be literaltrue)verificationReference— what was checked (explorer links, ticket…), recorded in the audit logBehaviour (fail-closed)
SendUncertain.outTxId/returnTxId— it did broadcast, so it must bereconciled against the chain, never re-sent.
noBroadcastVerified === true; a blind reset would re-introduce the exact double-sendfix(payin): fail closed on ambiguous non-EVM pay-in sends #4263 prevents.
status = SendUncertain)returns the pay-in to its direction's initial send status —
Acknowledged(forward) orToReturn(return) — so the next send-cron run re-runs it under the full designate-before-broadcast
protection (staged chains rebuild a fresh preparation). A pay-in that changed state concurrently
(e.g. a late confirmation) is not resurrected (
ConflictException).Scope
No migration, env, or frontend change:
CryptoInput.statusis a nullable varchar and every statusused already exists; the endpoint is admin-only tooling.
Tests
#resetSend(...): forward →Acknowledged, return →ToReturn, invalid action throws.#retryUncertainSend(...): not-found, wrong-status,outTxId/returnTxIdset,missing attestation, forward/return happy path with the exact conditional update, and the
concurrent-change conflict.