Skip to content

Commit 645f72e

Browse files
authored
Don't run shadow chunk validation when syncing blocks (#11293)
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.
1 parent e3c8f1f commit 645f72e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

chain/client/src/client.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,13 +1655,19 @@ impl Client {
16551655
info!(target: "client", "not producing a chunk");
16561656
}
16571657
}
1658-
if let Err(err) = self.shadow_validate_block_chunks(&block) {
1659-
tracing::error!(
1660-
target: "client",
1661-
?err,
1662-
block_hash = ?block.hash(),
1663-
"block chunks shadow validation failed"
1664-
);
1658+
1659+
// Run shadown chunk validation on the new block, unless it's coming from sync.
1660+
// Syncing has to be fast to catch up with the rest of the chain,
1661+
// applying the chunks would make the sync unworkably slow.
1662+
if provenance != Provenance::SYNC {
1663+
if let Err(err) = self.shadow_validate_block_chunks(&block) {
1664+
tracing::error!(
1665+
target: "client",
1666+
?err,
1667+
block_hash = ?block.hash(),
1668+
"block chunks shadow validation failed"
1669+
);
1670+
}
16651671
}
16661672

16671673
self.shards_manager_adapter

0 commit comments

Comments
 (0)