Skip to content

Commit

Permalink
Don't run shadow chunk validation when syncing blocks (#11293)
Browse files Browse the repository at this point in the history
Currently we run shadow validation for every new block, even if we're
only syncing up to reach the current tip of the chain. This causes sync
to be extremely slow, as every synced block is applied. Because of that
it's often faster to setup a new node from scratch rather than wait for
a node to sync.

Let's not run shadow validation when syncing, it'll make it possible to
catch up with the rest of the network in a reasonable amount of time.
  • Loading branch information
jancionear authored May 14, 2024
1 parent e3c8f1f commit 645f72e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions chain/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1655,13 +1655,19 @@ impl Client {
info!(target: "client", "not producing a chunk");
}
}
if let Err(err) = self.shadow_validate_block_chunks(&block) {
tracing::error!(
target: "client",
?err,
block_hash = ?block.hash(),
"block chunks shadow validation failed"
);

// Run shadown chunk validation on the new block, unless it's coming from sync.
// Syncing has to be fast to catch up with the rest of the chain,
// applying the chunks would make the sync unworkably slow.
if provenance != Provenance::SYNC {
if let Err(err) = self.shadow_validate_block_chunks(&block) {
tracing::error!(
target: "client",
?err,
block_hash = ?block.hash(),
"block chunks shadow validation failed"
);
}
}

self.shards_manager_adapter
Expand Down

0 comments on commit 645f72e

Please sign in to comment.