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

Print a warning in case of non-empty badBlocks #2585

Merged
merged 4 commits into from
Aug 5, 2022
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
1 change: 1 addition & 0 deletions bin/full-node/src/run/consensus_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ impl SyncBackground {
let _jaeger_span = self.jaeger_service.block_body_verify_span(&hash_to_verify);

let mut verify = verify.start(unix_time, ());
// TODO: check this block against the chain spec's badBlocks
loop {
match verify {
all::BlockVerification::Error {
Expand Down
10 changes: 10 additions & 0 deletions bin/light-base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ impl<TChain, TPlat: Platform> Client<TChain, TPlat> {
.as_ref()
.finalized_block_header
.hash(chain_spec.block_number_bytes().into());
let has_bad_blocks = chain_spec.bad_blocks_hashes().count() != 0;

let running_chain = start_services(
log_name.clone(),
Expand Down Expand Up @@ -777,6 +778,15 @@ impl<TChain, TPlat: Platform> Client<TChain, TPlat> {
);
}

// TODO: remove after https://github.com/paritytech/smoldot/issues/2584
if has_bad_blocks {
log::warn!(
target: "smoldot",
"Chain {} has bad blocks in its chain specification. Bad blocks \
are not implemented in the light client", log_name
);
}

running_chain
};

Expand Down
1 change: 1 addition & 0 deletions bin/wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- The GRANDPA warp sync algorithm now downloads Merkle proofs of all the necessary storage items at once, rather than one by one sequentially. This removes approximately 11 networking round-trips and thus significantly reduces the time the warp syncing takes. ([#2578](https://github.com/paritytech/smoldot/pull/2578))
- The GRANDPA warp sync algorithm now works on AURA-based chains. It previously only worked for chains that are using BABE. Note that GRANDPA warp sync is irrelevant for parachains. ([#2581](https://github.com/paritytech/smoldot/pull/2581))
- The GRANDPA warp sync implementation has been considerably refactored. It is possible that unintended changes in behaviour have accidentally been introduced. ([#2578](https://github.com/paritytech/smoldot/pull/2578))
- A warning is now printed if the `badBlocks` field in a chain specification is not empty. Bad blocks are not supported by the smoldot light client. ([#2585](https://github.com/paritytech/smoldot/pull/2585))

## 0.6.27 - 2022-07-29

Expand Down
10 changes: 10 additions & 0 deletions src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,16 @@ impl ChainSpec {
}
}

/// Returns a list of hashes of block headers that should always be considered as invalid.
pub fn bad_blocks_hashes(&'_ self) -> impl Iterator<Item = &'_ [u8; 32]> + '_ {
self.client_spec
.bad_blocks
.as_ref()
.into_iter()
.flat_map(|l| l.iter())
.map(|h| &h.0)
}

/// Returns the list of bootnode addresses found in the chain spec.
///
/// Bootnode addresses that have failed to be parsed are returned as well in the form of
Expand Down
1 change: 0 additions & 1 deletion src/chain_spec/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ pub(super) struct ClientSpec {
pub(super) properties: Option<Box<serde_json::value::RawValue>>,
// TODO: make use of this
pub(super) fork_blocks: Option<Vec<(u64, HashHexString)>>,
// TODO: make use of this
pub(super) bad_blocks: Option<HashSet<HashHexString, FnvBuildHasher>>,
// Unused but for some reason still part of the chain specs.
#[serde(default, skip_serializing)]
Expand Down