fix: Correct sign-check wording in lending protocol messages - #7913
Open
tyalymov wants to merge 1 commit into
Open
fix: Correct sign-check wording in lending protocol messages#7913tyalymov wants to merge 1 commit into
tyalymov wants to merge 1 commit into
Conversation
Several vault invariant log messages and one LoanPay assert said a value "must be positive" while the check only rejects negative values (zero is valid). Reword to "must not be negative" / "non-negative" to match the actual check. Log/assert text only; no behaviour change.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
High Level Overview of Change
Correct misleading sign-check wording in lending-protocol diagnostic messages. Several
vault invariant log messages and one
LoanPayassert stated that a value "must bepositive" while the corresponding check only rejects negative values (zero is a valid
state). They now say "must not be negative" / "non-negative" to match the actual check.
This is diagnostic text only — there is no behavioural or consensus change.
Context of Change
Following review discussion on #7863: the vault/loan invariants use
< 0(or>= 0)comparisons, i.e. they enforce non-negativity, but several messages read "must be
positive", which implies
> 0. Zero is legitimate (e.g. an empty vault hasassetsAvailable == 0,assetsTotal == 0;assetsMaximum == 0means "no maximum";a vault with no impaired loans has
lossUnrealized == 0), so the wording was misleadingwhen diagnosing invariant failures.
Reworded to match the checks:
VaultInvariant.cpp— "assets available / assets outstanding / assets maximum must bepositive" → "... must not be negative" (each guards
< 0).LoanPay.cpp— assert description "positive vault and broker balances" → "non-negativevault and broker balances" (guards
>= 0).A full sweep of the lending-protocol files confirmed these are the only mismatches;
LoanInvariant/LoanBrokerInvariantalready use "is negative" / "is zero or negative"correctly, and the remaining "positive" mentions are code comments or genuinely
strict-positive checks (
<= 0).API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)Test Plan
Updated the affected expectations in
Invariants_test.cppand confirmed the invariantsuite passes with the new wording. Both test sets are green (
xrpld --unittestandctest --preset conan-debug). No logic changed, so no new tests were added.