mirror of
https://github.com/XRPLF/rippled.git
synced 2026-02-14 19:02:30 +00:00
Compare commits
13 Commits
bthomee/no
...
tapanito/v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bc67c8b01 | ||
|
|
a14541a335 | ||
|
|
6a34a66659 | ||
|
|
3338ec3aed | ||
|
|
167147281c | ||
|
|
60fce3c487 | ||
|
|
f8b555d7a7 | ||
|
|
ba60306610 | ||
|
|
6674500896 | ||
|
|
c5d7ebe93d | ||
|
|
d0b5ca9dab | ||
|
|
5e51893e9b | ||
|
|
3422c11d02 |
@@ -15,6 +15,8 @@
|
||||
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FIX (LendingProtocolV1_1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PermissionedDomainInvariant, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ExpiredNFTokenOfferRemoval, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (BatchInnerSigs, Supported::yes, VoteBehavior::DefaultNo)
|
||||
|
||||
@@ -868,6 +868,7 @@ TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
|
||||
mustDeleteAcct | destroyMPTIssuance | mustModifyVault,
|
||||
({
|
||||
{sfVaultID, soeREQUIRED},
|
||||
{sfData, soeOPTIONAL},
|
||||
}))
|
||||
|
||||
/** This transaction trades assets for shares with a vault. */
|
||||
|
||||
@@ -1701,10 +1701,21 @@ class LoanBroker_test : public beast::unit_test::suite
|
||||
testRIPD4274MPT();
|
||||
}
|
||||
|
||||
void
|
||||
testFixAmendmentEnabled()
|
||||
{
|
||||
using namespace jtx;
|
||||
testcase("testFixAmendmentEnabled");
|
||||
Env env{*this};
|
||||
|
||||
BEAST_EXPECT(env.enabled(fixLendingProtocolV1_1));
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testFixAmendmentEnabled();
|
||||
testLoanBrokerSetDebtMaximum();
|
||||
testLoanBrokerCoverDepositNullVault();
|
||||
|
||||
|
||||
@@ -4990,6 +4990,54 @@ class Vault_test : public beast::unit_test::suite
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
testVaultDeleteData()
|
||||
{
|
||||
using namespace test::jtx;
|
||||
|
||||
auto const test =
|
||||
[&](std::string const& prefix, FeatureBitset features, std::string const& pl, TER expectedCode) {
|
||||
Env env{*this, features};
|
||||
testcase("VaultDelete data " + prefix);
|
||||
Account const owner{"owner"};
|
||||
|
||||
Vault vault{env};
|
||||
env.fund(XRP(1'000'000), owner);
|
||||
env.close();
|
||||
|
||||
PrettyAsset const xrpAsset = xrpIssue();
|
||||
|
||||
auto const [tx, keylet] = vault.create({.owner = owner, .asset = xrpAsset});
|
||||
env(tx, ter(tesSUCCESS), THISLINE);
|
||||
|
||||
auto delTx = vault.del({.owner = owner, .id = keylet.key});
|
||||
env(delTx, data(pl), ter(expectedCode), THISLINE);
|
||||
|
||||
env.close();
|
||||
};
|
||||
|
||||
auto const all = testable_amendments();
|
||||
|
||||
// Test VaultDelete with fixLendingProtocolV1_1 disabled
|
||||
// Transaction fails if the data field is provided
|
||||
test(
|
||||
"fixLendingProtocolV1_1 disabled",
|
||||
all - fixLendingProtocolV1_1,
|
||||
std::string(maxDataPayloadLength, 'A'),
|
||||
temDISABLED);
|
||||
|
||||
// Transaction fails if the data field is too large
|
||||
test(
|
||||
"fixLendingProtocolV1_1 enabled data too large",
|
||||
all,
|
||||
std::string(maxDataPayloadLength + 1, 'A'),
|
||||
temMALFORMED);
|
||||
|
||||
// Transaction fails if the data field is set, but is empty
|
||||
test("fixLendingProtocolV1_1 enabled data empty", all, std::string(0, 'A'), temMALFORMED);
|
||||
test("fixLendingProtocolV1_1 enabled data valid", all, std::string(maxDataPayloadLength, 'A'), tesSUCCESS);
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
@@ -5011,6 +5059,7 @@ public:
|
||||
testVaultClawbackBurnShares();
|
||||
testVaultClawbackAssets();
|
||||
testAssetsMaximum();
|
||||
testVaultDeleteData();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,13 @@ VaultDelete::preflight(PreflightContext const& ctx)
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfData) && !ctx.rules.enabled(fixLendingProtocolV1_1))
|
||||
return temDISABLED;
|
||||
|
||||
// The sfData field is an optional field used to record the deletion reason.
|
||||
if (auto const data = ctx.tx[~sfData]; data && !validDataLength(data, maxDataPayloadLength))
|
||||
return temMALFORMED;
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user