Compare commits

...

13 Commits

Author SHA1 Message Date
Vito
17220ca51a Merge remote-tracking branch 'origin/develop' into tapanito/unit-tests 2026-10-01 09:17:05 +02:00
Vito
cda637d476 test: Fold the CanTransfer vault case into the shared helper
Use the testCase helper in testCreateFailMPT like its siblings, drop the
holder case that the existing no-authorization case already covers, and
name the second vault's shares consistently in the AMM test.
2026-09-30 13:52:11 +02:00
Vito
ed42fe7a32 test: Trim vault and AMM coverage to cases not already tested
AMMCreate now rejects vault shares with tecWRONG_ASSET and MPT flags can
only be enabled, so the original positive-path tests no longer apply.
Keep the novel cases: vault shares as the first AMM asset and shares
paired with another vault's shares in AMMMPT_test, and VaultCreate being
refused with tecNO_AUTH for holder and issuer until the issuer enables
CanTransfer in VaultValidation_test.
2026-09-30 13:27:28 +02:00
Vito
516efefd6f Merge remote-tracking branch 'origin/develop' into tapanito/unit-tests
# Conflicts:
#	src/test/app/Vault_test.cpp
2026-09-30 13:27:26 +02:00
Vito
3ebc4b5a00 Merge remote-tracking branch 'origin/develop' into tapanito/unit-tests 2026-06-09 10:30:57 +02:00
Vito
8811e6c091 minor: fix test comments 2026-05-20 12:32:17 +02:00
Vito
8645272b1a post-merge issues 2026-05-20 12:21:53 +02:00
Vito
b3978ae302 Merge remote-tracking branch 'origin/develop' into tapanito/unit-tests 2026-05-20 12:20:34 +02:00
Vito Tumas
0e3807040d Merge branch 'develop' into tapanito/unit-tests 2026-05-19 15:56:02 +02:00
Vito
aa5b02cde3 test: Update Vault+AMM tests for develop renames
Rename references after merging develop:
- testable_amendments -> testableAmendments
- mptInitNoFund -> kMPT_INIT_NO_FUND
- MPTDEXFlags -> kMPT_DEX_FLAGS
- ter -> Ter
2026-05-04 17:57:46 +02:00
Vito
99747f6b04 Merge remote-tracking branch 'origin/develop' into tapanito/unit-tests 2026-05-04 17:38:41 +02:00
Vito
fc620bf29a test: Fix clang-tidy issues in new Vault+AMM tests
- AMM_test: directly include <xrpl/protocol/MPTIssue.h>
  (misc-include-cleaner).
- Vault_test::testMutateCanTransferAfterDeposit: declare local Vault
  const (misc-const-correctness).
2026-04-29 12:03:50 +02:00
Vito
b01ba1fce2 test: Add Vault+AMM integration coverage
- AMM_test::testVaultSharesAMM: pair vault-share MPT with XRP, do a
  single-asset deposit of additional shares.
- AMM_test::testLockedVaultMPTCashOut: lock the underlying MPT of a
  vault that backs an AMM and confirm the freeze cascades through
  isVaultPseudoAccountFrozen, blocking LP-token Payment (tecPATH_DRY)
  and AMM withdrawal (tecFROZEN).
- Vault_test::testMutateCanTransferAfterDeposit: exercise issuer
  mutating lsfMPTCanTransfer / lsfMPTCanTrade after holders have
  deposited. Confirms CanTrade has no effect on vault I/O, the
  issuer-as-depositor path is exempt from canTransfer, and a holder
  can still exit via VaultWithdraw with Destination = issuer while
  CanTransfer is cleared.
2026-04-29 11:45:43 +02:00
2 changed files with 58 additions and 6 deletions

View File

@@ -7116,8 +7116,33 @@ private:
auto const shareMPTID = vaultSle->at(sfShareMPTID);
STAmount const shareAmt{MPTIssue{shareMPTID}, 100'000'000};
AMM const amm{env, alice_, XRP(100), shareAmt, Ter(tecWRONG_ASSET)};
{
AMM const amm{env, alice_, XRP(100), shareAmt, Ter(tecWRONG_ASSET)};
BEAST_EXPECT(!amm.ammExists());
}
// Argument order swapped: shares as Amount, XRP as Amount2.
{
AMM const amm{env, alice_, shareAmt, XRP(100), Ter(tecWRONG_ASSET)};
BEAST_EXPECT(!amm.ammExists());
}
// Shares of one vault paired with shares of a second vault.
auto [createTx2, vaultKeylet2] = vault.create({.owner = alice_, .asset = iou});
env(createTx2);
env.close();
env(vault.deposit({.depositor = alice_, .id = vaultKeylet2.key, .amount = iou(200)}));
env.close();
auto const vault2Sle = env.le(vaultKeylet2);
if (!BEAST_EXPECT(vault2Sle))
return;
STAmount const vault2Shares{MPTIssue{vault2Sle->at(sfShareMPTID)}, 100'000'000};
{
AMM const amm{env, alice_, shareAmt, vault2Shares, Ter(tecWRONG_ASSET)};
BEAST_EXPECT(!amm.ammExists());
}
}
void

View File

@@ -870,7 +870,8 @@ private:
Account const& owner,
Account const& depositor,
Asset const& asset,
Vault& vault)> test) {
Vault& vault,
MPTTester& mptt)> test) {
Env env{*this, testableAmendments()};
Account const issuer{"issuer"};
Account const owner{"owner"};
@@ -883,7 +884,7 @@ private:
mptt.create();
Asset const asset = mptt.issuanceID();
test(env, issuer, owner, depositor, asset, vault);
test(env, issuer, owner, depositor, asset, vault, mptt);
};
testCase([this](
@@ -892,7 +893,8 @@ private:
Account const& owner,
Account const& depositor,
Asset const& asset,
Vault& vault) {
Vault& vault,
MPTTester& mptt) {
testcase("MPT no authorization");
auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
env(tx, Ter(tecNO_AUTH));
@@ -904,7 +906,31 @@ private:
Account const& owner,
Account const& depositor,
Asset const& asset,
Vault& vault) {
Vault& vault,
MPTTester& mptt) {
testcase("MPT without CanTransfer until issuer enables it");
// Unlike AMMCreate's requireAuth, canAddHolding does not exempt the issuer.
{
auto [tx, keylet] = vault.create({.owner = issuer, .asset = asset});
env(tx, Ter(tecNO_AUTH));
}
mptt.set({.account = issuer, .flags = tfMPTSetCanTransfer});
auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
env(tx);
env.close();
BEAST_EXPECT(env.le(keylet));
});
testCase([this](
Env& env,
Account const& issuer,
Account const& owner,
Account const& depositor,
Asset const& asset,
Vault& vault,
MPTTester& mptt) {
testcase("MPT cannot set Scale=0");
auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
tx[sfScale] = 0;
@@ -917,7 +943,8 @@ private:
Account const& owner,
Account const& depositor,
Asset const& asset,
Vault& vault) {
Vault& vault,
MPTTester& mptt) {
testcase("MPT cannot set Scale=1");
auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
tx[sfScale] = 1;