diff --git a/crates/sc-consensus-subspace/src/archiver.rs b/crates/sc-consensus-subspace/src/archiver.rs index c4ed38d2f2..3339df118f 100644 --- a/crates/sc-consensus-subspace/src/archiver.rs +++ b/crates/sc-consensus-subspace/src/archiver.rs @@ -687,16 +687,19 @@ where let last_archived_block_encoded = encode_block(last_archived_block); - let archiver = Archiver::with_initial_state( + Archiver::with_initial_state( subspace_link.kzg().clone(), subspace_link.erasure_coding().clone(), last_segment_header, &last_archived_block_encoded, block_object_mappings, ) - .expect("Incorrect parameters for archiver"); - - archiver + .map_err(|error| { + sp_blockchain::Error::Application( + format!("Incorrect parameters for archiver: {error:?} {last_segment_header:?}") + .into(), + ) + })? } else { info!("Starting archiving from genesis"); diff --git a/crates/subspace-archiving/src/archiver.rs b/crates/subspace-archiving/src/archiver.rs index f45e7890dc..a87d3e09bb 100644 --- a/crates/subspace-archiving/src/archiver.rs +++ b/crates/subspace-archiving/src/archiver.rs @@ -201,12 +201,13 @@ pub struct ArchiveBlockOutcome { /// Archiver instantiation error #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, thiserror::Error)] pub enum ArchiverInstantiationError { - /// Invalid last archived block, its size is the same as encoded block - #[error("Invalid last archived block, its size {0} bytes is the same as encoded block")] - InvalidLastArchivedBlock(BlockNumber), - /// Invalid block, its size is smaller than already archived number of bytes + /// Invalid last archived block, its size is the same as the encoded block + /// (so it should have been completely archived, not partially archived) + #[error("Invalid last archived block, its size {0} bytes is the same as the encoded block")] + InvalidLastArchivedBlock(u32), + /// Invalid block, its size is smaller than the already archived number of bytes #[error( - "Invalid block, its size {block_bytes} bytes is smaller than already archived \ + "Invalid block, its size {block_bytes} bytes is smaller than the already archived block \ {archived_block_bytes} bytes" )] InvalidBlockSmallSize {