- Document the mutate-then-transfer ordering that every helper follows and
the caller obligation to discard the ApplyView on non-tesSUCCESS
(transactor sandbox convention).
- Assert that removeVaultAssets is only called with `amount ==
sfAssetsAvailable` when FinalRemoval::Yes, so a mis-specified amount can
no longer zero the Vault fields while leaving dust on the pseudo-account.
- Mirror the `assetsAvailable <= assetsTotal` XRPL_ASSERT_PARTS from
LoanSet/LoanPay in LoanManage::defaultLoan's fixCleanup3_4_0 branch for
defense-in-depth parity.
- Extend VaultHelpers_test failure-path cases to pin the mutate-then-
transfer observable, add a third-party-destination sub-test for
removeVaultAssets, add a Legacy-vault fixture for moveVaultAssets with
nonzero valueDelta, and add an MPT-backed fixture covering
add/removeVaultAssets against the integral-asset transfer path.
Addresses review comments on #7983 from @gregtatcam, @xrplf-ai-reviewer,
and @copilot-pull-request-reviewer.
- Restore the doc comment on STAmount::isRounded that was lost when it
moved out of LendingHelpers.cpp.
- Collapse LoanManage::defaultLoan's Vault-update block into a direct
return of addVaultAssets, since there is no follow-up work after it.
- Mark removeVaultAssets's amount==0 early-return with LCOV_EXCL_LINE: it
is a defensive short-circuit for a branch that is only reachable in a
vanishingly rare edge case (final withdrawal from a vault whose
sfAssetsAvailable has already been written down to zero) and is not
reached by any current transactor-level test.
Add addVaultAssets, removeVaultAssets (two overloads: plain accountSend
and doWithdraw-based), clawbackVaultAssets, and moveVaultAssets as the
single points through which a Vault's sfAssetsTotal/sfAssetsAvailable are
mutated and funds move to/from its pseudo-account:
- addVaultAssets increases both fields and transfers in from a sender.
- removeVaultAssets/clawbackVaultAssets decrease both fields equally and
transfer out; a FinalRemoval flag hard-resets both fields to exactly
zero on a Vault's last withdrawal, since the discounted exchange-rate
formula can produce values with more precision than the asset can
canonically represent, and subtracting such a value would leave a
non-canonical residual instead of an exact zero.
- moveVaultAssets decreases only sfAssetsAvailable, for disbursements
(e.g. a loan's principal and origination fee) where sfAssetsTotal
independently grows via accrued interest.
Also consolidate getAssetsTotalScale into VaultHelpers::getVaultScale,
and move isRounded from LendingHelpers into STAmount.h alongside the
other rounding utilities.
* upstream/release/3.3.x: (41 commits)
chore: Bump version to 3.3.0
chore: Bump version to 3.3.0-rc7
fix: Increase manifest protocol message size cap and fix manifests relay
fix: Cap untrusted manifests per message and drop oversized ones
chore: Bump version to 3.2.1
chore: Bump version to 3.2.1-rc1
fix: Cap untrusted manifests per message and drop oversized ones
fix: Reject oversized validator manifest before decoding
fix: Reduce untrusted manifest cache cap to 100
fix: Bound untrusted manifest cache
chore: Bump version to 3.3.0-rc6
feat: Package validator-keys inside rippled
chore: Bump version to 3.3.0-rc5
fix: Switch SponsorshipSet to use a delta for sfFeeAmount
fix: Re-revert "fix: Set request size limits and differential pricing for get-object-by-hash calls"
chore: Bump version to 3.3.0-rc4
fix: Revert "fix: Set request size limits and differential pricing for get-object-by-hash calls"
chore: Bump version to 3.3.0-rc3
fix: Reduce untrusted manifest cache cap to 100
fix: Revert "fix: Reject oversized SHAMap nodes in gotStaleData and fetch-pack path"
...