statement-store: add the statement_unstable_ subscription functions - #3337
Draft
AndreiEres wants to merge 2 commits into
Draft
statement-store: add the statement_unstable_ subscription functions#3337AndreiEres wants to merge 2 commits into
AndreiEres wants to merge 2 commits into
Conversation
This was referenced Aug 7, 2026
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.
PR series, in merge order:
Adds
statement_unstable_subscribe/unsubscribe,statement_unstable_add_filter/remove_filter, and thestatement_unstable_subscribeEventnotification from json-rpc-interface-spec#185. Part 3/5 of the series splitting #3330.One registry serves both APIs. Each API can only reach its own subscriptions: both share a single id namespace, so without that check a legacy id passed to
add_filterwould start receiving events of an API it never called, and an unstable id passed to the legacy unsubscribe would be dropped without thestopevent its holder waits for.Filters are capped at 128 per subscription, matching polkadot-sdk;
add_filteranswers{"result":"limitReached"}beyond that, and-32801for an unknown subscription.topicFilteraccepts only"any"and{"matchAll": [1..4 topics]}—matchAnyand an emptymatchAllare turned down with-32602, as in polkadot-sdk. Both remain accepted by the legacy API, whose behavior is unchanged.add_filteremitsreplayDoneimmediately over an empty snapshot,replayStatementsnever being emitted: a light client keeps no statement store, so the replay is legitimately empty. Peers then resend everything matching the updated affinity filter, and the per-subscription deduplication drops what was already delivered, so only unseen statements reach the client throughnewStatements, each carrying the ids of the filters that matched it.-32800is never returned, as the number of statement subscriptions per client is not capped. The specification requires accepting at least 2 and only permits erroring beyond that, so this is compliant.Divergences from what the specification assumes of a full node, to raise on the spec PR (see #3330 for the discussion):
replayDonearrives before the effective backlog, which arrives afterwards throughnewStatements, delayed by up to the affinity update interval.newStatementsis what the at-most-once guarantee forbids. A complete backlog for a filter requires a fresh subscription.🤖 Generated with Claude Code