-
Notifications
You must be signed in to change notification settings - Fork 248
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
Improve snap sync #2972
Improve snap sync #2972
Conversation
When I set |
You will not get any finalization during sync because the whole archiving process is skipped for already archived blocks and finalization is only called from there. To re-enable archiving of already archived history you'll have to do something like this: diff --git a/crates/sc-consensus-subspace/src/archiver.rs b/crates/sc-consensus-subspace/src/archiver.rs
--- a/crates/sc-consensus-subspace/src/archiver.rs (revision 51c4da575186f81c98b550ad92bcc6a7ba8fffe4)
+++ b/crates/sc-consensus-subspace/src/archiver.rs (date 1723552439720)
@@ -845,7 +845,7 @@
"Checking if block needs to be skipped"
);
if best_archived_block_number >= block_number_to_archive
- || last_archived_block_number > block_number_to_archive
+ // || last_archived_block_number > block_number_to_archive
{
// This block was already archived, skip
debug!(
@@ -958,6 +958,13 @@
block_number_to_archive, block_hash_to_archive
);
But then you don't need to modify sync target or archiving depth at all if you want to just verify finalization, something like this is sufficient: diff --git a/crates/sc-consensus-subspace/src/archiver.rs b/crates/sc-consensus-subspace/src/archiver.rs
--- a/crates/sc-consensus-subspace/src/archiver.rs (revision 51c4da575186f81c98b550ad92bcc6a7ba8fffe4)
+++ b/crates/sc-consensus-subspace/src/archiver.rs (date 1723552439720)
@@ -845,7 +845,7 @@
"Checking if block needs to be skipped"
);
if best_archived_block_number >= block_number_to_archive
- || last_archived_block_number > block_number_to_archive
+ // || last_archived_block_number > block_number_to_archive
{
// This block was already archived, skip
debug!(
@@ -958,6 +958,13 @@
block_number_to_archive, block_hash_to_archive
);
+ finalize_block(
+ client,
+ None,
+ *block.block.header().parent_hash(),
+ *block.block.header().number() - One::one(),
+ );
+
if parent_block_hash != best_archived_block_hash {
let error = format!(
"Attempt to switch to a different fork beyond archiving depth, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well!
I'll submit a patch that will warn and suggest users to wipe the database separately (if we can't transparently fix it before then) |
This simple change ensures that the first imported block is finalized and allows to finalize all other blocks afterwards successfully.
Code contributor checklist: