-
Notifications
You must be signed in to change notification settings - Fork 863
New receiptDB receipt-specific interface #2701
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2701 +/- ##
==========================================
- Coverage 43.76% 41.98% -1.78%
==========================================
Files 1914 1017 -897
Lines 159504 84779 -74725
==========================================
- Hits 69801 35593 -34208
+ Misses 83284 45839 -37445
+ Partials 6419 3347 -3072
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| } | ||
| go func() { | ||
| for { | ||
| pruneStartTime := time.Now() |
Check warning
Code scanning / CodeQL
Calling the system time Warning
| go func() { | ||
| for { | ||
| pruneStartTime := time.Now() | ||
| latestVersion := db.GetLatestVersion() | ||
| pruneVersion := latestVersion - keepRecent | ||
| if pruneVersion > 0 { | ||
| // prune all versions up to and including the pruneVersion | ||
| if err := db.Prune(pruneVersion); err != nil { | ||
| log.Error("failed to prune receipt store till", "version", pruneVersion, "err", err) | ||
| } | ||
| log.Info(fmt.Sprintf("Pruned receipt store till version %d took %s\n", pruneVersion, time.Since(pruneStartTime))) | ||
| } | ||
|
|
||
| // Generate a random percentage (between 0% and 100%) of the fixed interval as a delay | ||
| randomPercentage := rand.Float64() | ||
| randomDelay := int64(float64(pruneInterval) * randomPercentage) | ||
| time.Sleep(time.Duration(pruneInterval+randomDelay) * time.Second) | ||
| } | ||
| }() |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
- Add sentinel errors ErrNotFound and ErrNotConfigured for consistent error checking - Add shutdown mechanism for pruning goroutine with stopPruning channel - Update Close() to signal pruning goroutine to stop using sync.Once - Update x/evm/keeper/receipt.go to use sentinel errors and errors.Is() - Replace string-based error comparison with errors.Is() for better error handling Co-authored-by: jeremy <[email protected]>
|
|
||
| // Generate a random percentage (between 0% and 100%) of the fixed interval as a delay | ||
| randomPercentage := rand.Float64() | ||
| randomDelay := int64(float64(pruneInterval) * randomPercentage) |
Check notice
Code scanning / CodeQL
Floating point arithmetic Note
- Rename StoreReceipts to SetReceipts for consistency - Rename LatestHeight to LatestVersion - Rename SetLatestHeight to SetLatestVersion - Rename SetEarliestHeight to SetEarliestVersion - Update all usages in keeper, evmrpc, and tests Co-authored-by: jeremy <[email protected]>
Describe your changes and provide context
This PR converts the current ReceiptDB interface from StateStore interface to using a receipt-specific interface. In a future PR, we will add in the new Parquet implementation for receipts.
Testing performed to validate your change
unit tests.