Commit Graph

14168 Commits

Author SHA1 Message Date
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
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
Ed Hennis
d353b0ec04 Review feedback
- Use a lambda to defensively guarantee that "tx" can not affect the
  "signerCount" in "LoanSet::calculateBaseFee" # Please enter the commit
  message for your changes. Lines starting
2025-11-22 16:14:54 -05:00
Ed Hennis
973a105959 Review feedback: test coverage, round debt total
- Add some test cases to improve coverage, and exclude some lines from
  coverage.
- Rounds the Broker.DebtTotal to the Vault scale any time it is
  modified. This should reduce rounding errors.
- Ensure that no debt is left for the Broker after the last loan is
  deleted. This ensures that any accumulated rounding errors are
  resolved.
2025-11-22 16:07:07 -05:00
Ed Hennis
1cec91e72d Move protocol.h values into namespace Lending 2025-11-21 17:20:43 -05:00
Ed Hennis
b76cd60a12 fixup! Restore code that needs to be amendment gated 2025-11-21 16:39:44 -05:00
Ed Hennis
cc9b6fc68c Restore code that needs to be amendment gated 2025-11-21 14:46:34 -05:00
Ed Hennis
66da6a8608 Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-21 12:47:43 -05:00
Jingchen
fb74dc28e1 chore: Clean up comment in NetworkOps_test.cpp (#6066)
This change removes a copyright notice that was accidentally copied over from another file.
2025-11-21 17:11:00 +00:00
Pratik Mankawde
e4dccfd49b refactor: Retire DisallowIncoming amendment (#6045)
Amendments activated for more than 2 years can be retired. This change retires the DisallowIncoming amendment.
2025-11-21 15:18:00 +00:00
Jingchen
57f4b4eb7f refactor: Retire Checks amendment (#6055)
Amendments activated for more than 2 years can be retired. This change retires the Checks amendment.
2025-11-21 14:19:43 +00:00
Ayaz Salikhov
adbeb94c2b ci: Only upload artifacts in XRPLF repo owner (#6060)
This change prevents uploading too many artifacts in non-public repositories.
2025-11-20 18:09:03 +00:00
Mayukha Vadari
a3d4be4eaf fix: Set correct index for limit in book_offers CLI (#6043)
This change fixes an indexing typo in the `book_offers` CLI processing, and does not affect the HTTPS/WS RPC processing.
2025-11-20 06:37:28 -05:00
Ed Hennis
8a1f244682 Updated overpayment processing
- Added a test for RIPD-4125
2025-11-20 00:17:33 -05:00
Olek
6ff495fd9b Fix: Perform array size check (#6030)
The `ledger_entry` and `deposit_preauth` requests require an array of credentials. However, the array size is not checked before is gets processing. This fix adds checks and return errors in case array size is too big.
2025-11-19 16:58:18 +00:00
Ed Hennis
bd0b651891 Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-18 22:39:17 -05:00