mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Compare commits
2 Commits
ximinez/le
...
a1q123456/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5158182f7 | ||
|
|
5ee23d92dd |
@@ -65,11 +65,9 @@ XRPL_FIX (UniversalNumber, Supported::yes, VoteBehavior::DefaultNo
|
|||||||
XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FEATURE(DisallowIncoming, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FEATURE(DisallowIncoming, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(FlowSortStrands, Supported::yes, VoteBehavior::DefaultYes)
|
|
||||||
XRPL_FEATURE(RequireFullyCanonicalSig, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FEATURE(RequireFullyCanonicalSig, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(DeletableAccounts, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FEATURE(DeletableAccounts, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(Checks, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FEATURE(Checks, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(Flow, Supported::yes, VoteBehavior::DefaultYes)
|
|
||||||
|
|
||||||
// The following amendments are obsolete, but must remain supported
|
// The following amendments are obsolete, but must remain supported
|
||||||
// because they could potentially get enabled.
|
// because they could potentially get enabled.
|
||||||
@@ -124,7 +122,9 @@ XRPL_RETIRE_FEATURE(Escrow)
|
|||||||
XRPL_RETIRE_FEATURE(EnforceInvariants)
|
XRPL_RETIRE_FEATURE(EnforceInvariants)
|
||||||
XRPL_RETIRE_FEATURE(ExpandedSignerList)
|
XRPL_RETIRE_FEATURE(ExpandedSignerList)
|
||||||
XRPL_RETIRE_FEATURE(FeeEscalation)
|
XRPL_RETIRE_FEATURE(FeeEscalation)
|
||||||
|
XRPL_RETIRE_FEATURE(Flow)
|
||||||
XRPL_RETIRE_FEATURE(FlowCross)
|
XRPL_RETIRE_FEATURE(FlowCross)
|
||||||
|
XRPL_RETIRE_FEATURE(FlowSortStrands)
|
||||||
XRPL_RETIRE_FEATURE(HardenedValidations)
|
XRPL_RETIRE_FEATURE(HardenedValidations)
|
||||||
XRPL_RETIRE_FEATURE(ImmediateOfferKilled)
|
XRPL_RETIRE_FEATURE(ImmediateOfferKilled)
|
||||||
XRPL_RETIRE_FEATURE(MultiSign)
|
XRPL_RETIRE_FEATURE(MultiSign)
|
||||||
|
|||||||
@@ -267,9 +267,8 @@ public:
|
|||||||
// strand dry until the liquidity is actually used)
|
// strand dry until the liquidity is actually used)
|
||||||
|
|
||||||
// The implementation allows any single step to consume at most 1000
|
// The implementation allows any single step to consume at most 1000
|
||||||
// offers. With the `FlowSortStrands` feature enabled, if the total
|
// offers.If the total number of offers consumed by all the steps
|
||||||
// number of offers consumed by all the steps combined exceeds 1500, the
|
// combined exceeds 1500, the payment stops.
|
||||||
// payment stops.
|
|
||||||
{
|
{
|
||||||
Env env(*this, features);
|
Env env(*this, features);
|
||||||
|
|
||||||
@@ -457,16 +456,12 @@ public:
|
|||||||
// below the limit. However, if all the offers are consumed it would
|
// below the limit. However, if all the offers are consumed it would
|
||||||
// create a tecOVERSIZE error.
|
// create a tecOVERSIZE error.
|
||||||
|
|
||||||
// The featureFlowSortStrands introduces a way of tracking the total
|
|
||||||
// number of consumed offers; with this feature the transaction no
|
|
||||||
// longer fails with a tecOVERSIZE error.
|
|
||||||
// The implementation allows any single step to consume at most 1000
|
// The implementation allows any single step to consume at most 1000
|
||||||
// offers. With the `FlowSortStrands` feature enabled, if the total
|
// offers. If the total number of offers consumed by all the steps
|
||||||
// number of offers consumed by all the steps combined exceeds 1500, the
|
// combined exceeds 1500, the payment stops. Since the first set of
|
||||||
// payment stops. Since the first set of offers consumes 998 offers, the
|
// offers consumes 998 offers, the second set will consume 998, which is
|
||||||
// second set will consume 998, which is not over the limit and the
|
// not over the limit and the payment stops. So 2*998, or 1996 is the
|
||||||
// payment stops. So 2*998, or 1996 is the expected value when
|
// expected value.
|
||||||
// `FlowSortStrands` is enabled.
|
|
||||||
n_offers(env, 998, alice, XRP(1.00), USD(1));
|
n_offers(env, 998, alice, XRP(1.00), USD(1));
|
||||||
n_offers(env, 998, alice, XRP(0.99), USD(1));
|
n_offers(env, 998, alice, XRP(0.99), USD(1));
|
||||||
n_offers(env, 998, alice, XRP(0.98), USD(1));
|
n_offers(env, 998, alice, XRP(0.98), USD(1));
|
||||||
@@ -474,22 +469,12 @@ public:
|
|||||||
n_offers(env, 998, alice, XRP(0.96), USD(1));
|
n_offers(env, 998, alice, XRP(0.96), USD(1));
|
||||||
n_offers(env, 998, alice, XRP(0.95), USD(1));
|
n_offers(env, 998, alice, XRP(0.95), USD(1));
|
||||||
|
|
||||||
bool const withSortStrands = features[featureFlowSortStrands];
|
auto const expectedTER = tesSUCCESS;
|
||||||
|
|
||||||
auto const expectedTER = [&]() -> TER {
|
|
||||||
if (!withSortStrands)
|
|
||||||
return TER{tecOVERSIZE};
|
|
||||||
return tesSUCCESS;
|
|
||||||
}();
|
|
||||||
|
|
||||||
env(offer(bob, USD(8000), XRP(8000)), ter(expectedTER));
|
env(offer(bob, USD(8000), XRP(8000)), ter(expectedTER));
|
||||||
env.close();
|
env.close();
|
||||||
|
|
||||||
auto const expectedUSD = [&] {
|
auto const expectedUSD = USD(1996);
|
||||||
if (!withSortStrands)
|
|
||||||
return USD(0);
|
|
||||||
return USD(1996);
|
|
||||||
}();
|
|
||||||
|
|
||||||
env.require(balance(bob, expectedUSD));
|
env.require(balance(bob, expectedUSD));
|
||||||
}
|
}
|
||||||
@@ -507,9 +492,7 @@ public:
|
|||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
auto const sa = testable_amendments();
|
auto const sa = testable_amendments();
|
||||||
testAll(sa);
|
testAll(sa);
|
||||||
testAll(sa - featureFlowSortStrands);
|
|
||||||
testAll(sa - featurePermissionedDEX);
|
testAll(sa - featurePermissionedDEX);
|
||||||
testAll(sa - featureFlowSortStrands - featurePermissionedDEX);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4330,7 +4330,7 @@ public:
|
|||||||
Account const ellie("ellie");
|
Account const ellie("ellie");
|
||||||
Account const fiona("fiona");
|
Account const fiona("fiona");
|
||||||
|
|
||||||
constexpr int ledgersInQueue = 10;
|
constexpr int ledgersInQueue = 20;
|
||||||
auto cfg = makeConfig(
|
auto cfg = makeConfig(
|
||||||
{{"minimum_txn_in_ledger_standalone", "1"},
|
{{"minimum_txn_in_ledger_standalone", "1"},
|
||||||
{"ledgers_in_queue", std::to_string(ledgersInQueue)},
|
{"ledgers_in_queue", std::to_string(ledgersInQueue)},
|
||||||
|
|||||||
@@ -798,16 +798,18 @@ public:
|
|||||||
|
|
||||||
{
|
{
|
||||||
// a Env FeatureBitset has *only* those features
|
// a Env FeatureBitset has *only* those features
|
||||||
Env env{*this, FeatureBitset{featureDynamicMPT | featureFlow}};
|
Env env{
|
||||||
|
*this, FeatureBitset{featureDynamicMPT | featureTokenEscrow}};
|
||||||
BEAST_EXPECT(env.app().config().features.size() == 2);
|
BEAST_EXPECT(env.app().config().features.size() == 2);
|
||||||
foreachFeature(supported, [&](uint256 const& f) {
|
foreachFeature(supported, [&](uint256 const& f) {
|
||||||
bool const has = (f == featureDynamicMPT || f == featureFlow);
|
bool const has =
|
||||||
|
(f == featureDynamicMPT || f == featureTokenEscrow);
|
||||||
this->BEAST_EXPECT(has == hasFeature(env, f));
|
this->BEAST_EXPECT(has == hasFeature(env, f));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const missingSomeFeatures =
|
auto const missingSomeFeatures =
|
||||||
testable_amendments() - featureDynamicMPT - featureFlow;
|
testable_amendments() - featureDynamicMPT - featureTokenEscrow;
|
||||||
BEAST_EXPECT(missingSomeFeatures.count() == (supported.count() - 2));
|
BEAST_EXPECT(missingSomeFeatures.count() == (supported.count() - 2));
|
||||||
{
|
{
|
||||||
// a Env supported_features_except is missing *only* those features
|
// a Env supported_features_except is missing *only* those features
|
||||||
@@ -815,7 +817,8 @@ public:
|
|||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
env.app().config().features.size() == (supported.count() - 2));
|
env.app().config().features.size() == (supported.count() - 2));
|
||||||
foreachFeature(supported, [&](uint256 const& f) {
|
foreachFeature(supported, [&](uint256 const& f) {
|
||||||
bool hasnot = (f == featureDynamicMPT || f == featureFlow);
|
bool hasnot =
|
||||||
|
(f == featureDynamicMPT || f == featureTokenEscrow);
|
||||||
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
|
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -828,7 +831,9 @@ public:
|
|||||||
Env env{
|
Env env{
|
||||||
*this,
|
*this,
|
||||||
FeatureBitset{
|
FeatureBitset{
|
||||||
featureDynamicMPT, featureFlow, *neverSupportedFeat}};
|
featureDynamicMPT,
|
||||||
|
featureTokenEscrow,
|
||||||
|
*neverSupportedFeat}};
|
||||||
|
|
||||||
// this app will have just 2 supported amendments and
|
// this app will have just 2 supported amendments and
|
||||||
// one additional never supported feature flag
|
// one additional never supported feature flag
|
||||||
@@ -836,7 +841,7 @@ public:
|
|||||||
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
|
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
|
||||||
|
|
||||||
foreachFeature(supported, [&](uint256 const& f) {
|
foreachFeature(supported, [&](uint256 const& f) {
|
||||||
bool has = (f == featureDynamicMPT || f == featureFlow);
|
bool has = (f == featureDynamicMPT || f == featureTokenEscrow);
|
||||||
this->BEAST_EXPECT(has == hasFeature(env, f));
|
this->BEAST_EXPECT(has == hasFeature(env, f));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -856,7 +861,8 @@ public:
|
|||||||
(supported.count() - 2 + 1));
|
(supported.count() - 2 + 1));
|
||||||
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
|
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
|
||||||
foreachFeature(supported, [&](uint256 const& f) {
|
foreachFeature(supported, [&](uint256 const& f) {
|
||||||
bool hasnot = (f == featureDynamicMPT || f == featureFlow);
|
bool hasnot =
|
||||||
|
(f == featureDynamicMPT || f == featureTokenEscrow);
|
||||||
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
|
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class Feature_test : public beast::unit_test::suite
|
|||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
featureToName(fixRemoveNFTokenAutoTrustLine) ==
|
featureToName(fixRemoveNFTokenAutoTrustLine) ==
|
||||||
"fixRemoveNFTokenAutoTrustLine");
|
"fixRemoveNFTokenAutoTrustLine");
|
||||||
BEAST_EXPECT(featureToName(featureFlow) == "Flow");
|
BEAST_EXPECT(featureToName(featureBatch) == "Batch");
|
||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
featureToName(featureDeletableAccounts) == "DeletableAccounts");
|
featureToName(featureDeletableAccounts) == "DeletableAccounts");
|
||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
|
|||||||
@@ -43,15 +43,6 @@ RippleCalc::rippleCalculate(
|
|||||||
PaymentSandbox flowSB(&view);
|
PaymentSandbox flowSB(&view);
|
||||||
auto j = l.journal("Flow");
|
auto j = l.journal("Flow");
|
||||||
|
|
||||||
if (!view.rules().enabled(featureFlow))
|
|
||||||
{
|
|
||||||
// The new payment engine was enabled several years ago. New transaction
|
|
||||||
// should never use the old rules. Assume this is a replay
|
|
||||||
j.fatal()
|
|
||||||
<< "Old payment rules are required for this transaction. Assuming "
|
|
||||||
"this is a replay and running with the new rules.";
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
bool const defaultPaths =
|
bool const defaultPaths =
|
||||||
!pInputs ? true : pInputs->defaultPathsAllowed;
|
!pInputs ? true : pInputs->defaultPathsAllowed;
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ public:
|
|||||||
// add the strands in `next_` to `cur_`, sorted by theoretical quality.
|
// add the strands in `next_` to `cur_`, sorted by theoretical quality.
|
||||||
// Best quality first.
|
// Best quality first.
|
||||||
cur_.clear();
|
cur_.clear();
|
||||||
if (v.rules().enabled(featureFlowSortStrands) && !next_.empty())
|
if (!next_.empty())
|
||||||
{
|
{
|
||||||
std::vector<std::pair<Quality, Strand const*>> strandQuals;
|
std::vector<std::pair<Quality, Strand const*>> strandQuals;
|
||||||
strandQuals.reserve(next_.size());
|
strandQuals.reserve(next_.size());
|
||||||
@@ -719,8 +719,6 @@ flow(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baseView.rules().enabled(featureFlowSortStrands))
|
|
||||||
{
|
|
||||||
XRPL_ASSERT(!best, "ripple::flow : best is unset");
|
XRPL_ASSERT(!best, "ripple::flow : best is unset");
|
||||||
if (!f.inactive)
|
if (!f.inactive)
|
||||||
activeStrands.push(strand);
|
activeStrands.push(strand);
|
||||||
@@ -729,36 +727,8 @@ flow(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
activeStrands.push(strand);
|
bool const shouldBreak =
|
||||||
|
!best || offersConsidered >= maxOffersToConsider;
|
||||||
if (!best || best->quality < q ||
|
|
||||||
(best->quality == q && best->out < f.out))
|
|
||||||
{
|
|
||||||
// If this strand is inactive (because it consumed too many
|
|
||||||
// offers) and ends up having the best quality, remove it
|
|
||||||
// from the activeStrands. If it doesn't end up having the
|
|
||||||
// best quality, keep it active.
|
|
||||||
|
|
||||||
if (f.inactive)
|
|
||||||
{
|
|
||||||
// This should be `nextSize`, not `size`. This issue is
|
|
||||||
// fixed in featureFlowSortStrands.
|
|
||||||
markInactiveOnUse = activeStrands.size() - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
markInactiveOnUse.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
best.emplace(f.in, f.out, std::move(*f.sandbox), *strand, q);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool const shouldBreak = [&] {
|
|
||||||
if (baseView.rules().enabled(featureFlowSortStrands))
|
|
||||||
return !best || offersConsidered >= maxOffersToConsider;
|
|
||||||
return !best;
|
|
||||||
}();
|
|
||||||
|
|
||||||
if (best)
|
if (best)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user