Extract all IOU freeze and MPT lock tests from testWithIOU and
testWithMPT into two focused test functions covering VaultDeposit
and VaultWithdraw respectively.
Each function tests both IOU (global, depositor regular/deep,
vault-account regular/deep) and MPT (global lock, depositor lock,
vault-account lock) for both pre- and post-fixCleanup3_3_0, plus
clawback-while-frozen assertions.
Add checkDepositFreeze that checks the depositor for regular freeze and
the destination pseudo-account for deep freeze only. A regular freeze on
the vault account's trust line no longer blocks deposits.
Update checkWithdrawFreezes to skip the submitter freeze check when
submitter == destination (withdrawing to self).
Gate VaultDeposit with fixCleanup3_3_0; pre-fix path preserves the old
isFrozen-based checks. Use checkDepositFreeze in LoanBrokerCoverDeposit.
Reflect the new deposit freeze semantics: only a deep-frozen
pseudo-account blocks deposits; a regular freeze on the vault account's
trust line no longer does. Also account for the checkWithdrawFreezes
change where submitter == destination skips the submitter freeze check.
Parameterize the pre/post-fix test variants via runTest lambdas instead
of withFix ternaries. Add a dedicated deep-freeze deposit test.
Introduce checkWithdrawFreezes helper gated behind fixCleanup3_3_0 that
consolidates source, submitter, and destination freeze checks for
pseudo-account withdrawals. The issuer-redemption exemption is now
handled in one place rather than scattered across callers.
Add MPT individual-lock tests for depositor and 3rd-party destination
withdrawal scenarios, and extend LoanBrokerCoverWithdraw with the same
consolidated freeze logic.
The previous edit dropped the assertion that clawback still works when
the MPT asset is globally locked. Restore it before the issuer-redemption
step, claw back 50 of the 100 deposited units, then withdraw the remaining
50 to the issuer so both behaviours are exercised in the same test.
Hoist dstAcct into doApply and use FreezeHandling::IgnoreFreeze for
accountHolds when dstAcct == vaultAsset.getIssuer() under fixCleanup3_2_0.
Without this the locked-share balance read as zero and the redemption
failed with tecINSUFFICIENT_FUNDS despite preclaim passing.
Update tests: issuer-redemption now succeeds end-to-end for both IOU and
MPT vaults.
Verify the dstAcct != vaultAsset.getIssuer() guard introduced under
fixCleanup3_2_0: frozen vault trust line and MPT global lock both block
non-issuer withdrawals, while the issuer-destination path bypasses
preclaim's freeze checks (redemption path). Preclaim passes for the
issuer destination, but doApply::accountHolds(ZeroIfFrozen) still returns
0 for locked shares — a matching doApply fix is tracked via TODO comments.
Also updates expected error codes in existing freeze tests affected by
the new vault-sender and deep-frozen-destination checks.
Under fixCleanup3_2_0, VaultWithdraw::preclaim now explicitly checks that
the vault pseudo-account (sender) is not frozen, and replaces the
destination checkFrozen with checkDeepFrozen — a frozen account can still
receive assets, only a deep-frozen one cannot.
Pre-amendment behaviour is preserved via the else branch. Tests are updated
to reflect the changed error codes and new pre/post amendment cases are
added for the vault-account and 3rd-party freeze scenarios.