-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[backport] chainHead/fix: Report bestBlock events only for newBlock r…
…eports (#5527) (#5582) This backports original PR: #5527 to the release branch ``` The #5512 has surfaced that we reported a `BestBlock` event for a block not previously reported via `NewBlock`. This is because of a race between: - the stream of events that announces new blocks - `self.client.info().best_block` It is possible that `client.info()` contains newer information than the information polled from the block stream (that may be lagging). To mitigate this, instead of relying on the client's info use the last finalized block to emit a new event. There are two cases when a new best block event is emitted: - The best block is in the pruned list and is reported immediately - The best block is not a descendant of the last finalized block Closes: #5512 Thanks @jsdw and @josepot for helping debug this 🙏 cc @paritytech/subxt-team ``` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
- Loading branch information
Showing
4 changed files
with
287 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 | ||
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json | ||
|
||
title: Report BestBlock events only for newBlock reports | ||
|
||
doc: | ||
- audience: Node Dev | ||
description: | | ||
This PR ensures that the chainHead_v1_follow method of the RPC-v2 API is always | ||
reporting a `BestBlock` event after a `NewBlock`. | ||
There was a race condition in the chainHead follow logic which led to the `BestBlock` | ||
event to be emitted without an associated `NewBlock` event. | ||
|
||
crates: | ||
- name: sc-rpc-spec-v2 | ||
bump: minor | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.