From ae919ad5b75b2687f13cb3145821484fe0943e40 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Wed, 26 Nov 2025 18:10:13 -0500 Subject: [PATCH] Start fixing the AMMExtended tests --- src/test/app/AMMExtended_test.cpp | 8 ++++++++ src/test/app/AMM_test.cpp | 2 +- src/xrpld/app/paths/detail/AMMLiquidity.cpp | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index 080b392ebe..4391ece609 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -26,6 +26,9 @@ namespace test { */ struct AMMExtended_test : public jtx::AMMTest { + // Use small Number mantissas for the life of this test. + NumberMantissaScaleGuard const sg_{ripple::MantissaRange::small}; + private: void testRmFundedOffer(FeatureBitset features) @@ -42,6 +45,11 @@ private: // funded and not used for the payment. using namespace jtx; + // For now, just disable SAV entirely, which locks in the small Number + // mantissas + features = + features - featureSingleAssetVault /* - featureLendingProtocol */; + Env env{*this, features}; fund( diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index edabd56ce8..2409f3f5bc 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -31,7 +31,7 @@ namespace test { struct AMM_test : public jtx::AMMTest { // Use small Number mantissas for the life of this test. - NumberMantissaScaleGuard sg_{ripple::MantissaRange::small}; + NumberMantissaScaleGuard const sg_{ripple::MantissaRange::small}; private: void diff --git a/src/xrpld/app/paths/detail/AMMLiquidity.cpp b/src/xrpld/app/paths/detail/AMMLiquidity.cpp index 84a039bfc6..b44941df44 100644 --- a/src/xrpld/app/paths/detail/AMMLiquidity.cpp +++ b/src/xrpld/app/paths/detail/AMMLiquidity.cpp @@ -42,9 +42,11 @@ AMMLiquidity::generateFibSeqOffer( { TAmounts cur{}; + Number const initialFibSeqPct = + Number{InitialFibSeqPct.mantissa(), InitialFibSeqPct.exponent()}; cur.in = toAmount( getIssue(balances.in), - InitialFibSeqPct * initialBalances_.in, + initialFibSeqPct * initialBalances_.in, Number::rounding_mode::upward); cur.out = swapAssetIn(initialBalances_, cur.in, tradingFee_);