- 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.
Adds unit-test coverage for three previously-untested branches in
VaultHelpers:
- addVaultAssets propagates a non-tes return when the underlying
accountSend fails (exercised via a sender with no trust line for the
vault asset).
- clawbackVaultAssets propagates a non-tes return when its accountSend
fails (exercised via a synthetic third-party recipient with no trust
line; the production caller always uses the asset issuer, which
cannot hit this branch).
- moveVaultAssets short-circuits and returns tesSUCCESS without
touching accountSendMulti when every recipient's amount is zero
(exercised via two zero-amount recipients, which still satisfies the
recipients.size() > 1 precondition).
Exercise addVaultAssets, clawbackVaultAssets, removeVaultAssets
(including FinalRemoval::Yes hard-reset and the amount > sfAssetsAvailable
failure path), and moveVaultAssets directly against a real Vault SLE and
ApplyView, built via jtx but bypassing the VaultDeposit/VaultWithdraw/
VaultClawback/LoanSet transactors. Covers zero-amount edges, negative
valueDelta, and the independent amount/valueDelta contract, in addition
to the existing transactor-level coverage in Vault_test.cpp,
LoanSet_test.cpp, etc.