diff --git a/cumulus/polkadot-omni-node/lib/src/common/runtime.rs b/cumulus/polkadot-omni-node/lib/src/common/runtime.rs index 1be88aec56c1a..8d65813fe6d1e 100644 --- a/cumulus/polkadot-omni-node/lib/src/common/runtime.rs +++ b/cumulus/polkadot-omni-node/lib/src/common/runtime.rs @@ -43,11 +43,28 @@ pub enum AuraConsensusId { /// /// Most parachains use Sr25519 for Aura consensus, but Asset Hub Polkadot /// (formerly Statemint) uses Ed25519. +/// +/// # Returns +/// +/// Returns `AuraConsensusId::Ed25519` for chain spec IDs starting with +/// `asset-hub-polkadot` or `statemint`, and `AuraConsensusId::Sr25519` for all +/// other chains. pub fn aura_id_from_chain_spec_id(id: &str) -> AuraConsensusId { - let id = id.replace('_', "-"); - if id.starts_with("asset-hub-polkadot") || id.starts_with("statemint") { + let id_normalized = id.replace('_', "-"); + if id_normalized.starts_with("asset-hub-polkadot") || id_normalized.starts_with("statemint") { + log::warn!( + "⚠️ Aura authority id type is assumed to be `ed25519` because the chain spec id \ + starts with `asset-hub-polkadot` or `statemint`. This is a known special case for \ + Asset Hub Polkadot (formerly Statemint). If this assumption is wrong for your runtime, \ + the node may not work correctly." + ); AuraConsensusId::Ed25519 } else { + log::warn!( + "⚠️ Aura authority id type is assumed to be `sr25519` by default. Runtimes using \ + `ed25519` for Aura are not yet supported (except for `asset-hub-polkadot` / `statemint`). \ + If your runtime uses `ed25519` for Aura, it may not work correctly with this node." + ); AuraConsensusId::Sr25519 } } @@ -136,7 +153,7 @@ impl RuntimeResolver for DefaultRuntimeResolver { if !metadata_inspector.pallet_exists(DEFAULT_PARACHAIN_SYSTEM_PALLET_NAME) { log::warn!( r#"⚠️ The parachain system pallet (https://docs.rs/crate/cumulus-pallet-parachain-system/latest) is - missing from the runtime’s metadata. Please check Omni Node docs for runtime conventions: + missing from the runtime's metadata. Please check Omni Node docs for runtime conventions: https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/omni_node/index.html#runtime-conventions."# ); } diff --git a/prdoc/pr_11102.prdoc b/prdoc/pr_11102.prdoc new file mode 100644 index 0000000000000..82cb5666531cc --- /dev/null +++ b/prdoc/pr_11102.prdoc @@ -0,0 +1,17 @@ +title: 'polkadot-omni-node-lib: emit warnings for aura authority id type assumptions' +doc: +- audience: Node Dev + description: |- + closes https://github.com/paritytech/polkadot-sdk/issues/11026 + + This PR adds explicit warnings at node startup to surface these assumptions: + + - When the chain spec id starts with `asset-hub-polkadot` or `statemint`, + the node assumes `ed25519` as the Aura authority id type and now emits a + warning documenting this specific assumption. + - For all other chains, the node assumes `sr25519` by default and now emits + a warning noting that `ed25519` runtimes are not yet + supported. +crates: +- name: polkadot-omni-node-lib + bump: patch