paritytech / paritytech/dotli-community

Give the chain tap typed request and subscribe primitives instead of a generic intercept hook

Open
#148 1 comment 0 reactions 1 assignee View on GitHub

@BigTava is already working on this.

Since Sep 11, 2026.

Dominant language
TypeScript
Stars
4
Forks
3
Avg merge
1d 8h
Merged PRs (30d)
40

Description

The chain tap in packages/resolver/src/smoldot-db.ts now has two mechanisms for claiming its own traffic. The owned one is typed and id-scoped (REQUEST_ID_PREFIX, pendingDbRequests, extractDb). The newer one is a caller-supplied TapIntercept predicate, which makes the tap surrender demux ownership and re-export raw JSON-RPC shape as its public contract. State that belongs to the tap then lives outside it, which is why followSubscriptions sits in smoldot.ts and has to be cleared by hand in terminateSmoldot.

The deeper shape is two primitives the tap is already half-implementing. A tap.request(method, params) generalises extractDb, which today hardcodes chainHead_unstable_finalizedDatabase, and would turn the health poll into a plain await. A tap.subscribe(method, params, onEvent) would keep the subscription id inside the tap's closure and route matching followEvent notifications, which is what makeSideChannelIntercept plus followSubscriptions do today.

That deletes TapIntercept, frees smoldot.ts of JSON-RPC framing, and ties the subscription teardown to the tap's own lifetime. Roughly 80 lines move between the two files, plus test churn. Worth doing while there is exactly one caller. Renaming smoldot-db.ts to chain-tap.ts would also stop the drift, since the module is now the chain demux layer rather than a DB helper.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.