-
Notifications
You must be signed in to change notification settings - Fork 204
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
Conversation
process/block/baseProcess.go
Outdated
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) |
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.
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
process/block/baseProcess.go
Outdated
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) |
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.
same as my previous comment
cmd/node/config/config.toml
Outdated
@@ -370,6 +370,9 @@ | |||
MaxHeadersPerShard = 1000 | |||
NumElementsToRemoveOnEviction = 200 | |||
|
|||
[ProofsPoolConfig] | |||
CleanupDelta = 3 |
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.
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 |
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.
CleanupDelta uint64 | |
CleanupNonceDelta uint64 |
func NewProofsPool() *proofsPool { | ||
func NewProofsPool(cleanupDelta uint64) *proofsPool { | ||
if cleanupDelta < defaultCleanupDelta { | ||
cleanupDelta = defaultCleanupDelta |
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.
maybe a log.Debug informing this?
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.
done
Reasoning behind the pull request
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?