Skip to content

Fetch parent block api_version#9059

Merged
bkchr merged 2 commits intomasterfrom
bkchr-fetch-old-api-version
Jul 2, 2025
Merged

Fetch parent block api_version#9059
bkchr merged 2 commits intomasterfrom
bkchr-fetch-old-api-version

Conversation

@bkchr
Copy link
Copy Markdown
Member

@bkchr bkchr commented Jul 1, 2025

This is required to ensure that we use the api_version of the runtime that will be used on the relay chain to validate the block. Otherwise the node may thinks the runtime was already upgraded and sends data to the relay chain that can not be decoded by the runtime and thus, the validation fails.

This is required to ensure that we use the `api_version` of the runtime that will be used on the relay chain to validate the block. Otherwise the node may thinks the runtime was already upgraded and sends data to the relay chain that can not be decoded by the runtime and thus, the validation fails.
@bkchr bkchr added T0-node This PR/Issue is related to the topic “node”. T9-cumulus This PR/Issue is related to cumulus. labels Jul 1, 2025
@bkchr
Copy link
Copy Markdown
Member Author

bkchr commented Jul 1, 2025

/cmd prdoc --audience node_dev --bump patch

@bkchr bkchr added the A4-backport-stable2506 Pull request must be backported to the stable2506 release branch label Jul 1, 2025
@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/16010727105
Failed job name: test-linux-stable-runtime-benchmarks

@skunert
Copy link
Copy Markdown
Contributor

skunert commented Jul 2, 2025

Logic LGTM.

For everyone wondering what is happening:

  • The BlockData encoding format introduced in cumulus: ParachainBlockData support multiple blocks #6137 is chosen based on the api version of the CollectCollationInfo runtime API. If the API version is >= 3, we use the new encoding: service.rs
  • So when the RC signals to the Parachain that it can now upgrade its code, the Parachain will perform the code replacement.
  • This is where After runtime upgrade, Runtime API calls use new code with unmigrated storage #64 kicks in. The API version is read straight from the code blob. However, the validation code on the RC is still the old one. So the Parachain node is encoding the blocks in the new format, but the validation code is not yet aware of it and fails to decode.
  • The fix here is to use the encoding format that reflects the state of code at the start of the block, before it was updated.

@bkchr bkchr enabled auto-merge July 2, 2025 08:39
@bkchr bkchr added this pull request to the merge queue Jul 2, 2025
Merged via the queue into master with commit e3f52a0 Jul 2, 2025
282 of 339 checks passed
@bkchr bkchr deleted the bkchr-fetch-old-api-version branch July 2, 2025 10:30
paritytech-release-backport-bot bot pushed a commit that referenced this pull request Jul 2, 2025
This is required to ensure that we use the `api_version` of the runtime
that will be used on the relay chain to validate the block. Otherwise
the node may thinks the runtime was already upgraded and sends data to
the relay chain that can not be decoded by the runtime and thus, the
validation fails.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit e3f52a0)
@paritytech-release-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for stable2506:

EgorPopelyaev pushed a commit that referenced this pull request Jul 2, 2025
Backport #9059 into `stable2506` from bkchr.

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: Bastian Köcher <git@kchr.de>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ordian added a commit that referenced this pull request Jul 24, 2025
* master: (91 commits)
  Add extra information to the harmless error logs during validate_transaction (#9047)
  `sp-tracing`: Remove `test-utils` feature (#9063)
  add try-state check for staking roles -- staker cannot be nominator a… (#9034)
  net/discovery: File persistence for `AddrCache` (#8839)
  dispute-coordinator: handle race with offchain disabling (#9050)
  Align parameters for `EventEmitter::emit_sent_event` (#9057)
  Fetch parent block `api_version` (#9059)
  [XCM Precompile] Rename functions and improve docs in the Solidity interface (#9023)
  Cleanup and improvements for `ControlledValidatorIndices` (#8896)
  reenable 0001-parachains-pvf (#9046)
  Add optional auto-rebag within on-idle (#8684)
  Fix flaxy 0003-block-building-warp-sync test - one more approach (#8974)
  [Staking] [AHM] Fixes insufficient slashing of nominators (and some other small issues). (#8937)
  chore: Bump bounded-collections dep (#9004)
  XCMP and DMP improvements (#8860)
  EPMB/unsigned: fixed multi-page winner computation (#8987)
  Always send full parent header, not only hash, part of collation response (#8939)
  revive: Precompiles should return dummy code when queried (#9001)
  Fix confusing log messages in network protocol behaviour (#8819)
  Fix pallet_migrations benchmark when FailedMigrationHandler emits events (#8694)
  ...
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
This is required to ensure that we use the `api_version` of the runtime
that will be used on the relay chain to validate the block. Otherwise
the node may thinks the runtime was already upgraded and sends data to
the relay chain that can not be decoded by the runtime and thus, the
validation fails.

---------

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

Labels

A4-backport-stable2506 Pull request must be backported to the stable2506 release branch T0-node This PR/Issue is related to the topic “node”. T9-cumulus This PR/Issue is related to cumulus.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants