mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-05 16:57:56 +00:00
Compare commits
44 Commits
3.1.0-b0
...
Bronek/vau
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94a1facf7b | ||
|
|
13a12c6402 | ||
|
|
362ecbd1cb | ||
|
|
7025e92080 | ||
|
|
f81d0d8c98 | ||
|
|
508937f3d1 | ||
|
|
b508d57112 | ||
|
|
a0896cb9d3 | ||
|
|
049cb0275c | ||
|
|
5844c59026 | ||
|
|
00ba58a5a8 | ||
|
|
2cad9460bd | ||
|
|
d502e56f83 | ||
|
|
52e311437c | ||
|
|
9942f62756 | ||
|
|
032c3c9a76 | ||
|
|
9d0a289686 | ||
|
|
863b3d74d8 | ||
|
|
5e3bcb1430 | ||
|
|
a6895505af | ||
|
|
9017860051 | ||
|
|
4aa471a4d5 | ||
|
|
73646bb758 | ||
|
|
96057c8aac | ||
|
|
db61c22c9b | ||
|
|
a355b1eb05 | ||
|
|
b87d6ecee5 | ||
|
|
0ff8c7e323 | ||
|
|
9037fcb374 | ||
|
|
37ada0c561 | ||
|
|
558d12c269 | ||
|
|
80a8f1cd9e | ||
|
|
077237f62a | ||
|
|
23fe3259b5 | ||
|
|
4cbe0d6fb6 | ||
|
|
3a37eae4fb | ||
|
|
4aff6e5d73 | ||
|
|
c1c3fb9ee8 | ||
|
|
8e678bfc70 | ||
|
|
11cb95d84a | ||
|
|
3883ca9790 | ||
|
|
7c1fafef85 | ||
|
|
295177c236 | ||
|
|
65e1c81746 |
@@ -6,18 +6,18 @@
|
||||
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1756234266.869",
|
||||
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1756234262.318",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1756234314.246",
|
||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1759820024.194",
|
||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1762797952.535",
|
||||
"re2/20230301#dfd6e2bf050eb90ddd8729cfb4c844a4%1756234257.976",
|
||||
"protobuf/3.21.12#d927114e28de9f4691a6bbcdd9a529d1%1756234251.614",
|
||||
"openssl/3.5.4#a1d5835cc6ed5c5b8f3cd5b9b5d24205%1760106486.594",
|
||||
"nudb/2.0.9#c62cfd501e57055a7e0d8ee3d5e5427d%1756234237.107",
|
||||
"nudb/2.0.9#fb8dfd1a5557f5e0528114c2da17721e%1763150366.909",
|
||||
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1756234228.999",
|
||||
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1756223727.64",
|
||||
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1756230911.03",
|
||||
"libarchive/3.8.1#5cf685686322e906cb42706ab7e099a8%1756234256.696",
|
||||
"jemalloc/5.3.0#e951da9cf599e956cebc117880d2d9f8%1729241615.244",
|
||||
"grpc/1.50.1#02291451d1e17200293a409410d1c4e1%1756234248.958",
|
||||
"doctest/2.4.12#eb9fb352fb2fdfc8abb17ec270945165%1749889324.069",
|
||||
"doctest/2.4.12#eb9fb352fb2fdfc8abb17ec270945165%1762797941.757",
|
||||
"date/3.0.4#f74bbba5a08fa388256688743136cb6f%1756234217.493",
|
||||
"c-ares/1.34.5#b78b91e7cfb1f11ce777a285bbf169c6%1756234217.915",
|
||||
"bzip2/1.0.8#00b4a4658791c1f06914e087f0e792f5%1756234261.716",
|
||||
@@ -53,6 +53,9 @@
|
||||
],
|
||||
"lz4/[>=1.9.4 <2]": [
|
||||
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504"
|
||||
],
|
||||
"sqlite3/3.44.2": [
|
||||
"sqlite3/3.49.1"
|
||||
]
|
||||
},
|
||||
"config_requires": []
|
||||
|
||||
@@ -31,17 +31,8 @@ class STTx final : public STObject, public CountedObject<STTx>
|
||||
TxType tx_type_;
|
||||
|
||||
public:
|
||||
static std::size_t const minMultiSigners = 1;
|
||||
|
||||
// if rules are not supplied then the largest possible value is returned
|
||||
static std::size_t
|
||||
maxMultiSigners(Rules const* rules = 0)
|
||||
{
|
||||
if (rules && !rules->enabled(featureExpandedSignerList))
|
||||
return 8;
|
||||
|
||||
return 32;
|
||||
}
|
||||
static constexpr std::size_t minMultiSigners = 1;
|
||||
static constexpr std::size_t maxMultiSigners = 32;
|
||||
|
||||
STTx() = delete;
|
||||
STTx(STTx const& other) = default;
|
||||
|
||||
@@ -27,7 +27,7 @@ XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::yes, VoteBehavior::DefaultNo
|
||||
XRPL_FIX (AMMv1_3, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Batch, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(SingleAssetVault, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(SingleAssetVault, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo)
|
||||
// Check flags in Credential transactions
|
||||
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo)
|
||||
@@ -65,13 +65,10 @@ XRPL_FIX (UniversalNumber, Supported::yes, VoteBehavior::DefaultNo
|
||||
XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DisallowIncoming, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(ExpandedSignerList, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(FlowSortStrands, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(TicketBatch, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(NegativeUNL, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(RequireFullyCanonicalSig, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(DeletableAccounts, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(MultiSignReserve, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(Checks, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(Flow, Supported::yes, VoteBehavior::DefaultYes)
|
||||
|
||||
@@ -126,13 +123,16 @@ XRPL_RETIRE_FEATURE(DepositAuth)
|
||||
XRPL_RETIRE_FEATURE(DepositPreauth)
|
||||
XRPL_RETIRE_FEATURE(Escrow)
|
||||
XRPL_RETIRE_FEATURE(EnforceInvariants)
|
||||
XRPL_RETIRE_FEATURE(ExpandedSignerList)
|
||||
XRPL_RETIRE_FEATURE(FeeEscalation)
|
||||
XRPL_RETIRE_FEATURE(FlowCross)
|
||||
XRPL_RETIRE_FEATURE(HardenedValidations)
|
||||
XRPL_RETIRE_FEATURE(ImmediateOfferKilled)
|
||||
XRPL_RETIRE_FEATURE(MultiSign)
|
||||
XRPL_RETIRE_FEATURE(MultiSignReserve)
|
||||
XRPL_RETIRE_FEATURE(NonFungibleTokensV1_1)
|
||||
XRPL_RETIRE_FEATURE(PayChan)
|
||||
XRPL_RETIRE_FEATURE(SortedDirectories)
|
||||
XRPL_RETIRE_FEATURE(TicketBatch)
|
||||
XRPL_RETIRE_FEATURE(TickSize)
|
||||
XRPL_RETIRE_FEATURE(TrustSetAuth)
|
||||
|
||||
@@ -155,7 +155,7 @@ TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel,
|
||||
#endif
|
||||
TRANSACTION(ttTICKET_CREATE, 10, TicketCreate,
|
||||
Delegation::delegatable,
|
||||
featureTicketBatch,
|
||||
uint256{},
|
||||
noPriv,
|
||||
({
|
||||
{sfTicketCount, soeREQUIRED},
|
||||
|
||||
@@ -476,7 +476,7 @@ multiSignHelper(
|
||||
|
||||
// There are well known bounds that the number of signers must be within.
|
||||
if (signers.size() < STTx::minMultiSigners ||
|
||||
signers.size() > STTx::maxMultiSigners(&rules))
|
||||
signers.size() > STTx::maxMultiSigners)
|
||||
return Unexpected("Invalid Signers array size.");
|
||||
|
||||
// Signers must be in sorted order by AccountID.
|
||||
|
||||
@@ -3534,8 +3534,7 @@ private:
|
||||
// Attach signers to alice.
|
||||
env(signers(alice, 2, {{becky, 1}, {bogie, 1}}), sig(alie));
|
||||
env.close();
|
||||
int const signerListOwners{features[featureMultiSignReserve] ? 2 : 5};
|
||||
env.require(owners(alice, signerListOwners + 0));
|
||||
env.require(owners(alice, 2));
|
||||
|
||||
msig const ms{becky, bogie};
|
||||
|
||||
@@ -3795,20 +3794,13 @@ private:
|
||||
void
|
||||
testMultisign()
|
||||
{
|
||||
using namespace jtx;
|
||||
auto const all = testable_amendments();
|
||||
|
||||
testTxMultisign(
|
||||
all - featureMultiSignReserve - featureExpandedSignerList);
|
||||
testTxMultisign(all - featureExpandedSignerList);
|
||||
testTxMultisign(all);
|
||||
testTxMultisign(jtx::testable_amendments());
|
||||
}
|
||||
|
||||
void
|
||||
testPayStrand()
|
||||
{
|
||||
using namespace jtx;
|
||||
auto const all = testable_amendments();
|
||||
auto const all = jtx::testable_amendments();
|
||||
|
||||
testToStrand(all);
|
||||
testRIPD1373(all);
|
||||
|
||||
@@ -963,14 +963,8 @@ class Check_test : public beast::unit_test::suite
|
||||
}
|
||||
|
||||
// Use a regular key and also multisign to cash a check.
|
||||
// featureMultiSignReserve changes the reserve on a SignerList, so
|
||||
// check both before and after.
|
||||
for (auto const& testFeatures :
|
||||
{features - featureMultiSignReserve,
|
||||
features | featureMultiSignReserve})
|
||||
{
|
||||
Env env{*this, testFeatures};
|
||||
|
||||
Env env{*this, features};
|
||||
env.fund(XRP(1000), gw, alice, bob);
|
||||
env.close();
|
||||
|
||||
@@ -999,11 +993,7 @@ class Check_test : public beast::unit_test::suite
|
||||
env(signers(bob, 2, {{bogie, 1}, {demon, 1}}), sig(bobby));
|
||||
env.close();
|
||||
|
||||
// If featureMultiSignReserve is enabled then bob's signer list
|
||||
// has an owner count of 1, otherwise it's 4.
|
||||
int const signersCount = {
|
||||
testFeatures[featureMultiSignReserve] ? 1 : 4};
|
||||
BEAST_EXPECT(ownerCount(env, bob) == signersCount + 1);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == 2);
|
||||
|
||||
// bob uses his regular key to cash a check.
|
||||
env(check::cash(bob, chkId1, (USD(1))), sig(bobby));
|
||||
@@ -1013,7 +1003,7 @@ class Check_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 1);
|
||||
BEAST_EXPECT(checksOnAccount(env, bob).size() == 1);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 2);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == signersCount + 1);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == 2);
|
||||
|
||||
// bob uses multisigning to cash a check.
|
||||
XRPAmount const baseFeeDrops{env.current()->fees().base};
|
||||
@@ -1026,7 +1016,7 @@ class Check_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 0);
|
||||
BEAST_EXPECT(checksOnAccount(env, bob).size() == 0);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 1);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == signersCount + 1);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1605,13 +1595,8 @@ class Check_test : public beast::unit_test::suite
|
||||
Account const zoe{"zoe"};
|
||||
IOU const USD{gw["USD"]};
|
||||
|
||||
// featureMultiSignReserve changes the reserve on a SignerList, so
|
||||
// check both before and after.
|
||||
for (auto const& testFeatures :
|
||||
{features - featureMultiSignReserve,
|
||||
features | featureMultiSignReserve})
|
||||
{
|
||||
Env env{*this, testFeatures};
|
||||
Env env{*this, features};
|
||||
|
||||
env.fund(XRP(1000), gw, alice, bob, zoe);
|
||||
env.close();
|
||||
@@ -1729,16 +1714,11 @@ class Check_test : public beast::unit_test::suite
|
||||
env(signers(alice, 2, {{bogie, 1}, {demon, 1}}), sig(alie));
|
||||
env.close();
|
||||
|
||||
// If featureMultiSignReserve is enabled then alices's signer list
|
||||
// has an owner count of 1, otherwise it's 4.
|
||||
int const signersCount{
|
||||
testFeatures[featureMultiSignReserve] ? 1 : 4};
|
||||
|
||||
// alice uses her regular key to cancel a check.
|
||||
env(check::cancel(alice, chkIdReg), sig(alie));
|
||||
env.close();
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 3);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == signersCount + 3);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 4);
|
||||
|
||||
// alice uses multisigning to cancel a check.
|
||||
XRPAmount const baseFeeDrops{env.current()->fees().base};
|
||||
@@ -1747,18 +1727,18 @@ class Check_test : public beast::unit_test::suite
|
||||
fee(3 * baseFeeDrops));
|
||||
env.close();
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 2);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == signersCount + 2);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 3);
|
||||
|
||||
// Creator and destination cancel the remaining unexpired checks.
|
||||
env(check::cancel(alice, chkId3), sig(alice));
|
||||
env.close();
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 1);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == signersCount + 1);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 2);
|
||||
|
||||
env(check::cancel(bob, chkIdNotExp3));
|
||||
env.close();
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 0);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == signersCount + 0);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1703,7 +1703,6 @@ class Delegate_test : public beast::unit_test::suite
|
||||
// NFTokenMint, NFTokenBurn, NFTokenCreateOffer, NFTokenCancelOffer,
|
||||
// NFTokenAcceptOffer are not included, they are tested separately.
|
||||
std::unordered_map<std::string, uint256> txRequiredFeatures{
|
||||
{"TicketCreate", featureTicketBatch},
|
||||
{"CheckCreate", featureChecks},
|
||||
{"CheckCash", featureChecks},
|
||||
{"CheckCancel", featureChecks},
|
||||
|
||||
@@ -54,37 +54,31 @@ public:
|
||||
Env env{*this, features};
|
||||
Account const alice{"alice", KeyType::secp256k1};
|
||||
|
||||
// The reserve required for a signer list changes with the passage
|
||||
// of featureMultiSignReserve. Make the required adjustments.
|
||||
bool const reserve1{features[featureMultiSignReserve]};
|
||||
|
||||
// Pay alice enough to meet the initial reserve, but not enough to
|
||||
// meet the reserve for a SignerListSet.
|
||||
auto const fee = env.current()->fees().base;
|
||||
auto const smallSignersReserve = reserve1 ? XRP(250) : XRP(350);
|
||||
env.fund(smallSignersReserve - drops(1), alice);
|
||||
env.fund(XRP(250) - drops(1), alice);
|
||||
env.close();
|
||||
env.require(owners(alice, 0));
|
||||
|
||||
{
|
||||
// Attach a signer list to alice. Should fail.
|
||||
Json::Value smallSigners = signers(alice, 1, {{bogie, 1}});
|
||||
env(smallSigners, ter(tecINSUFFICIENT_RESERVE));
|
||||
Json::Value signersList = signers(alice, 1, {{bogie, 1}});
|
||||
env(signersList, ter(tecINSUFFICIENT_RESERVE));
|
||||
env.close();
|
||||
env.require(owners(alice, 0));
|
||||
|
||||
// Fund alice enough to set the signer list, then attach signers.
|
||||
env(pay(env.master, alice, fee + drops(1)));
|
||||
env.close();
|
||||
env(smallSigners);
|
||||
env(signersList);
|
||||
env.close();
|
||||
env.require(owners(alice, reserve1 ? 1 : 3));
|
||||
env.require(owners(alice, 1));
|
||||
}
|
||||
{
|
||||
// Pay alice enough to almost make the reserve for the biggest
|
||||
// possible list.
|
||||
auto const addReserveBigSigners = reserve1 ? XRP(0) : XRP(350);
|
||||
env(pay(env.master, alice, addReserveBigSigners + fee - drops(1)));
|
||||
env(pay(env.master, alice, fee - drops(1)));
|
||||
|
||||
// Replace with the biggest possible signer list. Should fail.
|
||||
Json::Value bigSigners = signers(
|
||||
@@ -100,14 +94,14 @@ public:
|
||||
{spook, 1}});
|
||||
env(bigSigners, ter(tecINSUFFICIENT_RESERVE));
|
||||
env.close();
|
||||
env.require(owners(alice, reserve1 ? 1 : 3));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Fund alice one more drop (plus the fee) and succeed.
|
||||
env(pay(env.master, alice, fee + drops(1)));
|
||||
env.close();
|
||||
env(bigSigners);
|
||||
env.close();
|
||||
env.require(owners(alice, reserve1 ? 1 : 10));
|
||||
env.require(owners(alice, 1));
|
||||
}
|
||||
// Remove alice's signer list and get the owner count back.
|
||||
env(signers(alice, jtx::none));
|
||||
@@ -170,14 +164,12 @@ public:
|
||||
ter(temBAD_QUORUM));
|
||||
|
||||
// clang-format off
|
||||
// Make a signer list that's too big. Should fail. (Even with
|
||||
// ExpandedSignerList)
|
||||
// Make a signer list that's too big. Should fail.
|
||||
Account const spare("spare", KeyType::secp256k1);
|
||||
env(signers(
|
||||
alice,
|
||||
1,
|
||||
features[featureExpandedSignerList]
|
||||
? std::vector<signer>{{bogie, 1}, {demon, 1}, {ghost, 1},
|
||||
std::vector<signer>{{bogie, 1}, {demon, 1}, {ghost, 1},
|
||||
{haunt, 1}, {jinni, 1}, {phase, 1},
|
||||
{shade, 1}, {spook, 1}, {spare, 1},
|
||||
{acc10, 1}, {acc11, 1}, {acc12, 1},
|
||||
@@ -187,10 +179,7 @@ public:
|
||||
{acc22, 1}, {acc23, 1}, {acc24, 1},
|
||||
{acc25, 1}, {acc26, 1}, {acc27, 1},
|
||||
{acc28, 1}, {acc29, 1}, {acc30, 1},
|
||||
{acc31, 1}, {acc32, 1}, {acc33, 1}}
|
||||
: std::vector<signer>{{bogie, 1}, {demon, 1}, {ghost, 1},
|
||||
{haunt, 1}, {jinni, 1}, {phase, 1},
|
||||
{shade, 1}, {spook, 1}, {spare, 1}}),
|
||||
{acc31, 1}, {acc32, 1}, {acc33, 1}}),
|
||||
ter(temMALFORMED));
|
||||
// clang-format on
|
||||
env.close();
|
||||
@@ -211,7 +200,7 @@ public:
|
||||
// Attach phantom signers to alice and use them for a transaction.
|
||||
env(signers(alice, 1, {{bogie, 1}, {demon, 1}}));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 4));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// This should work.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -288,7 +277,7 @@ public:
|
||||
{shade, 1},
|
||||
{spook, 1}}));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 10));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// This should work.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -343,7 +332,7 @@ public:
|
||||
// Make sure the transaction fails if they are not.
|
||||
env(signers(alice, 1, {{bogie, 1}, {demon, 1}}));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 4));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
msig phantoms{bogie, demon};
|
||||
std::reverse(phantoms.signers.begin(), phantoms.signers.end());
|
||||
@@ -382,7 +371,7 @@ public:
|
||||
// Attach signers to alice
|
||||
env(signers(alice, 4, {{becky, 3}, {cheri, 4}}), sig(alice));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 4));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Attempt a multisigned transaction that meets the quorum.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -751,7 +740,7 @@ public:
|
||||
env(signers(alice, 1, {{becky, 1}, {cheri, 1}, {daria, 1}, {jinni, 1}}),
|
||||
sig(alie));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 6));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Each type of signer should succeed individually.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -798,7 +787,7 @@ public:
|
||||
{jinni, 0xFFFF}}),
|
||||
sig(alie));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 6));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
aliceSeq = env.seq(alice);
|
||||
env(noop(alice),
|
||||
@@ -829,7 +818,7 @@ public:
|
||||
{spook, 0xFFFF}}),
|
||||
sig(alie));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 10));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
aliceSeq = env.seq(alice);
|
||||
env(noop(alice),
|
||||
@@ -1005,8 +994,7 @@ public:
|
||||
// Attach signers to alice.
|
||||
env(signers(alice, 2, {{becky, 1}, {bogie, 1}}), sig(alie));
|
||||
env.close();
|
||||
int const signerListOwners{features[featureMultiSignReserve] ? 1 : 4};
|
||||
env.require(owners(alice, signerListOwners + 0));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Multisign a ttPAYMENT.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -1036,7 +1024,7 @@ public:
|
||||
fee(3 * baseFee),
|
||||
require(lines("alice", 1)));
|
||||
env.close();
|
||||
env.require(owners(alice, signerListOwners + 1));
|
||||
env.require(owners(alice, 2));
|
||||
|
||||
// Multisign a ttOFFER_CREATE transaction.
|
||||
env(pay(gw, alice, USD(50)));
|
||||
@@ -1049,7 +1037,7 @@ public:
|
||||
msig(becky, bogie),
|
||||
fee(3 * baseFee));
|
||||
env.close();
|
||||
env.require(owners(alice, signerListOwners + 2));
|
||||
env.require(owners(alice, 3));
|
||||
|
||||
// Now multisign a ttOFFER_CANCEL canceling the offer we just created.
|
||||
{
|
||||
@@ -1060,7 +1048,7 @@ public:
|
||||
fee(3 * baseFee));
|
||||
env.close();
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
|
||||
env.require(owners(alice, signerListOwners + 1));
|
||||
env.require(owners(alice, 2));
|
||||
}
|
||||
|
||||
// Multisign a ttSIGNER_LIST_SET.
|
||||
@@ -1068,7 +1056,7 @@ public:
|
||||
msig(becky, bogie),
|
||||
fee(3 * baseFee));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 2 : 6));
|
||||
env.require(owners(alice, 2));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1178,56 +1166,44 @@ public:
|
||||
"fails local checks: Invalid Signers array size.");
|
||||
}
|
||||
{
|
||||
// Multisign 9 (!ExpandedSignerList) | 33 (ExpandedSignerList) times
|
||||
// should fail.
|
||||
JTx tx = env.jt(
|
||||
noop(alice),
|
||||
fee(2 * baseFee),
|
||||
|
||||
features[featureExpandedSignerList] ? msig(
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie)
|
||||
: msig(
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie));
|
||||
msig(
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie));
|
||||
STTx local = *(tx.stx);
|
||||
auto const info = submitSTTx(local);
|
||||
BEAST_EXPECT(
|
||||
@@ -1446,101 +1422,6 @@ public:
|
||||
.asString() == "tesSUCCESS");
|
||||
}
|
||||
|
||||
void
|
||||
testAmendmentTransition()
|
||||
{
|
||||
testcase("Amendment Transition");
|
||||
|
||||
// The OwnerCount associated with a SignerList changes once the
|
||||
// featureMultiSignReserve amendment goes live. Create a couple
|
||||
// of signer lists before and after the amendment goes live and
|
||||
// verify that the OwnerCount is managed properly for all of them.
|
||||
using namespace jtx;
|
||||
Account const alice{"alice", KeyType::secp256k1};
|
||||
Account const becky{"becky", KeyType::ed25519};
|
||||
Account const cheri{"cheri", KeyType::secp256k1};
|
||||
Account const daria{"daria", KeyType::ed25519};
|
||||
|
||||
Env env{*this, testable_amendments() - featureMultiSignReserve};
|
||||
env.fund(XRP(1000), alice, becky, cheri, daria);
|
||||
env.close();
|
||||
|
||||
// Give alice and becky signer lists before the amendment goes live.
|
||||
env(signers(alice, 1, {{bogie, 1}}));
|
||||
env(signers(
|
||||
becky,
|
||||
1,
|
||||
{{bogie, 1},
|
||||
{demon, 1},
|
||||
{ghost, 1},
|
||||
{haunt, 1},
|
||||
{jinni, 1},
|
||||
{phase, 1},
|
||||
{shade, 1},
|
||||
{spook, 1}}));
|
||||
env.close();
|
||||
|
||||
env.require(owners(alice, 3));
|
||||
env.require(owners(becky, 10));
|
||||
|
||||
// Enable the amendment.
|
||||
env.enableFeature(featureMultiSignReserve);
|
||||
env.close();
|
||||
|
||||
// Give cheri and daria signer lists after the amendment goes live.
|
||||
env(signers(cheri, 1, {{bogie, 1}}));
|
||||
env(signers(
|
||||
daria,
|
||||
1,
|
||||
{{bogie, 1},
|
||||
{demon, 1},
|
||||
{ghost, 1},
|
||||
{haunt, 1},
|
||||
{jinni, 1},
|
||||
{phase, 1},
|
||||
{shade, 1},
|
||||
{spook, 1}}));
|
||||
env.close();
|
||||
|
||||
env.require(owners(alice, 3));
|
||||
env.require(owners(becky, 10));
|
||||
env.require(owners(cheri, 1));
|
||||
env.require(owners(daria, 1));
|
||||
|
||||
// Delete becky's signer list; her OwnerCount should drop to zero.
|
||||
// Replace alice's signer list; her OwnerCount should drop to one.
|
||||
env(signers(becky, jtx::none));
|
||||
env(signers(
|
||||
alice,
|
||||
1,
|
||||
{{bogie, 1},
|
||||
{demon, 1},
|
||||
{ghost, 1},
|
||||
{haunt, 1},
|
||||
{jinni, 1},
|
||||
{phase, 1},
|
||||
{shade, 1},
|
||||
{spook, 1}}));
|
||||
env.close();
|
||||
|
||||
env.require(owners(alice, 1));
|
||||
env.require(owners(becky, 0));
|
||||
env.require(owners(cheri, 1));
|
||||
env.require(owners(daria, 1));
|
||||
|
||||
// Delete the three remaining signer lists. Everybody's OwnerCount
|
||||
// should now be zero.
|
||||
env(signers(alice, jtx::none));
|
||||
env(signers(cheri, jtx::none));
|
||||
env(signers(daria, jtx::none));
|
||||
env.close();
|
||||
|
||||
env.require(owners(alice, 0));
|
||||
env.require(owners(becky, 0));
|
||||
env.require(owners(cheri, 0));
|
||||
env.require(owners(daria, 0));
|
||||
}
|
||||
|
||||
void
|
||||
testSignersWithTickets(FeatureBitset features)
|
||||
{
|
||||
@@ -1585,9 +1466,6 @@ public:
|
||||
void
|
||||
testSignersWithTags(FeatureBitset features)
|
||||
{
|
||||
if (!features[featureExpandedSignerList])
|
||||
return;
|
||||
|
||||
testcase("Signers With Tags");
|
||||
|
||||
using namespace jtx;
|
||||
@@ -1609,7 +1487,7 @@ public:
|
||||
// Attach phantom signers to alice and use them for a transaction.
|
||||
env(signers(alice, 1, {{bogie, 1, bogie_tag}, {demon, 1, demon_tag}}));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 4));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// This should work.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -1744,12 +1622,6 @@ public:
|
||||
using namespace jtx;
|
||||
auto const all = testable_amendments();
|
||||
|
||||
// The reserve required on a signer list changes based on
|
||||
// featureMultiSignReserve. Limits on the number of signers
|
||||
// changes based on featureExpandedSignerList. Test both with and
|
||||
// without.
|
||||
testAll(all - featureMultiSignReserve - featureExpandedSignerList);
|
||||
testAll(all - featureExpandedSignerList);
|
||||
testAll(all);
|
||||
|
||||
testSignerListSetFlags(all - fixInvalidTxFlags);
|
||||
@@ -1757,8 +1629,6 @@ public:
|
||||
|
||||
testSignerListObject(all - fixIncludeKeyletFields);
|
||||
testSignerListObject(all);
|
||||
|
||||
testAmendmentTransition();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -727,13 +727,13 @@ private:
|
||||
}
|
||||
|
||||
void
|
||||
testMultisig(FeatureBitset features)
|
||||
testMultisig()
|
||||
{
|
||||
testcase("Multisig");
|
||||
using namespace jtx;
|
||||
Oracle::setFee(100'000);
|
||||
|
||||
Env env(*this, features);
|
||||
Env env(*this);
|
||||
auto const baseFee =
|
||||
static_cast<int>(env.current()->fees().base.drops());
|
||||
|
||||
@@ -753,9 +753,8 @@ private:
|
||||
// Attach signers to alice.
|
||||
env(signers(alice, 2, {{becky, 1}, {bogie, 1}, {ed, 2}}), sig(alie));
|
||||
env.close();
|
||||
// if multiSignReserve disabled then its 2 + 1 per signer
|
||||
int const signerListOwners{features[featureMultiSignReserve] ? 1 : 5};
|
||||
env.require(owners(alice, signerListOwners));
|
||||
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Create
|
||||
// Force close (true) and time advancement because the close time
|
||||
@@ -860,11 +859,7 @@ public:
|
||||
testDelete();
|
||||
testUpdate();
|
||||
testAmendment();
|
||||
for (auto const& features :
|
||||
{all,
|
||||
all - featureMultiSignReserve - featureExpandedSignerList,
|
||||
all - featureExpandedSignerList})
|
||||
testMultisig(features);
|
||||
testMultisig();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1889,7 +1889,6 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(channelAmount(*env.current(), chan) == XRP(1000));
|
||||
|
||||
rmAccount(env, alice, carol, tecHAS_OBLIGATIONS);
|
||||
// can only remove bob if the channel isn't in their owner directory
|
||||
rmAccount(env, bob, carol, TER(tecHAS_OBLIGATIONS));
|
||||
|
||||
auto const feeDrops = env.current()->fees().base;
|
||||
@@ -1904,7 +1903,6 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
auto authAmt = reqBal + XRP(100);
|
||||
assert(reqBal <= chanAmt);
|
||||
|
||||
// claim should fail if the dst was removed
|
||||
env(claim(alice, chan, reqBal, authAmt));
|
||||
env.close();
|
||||
BEAST_EXPECT(channelBalance(*env.current(), chan) == reqBal);
|
||||
@@ -1912,7 +1910,6 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(env.balance(bob) == preBob + delta);
|
||||
chanBal = reqBal;
|
||||
|
||||
// fund should fail if the dst was removed
|
||||
auto const preAlice = env.balance(alice);
|
||||
env(fund(alice, chan, XRP(1000)));
|
||||
env.close();
|
||||
|
||||
@@ -360,52 +360,6 @@ class Ticket_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(ticketSeq < acctRootSeq);
|
||||
}
|
||||
|
||||
void
|
||||
testTicketNotEnabled()
|
||||
{
|
||||
testcase("Feature Not Enabled");
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env{*this, testable_amendments() - featureTicketBatch};
|
||||
|
||||
env(ticket::create(env.master, 1), ter(temDISABLED));
|
||||
env.close();
|
||||
env.require(owners(env.master, 0), tickets(env.master, 0));
|
||||
|
||||
env(noop(env.master), ticket::use(1), ter(temMALFORMED));
|
||||
env(noop(env.master),
|
||||
ticket::use(1),
|
||||
seq(env.seq(env.master)),
|
||||
ter(temMALFORMED));
|
||||
|
||||
// Close enough ledgers that the previous transactions are no
|
||||
// longer retried.
|
||||
for (int i = 0; i < 8; ++i)
|
||||
env.close();
|
||||
|
||||
env.enableFeature(featureTicketBatch);
|
||||
env.close();
|
||||
env.require(owners(env.master, 0), tickets(env.master, 0));
|
||||
|
||||
std::uint32_t ticketSeq{env.seq(env.master) + 1};
|
||||
env(ticket::create(env.master, 2));
|
||||
checkTicketCreateMeta(env);
|
||||
env.close();
|
||||
env.require(owners(env.master, 2), tickets(env.master, 2));
|
||||
|
||||
env(noop(env.master), ticket::use(ticketSeq++));
|
||||
checkTicketConsumeMeta(env);
|
||||
env.close();
|
||||
env.require(owners(env.master, 1), tickets(env.master, 1));
|
||||
|
||||
env(fset(env.master, asfDisableMaster),
|
||||
ticket::use(ticketSeq++),
|
||||
ter(tecNO_ALTERNATIVE_KEY));
|
||||
checkTicketConsumeMeta(env);
|
||||
env.close();
|
||||
env.require(owners(env.master, 0), tickets(env.master, 0));
|
||||
}
|
||||
|
||||
void
|
||||
testTicketCreatePreflightFail()
|
||||
{
|
||||
@@ -907,70 +861,43 @@ class Ticket_test : public beast::unit_test::suite
|
||||
void
|
||||
testFixBothSeqAndTicket()
|
||||
{
|
||||
using namespace test::jtx;
|
||||
|
||||
// It is an error if a transaction contains a non-zero Sequence field
|
||||
// and a TicketSequence field. Verify that the error is detected.
|
||||
testcase("Fix both Seq and Ticket");
|
||||
|
||||
// Try the test without featureTicketBatch enabled.
|
||||
using namespace test::jtx;
|
||||
{
|
||||
Env env{*this, testable_amendments() - featureTicketBatch};
|
||||
Account alice{"alice"};
|
||||
Env env{*this, testable_amendments()};
|
||||
Account alice{"alice"};
|
||||
|
||||
env.fund(XRP(10000), alice);
|
||||
env.close();
|
||||
env.fund(XRP(10000), alice);
|
||||
env.close();
|
||||
|
||||
// Fail to create a ticket.
|
||||
std::uint32_t const ticketSeq = env.seq(alice) + 1;
|
||||
env(ticket::create(alice, 1), ter(temDISABLED));
|
||||
env.close();
|
||||
env.require(owners(alice, 0), tickets(alice, 0));
|
||||
BEAST_EXPECT(ticketSeq == env.seq(alice) + 1);
|
||||
// Create a ticket.
|
||||
std::uint32_t const ticketSeq = env.seq(alice) + 1;
|
||||
env(ticket::create(alice, 1));
|
||||
env.close();
|
||||
env.require(owners(alice, 1), tickets(alice, 1));
|
||||
BEAST_EXPECT(ticketSeq + 1 == env.seq(alice));
|
||||
|
||||
// Create a transaction that includes both a ticket and a non-zero
|
||||
// sequence number. Since a ticket is used and tickets are not yet
|
||||
// enabled the transaction should be malformed.
|
||||
env(noop(alice),
|
||||
ticket::use(ticketSeq),
|
||||
seq(env.seq(alice)),
|
||||
ter(temMALFORMED));
|
||||
env.close();
|
||||
}
|
||||
// Try the test with featureTicketBatch enabled.
|
||||
{
|
||||
Env env{*this, testable_amendments()};
|
||||
Account alice{"alice"};
|
||||
// Create a transaction that includes both a ticket and a non-zero
|
||||
// sequence number. The transaction fails with temSEQ_AND_TICKET.
|
||||
env(noop(alice),
|
||||
ticket::use(ticketSeq),
|
||||
seq(env.seq(alice)),
|
||||
ter(temSEQ_AND_TICKET));
|
||||
env.close();
|
||||
|
||||
env.fund(XRP(10000), alice);
|
||||
env.close();
|
||||
|
||||
// Create a ticket.
|
||||
std::uint32_t const ticketSeq = env.seq(alice) + 1;
|
||||
env(ticket::create(alice, 1));
|
||||
env.close();
|
||||
env.require(owners(alice, 1), tickets(alice, 1));
|
||||
BEAST_EXPECT(ticketSeq + 1 == env.seq(alice));
|
||||
|
||||
// Create a transaction that includes both a ticket and a non-zero
|
||||
// sequence number. The transaction fails with temSEQ_AND_TICKET.
|
||||
env(noop(alice),
|
||||
ticket::use(ticketSeq),
|
||||
seq(env.seq(alice)),
|
||||
ter(temSEQ_AND_TICKET));
|
||||
env.close();
|
||||
|
||||
// Verify that the transaction failed by looking at alice's
|
||||
// sequence number and tickets.
|
||||
env.require(owners(alice, 1), tickets(alice, 1));
|
||||
BEAST_EXPECT(ticketSeq + 1 == env.seq(alice));
|
||||
}
|
||||
// Verify that the transaction failed by looking at alice's
|
||||
// sequence number and tickets.
|
||||
env.require(owners(alice, 1), tickets(alice, 1));
|
||||
BEAST_EXPECT(ticketSeq + 1 == env.seq(alice));
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testTicketNotEnabled();
|
||||
testTicketCreatePreflightFail();
|
||||
testTicketCreatePreclaimFail();
|
||||
testTicketInsufficientReserve();
|
||||
|
||||
@@ -1329,7 +1329,7 @@ class Vault_test : public beast::unit_test::suite
|
||||
Vault& vault) {
|
||||
auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
|
||||
testcase("insufficient fee");
|
||||
env(tx, fee(env.current()->fees().base), ter(telINSUF_FEE_P));
|
||||
env(tx, fee(env.current()->fees().base - 1), ter(telINSUF_FEE_P));
|
||||
});
|
||||
|
||||
testCase([this](
|
||||
@@ -2074,6 +2074,10 @@ class Vault_test : public beast::unit_test::suite
|
||||
auto const sleMPT = env.le(mptoken);
|
||||
BEAST_EXPECT(sleMPT == nullptr);
|
||||
|
||||
// Use one reserve so the next transaction fails
|
||||
env(ticket::create(owner, 1));
|
||||
env.close();
|
||||
|
||||
// No reserve to create MPToken for asset in VaultWithdraw
|
||||
tx = vault.withdraw(
|
||||
{.depositor = owner,
|
||||
@@ -2091,7 +2095,7 @@ class Vault_test : public beast::unit_test::suite
|
||||
}
|
||||
},
|
||||
{.requireAuth = false,
|
||||
.initialXRP = acctReserve + incReserve * 4 - 1});
|
||||
.initialXRP = acctReserve + incReserve * 4 + 1});
|
||||
|
||||
testCase([this](
|
||||
Env& env,
|
||||
@@ -2980,6 +2984,9 @@ class Vault_test : public beast::unit_test::suite
|
||||
env.le(keylet::line(owner, asset.raw().get<Issue>()));
|
||||
BEAST_EXPECT(trustline == nullptr);
|
||||
|
||||
env(ticket::create(owner, 1));
|
||||
env.close();
|
||||
|
||||
// Fail because not enough reserve to create trust line
|
||||
tx = vault.withdraw(
|
||||
{.depositor = owner,
|
||||
@@ -2995,7 +3002,7 @@ class Vault_test : public beast::unit_test::suite
|
||||
env(tx);
|
||||
env.close();
|
||||
},
|
||||
CaseArgs{.initialXRP = acctReserve + incReserve * 4 - 1});
|
||||
CaseArgs{.initialXRP = acctReserve + incReserve * 4 + 1});
|
||||
|
||||
testCase(
|
||||
[&, this](
|
||||
@@ -3016,8 +3023,7 @@ class Vault_test : public beast::unit_test::suite
|
||||
env(pay(owner, charlie, asset(100)));
|
||||
env.close();
|
||||
|
||||
// Use up some reserve on tickets
|
||||
env(ticket::create(charlie, 2));
|
||||
env(ticket::create(charlie, 3));
|
||||
env.close();
|
||||
|
||||
// Fail because not enough reserve to create MPToken for shares
|
||||
@@ -3035,7 +3041,7 @@ class Vault_test : public beast::unit_test::suite
|
||||
env(tx);
|
||||
env.close();
|
||||
},
|
||||
CaseArgs{.initialXRP = acctReserve + incReserve * 4 - 1});
|
||||
CaseArgs{.initialXRP = acctReserve + incReserve * 4 + 1});
|
||||
|
||||
testCase([&, this](
|
||||
Env& env,
|
||||
|
||||
@@ -798,17 +798,16 @@ public:
|
||||
|
||||
{
|
||||
// a Env FeatureBitset has *only* those features
|
||||
Env env{*this, FeatureBitset(featureMultiSignReserve, featureFlow)};
|
||||
Env env{*this, FeatureBitset{featureDynamicMPT | featureFlow}};
|
||||
BEAST_EXPECT(env.app().config().features.size() == 2);
|
||||
foreachFeature(supported, [&](uint256 const& f) {
|
||||
bool const has =
|
||||
(f == featureMultiSignReserve || f == featureFlow);
|
||||
bool const has = (f == featureDynamicMPT || f == featureFlow);
|
||||
this->BEAST_EXPECT(has == hasFeature(env, f));
|
||||
});
|
||||
}
|
||||
|
||||
auto const missingSomeFeatures =
|
||||
testable_amendments() - featureMultiSignReserve - featureFlow;
|
||||
testable_amendments() - featureDynamicMPT - featureFlow;
|
||||
BEAST_EXPECT(missingSomeFeatures.count() == (supported.count() - 2));
|
||||
{
|
||||
// a Env supported_features_except is missing *only* those features
|
||||
@@ -816,8 +815,7 @@ public:
|
||||
BEAST_EXPECT(
|
||||
env.app().config().features.size() == (supported.count() - 2));
|
||||
foreachFeature(supported, [&](uint256 const& f) {
|
||||
bool hasnot =
|
||||
(f == featureMultiSignReserve || f == featureFlow);
|
||||
bool hasnot = (f == featureDynamicMPT || f == featureFlow);
|
||||
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
|
||||
});
|
||||
}
|
||||
@@ -829,8 +827,8 @@ public:
|
||||
// the two supported ones
|
||||
Env env{
|
||||
*this,
|
||||
FeatureBitset(
|
||||
featureMultiSignReserve, featureFlow, *neverSupportedFeat)};
|
||||
FeatureBitset{
|
||||
featureDynamicMPT, featureFlow, *neverSupportedFeat}};
|
||||
|
||||
// this app will have just 2 supported amendments and
|
||||
// one additional never supported feature flag
|
||||
@@ -838,7 +836,7 @@ public:
|
||||
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
|
||||
|
||||
foreachFeature(supported, [&](uint256 const& f) {
|
||||
bool has = (f == featureMultiSignReserve || f == featureFlow);
|
||||
bool has = (f == featureDynamicMPT || f == featureFlow);
|
||||
this->BEAST_EXPECT(has == hasFeature(env, f));
|
||||
});
|
||||
}
|
||||
@@ -858,8 +856,7 @@ public:
|
||||
(supported.count() - 2 + 1));
|
||||
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
|
||||
foreachFeature(supported, [&](uint256 const& f) {
|
||||
bool hasnot =
|
||||
(f == featureMultiSignReserve || f == featureFlow);
|
||||
bool hasnot = (f == featureDynamicMPT || f == featureFlow);
|
||||
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ Vault::create(CreateArgs const& args)
|
||||
jv[jss::TransactionType] = jss::VaultCreate;
|
||||
jv[jss::Account] = args.owner.human();
|
||||
jv[jss::Asset] = to_json(args.asset);
|
||||
jv[jss::Fee] = STAmount(env.current()->fees().increment).getJson();
|
||||
if (args.flags)
|
||||
jv[jss::Flags] = *args.flags;
|
||||
return {jv, keylet};
|
||||
|
||||
@@ -1612,7 +1612,7 @@ public:
|
||||
// proper lifetime.
|
||||
std::unordered_set<uint256, beast::uhash<>> const presets;
|
||||
Rules const defaultRules{presets};
|
||||
BEAST_EXPECT(!defaultRules.enabled(featureExpandedSignerList));
|
||||
BEAST_EXPECT(!defaultRules.enabled(featureAMM));
|
||||
|
||||
unexpected(
|
||||
!j.checkSign(STTx::RequireFullyCanonicalSig::yes, defaultRules),
|
||||
|
||||
@@ -183,16 +183,16 @@ class Feature_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
Env env{*this};
|
||||
|
||||
auto jrr = env.rpc("feature", "MultiSignReserve")[jss::result];
|
||||
auto jrr = env.rpc("feature", "RequireFullyCanonicalSig")[jss::result];
|
||||
BEAST_EXPECTS(jrr[jss::status] == jss::success, "status");
|
||||
jrr.removeMember(jss::status);
|
||||
BEAST_EXPECT(jrr.size() == 1);
|
||||
BEAST_EXPECT(
|
||||
jrr.isMember("586480873651E106F1D6339B0C4A8945BA705A777F3F4524626FF"
|
||||
"1FC07EFE41D"));
|
||||
jrr.isMember("00C1FC4A53E60AB02C864641002B3172F38677E29C26C54066851"
|
||||
"79B37E1EDAC"));
|
||||
auto feature = *(jrr.begin());
|
||||
|
||||
BEAST_EXPECTS(feature[jss::name] == "MultiSignReserve", "name");
|
||||
BEAST_EXPECTS(feature[jss::name] == "RequireFullyCanonicalSig", "name");
|
||||
BEAST_EXPECTS(!feature[jss::enabled].asBool(), "enabled");
|
||||
BEAST_EXPECTS(
|
||||
feature[jss::vetoed].isBool() && !feature[jss::vetoed].asBool(),
|
||||
@@ -200,7 +200,7 @@ class Feature_test : public beast::unit_test::suite
|
||||
BEAST_EXPECTS(feature[jss::supported].asBool(), "supported");
|
||||
|
||||
// feature names are case-sensitive - expect error here
|
||||
jrr = env.rpc("feature", "multiSignReserve")[jss::result];
|
||||
jrr = env.rpc("feature", "requireFullyCanonicalSig")[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::error] == "badFeature");
|
||||
BEAST_EXPECT(jrr[jss::error_message] == "Feature unknown or invalid.");
|
||||
}
|
||||
@@ -476,8 +476,8 @@ class Feature_test : public beast::unit_test::suite
|
||||
testcase("Veto");
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env{*this, FeatureBitset(featureMultiSignReserve)};
|
||||
constexpr char const* featureName = "MultiSignReserve";
|
||||
Env env{*this, FeatureBitset{featureRequireFullyCanonicalSig}};
|
||||
constexpr char const* featureName = "RequireFullyCanonicalSig";
|
||||
|
||||
auto jrr = env.rpc("feature", featureName)[jss::result];
|
||||
if (!BEAST_EXPECTS(jrr[jss::status] == jss::success, "status"))
|
||||
|
||||
@@ -142,10 +142,6 @@ SetSignerList::preCompute()
|
||||
|
||||
// The return type is signed so it is compatible with the 3rd argument
|
||||
// of adjustOwnerCount() (which must be signed).
|
||||
//
|
||||
// NOTE: This way of computing the OwnerCount associated with a SignerList
|
||||
// is valid until the featureMultiSignReserve amendment passes. Once it
|
||||
// passes then just 1 OwnerCount is associated with a SignerList.
|
||||
static int
|
||||
signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules)
|
||||
{
|
||||
@@ -162,13 +158,13 @@ signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules)
|
||||
// units. A SignerList with 8 entries would cost 10 OwnerCount units.
|
||||
//
|
||||
// The static_cast should always be safe since entryCount should always
|
||||
// be in the range from 1 to 8 (or 32 if ExpandedSignerList is enabled).
|
||||
// be in the range from 1 to 32.
|
||||
// We've got a lot of room to grow.
|
||||
XRPL_ASSERT(
|
||||
entryCount >= STTx::minMultiSigners,
|
||||
"ripple::signerCountBasedOwnerCountDelta : minimum signers");
|
||||
XRPL_ASSERT(
|
||||
entryCount <= STTx::maxMultiSigners(&rules),
|
||||
entryCount <= STTx::maxMultiSigners,
|
||||
"ripple::signerCountBasedOwnerCountDelta : maximum signers");
|
||||
return 2 + static_cast<int>(entryCount);
|
||||
}
|
||||
@@ -250,8 +246,8 @@ SetSignerList::validateQuorumAndSignerEntries(
|
||||
// Reject if there are too many or too few entries in the list.
|
||||
{
|
||||
std::size_t const signerCount = signers.size();
|
||||
if ((signerCount < STTx::minMultiSigners) ||
|
||||
(signerCount > STTx::maxMultiSigners(&rules)))
|
||||
if (signerCount < STTx::minMultiSigners ||
|
||||
signerCount > STTx::maxMultiSigners)
|
||||
{
|
||||
JLOG(j.trace()) << "Too many or too few signers in signer list.";
|
||||
return temMALFORMED;
|
||||
@@ -269,9 +265,6 @@ SetSignerList::validateQuorumAndSignerEntries(
|
||||
return temBAD_SIGNER;
|
||||
}
|
||||
|
||||
// Is the ExpandedSignerList amendment active?
|
||||
bool const expandedSignerList = rules.enabled(featureExpandedSignerList);
|
||||
|
||||
// Make sure no signers reference this account. Also make sure the
|
||||
// quorum can be reached.
|
||||
std::uint64_t allSignersWeight(0);
|
||||
@@ -291,15 +284,6 @@ SetSignerList::validateQuorumAndSignerEntries(
|
||||
JLOG(j.trace()) << "A signer may not self reference account.";
|
||||
return temBAD_SIGNER;
|
||||
}
|
||||
|
||||
if (signer.tag && !expandedSignerList)
|
||||
{
|
||||
JLOG(j.trace()) << "Malformed transaction: sfWalletLocator "
|
||||
"specified in SignerEntry "
|
||||
<< "but featureExpandedSignerList is not enabled.";
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
// Don't verify that the signer accounts exist. Non-existent accounts
|
||||
// may be phantom accounts (which are permitted).
|
||||
}
|
||||
@@ -337,15 +321,8 @@ SetSignerList::replaceSignerList()
|
||||
// Compute new reserve. Verify the account has funds to meet the reserve.
|
||||
std::uint32_t const oldOwnerCount{(*sle)[sfOwnerCount]};
|
||||
|
||||
// The required reserve changes based on featureMultiSignReserve...
|
||||
int addedOwnerCount{1};
|
||||
constexpr int addedOwnerCount = 1;
|
||||
std::uint32_t flags{lsfOneOwnerCount};
|
||||
if (!ctx_.view().rules().enabled(featureMultiSignReserve))
|
||||
{
|
||||
addedOwnerCount = signerCountBasedOwnerCountDelta(
|
||||
signers_.size(), ctx_.view().rules());
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
XRPAmount const newReserve{
|
||||
view().fees().accountReserve(oldOwnerCount + addedOwnerCount)};
|
||||
@@ -415,9 +392,6 @@ SetSignerList::writeSignersToSLE(
|
||||
if (flags) // Only set flags if they are non-default (default is zero).
|
||||
ledgerEntry->setFieldU32(sfFlags, flags);
|
||||
|
||||
bool const expandedSignerList =
|
||||
ctx_.view().rules().enabled(featureExpandedSignerList);
|
||||
|
||||
// Create the SignerListArray one SignerEntry at a time.
|
||||
STArray toLedger(signers_.size());
|
||||
for (auto const& entry : signers_)
|
||||
@@ -429,8 +403,8 @@ SetSignerList::writeSignersToSLE(
|
||||
obj[sfSignerWeight] = entry.weight;
|
||||
|
||||
// This is a defensive check to make absolutely sure we will never write
|
||||
// a tag into the ledger while featureExpandedSignerList is not enabled
|
||||
if (expandedSignerList && entry.tag)
|
||||
// a tag into the ledger.
|
||||
if (entry.tag)
|
||||
obj.setFieldH256(sfWalletLocator, *(entry.tag));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ SignerEntries::deserialize(
|
||||
}
|
||||
|
||||
std::vector<SignerEntry> accountVec;
|
||||
accountVec.reserve(STTx::maxMultiSigners());
|
||||
accountVec.reserve(STTx::maxMultiSigners);
|
||||
|
||||
STArray const& sEntries(obj.getFieldArray(sfSignerEntries));
|
||||
for (STObject const& sEntry : sEntries)
|
||||
|
||||
@@ -143,14 +143,6 @@ preflightCheckSimulateKeys(
|
||||
NotTEC
|
||||
Transactor::preflight1(PreflightContext const& ctx, std::uint32_t flagMask)
|
||||
{
|
||||
// This is inappropriate in preflight0, because only Change transactions
|
||||
// skip this function, and those do not allow an sfTicketSequence field.
|
||||
if (ctx.tx.isFieldPresent(sfTicketSequence) &&
|
||||
!ctx.rules.enabled(featureTicketBatch))
|
||||
{
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfDelegate))
|
||||
{
|
||||
if (!ctx.rules.enabled(featurePermissionDelegationV1_1))
|
||||
@@ -442,8 +434,7 @@ Transactor::checkSeqProxy(
|
||||
|
||||
if (t_seqProx.isSeq())
|
||||
{
|
||||
if (tx.isFieldPresent(sfTicketSequence) &&
|
||||
view.rules().enabled(featureTicketBatch))
|
||||
if (tx.isFieldPresent(sfTicketSequence))
|
||||
{
|
||||
JLOG(j.trace()) << "applyTransaction: has both a TicketSequence "
|
||||
"and a non-zero Sequence number";
|
||||
|
||||
@@ -79,13 +79,6 @@ VaultCreate::preflight(PreflightContext const& ctx)
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
XRPAmount
|
||||
VaultCreate::calculateBaseFee(ReadView const& view, STTx const& tx)
|
||||
{
|
||||
// One reserve increment is typically much greater than one base fee.
|
||||
return calculateOwnerReserveFee(view, tx);
|
||||
}
|
||||
|
||||
TER
|
||||
VaultCreate::preclaim(PreclaimContext const& ctx)
|
||||
{
|
||||
@@ -142,8 +135,9 @@ VaultCreate::doApply()
|
||||
|
||||
if (auto ter = dirLink(view(), account_, vault))
|
||||
return ter;
|
||||
adjustOwnerCount(view(), owner, 1, j_);
|
||||
auto ownerCount = owner->at(sfOwnerCount);
|
||||
// We will create Vault and PseudoAccount, hence increase OwnerCount by 2
|
||||
adjustOwnerCount(view(), owner, 2, j_);
|
||||
auto const ownerCount = owner->at(sfOwnerCount);
|
||||
if (mPriorBalance < view().fees().accountReserve(ownerCount))
|
||||
return tecINSUFFICIENT_RESERVE;
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ public:
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
static XRPAmount
|
||||
calculateBaseFee(ReadView const& view, STTx const& tx);
|
||||
|
||||
static TER
|
||||
preclaim(PreclaimContext const& ctx);
|
||||
|
||||
|
||||
@@ -146,7 +146,35 @@ VaultDelete::doApply()
|
||||
return tecHAS_OBLIGATIONS; // LCOV_EXCL_LINE
|
||||
|
||||
// Destroy the pseudo-account.
|
||||
view().erase(view().peek(keylet::account(pseudoID)));
|
||||
auto vaultPseudoSLE = view().peek(keylet::account(pseudoID));
|
||||
if (!vaultPseudoSLE || vaultPseudoSLE->at(~sfVaultID) != vault->key())
|
||||
return tefBAD_LEDGER; // LCOV_EXCL_LINE
|
||||
|
||||
// Making the payment and removing the empty holding should have deleted any
|
||||
// obligations associated with the vault or vault pseudo-account.
|
||||
if (*vaultPseudoSLE->at(sfBalance))
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
JLOG(j_.error()) << "VaultDelete: pseudo-account has a balance";
|
||||
return tecHAS_OBLIGATIONS;
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
if (vaultPseudoSLE->at(sfOwnerCount) != 0)
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
JLOG(j_.error()) << "VaultDelete: pseudo-account still owns objects";
|
||||
return tecHAS_OBLIGATIONS;
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
if (view().exists(keylet::ownerDir(pseudoID)))
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
JLOG(j_.error()) << "VaultDelete: pseudo-account has a directory";
|
||||
return tecHAS_OBLIGATIONS;
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
view().erase(vaultPseudoSLE);
|
||||
|
||||
// Remove the vault from its owner's directory.
|
||||
auto const ownerID = vault->at(sfOwner);
|
||||
@@ -170,7 +198,9 @@ VaultDelete::doApply()
|
||||
return tefBAD_LEDGER;
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
adjustOwnerCount(view(), owner, -1, j_);
|
||||
|
||||
// We are destroying Vault and PseudoAccount, hence decrease by 2
|
||||
adjustOwnerCount(view(), owner, -2, j_);
|
||||
|
||||
// Destroy the vault.
|
||||
view().erase(vault);
|
||||
|
||||
@@ -822,7 +822,7 @@ getTxFee(Application const& app, Config const& config, Json::Value tx)
|
||||
if (!tx[jss::Signers].isArray())
|
||||
return config.FEES.reference_fee;
|
||||
|
||||
if (tx[jss::Signers].size() > STTx::maxMultiSigners(&ledger->rules()))
|
||||
if (tx[jss::Signers].size() > STTx::maxMultiSigners)
|
||||
return config.FEES.reference_fee;
|
||||
|
||||
// check multi-signed signers
|
||||
|
||||
Reference in New Issue
Block a user