From 9cbb7535acfc8f1666c42a88a7839554be2a8ae8 Mon Sep 17 00:00:00 2001 From: Sebastian Kunert Date: Tue, 17 Dec 2024 21:44:01 +0100 Subject: [PATCH] omni-node: Tolerate failing metadata check (#6923) #6450 introduced metadata checks. Supported are metadata v14 and higher. However, of course old chain-specs have a genesis code blob that might be on older version. This needs to be tolerated. We should just skip the checks in that case. Fixes #6921 --------- Co-authored-by: command-bot <> --- Cargo.lock | 1 - cumulus/polkadot-omni-node/lib/Cargo.toml | 1 - cumulus/polkadot-omni-node/lib/src/common/runtime.rs | 6 +++++- prdoc/pr_6923.prdoc | 12 ++++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 prdoc/pr_6923.prdoc diff --git a/Cargo.lock b/Cargo.lock index 3e4675365d21..1efda122d1f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18266,7 +18266,6 @@ dependencies = [ "sp-crypto-hashing 0.1.0", "sp-genesis-builder 0.8.0", "sp-inherents 26.0.0", - "sp-io 30.0.0", "sp-keystore 0.34.0", "sp-runtime 31.0.1", "sp-session 27.0.0", diff --git a/cumulus/polkadot-omni-node/lib/Cargo.toml b/cumulus/polkadot-omni-node/lib/Cargo.toml index 43478b41a119..b1937427be66 100644 --- a/cumulus/polkadot-omni-node/lib/Cargo.toml +++ b/cumulus/polkadot-omni-node/lib/Cargo.toml @@ -69,7 +69,6 @@ sp-inherents = { workspace = true, default-features = true } sp-api = { workspace = true, default-features = true } sp-consensus = { workspace = true, default-features = true } sp-consensus-aura = { workspace = true, default-features = true } -sp-io = { workspace = true, default-features = true } sc-consensus-manual-seal = { workspace = true, default-features = true } sc-sysinfo = { workspace = true, default-features = true } prometheus-endpoint = { workspace = true, default-features = true } diff --git a/cumulus/polkadot-omni-node/lib/src/common/runtime.rs b/cumulus/polkadot-omni-node/lib/src/common/runtime.rs index 2a95f41495a6..fcc1d7f0643e 100644 --- a/cumulus/polkadot-omni-node/lib/src/common/runtime.rs +++ b/cumulus/polkadot-omni-node/lib/src/common/runtime.rs @@ -103,7 +103,11 @@ pub struct DefaultRuntimeResolver; impl RuntimeResolver for DefaultRuntimeResolver { fn runtime(&self, chain_spec: &dyn ChainSpec) -> sc_cli::Result { - let metadata_inspector = MetadataInspector::new(chain_spec)?; + let Ok(metadata_inspector) = MetadataInspector::new(chain_spec) else { + log::info!("Unable to check metadata. Skipping metadata checks. Metadata checks are supported for metadata versions v14 and higher."); + return Ok(Runtime::Omni(BlockNumber::U32, Consensus::Aura(AuraConsensusId::Sr25519))) + }; + let block_number = match metadata_inspector.block_number() { Some(inner) => inner, None => { diff --git a/prdoc/pr_6923.prdoc b/prdoc/pr_6923.prdoc new file mode 100644 index 000000000000..5d88d7158e7f --- /dev/null +++ b/prdoc/pr_6923.prdoc @@ -0,0 +1,12 @@ +title: 'omni-node: Tolerate failing metadata check' +doc: +- audience: Node Operator + description: |- + #6450 introduced metadata checks. Supported are metadata v14 and higher. + + However, of course old chain-specs have a genesis code blob that might be on older version. This needs to be tolerated. We should just skip the checks in that case. + + Fixes #6921 +crates: +- name: polkadot-omni-node-lib + bump: patch