From 040233290ed4f72e3456159108d262fe80015192 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Wed, 8 Jun 2022 05:00:17 +0300 Subject: [PATCH] Another workaround for Gemini 1b launch preventing import of bad blocks on verification --- crates/sc-consensus-subspace/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/sc-consensus-subspace/src/lib.rs b/crates/sc-consensus-subspace/src/lib.rs index 0cf2bca32b..bc2c1d7738 100644 --- a/crates/sc-consensus-subspace/src/lib.rs +++ b/crates/sc-consensus-subspace/src/lib.rs @@ -802,6 +802,21 @@ where .ok_or(Error::::MissingSalt(hash))? .salt; + // TODO: Hack for Gemini 1b launch. Solution range should have been updated already. + if *block.header.number() >= 33_671_u32.into() + && self.client.info().genesis_hash.as_ref() == GEMINI_1B_GENESIS_HASH + && solution_range == 12_009_599_006_321_322_u64 + { + debug!( + target: "subspace", + "Ignoring block from non-canonical fork" + ); + return Err(Error::::InvalidSolutionRange( + block.post_hash.unwrap_or_default(), + ) + .into()); + } + // We add one to the current slot to allow for some small drift. // FIXME https://github.com/paritytech/substrate/issues/1019 in the future, alter this // queue to allow deferring of headers