mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-03 20:20:59 +00:00
fix: move amendment permutation generation to env
This commit is contained in:
@@ -92,23 +92,6 @@ protected:
|
||||
// even if they are set to unsupported.
|
||||
|
||||
FeatureBitset const all_{jtx::testableAmendments()};
|
||||
|
||||
// All 2^N permutations of `all_` with each subset of the given features
|
||||
// excluded. The first entry is always `all_` itself (empty exclusion);
|
||||
// the last excludes every feature in the list.
|
||||
std::vector<FeatureBitset>
|
||||
amendmentCombinations(std::initializer_list<uint256> features) const
|
||||
{
|
||||
std::vector<FeatureBitset> result{all_};
|
||||
for (auto const& f : features)
|
||||
{
|
||||
auto const n = result.size();
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
result.push_back(result[i] - f);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string const iouCurrency_{"IOU"};
|
||||
|
||||
void
|
||||
@@ -8624,8 +8607,8 @@ public:
|
||||
run() override
|
||||
{
|
||||
runAmendmentIndependent();
|
||||
for (auto const& features :
|
||||
amendmentCombinations({fixCleanup3_1_3, fixCleanup3_2_0, featureMPTokensV2}))
|
||||
for (auto const& features : jtx::amendmentCombinations(
|
||||
{fixCleanup3_1_3, fixCleanup3_2_0, featureMPTokensV2}, all_))
|
||||
runAmendmentSensitive(features);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -96,6 +96,19 @@ testableAmendments()
|
||||
return kIds;
|
||||
}
|
||||
|
||||
inline std::vector<FeatureBitset>
|
||||
amendmentCombinations(std::initializer_list<uint256> features, FeatureBitset seed)
|
||||
{
|
||||
std::vector<FeatureBitset> result{seed};
|
||||
for (auto const& f : features)
|
||||
{
|
||||
auto const n = result.size();
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
result.push_back(result[i] - f);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class SuiteLogs : public Logs
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <xrpld/rpc/RPCCall.h>
|
||||
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
#include <xrpl/basics/contract.h>
|
||||
#include <xrpl/basics/strHex.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
@@ -12,7 +11,6 @@
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/protocol/AccountID.h>
|
||||
#include <xrpl/protocol/ErrorCodes.h>
|
||||
#include <xrpl/protocol/Feature.h>
|
||||
#include <xrpl/protocol/HashPrefix.h>
|
||||
#include <xrpl/protocol/Indexes.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
@@ -23,8 +21,6 @@
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -104,18 +100,4 @@ cmdToJSONRPC(std::vector<std::string> const& args, beast::Journal j, unsigned in
|
||||
jv[jss::id] = paramsObj[jss::id];
|
||||
return jv;
|
||||
}
|
||||
|
||||
std::vector<FeatureBitset>
|
||||
amendmentCombinations(std::initializer_list<uint256> features, FeatureBitset seed)
|
||||
{
|
||||
std::vector<FeatureBitset> result{seed};
|
||||
for (auto const& f : features)
|
||||
{
|
||||
auto const n = result.size();
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
result.push_back(result[i] - f);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace xrpl::test::jtx
|
||||
|
||||
@@ -62,9 +62,5 @@ cmdToJSONRPC(std::vector<std::string> const& args, beast::Journal j, unsigned in
|
||||
* Useful for running a test over every combination of optional amendments
|
||||
* so that each case is exercised both with and without each feature.
|
||||
*/
|
||||
std::vector<FeatureBitset>
|
||||
amendmentCombinations(
|
||||
std::initializer_list<uint256> features,
|
||||
FeatureBitset seed = testableAmendments());
|
||||
|
||||
} // namespace xrpl::test::jtx
|
||||
|
||||
Reference in New Issue
Block a user