Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

RPC: Storage entry change query and notification pub/sub #135

@gavofyork

Description

@gavofyork

Websockets/pub-sub RPCs should be expanded to allow RPC clients to track specific storage items to get notifications should they change. It should also be possible to efficiently query historical changes - getting which extrinsics changed a number of storage keys over a range of blocks.

  • -> state_queryStorage(keys: [ StorageKey, ... ], from: BlockHash, to: Option<BlockHash>) -> Result<QueryIndex, Error>: Query changes of a storage entry, possibly historical and potentially tracking real-time, asynchronously reporting.
    • from: The block after which changes will be provided.
    • to: If given, the block up to which changes will be provided. If not given, then notifications will track the head of the chain as it changes.
  • <- state_notifyStorage(query: QueryIndex, until: BlockHash, changes: Changes) Notify of a change that happened in block until. This is guaranteed to be more recent than any previously reported changes. NOTE: This doesn't cover reversions - we'd probably want a separate notification type for those.

Error may be:

  • Unknown (i.e. we don't recognise from or to)

Changes takes the form of a structure:

[ {
  block: BlockHash,
  changes: [ {
    keys: [ StorageKey, ... ]
  }, ... ]
}, ... ]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions