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
23 changes: 20 additions & 3 deletions cumulus/polkadot-omni-node/lib/src/common/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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 runtimes 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."#
);
}
Expand Down
17 changes: 17 additions & 0 deletions prdoc/pr_11102.prdoc
Original file line number Diff line number Diff line change
@@ -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
Loading