Compare commits

..

531 Commits

Author SHA1 Message Date
Vito
4fc346ff3f additional comments 2025-11-15 16:34:00 +01:00
Vito
fc23199619 misc documentation 2025-11-15 16:24:17 +01:00
Vito
ef75e0efdd documents overpaymentComponents 2025-11-15 16:18:02 +01:00
Vito
e76ce57f04 documents paymentCOmponents 2025-11-15 16:12:43 +01:00
Vito
dd1ed63b90 moves Loandelta function to a better place 2025-11-15 15:57:49 +01:00
Vito
c6b26aa63f documents full payment 2025-11-15 15:55:49 +01:00
Vito
b6710a99fc documents late payment 2025-11-15 15:51:30 +01:00
Vito
173b736187 documents overpayment 2025-11-15 15:03:34 +01:00
Vito
04203196dc documents doPayment 2025-11-15 14:37:20 +01:00
Vito
32f5a945f2 documents LoanPaymentParts 2025-11-15 14:25:53 +01:00
Vito
e9fd82559a documents LoanProperties 2025-11-15 14:25:52 +01:00
Vito
0c073ffb4c documents loanDeltas 2025-11-15 14:25:52 +01:00
Vito
36cc8d2595 documents extendedPaymentComponents and moves them to header 2025-11-15 14:25:50 +01:00
Vito
ba6a706b63 documents paymentComponents struct 2025-11-15 14:25:41 +01:00
Vito
f1edda7fd3 cleans up loanstate docs 2025-11-15 14:25:40 +01:00
Vito
01a6b1081f documents core equations of the lending protocol 2025-11-15 14:25:39 +01:00
Vito Tumas
31d6ad727e Refactors method and struct names (#6039)
- remove unused method
- rename computeFee to computeManagementFee
- rename calculateRounded to constructRounded
- remove redundancies in LoanDeltas struct
- rename PaymentComponentsPlus to ExtendedPaymentComponents
- additional logging
2025-11-15 08:48:38 +00:00
Ed Hennis
cfdcaf3f8d Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-15 03:08:29 -05:00
Ed Hennis
b9fdf9e564 Add the testPoC_UnsignedUnderflowOnFullPayAfterEarlyPeriodic
- Updated to reflect that the issue in RIPD-3971 has been resolved by
  commit 4396b77c4b
2025-11-14 12:52:27 -05:00
Ed Hennis
c65a311ad1 Remove a bunch of obsolete code, marked by "#if LOANCOMPLETE" 2025-11-13 14:26:47 -05:00
Ed Hennis
a868b1938d Fix Vault test failure due to default field not being in RPC Json 2025-11-13 14:21:41 -05:00
Ed Hennis
2f94838bbf Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-13 12:18:42 -05:00
Ed Hennis
1c1cd1a391 Change Vault asset fields back to default
- Was unintentionally rolled back with `Number` changes.
2025-11-13 12:15:39 -05:00
Ed Hennis
ad124ce7b2 Fix balance checking assertion in LoanPay when issuer is borrower
- Resolves RIPD-4096
2025-11-13 01:51:07 -05:00
Ed Hennis
a4aa72eada Fix revert issues 2025-11-12 19:19:06 -05:00
Ed Hennis
398170ef3d Revert "Add optional enforcement of valid integer range to Number"
This reverts commit 3cb447a4fe.
2025-11-12 19:15:14 -05:00
Ed Hennis
9b0b7b5a91 Revert "Make all STNumber fields "soeDEFAULT""
This reverts commit 24f37d73f6.
2025-11-12 19:15:07 -05:00
Ed Hennis
1b4e18a1a7 Revert "Add integer enforcement when converting to XRP/MPTAmount to Number"
This reverts commit b605a2cdcc.
2025-11-12 19:15:06 -05:00
Ed Hennis
814577758f Revert "Fix build error - avoid copy"
This reverts commit cb6df196dc.
2025-11-12 19:15:03 -05:00
Ed Hennis
694abd1c79 Revert "Catch up the consequences of Number changes"
This reverts commit 0175dd70db.
2025-11-12 19:15:00 -05:00
Ed Hennis
2e34506835 Revert "Add a distinction between a "valid" and a "representable" Number"
This reverts commit 8e56af20ee.
2025-11-12 19:14:54 -05:00
Ed Hennis
b7ed35cb04 Fix merge issue: references to retired features 2025-11-12 16:34:41 -05:00
Ed Hennis
8f772b9073 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  chore: Set version 3.1.0-b0 (5986)
  ci: Clean workspace on Windows self-hosted runners (6024)
  docs: fix spelling in comments (6002)
  fix: floating point representation errors in vault (5997)
  ci: Specify bash as the default shell in workflows (6021)
  refactor: Add `XRPL_RETIRE_FIX` and `XRPL_RETIRE_FEATURE` macros (6014)
  refactor: Retire DepositPreAuth and DepositAuth amendments (5978)
  chore: Move running of unit tests out of coverage target (6018)
  refactor: Retire PayChanRecipientOwnerDir amendment (5946)
2025-11-12 14:12:01 -05:00
Ed Hennis
ef66a1cc0e Disable inner Batch transactions for Vault and Loan types 2025-11-12 13:51:57 -05:00
Ed Hennis
6c375f1346 Convert sfNextPaymentDueDate from optional to default
- Simplifies some of the updates and checks
2025-11-11 12:02:58 -05:00
Ed Hennis
21eb13de0c Reorder payment options to do full early payment first
- Since all the special cases are now specified with flags, the order is
  less important.
- Avoids computing the periodic payment parts that are not needed for
  full payment computation.
- A late payment without the late payment flag will override everything
  else, though.
2025-11-10 23:28:25 -05:00
Ed Hennis
4396b77c4b Add tfLoanLatePayment flag; full payment is no longer a special case
- 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.
2025-11-10 23:17:42 -05:00
Ed Hennis
8d22409ab5 review feedback: Use the specific type in the "SendMulti" functions 2025-11-10 21:20:42 -05:00
Ed Hennis
1c99243ec2 Fix service fee accounting when a borrower is the broker (#6016)
- Add unit-test to verify the fix.
2025-11-10 21:10:13 -05:00
Ed Hennis
7712cbdfcc Fix build issue - unused variable 2025-11-10 21:02:01 -05:00
Ed Hennis
abb05cc684 Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-10 19:52:54 -05:00
Ed Hennis
2f064893bb test: Add a test case reproducing the issue in RIPD-3902 2025-11-10 19:50:15 -05:00
Ed Hennis
6ad4b29878 Always round cover minimum calculations up
- Addresses RIPD-4016.
- Add and update testRoundingAllowsUndercoverage() unit test from ticket.
2025-11-10 17:59:10 -05:00
Ed Hennis
73a857e69e Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-10 15:35:09 -05:00
Ed Hennis
9e25b4753d fix: Check for empty or zero VaultID in LoanBrokerSet
- Resolves RIPD-4067.
2025-11-10 15:32:32 -05:00
Ed Hennis
0ae835b356 doc: Expand explanation for LoanBrokerCoverClawback::determineBrokerID 2025-11-10 13:16:10 -05:00
Ed Hennis
a9796d0210 Minor test fixes
- Don't deposit cover if the amount is 0.
- Handle missing next payment date in getCurrentState.
2025-11-09 20:27:59 -05:00
Ed Hennis
b5b31efe0b Fix RIPD-3901 - faulty assert
- 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.
2025-11-09 17:37:46 -05:00
Ed Hennis
e00fea9934 Update the test case for RIPD-3459 with more detailed output data 2025-11-08 22:47:50 -05:00
Ed Hennis
e3ea23cff5 Add test case to reproduce RIPD-3459
- Improve a few loan test helper functions.
- Make Loan.GracePeriod a default field.
2025-11-08 19:04:32 -05:00
Ed Hennis
ffc0d26d20 Merge remote-tracking branch 'mywork/ximinez/lending-number' into ximinez/lending-XLS-66
* mywork/ximinez/lending-number:
  Add a distinction between a "valid" and a "representable" Number
  chore: Point xrpld symlink to rippled (6012)
  Catch up the consequences of Number changes
  Fix build error - avoid copy
  Add integer enforcement when converting to XRP/MPTAmount to Number
  Make all STNumber fields "soeDEFAULT"
  Add optional enforcement of valid integer range to Number
2025-11-08 17:00:35 -05:00
Ed Hennis
fabc7bd916 Merge branch 'develop' into ximinez/lending-number 2025-11-07 19:11:47 -05:00
Ed Hennis
8e56af20ee Add a distinction between a "valid" and a "representable" Number
- "valid" means the value is <= Number::maxIntValue, which has been
  changed to maxMantissa / 100. A valid number could get bigger and be
  ok - such as when paying late interest on a loan.
- "representable" means the value is <= Number::maxMantissa. An
  unrepresentable number WILL be rounded or truncated.
- Adds a fourth level of enforcement: "compatible". It is used for
  converting XRP to Number (for AMM), and when doing explicit checks.
- "weak" will now throw if the number is unrepresentable.
2025-11-07 19:07:21 -05:00
Ed Hennis
972841ae29 Check for Grace Period overflow in LoanSet 2025-11-07 15:40:50 -05:00
Ed Hennis
77d5826297 Add Grace Period to testLoanNextPaymentDueDateOverflow
- Demonstrates that Grace Period can overflow.
- Expected to fail.
2025-11-07 15:37:32 -05:00
Gregory Tsipenyuk
ebfca636fc Implicitly authorize Vault and LoanBroker pseudo-accounts (#5976)
- 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.
2025-11-07 05:39:34 +00:00
Ed Hennis
0175dd70db Catch up the consequences of Number changes
- Change the Number::maxIntValue to all 9's.
- Add integral() to Asset (copied from Lending)
- Add toNumber() functions to STAmount, MPTAmount, XRPAmount to allow
  explicit conversions with enforcement options.
- Add optional Number::EnforceInteger options to STAmount and STNumber
  ctors, conversions, etc. IOUs are never checked.
- Update Vault transactors, and helper functions, to check restrictions.
- Fix and add Vault tests.
2025-11-06 23:55:05 -05:00
Ed Hennis
cb6df196dc Fix build error - avoid copy 2025-11-06 23:55:05 -05:00
Ed Hennis
b605a2cdcc Add integer enforcement when converting to XRP/MPTAmount to Number 2025-11-06 23:55:05 -05:00
Ed Hennis
24f37d73f6 Make all STNumber fields "soeDEFAULT" 2025-11-06 23:55:05 -05:00
Ed Hennis
3cb447a4fe Add optional enforcement of valid integer range to Number 2025-11-06 23:55:05 -05:00
Ed Hennis
ecc429e521 Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-06 23:50:30 -05:00
Ed Hennis
2cb0ca5ad2 Refactor loan test helpers into reusable functions
- Try to reproduce RIPD-3831
2025-11-06 23:49:10 -05:00
Gregory Tsipenyuk
c56387d124 Fix empty/zero broker ID in LoanBrokerSet and LoanSet (#5977)
- Add checks for empty/zero brokerID where needed
- Extend unit-tests.
2025-11-07 02:05:08 +00:00
Ed Hennis
fdb659dc72 fix: Use ".value()" instead of "->" when with STObject::Proxy objects
- Turns out that "Proxy::operator->" is not a safe substitute for
  "Proxy::value()." if the field is not required. The implementation
  is different such that "operator->" will return a null ptr if the
  field is not present. This includes default fields with a value of
  zero!
2025-11-06 20:14:52 -05:00
Ed Hennis
74e331f3e9 Handle zero rate in computePaymentFactor 2025-11-06 19:36:40 -05:00
Ed Hennis
2264713d52 fix: Improve rounding for IOU loans
- 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.
2025-11-06 19:25:37 -05:00
Ed Hennis
560ff824df Another arbitrary test case to try 2025-11-06 19:12:02 -05:00
Ed Hennis
07ec253f2e Add testDustManipulation test, which is expected to fail 2025-11-06 12:48:02 -05:00
Ed Hennis
d8243c7e68 Merge remote-tracking branch 'mywork/ximinez/lending-number' into ximinez/lending-XLS-66
* mywork/ximinez/lending-number:
  Catch up the consequences of Number changes
  Fix build error - avoid copy
  Add integer enforcement when converting to XRP/MPTAmount to Number
  Make all STNumber fields "soeDEFAULT"
  Add optional enforcement of valid integer range to Number
  fix: domain order book insertion #5998
  refactor: Retire fixTrustLinesToSelf amendment (#5989)
2025-11-05 19:29:27 -05:00
Ed Hennis
bd196c7609 Catch up the consequences of Number changes
- Change the Number::maxIntValue to all 9's.
- Add integral() to Asset (copied from Lending)
- Add toNumber() functions to STAmount, MPTAmount, XRPAmount to allow
  explicit conversions with enforcement options.
- Add optional Number::EnforceInteger options to STAmount and STNumber
  ctors, conversions, etc. IOUs are never checked.
- Update Vault transactors, and helper functions, to check restrictions.
- Fix and add Vault tests.
2025-11-05 19:16:09 -05:00
Ed Hennis
82f68496b8 Fix build error - avoid copy 2025-11-05 18:51:20 -05:00
Ed Hennis
16609ccaad Add integer enforcement when converting to XRP/MPTAmount to Number 2025-11-05 18:51:20 -05:00
Ed Hennis
93d99a671c Make all STNumber fields "soeDEFAULT" 2025-11-05 18:51:20 -05:00
Ed Hennis
d10a578663 Add optional enforcement of valid integer range to Number 2025-11-05 18:51:19 -05:00
Ed Hennis
165478b929 Remove the shortage code completely 2025-11-05 13:28:03 -05:00
Ed Hennis
95fdbe520f Partially revert aed8e2b166 Fill in payment computation shortages (#5941)
- Do not attempt to fill in payment computation shortages. Fixes, tests,
  and optimizations are left intact.
2025-11-05 12:48:14 -05:00
Ed Hennis
34db04ffc1 Update Lending files for the xrpl rename 2025-11-04 19:37:58 -05:00
Ed Hennis
65e6746b5c Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-04 18:02:38 -05:00
Ed Hennis
aed8e2b166 Fill in payment computation shortages (#5941)
- 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.
2025-11-04 22:56:16 +00:00
Ed Hennis
7925cc4052 fix: Check the borrower's balance in LoanSet for reserve
- Previously, the submitting Account's balance was checked, which could
  have been the borrower or the lender.
2025-11-03 20:39:01 -05:00
Ed Hennis
245bac1769 Merge branch 'develop' into ximinez/lending-XLS-66 2025-11-03 18:04:04 -05:00
Ed Hennis
cdd6ad4ba4 test: Fix test set up, since the order of preclaim checks changed
- Need to have multisign set up to get to the fee check
2025-11-03 18:00:10 -05:00
Ed Hennis
89979022f2 Merge remote-tracking branch 'upstream/develop' into ximinez/lending-XLS-66
* upstream/develop:
  refactor: Retire ImmediateOfferKilled amendment (5973)
  ci: Update CI image hashes to use netstat (5987)
  chore: Remove version number in find_dependency for OpenSSL (5985)
  refactor: Modularize shamap and nodestore (5668)
  refactor: Retire fixMasterKeyAsRegularKey amendment (5959)
  refactor: Retire fixReducedOffersV1 amendment (5972)
  refactor: Retire fixAmendmentMajorityCalc amendment (5961)
  refactor: Clean up `TxMeta` (5845)
  fix: Address permission delegation vulnerability (5825)
2025-11-03 13:09:03 -05:00
Ed Hennis
4920e65b14 fix: LoanBrokerSet is malformed if Cover fields don't align
- 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.
2025-11-03 12:31:20 -05:00
Bronek Kozicki
b472cc3493 Unit tests for multisigned LoanSet counterparty 2025-10-31 16:51:37 -04:00
Ed Hennis
27389cd7e8 Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-31 13:51:23 -04:00
Ed Hennis
2b9f70b0bd Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  refactor: Improve txset handling (5951)
  Remove directory size limit (5935)
  fix: Change Credential sfSubjectNode to optional (5936)
  refactor: Add support for extra transaction signature validation (5851)
  refactor: Retire fixQualityUpperBound amendment (5960)
  refactor: Retire fix1623 amendment (5928)
  refactor: Retire fixTakerDryOfferRemoval amendment (5958)
  ci: Check whether test failures are caused by port exhaustion (5938)
  chore: Use new prepare-runner (5970)
2025-10-31 13:50:46 -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
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
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
Ed Hennis
64e0ee4be9 Add POC unit test for null vault dereference 2025-10-29 12:25:03 -04: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
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
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
Ed Hennis
7c45f6a673 Fix broken Vault unit tests introduced in 6adb2ec
- canSendToAccount will check if a destination tag is required _before_
  checking if the sender is the destination. This is the original
  VaultWithdraw behavior, and I want to stay consistent.
2025-10-24 00:30:06 -04:00
Ed Hennis
66b547f6fc Review feedback from @Tapanito
- Correct interest rounding calculation
- Fix some comments
- Don't explicitly break out of the multiple payment loop for the final
  payment. Assert that it will exit by the loop condition.
2025-10-23 19:27:11 -04:00
Ed Hennis
6adb2eca76 Review feedbak from @tequdev, plus helpers
- Fix LoanSet.calculateBaseFee with multisign.
- Cleanups.
- Add View helper functions for Loan and Vault transactions
  - preflightDestinationAndTag
  - checkDestinationAndTag
  - canSendToAccount
- Used the helpers in appropriate Loan and Vault transactions.
  - They could also be used in older transactions, I'll save that for
    later.
2025-10-23 18:11:32 -04:00
Gregory Tsipenyuk
f60e298627 Extend LoanBroaker and Loan unit-tests. (#5863)
- Add convenience functions to MPT test-framework.
2025-10-23 19:51:30 +00:00
Ed Hennis
9f5bc8f0da Fix more build errors 2025-10-23 14:28:03 -04:00
Ed Hennis
e306a7c75f Fix some build errors 2025-10-23 14:11:31 -04:00
Ed Hennis
59364be5f8 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  refactor: Retire fix1515 amendment (5920)
  Use "${ENVVAR}" instead of ${{ env.ENVVAR }} syntax in GitHub Actions (5923)
2025-10-23 13:25:59 -04:00
Ed Hennis
aa696ed61a Merge branch 'develop' into ximinez/crashed-tests 2025-10-23 13:24:37 -04:00
Ed Hennis
044b9b8217 *facepalm* 2025-10-23 12:54:31 -04:00
Ed Hennis
f78c5f65bc Allow issuers to send LoanPay
- Implement a new helper accountCanSend, which is like accountHolds, but
  returns a meaningful value for issuers, and will include the available
  credit on the other side of a trust line. (The sfHighLimit or
  sfLowLimit as appropriate.)
- Use this new helper when checking the available balance in LoanPay.
2025-10-23 01:46:43 -04:00
Ed Hennis
6ad7d1c076 Rewrite functionality calculations to use updated calculations 2025-10-23 01:02:03 -04:00
Ed Hennis
9814ec0309 Implement tfLoanFullPayment; use updated full payment calculations 2025-10-23 00:54:58 -04:00
Ed Hennis
b3593fac1c test: Count crashed test suites 2025-10-22 20:23:54 -04:00
Ed Hennis
30e2650ff9 Use a loan scale of 0 for integral asset types
- Loan scale is completely irrelevant to integral types (XRP, MPT), and
  the field is "soeDEFAULT", so when set to 0, it won't be stored on
  ledger, saving a little bit of space.
2025-10-22 17:15:34 -04:00
Ed Hennis
4aa6baef26 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  Moved fix1513 to retire state (5919)
2025-10-22 11:43:39 -04:00
Ed Hennis
dd938c4e7b Add missing header file 2025-10-22 10:56:36 -04:00
Ed Hennis
92144efbdf Check that the borrower has sufficient funds to make the LoanPay 2025-10-22 00:38:05 -04:00
Ed Hennis
5da586bffc Add support for explicit overpayment flag in LoanPay
- Uses the same name and value as for LoanSet: tfLoanOverpayment.
- Untested.
- Also create several placeholders for missing test cases.
2025-10-21 23:55:46 -04:00
Ed Hennis
70ae693821 Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-21 22:20:17 -04:00
Ed Hennis
f6098fd80b Expand use of Asset::integral() 2025-10-21 20:01:55 -04:00
Gregory Tsipenyuk
8757022312 test: Add unit-test to verify correct behavior on broker deep freeze (#5904)
* Add unit-test to verify correct behavior on broker deep freeze
2025-10-21 23:23:27 +00:00
Ed Hennis
587cb2533c Fix build error - XRPL_ASSERT Antithesis expansion 2025-10-21 18:12:52 -04:00
Ed Hennis
92431e11c8 Fix build error - unused variables 2025-10-21 18:05:56 -04:00
Ed Hennis
dfc4933c3b Convert Loans to track management fee and use updated rounding
- Move management fee calculations out of transactors an into the
  appropriate functions in LendingHelpers.h.
- Rewrite how overpayments are handled. May changed based on numerical
  analysis.
- Update, fix, and clean up unit tests. Includes adding tolerances for
  some checks where an exact match is unlikely.
- Add "integral()" function to Asset to simplify a common check.
2025-10-21 17:47:13 -04:00
Ed Hennis
1bb306baf4 Fix formatting 2025-10-20 13:40:27 -04:00
Ed Hennis
98d1cf07ed Compare Numbers against beast::zero 2025-10-17 18:29:09 -04:00
Ed Hennis
baabf142e4 Fix some build errors 2025-10-17 18:29:09 -04:00
Ed Hennis
f9bd9f390a Remove some unused variables, increase rounding tolerance 2025-10-17 18:29:09 -04:00
Ed Hennis
d7196a8e56 Get remaining Loan unit tests working
- Rename some of the helper functions / lambdas.
- Update tracked interestOwed field better at final payoff.
- Add checks in LoanSet that the fields can be represented in the asset
  type, and update test that fails those checks
  (testLoanPayComputePeriodicPaymentValidRateInvariant)
- Also check that the computed periodic payment can be represented as
  the asset type, and doesn't round _UP_ to 0.
- Update asserts to account for more scenarios, including initial loan
  computation.
2025-10-17 18:29:09 -04:00
Ed Hennis
bda6bb46d1 Fix the singlePayment test helper lambda 2025-10-17 18:29:09 -04:00
Ed Hennis
ec20974cae Simplify rules for creating holdings in LoanSet
- Lender and borrower both signed the transaction. Duh.
2025-10-17 18:29:08 -04:00
Ed Hennis
1efc532b21 Implement Vito's new loan payment part rounding algorithm, and more
- Implement AccountSendMulti
- Document the derivations of loan components.
- Add "loanPrincipalFromPeriodicPayment" helper.
- Removed sfReferencePrincipal
- LoanSet and LoanPay can create MPTokens as a side effect
- LoanPay will send the fee to cover if the broker owner is deep frozen,
  and fail if both of them are deep frozen.
- LoanPay will check auth for the receivers, or create holdings for the
  submitting account if needed.
- LoanSet will fail if principal requested is not positive
- Handle overpayment in a separate function
- Add a test helper to check that balance changes went as expected
- Fix more tests
2025-10-17 18:29:08 -04:00
Ed Hennis
2dd239c59f Update payment component computation and rounding, and more tests
- Tests not expected to pass.
- Check in LoanSet if a loan with interest actually has interest.
  tecPRECISION_LOSS if not.
- Add checks in LoanPay for deep froze broker owner and pseudoaccount.
- Fix management fee calculations in LoanPay and associated LoanBroker
  and Vault data updates.
- Make state tracking next payment due date optional.
- Add a test case showing multiple payments combined.
- Update more tests to work with the new fields.
2025-10-17 18:29:08 -04:00
Ed Hennis
fc2163708a Update InvariantCheck, LoanManage, and LoanPay to make tests work
- Primarily updating tests, and fixing stuff that didn't work.
- Tests still not expected to pass.
- Add Json::Value::isMember(StaticString) so SFields can be used.
- Validate more fields in ValidLoan Invariant
2025-10-17 18:29:08 -04:00
Ed Hennis
eeec90ee74 Handle overpayment calculations 2025-10-17 18:29:08 -04:00
Ed Hennis
8d982758cb Ensure interest portion doesn't go negative
- Ensure principal part is not bigger than whole payment.
- Add some documentation.
2025-10-17 18:29:08 -04:00
Ed Hennis
1b31dbc4c9 Fix build errors 2025-10-17 18:29:07 -04:00
Ed Hennis
f8b63228b6 Cool idea: Charge one extra base fee per 25 payments 2025-10-17 18:29:07 -04:00
Ed Hennis
0b8cd2d7ca Cool idea: Make Loan.NextDueDate optional; clear it when complete
- Check "simple" loanMakePayment failure conditions early
2025-10-17 18:29:07 -04:00
Ed Hennis
a8de91c57d Add LoanPaymentParts::operator+=
- Builds, but tests are not expected to pass
2025-10-17 18:29:07 -04:00
Ed Hennis
97e2c10359 Continue progress updating the LoanHelpers
- May not build
2025-10-17 18:29:07 -04:00
Ed Hennis
96d0258f51 Update LoanPay
- Enable the rest of LoanPay.
- Start updating the helper functions.
- Tests are not expected to pass.
2025-10-17 18:29:07 -04:00
Ed Hennis
fb8dafa6a8 Refactor Number, add tests, update LoanManage, update LoanPay
- Loan tests are not expected to pass.
- Refactor Number to put rounding logic into reusable functions.
- Add Number tests to explicitly test rounding - may be redundant, but
  easy to reason about.  Verifies that the default rounding matches
  banker's rounding.
- Enable LoanManage. Apparently any remaining issues were fixed by the
  previous commit's cleanups.
- Partially enabled LoanPay.
2025-10-17 18:29:06 -04:00
Ed Hennis
3cc8e5564a Start converting LoanManage to handle pre-computed fields
- Tests are not expected to pass
2025-10-17 18:29:06 -04:00
Ed Hennis
e1939d0d20 Convert LoanSet to precomputed all values
- Tests are not expected to pass
2025-10-17 18:29:06 -04:00
Ed Hennis
2509293943 Disable blocks of code using #if LOANCOMPLETE to enable build
- Will add those back later as the appropriate helpers are updated.
- Tests are not expected to pass.
2025-10-17 18:29:06 -04:00
Ed Hennis
63edf035a6 Start converting Loans to use fixed payments and track value
- Not expected to build
2025-10-17 18:29:06 -04:00
Ed Hennis
d353f4a2e6 Remove conditional LoanDraw code 2025-10-17 18:29:06 -04:00
Ed Hennis
9f1ed7ed61 Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-17 18:21:49 -04:00
Ed Hennis
d700f6876d Merge remote-tracking branch 'mywork/ximinez/lending-sttx-checksign' into ximinez/lending-XLS-66
* mywork/ximinez/lending-sttx-checksign:
  Review feedback from @a1q123456
  Add jtx, STObject, and RPC support for sig object fields
  Add support for extra transaction signature validation
2025-10-17 18:21:12 -04:00
Ed Hennis
9c28578262 Review feedback from @a1q123456
- Convert STTx::getSignature to be static.
- Make the STTx::checkSign that takes a signature object private, and
  change it and all the other relevant functions to take the signature
  object as a `const&`.
- Change `getBatchTransactionIDs` to return a `const&` to reduce the
  number of vector copies. Rename `batchTxnIds_` to CamelCase. Update
  the text of the internal comment.
2025-10-17 16:26:23 -04:00
Ed Hennis
134998d86f Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-16 13:12:20 -04:00
Ed Hennis
307d5474b4 Merge branch 'develop' into ximinez/lending-sttx-checksign 2025-10-16 13:12:17 -04:00
Ed Hennis
1212902be6 Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-16 10:48:57 -04:00
Ed Hennis
48d458afc3 Merge branch 'develop' into ximinez/lending-sttx-checksign 2025-10-16 10:48:52 -04:00
Ed Hennis
e6e9003821 Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-10 13:47:05 -04:00
Ed Hennis
66dbc05a9f Update ValidVault to allow LoanPay to change LossUnrealized
- Making a payment on an impaired loan will unimpair the loan, which
  changes Vault.LossUnrealized.
- Add a step in unit tests to impair a loan before making a payment, to
  verify, and prevent future similar regressions.
- Resolves regression RIPD-3650
2025-10-10 13:15:28 -04:00
Ed Hennis
7f4cdefc24 Merge branch 'develop' into ximinez/lending-sttx-checksign 2025-10-10 13:01:41 -04:00
Ed Hennis
8152bcb1f3 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  refactor: Update Conan dependencies: OpenSSL (5873)
  Add vault invariants (5518)
  test: Add more tests for Simulate RPC metadata (5827)
  chore: Fix release build error (5864)
  refactor: Update CI strategy matrix to use new RHEL 9 and RHEL 10 images (5856)
  chore: exclude all `UNREACHABLE` blocks from codecov (5846)
  Set version to 3.0.0-b1 (5859)
2025-10-09 16:15:22 -04:00
Ed Hennis
53e82a1c11 Merge branch 'develop' into ximinez/lending-sttx-checksign 2025-10-09 15:14:55 -04:00
Ed Hennis
c179135e15 Fix the build and test errors introduced by the previous merge:
** Vault Invariants for Loan txs need to be fleshed out. **

- Give the appropriate Loan transactions vault modification privileges.
- Give the appropriate Loan transactions the ability to authorize
  (create in this case) MPTokens.
- Check that LoanManage does not leave Vault in an inconsistent state
  (AssetsAvailable > AssetsTotal). For IOU vaults, if the difference is
  dust, "round up".
2025-10-09 15:09:49 -04:00
Ed Hennis
5117ef831e Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-09 14:15:26 -04:00
Gregory Tsipenyuk
f35d0dc829 Add convenience functions to MPT test-framework. (#5870) 2025-10-09 04:22:38 +00:00
Ed Hennis
311da8fdcf Merge branch 'develop' into ximinez/lending-sttx-checksign 2025-10-08 14:21:41 -04:00
Ed Hennis
7120cce996 Add jtx, STObject, and RPC support for sig object fields 2025-10-06 15:40:14 -04:00
Ed Hennis
23045fcbef Add support for extra transaction signature validation
- Restructures `STTx` signature checking code to be able to handle
  a `sigObject`, which may be the full transaction, or may be an object
  field containing a separate signature. Either way, the `sigObject` can
  be a single- or multi-sign signature.
- This is distinct from 550f90a75e (#5594), which changed the check in
  Transactor, which validates whether a given account is allowed to sign
  for the given transaction. This cryptographically checks the signature
  validity.
2025-10-03 14:56:39 -04:00
Ed Hennis
d576e9d214 Include exception messages in multi signature check result 2025-10-02 22:08:03 -04:00
Ed Hennis
5863f05343 Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-02 11:03:17 -04:00
Ed Hennis
ce23d0aa54 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  fix: Transaction sig checking functions do not get a full context (5829)
2025-10-01 18:13:53 -04:00
Ed Hennis
aac25e8c79 fixup! Review feedback from @Bronek: Add an assert 2025-10-01 15:56:06 -04:00
Ed Hennis
1888784e8e Review feedback from @Bronek: Add an assert 2025-10-01 14:15:45 -04:00
Ed Hennis
681c179174 Merge branch 'develop' into ximinez/lending-XLS-66 2025-10-01 13:14:33 -04:00
Ed Hennis
05739c59cf Merge branch 'develop' into ximinez/lending-XLS-66 2025-09-30 22:29:07 -04:00
Ed Hennis
b127b24dae Addressed review feedback from @gregtatcam:
- All current items are done
- Mostly comments
- Restructured PaymentParts (formerly PeriodicPaymentParts) to bring
  along fees, and removed the computed / combined PeriodicPayment from
  places that should be using PaymentParts instead.
2025-09-30 22:25:53 -04:00
Ed Hennis
c2a0824da0 Merge remote-tracking branch 'mywork/ximinez/lending-tx-fix' into ximinez/lending-XLS-66
* mywork/ximinez/lending-tx-fix:
  fix: Transaction sig checking functions do not get a full context
  ci: Upload artifacts during build and test in a separate job (5817)
2025-09-30 16:28:10 -04:00
Ed Hennis
e1b234cc51 fix: Transaction sig checking functions do not get a full context
- Fixes a bug introduced by PR #5594, commit 550f90a75e, which
  introduced the concept of a "sigObject", in which the signature is
  checked without necessarily being the transaction.
- Fortunately, no code uses the "sigObject" as anything other than the
  transactor yet, so the bug is harmless for now.
- This fix removes the "PreclaimContext" from the parameter list, and
  adds only the individual parts needed by the function, none of which
  are the transaction.
2025-09-30 14:39:08 -04:00
Ed Hennis
03d8cf2c12 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  refactor: Add support for extra transaction signatures (5594)
  refactor: Restructure Transactor::preflight to reduce boilerplate (5592)
2025-09-29 21:49:58 -04:00
Ed Hennis
7a3f7aebcf Review feedback from @gregtatcam
* Write more comments explaining what's going on.
* Rename some variables.
* Do a final safety check for valid values in `LoanPay`.
2025-09-29 21:42:03 -04:00
Ed Hennis
f78d27e9b3 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  switch `fixIncludeKeyletFields` to `Supported::yes` (5819)
2025-09-29 13:38:43 -04:00
Ed Hennis
e38e911190 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-29 13:32:12 -04:00
Ed Hennis
44313d9a30 Merge branch 'develop' into ximinez/lending-refactoring-3 2025-09-29 13:32:08 -04:00
Ed Hennis
a3365545df Review feedback from @Bronek
- Exclude impossible logging from code coverage, too.
2025-09-28 19:10:12 -04:00
Ed Hennis
1d85727675 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-26 19:26:13 -04:00
Ed Hennis
da3c2beae0 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-26 19:26:06 -04:00
Ed Hennis
6b7136906f Merge branch 'develop' into ximinez/lending-refactoring-3 2025-09-26 19:26:02 -04:00
Ed Hennis
7612fd0ba6 Review feedback from @gregtatcam
- Amendment checking correctness.
- Sync some changes between LoanBrokerCoverWithdraw and CoverDeposit.
- Check for nulls.
- Add documentation.
2025-09-26 19:23:13 -04:00
Ed Hennis
0bd6b1ae49 Review feedback from @mvadari
- Clarify the purpose of the assert in calculateOwnerReserveFee
2025-09-26 16:05:15 -04:00
Ed Hennis
66216a3d41 Review feedback from @mvadari
- Add a test for preflightCheckSigningKey
2025-09-26 15:36:12 -04:00
Ed Hennis
4b90f97e52 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-26 13:41:43 -04:00
Ed Hennis
f1a2fe3d0a Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-26 13:41:35 -04:00
Ed Hennis
d76f31cb7c Merge branch 'develop' into ximinez/lending-refactoring-3 2025-09-26 13:41:31 -04:00
Ed Hennis
b5caa9c63d Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-26 12:09:25 -04:00
Ed Hennis
3931eb39d5 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-26 12:09:17 -04:00
Ed Hennis
322308f7d1 Merge branch 'develop' into ximinez/lending-refactoring-3 2025-09-26 12:09:13 -04:00
Ed Hennis
4c8f7968c4 Tweak payment rounding 2025-09-25 16:11:02 -04:00
Ed Hennis
6e2965f01a Add test cases for Vault prereq amendments being disabled 2025-09-25 15:26:30 -04:00
Ed Hennis
dba3af9318 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-25 13:27:17 -04:00
Ed Hennis
7304ee68d5 Merge branch 'develop' into ximinez/lending-refactoring-3 2025-09-25 13:27:13 -04:00
Ed Hennis
759d114ab8 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  docs: Add warning about using std::counting_semaphore (#5595)
  Revert "Update Conan dependencies: OpenSSL" (#5807)
  test: Add STInteger and STParsedJSON tests (#5726)
  Review feedback from @mvadari
2025-09-24 16:10:16 -04:00
Ed Hennis
3c93dbbc7c Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-24 15:49:59 -04:00
Ed Hennis
97819b23ba Merge branch 'develop' into ximinez/lending-refactoring-3 2025-09-24 15:49:56 -04:00
Ed Hennis
9bfa88cd86 Fix build error
- New code referenced `isEnabled`, which was renamed in an updated prereq PR
2025-09-24 15:38:53 -04:00
Ed Hennis
de5af71cb6 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-22 11:26:20 -04:00
Ed Hennis
67578b8f50 Review feedback from @mvadari
- Clean up some of the flag and extra feature checks for readability
2025-09-22 11:17:13 -04:00
Ed Hennis
e72a9d4bf2 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-20 17:12:32 -04:00
Ed Hennis
5b576b841c Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-20 17:12:26 -04:00
Ed Hennis
267b537a13 Review feedback from @Bronek
- Fix a moved assert message
- Rename `Transactor::isEnabled` to `checkExtraFeatures`, and finish
  cleaning up a few classes I missed on the first pass (Vault*
  & XChainBridge*).
2025-09-20 17:09:48 -04:00
Ed Hennis
543f1e702f Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-20 15:44:46 -04:00
Ed Hennis
f9dcce2d7e Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-20 15:44:39 -04:00
Ed Hennis
928af9633f Merge branch 'develop' into ximinez/lending-refactoring-3 2025-09-20 15:44:36 -04:00
Ed Hennis
9e84c37306 Refactor full payment into a function, and update some formatting 2025-09-18 14:54:49 -04:00
Ed Hennis
2aa626c205 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-18 14:08:42 -04:00
Ed Hennis
36c2fa1e56 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-18 14:08:35 -04:00
Ed Hennis
886b0a487c Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-18 14:08:31 -04:00
Ed Hennis
7849df5feb Merge branch 'develop' into ximinez/lending-refactoring-2 2025-09-18 14:08:27 -04:00
Ed Hennis
55baf35d9c Fix build errors due to private type access 2025-09-18 13:30:50 -04:00
Ed Hennis
90ca9ea71a Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  refactor: Modularise ledger (5493)
  chore: Add unit tests dir to code coverage excludes (5803)
  chore: Build and test all configs for daily scheduled run (5801)
  chore: Limits CI build and test parallelism to reduce resource contention (5799)
  fix(amendment): Add missing fields for keylets to ledger objects (5646)
  Rename mutable flags (5797)
  Set version to 2.6.1-rc1
  Downgrade to boost 1.83
  Set version to 2.5.1
  Fix: Don't flag consensus as stalled prematurely (5658)
2025-09-18 13:17:29 -04:00
Ed Hennis
47eb1e8db2 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-18 12:26:50 -04:00
Ed Hennis
540b76fe42 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-18 12:26:46 -04:00
Ed Hennis
d4135a9115 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-18 12:26:42 -04:00
Ed Hennis
4c6a34d3c1 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-18 12:26:38 -04:00
Ed Hennis
be5390b8c7 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-refactoring-1
* XRPLF/develop:
  refactor: Modularise ledger (5493)
  chore: Add unit tests dir to code coverage excludes (5803)
  chore: Build and test all configs for daily scheduled run (5801)
  chore: Limits CI build and test parallelism to reduce resource contention (5799)
  fix(amendment): Add missing fields for keylets to ledger objects (5646)
  Rename mutable flags (5797)
  Set version to 2.5.1
  Fix: Don't flag consensus as stalled prematurely (5658)
2025-09-18 12:03:29 -04:00
Ed Hennis
b5ddc812ea Review feedback from @gregtatcam:
- In progress
- Add explanatory comments, and start refactoring
  loanComputePaymentParts into functions for readability.
2025-09-17 19:37:59 -04:00
Ed Hennis
b9a2eb3399 Review feedback from @gregtatcam
- Remove a redundant struct LoanPaymentParts declaration.
- Add pointers to the XLS-66 spec for all of the LendingHeler formulas.
- Changed if/else if in LoanManage.
2025-09-17 16:54:50 -04:00
Ed Hennis
2c0c4567f4 Rewrite LoanManage flag check to skip if field not set or 0 2025-09-17 15:41:03 -04:00
Ed Hennis
d1c708ca01 Remove A BUNCH of unnecessary includes from the Loan/Lending files 2025-09-17 13:31:56 -04:00
Ed Hennis
ae27376863 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-17 10:49:29 -04:00
Ed Hennis
e237f968c7 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-17 10:49:20 -04:00
Ed Hennis
b02b58e3b5 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-17 10:49:15 -04:00
Ed Hennis
d10ac3b169 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-17 10:49:11 -04:00
Ed Hennis
c37f863201 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-17 10:49:07 -04:00
Ed Hennis
1fbd3fcfa4 Handle Flags not present in LoanManage
- Addresses RIPD-3418
2025-09-16 19:31:01 -04:00
Ed Hennis
70755ed1d3 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-16 19:04:59 -04:00
Ed Hennis
6926c511cb Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-16 19:04:53 -04:00
Ed Hennis
e01dd6d5b0 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-16 19:04:49 -04:00
Ed Hennis
0bfd404111 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-16 19:04:45 -04:00
Ed Hennis
5c072579d7 Review feedback from @yinyiqian1 and @Bronek
- Rewrite all of the templates in Units.h to use concepts.
- Restrict to_short_string to reasonably sized values.
- Rephrase some comments, and fix some typos.
2025-09-16 18:50:24 -04:00
Ed Hennis
c118121337 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-16 17:19:54 -04:00
Ed Hennis
8a4c607af9 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-16 17:19:47 -04:00
Ed Hennis
f85ce9c742 Remove or simplify Transactor::isEnabled overrides
- Remove the ones where the only condition was the required amendment
  specified in transactor.macro.
- Simplify the one that had other conditions, removing the required
  amendment from the conditions.
2025-09-16 17:15:57 -04:00
Ed Hennis
49e1f97476 Fix formatting 2025-09-16 17:10:28 -04:00
Ed Hennis
47aa95fcc4 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-16 15:07:11 -04:00
Ed Hennis
dc5b0918da Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-16 15:07:04 -04:00
Ed Hennis
cb991523f8 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-16 15:07:00 -04:00
Ed Hennis
9683344940 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-16 15:06:55 -04:00
Ed Hennis
5ac905be01 Fix issuer MPT balance sign on tests introduced by 5571 2025-09-16 14:51:18 -04:00
Ed Hennis
4d5afbea3a Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  Bugfix: Adds graceful peer disconnection (5669)
  Support DynamicMPT XLS-94d (5705)
  Only notify clio for PRs targeting the release and master branches (5794)
  refactor: Wrap GitHub CI conditionals in curly braces (5796)
2025-09-16 11:26:18 -04:00
Ed Hennis
9d08fe9a03 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-16 11:15:04 -04:00
Ed Hennis
84e97f0ef5 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3
* XRPLF/ximinez/lending-refactoring-2:
  Bugfix: Adds graceful peer disconnection (5669)
  Support DynamicMPT XLS-94d (5705)
  Only notify clio for PRs targeting the release and master branches (5794)
  refactor: Wrap GitHub CI conditionals in curly braces (5796)
2025-09-16 11:14:06 -04:00
Ed Hennis
4d24b5eac2 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-16 10:46:45 -04:00
Ed Hennis
935749fe1f Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-16 10:46:41 -04:00
Ed Hennis
49eb1cc54e Remove LoanDraw transaction (#5792) 2025-09-16 00:30:02 +00:00
Ed Hennis
dee972e9cd Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  Fix: EscrowTokenV1 (5571)
  fix: Skip processing transaction batch if the batch is empty (5670)
  ci: Fix conan secrets in `upload-conan-deps` (5785)
  Fix code coverage error (5765)
  docs: Add remote to `conan lock create` command (5770)
  refactor: clean up `CTID.h` (5681)
2025-09-15 11:25:13 -04:00
Ed Hennis
bdeed43304 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-15 11:13:45 -04:00
Ed Hennis
7eff303160 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-15 11:13:40 -04:00
Ed Hennis
aa1341f42e Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-15 11:13:36 -04:00
Ed Hennis
91031dbec4 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-15 11:13:32 -04:00
Ed Hennis
03da5da815 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-11 10:33:38 -04:00
Ed Hennis
fc860c1a1d Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-11 10:33:30 -04:00
Ed Hennis
2545bc5936 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-11 10:33:26 -04:00
Ed Hennis
9a9588eaf6 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-11 10:33:22 -04:00
Ed Hennis
abee3dd55c Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-11 10:33:17 -04:00
Ed Hennis
22d9ade2b0 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-10 20:36:49 -04:00
Ed Hennis
3ea0fa67cb Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-10 20:36:43 -04:00
Ed Hennis
1b295c7c00 Use Permission to check if a Transactor is enabled
- Adds a Permission::getTxFeature lookup function to find the
  controlling amendment for a Transactor, if any.
- Returns temDISABLED from preflight if there is an amendment and it's
  not enabled.
- Still need to go through and remove all the now-redundant isEnabled
  functions.
2025-09-10 20:33:01 -04:00
Ed Hennis
dd52a50acc Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  fixup! Make a few tweaks to the changes in 43fe49e7
  Fix Vault tests broken by negative MPT issuer balance
  Make a few tweaks to the changes in 43fe49e7
  fix: Add restrictions to Permission Delegation: fixDelegateV1_1 (5650)
  ci: Add missing dependencies to workflows (5783)
  ci: Use default conan install format (5784)
  Switch CI pipeline bookworm:gcc-13 from arm64 to amd64 (5779)
2025-09-10 20:01:15 -04:00
Ed Hennis
80a2d8f789 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-10 19:39:58 -04:00
Ed Hennis
e5f99e8ee7 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-10 19:39:55 -04:00
Ed Hennis
b925ed44a0 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-10 19:39:51 -04:00
Ed Hennis
14ff03821c Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-refactoring-1
* XRPLF/develop:
  fix: Add restrictions to Permission Delegation: fixDelegateV1_1 (5650)
  ci: Add missing dependencies to workflows (5783)
  ci: Use default conan install format (5784)
  Switch CI pipeline bookworm:gcc-13 from arm64 to amd64 (5779)
2025-09-10 19:34:05 -04:00
Ed Hennis
5ff6bc496a fixup! Make a few tweaks to the changes in 43fe49e7 2025-09-10 18:20:47 -04:00
Ed Hennis
7aaad4a8ef Fix Vault tests broken by negative MPT issuer balance 2025-09-10 17:00:05 -04:00
Ed Hennis
1897ac5ee7 Make a few tweaks to the changes in 43fe49e7
- This was the first merge after I got back from sabbatical. I made
  these same changes in "ximinez/lending-XLS-66" commit 9d052dc, but
  after seeing some test failures, I think they belong here.
2025-09-10 16:49:13 -04:00
Ed Hennis
5894cd2103 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-09 17:14:41 -04:00
Ed Hennis
2f89182fd3 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-09 17:14:34 -04:00
Ed Hennis
4191ddd702 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-09 17:14:30 -04:00
Ed Hennis
37888b97ba Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-09 17:14:27 -04:00
Ed Hennis
10f7e4a02a Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-09 17:14:23 -04:00
Ed Hennis
e5941d5b23 Simplify flag exclusion check in LoanManage 2025-09-09 16:29:35 -04:00
Ed Hennis
3f1a0f3a3d Fix some build errors from yesterday 2025-09-09 15:25:51 -04:00
Ed Hennis
fa2c595a59 Add more value validation in LoanSet
- Don't allow negative numbers.
- Don't send the origination fee if it's defined, but 0.
2025-09-08 17:57:56 -04:00
Ed Hennis
fc6fe9802e Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-08 11:42:09 -04:00
Ed Hennis
b3c40ad408 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-08 11:42:01 -04:00
Ed Hennis
779e94bc03 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-08 11:41:57 -04:00
Ed Hennis
f653ca03d9 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-08 11:41:53 -04:00
Ed Hennis
d46e477092 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-08 11:41:50 -04:00
Ed Hennis
24f58a2e94 Fix test loop 2025-09-05 23:46:48 -04:00
Ed Hennis
e3358ad124 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-05 20:29:04 -04:00
Ed Hennis
5102147709 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-05 20:28:58 -04:00
Ed Hennis
0a54c09de1 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-05 20:28:54 -04:00
Ed Hennis
d594ca1401 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-05 20:28:50 -04:00
Ed Hennis
5335c04616 Fix constexpr expression 2025-09-05 20:28:12 -04:00
Ed Hennis
6db14ccb13 More review feedback from @gregtatcam
- Also fix a few build errors that I missed earlier.
- Updated freeze check rules for LoanSet.
- Fixed the debt total calculation and check in LoanSet.
- Removed _some_ unnecessary includes.
2025-09-05 20:00:10 -04:00
Ed Hennis
582f56487d Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-05 17:44:28 -04:00
Ed Hennis
d47c039941 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-05 17:44:20 -04:00
Ed Hennis
bf4ae57da4 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-05 17:44:17 -04:00
Ed Hennis
83702e79bf Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-05 17:44:13 -04:00
Ed Hennis
6379363bad Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-05 17:44:10 -04:00
Ed Hennis
f0c96ccfe6 Review feedback from @yinyiqian1
- Rewrite to_short_string to call strHex directly instead of building
  the whole hex string first.
- Change PrettyAsset::scale_ back to a uint32 since the Number
  conversion elides any potential multiplication overflow.
- Clean ups.
2025-09-05 17:41:06 -04:00
Ed Hennis
4c726838d1 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-04 20:25:16 -04:00
Ed Hennis
47bcc67d56 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-04 20:25:09 -04:00
Ed Hennis
4b48f9612b Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-04 20:25:05 -04:00
Ed Hennis
7bba34832b Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-04 20:25:02 -04:00
Ed Hennis
76ae61feb5 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-04 20:24:58 -04:00
Ed Hennis
adb260fe17 Review feedback from @dangell7 and @gregtatcam
- Mostly adding comments.
- Fixed some function parameter names that weren't updated after
  a copy/paste.
- LoanBrokerCoverWithdraw does not need to check for freeze when sending
  to the issuer.
- Reorder the fund transfer cases in LoanBrokerCoverWithdraw to make it
  clearer that some transfers are direct, and some use the payment
  engine.
- Only look up the vault ID once in LoanBrokerSet
2025-09-04 20:21:30 -04:00
Ed Hennis
8444a944af Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-04 16:44:10 -04:00
Ed Hennis
6d20e59212 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-04 16:44:03 -04:00
Ed Hennis
c49cf6cec6 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-04 16:43:59 -04:00
Ed Hennis
e24f034b17 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-04 16:43:56 -04:00
Ed Hennis
72733b57e4 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-04 16:43:52 -04:00
Ed Hennis
7a78449f6d Fix minor review feedback from @Bronek
- Clean up assert, log, and comments
2025-09-04 15:53:04 -04:00
Ed Hennis
0d500343ed New invariant privilege "mayDeleteMPT", used by VauleDeposit & Clawback 2025-09-04 14:08:54 -04:00
Ed Hennis
f15e88c009 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-04 13:15:41 -04:00
Ed Hennis
0069c0c5fa Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-04 13:15:35 -04:00
Ed Hennis
450d38293d Remove unused variable 2025-09-04 13:14:19 -04:00
Ed Hennis
6d9001edac Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-04 12:37:00 -04:00
Ed Hennis
3dc14e7430 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4
* XRPLF/ximinez/lending-refactoring-3:
  ci: Use cleanup-workspace action (5763)
  Add `Scale` to SingleAssetVault (5652)
2025-09-04 12:35:39 -04:00
Ed Hennis
9a8c2523ae Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3
* XRPLF/ximinez/lending-refactoring-2:
  ci: Use cleanup-workspace action (5763)
  Add `Scale` to SingleAssetVault (5652)
2025-09-04 12:29:41 -04:00
Ed Hennis
115161f7d2 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-04 12:27:02 -04:00
Ed Hennis
77fcb9b9b3 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-04 12:26:58 -04:00
Ed Hennis
d2e8144c53 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-refactoring-1
* XRPLF/develop:
  Add `Scale` to SingleAssetVault (5652)
2025-09-04 12:25:49 -04:00
Ed Hennis
9d45fd1873 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-03 21:01:09 -04:00
Ed Hennis
4c43a0bca4 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-03 21:01:01 -04:00
Ed Hennis
bb491431bd Review feedback from @dangell7 and @mvadari
- Rewrite isTesSuccess to use TERSubset::operator bool
- Add Transactor::preflightSigValidated for expensive operations that
  should be done after signature validation. These things would have
  been done after preflight2 before this refactor.
- Split Batch and EscrowFinish preflight to use preflightSigValidated, too.
2025-09-03 20:51:40 -04:00
Ed Hennis
f090434c2d Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-03 19:21:10 -04:00
Ed Hennis
5f7b4a5e13 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-03 19:21:00 -04:00
Ed Hennis
11b8f9978e Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-03 19:20:57 -04:00
Ed Hennis
58551da698 Review feedback from @dangell7 and @Bronek
- Added more `STParsedJSON` test cases.
- Add a `safe_cast` conversion in `parseUint32`.
2025-09-03 19:18:24 -04:00
Ed Hennis
5ade8756f6 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  Review feedback from @Bronek
  Rewrite Units.h and same safe_cast.h restrictions to use concepts
* Also add required support for LoanBroker and Loan ledger entries
2025-09-03 18:41:24 -04:00
Ed Hennis
ac4c4905df Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-03 18:10:26 -04:00
Ed Hennis
a5f1879afb Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-03 18:10:23 -04:00
Ed Hennis
8a77ac71ed Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-03 18:10:19 -04:00
Ed Hennis
a72c237373 Review feedback from @Bronek
- Remove unnecessary #include
- Explanatory comments
- Make the MPT InvariantCheck related to EscrowFinish amendment safe
- Convert SField maps to unordered_maps
- Make jtx::fee::operator() clearer
- Rename checkMyPrivilege to hasPrivilege
2025-09-03 18:04:05 -04:00
Ed Hennis
faae2514b9 Rewrite Units.h and same safe_cast.h restrictions to use concepts 2025-09-03 16:14:28 -04:00
Ed Hennis
bcbbf71f29 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-09-03 14:04:25 -04:00
Ed Hennis
12994d4251 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-09-03 14:04:15 -04:00
Ed Hennis
22679673f6 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-09-03 14:04:12 -04:00
Ed Hennis
a14cbf117c Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-09-03 14:04:08 -04:00
Ed Hennis
5ce07e769f Merge branch 'develop' into ximinez/lending-refactoring-1 2025-09-03 14:04:05 -04:00
Ed Hennis
08a5e8428a Require all SFields to have a name
- From @bronek https://github.com/XRPLF/rippled/pull/5590#discussion_r2290589770
- Adds consistency, and ensures sfInvalid and sfGeneric are handled the
  same as all other SFields
2025-08-29 20:11:28 -04:00
Ed Hennis
a8e35f8399 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-29 17:58:21 -04:00
Ed Hennis
1f85888ae8 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-29 15:53:07 -04:00
Ed Hennis
183450db46 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-29 15:53:04 -04:00
Ed Hennis
64959b980f Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-29 15:53:00 -04:00
Ed Hennis
0b833e17ae Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-29 15:52:57 -04:00
Ed Hennis
2e3c5543f2 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-29 10:43:01 -04:00
Ed Hennis
0475398a17 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-29 10:42:57 -04:00
Ed Hennis
bf483a2e94 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-29 10:42:54 -04:00
Ed Hennis
5e3539d6bb Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-28 18:17:49 -04:00
Ed Hennis
a90265dd2a Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-28 18:17:40 -04:00
Ed Hennis
8498ed9df4 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-28 18:17:36 -04:00
Ed Hennis
4169b0a6b7 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-28 18:17:33 -04:00
Ed Hennis
024339c99b Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-28 18:17:29 -04:00
Ed Hennis
044697c438 fix: Allow the borrower to delete a completed / inactive loan, too. 2025-08-27 15:26:45 -04:00
Ed Hennis
2aebeeb966 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-27 11:15:23 -04:00
Ed Hennis
4c79fe46c9 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-27 11:15:14 -04:00
Ed Hennis
51abafea26 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-27 11:15:10 -04:00
Ed Hennis
f1f1117b08 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-27 11:15:06 -04:00
Ed Hennis
5bb12ac1db Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-27 11:15:03 -04:00
Ed Hennis
dbd9a05e10 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-25 19:51:13 -04:00
Ed Hennis
8981885196 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-25 19:51:04 -04:00
Ed Hennis
a7390c070f Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-25 19:51:01 -04:00
Ed Hennis
4d0f895cda Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-25 19:50:57 -04:00
Ed Hennis
48162219ac Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-25 19:50:54 -04:00
Ed Hennis
1cb4a49ad3 Make a note about PR #5650 integration 2025-08-25 19:48:31 -04:00
Ed Hennis
18ffbbd42d Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-22 20:34:42 -04:00
Ed Hennis
7f1c0e55d6 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-22 19:31:36 -04:00
Ed Hennis
1876ffcd71 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-22 19:31:24 -04:00
Ed Hennis
3ef1e4269b Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-22 19:31:20 -04:00
Ed Hennis
ae25e0f058 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-22 19:31:17 -04:00
Ed Hennis
7d634c1e62 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-22 19:31:14 -04:00
Ed Hennis
f713208d89 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-22 19:09:07 -04:00
Ed Hennis
5d98799205 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-22 19:08:55 -04:00
Ed Hennis
9086c678a9 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-22 19:08:52 -04:00
Ed Hennis
e434563e2e Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-22 19:08:48 -04:00
Ed Hennis
29300fc972 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-refactoring-1
* XRPLF/develop:
  chore: Update clang-format and prettier with pre-commit (5709)
  fix(test): handle null metadata for unvalidated tx in Env::meta (5715)
  chore: Workaround for CI build errors on arm64 (5717)
  chore: Fix file formatting (5718)
  fix: Skip notify-clio when running in a fork, reorder config fields (5712)
  chore: Reverts formatting changes to external files, adds formatting changes to proto files (5711)
2025-08-22 19:07:28 -04:00
Ed Hennis
a88aceb846 Reformat transactions.macro 2025-08-22 16:02:59 -04:00
Ed Hennis
9986346d60 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-21 11:39:20 -04:00
Ed Hennis
7c642783f4 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-21 11:39:09 -04:00
Ed Hennis
0f1a2324bc Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-21 11:39:05 -04:00
Ed Hennis
2d570267de Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-21 11:39:01 -04:00
Ed Hennis
97849b6e70 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-21 11:38:57 -04:00
Ed Hennis
5d2a7d651e Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  Review feedback from @dangell7
2025-08-19 20:22:54 -04:00
Ed Hennis
b26477a21e Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-19 20:11:45 -04:00
Ed Hennis
422a99bb26 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-19 20:11:42 -04:00
Ed Hennis
b447fc54c8 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-19 20:11:38 -04:00
Ed Hennis
9920037d13 Review feedback from @dangell7
- Cleaned up some of the `LEDGER_ENTRY` macros by eliding unnecessary
  parameters.
- Define the transaction privileges in one place (InvariantCheck.cpp).
- Give `EscrowFinish` the `mayAuthorizeMPT` privilege.
- Rename the test helper `expectLine` to `expectHolding` since
  it handles both trust lines and MPTs.
- Restructure the ""pseudo-account has 2 pseudo-account fields set"
  invariant test to loop over all defined pseudo-account fields.
- Fix `operator<<` for `PrettyAmount` to handle `MPTIssue`s.
- Add enforcement of the `AccountRootsDeletedClean` invariant if SAV is
  enabled, and clarify the comment for the pseudo-account field check.
- Delete the 100% redundant `ttMPTOKEN_ISSUANCE_SET` check in
  `ValidMPTIssuance`.
2025-08-19 19:52:30 -04:00
Ed Hennis
714e12f44f Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-19 16:14:20 -04:00
Ed Hennis
fba91487ec Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-19 16:05:34 -04:00
Ed Hennis
49ea5cc152 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-19 16:05:30 -04:00
Ed Hennis
87e0c25a34 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-19 16:05:26 -04:00
Ed Hennis
a648249b90 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-19 16:05:21 -04:00
Ed Hennis
083ab7b054 Prevent Vault unrealized loss from exceeding "unavailable" assets 2025-08-19 15:15:10 -04:00
Ed Hennis
b6ef337e45 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  fix: Modify jobs to use '>>' instead of 'tee' for GITHUB_OUTPUT (5699)
  refactor: Revamp CI workflows (5661)
  refactor: Decouple net from xrpld and move rpc-related classes to the rpc folder (5477)
  Set version to 2.6.0-rc2
  docs: Updates list of maintainers and reviewers (5687)
  fix: Change log to debug level for AMM offer retrieval and IOU payment check (5686)
  fix: Add -Wno-deprecated-declarations for Clang only (5680)
  Update .git-blame-ignore-revs for 5657 (5675)
  Fix BUILD.md instruction (5676)
  Set version to 2.6.0-rc1
  fix: Improve logging of the reason to refuse a peer connection (5664)
  fix: Make test suite names match the directory name (5597)
  chore: Run prettier on all files (5657)
  chore: Set CONAN_REMOTE_URL also for forks (5662)
  chore: Cleanup bin/ directory (5660)
  perf: Optimize hash performance by avoiding allocating hash state object (5469)
2025-08-18 20:36:35 -04:00
Ed Hennis
e62efa2a90 Fix unit tests broken by the addition of signature_target
- Specifically some of the tests for sign and submit
2025-08-18 20:32:53 -04:00
Ed Hennis
3867945b46 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-18 12:44:41 -04:00
Ed Hennis
084896189d Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-18 12:25:55 -04:00
Ed Hennis
e9033898da Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-18 12:25:51 -04:00
Ed Hennis
d952e9de1a Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-refactoring-1
* XRPLF/develop:
  fix: Modify jobs to use '>>' instead of 'tee' for GITHUB_OUTPUT (#5699)
  refactor: Revamp CI workflows (#5661)
  refactor: Decouple net from xrpld and move rpc-related classes to the rpc folder (#5477)
  Set version to 2.6.0-rc2
  docs: Updates list of maintainers and reviewers (#5687)
  fix: Change log to debug level for AMM offer retrieval and IOU payment check (#5686)
  fix: Add -Wno-deprecated-declarations for Clang only (#5680)
  Update .git-blame-ignore-revs for #5657 (#5675)
  Fix BUILD.md instruction (#5676)
  Set version to 2.6.0-rc1
  fix: Improve logging of the reason to refuse a peer connection (#5664)
  fix: Make test suite names match the directory name (#5597)
  chore: Run prettier on all files (#5657)
  chore: Set CONAN_REMOTE_URL also for forks (#5662)
  chore: Cleanup bin/ directory (#5660)
  perf: Optimize hash performance by avoiding allocating hash state object (#5469)
2025-08-18 12:22:43 -04:00
Ed Hennis
bc3c9e1534 fixup! Add Counterparty signing support 2025-08-09 01:19:38 -04:00
Ed Hennis
6d137e44dc Add Counterparty signing support
- Add a new parameter "signature_target" to "sign". Supports single and
  multisign, but I haven't written tests for multisign yet.
- Skip account validation if this field is set, like multisigning.
- Unit tests demonstrating examples.
2025-08-09 00:55:00 -04:00
Ed Hennis
6778521f12 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-08 18:30:40 -04:00
Ed Hennis
b0f3ef4969 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-08 18:23:37 -04:00
Ed Hennis
c01ef3f155 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-08 18:23:34 -04:00
Ed Hennis
241f22bab7 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-08 18:23:30 -04:00
Ed Hennis
a387a7aadf Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-08 18:23:27 -04:00
Ed Hennis
d5e137de82 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-refactoring-1
* XRPLF/develop:
  Switch Conan 1 commands to Conan 2 and fix credentials (#5655)
  perf: Move mutex to the partition level (#5486)
  Upload Conan dependencies upon merge into develop (#5654)
2025-08-08 11:31:44 -04:00
Ed Hennis
e0cdd65352 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-06 21:08:14 -04:00
Ed Hennis
2c1ccdbc84 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-06 21:03:14 -04:00
Ed Hennis
36204d2ce9 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-06 21:03:10 -04:00
Ed Hennis
4639c1c351 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-06 21:03:07 -04:00
Ed Hennis
c863bd25e0 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-06 21:03:04 -04:00
Ed Hennis
7dcc682e29 Make LoanSet.CounterpartySignature optional in the Tx layout
- Still required for the transaction to succeed (except inside a Batch,
  because the batch signers take care of that).
- Started adding tests for Loan-related RPC and low-level math checks.
  Currently only implemented "sign" on a LoanSet to verify it can be
  done.
2025-08-06 20:48:13 -04:00
Ed Hennis
162875616d Correct more issues related to 0-interest loans and some rounding issues
- Addresses FIND-012 from audit.
- If computePeriodicPaymentParts rounds the principal part to 0, add
  a small amount so that some principal is paid regardless of how
  extreme the loan parameters are. For XRP and MPTs, this just adds 1.
  For IOUs, compute an epsilon based on the scale of the original loan.
  (IOUs untested.)
  - Also move this function out of the detail namespace so direct unit
    tests can be written. (Pending.)
- Adds the testLoanPayComputePeriodicPaymentValidRateInvariant from
  auditors with some minor modifications.
- Fixes an assert that the periodic rate > 0, which won't be true if the
  loan interest rate is 0.
2025-08-06 11:47:42 -04:00
Ed Hennis
9847025099 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  Fix formatting
  fix: Ensures canonical order for `PriceDataSeries` upon `PriceOracle` creation (#5485)
  Add code coverage for STParsedJSON edge cases
  refactor: Decouple ledger from xrpld/app (#5492)
2025-08-05 21:30:31 -04:00
Ed Hennis
bb183ea09a Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-05 21:16:57 -04:00
Ed Hennis
9fd45e7aa7 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-05 21:16:54 -04:00
Ed Hennis
924b05ea9f Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-05 21:16:50 -04:00
Ed Hennis
a0a0916108 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-05 21:16:47 -04:00
Ed Hennis
c78b9aedac Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-08-05 21:16:34 -04:00
Ed Hennis
b07087f10b Fix formatting 2025-08-05 13:20:29 -04:00
Ed Hennis
f89c88dbb8 Add code coverage for STParsedJSON edge cases
- Move several tests from `STObject_test` to new `STParsedJSON_test`
  unchanged.
- Add 3 test cases to cover edge cases for UInt16 values.

Co-authored-by: Denis Angell <dangell@transia.co>
2025-08-05 12:45:05 -04:00
Ed Hennis
0c76153b2c Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-08-04 13:05:06 -04:00
Ed Hennis
70a23bcca3 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-08-04 13:05:02 -04:00
Ed Hennis
a66ef800bc Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-08-04 13:04:59 -04:00
Ed Hennis
5f5f60a024 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-08-04 13:04:55 -04:00
Ed Hennis
d58399d417 Correct handling of LoanBroker.DebtMaximum zero values
- Addresses FIND-003 from audit.
- Behavior changed to treat a DebtMaximum value of 0 to mean "no limit",
  as defined in spec.
- No need to add unit tests, because the previous commit covers 0, and
  tests already exist for non-zero limits.
2025-07-30 18:08:05 -04:00
Ed Hennis
a1e9091f1e Add the "testBatchBypassCounterparty" test from auditors
- (With some minor modifications)
2025-07-30 17:25:58 -04:00
Ed Hennis
84acebeb7f Enforce valid range of LoanSet.InterestRate
- Addresses FIND-002 from audit.
- Enforces a range of 0-100% in 1/10 bips.
- Also add a couple of unit test checks.
2025-07-30 13:56:50 -04:00
Ed Hennis
83ba11d505 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  fix `DeliveredAmount` and `delivered_amount` in transaction metadata for direct MPT transfer (#5569)
2025-07-30 11:07:03 -04:00
Ed Hennis
97469a1c02 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-07-29 20:33:43 -04:00
Ed Hennis
c74dc6baf2 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-07-29 20:33:40 -04:00
Ed Hennis
1d90ae7c25 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-07-29 20:33:36 -04:00
Ed Hennis
39db7381b2 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-07-29 20:33:32 -04:00
Ed Hennis
ec8eaf0d73 fixup! Ensure Counterparty Signatures are properly handled by Batch tx 2025-07-29 20:31:31 -04:00
Ed Hennis
9d1a23a811 Ensure Counterparty Signatures are properly handled by Batch tx
- Addresses FIND-001 from audit
- LoanSet::preflight will require Counterparty to be set (it's normally
  optional) for an inner batch transaction, because the checks are done
  before the LoanBroker object can be accessed.
- Adjust LoanSet::calculateBaseFee to not charge extra if an inner
  transaction.
- Adds a Loan-specific test to Batch_test.
2025-07-29 19:46:01 -04:00
Ed Hennis
421cbb9abd Add the "testBatchBypassCounterparty" test from auditors
- (With some minor modifications)
2025-07-29 19:34:02 -04:00
Ed Hennis
bba9119a75 Fix a couple of errors
- Mark variable only used in asserts as [[maybe_unused]].
- Restore commented out line that I think I resolved wrong in an earlier
  merge to fix Vault tests.
2025-07-29 14:58:36 -04:00
Ed Hennis
6f00f296c8 Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-07-29 12:31:48 -04:00
Ed Hennis
aee4719df4 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-07-29 11:54:30 -04:00
Ed Hennis
5f2402479d Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-07-29 11:54:26 -04:00
Ed Hennis
c3fa4fb71c Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-07-29 11:54:23 -04:00
Ed Hennis
a8d0d763b0 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-07-29 11:54:19 -04:00
Ed Hennis
6310b2544c Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  Build options cleanup (#5581)
  Updates Conan dependencies: Boost 1.86 (#5264)
  VaultWithdraw destination account bugfix (#5572)
2025-07-28 21:10:12 -04:00
Ed Hennis
3c0ef8f8d3 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-07-28 20:57:29 -04:00
Ed Hennis
ebe39e9320 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-07-28 20:57:24 -04:00
Ed Hennis
1b8da176bf Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-07-28 20:57:21 -04:00
Ed Hennis
66dd0de019 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-07-28 20:57:17 -04:00
Ed Hennis
a2be55fbc9 Check LoanBrokerCoverWithdraw Destination and DestinationTag fields
- See also #5572 / e7a7bb8
2025-07-28 19:04:55 -04:00
Ed Hennis
41c24094eb Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66 2025-07-24 17:00:57 -04:00
Ed Hennis
3b446f144f Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-07-24 16:13:47 -04:00
Ed Hennis
760a9aad83 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3
* XRPLF/ximinez/lending-refactoring-2:
  refactor: Update rocksdb (#5568)
  Switch instrumentation workflow to use dependencies (#5607)
  chore: Rename conan profile to `default` (#5599)
  Include `network_id` in validations and subscription stream responses (#5579)
  Add support for `DomainID` in `MPTokenIssuance` transactions (#5509)
  chore: Remove unused code after flow cross retirement (#5575)
  Remove obsolete owner pays fee feature and XRPL_ABANDON stanza (#5550)
  refactor: Makes HashRouter flags more type-safe (#5371)
  Fix clang-format CI job (#5598)
2025-07-24 16:12:48 -04:00
Ed Hennis
c73372297c Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-07-24 15:50:17 -04:00
Ed Hennis
1f331bf8d8 Merge branch 'develop' into ximinez/lending-refactoring-1 2025-07-24 15:50:13 -04:00
Ed Hennis
57c78c56ba fixup! fixup! Fix divide by 0 error on 0-interest loans; allow broker to self-lend 2025-07-24 15:08:18 -04:00
Ed Hennis
1adb410e8e fixup! Fix divide by 0 error on 0-interest loans; allow broker to self-lend 2025-07-24 13:58:05 -04:00
Ed Hennis
6444ad4393 Merge remote-tracking branch 'XRPLF/ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
* XRPLF/ximinez/lending-refactoring-4:
  fixup! Rename Transactor preflight functions
  Rename Transactor preflight functions
  fixup! Make preflight1 and preflight2 private static Transactor functions
  Make preflight1 and preflight2 private static Transactor functions
  Fix formatting
2025-07-23 17:45:51 -04:00
Ed Hennis
1e7462606c Fix divide by 0 error on 0-interest loans; allow broker to self-lend
* Unit tests for self lending
2025-07-23 17:24:53 -04:00
Ed Hennis
68aecfe8a2 Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4 2025-07-22 14:09:47 -04:00
Ed Hennis
8ffe1838d4 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3 2025-07-22 14:09:43 -04:00
Ed Hennis
30becab0b6 Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2 2025-07-22 14:09:40 -04:00
Ed Hennis
e037ae3d3a Merge branch 'develop' into ximinez/lending-refactoring-1 2025-07-22 14:09:37 -04:00
Ed Hennis
2f3c79837e Merge branch 'develop' into ximinez/lending-XLS-66 2025-07-22 14:09:23 -04:00
Ed Hennis
4550d2bfba Fix build error 2025-07-22 14:06:17 -04:00
Ed Hennis
5edaad41af Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4
* ximinez/lending-refactoring-3: (61 commits)
  fixup! Rename Transactor preflight functions
  Rename Transactor preflight functions
  fixup! Make preflight1 and preflight2 private static Transactor functions
  Make preflight1 and preflight2 private static Transactor functions
  Fix formatting
  Remove `include(default)` from libxrpl profile (#5587)
  refactor: Change boost::shared_mutex to std::shared_mutex (#5576)
  Fix macos runner (#5585)
  Remove the type filter from "ledger" RPC command (#4934)
  refactor: Update date, libarchive, nudb, openssl, sqlite3, xxhash packages (#5567)
  test: Run unit tests regardless of 'Supported' amendment status (#5537)
  Retire Flow Cross amendment (#5562)
  chore: Update CI to use Conan 2 (#5556)
  fixAMMClawbackRounding: adjust last holder's LPToken balance (#5513)
  chore: Add gcc-12 workaround (#5554)
  Add MPT related txns into issuer's account history  (#5530)
  chore: Remove unused headers (#5526)
  fix: add allowTrustLineLocking flag for account_info (#5525)
  Downgrade required CMake version for Antithesis SDK (#5548)
  fix: Link with boost libraries explicitly (#5546)
  ...

Co-authored-by: Bronek Kozicki <brok@incorrekt.com>
2025-07-22 13:34:43 -04:00
Ed Hennis
24447969be fixup! Rename Transactor preflight functions 2025-07-22 12:43:54 -04:00
Ed Hennis
c76e485d01 Rename Transactor preflight functions
- Rename Transactor::preflight to invokePreflight.
- Rename doPreflight back to preflight.
- Update instructions.
- With preflight1 & 2 now uncallable, in-flight code in other
  branches should be easier to convert.
2025-07-22 12:11:00 -04:00
Ed Hennis
021bee8dd4 fixup! Make preflight1 and preflight2 private static Transactor functions 2025-07-22 12:10:58 -04:00
Ed Hennis
6c5945f9e8 Make preflight1 and preflight2 private static Transactor functions
- They should never be called by derived classes.
2025-07-21 23:26:29 -04:00
Ed Hennis
96ad348fb0 Merge branch 'ximinez/lending-refactoring-2' into ximinez/lending-refactoring-3
* ximinez/lending-refactoring-2: (57 commits)
  Fix formatting
  Remove `include(default)` from libxrpl profile (#5587)
  refactor: Change boost::shared_mutex to std::shared_mutex (#5576)
  Fix macos runner (#5585)
  Remove the type filter from "ledger" RPC command (#4934)
  refactor: Update date, libarchive, nudb, openssl, sqlite3, xxhash packages (#5567)
  test: Run unit tests regardless of 'Supported' amendment status (#5537)
  Retire Flow Cross amendment (#5562)
  chore: Update CI to use Conan 2 (#5556)
  fixAMMClawbackRounding: adjust last holder's LPToken balance (#5513)
  chore: Add gcc-12 workaround (#5554)
  Add MPT related txns into issuer's account history  (#5530)
  chore: Remove unused headers (#5526)
  fix: add allowTrustLineLocking flag for account_info (#5525)
  Downgrade required CMake version for Antithesis SDK (#5548)
  fix: Link with boost libraries explicitly (#5546)
  chore: Fix compilation error with clang-20 and cleanup (#5543)
  test: Remove circular jtx.h dependencies (#5544)
  Decouple CredentialHelpers from xrpld/app/tx (#5487)
  fix: crash when trace-logging in tests (#5529)
  ...
2025-07-21 23:26:23 -04:00
Ed Hennis
72f33d8f3b Merge branch 'ximinez/lending-refactoring-1' into ximinez/lending-refactoring-2
* ximinez/lending-refactoring-1: (57 commits)
  Fix formatting
  Remove `include(default)` from libxrpl profile (#5587)
  refactor: Change boost::shared_mutex to std::shared_mutex (#5576)
  Fix macos runner (#5585)
  Remove the type filter from "ledger" RPC command (#4934)
  refactor: Update date, libarchive, nudb, openssl, sqlite3, xxhash packages (#5567)
  test: Run unit tests regardless of 'Supported' amendment status (#5537)
  Retire Flow Cross amendment (#5562)
  chore: Update CI to use Conan 2 (#5556)
  fixAMMClawbackRounding: adjust last holder's LPToken balance (#5513)
  chore: Add gcc-12 workaround (#5554)
  Add MPT related txns into issuer's account history  (#5530)
  chore: Remove unused headers (#5526)
  fix: add allowTrustLineLocking flag for account_info (#5525)
  Downgrade required CMake version for Antithesis SDK (#5548)
  fix: Link with boost libraries explicitly (#5546)
  chore: Fix compilation error with clang-20 and cleanup (#5543)
  test: Remove circular jtx.h dependencies (#5544)
  Decouple CredentialHelpers from xrpld/app/tx (#5487)
  fix: crash when trace-logging in tests (#5529)
  ...
2025-07-21 20:48:44 -04:00
Ed Hennis
96f2a65f64 Fix formatting 2025-07-21 20:37:16 -04:00
Ed Hennis
43fe49e756 Merge remote-tracking branch 'upstream/develop' into ximinez/lending-refactoring-1
* upstream/develop: (56 commits)
  Remove `include(default)` from libxrpl profile (#5587)
  refactor: Change boost::shared_mutex to std::shared_mutex (#5576)
  Fix macos runner (#5585)
  Remove the type filter from "ledger" RPC command (#4934)
  refactor: Update date, libarchive, nudb, openssl, sqlite3, xxhash packages (#5567)
  test: Run unit tests regardless of 'Supported' amendment status (#5537)
  Retire Flow Cross amendment (#5562)
  chore: Update CI to use Conan 2 (#5556)
  fixAMMClawbackRounding: adjust last holder's LPToken balance (#5513)
  chore: Add gcc-12 workaround (#5554)
  Add MPT related txns into issuer's account history  (#5530)
  chore: Remove unused headers (#5526)
  fix: add allowTrustLineLocking flag for account_info (#5525)
  Downgrade required CMake version for Antithesis SDK (#5548)
  fix: Link with boost libraries explicitly (#5546)
  chore: Fix compilation error with clang-20 and cleanup (#5543)
  test: Remove circular jtx.h dependencies (#5544)
  Decouple CredentialHelpers from xrpld/app/tx (#5487)
  fix: crash when trace-logging in tests (#5529)
  test: switch some unit tests to doctest (#5383)
  ...
2025-07-21 19:53:20 -04:00
Ed Hennis
e14ca4c438 Merge branch 'develop' into ximinez/lending-XLS-66 2025-07-21 18:20:32 -04:00
Ed Hennis
ed00018adc fixup! Add pseudo account type to injected data in RPC account_info result 2025-07-18 20:42:00 -04:00
Ed Hennis
f7aef49509 Add pseudo account type to injected data in RPC account_info result
- Low hanging fruit
2025-07-18 20:32:07 -04:00
Ed Hennis
e1edd43205 fixup! Fix LoanBrokerCoverClawback tests? 2025-07-18 19:19:08 -04:00
Ed Hennis
03d253ae20 Fix LoanBrokerCoverClawback tests? 2025-07-18 18:58:58 -04:00
Ed Hennis
577b047cc1 Merge branch 'develop' into ximinez/lending-XLS-66 2025-07-18 18:33:00 -04:00
Ed Hennis
c46d894192 Implement LoanBrokerCoverClawback and many test cases
- Not all tests are passing yet
2025-07-17 20:41:55 -04:00
Ed Hennis
e4480569f7 TEMP: Change VaultWithdraw back so tests pass 2025-07-16 18:58:25 -04:00
Ed Hennis
e6e6360c1a Support MPT payments via Payment tx for LBCoverWithdraw.Destination 2025-07-16 18:31:10 -04:00
Ed Hennis
6b4236343a Get CoverWithdraw IOU payments working
- Clean up some of the payment parameters
- Also factor out Payment::makeMPTDirectPayment for future use
2025-07-16 17:41:23 -04:00
Ed Hennis
45abab3a78 Add missing headers 2025-07-16 15:29:59 -04:00
Ed Hennis
4d7492a00d Use new "testable_amendments" function in new tests 2025-07-16 14:03:50 -04:00
Ed Hennis
b83af2d54a Fix formatting 2025-07-16 13:49:23 -04:00
Ed Hennis
10b73525be fixup! Start implementing LoanBrokerCoverWithdraw.Destination field 2025-07-16 12:55:23 -04:00
Ed Hennis
89dbb48860 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  test: Run unit tests regardless of 'Supported' amendment status (#5537)
  Retire Flow Cross amendment (#5562)
2025-07-16 12:53:36 -04:00
Ed Hennis
16854fff1a Merge branch 'develop' into ximinez/lending-XLS-66 2025-07-15 19:36:14 -04:00
Ed Hennis
b34f59eafc Start implementing LoanBrokerCoverWithdraw.Destination field
- Refactor the IOU payment code out of the Payment transactor and use it
  for different destinations. This should enforce all of the trust line
  rules without having to reinvent a dozen wheels.
- TODO: Same for MPTs.
2025-07-15 19:30:58 -04:00
Ed Hennis
38cb371c72 Make requireAuth work more similarly between IOUs and MPTs
- Unfortunately, to not change behavior, a new "Legacy" authorization
  type was created. It acts like "StrongAuth" for MPTs and "WeakAuth"
  for IOUs.
2025-07-15 17:48:14 -04:00
Ed Hennis
5199c5e073 Improve / add freeze checking helper functions
- Add an override of isDeepFrozen that can take an Asset, and thus an
  MPTIssue. The MPT version just calls isFrozen, since they're
  equivalent for MPTs.
- Add wrappers checkFrozen and checkDeepFrozen that return the
  appropriate TER code, so the Asset type doesn't have to be checked
  at every #*%@ing caller.
- Convert the Loan* transactors to use these functions.
2025-07-15 15:32:21 -04:00
Ed Hennis
3ef72d28bd fixup! Make a few tweaks to the changes in 907cc19a 2025-07-15 14:20:44 -04:00
Ed Hennis
06906a8bd3 Refactor the bulk of testLifecycle into a function
- Allows tweaking loan properties
2025-07-14 18:54:48 -04:00
Ed Hennis
0a3c728a96 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-XLS-66
* XRPLF/develop:
  fixAMMClawbackRounding: adjust last holder's LPToken balance (#5513)
  chore: Add gcc-12 workaround (#5554)
  Add MPT related txns into issuer's account history  (#5530)
  chore: Remove unused headers (#5526)
2025-07-11 19:21:03 -04:00
Ed Hennis
37745cb5b2 Rename Transactor preflight functions
- Rename Transactor::preflight to invokePreflight.
- Rename doPreflight back to preflight.
- Update instructions.
- With preflight1 & 2 now uncallable, in-flight code in other
  branches should be easier to convert.
2025-07-11 19:17:11 -04:00
Ed Hennis
269eac9a15 Mark the LendingProtocol amendment as unsupported 2025-07-11 18:55:08 -04:00
Ed Hennis
d82461ea70 Make preflight1 and preflight2 private static Transactor functions
- They should never be called by derived classes.
2025-07-11 18:42:39 -04:00
Ed Hennis
e9d2dfe329 fixup! Make a few tweaks to the changes in merge cc83ea8 2025-07-11 17:14:53 -04:00
Ed Hennis
9d052dc86c Make a few tweaks to the changes in 907cc19a 2025-07-11 17:06:26 -04:00
Ed Hennis
ad5d28bc48 Make a few tweaks to the changes in merge cc83ea8
- Not necessarily wrong, just not how I want it.
- Fixes a build error in LoanBroker_test
- In CreateOffer, fixes a logic error where _no_ offers will work if
  PermissionedDex amendment is enabled, and FlowCross is not
2025-07-11 16:14:10 -04:00
Ed Hennis
2b5a8ebf2f Merge branch 'develop' into ximinez/lending-XLS-66 2025-07-10 12:30:06 -04:00
Ed Hennis
28999a242c Merge branch 'develop' into ximinez/lending-XLS-66 2025-07-03 15:51:14 -04:00
Ed Hennis
186821f971 Merge branch 'develop' into ximinez/lending-XLS-66 2025-07-02 19:04:56 -04:00
Bronek Kozicki
1c8e4c346b Merge branch 'develop' into ximinez/lending-XLS-66 2025-06-27 10:45:37 +01:00
Bronek Kozicki
6bcd037264 Merge branch 'develop' into ximinez/lending-XLS-66 2025-06-23 10:33:05 +01:00
Bronek Kozicki
439e2d4934 Merge branch 'release' into ximinez/lending-XLS-66 2025-06-23 10:04:20 +01:00
Bronek Kozicki
f812774637 Merge branch 'develop' into ximinez/lending-XLS-66 2025-06-10 23:03:43 +08:00
Bronek Kozicki
d82693c2d3 Merge branch 'develop' into ximinez/lending-XLS-66 2025-06-10 21:51:58 +08:00
Bronek Kozicki
907cc19a41 Merge branch 'develop' into ximinez/lending-XLS-66 2025-06-05 13:04:15 +01:00
Bronek Kozicki
cc83ea8eb6 Merge branch 'develop' into ximinez/lending-XLS-66 2025-06-04 19:35:45 +01:00
Ed Hennis
527e0c916f Lending protocol implementation (XLS-0066)
- Add the LendingProtocol amendment
- Add Loan Broker and Loan ledger objects:
- Also add new SFields, Keylet functions, and an Invariant to verify no
  illegal field modification
- Update list of "constant" fields from spec
- Also add a general check for all object types for the type and index
  fields
- refactor: Check transaction flags in preflight0
- Adds a flagMask parameter to preflight1 so that it's impossible to
  forget to check flags.
- Also adds a short hash prefix to all Transactor log messages.
- refactor: Generalize Transactor preflight:
- Derived classes no longer need to explicitly check amendments, nor
  call into preflight1 or preflight2.
- implemeng LoanBrokerSet
- Transactions: LoanDelete, LoanManage, LoanDraw, LoanPay
- LoanBrokerSet creation mostly done. Need update.
- Also added a lookup table for pseudo account fields.
- Update changed field name.
- Modify modifiable fields in an update. Note there are only two.
- Add a node field to dirLink, defaulting sfOwnerNode, so other
  relationships can be updated.
- Create some helper classes for transaction fields
- Test that they work by converting some of the existing classes
- Finish creating helper classes for JTx fields
- Also change the pseudo account field lookup to a function that uses
  a switch
- Update tests, update pseudo-account checking
- Generalize some of the Invariant checks using macro files
  - Valid ledger entry type
  - Valid new account root and pseudo account check
- Enumerate transaction privileges for invariants
  - Allows them to be defined in transactions.macro instead of needing to
    scrutinize every existing Invariant class.
  - List is not necessarily comprehensive, but does cover every check
    where more than one transaction type is involved.
- Reserve a few values between Vault and Lending for future use
- Pseudo-account improvements
  - Define pseudo-account fields with an sfield flag
  - Pseudo-account invariant checks rules whenever a pseudo-account is
    created or modified.
- Move some helper functions.
- Check the regular key in the pseudo-transaction invariant check.
- Transactor::checkSign will always fail for a pseudo-account, so even
  if someone figures out how to get a good signature, it won't work.
- Fix account creation to check both amendments
- Add a validity range for sfDebtMaximum
- Change more "failed" messages. The goal here is to be able to search
  the log for "failed" and ONLY get test failures.
- NoModifiedUnmodifiableFields and ValidPseudoAccounts
- Move the Invariants_test class into the test namespace
- Clang wants an explicit ctor to emplace in a vector
- Refactor: Add a Transactor base function to make it easier to get the
  owner reserve increment as a fee.
- Refactor: Add an overload jtx::fee(increment) to pay an owner reserve.
- Initial implementation of LoanBrokerDelete
- Generalize the LoanBroker lifecycle test
- Refactor ApplyView::dirAdd to give access to low-level operations
  - Takes a page from #5362, which may turn out to be useful!
- Start writing Loan Broker invariants and tests
  - Specifically those mentioned for LoanBrokerDelete
- Move all detail namespaces to be under ripple
  - Avoids problems with namespace collisions / ambiguous symbol issues
    with unity builds, especially when adding or removing files.
- Add LoanBrokerCoverDeposit transaction
- Add LoanBrokerCoverWithdraw transaction
- Start writing tests for LoanBrokerCover*
- Add support for `Asset` and `MPTIssue` to some `jtx` helper classes
  and functions (`balance`, `expectLine`)
- Add support for pseudo-accounts to `jtx::Account` by allowing directly
  setting the AccountID without a matching key.
- Add Asset and MPTIssue support to more jtx objects / functions
  - Unfortunately, to work around some ambiguous symbol compilation
    errors, I had to change the implicit conversion from IOU to Asset to
    a conversion from IOU to PrettyAsset, and add a more explicit
    `asset()` function. This workaround only required changing two
    existing tests, so seems acceptable.
- Ensure that an account is not deleted with an XRP balance
  - Updates the AccountRootsDeletedClean invariant
- Finish up the Loan Broker tests
- Move inclusion of Transactor headers to transactions.macro
  - Only need to update in one place when adding a new transaction.
- Start implementing LoanSet transactor
  - Add some more values and functions to make it easier to work with
    basis point values / bips.
  - Fix several earlier mistakes.
- Generalize the check*Sign functions to support CounterParty
  - checkSign, checkSingleSign, and checkMultiSign in STTx and Transactor
- Start writing Loan tests
  - Required adding support for counterparty signature to jtx framework:
    arbitrary signature field destination, multiple signer callbacks
- Get Counterparty signing working
- Add more LoanSet unit tests, added LoanBroker LoanSequence field
  - LoanSequence will prevent loan key collisions
- Change Loan object indexing, fix several broken LoanSet unit tests
  - Loan objects will now only be indexed by LoanBrokerID and
    LoanSequence, which is a new field in LoanBroker. Also changes
    Loan.Sequence to Loan.LoanSequence to match up.
  - Several tests weren't working because of `PrettyAsset` scaling. Also,
    `PrettyAsset` calculations could overflow. Made that less likely by
    changing the type of `scale_`.
  - LoanSet will fail if an account tries to loan to itself.
- Ensure that an account is not deleted with a non-zero owner count
  - Updates the AccountRootsDeletedClean invariant
- Add unit tests to create a Loan successfully
  - Fix a few field initializations in LoanSet
- Refactor issuance validity check in VaultCreate
  - Utility function: canAddHolding
  - Call canAddHolding from any transactor that call addEmptyHolding
    (LoanBrokerSet, LoanSet)
- Start implementing LoanManage transaction
  - Also add a ValidLoan invariant
- Finish `LoanManage` functionality and tests, modulo LoanDraw/Pay
- Allow existing trust lines to loan brokers to be managed (by issuer)
- Implement LoanDelete, and fix a bunch of math errors in LoanManage
- Update to match latest spec: compute interest, LoanBroker reserves
- refactor: Define getFlagsMask in the base Transactor class
  - Returns tfUniversalMask for most transactors
  - Only transactors that use other flags need to override
- Implement LoanDraw, and made good progress on related tests
- Start implementing LoanPay transaction
- Implement LoanPay & most tests
- Also add an XRPL_ASSERT_PARTS, which splits the parts of the assert message
    so I don't have to remember the proper formatting.
Start writing LoanPay transaction tests
2025-05-21 11:39:55 +01:00
Ed Hennis
fb5d94bbef Refactor 4: Transactor extra signing support 2025-05-21 11:39:37 +01:00
Ed Hennis
4fe3ec8a08 Refactor 3: Transactors 2025-05-21 11:39:35 +01:00
Ed Hennis
937b67cbc0 Refactor 2: STParsed Json 2025-05-21 11:39:34 +01:00
Ed Hennis
4e50087612 Refactoring 1 2025-05-21 11:39:26 +01:00
1267 changed files with 22017 additions and 4579 deletions

View File

@@ -26,11 +26,6 @@ run from the repository root.
references to `ripple` and `rippled` (with or without capital letters) to
`xrpl` and `xrpld`, respectively. The name of the binary will remain as-is,
and will only be renamed to `xrpld` by a later script.
4. `.github/scripts/rename/binary.sh`: This script will rename the binary from
`rippled` to `xrpld`, and reverses the symlink so that `rippled` points to
the `xrpld` binary.
5. `.github/scripts/rename/namespace.sh`: This script will rename the C++
namespaces from `ripple` to `xrpl`.
You can run all these scripts from the repository root as follows:
@@ -38,6 +33,4 @@ You can run all these scripts from the repository root as follows:
./.github/scripts/rename/definitions.sh .
./.github/scripts/rename/copyright.sh .
./.github/scripts/rename/cmake.sh .
./.github/scripts/rename/binary.sh .
./.github/scripts/rename/namespace.sh .
```

View File

@@ -1,42 +0,0 @@
#!/bin/bash
# Exit the script as soon as an error occurs.
set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script changes the binary name from `rippled` to `xrpld`, and reverses
# the symlink that currently points from `xrpld` to `rippled` so that it points
# from `rippled` to `xrpld` instead.
# Usage: .github/scripts/rename/binary.sh <repository directory>
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <repository directory>"
exit 1
fi
DIRECTORY=$1
echo "Processing directory: ${DIRECTORY}"
if [ ! -d "${DIRECTORY}" ]; then
echo "Error: Directory '${DIRECTORY}' does not exist."
exit 1
fi
pushd ${DIRECTORY}
# Remove the binary name override added by the cmake.sh script.
${SED_COMMAND} -z -i -E 's@\s+# For the time being.+"rippled"\)@@' cmake/XrplCore.cmake
# Reverse the symlink.
${SED_COMMAND} -i -E 's@create_symbolic_link\(rippled@create_symbolic_link(xrpld@' cmake/XrplInstall.cmake
${SED_COMMAND} -i -E 's@/xrpld\$\{suffix\}@/rippled${suffix}@' cmake/XrplInstall.cmake
popd
echo "Processing complete."

View File

@@ -1,54 +0,0 @@
#!/bin/bash
# Exit the script as soon as an error occurs.
set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames the `ripple` namespace to `xrpl` in this project.
# Specifically, it renames all occurrences of `namespace ripple` and `ripple::`
# to `namespace xrpl` and `xrpl::`, respectively, by scanning all header and
# source files in the specified directory and its subdirectories, as well as any
# occurrences in the documentation.
# Usage: .github/scripts/rename/namespace.sh <repository directory>
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <repository directory>"
exit 1
fi
DIRECTORY=$1
echo "Processing directory: ${DIRECTORY}"
if [ ! -d "${DIRECTORY}" ]; then
echo "Error: Directory '${DIRECTORY}' does not exist."
exit 1
fi
pushd ${DIRECTORY}
DIRECTORIES=("include" "src" "tests")
for DIRECTORY in "${DIRECTORIES[@]}"; do
echo "Processing directory: ${DIRECTORY}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i 's/namespace ripple/namespace xrpl/g' "${FILE}"
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
done
done
DIRECTORY=$1
find "${DIRECTORY}" -type f -name "*.md" | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
done
popd
echo "Renaming complete."

View File

@@ -129,14 +129,14 @@ jobs:
--parallel "${BUILD_NPROC}" \
--target "${CMAKE_TARGET}"
- name: Upload the binary (Linux)
- name: Upload rippled artifact (Linux)
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
env:
BUILD_DIR: ${{ inputs.build_dir }}
with:
name: xrpld-${{ inputs.config_name }}
path: ${{ env.BUILD_DIR }}/xrpld
name: rippled-${{ inputs.config_name }}
path: ${{ env.BUILD_DIR }}/rippled
retention-days: 3
if-no-files-found: error
@@ -144,8 +144,8 @@ jobs:
if: ${{ runner.os == 'Linux' }}
working-directory: ${{ inputs.build_dir }}
run: |
ldd ./xrpld
if [ "$(ldd ./xrpld | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
ldd ./rippled
if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
echo 'The binary is statically linked.'
else
echo 'The binary is dynamically linked.'
@@ -156,7 +156,7 @@ jobs:
if: ${{ runner.os == 'Linux' && env.ENABLED_VOIDSTAR == 'true' }}
working-directory: ${{ inputs.build_dir }}
run: |
./xrpld --version | grep libvoidstar
./rippled --version | grep libvoidstar
- name: Run the separate tests
if: ${{ !inputs.build_only }}
@@ -177,7 +177,7 @@ jobs:
env:
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
run: |
./xrpld --unittest --unittest-jobs "${BUILD_NPROC}"
./rippled --unittest --unittest-jobs "${BUILD_NPROC}"
- name: Debug failure (Linux)
if: ${{ failure() && runner.os == 'Linux' && !inputs.build_only }}

View File

@@ -25,7 +25,7 @@ jobs:
env:
MESSAGE: |
The dependency relationships between the modules in xrpld have
The dependency relationships between the modules in rippled have
changed, which may be an improvement or a regression.
A rule of thumb is that if your changes caused something to be

View File

@@ -25,10 +25,6 @@ jobs:
run: .github/scripts/rename/copyright.sh .
- name: Check CMake configs
run: .github/scripts/rename/cmake.sh .
- name: Check binary name
run: .github/scripts/rename/binary.sh .
- name: Check namespaces
run: .github/scripts/rename/namespace.sh .
- name: Check for differences
env:
MESSAGE: |

View File

@@ -299,7 +299,7 @@ For this reason:
- Example **bad** name
`"RFC1751::insert(char* s, int x, int start, int length) : length is greater than or equal zero"`
(missing namespace, unnecessary full function signature, description too verbose).
Good name: `"xrpl::RFC1751::insert : minimum length"`.
Good name: `"ripple::RFC1751::insert : minimum length"`.
- In **few** well-justified cases a non-standard name can be used, in which case a
comment should be placed to explain the rationale (example in `contract.cpp`)
- Do **not** rename a contract without a good reason (e.g. the name no longer

View File

@@ -223,4 +223,6 @@ if(xrpld)
src/test/ledger/Invariants_test.cpp
PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
endif()
# For the time being, we will keep the name of the binary as it was.
set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled")
endif()

View File

@@ -67,8 +67,8 @@ if (is_root_project AND TARGET xrpld)
install(CODE "
set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
include(create_symbolic_link)
create_symbolic_link(xrpld${suffix} \
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/rippled${suffix})
create_symbolic_link(rippled${suffix} \
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/xrpld${suffix})
")
endif ()

View File

@@ -3,7 +3,7 @@
#include <boost/filesystem.hpp>
namespace xrpl {
namespace ripple {
/** Extract a tar archive compressed with lz4
@@ -17,6 +17,6 @@ extractTarLz4(
boost::filesystem::path const& src,
boost::filesystem::path const& dst);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -12,7 +12,7 @@
#include <unordered_map>
#include <vector>
namespace xrpl {
namespace ripple {
using IniFileSections =
std::unordered_map<std::string, std::vector<std::string>>;
@@ -380,6 +380,6 @@ get_if_exists<bool>(Section const& section, std::string const& name, bool& v)
return stat;
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,13 +3,13 @@
#include <vector>
namespace xrpl {
namespace ripple {
/** Storage for linear binary data.
Blocks of binary data appear often in various idioms and structures.
*/
using Blob = std::vector<unsigned char>;
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -8,7 +8,7 @@
#include <cstring>
#include <memory>
namespace xrpl {
namespace ripple {
/** Like std::vector<char> but better.
Meets the requirements of BufferFactory.
@@ -96,7 +96,7 @@ public:
XRPL_ASSERT(
s.size() == 0 || size_ == 0 || s.data() < p_.get() ||
s.data() >= p_.get() + size_,
"xrpl::Buffer::operator=(Slice) : input not a subset");
"ripple::Buffer::operator=(Slice) : input not a subset");
if (auto p = alloc(s.size()))
std::memcpy(p, s.data(), s.size());
@@ -215,6 +215,6 @@ operator!=(Buffer const& lhs, Buffer const& rhs) noexcept
return !(lhs == rhs);
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -1,7 +1,7 @@
#ifndef XRPL_BASICS_BYTEUTILITIES_H_INCLUDED
#define XRPL_BASICS_BYTEUTILITIES_H_INCLUDED
namespace xrpl {
namespace ripple {
template <class T>
constexpr auto
@@ -19,6 +19,6 @@ megabytes(T value) noexcept
static_assert(kilobytes(2) == 2048, "kilobytes(2) == 2048");
static_assert(megabytes(3) == 3145728, "megabytes(3) == 3145728");
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -10,7 +10,7 @@
#include <stdexcept>
#include <vector>
namespace xrpl {
namespace ripple {
namespace compression_algorithms {
@@ -144,6 +144,6 @@ lz4Decompress(
} // namespace compression_algorithms
} // namespace xrpl
} // namespace ripple
#endif // XRPL_COMPRESSIONALGORITHMS_H_INCLUDED

View File

@@ -8,7 +8,7 @@
#include <utility>
#include <vector>
namespace xrpl {
namespace ripple {
/** Manages all counted object types. */
class CountedObjects
@@ -133,6 +133,6 @@ public:
}
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,7 +4,7 @@
#include <chrono>
#include <cmath>
namespace xrpl {
namespace ripple {
/** Sampling function using exponential decay to provide a continuous value.
@tparam The number of seconds in the decay window.
@@ -131,6 +131,6 @@ private:
time_point when_;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -7,7 +7,7 @@
#include <stdexcept>
namespace xrpl {
namespace ripple {
/** Expected is an approximation of std::expected (hoped for in C++23)
@@ -232,6 +232,6 @@ public:
}
};
} // namespace xrpl
} // namespace ripple
#endif // XRPL_BASICS_EXPECTED_H_INCLUDED

View File

@@ -6,7 +6,7 @@
#include <optional>
namespace xrpl {
namespace ripple {
std::string
getFileContents(
@@ -20,6 +20,6 @@ writeFileContents(
boost::filesystem::path const& destPath,
std::string const& contents);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <type_traits>
#include <utility>
namespace xrpl {
namespace ripple {
//------------------------------------------------------------------------------
@@ -492,5 +492,5 @@ dynamic_pointer_cast(TT const& v)
return SharedPtr<T>(DynamicCastTagSharedIntrusive{}, v);
}
} // namespace intr_ptr
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <utility>
namespace xrpl {
namespace ripple {
template <class T>
template <CAdoptTag TAdoptTag>
@@ -608,7 +608,7 @@ SharedWeakUnion<T>::convertToStrong()
[[maybe_unused]] auto action = p->releaseWeakRef();
XRPL_ASSERT(
(action == ReleaseWeakRefAction::noop),
"xrpl::SharedWeakUnion::convertToStrong : "
"ripple::SharedWeakUnion::convertToStrong : "
"action is noop");
unsafeSetRawPtr(p, RefStrength::strong);
return true;
@@ -637,7 +637,7 @@ SharedWeakUnion<T>::convertToWeak()
// We just added a weak ref. How could we destroy?
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::SharedWeakUnion::convertToWeak : destroying freshly "
"ripple::SharedWeakUnion::convertToWeak : destroying freshly "
"added ref");
delete p;
unsafeSetRawPtr(nullptr);
@@ -719,5 +719,5 @@ SharedWeakUnion<T>::unsafeReleaseNoStore()
}
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <atomic>
#include <cstdint>
namespace xrpl {
namespace ripple {
/** Action to perform when releasing a strong pointer.
@@ -34,7 +34,7 @@ enum class ReleaseWeakRefAction { noop, destroy };
/** Implement the strong count, weak count, and bit flags for an intrusive
pointer.
A class can satisfy the requirements of a xrpl::IntrusivePointer by
A class can satisfy the requirements of a ripple::IntrusivePointer by
inheriting from this class.
*/
struct IntrusiveRefCounts
@@ -257,7 +257,7 @@ IntrusiveRefCounts::releaseStrongRef() const
RefCountPair const prevVal{prevIntVal};
XRPL_ASSERT(
(prevVal.strong >= strongDelta),
"xrpl::IntrusiveRefCounts::releaseStrongRef : previous ref "
"ripple::IntrusiveRefCounts::releaseStrongRef : previous ref "
"higher than new");
auto nextIntVal = prevIntVal - strongDelta;
ReleaseStrongRefAction action = noop;
@@ -282,7 +282,7 @@ IntrusiveRefCounts::releaseStrongRef() const
// twice.
XRPL_ASSERT(
(action == noop) || !(prevIntVal & partialDestroyStartedMask),
"xrpl::IntrusiveRefCounts::releaseStrongRef : not in partial "
"ripple::IntrusiveRefCounts::releaseStrongRef : not in partial "
"destroy");
return action;
}
@@ -314,7 +314,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
// can't happen twice.
XRPL_ASSERT(
(!prevVal.partialDestroyStartedBit),
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not in "
"ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not in "
"partial destroy");
auto nextIntVal = prevIntVal + delta;
@@ -336,7 +336,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
{
XRPL_ASSERT(
(!(prevIntVal & partialDestroyStartedMask)),
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not "
"ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not "
"started partial destroy");
return action;
}
@@ -408,11 +408,11 @@ inline IntrusiveRefCounts::~IntrusiveRefCounts() noexcept
auto v = refCounts.load(std::memory_order_acquire);
XRPL_ASSERT(
(!(v & valueMask)),
"xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
"ripple::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
auto t = v & tagMask;
XRPL_ASSERT(
(!t || t == tagMask),
"xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
"ripple::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
#endif
}
@@ -427,7 +427,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair(
{
XRPL_ASSERT(
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
"xrpl::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside "
"ripple::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside "
"range");
}
@@ -438,7 +438,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair(
{
XRPL_ASSERT(
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
"xrpl::IntrusiveRefCounts::RefCountPair(CountType, CountType) : "
"ripple::IntrusiveRefCounts::RefCountPair(CountType, CountType) : "
"inputs inside range");
}
@@ -447,7 +447,7 @@ IntrusiveRefCounts::RefCountPair::combinedValue() const noexcept
{
XRPL_ASSERT(
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
"xrpl::IntrusiveRefCounts::RefCountPair::combinedValue : inputs "
"ripple::IntrusiveRefCounts::RefCountPair::combinedValue : inputs "
"inside range");
return (static_cast<IntrusiveRefCounts::FieldType>(weak)
<< IntrusiveRefCounts::StrongCountNumBits) |
@@ -465,7 +465,7 @@ partialDestructorFinished(T** o)
XRPL_ASSERT(
(!p.partialDestroyFinishedBit && p.partialDestroyStartedBit &&
!p.strong),
"xrpl::partialDestructorFinished : not a weak ref");
"ripple::partialDestructorFinished : not a weak ref");
if (!p.weak)
{
// There was a weak count before the partial destructor ran (or we would
@@ -479,5 +479,5 @@ partialDestructorFinished(T** o)
}
//------------------------------------------------------------------------------
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,10 +4,10 @@
#include <xrpl/basics/TaggedCache.h>
#include <xrpl/basics/base_uint.h>
namespace xrpl {
namespace ripple {
using KeyCache = TaggedCache<uint256, int, true>;
} // namespace xrpl
} // namespace ripple
#endif // XRPL_BASICS_KEYCACHE_H

View File

@@ -6,7 +6,7 @@
#include <memory>
#include <unordered_map>
namespace xrpl {
namespace ripple {
namespace detail {
@@ -109,6 +109,6 @@ LocalValue<T>::operator*()
.emplace(this, std::make_unique<detail::LocalValues::Value<T>>(t_))
.first->second->get());
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -13,7 +13,7 @@
#include <mutex>
#include <utility>
namespace xrpl {
namespace ripple {
// DEPRECATED use beast::severities::Severity instead
enum LogSeverity {
@@ -271,6 +271,6 @@ setDebugLogSink(std::unique_ptr<beast::Journal::Sink> sink);
beast::Journal
debugLog();
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <cassert>
#include <cstddef>
namespace xrpl {
namespace ripple {
/** Calculate one number divided by another number in percentage.
* The result is rounded up to the next integer, and capped in the range [0,100]
@@ -44,6 +44,6 @@ static_assert(calculatePercent(50'000'000, 100'000'000) == 50);
static_assert(calculatePercent(50'000'001, 100'000'000) == 51);
static_assert(calculatePercent(99'999'999, 100'000'000) == 100);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,13 +6,22 @@
#include <ostream>
#include <string>
namespace xrpl {
namespace ripple {
class Number;
std::string
to_string(Number const& amount);
template <typename T>
constexpr bool
isPowerOfTen(T value)
{
while (value >= 10 && value % 10 == 0)
value /= 10;
return value == 1;
}
class Number
{
using rep = std::int64_t;
@@ -22,7 +31,9 @@ class Number
public:
// The range for the mantissa when normalized
constexpr static std::int64_t minMantissa = 1'000'000'000'000'000LL;
constexpr static std::int64_t maxMantissa = 9'999'999'999'999'999LL;
static_assert(isPowerOfTen(minMantissa));
constexpr static std::int64_t maxMantissa = minMantissa * 10 - 1;
static_assert(maxMantissa == 9'999'999'999'999'999LL);
// The range for the exponent when normalized
constexpr static int minExponent = -32768;
@@ -132,22 +143,7 @@ public:
}
Number
truncate() const noexcept
{
if (exponent_ >= 0 || mantissa_ == 0)
return *this;
Number ret = *this;
while (ret.exponent_ < 0 && ret.mantissa_ != 0)
{
ret.exponent_ += 1;
ret.mantissa_ /= rep(10);
}
// We are guaranteed that normalize() will never throw an exception
// because exponent is either negative or zero at this point.
ret.normalize();
return ret;
}
truncate() const noexcept;
friend constexpr bool
operator>(Number const& x, Number const& y) noexcept
@@ -192,6 +188,8 @@ private:
class Guard;
};
constexpr static Number numZero{};
inline constexpr Number::Number(rep mantissa, int exponent, unchecked) noexcept
: mantissa_{mantissa}, exponent_{exponent}
{
@@ -404,6 +402,6 @@ public:
operator=(NumberRoundModeGuard const&) = delete;
};
} // namespace xrpl
} // namespace ripple
#endif // XRPL_BASICS_NUMBER_H_INCLUDED

View File

@@ -21,11 +21,11 @@ ripple/basic should contain no dependencies on other modules.
- `std::set`
- For sorted containers.
- `xrpl::hash_set`
- `ripple::hash_set`
- Where inserts and contains need to be O(1).
- For "small" sets, `std::set` might be faster and smaller.
- `xrpl::hardened_hash_set`
- `ripple::hardened_hash_set`
- For data sets where the key could be manipulated by an attacker
in an attempt to mount an algorithmic complexity attack: see
http://en.wikipedia.org/wiki/Algorithmic_complexity_attack
@@ -33,5 +33,5 @@ ripple/basic should contain no dependencies on other modules.
The following container is deprecated
- `std::unordered_set`
- Use `xrpl::hash_set` instead, which uses a better hashing algorithm.
- Or use `xrpl::hardened_hash_set` to prevent algorithmic complexity attacks.
- Use `ripple::hash_set` instead, which uses a better hashing algorithm.
- Or use `ripple::hardened_hash_set` to prevent algorithmic complexity attacks.

View File

@@ -11,7 +11,7 @@
#include <string>
#include <vector>
namespace xrpl {
namespace ripple {
/** A closed interval over the domain T.
@@ -85,7 +85,7 @@ to_string(RangeSet<T> const& rs)
std::string s;
for (auto const& interval : rs)
s += xrpl::to_string(interval) + ",";
s += ripple::to_string(interval) + ",";
s.pop_back();
return s;
@@ -172,6 +172,6 @@ prevMissing(RangeSet<T> const& rs, T t, T minVal = 0)
return boost::icl::last(tgt);
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <functional>
#include <vector>
namespace xrpl {
namespace ripple {
class Resolver
{
@@ -47,6 +47,6 @@ public:
/** @} */
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <boost/asio/io_context.hpp>
namespace xrpl {
namespace ripple {
class ResolverAsio : public Resolver
{
@@ -17,6 +17,6 @@ public:
New(boost::asio::io_context&, beast::Journal);
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <ostream>
namespace xrpl {
namespace ripple {
// A SHAMapHash is the hash of a node in a SHAMap, and also the
// type of the hash of the entire SHAMap.
@@ -97,6 +97,6 @@ extract(SHAMapHash const& key)
return *reinterpret_cast<std::size_t const*>(key.as_uint256().data());
}
} // namespace xrpl
} // namespace ripple
#endif // XRPL_BASICS_SHAMAP_HASH_H_INCLUDED

View File

@@ -4,7 +4,7 @@
#include <memory>
#include <variant>
namespace xrpl {
namespace ripple {
/** A combination of a std::shared_ptr and a std::weak_pointer.
@@ -112,5 +112,5 @@ public:
private:
std::variant<std::shared_ptr<T>, std::weak_ptr<T>> combo_;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,7 +3,7 @@
#include <xrpl/basics/SharedWeakCachePointer.h>
namespace xrpl {
namespace ripple {
template <class T>
SharedWeakCachePointer<T>::SharedWeakCachePointer(
SharedWeakCachePointer const& rhs) = default;
@@ -169,5 +169,5 @@ SharedWeakCachePointer<T>::convertToWeak()
return false;
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -22,7 +22,7 @@
#include <sys/mman.h>
#endif
namespace xrpl {
namespace ripple {
template <typename Type>
class SlabAllocator
@@ -128,7 +128,7 @@ class SlabAllocator
{
XRPL_ASSERT(
own(ptr),
"xrpl::SlabAllocator::SlabBlock::deallocate : own input");
"ripple::SlabAllocator::SlabBlock::deallocate : own input");
std::lock_guard l(m_);
@@ -173,7 +173,7 @@ public:
{
XRPL_ASSERT(
(itemAlignment_ & (itemAlignment_ - 1)) == 0,
"xrpl::SlabAllocator::SlabAllocator : valid alignment");
"ripple::SlabAllocator::SlabAllocator : valid alignment");
}
SlabAllocator(SlabAllocator const& other) = delete;
@@ -285,7 +285,7 @@ public:
{
XRPL_ASSERT(
ptr,
"xrpl::SlabAllocator::SlabAllocator::deallocate : non-null "
"ripple::SlabAllocator::SlabAllocator::deallocate : non-null "
"input");
for (auto slab = slabs_.load(); slab != nullptr; slab = slab->next_)
@@ -419,6 +419,6 @@ public:
}
};
} // namespace xrpl
} // namespace ripple
#endif // XRPL_BASICS_SLABALLOCATOR_H_INCLUDED

View File

@@ -15,7 +15,7 @@
#include <type_traits>
#include <vector>
namespace xrpl {
namespace ripple {
/** An immutable linear range of bytes.
@@ -87,7 +87,7 @@ public:
{
XRPL_ASSERT(
i < size_,
"xrpl::Slice::operator[](std::size_t) const : valid input");
"ripple::Slice::operator[](std::size_t) const : valid input");
return data_[i];
}
@@ -243,6 +243,6 @@ makeSlice(std::basic_string<char, Traits, Alloc> const& s)
return Slice(s.data(), s.size());
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -12,7 +12,7 @@
#include <optional>
#include <string>
namespace xrpl {
namespace ripple {
/** Format arbitrary binary data as an SQLite "blob literal".
@@ -132,6 +132,6 @@ to_uint64(std::string const& s);
bool
isProperlyFormedTomlDomain(std::string_view domain);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -16,7 +16,7 @@
#include <type_traits>
#include <vector>
namespace xrpl {
namespace ripple {
/** Map/cache combination.
This class implements a cache and a map. The cache keeps objects alive
@@ -315,6 +315,6 @@ private:
std::uint64_t m_misses;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/basics/IntrusivePointer.ipp>
#include <xrpl/basics/TaggedCache.h>
namespace xrpl {
namespace ripple {
template <
class Key,
@@ -1005,6 +1005,6 @@ TaggedCache<
});
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,7 +4,7 @@
#include <string>
#include <type_traits>
namespace xrpl {
namespace ripple {
/** to_string() generalizes std::to_string to handle bools, chars, and strings.
@@ -43,6 +43,6 @@ to_string(char const* s)
return s;
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -22,7 +22,7 @@
* what container it is.
*/
namespace xrpl {
namespace ripple {
// hash containers
@@ -102,6 +102,6 @@ template <
using hardened_hash_multiset =
std::unordered_multiset<Value, Hash, Pred, Allocator>;
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <ratio>
#include <thread>
namespace xrpl {
namespace ripple {
/** Tracks program uptime to seconds precision.
@@ -45,6 +45,6 @@ private:
start_clock();
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,7 +3,7 @@
#include <utility>
namespace xrpl {
namespace ripple {
// Requires: [first1, last1) and [first2, last2) are ordered ranges according to
// comp.
@@ -95,6 +95,6 @@ remove_if_intersect_or_match(
return first1;
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -38,7 +38,7 @@
#include <cstdint>
#include <string>
namespace xrpl {
namespace ripple {
std::string
base64_encode(std::uint8_t const* data, std::size_t len);
@@ -53,6 +53,6 @@ base64_encode(std::string const& s)
std::string
base64_decode(std::string_view data);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -23,7 +23,7 @@
#include <cstring>
#include <type_traits>
namespace xrpl {
namespace ripple {
namespace detail {
@@ -275,7 +275,7 @@ public:
{
XRPL_ASSERT(
c.size() * sizeof(typename Container::value_type) == size(),
"xrpl::base_uint::base_uint(Container auto) : input size match");
"ripple::base_uint::base_uint(Container auto) : input size match");
std::memcpy(data_.data(), c.data(), size());
}
@@ -288,7 +288,7 @@ public:
{
XRPL_ASSERT(
c.size() * sizeof(typename Container::value_type) == size(),
"xrpl::base_uint::operator=(Container auto) : input size match");
"ripple::base_uint::operator=(Container auto) : input size match");
std::memcpy(data_.data(), c.data(), size());
return *this;
}
@@ -648,12 +648,12 @@ static_assert(sizeof(uint192) == 192 / 8, "There should be no padding bytes");
static_assert(sizeof(uint256) == 256 / 8, "There should be no padding bytes");
#endif
} // namespace xrpl
} // namespace ripple
namespace beast {
template <std::size_t Bits, class Tag>
struct is_uniquely_represented<xrpl::base_uint<Bits, Tag>>
struct is_uniquely_represented<ripple::base_uint<Bits, Tag>>
: public std::true_type
{
explicit is_uniquely_represented() = default;

View File

@@ -12,7 +12,7 @@
#include <ratio>
#include <string>
namespace xrpl {
namespace ripple {
// A few handy aliases
@@ -104,6 +104,6 @@ stopwatch()
return beast::get_abstract_clock<Facade, Clock>();
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,7 +3,7 @@
#include <functional>
namespace xrpl {
namespace ripple {
#ifdef _MSC_VER
@@ -52,6 +52,6 @@ using equal_to = std::equal_to<T>;
#endif
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -7,7 +7,7 @@
#include <string>
#include <utility>
namespace xrpl {
namespace ripple {
/* Programming By Contract
@@ -52,6 +52,6 @@ Throw(Args&&... args)
[[noreturn]] void
LogicError(std::string const& how) noexcept;
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -9,7 +9,7 @@
#include <random>
#include <utility>
namespace xrpl {
namespace ripple {
namespace detail {
@@ -92,6 +92,6 @@ public:
}
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,7 +3,7 @@
#include <string>
namespace xrpl {
namespace ripple {
template <class Stream, class Iter>
Stream&
@@ -85,6 +85,6 @@ public:
}
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <string>
namespace xrpl {
namespace ripple {
/** Create a self-signed SSL context that allows anonymous Diffie Hellman. */
std::shared_ptr<boost::asio::ssl::context>
@@ -19,6 +19,6 @@ make_SSLContextAuthed(
std::string const& chainFile,
std::string const& cipherList);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <limits>
#include <optional>
namespace xrpl {
namespace ripple {
auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();
/** Return value*mul/div accurately.
@@ -21,6 +21,6 @@ auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();
std::optional<std::uint64_t>
mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -12,7 +12,7 @@
#include <utility>
#include <vector>
namespace xrpl {
namespace ripple {
template <typename Key>
static std::size_t
@@ -242,7 +242,7 @@ public:
map_.resize(partitions_);
XRPL_ASSERT(
partitions_,
"xrpl::partitioned_unordered_map::partitioned_unordered_map : "
"ripple::partitioned_unordered_map::partitioned_unordered_map : "
"nonzero partitions");
}
@@ -401,6 +401,6 @@ private:
mutable partition_map_type map_{};
};
} // namespace xrpl
} // namespace ripple
#endif // XRPL_BASICS_PARTITIONED_UNORDERED_MAP_H

View File

@@ -11,7 +11,7 @@
#include <random>
#include <type_traits>
namespace xrpl {
namespace ripple {
#ifndef __INTELLISENSE__
static_assert(
@@ -95,7 +95,7 @@ std::enable_if_t<
Integral>
rand_int(Engine& engine, Integral min, Integral max)
{
XRPL_ASSERT(max > min, "xrpl::rand_int : max over min inputs");
XRPL_ASSERT(max > min, "ripple::rand_int : max over min inputs");
// This should have no state and constructing it should
// be very cheap. If that turns out not to be the case
@@ -186,6 +186,6 @@ rand_bool()
}
/** @} */
} // namespace xrpl
} // namespace ripple
#endif // XRPL_BASICS_RANDOM_H_INCLUDED

View File

@@ -3,7 +3,7 @@
#include <type_traits>
namespace xrpl {
namespace ripple {
// safe_cast adds compile-time checks to a static_cast to ensure that
// the destination can hold all values of the source. This is particularly
@@ -80,6 +80,6 @@ inline constexpr std::
return unsafe_cast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -8,7 +8,7 @@
#include <type_traits>
#include <utility>
namespace xrpl {
namespace ripple {
// RAII scope helpers. As specified in Library Fundamental, Version 3
// Basic design of idea: https://www.youtube.com/watch?v=WjTrfoiB0MQ
@@ -218,7 +218,7 @@ public:
{
XRPL_ASSERT(
plock->owns_lock(),
"xrpl::scope_unlock::scope_unlock : mutex must be locked");
"ripple::scope_unlock::scope_unlock : mutex must be locked");
plock->unlock();
}
@@ -236,6 +236,6 @@ public:
template <class Mutex>
scope_unlock(std::unique_lock<Mutex>&) -> scope_unlock<Mutex>;
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -13,7 +13,7 @@
#include <immintrin.h>
#endif
namespace xrpl {
namespace ripple {
namespace detail {
/** Inform the processor that we are in a tight spin-wait loop.
@@ -105,7 +105,7 @@ public:
{
XRPL_ASSERT(
index >= 0 && (mask_ != 0),
"xrpl::packed_spinlock::packed_spinlock : valid index and mask");
"ripple::packed_spinlock::packed_spinlock : valid index and mask");
}
[[nodiscard]] bool
@@ -206,6 +206,6 @@ public:
};
/** @} */
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,7 +4,7 @@
#include <boost/algorithm/hex.hpp>
#include <boost/endian/conversion.hpp>
namespace xrpl {
namespace ripple {
template <class FwdIt>
std::string
@@ -28,6 +28,6 @@ strHex(T const& from)
return strHex(from.begin(), from.end());
}
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -10,7 +10,7 @@
#include <iostream>
#include <type_traits>
namespace xrpl {
namespace ripple {
/** A type-safe wrap around standard integral types
@@ -197,11 +197,11 @@ public:
}
};
} // namespace xrpl
} // namespace ripple
namespace beast {
template <class Int, class Tag, class HashAlgorithm>
struct is_contiguously_hashable<xrpl::tagged_integer<Int, Tag>, HashAlgorithm>
struct is_contiguously_hashable<ripple::tagged_integer<Int, Tag>, HashAlgorithm>
: public is_contiguously_hashable<Int, HashAlgorithm>
{
explicit is_contiguously_hashable() = default;

View File

@@ -13,7 +13,7 @@
// The duplication is because Visual Studio 2019 cannot compile that header
// even with the option -Zc:__cplusplus added.
#define ALWAYS(cond, message, ...) assert((message) && (cond))
#define ALWAYS_OR_UNREACHABLE(cond, message, ...) assert((message) && (cond))
#define ALWAYS_OR_UNREACHABLE(cond, message) assert((message) && (cond))
#define SOMETIMES(cond, message, ...)
#define REACHABLE(message, ...)
#define UNREACHABLE(message, ...) assert((message) && false)

View File

@@ -4,7 +4,7 @@
#include <string>
#include <vector>
namespace xrpl {
namespace ripple {
class RFC1751
{
@@ -42,6 +42,6 @@ private:
static char const* s_dictionary[];
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,7 +3,7 @@
#include <mutex>
namespace xrpl {
namespace ripple {
/** A cryptographically secure random number engine
@@ -70,6 +70,6 @@ public:
csprng_engine&
crypto_prng();
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,7 +3,7 @@
#include <cstddef>
namespace xrpl {
namespace ripple {
/** Attempts to clear the given blob of memory.
@@ -22,6 +22,6 @@ namespace xrpl {
void
secure_erase(void* dest, std::size_t bytes);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/beast/utility/PropertyStream.h>
#include <xrpl/json/json_value.h>
namespace xrpl {
namespace ripple {
/** A PropertyStream::Sink which produces a Json::Value of type objectValue. */
class JsonPropertyStream : public beast::PropertyStream
@@ -66,6 +66,6 @@ protected:
add(std::string const& v) override;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -234,7 +234,7 @@ inline void
check(bool condition, std::string const& message)
{
if (!condition)
xrpl::Throw<std::logic_error>(message);
ripple::Throw<std::logic_error>(message);
}
} // namespace Json

View File

@@ -6,6 +6,6 @@
#define JSON_ASSERT_MESSAGE(condition, message) \
if (!(condition)) \
xrpl::Throw<Json::error>(message);
ripple::Throw<Json::error>(message);
#endif

View File

@@ -199,7 +199,7 @@ public:
Value(UInt value);
Value(double value);
Value(char const* value);
Value(xrpl::Number const& value);
Value(ripple::Number const& value);
/** \brief Constructs a value from a static string.
* Like other value string constructor but do not duplicate the string for
@@ -381,6 +381,9 @@ public:
/// Return true if the object has a member named key.
bool
isMember(std::string const& key) const;
/// Return true if the object has a member named key.
bool
isMember(StaticString const& key) const;
/// \brief Return a list of the member names.
///
@@ -427,7 +430,7 @@ private:
};
inline Value
to_json(xrpl::Number const& number)
to_json(ripple::Number const& number)
{
return to_string(number);
}

View File

@@ -6,7 +6,7 @@
#include <xrpl/ledger/RawView.h>
#include <xrpl/ledger/ReadView.h>
namespace xrpl {
namespace ripple {
enum ApplyFlags : std::uint32_t {
tapNONE = 0x00,
@@ -267,7 +267,7 @@ public:
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ApplyView::dirAppend : only Offers are appended to "
"ripple::ApplyView::dirAppend : only Offers are appended to "
"book directories");
// Only Offers are appended to book directories. Call dirInsert()
// instead
@@ -368,6 +368,45 @@ public:
emptyDirDelete(Keylet const& directory);
};
} // namespace xrpl
namespace directory {
/** Helper functions for managing low-level directory operations.
These are not part of the ApplyView interface.
Don't use them unless you really, really know what you're doing.
Instead use dirAdd, dirInsert, etc.
*/
std::uint64_t
createRoot(
ApplyView& view,
Keylet const& directory,
uint256 const& key,
std::function<void(std::shared_ptr<SLE> const&)> const& describe);
auto
findPreviousPage(ApplyView& view, Keylet const& directory, SLE::ref start);
std::uint64_t
insertKey(
ApplyView& view,
SLE::ref node,
std::uint64_t page,
bool preserveOrder,
STVector256& indexes,
uint256 const& key);
std::optional<std::uint64_t>
insertPage(
ApplyView& view,
std::uint64_t page,
SLE::pointer node,
std::uint64_t nextPage,
SLE::ref next,
uint256 const& key,
Keylet const& directory,
std::function<void(std::shared_ptr<SLE> const&)> const& describe);
} // namespace directory
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/TER.h>
namespace xrpl {
namespace ripple {
/** Editable, discardable view that can build metadata for one tx.
@@ -75,6 +75,6 @@ private:
std::optional<STAmount> deliver_;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/ledger/ReadView.h>
namespace xrpl {
namespace ripple {
class BookDirs
{
@@ -89,6 +89,6 @@ private:
static beast::Journal j_;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/STLedgerEntry.h>
namespace xrpl {
namespace ripple {
using CachedSLEs = TaggedCache<uint256, SLE const>;
}

View File

@@ -8,7 +8,7 @@
#include <mutex>
#include <type_traits>
namespace xrpl {
namespace ripple {
namespace detail {
@@ -164,6 +164,6 @@ public:
}
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -11,7 +11,7 @@
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/TER.h>
namespace xrpl {
namespace ripple {
namespace credentials {
// These function will be used by the code that use DepositPreauth / Credentials
@@ -93,6 +93,6 @@ verifyDepositPreauth(
std::shared_ptr<SLE> const& sleDst,
beast::Journal j);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/ledger/ReadView.h>
#include <xrpl/protocol/Indexes.h>
namespace xrpl {
namespace ripple {
/** A class that simplifies iterating ledger directory pages
@@ -108,6 +108,6 @@ private:
std::vector<uint256>::const_iterator it_;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -13,7 +13,7 @@
#include <functional>
#include <utility>
namespace xrpl {
namespace ripple {
/** Open ledger construction tag.
@@ -252,6 +252,6 @@ public:
std::shared_ptr<Serializer const> const& metaData) override;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -8,7 +8,7 @@
#include <map>
namespace xrpl {
namespace ripple {
namespace detail {
@@ -188,6 +188,6 @@ private:
PaymentSandbox const* ps_ = nullptr;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/Serializer.h>
namespace xrpl {
namespace ripple {
/** Interface for ledger entry changes.
@@ -87,6 +87,6 @@ public:
std::shared_ptr<Serializer const> const& metaData) = 0;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -18,7 +18,7 @@
#include <optional>
#include <unordered_set>
namespace xrpl {
namespace ripple {
//------------------------------------------------------------------------------
@@ -258,7 +258,7 @@ makeRulesGivenLedger(
DigestAwareReadView const& ledger,
std::unordered_set<uint256, beast::uhash<>> const& presets);
} // namespace xrpl
} // namespace ripple
#include <xrpl/ledger/detail/ReadViewFwdRange.ipp>

View File

@@ -4,7 +4,7 @@
#include <xrpl/ledger/RawView.h>
#include <xrpl/ledger/detail/ApplyViewBase.h>
namespace xrpl {
namespace ripple {
/** Discardable, editable view to a ledger.
@@ -39,6 +39,6 @@ public:
}
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -19,7 +19,7 @@
#include <map>
#include <utility>
namespace xrpl {
namespace ripple {
enum class WaiveTransferFee : bool { No = false, Yes };
enum class SkipEntry : bool { No = false, Yes };
@@ -223,6 +223,80 @@ isDeepFrozen(
Currency const& currency,
AccountID const& issuer);
[[nodiscard]] inline bool
isDeepFrozen(
ReadView const& view,
AccountID const& account,
Issue const& issue,
int = 0 /*ignored*/)
{
return isDeepFrozen(view, account, issue.currency, issue.account);
}
[[nodiscard]] inline bool
isDeepFrozen(
ReadView const& view,
AccountID const& account,
MPTIssue const& mptIssue,
int depth = 0)
{
// Unlike IOUs, frozen / locked MPTs are not allowed to send or receive
// funds, so checking "deep frozen" is the same as checking "frozen".
return isFrozen(view, account, mptIssue, depth);
}
/**
* isFrozen check is recursive for MPT shares in a vault, descending to
* assets in the vault, up to maxAssetCheckDepth recursion depth. This is
* purely defensive, as we currently do not allow such vaults to be created.
*/
[[nodiscard]] inline bool
isDeepFrozen(
ReadView const& view,
AccountID const& account,
Asset const& asset,
int depth = 0)
{
return std::visit(
[&](auto const& issue) {
return isDeepFrozen(view, account, issue, depth);
},
asset.value());
}
[[nodiscard]] inline TER
checkDeepFrozen(
ReadView const& view,
AccountID const& account,
Issue const& issue)
{
return isDeepFrozen(view, account, issue) ? (TER)tecFROZEN
: (TER)tesSUCCESS;
}
[[nodiscard]] inline TER
checkDeepFrozen(
ReadView const& view,
AccountID const& account,
MPTIssue const& mptIssue)
{
return isDeepFrozen(view, account, mptIssue) ? (TER)tecLOCKED
: (TER)tesSUCCESS;
}
[[nodiscard]] inline TER
checkDeepFrozen(
ReadView const& view,
AccountID const& account,
Asset const& asset)
{
return std::visit(
[&](auto const& issue) {
return checkDeepFrozen(view, account, issue);
},
asset.value());
}
[[nodiscard]] bool
isLPTokenFrozen(
ReadView const& view,
@@ -268,6 +342,49 @@ accountHolds(
AuthHandling zeroIfUnauthorized,
beast::Journal j);
// Returns the amount an account can spend total.
//
// These functions use accountHolds, but unlike accountHolds:
// * The account can go into debt.
// * If the account is the asset issuer the only limit is defined by the asset /
// issuance.
//
// <-- saAmount: amount of currency held by account. May be negative.
[[nodiscard]] STAmount
accountCanSend(
ReadView const& view,
AccountID const& account,
Currency const& currency,
AccountID const& issuer,
FreezeHandling zeroIfFrozen,
beast::Journal j);
[[nodiscard]] STAmount
accountCanSend(
ReadView const& view,
AccountID const& account,
Issue const& issue,
FreezeHandling zeroIfFrozen,
beast::Journal j);
[[nodiscard]] STAmount
accountCanSend(
ReadView const& view,
AccountID const& account,
MPTIssue const& mptIssue,
FreezeHandling zeroIfFrozen,
AuthHandling zeroIfUnauthorized,
beast::Journal j);
[[nodiscard]] STAmount
accountCanSend(
ReadView const& view,
AccountID const& account,
Asset const& asset,
FreezeHandling zeroIfFrozen,
AuthHandling zeroIfUnauthorized,
beast::Journal j);
// Returns the amount an account can spend of the currency type saDefault, or
// returns saDefault if this account is the issuer of the currency in
// question. Should be used in favor of accountHolds when questioning how much
@@ -514,7 +631,11 @@ dirNext(
describeOwnerDir(AccountID const& account);
[[nodiscard]] TER
dirLink(ApplyView& view, AccountID const& owner, std::shared_ptr<SLE>& object);
dirLink(
ApplyView& view,
AccountID const& owner,
std::shared_ptr<SLE>& object,
SF_UINT64 const& node = sfOwnerNode);
AccountID
pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey);
@@ -533,14 +654,17 @@ createPseudoAccount(
uint256 const& pseudoOwnerKey,
SField const& ownerField);
// Returns true iff sleAcct is a pseudo-account.
// Returns true iff sleAcct is a pseudo-account or specific
// pseudo-accounts in pseudoFieldFilter.
//
// Returns false if sleAcct is
// * NOT a pseudo-account OR
// * NOT a ltACCOUNT_ROOT OR
// * null pointer
[[nodiscard]] bool
isPseudoAccount(std::shared_ptr<SLE const> sleAcct);
isPseudoAccount(
std::shared_ptr<SLE const> sleAcct,
std::set<SField const*> const& pseudoFieldFilter = {});
// Returns the list of fields that define an ACCOUNT_ROOT as a pseudo-account if
// set
@@ -554,14 +678,80 @@ isPseudoAccount(std::shared_ptr<SLE const> sleAcct);
getPseudoAccountFields();
[[nodiscard]] inline bool
isPseudoAccount(ReadView const& view, AccountID accountId)
isPseudoAccount(
ReadView const& view,
AccountID const& accountId,
std::set<SField const*> const& pseudoFieldFilter = {})
{
return isPseudoAccount(view.read(keylet::account(accountId)));
return isPseudoAccount(
view.read(keylet::account(accountId)), pseudoFieldFilter);
}
[[nodiscard]] TER
canAddHolding(ReadView const& view, Asset const& asset);
/** Validates that the destination SLE and tag are valid
- Checks that the SLE is not null.
- If the SLE requires a destination tag, checks that there is a tag.
*/
[[nodiscard]] TER
checkDestinationAndTag(SLE::const_ref toSle, bool hasDestinationTag);
/** Checks that can withdraw funds from an object to itself or a destination.
*
* The receiver may be either the submitting account (sfAccount) or a different
* destination account (sfDestination).
*
* - Checks that the receiver account exists.
* - If the receiver requires a destination tag, check that one exists, even
* if withdrawing to self.
* - If withdrawing to self, succeed.
* - If not, checks if the receiver requires deposit authorization, and if
* the sender has it.
*/
[[nodiscard]] TER
canWithdraw(
AccountID const& from,
ReadView const& view,
AccountID const& to,
SLE::const_ref toSle,
bool hasDestinationTag);
/** Checks that can withdraw funds from an object to itself or a destination.
*
* The receiver may be either the submitting account (sfAccount) or a different
* destination account (sfDestination).
*
* - Checks that the receiver account exists.
* - If the receiver requires a destination tag, check that one exists, even
* if withdrawing to self.
* - If withdrawing to self, succeed.
* - If not, checks if the receiver requires deposit authorization, and if
* the sender has it.
*/
[[nodiscard]] TER
canWithdraw(
AccountID const& from,
ReadView const& view,
AccountID const& to,
bool hasDestinationTag);
/** Checks that can withdraw funds from an object to itself or a destination.
*
* The receiver may be either the submitting account (sfAccount) or a different
* destination account (sfDestination).
*
* - Checks that the receiver account exists.
* - If the receiver requires a destination tag, check that one exists, even
* if withdrawing to self.
* - If withdrawing to self, succeed.
* - If not, checks if the receiver requires deposit authorization, and if
* the sender has it.
*/
[[nodiscard]] TER
canWithdraw(ReadView const& view, STTx const& tx);
/// Any transactors that call addEmptyHolding() in doApply must call
/// canAddHolding() in preflight with the same View and Asset
[[nodiscard]] TER
@@ -731,6 +921,22 @@ accountSend(
beast::Journal j,
WaiveTransferFee waiveFee = WaiveTransferFee::No);
using MultiplePaymentDestinations = std::vector<std::pair<AccountID, Number>>;
/** Like accountSend, except one account is sending multiple payments (with the
* same asset!) simultaneously
*
* Calls static accountSendMultiIOU if saAmount represents Issue.
* Calls static accountSendMultiMPT if saAmount represents MPTIssue.
*/
[[nodiscard]] TER
accountSendMulti(
ApplyView& view,
AccountID const& senderID,
Asset const& asset,
MultiplePaymentDestinations const& receivers,
beast::Journal j,
WaiveTransferFee waiveFee = WaiveTransferFee::No);
[[nodiscard]] TER
issueIOU(
ApplyView& view,
@@ -802,7 +1008,8 @@ requireAuth(
* purely defensive, as we currently do not allow such vaults to be created.
*
* If StrongAuth then return tecNO_AUTH if MPToken doesn't exist or
* lsfMPTRequireAuth is set and MPToken is not authorized.
* lsfMPTRequireAuth is set and MPToken is not authorized. Vault and LoanBroker
* pseudo-accounts are implicitly authorized.
*
* If WeakAuth then return tecNO_AUTH if lsfMPTRequireAuth is set and MPToken
* doesn't exist or is not authorized (explicitly or via credentials, if
@@ -958,6 +1165,6 @@ sharesToAssetsWithdraw(
bool
after(NetClock::time_point now, std::uint32_t mark);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -11,7 +11,7 @@
#include <memory>
namespace xrpl {
namespace ripple {
namespace detail {
// Helper class that buffers modifications
@@ -139,6 +139,6 @@ private:
};
} // namespace detail
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -6,7 +6,7 @@
#include <xrpl/ledger/detail/ApplyStateTable.h>
#include <xrpl/protocol/XRPAmount.h>
namespace xrpl {
namespace ripple {
namespace detail {
class ApplyViewBase : public ApplyView, public RawView
@@ -106,6 +106,6 @@ protected:
};
} // namespace detail
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -10,7 +10,7 @@
#include <map>
#include <utility>
namespace xrpl {
namespace ripple {
namespace detail {
// Helper class that buffers raw modifications
@@ -118,6 +118,6 @@ private:
};
} // namespace detail
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <memory>
#include <optional>
namespace xrpl {
namespace ripple {
class ReadView;
@@ -130,6 +130,6 @@ protected:
};
} // namespace detail
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -1,7 +1,7 @@
#ifndef XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED
#define XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED
namespace xrpl {
namespace ripple {
namespace detail {
template <class ValueType>
@@ -63,7 +63,7 @@ ReadViewFwdRange<ValueType>::iterator::operator==(iterator const& other) const
{
XRPL_ASSERT(
view_ == other.view_,
"xrpl::detail::ReadViewFwdRange::iterator::operator==(iterator) "
"ripple::detail::ReadViewFwdRange::iterator::operator==(iterator) "
"const : input view match");
if (impl_ != nullptr && other.impl_ != nullptr)
@@ -115,6 +115,6 @@ ReadViewFwdRange<ValueType>::iterator::operator++(int) -> iterator
}
} // namespace detail
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -269,7 +269,7 @@ protected:
error_code const& ec,
size_t bytesTransferred)
{
using namespace xrpl;
using namespace ripple;
if (ec)
{

View File

@@ -12,7 +12,7 @@
#include <functional>
#include <string>
namespace xrpl {
namespace ripple {
/** Provides an asynchronous HTTP client implementation with optional SSL.
*/
@@ -75,6 +75,6 @@ public:
beast::Journal& j);
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -11,7 +11,7 @@
#include <boost/asio/ssl.hpp>
#include <boost/format.hpp>
namespace xrpl {
namespace ripple {
class HTTPClientSSLContext
{
@@ -176,6 +176,6 @@ private:
bool const verify_;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <boost/asio/ssl/context.hpp>
namespace xrpl {
namespace ripple {
/** Register default SSL certificates.
Register the system default SSL root certificates. On linux/mac,
@@ -19,6 +19,6 @@ registerSSLCerts(
boost::system::error_code&,
beast::Journal j);
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <cstdint>
namespace xrpl {
namespace ripple {
namespace NodeStore {
/** A backend used for the NodeStore.
@@ -143,6 +143,6 @@ public:
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -11,7 +11,7 @@
#include <condition_variable>
namespace xrpl {
namespace ripple {
namespace NodeStore {
@@ -230,7 +230,7 @@ protected:
{
XRPL_ASSERT(
count <= sz,
"xrpl::NodeStore::Database::storeStats : valid inputs");
"ripple::NodeStore::Database::storeStats : valid inputs");
storeCount_ += count;
storeSz_ += sz;
}
@@ -291,6 +291,6 @@ private:
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,7 +3,7 @@
#include <xrpl/nodestore/Database.h>
namespace xrpl {
namespace ripple {
namespace NodeStore {
/* This class has two key-value store Backend objects for persisting SHAMap
@@ -39,6 +39,6 @@ public:
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -3,7 +3,7 @@
#include <xrpl/nodestore/Scheduler.h>
namespace xrpl {
namespace ripple {
namespace NodeStore {
/** Simple NodeStore Scheduler that just peforms the tasks synchronously. */
@@ -21,6 +21,6 @@ public:
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -8,7 +8,7 @@
#include <nudb/store.hpp>
namespace xrpl {
namespace ripple {
namespace NodeStore {
@@ -61,6 +61,6 @@ public:
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/nodestore/DatabaseRotating.h>
#include <xrpl/nodestore/Factory.h>
namespace xrpl {
namespace ripple {
namespace NodeStore {
@@ -83,6 +83,6 @@ public:
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -7,7 +7,7 @@
// VFALCO NOTE Intentionally not in the NodeStore namespace
namespace xrpl {
namespace ripple {
/** The types of node objects. */
enum NodeObjectType : std::uint32_t {
@@ -81,6 +81,6 @@ private:
Blob const mData;
};
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <chrono>
namespace xrpl {
namespace ripple {
namespace NodeStore {
enum class FetchType { synchronous, async };
@@ -66,6 +66,6 @@ public:
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -1,7 +1,7 @@
#ifndef XRPL_NODESTORE_TASK_H_INCLUDED
#define XRPL_NODESTORE_TASK_H_INCLUDED
namespace xrpl {
namespace ripple {
namespace NodeStore {
/** Derived classes perform scheduled tasks. */
@@ -17,6 +17,6 @@ struct Task
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -5,7 +5,7 @@
#include <vector>
namespace xrpl {
namespace ripple {
namespace NodeStore {
enum {
@@ -37,6 +37,6 @@ using Batch = std::vector<std::shared_ptr<NodeObject>>;
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

View File

@@ -8,7 +8,7 @@
#include <condition_variable>
#include <mutex>
namespace xrpl {
namespace ripple {
namespace NodeStore {
/** Batch-writing assist logic.
@@ -78,6 +78,6 @@ private:
};
} // namespace NodeStore
} // namespace xrpl
} // namespace ripple
#endif

Some files were not shown because too many files have changed in this diff Show More