Skip to content

Commit

Permalink
Merge pull request #3378 from autonomys/archiver-debug-2
Browse files Browse the repository at this point in the history
Log segment header when archiver instantiation fails
  • Loading branch information
teor2345 authored Feb 11, 2025
2 parents 8dcc0fd + 96dba4f commit 4150c68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
11 changes: 7 additions & 4 deletions crates/sc-consensus-subspace/src/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
11 changes: 6 additions & 5 deletions crates/subspace-archiving/src/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4150c68

Please sign in to comment.