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

gossip: demote invalid duplicate proof errors to info #2754

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions gossip/src/duplicate_shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ pub enum Error {
UnknownSlotLeader(Slot),
}

impl Error {
/// Errors indicating that the initial node submitted an invalid duplicate proof case
pub(crate) fn is_non_critical(&self) -> bool {
matches!(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather we explicitly list every enum variant and what is critical and what is not, similar to:
https://rust-lang.github.io/rust-clippy/master/index.html#/wildcard_enum_match_arm
but I guess not much an issue here.

self,
Self::SlotMismatch
| Self::InvalidShredVersion(_)
| Self::InvalidSignature
| Self::ShredTypeMismatch
| Self::InvalidDuplicateShreds
| Self::InvalidLastIndexConflict
| Self::InvalidErasureMetaConflict
)
}
}

/// Check that `shred1` and `shred2` indicate a valid duplicate proof
/// - Must be for the same slot
/// - Must match the expected shred version
Expand Down
8 changes: 7 additions & 1 deletion gossip/src/duplicate_shred_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ impl DuplicateShredHandlerTrait for DuplicateShredHandler {
fn handle(&mut self, shred_data: DuplicateShred) {
self.cache_root_info();
self.maybe_prune_buffer();
let slot = shred_data.slot;
let pubkey = shred_data.from;
if let Err(error) = self.handle_shred_data(shred_data) {
error!("handle packet: {error:?}")
if error.is_non_critical() {
info!("Received invalid duplicate shred proof from {pubkey} for slot {slot}: {error:?}");
} else {
error!("Unable to process duplicate shred proof from {pubkey} for slot {slot}: {error:?}");
}
}
}
}
Expand Down