Validate LoanManager min score bounds#974
Open
Lucas-FManager wants to merge 1 commit into
Open
Conversation
Author
|
CI note after re-checking the failing workflow:
I am leaving the branch scoped to the min-score validation fix unless you want a separate cleanup for the repository-wide formatting issues. |
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.
Summary
Refs #941.
This hardens
LoanManager::set_min_scoreso the admin setter follows the sameResult<(), LoanError>pattern as the other guarded configuration setters and rejects unsafe score bounds.Approach
MAX_CREDIT_SCOREceiling of850, matching the RemittanceNFT score cap referenced by the issue.set_min_scoreto returnResult<(), LoanError>.0and values above850withLoanError::InvalidConfigurationbefore writing storage.min_score_updated, unchanged after validation succeeds.850, and rejected out-of-bounds values.Security
min_score > 850, which would make all borrowers fail the score gate.min_score = 0, which would effectively disable the score gate.Verification
docker run --rm -v "C:\\Users\\ADMIN\\.openclaw\\github-jobs\\remitlend:/work" -w /work/contracts rust:1.95 bash -lc "/usr/local/cargo/bin/cargo test -p loan_manager set_min_score"git diff --check