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

No longer ban peers for BEEFY justifications #1614

Merged
merged 2 commits into from
Jan 26, 2024
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
24 changes: 16 additions & 8 deletions full-node/src/consensus_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2950,14 +2950,22 @@ impl SyncBackground {
(self, true)
}
(sync_out, all::FinalityProofVerifyOutcome::JustificationError(error)) => {
self.network_service
.ban_and_disconnect(
sender.clone(),
self.network_chain_id,
network_service::BanSeverity::High,
"bad-warp-sync-fragment",
)
.await;
// Errors of type `JustificationEngineMismatch` indicate that the chain
// uses a finality engine that smoldot doesn't recognize. This is a benign
// error that shouldn't lead to a ban.
if !matches!(
error,
all::JustificationVerifyError::JustificationEngineMismatch
) {
self.network_service
.ban_and_disconnect(
sender.clone(),
self.network_chain_id,
network_service::BanSeverity::High,
"bad-warp-sync-fragment",
)
.await;
}
self.log_callback.log(
LogLevel::Warn,
format!(
Expand Down
5 changes: 3 additions & 2 deletions lib/src/sync/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ use core::{
};

pub use crate::executor::vm::ExecHint;
pub use blocks_tree::{CommitVerifyError, JustificationVerifyError};
pub use warp_sync::{
BuildChainInformationError as WarpSyncBuildChainInformationError,
BuildRuntimeError as WarpSyncBuildRuntimeError, ConfigCodeTrieNodeHint, VerifyFragmentError,
Expand Down Expand Up @@ -2046,9 +2047,9 @@ pub enum FinalityProofVerifyOutcome<TBl> {
/// GrandPa commit cannot be verified yet and has been stored for later.
GrandpaCommitPending,
/// Problem while verifying justification.
JustificationError(blocks_tree::JustificationVerifyError),
JustificationError(JustificationVerifyError),
/// Problem while verifying GrandPa commit.
GrandpaCommitError(blocks_tree::CommitVerifyError),
GrandpaCommitError(CommitVerifyError),
}

pub struct WarpSyncFragmentVerify<TRq, TSrc, TBl> {
Expand Down
36 changes: 21 additions & 15 deletions light-base/src/sync_service/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,22 +1364,28 @@ impl<TPlat: PlatformRef> Task<TPlat> {
sender,
);

// TODO: don't print for consensusenginemismatch?
log!(
&self.platform,
Warn,
&self.log_target,
format!("Error while verifying justification: {error}")
);
// Errors of type `JustificationEngineMismatch` indicate that the chain
// uses a finality engine that smoldot doesn't recognize. This is a benign
// error that shouldn't lead to a ban.
if !matches!(
error,
all::JustificationVerifyError::JustificationEngineMismatch
) {
log!(
&self.platform,
Warn,
&self.log_target,
format!("Error while verifying justification: {error}")
);

// TODO: don't ban for consensusenginemismatch?
self.network_service
.ban_and_disconnect(
sender,
network_service::BanSeverity::High,
"bad-justification",
)
.await;
self.network_service
.ban_and_disconnect(
sender,
network_service::BanSeverity::High,
"bad-justification",
)
.await;
}
}

(sync, all::FinalityProofVerifyOutcome::GrandpaCommitError(error)) => {
Expand Down
4 changes: 4 additions & 0 deletions wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixed

- Non-Grandpa justifications are now silently ignored, instead of leading to a ban of the peer that sent the justification. This makes smoldot work better on chains that use BEEFY. ([#1614](https://github.com/smol-dot/smoldot/pull/1614))

## 2.0.18 - 2024-01-24

### Changed
Expand Down
Loading