Skip to content

DAPI: stream committed document transitions that match a subscription filter (verifiable document subscriptions) #5274

Done

Description

@PastaPastaPasta

Drive has a filter for matching document state transitions, written "to be used in the context of clients subscribing to document events" (#2761, #2781). DAPI has no RPC that uses it, and the Platform service has no streaming RPC at all, so an application that wants to react to new documents has to poll. We would like a server-streaming DAPI call that delivers the document transitions matching such a filter, in a form the client can verify.

We hit this building Dash Forge, a git forge that runs on Platform. Its notifications, CI runners and webhook relay all depend on hearing about new documents.

Expected Behavior

A client opens one stream with a filter (contract id, document type, action and clauses, the shape DriveDocumentQueryFilter already takes) and receives each matching document transition once it is committed, with its block height and transition hash. The client can check what it receives against Platform state instead of trusting the node that sent it.

Current Behavior

The filter exists, but nothing serves it.

DAPI has no Platform stream.

  • None of the 73 RPCs of the Platform service in platform.proto is server-streaming. The closest is waitForStateTransitionResult, which waits for one transition whose hash the client already knows.
  • The Core service does stream: subscribeToBlockHeadersWithChainLocks, subscribeToTransactionsWithProofs and subscribeToMasternodeList (core.proto L13-L15).

rs-dapi already sees every Platform transaction.

An earlier attempt was closed. #2795 added subscribePlatformEvents: an event bus in drive-abci, block-committed and state-transition-result events, a DAPI proxy and an rs-sdk helper. Its description calls those events a proof of concept and lists "document updates, identity changes" as further work. It was closed unmerged on 2026-08-21. Parts of it are at the tag:

  • the rs-dash-event-bus crate, whose header still lists an event_mux module that is not there (lib.rs L1-L8);
  • subscribePlatformEvents in rs-dapi's table of streaming methods, although the proto has no such RPC (grpc.rs L116-L122).

We could not find an open issue or PR that tracks document subscriptions.

Possible Solution

A suggestion; you will know better where the pieces should live.

  • A server-streaming RPC, for example subscribeToDocumentTransitions(filter), whose request carries the fields of DriveDocumentQueryFilter (contract id, document type name, action and clauses) and is checked with its validate() (L496).
  • Each message carries the block height, the transition hash, the matching transition (or its index in the batch), and the block time.
  • To verify, a client could ask for the same proof waitForStateTransitionResult returns with prove: true, either attached to the message or by a follow-up call per hash. Even without a proof on every message, a stream of hashes and heights that the client then reads with proofs would replace polling and keep the client verifying.
  • Some open questions we noticed and can't answer:

Alternatives Considered

  • Polling (what we do). Forge's inbox reads up to 12 document feeds every 60 seconds per open tab (inbox.ts L71-L77). Self-hosted CI runners poll their repositories every two minutes by default (forge-relay README L110-L113). Notifications arrive up to a minute late and CI up to two, and every poll that finds nothing still counts against dashmate's default gateway limit of 150 requests per minute per IP (getBaseConfigFactory.js L254-L255, rate_limiter.yaml.dot L1-L6).
  • A relay. Forge ships a relay a user can run to poll on behalf of runners and wake them. It works, but it is one more service someone has to host, and the runner trusts it rather than Platform.
  • subscribePlatformEvents as in feat(platform): add real-time platform event subscriptions via gRPC streaming #2795. Block-committed events alone would let a client poll only when a block lands, which helps with latency but not with the number of reads. A document filter is what removes the reads.

Additional Context

Activity

  1. added
    enhancement
    dapi-endpoint
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dapi-endpointenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions