Repository navigation
Advance the cursor to the ledger actually covered, not the chain tip #180
Description
Background
fetchEvents (src/rpc.ts:105-145) sends one getEvents request with a limit and returns resp.latestLedger — the network tip, not the highest ledger the returned events actually cover. It never reads resp.cursor, so a truncated page is simply lost. fetchEventsSafe's happy path (src/rpc.ts:217-219) passes that tip straight through as highestLedger, ignoring its endLedger argument, and pollOnce commits it as the cursor (src/indexer.ts:402).
Two consequences: a range producing more than EVENTS_BATCH_SIZE events drops the remainder and never refetches it, and the cursor jumps past target = tip - TIP_LAG (src/indexer.ts:483), defeating the propagation buffer that exists to avoid reading un-settled ledgers.
Acceptance criteria
-
fetchEventsreturns the paging cursor and the maximumevent.ledgerseen, alongsidelatestLedger - A full page causes the caller to page with the cursor until the range is drained or a page budget is hit
-
highestLedgerismin(last ledger fully covered, endLedger)— never the raw tip - A test with a mocked RPC returning exactly
limitevents proves the second page is lost onmainand ingested after - A test proves the cursor never exceeds the
endLedgerpassed in
Drips Wave · Complexity: Advanced · 200 points
How this repo is laid out
Wraith is a Soroban incoming-transfer indexer: it fills the gap Horizon leaves for SAC/SEP-41 token events by recipient address. Roughly 14k lines under src/, REST + GraphQL + WebSocket, Postgres via Prisma, deployed on Render.
- Unit tests are jest (
src/**/__tests__,tests/*.test.ts), with a coverage gate. - Integration tests are vitest (
tests/integration/,vitest.integration.config.ts, Docker). - Don't mix the two runners in one file.
Known state of main before you start
tsc --noEmit and the unit suite are green. The Integration tests CI job is red, and so is Load test — both predate this batch. Open PRs #177 and #178 address them. If the integration job is red when you open a PR, that is not your fault; say so in the PR and carry on.
Four modules are shipped, closed as done, and imported by nothing: src/indexer/checkpoint.ts, src/ingest/reorg.ts, src/middleware/opa.ts, and src/api/candles.ts + src/workers/ohlc-refresh.ts. So the live indexer today has no reorg handling and no atomic checkpointing, despite both features being closed. Two issues below start unpicking that — don't assume a closed issue means a wired feature.
Ground rules
- Every PR needs a test that fails before the change and passes after, unless the issue says otherwise.
- Don't widen a Prometheus label to something unbounded — addresses and contract ids must never become label values.
- Nothing may log or return a raw database error, a connection string, or a provider URL.
- Don't reformat a file you're changing. A diff that is 90% whitespace hides the 10% that matters.
Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk
Activity
Richard-tobi commentedon Sep 24, 2026
@Richard-tobi has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Richard-tobi to this issue.
tomasbogado203-bit commentedon Sep 24, 2026
@tomasbogado203-bit has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @tomasbogado203-bit to this issue.
barnabasolutayo-lgtm commentedon Sep 24, 2026
@barnabasolutayo-lgtm has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @barnabasolutayo-lgtm to this issue.
DevScoopee commentedon Sep 25, 2026
@DevScoopee has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @DevScoopee to this issue.
shogun444 commentedon Sep 26, 2026
@shogun444 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @shogun444 to this issue.
funds0033-cmyk commentedon Sep 26, 2026
@funds0033-cmyk has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @funds0033-cmyk to this issue.
drips-wave commentedon Sep 26, 2026
Congratulations, @Richard-tobi! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.
🧑💻 @Richard-tobi: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
fix: commit the minimum covered ledger across partitions
fix(Miracle656#180): re-apply the drain-cursor fix on the parallel in…
feat: Advance the cursor to the ledger actually covered, not the c (M…
feat: Advance the cursor to the ledger actually covered, not the c (M…
feat: Advance the cursor to the ledger actually covered, not the c (M…