Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] chainHead/fix: Report bestBlock events only for newBlock reports (#5527) #5582

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Sep 4, 2024

This backports original PR: #5527 to the release branch


The https://github.com/paritytech/polkadot-sdk/issues/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: https://github.com/paritytech/polkadot-sdk/issues/5512 

Thanks @jsdw and @josepot for helping debug this 🙏 

cc @paritytech/subxt-team

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>
Co-authored-by: command-bot <>
@lexnv lexnv added the R0-silent Changes should not be mentioned in any release notes label Sep 4, 2024
@lexnv lexnv self-assigned this Sep 4, 2024
Copy link

github-actions bot commented Sep 4, 2024

This pull request is amending an existing release. Please proceed with extreme caution,
as to not impact downstream teams that rely on the stability of it. Some things to consider:

  • Backports are only for 'patch' or 'minor' changes. No 'major' or other breaking change.
  • Should be a legit fix for some bug, not adding tons of new features.
  • Must either be already audited or not need an audit.
Emergency Bypass

If you really need to bypass this check: add validate: false to each crate
in the Prdoc where a breaking change is introduced. This will release a new major
version of that crate and all its reverse dependencies and basically break the release.

@EgorPopelyaev EgorPopelyaev merged commit 533b951 into stable2409 Sep 4, 2024
200 of 217 checks passed
@EgorPopelyaev EgorPopelyaev deleted the lexnv/backport-rpc-fix branch September 4, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants