-
Notifications
You must be signed in to change notification settings - Fork 274
added config setting to prune warpdb #702
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
Changes from 7 commits
98761cb
09be544
cb9edb9
0079046
cc4ca65
8aa7aa4
dd5f85f
fc7cfff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ import ( | |
| const ( | ||
| defaultAcceptorQueueLimit = 64 // Provides 2 minutes of buffer (2s block target) for a commit delay | ||
| defaultPruningEnabled = true | ||
| defaultPruneWarpDB = false | ||
| defaultCommitInterval = 4096 | ||
| defaultTrieCleanCache = 512 | ||
| defaultTrieDirtyCache = 512 | ||
|
|
@@ -122,6 +123,7 @@ type Config struct { | |
| AllowMissingTries bool `json:"allow-missing-tries"` // If enabled, warnings preventing an incomplete trie index are suppressed | ||
| PopulateMissingTries *uint64 `json:"populate-missing-tries,omitempty"` // Sets the starting point for re-populating missing tries. Disables re-generation if nil. | ||
| PopulateMissingTriesParallelism int `json:"populate-missing-tries-parallelism"` // Number of concurrent readers to use when re-populating missing tries on startup. | ||
| PruneWarpDB bool `json:"prune-warp-db-enabled"` // Determines if the warpDb should be cleared when re-initialzing subnet-evm | ||
aaronbuchwald marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: re-initialzing -> reinitializing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch updated to cleared on startup |
||
| // Metric Settings | ||
| MetricsExpensiveEnabled bool `json:"metrics-expensive-enabled"` // Debug-level metrics that might impact runtime performance | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,42 @@ var ( | |
| payload = []byte("test") | ||
| ) | ||
|
|
||
| func TestClearDB(t *testing.T) { | ||
| db := memdb.New() | ||
|
|
||
| snowCtx := snow.DefaultContextTest() | ||
| sk, err := bls.NewSecretKey() | ||
| require.NoError(t, err) | ||
| snowCtx.WarpSigner = avalancheWarp.NewSigner(sk, sourceChainID) | ||
| backend := NewWarpBackend(snowCtx, db, 500) | ||
|
|
||
| // use multiple messages to test that all messages get cleared | ||
| payloads := [][]byte{[]byte("test1"), []byte("test2"), []byte("test3"), []byte("test4"), []byte("test5")} | ||
| messageIDs := []ids.ID{} | ||
|
|
||
| // add all messages | ||
| for _, payload := range payloads { | ||
| unsignedMsg, err := avalancheWarp.NewUnsignedMessage(sourceChainID, destinationChainID, payload) | ||
| require.NoError(t, err) | ||
| messageID := hashing.ComputeHash256Array(unsignedMsg.Bytes()) | ||
| messageIDs = append(messageIDs, messageID) | ||
| err = backend.AddMessage(unsignedMsg) | ||
| require.NoError(t, err) | ||
| // ensure that the message was added | ||
| _, err = backend.GetSignature(messageID) | ||
| require.NoError(t, err) | ||
| } | ||
|
|
||
| err = backend.Clear() | ||
| require.NoError(t, err) | ||
|
|
||
| // ensure all messages have been deleted | ||
| for _, messageID := range messageIDs { | ||
| _, err := backend.GetSignature(messageID) | ||
| require.ErrorContains(t, err, "failed to get warp message") | ||
| } | ||
| } | ||
|
|
||
| func TestAddAndGetValidMessage(t *testing.T) { | ||
| db := memdb.New() | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to add a e2e test in in |
||
|
|
||
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.
Should we add add a validation for the case
PruneWarpDBwas enabled butPruningwas not? If these are not related, can we rename it to something likewarp-db-cleanup-enabledetc? lIMHO one can confuse this withpruningand try to enable both of them.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.
These are two different types of pruning.
I think pruning is the right term here tbh