Commit Graph

482 Commits

Author SHA1 Message Date
Vito
2df03ba770 Merge remote-tracking branch 'origin/tapanito/enable-lp-1-1' into ripple/lending-stage 2026-08-26 18:30:45 +02:00
Vito
966ce3bed8 Merge remote-tracking branch 'origin/tapanito/vault-precision-transactor' into ripple/lending-stage 2026-08-26 18:25:52 +02:00
Vito
e118f4cc30 feat: Enable LendingProtocolV1_1 amendment 2026-08-26 18:17:12 +02:00
JCW
efadaf6aa7 Self review 2026-08-26 15:58:15 +01:00
JCW
290b1a6d68 Merge remote-tracking branch 'origin/develop' into a1q123456/add-loan-invariants 2026-08-26 15:25:16 +01:00
JCW
3b332f7838 Strip out some checks 2026-08-26 15:25:00 +01:00
Vito Tumas
36c165f74d fix: Prevent early loan impairment and due-date manipulation (#6557)
Co-authored-by: Ed Hennis <ed@ripple.com>
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com>
2026-08-26 13:38:24 +00:00
Vito
f39fc07c0b fix: Guard clamp credit sum and skip rounding for integral assets 2026-08-26 12:37:51 +02:00
Vito
03236cc07e fix: Snap vault deltas to ValidVault's posterior assetsTotal scale
Derive credits from the Downward-rounded posterior total so an off-grid
sfAssetsTotal cannot over-credit the depositor's payment, and round
debits down at that same posterior scale so decade-boundary amounts
that are representable after the tx succeed in full.
2026-08-25 21:12:14 +02:00
Vito
9b8e5d6672 Merge remote-tracking branch 'origin/develop' into tapanito/vault-precision-transactor 2026-08-25 20:39:29 +02:00
JCW
b7d5715c90 Merge remote-tracking branch 'origin/develop' into a1q123456/add-loan-invariants 2026-08-25 16:05:47 +01:00
JCW
113427f4bb WIP: address PR comments 2026-08-25 15:23:27 +01:00
Jingchen
c5dc408596 fix: Remove explicit from std/boost hash specialisation default constructors (#8100) 2026-08-25 14:13:02 +00:00
JCW
ad745adaa2 Merge remote-tracking branch 'origin/develop' into a1q123456/add-loan-invariants 2026-08-25 14:19:20 +01:00
Vito
3b550b720e Merge remote-tracking branch 'origin/develop' into tapanito/vault-precision-transactor 2026-08-25 11:20:12 +02:00
JCW
1d0332525c Address comments 2026-08-24 22:07:43 +01:00
JCW
2d1af3dc2a Fix build error 2026-08-24 17:18:27 +01:00
Jingchen
f137d71510 test: Split Invariants_test.cpp into per-topic files (#8077) 2026-08-24 16:17:33 +00:00
Ed Hennis
764cbe7c29 perf: Pause online delete if there any gaps in recent ledger history (#5531)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-24 14:16:03 +00:00
Vito
37dbfc0447 Merge remote-tracking branch 'origin/develop' into tapanito/vault-precision-transactor 2026-08-24 16:12:06 +02:00
Timur Yalymov
520650081b fix: Remove credentials pinned to Vault, LoanBroker, and AMM pseudo-accounts (#7877)
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2026-08-24 13:06:44 +00:00
Timur Yalymov
a097ccebae fix: Tighten destination checks on vault withdrawal (#7977)
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2026-08-24 12:50:57 +00:00
Vito
79ef10c529 Merge remote-tracking branch 'origin/develop' into tapanito/vault-precision-transactor
# Conflicts:
#	src/test/app/vault/VaultBugs_test.cpp
2026-08-24 11:14:03 +02:00
JCW
30890b8e19 Address Vito's comments I left 2026-08-21 17:56:23 +01:00
JCW
bf11ffec7a pre-commit hooks 2026-08-21 15:43:29 +01:00
JCW
e27db94891 Address PR comments 2026-08-21 12:51:22 +01:00
JCW
019ae5b9cb Update comments 2026-08-21 12:18:34 +01:00
JCW
c571eff3a8 WIP 2026-08-21 11:57:07 +01:00
JCW
f66ce70256 WIP 2026-08-21 11:45:05 +01:00
JCW
c7672d5ef7 WIP 2026-08-21 10:41:40 +01:00
Vito
fbda53aa8b fix: Guard debitIsNonZeroDust against overflow_error in VaultClawback
Mirrors the equivalent guard already applied to VaultWithdraw: wrap
the dust check in try/catch so a sufficiently abused sfScale pushing
assetsTotal/assetsAvailable out of STAmount's representable range
returns tecPATH_DRY instead of surfacing as a raw overflow_error.

Also address other outstanding review nits: fix
VaultTransactorPrecision_test's suite module (tx -> app, matching
every other Vault suite), replace the "PR 2" comment in
VaultPrecisionFixture.h with a stable description, and tighten the
clampToAssetsTotalScale docstring in VaultHelpers.h.
2026-08-21 11:14:31 +02:00
JCW
b77d5b8f4c Merge remote-tracking branch 'origin/develop' into a1q123456/add-loan-invariants 2026-08-21 08:29:44 +01:00
JCW
2f2e306fcd WIP 2026-08-21 08:27:29 +01:00
Mayukha Vadari
85512541ad refactor: Collapse transactions.macro settings into a TxSettings struct (#8001)
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-08-20 19:25:27 +00:00
Kassaking7
d0dbf9163c fix: Prevent AMM auction slots from being acquired at zero cost when trading fee is zero (#7430) 2026-08-20 19:04:04 +00:00
Shawn Xie
e3ba569187 fix: Check credential for LoanBrokerCoverWithdraw and VaultWithdraw (#7107)
Co-authored-by: Peter Chen <ychen@ripple.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-08-20 15:33:46 +00:00
Vito
1583772faf fix: Guard clamp for zero-payout withdrawals; address review feedback
The clamp block added in VaultWithdraw::doApply unconditionally returned
tecPRECISION_LOSS when the clamped payout was zero. That undid the
develop-side guard that deliberately permits fixed-share zero-asset
withdrawals in a fully-impaired vault (assetsTotalForWithdrawal == 0),
causing xrpl.tx.LoanRounding to fail on all three build-test configs
(linux-clang, linux-gcc-coverage, windows). Skip the clamp when
assetsWithdrawn is already zero, and also on the final-withdrawal path
where the value is overwritten with sfAssetsAvailable a few lines later.

Also addresses review feedback:
- Correct clampToAssetsTotalScale docstring to reflect that it returns a
  non-negative magnitude; the caller applies the sign.
- Add XRPL_ASSERT precondition matching sibling helpers, and canonicalize
  totalBefore/totalAfter under a single NumberRoundModeGuard so the
  returned delta reflects only `delta`, not a rounding difference between
  the two endpoints.
- Move VaultPrecisionFixture.h and VaultTransactorPrecision_test.cpp
  from src/test/app/lending/ to src/test/app/vault/ so vault tests live
  alongside the other vault-specific suites.
- Simplify inline commentary across VaultDeposit/VaultWithdraw/
  VaultClawback.
2026-08-20 12:12:25 +02:00
Vito
0db000bc97 Merge remote-tracking branch 'origin/develop' into tapanito/vault-precision-transactor
# Conflicts:
#	src/libxrpl/ledger/helpers/VaultHelpers.cpp
#	src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp
2026-08-20 11:00:36 +02:00
Vito
ec8a9cdbf8 fix: Clamp Vault Deposit, Withdraw, and Clawback to assetsTotal grid
sfAssetsTotal is stored on a coarser STAmount grid than sfAssetsAvailable
and the vault's trust line, so adding the same amount to all three
quantizes differently on each and leaves the vault's books disagreeing
with its actual holdings by a sub-ULP amount. Fix by clamping the
credited/withdrawn amount to what sfAssetsTotal can represent before
applying it to the other rails, via a shared clampToAssetsTotalScale
helper used by all three transactors.

- Deposit: clamp assetsDeposited downward to the assetsTotal grid, then
  re-derive shares from the clamped amount so the depositor cannot
  receive shares worth more than they paid. Return tecPRECISION_LOSS if
  the clamp rounds the deposit to zero.
- Withdraw: clamp assetsWithdrawn upward (i.e. the vault pays out
  slightly less) so it never pays out more than it can account for.
  Shares are not re-derived, so the withdrawer receives slightly less
  per share, favouring remaining holders.
- Clawback: same pattern as withdraw, guarded on assetsRecovered > 0 and
  placed after the existing clamp-to-available.

Gated on fixCleanup3_4_0.
2026-08-19 19:54:50 +02:00
JCW
fa60adb9a6 Merge remote-tracking branch 'origin/develop' into a1q123456/add-loan-invariants 2026-08-19 17:28:00 +01:00
JCW
7f687b49be Merge remote-tracking branch 'origin/develop' into a1q123456/add-loan-invariants 2026-08-19 15:48:27 +01:00
Vito Tumas
d1dc7a6ccf refactor: Extract invariant invocation into free checkInvariants runner (#7404)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 14:10:11 +00:00
Timur Yalymov
368ff1afce fix: Exempt loan default from asset freeze (#7932)
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-08-19 13:43:40 +00:00
Vito Tumas
3adf2d40b5 fix: Reject VaultWithdraw fixed-share amounts that round to zero (#7950) 2026-08-19 13:09:38 +00:00
Bart
ca39bff3c8 refactor: Add SHAMapNodeID::isPrefixOf (#7939)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-08-18 12:35:32 +00:00
Copilot
820ca5b332 refactor: Convert boost::beast::string_view to std::string_view (#6306)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Co-authored-by: Mayukha Vadari <mvadari@ripple.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
Co-authored-by: Mayukha Vadari <mvadari@gmail.com>
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
2026-08-17 23:19:56 +00:00
Gregory Tsipenyuk
1b226c8b2e perf: Optimize MPT freeze checks to reduce redundant state reads (#7411)
Co-authored-by: Chenna Keshava B S <21219765+ckeshava@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-17 21:15:16 +00:00
Gregory Tsipenyuk
ca6121c5b3 feat: Enforce MPT CanTransfer on AMM LPTokens transfers (#7418) 2026-08-17 20:58:46 +00:00
Bart
5337d028a2 refactor: Use unsigned int for branch-related operations (#7938)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 10:07:14 +00:00
Bart
2adffaef72 refactor: Remove support for protocol version 2.1 (#7432)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-14 15:36:47 +00:00