Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixAMMv1_3 amendment #5203

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/xrpl/basics/IOUAmount.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ class IOUAmount : private boost::totally_ordered<IOUAmount>,

static IOUAmount
minPositiveAmount();

friend std::ostream&
operator<<(std::ostream& os, IOUAmount const& x)
{
return os << to_string(x);
}
};

inline IOUAmount::IOUAmount(beast::Zero)
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/protocol/Feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
// the actual number of amendments. A LogicError on startup will verify this.
static constexpr std::size_t numFeatures = 83;
static constexpr std::size_t numFeatures = 84;

/** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated
Expand Down
3 changes: 3 additions & 0 deletions include/xrpl/protocol/Rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,8 @@ class CurrentTransactionRulesGuard
std::optional<Rules> saved_;
};

bool
isFeatureEnabled(uint256 const& feature);

} // namespace ripple
#endif
3 changes: 2 additions & 1 deletion include/xrpl/protocol/detail/features.macro
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
// If you add an amendment here, then do not forget to increment `numFeatures`
// in include/xrpl/protocol/Feature.h.

XRPL_FIX (AMMv1_3, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Credentials, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(AMMClawback, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMv1_2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo)
// InvariantsV1_1 will be changes to Supported::yes when all the
// invariants expected to be included under it are complete.
XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(InvariantsV1_1, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (NFTokenPageLinks, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (InnerObjTemplate2, Supported::yes, VoteBehavior::DefaultNo)
Expand Down
8 changes: 8 additions & 0 deletions src/libxrpl/protocol/Rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,12 @@ Rules::operator!=(Rules const& other) const
{
return !(*this == other);
}

bool
isFeatureEnabled(uint256 const& feature)
{
auto const rules = getCurrentTransactionRules();
return rules && rules->enabled(feature);
}

} // namespace ripple
553 changes: 409 additions & 144 deletions src/test/app/AMMClawback_test.cpp

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/test/app/AMMExtended_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ struct AMMExtended_test : public jtx::AMMTest
using namespace jtx;
FeatureBitset const all{supported_amendments()};
testRmFundedOffer(all);
testRmFundedOffer(all - fixAMMv1_1);
testRmFundedOffer(all - fixAMMv1_1 - fixAMMv1_3);
testEnforceNoRipple(all);
testFillModes(all);
testOfferCrossWithXRP(all);
Expand All @@ -1458,15 +1458,15 @@ struct AMMExtended_test : public jtx::AMMTest
testOfferCreateThenCross(all);
testSellFlagExceedLimit(all);
testGatewayCrossCurrency(all);
testGatewayCrossCurrency(all - fixAMMv1_1);
testGatewayCrossCurrency(all - fixAMMv1_1 - fixAMMv1_3);
testBridgedCross(all);
testSellWithFillOrKill(all);
testTransferRateOffer(all);
testSelfIssueOffer(all);
testBadPathAssert(all);
testSellFlagBasic(all);
testDirectToDirectPath(all);
testDirectToDirectPath(all - fixAMMv1_1);
testDirectToDirectPath(all - fixAMMv1_1 - fixAMMv1_3);
testRequireAuth(all);
testMissingAuth(all);
}
Expand Down Expand Up @@ -4090,9 +4090,9 @@ struct AMMExtended_test : public jtx::AMMTest
testBookStep(all);
testBookStep(all | ownerPaysFee);
testTransferRate(all | ownerPaysFee);
testTransferRate((all - fixAMMv1_1) | ownerPaysFee);
testTransferRate((all - fixAMMv1_1 - fixAMMv1_3) | ownerPaysFee);
testTransferRateNoOwnerFee(all);
testTransferRateNoOwnerFee(all - fixAMMv1_1);
testTransferRateNoOwnerFee(all - fixAMMv1_1 - fixAMMv1_3);
testLimitQuality();
testXRPPathLoop();
}
Expand All @@ -4103,7 +4103,7 @@ struct AMMExtended_test : public jtx::AMMTest
using namespace jtx;
FeatureBitset const all{supported_amendments()};
testStepLimit(all);
testStepLimit(all - fixAMMv1_1);
testStepLimit(all - fixAMMv1_1 - fixAMMv1_3);
}

void
Expand All @@ -4112,7 +4112,7 @@ struct AMMExtended_test : public jtx::AMMTest
using namespace jtx;
FeatureBitset const all{supported_amendments()};
test_convert_all_of_an_asset(all);
test_convert_all_of_an_asset(all - fixAMMv1_1);
test_convert_all_of_an_asset(all - fixAMMv1_1 - fixAMMv1_3);
}

void
Expand Down
Loading
Loading