diff --git a/cumulus/client/parachain-inherent/src/mock.rs b/cumulus/client/parachain-inherent/src/mock.rs index 983c2ed89dbda..6c57396f3453b 100644 --- a/cumulus/client/parachain-inherent/src/mock.rs +++ b/cumulus/client/parachain-inherent/src/mock.rs @@ -54,6 +54,8 @@ pub struct MockValidationDataInherentDataProvider { /// 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, @@ -230,7 +232,7 @@ impl> 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); + 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(), diff --git a/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs b/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs index bbdce78d0121d..9cd0246ceff56 100644 --- a/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs +++ b/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs @@ -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}; @@ -430,11 +431,15 @@ where UniqueSaturatedInto::::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."); diff --git a/prdoc/pr_10658.prdoc b/prdoc/pr_10658.prdoc new file mode 100644 index 0000000000000..d334b2064e42e --- /dev/null +++ b/prdoc/pr_10658.prdoc @@ -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