eager prune for lockup#810
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #810 +/- ##
=======================================
Coverage 96.62% 96.63%
=======================================
Files 71 71
Lines 7345 7365 +20
=======================================
+ Hits 7097 7117 +20
Misses 248 248 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Review — stellar-tokens
|
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughInitial lockup periods now define a 512-entry active-lock limit, prune expired locks during mints, reject oversized presets or mint schedules with ChangesBounded lockup lifecycle
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Ledger
participant on_created
participant prune_expired_locks
participant LockStorage
Ledger->>on_created: mint at current ledger time
on_created->>prune_expired_locks: remove expired locks
prune_expired_locks->>LockStorage: update locks and total_locked
on_created->>LockStorage: append lock or raise LockBoundExceeded
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/tokens/src/rwa/compliance/modules/initial_lockup_period/storage.rs`:
- Around line 451-465: Update the lock-pruning loop to track whether any lock
expired independently of the accumulated pruned amount, including zero-valued
locks. In the surrounding pruning logic, replace details.locks whenever an
expired entry was found, while only subtracting pruned from total_locked when
pruned is positive; add a regression test covering expired zero-value entries at
MAX_LOCKS.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 671e22eb-9696-42e2-ba3b-21710b50eca0
📒 Files selected for processing (4)
packages/tokens/src/rwa/compliance/modules/initial_lockup_period/mod.rspackages/tokens/src/rwa/compliance/modules/initial_lockup_period/storage.rspackages/tokens/src/rwa/compliance/modules/initial_lockup_period/test.rspackages/tokens/src/rwa/compliance/modules/mod.rs
Fixes #809
PR Checklist
Summary by CodeRabbit
New Features
Bug Fixes