Commit Graph

13992 Commits

Author SHA1 Message Date
Gregory Tsipenyuk
1acb3df197 Fix empty/zero brokerID in LoanSet, extend unit-tests. 2025-11-03 18:58:00 -05:00
Gregory Tsipenyuk
117382ed2c Fix empty/zero brokerID, extend unit-tests. 2025-10-31 09:13:54 -04:00
Gregory Tsipenyuk
e8dddcbb7f Fix LoanBrokerDelete with empty or zero broker ID (RIPD-3858) (#5967) 2025-10-31 03:01:05 +00:00
Ed Hennis
7a758a42f9 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  refactor: Retire fixSTAmountCanonicalize code (5956)
2025-10-29 14:26:32 -04:00
Pratik Mankawde
f8b4f692f1 refactor: Retire fixSTAmountCanonicalize code (#5956)
Amendments activated for more than 2 years can be retired. This change retires the fixSTAmountCanonicalize amendment.
2025-10-29 18:17:50 +00:00
Ed Hennis
298f6deac9 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  refactor: Retire fixRmSmallIncreasedQOffers amendment (5955)
  refactor: Sorts retired amendments to reduce conflicts (5966)
2025-10-29 13:45:08 -04:00
Pratik Mankawde
80a3ae6386 refactor: Retire fixRmSmallIncreasedQOffers amendment (#5955)
Amendments activated for more than 2 years can be retired. This change retires the fixRmSmallIncreasedQOffers amendment.
2025-10-29 17:34:06 +00:00
Bart
48d38c1e2c refactor: Sorts retired amendments to reduce conflicts (#5966)
We are on an amendment retiring spree, but each change results in conflicts in `features.macro` because currently they all add the retired amendment to the end of the list. By sorting the list the number of conflicts should be reduced, making it easier to merge them.
2025-10-29 17:03:16 +00:00
Ed Hennis
71565a909e Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  refactor: Retire fixCheckThreading amendment (5957)
  refactor: Retire fix1578 amendment (5927)
  refactor: Retire fix1571 amendment (5925)
  feat: Add public key to log messages (5678)
  Retire fix1781 amendment (5931)
  ci: Use nproc-2 to set parallelism for builds and tests (5939)
2025-10-29 12:57:37 -04:00
Ed Hennis
52490730b2 Check for null Vault SLE in LoanBrokerCoverDeposit 2025-10-29 12:51:12 -04:00
Jingchen
553fb5be3b refactor: Retire fixCheckThreading amendment (#5957)
Amendments activated for more than 2 years can be retired. This change retires the fixCheckThreading amendment.
2025-10-29 16:36:51 +00:00
Ed Hennis
64e0ee4be9 Add POC unit test for null vault dereference 2025-10-29 12:25:03 -04:00
Pratik Mankawde
efa917d9f3 refactor: Retire fix1578 amendment (#5927)
Amendments activated for more than 2 years can be retired. This change retires the fix1578 amendment.
2025-10-29 16:08:17 +00:00
Pratik Mankawde
bd3bc917f8 refactor: Retire fix1571 amendment (#5925)
Amendments activated for more than 2 years can be retired. This change retires the fix1571 amendment.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-29 14:21:50 +00:00
Jingchen
ed5d6f3e22 feat: Add public key to log messages (#5678)
To protect the identity of UNL validators, the IP addresses are redacted from the log messages sent to the common Grafana instance. However, without such identifying information it is challenging to debug issues. This change adds a node's public key to logs to improve our ability to debug issues.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-29 14:16:37 +00:00
Pratik Mankawde
a8e4da0b11 Retire fix1781 amendment (#5931)
* Retired fix1781 amendment

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

* refactor: Retire fix1781 amendment

Amendments activated for more than 2 years can be retired. This change retires the fix1781 amendment.

---------

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>
Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-29 11:32:43 +00:00
Bart
1dd60242de ci: Use nproc-2 to set parallelism for builds and tests (#5939)
This change reduces the number of cores used to build and test, as using all cores may be contributing to occasional build and test failures.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-29 00:07:09 +00:00
Ed Hennis
d0c60cdf59 Fix broken unit test case 2025-10-28 18:47:52 -04:00
Ed Hennis
0febc60cbe Ignore the contents of SigningPubKey when multisigning with a target 2025-10-28 18:37:15 -04:00
Ed Hennis
122d8f96b3 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  ci: Use commit hash so workflows are not canceled when merging multiple PRs (5950)
  ci: Only upload codecov reports in the original repo, not in forks (5953)
  ci: Only log into Conan when uploading packages (5952)
  fix: invariant error in fee-sized `VaultWithdraw` (5876)
  fix: account_tx limit parameter validation for malformed values (5891)
  refactor: Retire fix1543 amendment (5926)
  ci: Only run .exe files during test phase on Windows (5947)
  refactor: Migrate json unit tests to use doctest (5533)
  Change `fixMPTDeliveredAmount` to `Supported::yes` (5833)
  fix: Upload all test binaries (5932)
  chore: Better pre-commit failure message (5940)
2025-10-28 18:21:12 -04:00
Ed Hennis
ec60dcf90d Ensure payment does not exceed Loan balance
- Also disallow extra parameters on the ALWAYS_OR_UNREACHABLE macro,
  which should prevent me from mixing up XRPL_ASSERT and
  XRPL_ASSERT_PARTS.
2025-10-28 16:27:45 -04:00
Ed Hennis
310852ba2d refactor: Payment component calculation will target next true state
- Compute the next "true" state, round the values off, then compute the
  deltas needed to get the current state to that state. Plus some data
  integrity checks.
- Add `Number::zero`, which is longer to type, but more readable than
  `Number{}`.
- Prepare to improve Loan unit tests: track managementFeeRate in
  BrokerInfo, define a LoanParameters object for creation options and
  start adding support for it, track and verify loan state while making
  payments.
2025-10-28 16:27:44 -04:00
Bart
76611c3f46 ci: Use commit hash so workflows are not canceled when merging multiple PRs (#5950)
This change changes the CI concurrency group for pushes to the `develop` branch to use the commit hash instead of the target branch.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-28 20:08:08 +00:00
Bart
5efaf0c328 ci: Only upload codecov reports in the original repo, not in forks (#5953)
Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-28 19:52:52 +00:00
Bart
0aa23933ea ci: Only log into Conan when uploading packages (#5952)
There are separate steps for logging into Conan and uploading packages. However, at the moment sometimes the login step is executed even though no packages will be uploaded. The condition for performing both steps should be the same.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-28 19:52:13 +00:00
Bronek Kozicki
21f3c12d85 fix: invariant error in fee-sized VaultWithdraw (#5876)
This changes fixes an invariant error where the amount withdrawn is equal to the transaction fee.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-28 18:12:11 +00:00
Copilot
7d5ed0cd8d fix: account_tx limit parameter validation for malformed values (#5891)
This change fixes the `account_tx` RPC method to properly validate malformed limit parameter values. Previously, invalid values like `0`, `1.2`, `"10"`, `true`, `false`, `-1`, `[]`, `{}`, etc. were either accepted without errors or caused internal errors. Now all malformed values correctly return the `invalidParams` error.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-28 17:42:43 +00:00
Pratik Mankawde
d9960d5ba0 refactor: Retire fix1543 amendment (#5926)
Amendments activated for more than 2 years can be retired. This change retires the fix1543 amendment.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-28 15:10:38 +00:00
Ayaz Salikhov
91fa6b2295 ci: Only run .exe files during test phase on Windows (#5947) 2025-10-28 14:26:25 +00:00
Jingchen
76f774e22d refactor: Migrate json unit tests to use doctest (#5533)
Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-28 14:19:39 +00:00
Shawn Xie
f4f7618173 Change fixMPTDeliveredAmount to Supported::yes (#5833)
Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-27 19:04:14 +00:00
Ayaz Salikhov
66f16469f9 fix: Upload all test binaries (#5932) 2025-10-27 17:27:56 +00:00
Ayaz Salikhov
1845b1c656 chore: Better pre-commit failure message (#5940) 2025-10-27 14:43:45 +00:00
Ed Hennis
f4404eafbd Fix build error
- Use an explicit cast to std::int64_t in std::max call, because
  suffixes are inconsistent.
2025-10-26 21:52:01 -04:00
Ed Hennis
fe5bd82ed8 Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-26 19:12:45 -04:00
Ed Hennis
da14c6f018 Prevent numerical overflow of payment due dates
- Addresses FIND-013 from audit.
- Bases the limit on the current ledger time, and ensures that
  "payments * interval <= limit". This allows a loan to potentially run through
  "the end of time" successfully, but not go a second over.
- Wrote several test cases, including a few that go right to "the end of
  time".
2025-10-26 18:57:16 -04:00
Ed Hennis
5ceefdfbd5 Add repro unit test for FIND-008, with modifications, from audit 2025-10-26 16:03:59 -04:00
Ed Hennis
b8b9e7a51e Add repro unit tests, with modifications, from audit
- FIND-005, FIND-009, and FIND-010.
- Add the finding number to existing tests - FIND-001, FIND-003,
  FIND-012, FIND-007.
- Tweak the interest rate failure log messages in LoanSet.
2025-10-26 15:31:32 -04:00
Ed Hennis
269fb44cd7 Add unit test from security audit (FIND-007)
- The issue identified in this finding had previously been fixed, but
  the test is useful to verify.
2025-10-26 13:51:46 -04:00
Ed Hennis
40ef91e7e0 Limit how many payments can be made in a single LoanPay
- Addresses FIND-005 from audit.
- Tuning values defined in Protocol.h. Optimal values TBD.
  - loanPaymentsPerFeeIncrement: calculateBaseFee estimates the number
    of payments included in the Amount and charges
    "baseFee * number / loanPaymentsPerFeeIncrement".
  - loanMaximumPaymentsPerTransaction: If the number of payments
    (including overpayments if applicable) hits this limit, stop
    processing more payments, but DO NOT FAIL.
- Fix the rounding in LoanSet for Guard 4 (sufficient computed payments)
- Tweak several test parameters to account for the new limits.
- Change payment component rounding for IOUs to "towards_zero".
- Add some safety limits to loan calculations to prevent nonsensical
  values.
2025-10-26 13:09:35 -04:00
Ed Hennis
fe4269cf8b Avoid negative payments: limit origination fee to the loan principal
- Addresses FIND-006 from audit.
- Removes the "minimum" check for sfLoanOriginationFee, and replaces it
  with a "valid range" check with the max value being
  sfPrincipalRequested.
- Reuses the test from the report, with some modifications.
- Also adds some more test cases for existing interest rate tests.
2025-10-24 18:33:57 -04:00
Ed Hennis
a3b82023d6 refactor: Pull computeOverpaymentComponents into a separate function 2025-10-24 16:00:32 -04:00
Ed Hennis
0950d41fce refactor: De-templatize and move LendingHelper functions from .h to .cpp
- Changes:
  1. Removed the `AssetType` template parameter from all functions in
     favor of just using the `Asset` class.
  2. Fully moved all `ripple::detail` functions from .h to .cpp.
  3. Moved all definitions of non `detail` functions from .h to .cpp,
     except roundPeriodicPayment, just because it's small and I want it
     to be visible. Left declarations in .h
  4. Moved `PaymentSpecialCase`, `PaymentComponents` and
     `computePaymentComponents` into `detail` and updated references.
2025-10-24 15:44:46 -04:00
Ed Hennis
45819477d3 refactor: change what values are tracked as Payment Components - Part 2
- PaymentComponents is an class used internally to break a payment value
  into principal, interest, and fees.
2025-10-24 15:09:35 -04:00
Ed Hennis
83e249eb8a refactor: change what values are tracked as Payment Components - Part 1
- This is an intermediate commit. It leaves the old variables in place,
  so I can do verifications that the new computations are correct. They
  will be removed in the next commit.
- PaymentComponents is an class used internally to break a payment value
  into principal, interest, and fees.
2025-10-24 15:09:35 -04:00
Bronek Kozicki
07fcbd5498 Add authorization check to LoanSet (#5875)
- Add tests for unauthorized borrower and lender
2025-10-24 13:27:27 -04:00
Gregory Tsipenyuk
88a770c71b Don't create empty holding for MPT or trust line issuer (#5877)
- Adds a check to the MPToken creation invariant to ensure none are created for the issuer.
- `addEmptyHolding()` will return success without doing anything for these scenarios. There is nothing to do, as with XRP.

---------

Co-authored-by: Ed Hennis <ed@ripple.com>
2025-10-24 12:32:26 -04:00
Ayaz Salikhov
e192ffe964 fix: Clean up build profile options (#5934)
The `-Wno-missing-template-arg-list-after-template-kw` flag is only needed for the grpc library. Use `+=` for the default build flags to make it easier to extend in the future.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
2025-10-24 15:16:15 +00:00
Ed Hennis
78ef800e30 Fix more problems introduced by 6adb2ec
- Renamed canSendToAccount to canWithdraw, because the semantics are
  a little different from a payment. Notably, if withdrawing to self,
  you can still include a destination tag.
- Simplified the interface to canWithdraw to just pass in the
  STTx.
- preflightDestinationAndTag is pretty pointless now, so removed it.
2025-10-24 01:19:45 -04:00
Ed Hennis
7f2f6b8791 Merge remote-tracking branch 'mywork/ximinez/crashed-tests' into ximinez/lending-XLS-66
* mywork/ximinez/crashed-tests:
  test: Count crashed test suites
2025-10-24 00:59:33 -04:00