Skip to content

Advance the cursor to the ledger actually covered, not the chain tip #180

Open

Description

@Miracle656

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

  • fetchEvents returns the paging cursor and the maximum event.ledger seen, alongside latestLedger
  • A full page causes the caller to page with the cursor until the range is drained or a page budget is hit
  • highestLedger is min(last ledger fully covered, endLedger) — never the raw tip
  • A test with a mocked RPC returning exactly limit events proves the second page is lost on main and ingested after
  • A test proves the cursor never exceeds the endLedger passed 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

  1. Richard-tobi commented on Sep 24, 2026

    @Richard-tobi

    @Richard-tobi has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hello, I’m interested in contributing to this issue and would appreciate the opportunity to work on it. I’m ready to dedicate the necessary time and effort to deliver a reliable solution. Thank you for considering my request.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Richard-tobi to this issue.

  2. tomasbogado203-bit commented on Sep 24, 2026

    @tomasbogado203-bit

    @tomasbogado203-bit has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    i would like to work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @tomasbogado203-bit to this issue.

  3. barnabasolutayo-lgtm commented on Sep 24, 2026

    @barnabasolutayo-lgtm

    @barnabasolutayo-lgtm has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hello Maintainer. Please assign this task to me. I'm grateful

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @barnabasolutayo-lgtm to this issue.

  4. DevScoopee commented on Sep 25, 2026

    @DevScoopee
    Contributor

    @DevScoopee has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    I fully understand what needs to be done and can deliver. Kindly assign

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @DevScoopee to this issue.

  5. shogun444 commented on Sep 26, 2026

    @shogun444
    Contributor

    @shogun444 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hi @maintainers,
    I'd love to take this on. I have 3+ years of experience and have already contributed to this repo, so I know the codebase well. I've starred the repository and can rebuild the explorer cleanly against the real spec.
    Portfolio: https://portfolio-amber-one-v8ggyhsjyr.vercel.app

    Kindly assign this to me, thank you!

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @shogun444 to this issue.

  6. funds0033-cmyk commented on Sep 26, 2026

    @funds0033-cmyk
    Contributor

    @funds0033-cmyk has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Dear maintainer pls assign me to this

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @funds0033-cmyk to this issue.

  7. drips-wave commented on Sep 26, 2026

    @drips-wave

    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 🌊

  8. added 2 commits that reference this issue on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions