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

[ZKS-04] Properly set the gc_round on Storage initialization #3145

Merged
merged 3 commits into from Mar 4, 2024

Conversation

raychu86
Copy link
Contributor

@raychu86 raychu86 commented Mar 4, 2024

Motivation

This PR calls GC on Storage initialization to properly set the gc_round variable set in Storage. By default this value was set to 0, which is incorrect and would cause bootup to look too far back for certificates.

Test Plan

Tests hav been added to ensure that the storage has the proper gc_round during initialization and that the BFT calls GC when committing a leader certificate.

Related PRs

Related to #3144

@howardwu howardwu merged commit 8be6ac9 into mainnet Mar 4, 2024
23 of 24 checks passed
@howardwu howardwu deleted the gc-on-bootup branch March 4, 2024 04:42
@@ -114,6 +114,8 @@ impl<N: Network> Storage<N> {
}));
// Update the storage to the current round.
storage.update_current_round(current_round);
// Perform GC on the current round.
storage.garbage_collect_certificates(current_round);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what is happening here. Shouldn't you garbage collect based on the last committed round instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case here is called in the constructor.

On bootup, we load the current_round which is technically the last committed round from the ledger's perspective.

I believe this is equivalent to what your intention is as well.

@howardwu howardwu changed the title Properly set the gc_round on Storage initialization [ZKS-04] Properly set the gc_round on Storage initialization Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants