mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
Cherry-pick XRPFees bugfix
This commit is contained in:
@@ -333,7 +333,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathMinimalFirstXRPNoTrustline)
|
||||
AMM_ACCOUNT, "XRP", ripple::toBase58(ripple::xrpAccount()), "JPY", AMM_ACCOUNT2, LP_ISSUE_CURRENCY
|
||||
);
|
||||
accountRoot.setFieldH256(ripple::sfAMMID, ammKey);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
|
||||
ON_CALL(*backend, fetchLedgerBySequence).WillByDefault(Return(lgrInfo));
|
||||
ON_CALL(*backend, doFetchLedgerObject(GetAccountKey(account1), testing::_, testing::_))
|
||||
@@ -410,7 +410,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathWithAccount)
|
||||
);
|
||||
auto const lptCurrency = CreateLPTCurrency("XRP", "JPY");
|
||||
auto const accountHoldsKeylet = ripple::keylet::line(account2, account2, lptCurrency);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const trustline = CreateRippleStateLedgerObject(
|
||||
LP_ISSUE_CURRENCY, AMM_ACCOUNT, 12, AMM_ACCOUNT2, 1000, AMM_ACCOUNT, 2000, INDEX1, 2
|
||||
);
|
||||
@@ -491,7 +491,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathMinimalSecondXRPNoTrustline)
|
||||
AMM_ACCOUNT, "JPY", AMM_ACCOUNT2, "XRP", ripple::toBase58(ripple::xrpAccount()), LP_ISSUE_CURRENCY
|
||||
);
|
||||
accountRoot.setFieldH256(ripple::sfAMMID, ammKey);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
|
||||
ON_CALL(*backend, fetchLedgerBySequence).WillByDefault(Return(lgrInfo));
|
||||
ON_CALL(*backend, doFetchLedgerObject(GetAccountKey(account1), testing::_, testing::_))
|
||||
@@ -563,7 +563,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathNonXRPNoTrustlines)
|
||||
auto accountRoot = CreateAccountRootObject(AMM_ACCOUNT, 0, 2, 200, 2, INDEX1, 2);
|
||||
auto ammObj = CreateAMMObject(AMM_ACCOUNT, "USD", AMM_ACCOUNT, "JPY", AMM_ACCOUNT2, LP_ISSUE_CURRENCY);
|
||||
accountRoot.setFieldH256(ripple::sfAMMID, ammKey);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
|
||||
ON_CALL(*backend, fetchLedgerBySequence).WillByDefault(Return(lgrInfo));
|
||||
ON_CALL(*backend, doFetchLedgerObject(GetAccountKey(account1), testing::_, testing::_))
|
||||
@@ -643,7 +643,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathFrozen)
|
||||
auto accountRoot = CreateAccountRootObject(AMM_ACCOUNT, 0, 2, 200, 2, INDEX1, 2);
|
||||
auto ammObj = CreateAMMObject(AMM_ACCOUNT, "USD", AMM_ACCOUNT, "JPY", AMM_ACCOUNT2, LP_ISSUE_CURRENCY);
|
||||
accountRoot.setFieldH256(ripple::sfAMMID, ammKey);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
|
||||
// note: frozen flag will not be used for trustline1 because issuer == account
|
||||
auto const trustline1BalanceFrozen = CreateRippleStateLedgerObject(
|
||||
@@ -735,7 +735,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathFrozenIssuer)
|
||||
auto accountRoot = CreateAccountRootObject(AMM_ACCOUNT, ripple::lsfGlobalFreeze, 2, 200, 2, INDEX1, 2);
|
||||
auto ammObj = CreateAMMObject(AMM_ACCOUNT, "USD", AMM_ACCOUNT, "JPY", AMM_ACCOUNT2, LP_ISSUE_CURRENCY);
|
||||
accountRoot.setFieldH256(ripple::sfAMMID, ammKey);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
|
||||
// note: frozen flag will not be used for trustline1 because issuer == account
|
||||
auto const trustline1BalanceFrozen = CreateRippleStateLedgerObject(
|
||||
@@ -827,7 +827,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathWithTrustline)
|
||||
AMM_ACCOUNT, "XRP", ripple::toBase58(ripple::xrpAccount()), "JPY", AMM_ACCOUNT2, LP_ISSUE_CURRENCY
|
||||
);
|
||||
accountRoot.setFieldH256(ripple::sfAMMID, ammKey);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const trustlineBalance =
|
||||
CreateRippleStateLedgerObject("JPY", AMM_ACCOUNT2, -8, AMM_ACCOUNT, 1000, AMM_ACCOUNT2, 2000, INDEX2, 2, 0);
|
||||
|
||||
@@ -906,7 +906,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathWithVoteSlots)
|
||||
AMMAddVoteSlot(ammObj, account1, 2, 4);
|
||||
AMMAddVoteSlot(ammObj, account2, 4, 2);
|
||||
accountRoot.setFieldH256(ripple::sfAMMID, ammKey);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const trustlineBalance =
|
||||
CreateRippleStateLedgerObject("JPY", AMM_ACCOUNT2, -8, AMM_ACCOUNT, 1000, AMM_ACCOUNT2, 2000, INDEX2, 2, 0);
|
||||
|
||||
@@ -1001,7 +1001,7 @@ TEST_F(RPCAMMInfoHandlerTest, HappyPathWithAuctionSlot)
|
||||
);
|
||||
|
||||
accountRoot.setFieldH256(ripple::sfAMMID, ammKey);
|
||||
auto const feesObj = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feesObj = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const trustlineBalance =
|
||||
CreateRippleStateLedgerObject("JPY", AMM_ACCOUNT2, -8, AMM_ACCOUNT, 1000, AMM_ACCOUNT2, 2000, INDEX2, 2, 0);
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ TEST_F(RPCAccountInfoHandlerTest, AccountInvalid)
|
||||
|
||||
ON_CALL(*backend, fetchLedgerBySequence).WillByDefault(Return(ledgerinfo));
|
||||
// return a valid ledger object but not account root
|
||||
ON_CALL(*backend, doFetchLedgerObject).WillByDefault(Return(CreateFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
ON_CALL(*backend, doFetchLedgerObject).WillByDefault(Return(CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).Times(1);
|
||||
|
||||
auto static const input = json::parse(fmt::format(
|
||||
@@ -292,7 +292,7 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsInvalid)
|
||||
.WillByDefault(Return(accountRoot.getSerializer().peekData()));
|
||||
auto signersKey = ripple::keylet::signers(account).key;
|
||||
ON_CALL(*backend, doFetchLedgerObject(signersKey, 30, _))
|
||||
.WillByDefault(Return(CreateFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
.WillByDefault(Return(CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::amendments().key, 30, _))
|
||||
.WillByDefault(Return(CreateAmendmentsObject({}).getSerializer().peekData()));
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).Times(4);
|
||||
|
||||
@@ -644,7 +644,7 @@ generateNormalPathBookOffersTestBundles()
|
||||
ACCOUNT
|
||||
);
|
||||
|
||||
auto const feeLedgerObject = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feeLedgerObject = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
|
||||
auto const trustline30Balance =
|
||||
CreateRippleStateLedgerObject("USD", ACCOUNT, -30, ACCOUNT2, 1000, ACCOUNT, 2000, INDEX1, 2, 0);
|
||||
@@ -1303,7 +1303,7 @@ TEST_F(RPCBookOffersHandlerTest, Limit)
|
||||
.WillByDefault(Return(CreateAccountRootObject(ACCOUNT2, 0, 2, 200, 2, INDEX1, 2).getSerializer().peekData()));
|
||||
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, seq, _))
|
||||
.WillByDefault(Return(CreateFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
.WillByDefault(Return(CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::account(issuer).key, seq, _))
|
||||
.WillByDefault(
|
||||
@@ -1377,7 +1377,7 @@ TEST_F(RPCBookOffersHandlerTest, LimitMoreThanMax)
|
||||
.WillByDefault(Return(CreateAccountRootObject(ACCOUNT2, 0, 2, 200, 2, INDEX1, 2).getSerializer().peekData()));
|
||||
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, seq, _))
|
||||
.WillByDefault(Return(CreateFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
.WillByDefault(Return(CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::account(issuer).key, seq, _))
|
||||
.WillByDefault(
|
||||
|
||||
@@ -1025,7 +1025,7 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsTrueBinaryFalse)
|
||||
ON_CALL(*backend, doFetchLedgerObject(accountKk, RANGEMAX, _)).WillByDefault(Return(accountObject));
|
||||
|
||||
// fee object 2*2+3->7 ; balance 200 - 7 -> 193
|
||||
auto feeBlob = CreateFeeSettingBlob(1, 2 /*reserve inc*/, 3 /*reserve base*/, 4, 0);
|
||||
auto feeBlob = CreateLegacyFeeSettingBlob(1, 2 /*reserve inc*/, 3 /*reserve base*/, 4, 0);
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, RANGEMAX, _)).WillByDefault(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).Times(2);
|
||||
@@ -1094,7 +1094,7 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsTrueBinaryTrue)
|
||||
ON_CALL(*backend, doFetchLedgerObject(accountKk, RANGEMAX, _)).WillByDefault(Return(accountObject));
|
||||
|
||||
// fee object 2*2+3->7 ; balance 200 - 7 -> 193
|
||||
auto feeBlob = CreateFeeSettingBlob(1, 2 /*reserve inc*/, 3 /*reserve base*/, 4, 0);
|
||||
auto feeBlob = CreateLegacyFeeSettingBlob(1, 2 /*reserve inc*/, 3 /*reserve base*/, 4, 0);
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, RANGEMAX, _)).WillByDefault(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).Times(2);
|
||||
@@ -1198,7 +1198,7 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsNotEnoughForReserve)
|
||||
ON_CALL(*backend, doFetchLedgerObject(accountKk, RANGEMAX, _)).WillByDefault(Return(accountObject));
|
||||
|
||||
// fee object 2*2+3->7 ; balance 6 - 7 -> -1
|
||||
auto feeBlob = CreateFeeSettingBlob(1, 2 /*reserve inc*/, 3 /*reserve base*/, 4, 0);
|
||||
auto feeBlob = CreateLegacyFeeSettingBlob(1, 2 /*reserve inc*/, 3 /*reserve base*/, 4, 0);
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, RANGEMAX, _)).WillByDefault(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).Times(2);
|
||||
|
||||
@@ -571,7 +571,7 @@ TEST_F(RPCNoRippleCheckTest, NormalPathRoleGatewayDefaultRippleUnsetTrustLineNoR
|
||||
ON_CALL(*backend, doFetchLedgerObject(ownerDirKk, seq, _))
|
||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, seq, _))
|
||||
.WillByDefault(Return(CreateFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
.WillByDefault(Return(CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).Times(3);
|
||||
|
||||
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT2, 10, ACCOUNT, 20, TXNID, 123, 0);
|
||||
@@ -727,7 +727,7 @@ TEST_F(RPCNoRippleCheckTest, NormalPathTransactions)
|
||||
ON_CALL(*backend, doFetchLedgerObject(ownerDirKk, seq, _))
|
||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, seq, _))
|
||||
.WillByDefault(Return(CreateFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
.WillByDefault(Return(CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).Times(3);
|
||||
|
||||
auto const line1 = CreateRippleStateLedgerObject(
|
||||
|
||||
@@ -203,7 +203,7 @@ TEST_F(RPCServerInfoHandlerTest, DefaultOutputIsPresent)
|
||||
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, 30, 3); // 3 seconds old
|
||||
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(Return(ledgerinfo));
|
||||
|
||||
auto const feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).WillOnce(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*rawBalancerPtr, forwardToRippled(testing::_, testing::Eq(CLIENTIP), testing::_))
|
||||
@@ -240,7 +240,7 @@ TEST_F(RPCServerInfoHandlerTest, AmendmentBlockedIsPresentIfSet)
|
||||
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, 30, 3); // 3 seconds old
|
||||
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(Return(ledgerinfo));
|
||||
|
||||
auto const feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).WillOnce(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*rawBalancerPtr, forwardToRippled(testing::_, testing::Eq(CLIENTIP), testing::_))
|
||||
@@ -277,7 +277,7 @@ TEST_F(RPCServerInfoHandlerTest, AdminSectionPresentWhenAdminFlagIsSet)
|
||||
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, 30, 3); // 3 seconds old
|
||||
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(Return(ledgerinfo));
|
||||
|
||||
auto const feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).WillOnce(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*rawBalancerPtr, forwardToRippled).WillOnce(Return(empty));
|
||||
@@ -317,7 +317,7 @@ TEST_F(RPCServerInfoHandlerTest, BackendCountersPresentWhenRequestWithParam)
|
||||
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, 30, 3); // 3 seconds old
|
||||
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(Return(ledgerinfo));
|
||||
|
||||
auto const feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).WillOnce(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*rawBalancerPtr, forwardToRippled).WillOnce(Return(empty));
|
||||
@@ -363,7 +363,7 @@ TEST_F(RPCServerInfoHandlerTest, RippledForwardedValuesPresent)
|
||||
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, 30, 3); // 3 seconds old
|
||||
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(Return(ledgerinfo));
|
||||
|
||||
auto const feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).WillOnce(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*rawCountersPtr, uptime).WillOnce(Return(std::chrono::seconds{1234}));
|
||||
@@ -414,7 +414,7 @@ TEST_F(RPCServerInfoHandlerTest, RippledForwardedValuesMissingNoExceptionThrown)
|
||||
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, 30, 3); // 3 seconds old
|
||||
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(Return(ledgerinfo));
|
||||
|
||||
auto const feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto const feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).WillOnce(Return(feeBlob));
|
||||
|
||||
EXPECT_CALL(*rawCountersPtr, uptime).WillOnce(Return(std::chrono::seconds{1234}));
|
||||
|
||||
@@ -646,7 +646,7 @@ TEST_F(RPCSubscribeHandlerTest, StreamsLedger)
|
||||
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, MAXSEQ);
|
||||
ON_CALL(*backend, fetchLedgerBySequence(MAXSEQ, _)).WillByDefault(Return(ledgerinfo));
|
||||
// fee
|
||||
auto feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
ON_CALL(*backend, doFetchLedgerObject).WillByDefault(Return(feeBlob));
|
||||
EXPECT_CALL(*backend, doFetchLedgerObject).Times(1);
|
||||
|
||||
@@ -845,7 +845,7 @@ TEST_F(RPCSubscribeHandlerTest, BooksBothSnapshotSet)
|
||||
.WillByDefault(Return(CreateAccountRootObject(ACCOUNT, 0, 2, 200, 2, INDEX1, 2).getSerializer().peekData()));
|
||||
|
||||
// fee
|
||||
auto feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, MAXSEQ, _)).WillByDefault(Return(feeBlob));
|
||||
|
||||
auto const gets10XRPPays20USDOffer = CreateOfferLedgerObject(
|
||||
@@ -1013,7 +1013,7 @@ TEST_F(RPCSubscribeHandlerTest, BooksBothUnsetSnapshotSet)
|
||||
.WillByDefault(Return(CreateAccountRootObject(ACCOUNT, 0, 2, 200, 2, INDEX1, 2).getSerializer().peekData()));
|
||||
|
||||
// fee
|
||||
auto feeBlob = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
auto feeBlob = CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0);
|
||||
ON_CALL(*backend, doFetchLedgerObject(ripple::keylet::fees().key, MAXSEQ, _)).WillByDefault(Return(feeBlob));
|
||||
|
||||
auto const gets10XRPPays20USDOffer = CreateOfferLedgerObject(
|
||||
|
||||
Reference in New Issue
Block a user