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
4 changes: 3 additions & 1 deletion cumulus/client/parachain-inherent/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ pub struct MockValidationDataInherentDataProvider<R = ()> {
/// The relay block in which this parachain appeared to start. This will be the relay block
/// number in para block #P1.
pub relay_offset: u32,
/// The relay parent offset that determines how many relay parent descendants are required.
pub relay_parent_offset: u32,
/// The number of relay blocks that elapses between each parablock. Probably set this to 1 or 2
/// to simulate optimistic or realistic relay chain behavior.
pub relay_blocks_per_para_block: u32,
Expand Down Expand Up @@ -230,7 +232,7 @@ impl<R: Send + Sync + GenerateRandomness<u64>> InherentDataProvider
sproof_builder.included_para_head = self.current_para_block_head.clone();
sproof_builder.num_authorities = 2;
let (relay_parent_storage_root, proof, relay_parent_descendants) =
sproof_builder.into_state_root_proof_and_descendants(1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm how did this work with a value of 1 before, did we break it in previous PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was just introduced last week and probably never tested :P

sproof_builder.into_state_root_proof_and_descendants(self.relay_parent_offset.into());
let parachain_inherent_data = ParachainInherentData {
validation_data: PersistedValidationData {
parent_head: Default::default(),
Expand Down
5 changes: 5 additions & 0 deletions cumulus/polkadot-omni-node/lib/src/nodes/aura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ use cumulus_client_parachain_inherent::MockValidationDataInherentDataProvider;
use cumulus_client_service::CollatorSybilResistance;
use cumulus_primitives_core::{
relay_chain::ValidationCode, CollectCollationInfo, GetParachainInfo, ParaId,
RelayParentOffsetApi,
};
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
use futures::{prelude::*, FutureExt};
Expand Down Expand Up @@ -430,11 +431,15 @@ where
UniqueSaturatedInto::<u32>::unique_saturated_into(*current_para_head.number()) + 1;
log::info!("Current block number: {current_block_number}");

let relay_parent_offset =
client.runtime_api().relay_parent_offset(block).unwrap_or_default();

let mocked_parachain = MockValidationDataInherentDataProvider::<()> {
current_para_block: current_block_number,
para_id,
current_para_block_head,
relay_blocks_per_para_block: 1,
relay_parent_offset,
para_blocks_per_relay_epoch: 10,
upgrade_go_ahead: should_send_go_ahead.then(|| {
log::info!("Detected pending validation code, sending go-ahead signal.");
Expand Down
11 changes: 11 additions & 0 deletions prdoc/pr_10658.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: 'Omninode instant seal: Support relay parent offset'
doc:
- audience: Node Dev
description: |-
This brings support for relay parent offset to the omni-node instant seal consensus engine. Before instant seal was not working with relay parent offsets bigger than `0`.

crates:
- name: cumulus-client-parachain-inherent
bump: patch
- name: polkadot-omni-node-lib
bump: patch
Loading