Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion cumulus/client/collator/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ where
};

// Create the parachain block data for the validators.
let (collation_info, api_version) = self
let (collation_info, _api_version) = self
.fetch_collation_info(block_hash, block.header())
.map_err(|e| {
tracing::error!(
Expand All @@ -247,6 +247,20 @@ where
.ok()
.flatten()?;

// Workaround for: https://github.com/paritytech/polkadot-sdk/issues/64
//
// We are always using the `api_version` of the parent block. The `api_version` can only
// change with a runtime upgrade and this is when we want to observe the old `api_version`.
// Because this old `api_version` is the one used to validate this block. Otherwise we
// already assume the `api_version` is higher than what the relay chain will use and this
// will lead to validation errors.
let api_version = self
.runtime_api
.runtime_api()
.api_version::<dyn CollectCollationInfo<Block>>(parent_header.hash())
.ok()
.flatten()?;

let block_data = ParachainBlockData::<Block>::new(vec![block], compact_proof);

let pov = polkadot_node_primitives::maybe_compress_pov(PoV {
Expand Down
8 changes: 8 additions & 0 deletions prdoc/pr_9059.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Fetch parent block `api_version`
doc:
- audience: Node Dev
description: |-
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.
crates:
- name: cumulus-client-collator
bump: patch
Loading