Skip to content

Conversation

@voliva
Copy link
Contributor

@voliva voliva commented Dec 3, 2025

Description

Fixes polkadot-api/polkadot-api#1244

The current chainHead_v1 implementation is not spec-compliant, as it states:

  • Generates an initialized notification
  • Generates one newBlock notification for each non-finalized block
  • Then a bestBlockChanged notification
  • When a new block arrives, generates a newBlock notification
  • When the node finalizes a block, generates a finalized notification

And the current implemention only emits the bestBlockChanged notification after initialized iif the best block is different from the finalized block.

PAPI recently is using this part of the spec as an assumption. Most chains are unaffected, but those that produce blocks on-demand (e.g. manual-seal) then have polkadot-api hanging until there's a higher block different than the finalized one.

Integration

This PR doesn't change any of the APIs of the node. Upgrade should be automatic.

Review Notes

This PR removes that condition so that the bestBlockChanged notification is always emited. All tests are updated to this new behaviour

Checklist

  • My PR includes a detailed description as outlined in the "Description" and its two subsections above.
  • My PR follows the labeling requirements of this project (at minimum one label for T required)
    • External contributors: Use /cmd label <label-name> to add labels
    • Maintainers can also add labels manually
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@voliva
Copy link
Contributor Author

voliva commented Dec 3, 2025

/cmd label T0-node

@voliva
Copy link
Contributor Author

voliva commented Dec 3, 2025

/cmd prdoc

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Command "label T0-node" has failed ❌! See logs here

@voliva voliva marked this pull request as ready for review December 3, 2025 17:10
@lexnv lexnv added T0-node This PR/Issue is related to the topic “node”. I2-bug The node fails to follow expected behavior. labels Dec 3, 2025
Comment on lines 25 to 38
## Review Notes

This PR removes that condition so that the `bestBlockChanged` notification is always emited. All tests are updated to this new behaviour

# Checklist

* [x] My PR includes a detailed description as outlined in the "Description" and its two subsections above.
* [ ] My PR follows the [labeling requirements](
https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process
) of this project (at minimum one label for `T` required)
* External contributors: Use `/cmd label <label-name>` to add labels
* Maintainers can also add labels manually
* [x] I have made corresponding changes to the documentation (if applicable)
* [x] I have added tests that prove my fix is effective or that my feature works (if applicable)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lets remove the checklist from the prdoc, is added by default but not really related to our release process

Copy link
Contributor

@lexnv lexnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me! @voliva thanks for handling this 🙏

@lexnv lexnv added A4-backport-stable2509 Pull request must be backported to the stable2509 release branch A4-backport-stable2512 Pull request must be backported to the stable2512 release branch labels Dec 4, 2025
@lexnv lexnv added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@lexnv lexnv enabled auto-merge December 4, 2025 20:29
@lexnv lexnv added this pull request to the merge queue Dec 5, 2025
Merged via the queue into paritytech:master with commit 68c1250 Dec 5, 2025
253 of 255 checks passed
paritytech-release-backport-bot bot pushed a commit that referenced this pull request Dec 5, 2025
…sed (#10525)

# Description

Fixes polkadot-api/polkadot-api#1244

The current chainHead_v1 implementation is [not
spec-compliant](https://paritytech.github.io/json-rpc-interface-spec/api/chainHead_v1_follow.html),
as it states:

> - Generates an `initialized` notification
> - Generates one `newBlock` notification for each non-finalized block
> - Then a `bestBlockChanged` notification
> - When a new block arrives, generates a `newBlock` notification
> - When the node finalizes a block, generates a `finalized`
notification

And the current implemention only emits the `bestBlockChanged`
notification after initialized iif the best block is different from the
finalized block.

PAPI recently is using this part of the spec as an assumption. Most
chains are unaffected, but those that produce blocks on-demand (e.g.
manual-seal) then have polkadot-api hanging until there's a higher block
different than the finalized one.

## Integration

This PR doesn't change any of the APIs of the node. Upgrade should be
automatic.

## Review Notes

This PR removes that condition so that the `bestBlockChanged`
notification is always emited. All tests are updated to this new
behaviour

# Checklist

* [x] My PR includes a detailed description as outlined in the
"Description" and its two subsections above.
* [x] My PR follows the [labeling requirements](

https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process
) of this project (at minimum one label for `T` required)
    * External contributors: Use `/cmd label <label-name>` to add labels
    * Maintainers can also add labels manually
* [x] I have made corresponding changes to the documentation (if
applicable)
* [x] I have added tests that prove my fix is effective or that my
feature works (if applicable)

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexandru Vasile <[email protected]>
(cherry picked from commit 68c1250)
@paritytech-release-backport-bot

Successfully created backport PR for stable2509:

paritytech-release-backport-bot bot pushed a commit that referenced this pull request Dec 5, 2025
…sed (#10525)

# Description

Fixes polkadot-api/polkadot-api#1244

The current chainHead_v1 implementation is [not
spec-compliant](https://paritytech.github.io/json-rpc-interface-spec/api/chainHead_v1_follow.html),
as it states:

> - Generates an `initialized` notification
> - Generates one `newBlock` notification for each non-finalized block
> - Then a `bestBlockChanged` notification
> - When a new block arrives, generates a `newBlock` notification
> - When the node finalizes a block, generates a `finalized`
notification

And the current implemention only emits the `bestBlockChanged`
notification after initialized iif the best block is different from the
finalized block.

PAPI recently is using this part of the spec as an assumption. Most
chains are unaffected, but those that produce blocks on-demand (e.g.
manual-seal) then have polkadot-api hanging until there's a higher block
different than the finalized one.

## Integration

This PR doesn't change any of the APIs of the node. Upgrade should be
automatic.

## Review Notes

This PR removes that condition so that the `bestBlockChanged`
notification is always emited. All tests are updated to this new
behaviour

# Checklist

* [x] My PR includes a detailed description as outlined in the
"Description" and its two subsections above.
* [x] My PR follows the [labeling requirements](

https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process
) of this project (at minimum one label for `T` required)
    * External contributors: Use `/cmd label <label-name>` to add labels
    * Maintainers can also add labels manually
* [x] I have made corresponding changes to the documentation (if
applicable)
* [x] I have added tests that prove my fix is effective or that my
feature works (if applicable)

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexandru Vasile <[email protected]>
(cherry picked from commit 68c1250)
@paritytech-release-backport-bot

Successfully created backport PR for stable2512:

@voliva voliva deleted the best-fix branch December 8, 2025 14:02
EgorPopelyaev added a commit that referenced this pull request Dec 9, 2025
Backport #10525 into `stable2509` from voliva.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Victor Oliva <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexandru Vasile <[email protected]>
Co-authored-by: Egor_P <[email protected]>
EgorPopelyaev added a commit that referenced this pull request Dec 9, 2025
Backport #10525 into `stable2512` from voliva.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Victor Oliva <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexandru Vasile <[email protected]>
Co-authored-by: Egor_P <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A4-backport-stable2509 Pull request must be backported to the stable2509 release branch A4-backport-stable2512 Pull request must be backported to the stable2512 release branch I2-bug The node fails to follow expected behavior. T0-node This PR/Issue is related to the topic “node”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PAPI hangs on manual-seal dev nodes because readiness waits for bestBlockChanged

3 participants