feat: Soroban event listener with reconnect, dedup, and polling fallback#94
Open
Arowolokehinde wants to merge 1 commit into
Open
feat: Soroban event listener with reconnect, dedup, and polling fallback#94Arowolokehinde wants to merge 1 commit into
Arowolokehinde wants to merge 1 commit into
Conversation
Implements the background event streaming service for the escrow contract
(closes issue on Horizon/Soroban event listener with polling fallback).
Key changes:
- EscrowEventListener: cursor-based RPC polling with full-jitter exponential
backoff, injectable deps for testability, and isHealthy() signal exposed
on /health for the polling-fallback UX
- event-dispatcher: pure parseEscrowEvent + idempotent applyEscrowEvent;
released → completed, refunded → cancelled, both guarded with NOT IN
terminal states to prevent double-mutations
- Deduplication via existing processed_tx table (evt:{id} keys, O(1) PK lookup)
- contract_trade_id column on trades (sha256 of secret_hash) for O(1)
event → trade lookup; populated at lock time
- event_cursor table persists polling position across restarts; atomic
UPSERT on PostgreSQL, check-then-set on in-memory fallback
- Graceful cursor reset when RPC 7-day window is exceeded after long downtime
- 20 tests across 7 suites (no network or PostgreSQL required)
- Existing frontend polling and Horizon confirmation loop untouched
|
@Arowolokehinde 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.
Implements the background event streaming service for the escrow contract (closes issue on Horizon/Soroban event listener with polling fallback).
Closes #85
Key changes: