From feb7582aca40e0b660ffd79de645651c7596a92d Mon Sep 17 00:00:00 2001 From: Scott Schurr Date: Thu, 3 Aug 2017 16:26:40 -0700 Subject: [PATCH] Unit tests don't enable Tickets or SHAMapV2 by default: Both Tickets and SHAMapV2 have been around for a while and don't look like they will be enabled on the network soon. So they are removed from the supportedAmendments list. This prevents Env from automatically testing with Tickets or SHAMapV2 enabled, although testing with those features can still be explicitly specified. Drive-by cleanups: o supportedAmendments() returns a const reference rather than a fresh vector on each call. o supportedAmendments() implementation moved from Amendments.cpp to Feature.cpp. Amendments.cpp deleted. o supportedAmendments() declared in Feature.h. All other declarations deleted. o preEnabledAmendments() removed, since it was empty and only used in one place. It will be easy to re-add when it is needed. o jtx::all_features_except() renamed to jtx::supported_features_except(), which is more descriptive. o jtx::all_amendments() renamed to jxt::supported_amendments() o jtx::with_features() renamed to with_only_features() o Env_test.cpp adjusted since featureTickets is no longer automatically enabled for unit tests. --- Builds/VisualStudio2015/RippleD.vcxproj | 4 - .../VisualStudio2015/RippleD.vcxproj.filters | 3 - src/ripple/app/main/Amendments.cpp | 71 ----------- src/ripple/app/main/Application.cpp | 11 +- src/ripple/protocol/Feature.h | 8 +- src/ripple/protocol/impl/Feature.cpp | 33 +++++ src/ripple/unity/app_main1.cpp | 1 - src/test/app/AmendmentTable_test.cpp | 6 - src/test/app/CrossingLimits_test.cpp | 6 +- src/test/app/DeliverMin_test.cpp | 8 +- src/test/app/Discrepancy_test.cpp | 2 +- src/test/app/Escrow_test.cpp | 32 ++--- src/test/app/Flow_test.cpp | 74 +++++------ src/test/app/Freeze_test.cpp | 8 +- src/test/app/MultiSign_test.cpp | 28 ++--- src/test/app/Offer_test.cpp | 118 +++++++++--------- src/test/app/Path_test.cpp | 2 +- src/test/app/PayStrand_test.cpp | 32 ++--- src/test/app/SetAuth_test.cpp | 4 +- src/test/app/Ticket_test.cpp | 22 ++-- src/test/app/TrustAndBalance_test.cpp | 14 +-- src/test/app/TxQ_test.cpp | 8 +- src/test/jtx/Env.h | 34 +++-- src/test/jtx/Env_test.cpp | 34 ++--- src/test/ledger/BookDirs_test.cpp | 2 +- src/test/ledger/Directory_test.cpp | 11 +- src/test/ledger/PaymentSandbox_test.cpp | 10 +- src/test/rpc/AccountInfo_test.cpp | 4 +- src/test/rpc/AccountSet_test.cpp | 20 +-- src/test/rpc/Feature_test.cpp | 4 +- src/test/rpc/GatewayBalances_test.cpp | 2 +- src/test/rpc/JSONRPC_test.cpp | 3 +- src/test/rpc/LedgerData_test.cpp | 2 +- src/test/rpc/NoRipple_test.cpp | 6 +- 34 files changed, 282 insertions(+), 345 deletions(-) delete mode 100644 src/ripple/app/main/Amendments.cpp diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index 66f51f63e8..4ba16d1b5a 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -993,10 +993,6 @@ - - True - True - True True diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index 0c744ed4c8..f2b675c5b5 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -1533,9 +1533,6 @@ ripple\app\ledger - - ripple\app\main - ripple\app\main diff --git a/src/ripple/app/main/Amendments.cpp b/src/ripple/app/main/Amendments.cpp deleted file mode 100644 index ab826d54d3..0000000000 --- a/src/ripple/app/main/Amendments.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#include - -namespace ripple { - -namespace detail { - -/** Amendments that this server supports and enables by default */ -std::vector -preEnabledAmendments () -{ - return - { - }; -} - -/** Amendments that this server supports, but doesn't enable by default */ -std::vector -supportedAmendments () -{ - return - { - { "C6970A8B603D8778783B61C0D445C23D1633CCFAEF0D43E7DBCD1521D34BD7C3 SHAMapV2" }, - { "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373 MultiSign" }, - { "C1B8D934087225F509BEB5A8EC24447854713EE447D277F69545ABFA0E0FD490 Tickets" }, - { "6781F8368C4771B83E8B821D88F580202BCB4228075297B19E4FDC5233F1EFDC TrustSetAuth" }, - { "42426C4D4F1009EE67080A9B7965B44656D7714D104A72F9B4369F97ABF044EE FeeEscalation" }, - // The following will be supported in a future release (and uncommented at that time) - //{ "9178256A980A86CF3D70D0260A7DA6402AAFE43632FDBCB88037978404188871 OwnerPaysFee" }, - { "08DE7D96082187F6E6578530258C77FAABABE4C20474BDB82F04B021F1A68647 PayChan" }, - { "740352F2412A9909880C23A559FCECEDA3BE2126FED62FC7660D628A06927F11 Flow" }, - { "1562511F573A19AE9BD103B5D6B9E01B3B46805AEC5D3C4805C902B514399146 CryptoConditions" }, - { "532651B4FD58DF8922A49BA101AB3E996E5BFBF95A913B3E392504863E63B164 TickSize" }, - { "E2E6F2866106419B88C50045ACE96368558C345566AC8F2BDF5A5B5587F0E6FA fix1368" }, - { "07D43DCE529B15A10827E5E04943B496762F9A88E3268269D69C44BE49E21104 Escrow" }, - { "86E83A7D2ECE3AD5FA87AB2195AE015C950469ABF0B72EAACED318F74886AE90 CryptoConditionsSuite" }, - { "42EEA5E28A97824821D4EF97081FE36A54E9593C6E4F20CBAE098C69D2E072DC fix1373" }, - { "DC9CA96AEA1DCF83E527D1AFC916EFAF5D27388ECA4060A88817C1238CAEE0BF EnforceInvariants" }, - { "3012E8230864E95A58C60FD61430D7E1B4D3353195F2981DC12B0C7C0950FFAC FlowCross" }, - { "CC5ABAE4F3EC92E94A59B1908C2BE82D2228B6485C00AFF8F22DF930D89C194E SortedDirectories" }, - { "B4D44CC3111ADD964E846FC57760C8B50FFCD5A82C86A72756F6B058DDDF96AD fix1201" }, - { "6C92211186613F9647A89DFFBAB8F94C99D4C7E956D495270789128569177DA1 fix1512" }, - { "67A34F2CF55BFC0F93AACD5B281413176FEE195269FA6D95219A2DF738671172 fix1513" }, - { "B9E739B8296B4A1BB29BE990B17D66E21B62A300A909F25AC55C22D6C72E1F9D fix1523" }, - { "1D3463A5891F9E589C5AE839FFAC4A917CE96197098A1EF22304E1BC5B98A454 fix1528" } - }; -} - -} - -} - diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index 946374dccf..360fac71b6 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -204,15 +205,6 @@ public: } }; - -/** Amendments that this server supports and enables by default */ -std::vector -preEnabledAmendments (); - -/** Amendments that this server supports, but doesn't enable by default */ -std::vector -supportedAmendments (); - } // detail //------------------------------------------------------------------------------ @@ -1111,7 +1103,6 @@ bool ApplicationImp::setup() supportedAmendments.append (detail::supportedAmendments ()); Section enabledAmendments = config_->section (SECTION_AMENDMENTS); - enabledAmendments.append (detail::preEnabledAmendments ()); m_amendmentTable = make_AmendmentTable ( weeks{2}, diff --git a/src/ripple/protocol/Feature.h b/src/ripple/protocol/Feature.h index 1cbfea2654..2f6b843d9b 100644 --- a/src/ripple/protocol/Feature.h +++ b/src/ripple/protocol/Feature.h @@ -37,8 +37,8 @@ * 3) add a uint256 definition for the feature to the corresponding source * file (Feature.cpp) * 4) if the feature is going to be supported in the near future, add its - * sha512half value and name (matching exactly the featureName here) to the - * supportedAmendments in Amendments.cpp. + * sha512half value and name (matching exactly the featureName here) to + * the supportedAmendments in Feature.cpp. * */ @@ -98,6 +98,10 @@ public: bitsetIndexToFeature(size_t i) const; }; +/** Amendments that this server supports, but doesn't enable by default */ +std::vector const& +supportedAmendments (); + } // detail boost::optional diff --git a/src/ripple/protocol/impl/Feature.cpp b/src/ripple/protocol/impl/Feature.cpp index 973548bcc8..b825dce846 100644 --- a/src/ripple/protocol/impl/Feature.cpp +++ b/src/ripple/protocol/impl/Feature.cpp @@ -77,6 +77,39 @@ detail::FeatureCollections::bitsetIndexToFeature(size_t i) const static detail::FeatureCollections const featureCollections; +/** Amendments that this server supports, but doesn't enable by default */ +std::vector const& +detail::supportedAmendments () +{ + // Commented out amendments will be supported in a future release (and + // uncommented at that time). + static std::vector const supported + { +// { "C6970A8B603D8778783B61C0D445C23D1633CCFAEF0D43E7DBCD1521D34BD7C3 SHAMapV2" }, + { "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373 MultiSign" }, +// { "C1B8D934087225F509BEB5A8EC24447854713EE447D277F69545ABFA0E0FD490 Tickets" }, + { "6781F8368C4771B83E8B821D88F580202BCB4228075297B19E4FDC5233F1EFDC TrustSetAuth" }, + { "42426C4D4F1009EE67080A9B7965B44656D7714D104A72F9B4369F97ABF044EE FeeEscalation" }, +// { "9178256A980A86CF3D70D0260A7DA6402AAFE43632FDBCB88037978404188871 OwnerPaysFee" }, + { "08DE7D96082187F6E6578530258C77FAABABE4C20474BDB82F04B021F1A68647 PayChan" }, + { "740352F2412A9909880C23A559FCECEDA3BE2126FED62FC7660D628A06927F11 Flow" }, + { "1562511F573A19AE9BD103B5D6B9E01B3B46805AEC5D3C4805C902B514399146 CryptoConditions" }, + { "532651B4FD58DF8922A49BA101AB3E996E5BFBF95A913B3E392504863E63B164 TickSize" }, + { "E2E6F2866106419B88C50045ACE96368558C345566AC8F2BDF5A5B5587F0E6FA fix1368" }, + { "07D43DCE529B15A10827E5E04943B496762F9A88E3268269D69C44BE49E21104 Escrow" }, + { "86E83A7D2ECE3AD5FA87AB2195AE015C950469ABF0B72EAACED318F74886AE90 CryptoConditionsSuite" }, + { "42EEA5E28A97824821D4EF97081FE36A54E9593C6E4F20CBAE098C69D2E072DC fix1373" }, + { "DC9CA96AEA1DCF83E527D1AFC916EFAF5D27388ECA4060A88817C1238CAEE0BF EnforceInvariants" }, + { "3012E8230864E95A58C60FD61430D7E1B4D3353195F2981DC12B0C7C0950FFAC FlowCross" }, + { "CC5ABAE4F3EC92E94A59B1908C2BE82D2228B6485C00AFF8F22DF930D89C194E SortedDirectories" }, + { "B4D44CC3111ADD964E846FC57760C8B50FFCD5A82C86A72756F6B058DDDF96AD fix1201" }, + { "6C92211186613F9647A89DFFBAB8F94C99D4C7E956D495270789128569177DA1 fix1512" }, + { "B9E739B8296B4A1BB29BE990B17D66E21B62A300A909F25AC55C22D6C72E1F9D fix1523" }, + { "1D3463A5891F9E589C5AE839FFAC4A917CE96197098A1EF22304E1BC5B98A454 fix1528" } + }; + return supported; +} + //------------------------------------------------------------------------------ boost::optional diff --git a/src/ripple/unity/app_main1.cpp b/src/ripple/unity/app_main1.cpp index 24610ce220..8f87b32205 100644 --- a/src/ripple/unity/app_main1.cpp +++ b/src/ripple/unity/app_main1.cpp @@ -19,7 +19,6 @@ #include -#include #include #include #include diff --git a/src/test/app/AmendmentTable_test.cpp b/src/test/app/AmendmentTable_test.cpp index e2bc0bc151..3f69d01189 100644 --- a/src/test/app/AmendmentTable_test.cpp +++ b/src/test/app/AmendmentTable_test.cpp @@ -34,12 +34,6 @@ namespace ripple { -namespace detail { -extern -std::vector -supportedAmendments (); -} - class AmendmentTable_test final : public beast::unit_test::suite { private: diff --git a/src/test/app/CrossingLimits_test.cpp b/src/test/app/CrossingLimits_test.cpp index e0085ffff0..32cfa42ed4 100644 --- a/src/test/app/CrossingLimits_test.cpp +++ b/src/test/app/CrossingLimits_test.cpp @@ -47,7 +47,7 @@ public: testStepLimit(std::initializer_list fs) { using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto const xrpMax = XRP(100000000000); auto const gw = Account("gateway"); auto const USD = gw["USD"]; @@ -81,7 +81,7 @@ public: testCrossingLimit(std::initializer_list fs) { using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto const xrpMax = XRP(100000000000); auto const gw = Account("gateway"); auto const USD = gw["USD"]; @@ -110,7 +110,7 @@ public: testStepAndCrossingLimit(std::initializer_list fs) { using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto const xrpMax = XRP(100000000000); auto const gw = Account("gateway"); auto const USD = gw["USD"]; diff --git a/src/test/app/DeliverMin_test.cpp b/src/test/app/DeliverMin_test.cpp index 29ca1225ca..81588d86a9 100644 --- a/src/test/app/DeliverMin_test.cpp +++ b/src/test/app/DeliverMin_test.cpp @@ -38,7 +38,7 @@ public: auto const USD = gw["USD"]; { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), "alice", "bob", "carol", gw); env.trust(USD(100), "alice", "bob", "carol"); env(pay("alice", "bob", USD(10)), delivermin(USD(10)), ter(temBAD_AMOUNT)); @@ -61,7 +61,7 @@ public: } { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), "alice", "bob", gw); env.trust(USD(1000), "alice", "bob"); env(pay(gw, "bob", USD(100))); @@ -73,7 +73,7 @@ public: } { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), "alice", "bob", "carol", gw); env.trust(USD(1000), "bob", "carol"); env(pay(gw, "bob", USD(200))); @@ -91,7 +91,7 @@ public: } { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), "alice", "bob", "carol", "dan", gw); env.trust(USD(1000), "bob", "carol", "dan"); env(pay(gw, "bob", USD(100))); diff --git a/src/test/app/Discrepancy_test.cpp b/src/test/app/Discrepancy_test.cpp index 54927dfc0f..b881f85d60 100644 --- a/src/test/app/Discrepancy_test.cpp +++ b/src/test/app/Discrepancy_test.cpp @@ -41,7 +41,7 @@ class Discrepancy_test : public beast::unit_test::suite { testcase ("Discrepancy test : XRP Discrepancy"); using namespace test::jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; Account A1 {"A1"}; Account A2 {"A2"}; diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index f8df897d2e..915dee7971 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -215,7 +215,7 @@ struct Escrow_test : public beast::unit_test::suite } { // Escrow enabled - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); env.fund(XRP(5000), "alice", "bob"); env(lockup("alice", "bob", XRP(1000), env.now() + 1s)); env.close(); @@ -237,7 +237,7 @@ struct Escrow_test : public beast::unit_test::suite using namespace jtx; using namespace std::chrono; - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); auto const alice = Account("alice"); env.fund(XRP(5000), alice, "bob"); @@ -261,7 +261,7 @@ struct Escrow_test : public beast::unit_test::suite using namespace jtx; using namespace std::chrono; - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); env.fund(XRP(5000), "alice", "bob"); env.close(); @@ -364,7 +364,7 @@ struct Escrow_test : public beast::unit_test::suite using namespace std::chrono; { // Unconditional - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); env.fund(XRP(5000), "alice", "bob"); auto const seq = env.seq("alice"); env(lockup("alice", "alice", XRP(1000), env.now() + 1s)); @@ -379,7 +379,7 @@ struct Escrow_test : public beast::unit_test::suite } { // Conditional - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); env.fund(XRP(5000), "alice", "bob"); auto const seq = env.seq("alice"); env(lockup("alice", "alice", XRP(1000), makeSlice(cb2), env.now() + 1s)); @@ -412,7 +412,7 @@ struct Escrow_test : public beast::unit_test::suite { // Test cryptoconditions Env env(*this, - with_features(featureEscrow)); + with_only_features(featureEscrow)); auto T = [&env](NetClock::duration const& d) { return env.now() + d; }; env.fund(XRP(5000), "alice", "bob", "carol"); @@ -460,7 +460,7 @@ struct Escrow_test : public beast::unit_test::suite { // Test cancel when condition is present Env env(*this, - with_features(featureEscrow)); + with_only_features(featureEscrow)); auto T = [&env](NetClock::duration const& d) { return env.now() + d; }; env.fund(XRP(5000), "alice", "bob", "carol"); @@ -477,7 +477,7 @@ struct Escrow_test : public beast::unit_test::suite } { - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); auto T = [&env](NetClock::duration const& d) { return env.now() + d; }; env.fund(XRP(5000), "alice", "bob", "carol"); @@ -497,7 +497,7 @@ struct Escrow_test : public beast::unit_test::suite } { // Test long & short conditions during creation - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); auto T = [&env](NetClock::duration const& d) { return env.now() + d; }; env.fund(XRP(5000), "alice", "bob", "carol"); @@ -538,7 +538,7 @@ struct Escrow_test : public beast::unit_test::suite { // Test long and short conditions & fulfillments during finish Env env(*this, - with_features(featureEscrow)); + with_only_features(featureEscrow)); auto T = [&env](NetClock::duration const& d) { return env.now() + d; }; env.fund(XRP(5000), "alice", "bob", "carol"); @@ -623,7 +623,7 @@ struct Escrow_test : public beast::unit_test::suite { // Test empty condition during creation and // empty condition & fulfillment during finish - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); auto T = [&env](NetClock::duration const& d) { return env.now() + d; }; env.fund(XRP(5000), "alice", "bob", "carol"); @@ -663,7 +663,7 @@ struct Escrow_test : public beast::unit_test::suite { // Test a condition other than PreimageSha256, which // would require a separate amendment - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); auto T = [&env](NetClock::duration const& d) { return env.now() + d; }; env.fund(XRP(5000), "alice", "bob", "carol"); @@ -696,7 +696,7 @@ struct Escrow_test : public beast::unit_test::suite { testcase ("Metadata & Ownership (without fix1523)"); - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); env.fund(XRP(5000), alice, bruce, carol); auto const seq = env.seq(alice); @@ -718,7 +718,7 @@ struct Escrow_test : public beast::unit_test::suite { testcase ("Metadata (with fix1523, to self)"); - Env env(*this, with_features(featureEscrow, fix1523)); + Env env(*this, with_only_features(featureEscrow, fix1523)); env.fund(XRP(5000), alice, bruce, carol); auto const aseq = env.seq(alice); auto const bseq = env.seq(bruce); @@ -777,7 +777,7 @@ struct Escrow_test : public beast::unit_test::suite { testcase ("Metadata (with fix1523, to other)"); - Env env(*this, with_features(featureEscrow, fix1523)); + Env env(*this, with_only_features(featureEscrow, fix1523)); env.fund(XRP(5000), alice, bruce, carol); auto const aseq = env.seq(alice); auto const bseq = env.seq(bruce); @@ -856,7 +856,7 @@ struct Escrow_test : public beast::unit_test::suite using namespace jtx; using namespace std::chrono; - Env env(*this, with_features(featureEscrow)); + Env env(*this, with_only_features(featureEscrow)); env.memoize("alice"); env.memoize("bob"); diff --git a/src/test/app/Flow_test.cpp b/src/test/app/Flow_test.cpp index 43e719cee1..39ed53e0da 100644 --- a/src/test/app/Flow_test.cpp +++ b/src/test/app/Flow_test.cpp @@ -82,7 +82,7 @@ struct Flow_test : public beast::unit_test::suite auto const USD = gw["USD"]; { // Pay USD, trivial path - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, gw); env.trust (USD (1000), alice, bob); @@ -92,7 +92,7 @@ struct Flow_test : public beast::unit_test::suite } { // XRP transfer - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob); env (pay (alice, bob, XRP (100))); @@ -101,7 +101,7 @@ struct Flow_test : public beast::unit_test::suite } { // Partial payments - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, gw); env.trust (USD (1000), alice, bob); @@ -115,7 +115,7 @@ struct Flow_test : public beast::unit_test::suite } { // Pay by rippling through accounts, use path finder - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, dan); env.trust (USDA (10), bob); @@ -130,7 +130,7 @@ struct Flow_test : public beast::unit_test::suite { // Pay by rippling through accounts, specify path // and charge a transfer fee - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, dan); env.trust (USDA (10), bob); @@ -148,7 +148,7 @@ struct Flow_test : public beast::unit_test::suite { // Pay by rippling through accounts, specify path and transfer fee // Test that the transfer fee is not charged when alice issues - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, dan); env.trust (USDA (10), bob); @@ -164,7 +164,7 @@ struct Flow_test : public beast::unit_test::suite { // test best quality path is taken // Paths: A->B->D->E ; A->C->D->E - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, dan, erin); env.trust (USDA (10), bob, carol); @@ -185,7 +185,7 @@ struct Flow_test : public beast::unit_test::suite } { // Limit quality - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol); env.trust (USDA (10), bob); @@ -222,7 +222,7 @@ struct Flow_test : public beast::unit_test::suite if (!hasFeature(featureFlow, fs) && bobDanQIn < 100 && bobAliceQOut < 100) continue; // Bug in flow v1 - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol, dan); env(trust(bob, USDD(100)), qualityInPercent(bobDanQIn)); env(trust(bob, USDA(100)), qualityOutPercent(bobAliceQOut)); @@ -245,7 +245,7 @@ struct Flow_test : public beast::unit_test::suite // bob -> alice -> carol; vary carolAliceQIn for (auto carolAliceQIn : {80, 100, 120}) { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol); env(trust(bob, USDA(10))); env(trust(carol, USDA(10)), qualityInPercent(carolAliceQIn)); @@ -261,7 +261,7 @@ struct Flow_test : public beast::unit_test::suite // bob -> alice -> carol; bobAliceQOut varies. for (auto bobAliceQOut : {80, 100, 120}) { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol); env(trust(bob, USDA(10)), qualityOutPercent(bobAliceQOut)); env(trust(carol, USDA(10))); @@ -290,7 +290,7 @@ struct Flow_test : public beast::unit_test::suite { // simple IOU/IOU offer - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env.trust (USD (1000), alice, bob, carol); @@ -311,7 +311,7 @@ struct Flow_test : public beast::unit_test::suite } { // simple IOU/XRP XRP/IOU offer - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env.trust (USD (1000), alice, bob, carol); @@ -335,7 +335,7 @@ struct Flow_test : public beast::unit_test::suite } { // simple XRP -> USD through offer and sendmax - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env.trust (USD (1000), alice, bob, carol); @@ -356,7 +356,7 @@ struct Flow_test : public beast::unit_test::suite } { // simple USD -> XRP through offer and sendmax - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env.trust (USD (1000), alice, bob, carol); @@ -377,7 +377,7 @@ struct Flow_test : public beast::unit_test::suite } { // test unfunded offers are removed when payment succeeds - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env.trust (USD (1000), alice, bob, carol); @@ -423,7 +423,7 @@ struct Flow_test : public beast::unit_test::suite // offer. When the payment fails `flow` should return the unfunded // offer. This test is intentionally similar to the one that removes // unfunded offers when the payment succeeds. - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env.trust (USD (1000), alice, bob, carol); @@ -498,7 +498,7 @@ struct Flow_test : public beast::unit_test::suite // Without limits, the 0.4 USD would produce 1000 EUR in the forward // pass. This test checks that the payment produces 1 EUR, as expected. - Env env (*this, with_features (fs)); + Env env (*this, with_only_features (fs)); auto const closeTime = STAmountSO::soTime2 + 100 * env.closed ()->info ().closeTimeResolution; @@ -541,7 +541,7 @@ struct Flow_test : public beast::unit_test::suite { // Simple payment through a gateway with a // transfer rate - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env(rate(gw, 1.25)); @@ -553,7 +553,7 @@ struct Flow_test : public beast::unit_test::suite } { // transfer rate is not charged when issuer is src or dst - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env(rate(gw, 1.25)); @@ -565,7 +565,7 @@ struct Flow_test : public beast::unit_test::suite } { // transfer fee on an offer - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env(rate(gw, 1.25)); @@ -583,7 +583,7 @@ struct Flow_test : public beast::unit_test::suite { // Transfer fee two consecutive offers - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, carol, gw); env(rate(gw, 1.25)); @@ -606,7 +606,7 @@ struct Flow_test : public beast::unit_test::suite { // First pass through a strand redeems, second pass issues, no offers // limiting step is not an endpoint - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); auto const USDA = alice["USD"]; auto const USDB = bob["USD"]; @@ -626,7 +626,7 @@ struct Flow_test : public beast::unit_test::suite { // First pass through a strand redeems, second pass issues, through an offer // limiting step is not an endpoint - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); auto const USDA = alice["USD"]; auto const USDB = bob["USD"]; Account const dan ("dan"); @@ -653,7 +653,7 @@ struct Flow_test : public beast::unit_test::suite { // Offer where the owner is also the issuer, owner pays fee - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, gw); env(rate(gw, 1.25)); @@ -668,7 +668,7 @@ struct Flow_test : public beast::unit_test::suite if (!hasFeature(featureOwnerPaysFee, fs)) { // Offer where the owner is also the issuer, sender pays fee - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); env.fund (XRP (10000), alice, bob, gw); env(rate(gw, 1.25)); @@ -696,7 +696,7 @@ struct Flow_test : public beast::unit_test::suite Account const bob ("bob"); Account const carol ("carol"); - Env env (*this, with_features (fs)); + Env env (*this, with_only_features (fs)); auto const closeTime = fix1141Time() + 100 * env.closed ()->info ().closeTimeResolution; @@ -810,7 +810,7 @@ struct Flow_test : public beast::unit_test::suite auto const USD = gw1["USD"]; auto const EUR = gw2["EUR"]; - Env env (*this, with_features (fs)); + Env env (*this, with_only_features (fs)); auto const closeTime = fix1141Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -884,7 +884,7 @@ struct Flow_test : public beast::unit_test::suite auto const USD = gw1["USD"]; auto const EUR = gw2["EUR"]; - Env env (*this, with_features (fs)); + Env env (*this, with_only_features (fs)); auto const closeTime = fix1141Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -952,7 +952,7 @@ struct Flow_test : public beast::unit_test::suite using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); // Need new behavior from `accountHolds` auto const closeTime = fix1141Time() + @@ -983,7 +983,7 @@ struct Flow_test : public beast::unit_test::suite using namespace jtx; { // Test reverse - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto closeTime = fix1298Time(); if (withFix) closeTime += env.closed()->info().closeTimeResolution; @@ -1015,7 +1015,7 @@ struct Flow_test : public beast::unit_test::suite } { // Test forward - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto closeTime = fix1298Time(); if (withFix) closeTime += env.closed()->info().closeTimeResolution; @@ -1055,7 +1055,7 @@ struct Flow_test : public beast::unit_test::suite testcase("ReexecuteDirectStep"); using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1111,7 +1111,7 @@ struct Flow_test : public beast::unit_test::suite testcase("ripd1443"); using namespace jtx; - Env env(*this, with_features(featureFlow)); + Env env(*this, with_only_features(featureFlow)); auto const timeDelta = env.closed ()->info ().closeTimeResolution; auto const d = withFix ? 100*timeDelta : -100*timeDelta; auto closeTime = fix1443Time() + d; @@ -1164,7 +1164,7 @@ struct Flow_test : public beast::unit_test::suite testcase("ripd1449"); using namespace jtx; - Env env(*this, with_features(featureFlow)); + Env env(*this, with_only_features(featureFlow)); auto const timeDelta = env.closed ()->info ().closeTimeResolution; auto const d = withFix ? 100*timeDelta : -100*timeDelta; auto closeTime = fix1449Time() + d; @@ -1210,7 +1210,7 @@ struct Flow_test : public beast::unit_test::suite using namespace jtx; - Env env(*this, with_features (fs)); + Env env(*this, with_only_features (fs)); auto const ann = Account("ann"); auto const gw = Account("gateway"); @@ -1244,7 +1244,7 @@ struct Flow_test : public beast::unit_test::suite auto const alice = Account("alice"); - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice); diff --git a/src/test/app/Freeze_test.cpp b/src/test/app/Freeze_test.cpp index c79816c0fd..87f76d171e 100644 --- a/src/test/app/Freeze_test.cpp +++ b/src/test/app/Freeze_test.cpp @@ -58,7 +58,7 @@ class Freeze_test : public beast::unit_test::suite testcase("RippleState Freeze"); using namespace test::jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); Account G1 {"G1"}; Account alice {"alice"}; @@ -212,7 +212,7 @@ class Freeze_test : public beast::unit_test::suite testcase("Global Freeze"); using namespace test::jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); Account G1 {"G1"}; Account A1 {"A1"}; @@ -370,7 +370,7 @@ class Freeze_test : public beast::unit_test::suite testcase("No Freeze"); using namespace test::jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); Account G1 {"G1"}; Account A1 {"A1"}; @@ -424,7 +424,7 @@ class Freeze_test : public beast::unit_test::suite testcase("Offers for Frozen Trust Lines"); using namespace test::jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); Account G1 {"G1"}; Account A2 {"A2"}; diff --git a/src/test/app/MultiSign_test.cpp b/src/test/app/MultiSign_test.cpp index 23fdebaf69..f7bfe1ca61 100644 --- a/src/test/app/MultiSign_test.cpp +++ b/src/test/app/MultiSign_test.cpp @@ -39,7 +39,7 @@ public: void test_noReserve() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::secp256k1}; // Pay alice enough to meet the initial reserve, but not enough to @@ -87,7 +87,7 @@ public: void test_signerListSet() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::ed25519}; env.fund(XRP(1000), alice); @@ -132,7 +132,7 @@ public: void test_phantomSigners() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::ed25519}; env.fund(XRP(1000), alice); env.close(); @@ -233,7 +233,7 @@ public: void test_fee () { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::ed25519}; env.fund(XRP(1000), alice); env.close(); @@ -283,7 +283,7 @@ public: void test_misorderedSigners() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::ed25519}; env.fund(XRP(1000), alice); env.close(); @@ -305,7 +305,7 @@ public: void test_masterSigners() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::ed25519}; Account const becky {"becky", KeyType::secp256k1}; Account const cheri {"cheri", KeyType::ed25519}; @@ -357,7 +357,7 @@ public: void test_regularSigners() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::secp256k1}; Account const becky {"becky", KeyType::ed25519}; Account const cheri {"cheri", KeyType::secp256k1}; @@ -415,7 +415,7 @@ public: void test_regularSignersUsingSubmitMulti() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::secp256k1}; Account const becky {"becky", KeyType::ed25519}; Account const cheri {"cheri", KeyType::secp256k1}; @@ -618,7 +618,7 @@ public: void test_heterogeneousSigners() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::secp256k1}; Account const becky {"becky", KeyType::ed25519}; Account const cheri {"cheri", KeyType::secp256k1}; @@ -733,7 +733,7 @@ public: void test_keyDisable() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::ed25519}; env.fund(XRP(1000), alice); @@ -808,7 +808,7 @@ public: void test_regKey() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::secp256k1}; env.fund(XRP(1000), alice); @@ -840,7 +840,7 @@ public: void test_txTypes() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice", KeyType::secp256k1}; Account const becky {"becky", KeyType::ed25519}; Account const zelda {"zelda", KeyType::secp256k1}; @@ -924,7 +924,7 @@ public: // Verify that the text returned for signature failures is correct. using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); // lambda that submits an STTx and returns the resulting JSON. auto submitSTTx = [&env] (STTx const& stx) @@ -1058,7 +1058,7 @@ public: void test_noMultiSigners() { using namespace jtx; - Env env {*this, with_features(featureMultiSign)}; + Env env {*this, with_only_features(featureMultiSign)}; Account const alice {"alice", KeyType::ed25519}; Account const becky {"becky", KeyType::secp256k1}; env.fund(XRP(1000), alice, becky); diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 1cab2f87fe..ff28ba8ca8 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -120,7 +120,7 @@ public: // not used for the payment. using namespace jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -171,7 +171,7 @@ public: testcase ("Removing Canceled Offers"); using namespace jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -241,7 +241,7 @@ public: auto const USD = gw["USD"]; auto const EUR = gw["EUR"]; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; env.fund (XRP (10000), alice, bob, carol, gw); env.trust (USD (1000), alice, bob, carol); @@ -310,7 +310,7 @@ public: if (!withFix && fs.size()) continue; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; auto closeTime = [&] { @@ -391,7 +391,7 @@ public: { // No ripple with an implied account step after an offer - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -420,7 +420,7 @@ public: } { // Make sure payment works with default flags - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -475,7 +475,7 @@ public: // No crossing: { - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -500,7 +500,7 @@ public: // Partial cross: { - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -534,7 +534,7 @@ public: // if an offer were added. Attempt to sell IOUs to // buy XRP. If it fully crosses, we succeed. { - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -600,7 +600,7 @@ public: // Fill or Kill - unless we fully cross, just charge // a fee and not place the offer on the books: { - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -645,7 +645,7 @@ public: // Immediate or Cancel - cross as much as possible // and add nothing on the books: { - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -701,7 +701,7 @@ public: // tfPassive -- place the offer without crossing it. { - Env env (*this, with_features (fs)); + Env env (*this, with_only_features (fs)); auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -758,7 +758,7 @@ public: // tfPassive -- cross only offers of better quality. { - Env env (*this, with_features (fs)); + Env env (*this, with_only_features (fs)); auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -810,7 +810,7 @@ public: auto const alice = Account {"alice"}; auto const USD = gw["USD"]; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -914,7 +914,7 @@ public: Json::StaticString const key ("Expiration"); - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -987,7 +987,7 @@ public: auto const usdOffer = USD (1000); auto const xrpOffer = XRP (1000); - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1053,7 +1053,7 @@ public: auto const USD = gw["USD"]; auto const BTC = gw["BTC"]; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1168,7 +1168,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1255,7 +1255,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1315,7 +1315,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1365,7 +1365,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1398,7 +1398,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1432,7 +1432,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1497,7 +1497,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1530,7 +1530,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1622,7 +1622,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1666,7 +1666,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1718,7 +1718,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1788,7 +1788,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1846,7 +1846,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1886,7 +1886,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1932,7 +1932,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -1980,7 +1980,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -2089,7 +2089,7 @@ public: auto const gw = Account("gateway"); auto const USD = gw["USD"]; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -2251,7 +2251,7 @@ public: auto const usdOffer = USD(1000); auto const xrpOffer = XRP(1000); - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -2336,7 +2336,7 @@ public: auto const usdOffer = USD(1000); auto const eurOffer = EUR(1000); - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -2433,7 +2433,7 @@ public: auto const usdOffer = USD(1000); auto const eurOffer = EUR(1000); - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -2531,7 +2531,7 @@ public: auto const gw = Account("gateway"); auto const USD = gw["USD"]; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -2708,7 +2708,7 @@ public: auto const bob = Account("bob"); auto const USD = gw["USD"]; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -2788,7 +2788,7 @@ public: auto const gw1 = Account("gateway1"); auto const USD = gw1["USD"]; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3113,7 +3113,7 @@ public: auto const gw = Account("gateway"); auto const USD = gw["USD"]; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3176,7 +3176,7 @@ public: auto const USD = gw1["USD"]; auto const EUR = gw2["EUR"]; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3297,7 +3297,7 @@ public: // correctly now. using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3349,7 +3349,8 @@ public: // The problem was identified when featureOwnerPaysFee was enabled, // so make sure that gets included. - Env env {*this, with_features(fs) | with_features(featureOwnerPaysFee)}; + Env env {*this, + with_only_features(fs) | with_only_features(featureOwnerPaysFee)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3427,7 +3428,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3482,7 +3483,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3522,7 +3523,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3571,7 +3572,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3625,7 +3626,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time () + 100 * env.closed ()->info ().closeTimeResolution; @@ -3684,7 +3685,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time() + 100 * env.closed()->info().closeTimeResolution; @@ -3767,7 +3768,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time() + 100 * env.closed()->info().closeTimeResolution; @@ -3919,7 +3920,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time() + 100 * env.closed()->info().closeTimeResolution; @@ -4048,7 +4049,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time() + 100 * env.closed()->info().closeTimeResolution; @@ -4120,7 +4121,7 @@ public: using namespace jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; auto const closeTime = fix1449Time() + 100 * env.closed()->info().closeTimeResolution; @@ -4242,7 +4243,7 @@ public: testcase("RippleConnect Smoketest payment flow"); using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time() + 100 * env.closed()->info().closeTimeResolution; @@ -4335,7 +4336,7 @@ public: using namespace jtx; - Env env {*this, with_features (fs)}; + Env env {*this, with_only_features (fs)}; auto const closeTime = fix1449Time() + 100 * env.closed()->info().closeTimeResolution; @@ -4413,7 +4414,7 @@ public: // Try to set tick size without enabling feature { - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; auto const gw = Account {"gateway"}; env.fund (XRP(10000), gw); @@ -4422,7 +4423,8 @@ public: env(txn, ter(temDISABLED)); } - auto const fsPlus = with_features(fs) | with_features(featureTickSize); + auto const fsPlus = + with_only_features(fs) | with_only_features(featureTickSize); // Try to set tick size out of range { diff --git a/src/test/app/Path_test.cpp b/src/test/app/Path_test.cpp index c119fa3b42..4e768650b6 100644 --- a/src/test/app/Path_test.cpp +++ b/src/test/app/Path_test.cpp @@ -1025,7 +1025,7 @@ public: { testcase("Path Find: CNY"); using namespace jtx; - Env env{*this, all_features_except(featureFlow)}; + Env env{*this, supported_features_except(featureFlow)}; Account A1 {"A1"}; Account A2 {"A2"}; diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 083a700918..c344d25edf 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -632,7 +632,7 @@ struct PayStrandAllPairs_test : public beast::unit_test::suite using RippleCalc = ::ripple::path::RippleCalc; ExistingElementPool eep; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto const closeTime = fix1298Time() + 100 * env.closed()->info().closeTimeResolution; @@ -910,7 +910,7 @@ struct PayStrand_test : public beast::unit_test::suite }; { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, gw); env.trust(USD(1000), alice, bob); env.trust(EUR(1000), alice, bob); @@ -951,7 +951,7 @@ struct PayStrand_test : public beast::unit_test::suite }; { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol, gw); test(env, USD, boost::none, STPath(), terNO_LINE); @@ -1134,7 +1134,7 @@ struct PayStrand_test : public beast::unit_test::suite // cannot have more than one offer with the same output issue using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol, gw); env.trust(USD(10000), alice, bob, carol); @@ -1156,7 +1156,7 @@ struct PayStrand_test : public beast::unit_test::suite } { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, noripple(gw)); env.trust(USD(1000), alice, bob); env(pay(gw, alice, USD(100))); @@ -1165,7 +1165,7 @@ struct PayStrand_test : public beast::unit_test::suite { // check global freeze - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, gw); env.trust(USD(1000), alice, bob); env(pay(gw, alice, USD(100))); @@ -1190,7 +1190,7 @@ struct PayStrand_test : public beast::unit_test::suite } { // Freeze between gw and alice - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, gw); env.trust(USD(1000), alice, bob); env(pay(gw, alice, USD(100))); @@ -1203,7 +1203,7 @@ struct PayStrand_test : public beast::unit_test::suite // check no auth // An account may require authorization to receive IOUs from an // issuer - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, gw); env(fset(gw, asfRequireAuth)); env.trust(USD(1000), alice, bob); @@ -1231,7 +1231,7 @@ struct PayStrand_test : public beast::unit_test::suite } { // Check path with sendMax and node with correct sendMax already set - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, gw); env.trust(USD(1000), alice, bob); env.trust(EUR(1000), alice, bob); @@ -1246,7 +1246,7 @@ struct PayStrand_test : public beast::unit_test::suite { // last step xrp from offer - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, gw); env.trust(USD(1000), alice, bob); env(pay(gw, alice, USD(100))); @@ -1287,7 +1287,7 @@ struct PayStrand_test : public beast::unit_test::suite if (hasFeature(fix1373, fs)) { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, gw); env.trust(USD(1000), alice, bob); @@ -1319,7 +1319,7 @@ struct PayStrand_test : public beast::unit_test::suite } { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol, gw); env.trust(USD(10000), alice, bob, carol); @@ -1337,7 +1337,7 @@ struct PayStrand_test : public beast::unit_test::suite } { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol, gw); env.trust(USD(10000), alice, bob, carol); @@ -1371,7 +1371,7 @@ struct PayStrand_test : public beast::unit_test::suite auto const CNY = gw["CNY"]; { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol, gw); env.trust(USD(10000), alice, bob, carol); @@ -1396,7 +1396,7 @@ struct PayStrand_test : public beast::unit_test::suite ter(expectedResult)); } { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, carol, gw); env.trust(USD(10000), alice, bob, carol); @@ -1431,7 +1431,7 @@ struct PayStrand_test : public beast::unit_test::suite auto const gw = Account("gw"); auto const USD = gw["USD"]; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(10000), alice, bob, gw); STAmount sendMax{USD.issue(), 100, 1}; diff --git a/src/test/app/SetAuth_test.cpp b/src/test/app/SetAuth_test.cpp index 25f8b149e9..930f34ee4d 100644 --- a/src/test/app/SetAuth_test.cpp +++ b/src/test/app/SetAuth_test.cpp @@ -52,13 +52,13 @@ struct SetAuth_test : public beast::unit_test::suite auto const gw = Account("gw"); auto const USD = gw["USD"]; { - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); env.fund(XRP(100000), "alice", gw); env(fset(gw, asfRequireAuth)); env(auth(gw, "alice", "USD"), ter(tecNO_LINE_REDUNDANT)); } { - Env env(*this, with_features(featureTrustSetAuth)); + Env env(*this, with_only_features(featureTrustSetAuth)); env.fund(XRP(100000), "alice", "bob", gw); env(fset(gw, asfRequireAuth)); env(auth(gw, "alice", "USD")); diff --git a/src/test/app/Ticket_test.cpp b/src/test/app/Ticket_test.cpp index 3af7db0d7d..6d275103ca 100644 --- a/src/test/app/Ticket_test.cpp +++ b/src/test/app/Ticket_test.cpp @@ -126,7 +126,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Cancel Nonexistent"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; env (ticket::cancel (env.master, idOne), ter (tecNO_ENTRY)); } @@ -135,7 +135,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create/Cancel Ticket with Bad Fee, Fail Preflight"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; env (ticket::create (env.master), fee (XRP (-1)), ter (temBAD_FEE)); env (ticket::cancel (env.master, idOne), fee (XRP (-1)), ter (temBAD_FEE)); @@ -146,7 +146,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Tickets with Nonexistent Accounts"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; Account alice {"alice"}; env.memoize (alice); @@ -162,7 +162,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Tickets with Same Account and Target"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; env (ticket::create (env.master, env.master)); auto cr = checkTicketMeta (env); @@ -183,7 +183,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Ticket and Then Cancel by Creator"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; // create and verify env (ticket::create (env.master)); @@ -215,7 +215,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Ticket Insufficient Reserve"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; Account alice {"alice"}; env.fund (env.current ()->fees ().accountReserve (0), alice); @@ -229,7 +229,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Ticket and Then Cancel by Target"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; Account alice {"alice"}; env.fund (XRP (10000), alice); @@ -275,7 +275,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Ticket with Future Expiration"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; // create and verify uint32_t expire = @@ -300,7 +300,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Ticket with Zero Expiration"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; // create and verify env (ticket::create (env.master, 0u), ter (temBAD_EXPIRATION)); @@ -311,7 +311,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Ticket with Past Expiration"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; env.timeKeeper ().adjustCloseTime (days {2}); env.close (); @@ -340,7 +340,7 @@ class Ticket_test : public beast::unit_test::suite testcase ("Create Ticket and Allow to Expire"); using namespace test::jtx; - Env env {*this, with_features (featureTickets)}; + Env env {*this, with_only_features (featureTickets)}; // create and verify uint32_t expire = diff --git a/src/test/app/TrustAndBalance_test.cpp b/src/test/app/TrustAndBalance_test.cpp index 7e81c3b350..4f405deb6c 100644 --- a/src/test/app/TrustAndBalance_test.cpp +++ b/src/test/app/TrustAndBalance_test.cpp @@ -51,7 +51,7 @@ class TrustAndBalance_test : public beast::unit_test::suite testcase ("Payment to Nonexistent Account"); using namespace test::jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; env (pay (env.master, "alice", XRP(1)), ter(tecNO_DST_INSUF_XRP)); env.close(); } @@ -167,7 +167,7 @@ class TrustAndBalance_test : public beast::unit_test::suite testcase ("Direct Payment, Ripple"); using namespace test::jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; Account alice {"alice"}; Account bob {"bob"}; @@ -210,7 +210,7 @@ class TrustAndBalance_test : public beast::unit_test::suite (subscribe ? "With " : "Without ") + " Subscribe"); using namespace test::jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; auto wsc = test::makeWSClient(env.app().config()); Account gw {"gateway"}; Account alice {"alice"}; @@ -288,7 +288,7 @@ class TrustAndBalance_test : public beast::unit_test::suite testcase ("Payments With Paths and Fees"); using namespace test::jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; Account gw {"gateway"}; Account alice {"alice"}; Account bob {"bob"}; @@ -336,7 +336,7 @@ class TrustAndBalance_test : public beast::unit_test::suite testcase ("Indirect Payment"); using namespace test::jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; Account gw {"gateway"}; Account alice {"alice"}; Account bob {"bob"}; @@ -378,7 +378,7 @@ class TrustAndBalance_test : public beast::unit_test::suite (with_rate ? "With " : "Without ") + " Xfer Fee, "); using namespace test::jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; Account gw {"gateway"}; Account amazon {"amazon"}; Account alice {"alice"}; @@ -443,7 +443,7 @@ class TrustAndBalance_test : public beast::unit_test::suite testcase ("Set Invoice ID on Payment"); using namespace test::jtx; - Env env {*this, with_features(fs)}; + Env env {*this, with_only_features(fs)}; Account alice {"alice"}; auto wsc = test::makeWSClient(env.app().config()); diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index a11b678ae3..f1dd4c5a7e 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -36,12 +36,6 @@ namespace ripple { -namespace detail { -extern -std::vector -supportedAmendments (); -} - namespace test { class TxQ_test : public beast::unit_test::suite @@ -1568,7 +1562,7 @@ public: { using namespace jtx; using namespace std::chrono; - Env env(*this, with_features(featureTickets)); + Env env(*this, with_only_features(featureTickets)); auto const alice = Account("alice"); env.memoize(alice); env.memoize("bob"); diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index f3f0c3fd1b..757e1c7463 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -56,13 +56,6 @@ namespace ripple { - -namespace detail { -extern -std::vector -supportedAmendments (); -} - namespace test { namespace jtx { @@ -84,7 +77,7 @@ noripple (Account const& account, Args const&... args) */ template FeatureBitset -with_features (uint256 const& key, Args const&... args) +with_only_features (uint256 const& key, Args const&... args) { return makeFeatureBitset( std::array{{key, args...}}); @@ -100,7 +93,7 @@ with_features (uint256 const& key, Args const&... args) */ template FeatureBitset -with_features (Col&& keys) +with_only_features (Col&& keys) { return makeFeatureBitset(std::forward(keys)); } @@ -109,7 +102,7 @@ constexpr FeatureBitset no_features = {}; inline FeatureBitset -all_amendments() +supported_amendments() { static const FeatureBitset ids = []{ auto const& sa = ripple::detail::supportedAmendments(); @@ -137,9 +130,9 @@ all_amendments() */ template FeatureBitset -all_features_except (Col const& keys) +supported_features_except (Col const& keys) { - return all_amendments() & ~makeFeatureBitset(keys); + return supported_amendments() & ~makeFeatureBitset(keys); } /** @@ -152,9 +145,9 @@ all_features_except (Col const& keys) */ template FeatureBitset -all_features_except (uint256 const& key, Args const&... args) +supported_features_except (uint256 const& key, Args const&... args) { - return all_features_except( + return supported_features_except( std::array{{key, args...}}); } @@ -250,8 +243,8 @@ public: * @param suite_ the current unit_test::suite * @param config The desired Config - ownership will be taken by moving * the pointer. See envconfig and related functions for common config tweaks. - * @param args with_features() to explicitly enable or all_features_except() to - * enable all and disable specific features + * @param args with_only_features() to explicitly enable or + * supported_features_except() to enable all and disable specific features. */ // VFALCO Could wrap the suite::log in a Journal here Env (beast::unit_test::suite& suite_, @@ -277,9 +270,9 @@ public: * features. * * This constructor will create an Env with the standard Env configuration - * (from envconfig()) and features explicitly specified. Use with_features(...) - * or all_features_except(...) to create a collection of features appropriate - * for passing here. + * (from envconfig()) and features explicitly specified. Use + * with_only_features(...) or supported_features_except(...) to create a + * collection of features appropriate for passing here. * * @param suite_ the current unit_test::suite * @param args collection of features @@ -305,7 +298,8 @@ public: Env (beast::unit_test::suite& suite_, std::unique_ptr config, std::unique_ptr logs = nullptr) - : Env(suite_, std::move(config), all_amendments(), std::move(logs)) + : Env(suite_, std::move(config), + supported_amendments(), std::move(logs)) { } diff --git a/src/test/jtx/Env_test.cpp b/src/test/jtx/Env_test.cpp index 407d8d110d..9408b2c2d4 100644 --- a/src/test/jtx/Env_test.cpp +++ b/src/test/jtx/Env_test.cpp @@ -301,7 +301,7 @@ public: env(pay(env.master, "alice", XRP(1000)), fee(none), ter(temMALFORMED)); env(pay(env.master, "alice", XRP(1000)), fee(1), ter(telINSUF_FEE_P)); env(pay(env.master, "alice", XRP(1000)), seq(none), ter(temMALFORMED)); - env(pay(env.master, "alice", XRP(1000)), seq(20), ter(terPRE_SEQ)); + env(pay(env.master, "alice", XRP(1000)), seq(20), ter(terPRE_SEQ)); env(pay(env.master, "alice", XRP(1000)), sig(none), ter(temMALFORMED)); env(pay(env.master, "alice", XRP(1000)), sig("bob"), ter(tefBAD_AUTH_MASTER)); @@ -355,7 +355,7 @@ public: { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); env.fund(XRP(10000), "alice"); env(signers("alice", 1, { { "alice", 1 }, { "bob", 2 } }), ter(temBAD_SIGNER)); @@ -384,7 +384,7 @@ public: ticket::create("alice", 60, "bob"); { - Env env(*this, with_features(featureTickets)); + Env env(*this, with_only_features(featureTickets)); env.fund(XRP(10000), "alice"); env(noop("alice"), require(owners("alice", 0), tickets("alice", 0))); env(ticket::create("alice"), require(owners("alice", 1), tickets("alice", 1))); @@ -632,7 +632,7 @@ public: { testcase("Env features"); using namespace jtx; - auto const supported = all_amendments(); + auto const supported = supported_amendments(); // this finds a feature that is not in // the supported amendments list and tests that it can be @@ -655,7 +655,7 @@ public: return; } - auto const neverSupported = with_features(*neverSupportedFeat); + auto const neverSupported = with_only_features(*neverSupportedFeat); auto hasFeature = [](Env& env, uint256 const& f) { @@ -674,22 +674,23 @@ public: } { - // a Env with_features has *only* those features - Env env{*this, with_features(featureEscrow, featureTickets)}; + // a Env with_only_features has *only* those features + Env env{*this, with_only_features(featureEscrow, featureFlow)}; BEAST_EXPECT(env.app().config().features.size() == 2); foreachFeature(supported, [&](uint256 const& f) { - bool const has = (f == featureEscrow || f == featureTickets); + bool const has = (f == featureEscrow || f == featureFlow); this->BEAST_EXPECT(has == hasFeature(env, f)); }); } { - // a Env all_features_except is missing *only* those features - Env env{*this, all_features_except(featureEscrow, featureTickets)}; + // a Env supported_features_except is missing *only* those features + Env env{*this, + supported_features_except(featureEscrow, featureFlow)}; BEAST_EXPECT( env.app().config().features.size() == (supported.count() - 2)); foreachFeature(supported, [&](uint256 const& f) { - bool hasnot = (f == featureEscrow || f == featureTickets); + bool hasnot = (f == featureEscrow || f == featureFlow); this->BEAST_EXPECT(hasnot != hasFeature(env, f)); }); } @@ -701,7 +702,8 @@ public: // the two supported ones Env env{ *this, - with_features(featureEscrow, featureTickets) | neverSupported}; + with_only_features( + featureEscrow, featureFlow) | neverSupported}; // this app will have just 2 supported amendments and // one additional never supported feature flag @@ -709,7 +711,7 @@ public: BEAST_EXPECT(hasFeature(env, *neverSupportedFeat)); foreachFeature(supported, [&](uint256 const& f) { - bool has = (f == featureEscrow || f == featureTickets); + bool has = (f == featureEscrow || f == featureFlow); this->BEAST_EXPECT(has == hasFeature(env, f)); }); } @@ -719,7 +721,7 @@ public: // and omit a few standard amendments // the unsupported features should be enabled Env env{*this, - all_features_except(featureEscrow, featureTickets) | + supported_features_except(featureEscrow, featureFlow) | neverSupported}; // this app will have all supported amendments minus 2 and then the @@ -729,7 +731,7 @@ public: (supported.count() - 2 + 1)); BEAST_EXPECT(hasFeature(env, *neverSupportedFeat)); foreachFeature(supported, [&](uint256 const& f) { - bool hasnot = (f == featureEscrow || f == featureTickets); + bool hasnot = (f == featureEscrow || f == featureFlow); this->BEAST_EXPECT(hasnot != hasFeature(env, f)); }); } @@ -738,7 +740,7 @@ public: // add a feature that is NOT in the supported amendments list // along with all supported amendments // the unsupported features should be enabled - Env env{*this, all_amendments() | neverSupported}; + Env env{*this, supported_amendments() | neverSupported}; // this app will have all supported amendments and then the // one additional never supported feature flag diff --git a/src/test/ledger/BookDirs_test.cpp b/src/test/ledger/BookDirs_test.cpp index 933f24d742..216322c252 100644 --- a/src/test/ledger/BookDirs_test.cpp +++ b/src/test/ledger/BookDirs_test.cpp @@ -28,7 +28,7 @@ struct BookDirs_test : public beast::unit_test::suite void test_bookdir(std::initializer_list fs) { using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto gw = Account("gw"); auto USD = gw["USD"]; env.fund(XRP(1000000), "alice", "bob", "gw"); diff --git a/src/test/ledger/Directory_test.cpp b/src/test/ledger/Directory_test.cpp index 0261c5de06..fe5b5ea13f 100644 --- a/src/test/ledger/Directory_test.cpp +++ b/src/test/ledger/Directory_test.cpp @@ -88,7 +88,7 @@ struct Directory_test : public beast::unit_test::suite { testcase ("Directory Ordering (without 'SortedDirectories' amendment"); - Env env(*this, all_features_except(featureSortedDirectories)); + Env env(*this, supported_features_except(featureSortedDirectories)); env.fund(XRP(10000000), alice, bob, gw); // Insert 400 offers from Alice, then one from Bob: @@ -116,7 +116,7 @@ struct Directory_test : public beast::unit_test::suite { testcase ("Directory Ordering (with 'SortedDirectories' amendment)"); - Env env(*this, with_features(featureSortedDirectories)); + Env env(*this, with_only_features(featureSortedDirectories)); env.fund(XRP(10000000), alice, gw); for (std::size_t i = 1; i <= 400; ++i) @@ -184,7 +184,8 @@ struct Directory_test : public beast::unit_test::suite beast::xor_shift_engine eng; - Env env(*this, with_features(featureSortedDirectories, featureMultiSign)); + Env env(*this, + with_only_features(featureSortedDirectories, featureMultiSign)); env.fund(XRP(1000000), alice, charlie, gw); env.close(); @@ -288,7 +289,7 @@ struct Directory_test : public beast::unit_test::suite testcase("RIPD-1353 Empty Offer Directories"); using namespace jtx; - Env env(*this, with_features(featureSortedDirectories)); + Env env(*this, with_only_features(featureSortedDirectories)); auto const gw = Account{"gateway"}; auto const alice = Account{"alice"}; @@ -348,7 +349,7 @@ struct Directory_test : public beast::unit_test::suite testcase("Empty Chain on Delete"); using namespace jtx; - Env env(*this, with_features(featureSortedDirectories)); + Env env(*this, with_only_features(featureSortedDirectories)); auto const gw = Account{"gateway"}; auto const alice = Account{"alice"}; diff --git a/src/test/ledger/PaymentSandbox_test.cpp b/src/test/ledger/PaymentSandbox_test.cpp index 0ab0efef29..49dc515e81 100644 --- a/src/test/ledger/PaymentSandbox_test.cpp +++ b/src/test/ledger/PaymentSandbox_test.cpp @@ -60,7 +60,7 @@ class PaymentSandbox_test : public beast::unit_test::suite testcase ("selfFunding"); using namespace jtx; - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); Account const gw1 ("gw1"); Account const gw2 ("gw2"); Account const snd ("snd"); @@ -101,7 +101,7 @@ class PaymentSandbox_test : public beast::unit_test::suite testcase ("subtractCredits"); using namespace jtx; - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); Account const gw1 ("gw1"); Account const gw2 ("gw2"); Account const alice ("alice"); @@ -266,7 +266,7 @@ class PaymentSandbox_test : public beast::unit_test::suite using namespace jtx; - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); Account const gw ("gw"); Account const alice ("alice"); @@ -312,7 +312,7 @@ class PaymentSandbox_test : public beast::unit_test::suite return env.current ()->fees ().accountReserve (count); }; - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); Account const alice ("alice"); env.fund (reserve(env, 1), alice); @@ -340,7 +340,7 @@ class PaymentSandbox_test : public beast::unit_test::suite testcase ("balanceHook"); using namespace jtx; - Env env (*this, with_features(fs)); + Env env (*this, with_only_features(fs)); Account const gw ("gw"); auto const USD = gw["USD"]; diff --git a/src/test/rpc/AccountInfo_test.cpp b/src/test/rpc/AccountInfo_test.cpp index 1dc29004d9..c1d83d94ca 100644 --- a/src/test/rpc/AccountInfo_test.cpp +++ b/src/test/rpc/AccountInfo_test.cpp @@ -59,7 +59,7 @@ public: void testSignerLists() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice"}; env.fund(XRP(1000), alice); @@ -165,7 +165,7 @@ public: void testSignerListsV2() { using namespace jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice {"alice"}; env.fund(XRP(1000), alice); diff --git a/src/test/rpc/AccountSet_test.cpp b/src/test/rpc/AccountSet_test.cpp index 7ff5426dc2..88312b767f 100644 --- a/src/test/rpc/AccountSet_test.cpp +++ b/src/test/rpc/AccountSet_test.cpp @@ -237,7 +237,7 @@ public: { testcase ("Setting transfer rate (without fix1201)"); - doTests (all_features_except(fix1201), + doTests (supported_features_except(fix1201), { { 1.0, tesSUCCESS, 1.0 }, { 1.1, tesSUCCESS, 1.1 }, @@ -250,7 +250,7 @@ public: { testcase ("Setting transfer rate (with fix1201)"); - doTests (all_amendments(), + doTests (supported_amendments(), { { 1.0, tesSUCCESS, 1.0 }, { 1.1, tesSUCCESS, 1.1 }, @@ -290,16 +290,16 @@ public: }; // Test gateway with allowed transfer rates - runTest (Env{*this, all_features_except(fix1201)}, 1.02); - runTest (Env{*this, all_features_except(fix1201)}, 1); - runTest (Env{*this, all_features_except(fix1201)}, 2); - runTest (Env{*this, all_features_except(fix1201)}, 2.1); - runTest (Env{*this, all_amendments()}, 1.02); - runTest (Env{*this, all_amendments()}, 2); + runTest (Env{*this, supported_features_except(fix1201)}, 1.02); + runTest (Env{*this, supported_features_except(fix1201)}, 1); + runTest (Env{*this, supported_features_except(fix1201)}, 2); + runTest (Env{*this, supported_features_except(fix1201)}, 2.1); + runTest (Env{*this, supported_amendments()}, 1.02); + runTest (Env{*this, supported_amendments()}, 2); // Test gateway when amendment is set after transfer rate { - Env env (*this, all_features_except(fix1201)); + Env env (*this, supported_features_except(fix1201)); Account const alice ("alice"); Account const bob ("bob"); Account const gw ("gateway"); @@ -371,7 +371,7 @@ public: void testRequireAuthWithDir() { using namespace test::jtx; - Env env(*this, with_features(featureMultiSign)); + Env env(*this, with_only_features(featureMultiSign)); Account const alice ("alice"); Account const bob ("bob"); diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index 7fa2aa12a6..61d4939a03 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -116,7 +116,7 @@ class Feature_test : public beast::unit_test::suite using namespace test::jtx; Env env {*this, - with_features(featureEscrow, featureCryptoConditions)}; + with_only_features(featureEscrow, featureCryptoConditions)}; // The amendment table has to be modified // since that is what feature RPC actually checks env.app().getAmendmentTable().enable(featureEscrow); @@ -220,7 +220,7 @@ class Feature_test : public beast::unit_test::suite using namespace test::jtx; Env env {*this, - with_features(featureCryptoConditions)}; + with_only_features(featureCryptoConditions)}; // The amendment table has to be modified // since that is what feature RPC actually checks env.app().getAmendmentTable().enable(featureCryptoConditions); diff --git a/src/test/rpc/GatewayBalances_test.cpp b/src/test/rpc/GatewayBalances_test.cpp index 73bfa6db76..500e700d4f 100644 --- a/src/test/rpc/GatewayBalances_test.cpp +++ b/src/test/rpc/GatewayBalances_test.cpp @@ -34,7 +34,7 @@ public: { using namespace std::chrono_literals; using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); // Gateway account and assets Account const alice {"alice"}; diff --git a/src/test/rpc/JSONRPC_test.cpp b/src/test/rpc/JSONRPC_test.cpp index 8056ef9f3a..807a38fcf8 100644 --- a/src/test/rpc/JSONRPC_test.cpp +++ b/src/test/rpc/JSONRPC_test.cpp @@ -2254,7 +2254,8 @@ public: // "b" (not in the ledger) is rDg53Haik2475DJx8bjMDSDPj4VX7htaMd. // "c" (phantom signer) is rPcNzota6B8YBokhYtcTNqQVCngtbnWfux. - test::jtx::Env env(*this, test::jtx::with_features(featureMultiSign)); + test::jtx::Env env(*this, + test::jtx::with_only_features(featureMultiSign)); env.fund(test::jtx::XRP(100000), a, ed, g); env.close(); diff --git a/src/test/rpc/LedgerData_test.cpp b/src/test/rpc/LedgerData_test.cpp index dbede8d2e5..2191a642a2 100644 --- a/src/test/rpc/LedgerData_test.cpp +++ b/src/test/rpc/LedgerData_test.cpp @@ -268,7 +268,7 @@ public: using namespace test::jtx; using namespace std::chrono; Env env { *this, envconfig(validator, ""), - with_features(featureMultiSign, featureTickets, + with_only_features(featureMultiSign, featureTickets, featureEscrow, featurePayChan) }; Account const gw { "gateway" }; auto const USD = gw["USD"]; diff --git a/src/test/rpc/NoRipple_test.cpp b/src/test/rpc/NoRipple_test.cpp index cbd7067e12..02bdc1a611 100644 --- a/src/test/rpc/NoRipple_test.cpp +++ b/src/test/rpc/NoRipple_test.cpp @@ -72,7 +72,7 @@ public: testcase("Set noripple on a line with negative balance"); using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto const gw = Account("gateway"); auto const alice = Account("alice"); @@ -118,7 +118,7 @@ public: testcase("pairwise NoRipple"); using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -155,7 +155,7 @@ public: testcase("Set default ripple on an account and check new trustlines"); using namespace jtx; - Env env(*this, with_features(fs)); + Env env(*this, with_only_features(fs)); auto const gw = Account("gateway"); auto const alice = Account("alice");