From 32d289f107e750f2cf1096ed0f95321f35eb79b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 28 Jan 2023 20:10:40 +0100 Subject: [PATCH] sc-finality-grandpa: Warp proof generation can not expect justifications (#13249) When a node is running with `--blocks-pruning` it will also prunes justifications. So, the warp proof generation can not use `expect` for unwrapping the justification. --- client/cli/src/params/pruning_params.rs | 1 + client/finality-grandpa/src/warp_proof.rs | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/client/cli/src/params/pruning_params.rs b/client/cli/src/params/pruning_params.rs index fd01ba67bab7d..66282fd08848c 100644 --- a/client/cli/src/params/pruning_params.rs +++ b/client/cli/src/params/pruning_params.rs @@ -49,6 +49,7 @@ pub struct PruningParams { /// [default: 256] #[arg(alias = "pruning", long, value_name = "PRUNING_MODE")] pub state_pruning: Option, + /// Specify the blocks pruning mode. /// /// This mode specifies when the block's body (including justifications) diff --git a/client/finality-grandpa/src/warp_proof.rs b/client/finality-grandpa/src/warp_proof.rs index c65a705d3e844..1169083ea1d51 100644 --- a/client/finality-grandpa/src/warp_proof.rs +++ b/client/finality-grandpa/src/warp_proof.rs @@ -135,11 +135,7 @@ impl WarpSyncProof { let justification = blockchain .justifications(header.hash())? .and_then(|just| just.into_justification(GRANDPA_ENGINE_ID)) - .expect( - "header is last in set and contains standard change signal; \ - must have justification; \ - qed.", - ); + .ok_or_else(|| Error::MissingData)?; let justification = GrandpaJustification::::decode(&mut &justification[..])?;