From 95a605e0b8134c3eebadd1ea00b6b4b448c6f152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 4 Jan 2023 14:17:18 +0100 Subject: [PATCH] Aura: Do not verify on state import (#13058) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Aura: Do not verify on state import When we import the state, we can not fetch authorities to verify the seal etc. So, we can directly skip any verification. * Skip checks as well for gap sync * Update client/consensus/aura/src/import_queue.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Review comment Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> --- client/consensus/aura/src/import_queue.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index d5cf40f33359e..0973b33d402e6 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -186,6 +186,19 @@ where &mut self, mut block: BlockImportParams, ) -> Result<(BlockImportParams, Option)>>), String> { + // When importing whole state we don't verify the seal as the state is not available. + if block.with_state() { + return Ok((block, Default::default())) + } + + // Skip checks that include execution, if being told so. + // + // This is done for example when gap syncing and it is expected that the block after the gap + // was checked/chosen properly, e.g. by warp syncing to this block using a finality proof. + if block.state_action.skip_execution_checks() { + return Ok((block, Default::default())) + } + let hash = block.header.hash(); let parent_hash = *block.header.parent_hash(); let authorities = authorities(