Commit Graph

14184 Commits

Author SHA1 Message Date
Ed Hennis
315b511326 Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-25 14:54:52 -05:00
Ed Hennis
40cd57355d Review feedback from @shawnxie999: MPT Clawback
- MPTs do not require the lsfMPTCanLock flag to be able to clawback
2025-11-25 14:46:46 -05:00
Ed Hennis
77e3bbdc89 Move the ValidPseudoAccounts class back to its original location
- The class didn't actually change much, if at all, but somehow got
  relocated.
- This should make the review easier, and reduce the footprint of the
  PR.
2025-11-25 13:29:05 -05:00
Ed Hennis
49ee70ea28 Fix formatting again 2025-11-25 12:22:15 -05:00
Jingchen
b124c9f7e3 refactor: Retire Flow and FlowSortStrands amendments (#6054)
Amendments activated for more than 2 years can be retired. This change retires the Flow and FlowSortStrands amendments.
2025-11-25 14:21:17 +00:00
Vito Tumas
5773f2440a Add additional documentation to Lending Protocol (#6037)
- documents core equations of the lending protocol
2025-11-25 05:37:04 +00:00
Ed Hennis
08a6bef7f3 Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-24 21:48:57 -05:00
Bart
b550dc00ed ci: Remove missing commits check (#6077)
This change removes the CI check for missing commits, as well as a stray path to the publish-docs workflow that isn't used in the on-trigger workflow.
2025-11-24 21:43:39 -05:00
Ed Hennis
b8d830a812 Fix formatting 2025-11-24 21:38:21 -05:00
Ed Hennis
814fe018b7 Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-24 21:30:08 -05:00
Ed Hennis
dedafbe326 Review feedback from @gregtatcam: typo 2025-11-24 20:54:31 -05:00
Ed Hennis
71bb08cd78 Review feedback from @Tapanito, @gregtatcam, and @shawnxie999
- Created a common doWithdraw function for VaultWithdraw and
  LoanBrokerCoverWithdraw. Added verifyDepositPreauth to it, so that
  both transactions will get the check.
- Add a missing null check to LoanBrokerSet, and add log messages to the
  existing checks.
2025-11-24 20:42:40 -05:00
Ed Hennis
25e72d7844 Update src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp
Co-authored-by: Shawn Xie <35279399+shawnxie999@users.noreply.github.com>
2025-11-24 21:42:03 -04:00
Ed Hennis
005390e266 Fix formatting 2025-11-24 19:48:57 -05:00
Vito Tumas
24586ef394 Add deep freeze check to LoanBrokerDelete (#6053)
- Add logging for missing vault
- Fix unit test
2025-11-24 23:17:34 +00:00
Ed Hennis
3ef6508490 Fix build error with LoanBroker invariant 2025-11-24 17:55:29 -05:00
Ed Hennis
c5f5edebcc Address a couple of feedback items from @Tapanito and @shawnxie999:
- Call verifyDepositAuth in VaultWithdraw and LoanBrokerCoverWithdraw to
  a destination.
- Update a couple of impossible error returns to log a message, but
  exclude from coverage.
- Fail if the LoanBroker.LoanSequence overflows to 0.
2025-11-24 17:45:56 -05:00
Ed Hennis
bb3bd74457 Review feedback from @shawnxie999: removeEmptyHolding
- removeEmptyHolding will succeed if the account is the issuer
- If it encounters a trust line in that state, the line will always be
  deleted.
- If it encounters an MPTToken in that state, which should be
  impossible, the token will be deleted if it doesn't have a balance.
2025-11-24 17:44:58 -05:00
Ed Hennis
7e6647e769 Review feedback from @shawnxie999: broker owner count
Annotate loan broker owner set/delete owner count adjustment
2025-11-24 17:44:57 -05:00
Ed Hennis
b7b0a65735 Update src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2025-11-24 18:44:16 -04:00
Ed Hennis
e850b9f799 Update src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2025-11-24 18:25:56 -04:00
Ed Hennis
4081c9b8e9 Update src/xrpld/app/tx/detail/LoanBrokerSet.cpp
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2025-11-24 18:20:00 -04:00
Ed Hennis
a7af773dd8 Add a LoanBroker invariant to compare CoverAvailable to balance
- Ensures that LoanBroker.CoverAvailable is never less than the
  pseudo-account balance for the Vault asset.
2025-11-24 16:24:35 -05:00
Jingchen
21c02232a5 refactor: Retire RequireFullyCanonicalSig amendment (#6035)
Amendments activated for more than 2 years can be retired. This change retires the RequireFullyCanonicalSig amendment.
2025-11-24 13:58:37 +00:00
Jingchen
a791c03dc1 refactor: Retire DeletableAccounts amendment (#6056)
Amendments activated for more than 2 years can be retired. This change retires the DeletableAccounts amendment.
2025-11-24 11:52:08 +00:00
Jingchen
800a315383 refactor: Retire CryptoConditionsSuite amendment (#6036)
Amendments activated for more than 2 years can be retired. This change retires the CryptoConditionsSuite amendment.
2025-11-24 06:23:16 -05:00
Ed Hennis
1ba010031d Review feedback from @gregtatcam: variable name
- Renamed "fee" to "overpaymentFee" in "computeOverpaymentComponents".
2025-11-23 23:32:23 -05:00
Ed Hennis
76766e93df Review feedback from @gregtatcam: readability 2025-11-23 23:14:26 -05:00
Ed Hennis
dd5464d921 From discussion with @gregtatcam: Revert "Payment"
- Revert Payment transactor (Payment.*) back to what is in "develop".
- Change LoanBrokerCoverWithdraw to do a direct transfer, whether it's
  too the account or the destination. Similar to VaultWithdraw, and as
  specified
- https://github.com/XRPLF/rippled/pull/5270#discussion_r2554560222
2025-11-23 23:06:44 -05:00
Ed Hennis
4c28e750ff Review feedback from @gregtatcam: compute vs. calculate
- Rename the LendingHelper functions that started with `calculate` to
  start with `compute`.
2025-11-23 21:41:38 -05:00
Ed Hennis
4ba2514bfa Review feedback from @gregtatcam: LoanDeltas
- Renamed to LoanStateDeltas, and document what it's for
2025-11-23 21:28:09 -05:00
Ed Hennis
27a7138f88 Review feedback from @gregtatcam: constructRoundedLoanState
- Rename the overload of constructRoundedLoanState that takes components
  as inputs to constructLoanState. The original function did no rounding
  or enforcement of the inputs being rounded.
- Left the overload constructRoundedLoanState(SLE::const_ref loan)
  alone, because Loan objects are assumed to be rounded.
2025-11-23 21:09:56 -05:00
Ed Hennis
36c1dd18ee Review feedback from @Tapanito: final payment
- Optimize final payment by checking and returning that case before
  doing any other computations. Removes some asserts that weren't really
  adding value.
2025-11-23 17:28:32 -05:00
Ed Hennis
deab24b580 Review feedback from @gregtatcam: full interest
- Found computed full interest downward, per spec.
2025-11-23 17:10:15 -05:00
Ed Hennis
58497541c7 Review feedback from @gregtatcam: LoanPay flags
- Used std::popcount instead of a loop to check for mutually exclusive
  flags
2025-11-23 15:29:48 -05:00
Ed Hennis
b8ad6d3950 Review feedback from @a1q123456: LoanDelete
- Update the ValidLoan invariant to guarantee that Loan fields are
  consistent for the paid off and not paid off state.
2025-11-23 14:58:45 -05:00
Ed Hennis
63724e4405 Review feedback from @gregtatcam: seconds per year
- Define a constexpr secondsInYear in LedgerHelpers.h
2025-11-23 00:03:52 -05:00
Ed Hennis
a3b2ce91de Review feedback from @gregtatcam: frozen broker pseudo-account
- LoanSet needs to fail if the broker pseudo-account is deep frozen,
  because it needs to be able to receive fees if the broker owner can't.
2025-11-22 23:45:39 -05:00
Ed Hennis
1ceff3dde7 Review feedback from @greptatcam: getStartDate
- Make getStartDate helper in LoanSet static.
2025-11-22 23:36:17 -05:00
Ed Hennis
2fb9a6a292 Review feedback from @Tapanito: tecKILLED logs
- Log messages explaining Loan-related tecKILLED returns.
2025-11-22 23:06:12 -05:00
Ed Hennis
e25bae5e78 Review feedback from @Tapanito
- Check for zero interest in loanAccruedInterest
- Fix a couple of errors from earlier commits
2025-11-22 22:56:40 -05:00
Ed Hennis
17eaa51378 Update src/xrpld/app/misc/detail/LendingHelpers.cpp
- Optimization to skip multiplication.

Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2025-11-22 23:49:19 -04:00
Ed Hennis
2f410148f1 Update src/xrpld/app/misc/detail/LendingHelpers.cpp
- Log a warning if a full payment fails because it's the last payment.

Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2025-11-22 23:40:19 -04:00
Ed Hennis
fa2dea84c2 Review feedback from @gregtatcam: STAmount
- Fix a couple of typos.
- Make fewer unneeded copies in roundToScale.
2025-11-22 22:30:06 -05:00
Ed Hennis
f8ee979ff4 Review feedback from @gregtatcam
- Add a comment explaining the formula in LoanManage::owedToVault
- Make owedToVault static
2025-11-22 21:48:46 -05:00
Ed Hennis
1c38bbdf45 Review feedback from @gregtatcam
- Remove unneeded proxy variables. Set the fields directly.
2025-11-22 21:33:30 -05:00
Ed Hennis
590f69cd4c Add comment to totalPaidToVaultForDebt in LoanPay.cpp
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2025-11-22 21:24:42 -05:00
Ed Hennis
4c9a96a17b Review feedback from @gregtatcam
- No need to subtract takeFromSender in rippleSendMultiMPT if the sender
  is the issuer.
2025-11-22 21:11:06 -05:00
Ed Hennis
b82481858a Review feedback from @gregtatcam
- Rename "accountCanSpend" to "accountSpendabled".
- Change some getIssuer() local vars to use references.
2025-11-22 20:57:34 -05:00
Ed Hennis
8bb162ce52 Review feedback from @gregtatcam
- Rewrite "Asset::native()" and "integral()" to use std::visit.
- Improve documentation for the LoanPay transaction flags:
  tfLoanFullPayment, tfLoanLatePayment
2025-11-22 19:36:50 -05:00