- Updates or fixes a couple of things I noticed while reviewing changes
to the spec.
- Rename sfPreviousPaymentDate to sfPreviousPaymentDueDate.
- Make the vault asset cap check added in #6124 a little more robust:
1. Check in preflight if the vault is _already_ over the limit.
2. Prevent overflow when checking with the loan value. (Subtract
instead of adding, in case the values are near maxint. Both return
the same result. Also add a unit test so each case is covered.
- add nodiscard to unimpairLoan, and check result in LoanPay
- add a check to verify that issuer exists
- improve LoanManage error code for dust amounts
* XRPLF/ximinez/lending-XLS-66-2:
Change some instances of View info() to header()
Update rippled to xrpl
refactor: Rename `ripple` namespace to `xrpl` (5982)
refactor: Move JobQueue and related classes into xrpl.core module (6121)
refactor: Rename `rippled` binary to `xrpld` (5983)
refactor: rename info() to header() (6138)
refactor: rename `LedgerInfo` to `LedgerHeader` (6136)
refactor: clean up `RPCHelpers` (5684)
chore: Fix docs readme and cmake (6122)
chore: Clean up .gitignore and .gitattributes (6001)
chore: Use updated secp256k1 recipe (6118)
- Round the initial total value computation upward, unless there is
0-interest.
- Rename getVaultScale to getAssetsTotalScale, and convert one incorrect
computation to use it.
- Use adjustImpreciseNumber for LossUnrealized.
- Add some logging to computeLoanProperties.
- 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.
- 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.
- Shortcut on issuer match in canTransfer.
- An asset can transfer if either trustline enabled rippling, so both
must have it disabled for the transfer to fail with terNO_RIPPLE.
- Remove unnecessary asfDefaultRipple sets in unit tests.
- Add a new unit test helper class: testline, and a macro: THISLINE.
When included as a parameter to Env::operator(), will include the line
number of the transaction that didn't get the expected result. Works
similarly to BEAST_EXPECT. I didn't do the same for the file name,
because that can be deduced from the testcase name.
- Includes unit tests for terNO_RIPPLE.
- Switch auth mode to weak when submitter is destination.
- Require rippling enabled for vault deposits or withdrawals.
- A regular payment that is late, or a tfLoanLatePayment that is not
late will fail.
- Flags are mutually exclusive.
- Add a few interest computation shortcuts and overflow prevention
checks that return 0 if there's no time to compute for.
- Assert requires that an overpayment reduces the value of a loan. If
the overall loan interest is low enough, it could leave it unchanged.
Update the assert to require that the overpayment does not increase
the value of the loan.
- Adds a unit test provided by @gregtatcam to demonstrate this issue.
- Vault and LoanBroker pseudo-accounts can hold MPTs, regardless of MPTRequireAuth setting.
- Add requireAuth check in LoanBrokerCoverDeposit and LoanPay.
- Fail attempts to unauthorize pseudo-accounts by MPT issuers.
- Scale the loan to the Vault, so that amounts moving to the vault are
less likely to have rounding errors.
- Similar to LoanPay, when LoanManage defaults a loan, round the amounts
to the Vault scale (because the Vault scale can change) before
applying them to the Vault.
- Ensures a consistent fixed payment amount for the entire life of the
loan, except the final payment, which is guaranteed to be the same or
smaller.
- Convert some Loan structs to compute values that had need manual
updates to stay consistent.
- Fail the transaction in `LoanPay` if it violates the Vault `assetsAvailable <=
assetsTotal` invariant.
- Use constexpr to check that min mantissa value for Number and STAmount
is a power of 10, and compute the max in terms of the min.
- Improve unit tests:
- Use BrokerParameters and Loan Parameters instead of semi-global
class values
- In tests, check that the expected number of loan payments are made.
- Add LoanBatch manual test to generate a set number of random loans,
set them up, and pay them off.
- Add LoanArbitrary manual test to run a single test with specific
(hard-coded for now) parameters.
- Add Number support to XRP_t.
- sfCoverRateMinimum and sfCoverRateLiquidation must be both zero or
both non-zero, because both are used in the default amount
calculations, which is the only place they're really meaningful.