Conversation
...rced-transactions/src/main/kotlin/linea/ftx/conflation/ForcedTransactionsDbCleanUpService.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| ftxDao = ftxDao, | ||
| finalizedStateProvider = finalizedStateProvider, | ||
| vertx = vertx, | ||
| ) |
There was a problem hiding this comment.
Cleanup service polling interval not configurable via config
Low Severity
ForcedTransactionsDbCleanUpService is constructed without passing a pollingInterval, falling back to a hardcoded default of 5.seconds. All other periodic services in ForcedTransactionsApp (e.g., ftxInvalidityProofService) use intervals from the config object. This inconsistency means operators cannot tune the cleanup frequency without code changes, unlike every other polling service in the same app.
Additional Locations (1)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2719 +/- ##
============================================
+ Coverage 58.74% 58.84% +0.09%
- Complexity 1625 1633 +8
============================================
Files 459 460 +1
Lines 18621 18649 +28
Branches 2023 2024 +1
============================================
+ Hits 10939 10974 +35
+ Misses 7016 7009 -7
Partials 666 666
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
| @Synchronized | ||
| private fun tick(): SafeFuture<Unit> { | ||
| return finalizedStateProvider | ||
| .getLatestFinalizedState(blockParameter = BlockParameter.Tag.FINALIZED) |
There was a problem hiding this comment.
FinalizationMonitorImpl is responsible for polling the finalized state and it has getLastFinalizationUpdate to access this information. Can't we use it?
There was a problem hiding this comment.
Also, clean up can be set up as a reaction on the finalization events with addFinalizationHandler
There was a problem hiding this comment.
But I don't see anything against putting the cleanup logic next to the other clean up logic we had. I see a comment about contract version switch being inside the FinalizationMonitorImpl rather than in a contract client somewhere


This PR implements issue(s) #2103
Checklist
PR.
Note
Medium Risk
Introduces automated deletion of persisted forced-transaction records driven by finalized-state polling; misconfiguration or incorrect finalized-number handling could lead to unintended data loss or operational churn.
Overview
Adds a new
ForcedTransactionsDbCleanUpServicethat periodically polls the latest finalized state and deletes forced-transaction DB rows withftxNumber <= finalizedForcedTransactionNumber, skipping work when the finalized number hasn’t changed.Wires this cleanup service into
ForcedTransactionsApplifecycle (start/stop) and adds an integration-style test asserting older finalized records are removed while newer ones remain.Written by Cursor Bugbot for commit 48687fe. This will update automatically on new commits. Configure here.