diff --git a/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs b/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs index 6b9f5bb835121..ae3c35a34372f 100644 --- a/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs +++ b/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs @@ -666,9 +666,16 @@ where max_pov_percentage: node_extra_args.max_pov_percentage, }; - // We have a separate function only to be able to use `docify::export` on this piece of - // code. - Self::launch_slot_based_collator(params); + let wait_client = client.clone(); + let fut = async move { + wait_for_aura::(wait_client).await; + // We have a separate function only to be able to use `docify::export` on this + // piece of code. + Self::launch_slot_based_collator(params); + }; + task_manager + .spawn_essential_handle() + .spawn("slot-based-collator-init", None, fut); Ok(()) } diff --git a/prdoc/pr_11381.prdoc b/prdoc/pr_11381.prdoc new file mode 100644 index 0000000000000..b721050bdbebf --- /dev/null +++ b/prdoc/pr_11381.prdoc @@ -0,0 +1,23 @@ +title: Fix slot-based collator panic during warp sync (#11072) +doc: +- audience: Node Dev + description: |- + When a parachain collator starts with `--authoring=slot-based` and performs warp sync, the `slot-based-block-builder` essential task immediately calls `slot_duration()` which requires `AuraApi_slot_duration`. During warp sync the runtime isn't ready, so this fails and the task returns, shutting down the node. + + The lookahead collator avoids this by calling `wait_for_aura()` before starting. This PR adds an equivalent guard to the slot-based collator. + + ### Manual test + Before the fix the collator panicked after the relay chain warp sync with AuraApi_slot_duration not available, which does not occur anymore now. + ``` + ./target/release/polkadot-parachain \ + --chain asset-hub-polkadot \ + --sync warp \ + --authoring=slot-based \ + --tmp -- --sync warp + ``` + Closes #11072. +crates: +- name: cumulus-client-consensus-aura + bump: patch +- name: polkadot-omni-node-lib + bump: patch