fix: Skip deleted book directories and non-root modifications in ValidBookDirectory invariant - #7312
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7312 +/- ##
=======================================
Coverage 82.3% 82.3%
=======================================
Files 1011 1011
Lines 76303 76305 +2
Branches 7314 7312 -2
=======================================
+ Hits 62827 62836 +9
+ Misses 13476 13469 -7
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the ValidBookDirectory invariant to ignore deleted directory entries, preventing legacy/bad book-root directories that are being removed from being misclassified as newly-created bad state. It also adds a regression test covering the deletion callback scenario where the deleted SLE image may still be provided to the invariant.
Changes:
- Update
ValidBookDirectory::visitEntryto early-return whenisDeleteis true. - Add a unit/regression test ensuring deleting a legacy bad root directory does not trip the invariant.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/libxrpl/tx/invariants/DirectoryInvariant.cpp | Skips invariant checks for deleted entries via the isDelete marker to avoid false positives. |
| src/test/app/Invariants_test.cpp | Adds regression coverage for deletion of a legacy bad root book directory where the deleted SLE image is still passed to visitEntry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/ai-review |
ximinez
left a comment
There was a problem hiding this comment.
My issues are addressed.
ValidBookDirectory invariant
…idBookDirectory` invariant (XRPLF#7312)
High Level Overview of Change
Update ValidBookDirectory to validate newly-created directory nodes and modified
directory nodes only when
sfRootIndexchanges. This keeps legacy badexchange-rate metadata from causing false positives during ordinary
modifications, while still checking root-link changes.
Context of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)