Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log segment header when archiver instantiation fails #3378

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading