From 2982f016be5ceb4b3d0754d3a37ec82eb7d25102 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 3 Mar 2023 10:57:07 +0100 Subject: [PATCH 1/3] Fix assumption that warp sync target isn't genesis --- lib/src/sync/warp_sync.rs | 9 +++++++-- wasm-node/CHANGELOG.md | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/src/sync/warp_sync.rs b/lib/src/sync/warp_sync.rs index 1743e4f071..2a7cb3a666 100644 --- a/lib/src/sync/warp_sync.rs +++ b/lib/src/sync/warp_sync.rs @@ -1303,11 +1303,16 @@ impl BuildRuntime { let chain_info_builder = chain_information::build::ChainInformationBuild::new( chain_information::build::Config { - finalized_block_header: + finalized_block_header: if header.number != 0 { + chain_information::build::ConfigFinalizedBlockHeader::Genesis { + state_trie_root_hash: header.state_root, + } + } else { chain_information::build::ConfigFinalizedBlockHeader::NonGenesis { header: header.clone(), known_finality: Some(chain_information_finality.clone()), - }, + } + }, runtime, }, ); diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index 32b03aa4fc..8280cf5833 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -12,6 +12,7 @@ ## Fixed +- Fix panic when connecting to a chain that hasn't finalized any block yet. - Fix the signatures of the `ext_default_child_storage_read_version_1` and `ext_default_child_storage_root_version_2` host functions. This would lead to a warning about these function being unresolved. ([#244](https://github.com/smol-dot/smoldot/pull/244)) - Fix panic when the input data of a Wasm function call is larger than a Wasm page. ([#218](https://github.com/smol-dot/smoldot/pull/218)) - Subscriptions to the `chain_subscribeAllHeads` JSON-RPC function now generate notifications named `chain_allHead`, like in Substrate. They were erroneously named `chain_newHead`. ([#227](https://github.com/smol-dot/smoldot/pull/227)) From 7d677af52145b9c4b8444619cddd42bdaf7a8ed9 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 3 Mar 2023 11:00:02 +0100 Subject: [PATCH 2/3] PR link --- wasm-node/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index 8280cf5833..7f28ed3bc5 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -12,7 +12,7 @@ ## Fixed -- Fix panic when connecting to a chain that hasn't finalized any block yet. +- Fix panic when connecting to a chain that hasn't finalized any block yet. ([#258](https://github.com/smol-dot/smoldot/pull/258)) - Fix the signatures of the `ext_default_child_storage_read_version_1` and `ext_default_child_storage_root_version_2` host functions. This would lead to a warning about these function being unresolved. ([#244](https://github.com/smol-dot/smoldot/pull/244)) - Fix panic when the input data of a Wasm function call is larger than a Wasm page. ([#218](https://github.com/smol-dot/smoldot/pull/218)) - Subscriptions to the `chain_subscribeAllHeads` JSON-RPC function now generate notifications named `chain_allHead`, like in Substrate. They were erroneously named `chain_newHead`. ([#227](https://github.com/smol-dot/smoldot/pull/227)) From e8c1c3fceb53fdaa7bf0eabd9385b10bd3dc6fd4 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 3 Mar 2023 12:09:05 +0100 Subject: [PATCH 3/3] Fix wrong check --- lib/src/sync/warp_sync.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/sync/warp_sync.rs b/lib/src/sync/warp_sync.rs index 2a7cb3a666..2e3dffc4cd 100644 --- a/lib/src/sync/warp_sync.rs +++ b/lib/src/sync/warp_sync.rs @@ -1303,7 +1303,7 @@ impl BuildRuntime { let chain_info_builder = chain_information::build::ChainInformationBuild::new( chain_information::build::Config { - finalized_block_header: if header.number != 0 { + finalized_block_header: if header.number == 0 { chain_information::build::ConfigFinalizedBlockHeader::Genesis { state_trie_root_hash: header.state_root, }