paritytech / subxt

Interact with Substrate based nodes in Rust or WebAssembly
Other
391 stars 236 forks source link

unstable rpc backend: `best_block` or `all_blocks` subscription may be silently lose blocks when reconnecting #1568

Open niklasad1 opened 2 months ago

niklasad1 commented 2 months ago

It's possible that blocks may be be silently missed if a reconnecting occurs because it's restarted by unstable backend.

For instance the following could happen:

  1. A connection is established
  2. Block A, Block B, and Block C are announced and propagated in the subscription
  3. The connection is lost and during this phase Block D is announced
  4. Then after a while the connection is re-established and the next Block E is announced.

Thus, Block D is missed and no way to now about it.

Because subxt mainly care about that finalized blocks, it's not critical for now.

jsdw commented 2 months ago

Yeah, it's hard to know how much I care about missed new/best block notifications because they are ephemeral anyway; as long as all finalized blocks are notified then it's all good, and if you re-subscribe then you should be told about recent new blocks and the latest current best block again anyways :)

lexnv commented 2 months ago

Yep, something we can think about in the future. One use-case may be users that want to query a pruned block, where block D was announced, the client disconnected, the chain pruned block D and the client reconnects.