Skip to content

Put the network in the Redis cache key #182

Closed

Description

@Miracle656

Background

defaultKeyFn (src/cache/redis.ts:131-137) builds the cache key from method, path and sorted query string. But the network selector is also accepted as the X-Network header (src/middleware/network.ts:31, 44-46), which is invisible to that function.

/assets/popular and /search are both cached (src/api.ts:205, 211). With CACHE_ENABLED=true and both networks enabled, a mainnet request and a testnet request collide on one key, and whichever lands first is served to both chains for the whole TTL.

Acceptance criteria

  • The key includes the resolved req.network
  • Two requests differing only by X-Network produce different keys — fails on main
  • ?network=mainnet and X-Network: mainnet produce the same key, so they share an entry
  • The PR notes that existing keys change shape and simply expire

Drips Wave · Complexity: Easy · 100 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. rndsa commented on Sep 25, 2026

    @rndsa

    Submitted PR #195 adding req.network into defaultKeyFn and ensuring query and header network selectors share the same cache entry.

  2. RikaTech2006 commented on Sep 25, 2026

    @RikaTech2006
    Contributor

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

    Based on your request, I will implement and fix this issue according to the design requirement and to fit your acceptance criteria.

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

  3. 0darkside0rbit-star commented on Sep 26, 2026

    @0darkside0rbit-star

    @0darkside0rbit-star 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 @0darkside0rbit-star to this issue.

  4. 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.

    Ahh sorry am just running

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

  5. drips-wave commented on Sep 26, 2026

    @drips-wave

    Congratulations, @funds0033-cmyk! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.

    🧑‍💻 @funds0033-cmyk: 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 🌊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions