fix(stellar): per-payment expiry failure isolation, event-cursor correctness, callback idempotency - #274
Merged
Conversation
…potency - stellar-monitor: wrap each expireOldPayments iteration in try/catch so a single invokeContract failure no longer aborts the whole batch; log and raise an admin alert per failure then continue remaining payments (dupdab#192) - soroban-event-indexer: advance the persisted cursor only to the ledger of the last successfully-dispatched event instead of the RPC-reported latest ledger, so failed/DLQ'd events are not skipped on subsequent polls (dupdab#193) - settlements: short-circuit handlePartnerCallback when the settlement is already in the terminal state matching the callback intent, preventing duplicate on-chain settlement attempts and re-dispatch of merchant webhooks/emails on retried callbacks (dupdab#195)
|
@tegaReed-crypto Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
expireOldPayments aborts the whole batch on one failure
StellarMonitorService.expireOldPaymentslooped over expired payments callingstellar.invokeContract('expire', ...)with no per-iteration try/catch, so asingle transient Soroban RPC failure aborted the entire batch and silently
delayed expiry of every subsequent payment until the next ~30s cycle.
and raise a deduped
STELLAR_MONITORadmin alert, then continue processing theremaining payments in the batch (mirroring the existing
confirmPaymenterror path).SorobanEventIndexer advances cursor past failed events
SorobanEventIndexer.pollEventssetlatestSeenLedgerfrom the RPC response'slatestLedgerbefore processing events and persisted that cursor regardless ofwhether some events failed to parse/dispatch and were sent to the DLQ.
dispatched event (or the RPC
latestLedgerfor an empty page, where there isnothing to reprocess), so failed/DLQ'd events are re-fetched on subsequent polls
instead of being silently skipped.
handlePartnerCallback has no idempotency check
SettlementsService.handlePartnerCallbacklooked up the settlement bypayload.referenceand unconditionally processed it, so retried partner webhooksre-invoked
stellar.invokeContract('settle', ...), re-dispatchedpayment.settledwebhooks, and re-sent settlement-completed emails.in the terminal state matching the callback intent (
success+completed, orfailed+failed).Testing
tsc --noEmitintroduces no new errors in the changed files (remainingdiagnostics are pre-existing in untouched spec/admin files).
closes #192, closes #193, closes #194, closes #195.