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

Proofs pool cleanup delta #6725

Merged
merged 6 commits into from
Jan 22, 2025
Merged

Conversation

ssd04
Copy link
Contributor

@ssd04 ssd04 commented Jan 22, 2025

Reasoning behind the pull request

  • Add cleanup delta for proofs pool

Testing procedure

  • TBD

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@ssd04 ssd04 self-assigned this Jan 22, 2025
if bp.enableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, headerHandler.GetEpoch()) {
err := bp.dataPool.Proofs().CleanupProofsBehindNonce(bp.shardCoordinator.SelfId(), highestPrevFinalBlockNonce)
if common.ShouldBlockHavePrevProof(headerHandler, bp.enableEpochsHandler, common.EquivalentMessagesFlag) {
err := bp.dataPool.Proofs().CleanupProofsBehindNonce(bp.shardCoordinator.SelfId(), highestPrevFinalBlockNonce-proofsCleanupDelta)
Copy link
Contributor

Choose a reason for hiding this comment

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

make sure that highestPrevFinalBlockNonce-proofsCleanupDelta is not negative, otherwise it will cleanup everything (expected an unsigned 64)

I would compute the value first, and do the call only if >0

if bp.enableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, crossNotarizedHeader.GetEpoch()) {
err = bp.dataPool.Proofs().CleanupProofsBehindNonce(shardID, noncesToPrevFinal)
if common.ShouldBlockHavePrevProof(crossNotarizedHeader, bp.enableEpochsHandler, common.EquivalentMessagesFlag) {
err = bp.dataPool.Proofs().CleanupProofsBehindNonce(shardID, noncesToPrevFinal-proofsCleanupDelta)
Copy link
Contributor

Choose a reason for hiding this comment

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

same as my previous comment

@@ -370,6 +370,9 @@
MaxHeadersPerShard = 1000
NumElementsToRemoveOnEviction = 200

[ProofsPoolConfig]
CleanupDelta = 3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
CleanupDelta = 3
CleanupNonceDelta = 3

config/config.go Outdated
@@ -19,6 +19,11 @@ type HeadersPoolConfig struct {
NumElementsToRemoveOnEviction int
}

// ProofsPoolConfig will map the proofs cache configuration
type ProofsPoolConfig struct {
CleanupDelta uint64
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
CleanupDelta uint64
CleanupNonceDelta uint64

func NewProofsPool() *proofsPool {
func NewProofsPool(cleanupDelta uint64) *proofsPool {
if cleanupDelta < defaultCleanupDelta {
cleanupDelta = defaultCleanupDelta
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe a log.Debug informing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ssd04 ssd04 merged commit 032da79 into feat/equivalent-messages Jan 22, 2025
5 checks passed
@ssd04 ssd04 deleted the proofs-pool-cleanup-delta branch January 22, 2025 11:06
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.

3 participants