Skip to content

Commit

Permalink
Support fields from XRPFees amendment (#1282)
Browse files Browse the repository at this point in the history
Fixes #1280
  • Loading branch information
godexsoft authored Mar 20, 2024
1 parent 27db183 commit 8e75818
Show file tree
Hide file tree
Showing 16 changed files with 196 additions and 47 deletions.
40 changes: 34 additions & 6 deletions src/data/BackendInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,42 @@ BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context
ripple::SerialIter it(bytes->data(), bytes->size());
ripple::SLE const sle{it, key};

if (sle.getFieldIndex(ripple::sfBaseFee) != -1)
fees.base = sle.getFieldU64(ripple::sfBaseFee);
// XRPFees amendment introduced new fields for fees calculations.
// New fields are set and the old fields are removed via `set_fees` tx.
// Fallback to old fields if `set_fees` was not yet used to update the fields on this tx.
auto hasNewFields = false;
{
auto const baseFeeXRP = sle.at(~ripple::sfBaseFeeDrops);
auto const reserveBaseXRP = sle.at(~ripple::sfReserveBaseDrops);
auto const reserveIncrementXRP = sle.at(~ripple::sfReserveIncrementDrops);

if (sle.getFieldIndex(ripple::sfReserveBase) != -1)
fees.reserve = sle.getFieldU32(ripple::sfReserveBase);
if (baseFeeXRP)
fees.base = baseFeeXRP->xrp();

if (sle.getFieldIndex(ripple::sfReserveIncrement) != -1)
fees.increment = sle.getFieldU32(ripple::sfReserveIncrement);
if (reserveBaseXRP)
fees.reserve = reserveBaseXRP->xrp();

if (reserveIncrementXRP)
fees.increment = reserveIncrementXRP->xrp();

hasNewFields = baseFeeXRP || reserveBaseXRP || reserveIncrementXRP;
}

if (not hasNewFields) {
// Fallback to old fields
auto const baseFee = sle.at(~ripple::sfBaseFee);
auto const reserveBase = sle.at(~ripple::sfReserveBase);
auto const reserveIncrement = sle.at(~ripple::sfReserveIncrement);

if (baseFee)
fees.base = baseFee.value();

if (reserveBase)
fees.reserve = reserveBase.value();

if (reserveIncrement)
fees.increment = reserveIncrement.value();
}

return fees;
}
Expand Down
1 change: 1 addition & 0 deletions unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ target_sources(
ConfigTests.cpp
data/BackendCountersTests.cpp
data/BackendFactoryTests.cpp
data/BackendInterfaceTests.cpp
data/cassandra/AsyncExecutorTests.cpp
# Webserver
data/cassandra/BackendTests.cpp
Expand Down
72 changes: 72 additions & 0 deletions unittests/data/BackendInterfaceTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//------------------------------------------------------------------------------
/*
This file is part of clio: https://github.com/XRPLF/clio
Copyright (c) 2024, the clio developers.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================

#include "data/BackendInterface.hpp"
#include "util/Fixtures.hpp"
#include "util/TestObject.hpp"

#include <gmock/gmock.h>
#include <gtest/gtest.h>

using namespace data;
using namespace util::prometheus;
using namespace testing;

constexpr static auto MAXSEQ = 30;
constexpr static auto MINSEQ = 10;

struct BackendInterfaceTest : MockBackendTestNaggy, SyncAsioContextTest, WithPrometheus {};

TEST_F(BackendInterfaceTest, FetchFeesSuccessPath)
{
using namespace ripple;
backend->setRange(MINSEQ, MAXSEQ);

// New fee setting (after XRPFees amendment)
EXPECT_CALL(*backend, doFetchLedgerObject(keylet::fees().key, MAXSEQ, _))
.WillRepeatedly(Return(CreateFeeSettingBlob(XRPAmount(1), XRPAmount(2), XRPAmount(3), 0)));

runSpawn([this](auto yield) {
auto fees = backend->fetchFees(MAXSEQ, yield);

EXPECT_TRUE(fees.has_value());
EXPECT_EQ(fees->base, XRPAmount(1));
EXPECT_EQ(fees->increment, XRPAmount(2));
EXPECT_EQ(fees->reserve, XRPAmount(3));
});
}

TEST_F(BackendInterfaceTest, FetchFeesLegacySuccessPath)
{
using namespace ripple;
backend->setRange(MINSEQ, MAXSEQ);

// Legacy fee setting (before XRPFees amendment)
EXPECT_CALL(*backend, doFetchLedgerObject(keylet::fees().key, MAXSEQ, _))
.WillRepeatedly(Return(CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0)));

runSpawn([this](auto yield) {
auto fees = backend->fetchFees(MAXSEQ, yield);

EXPECT_TRUE(fees.has_value());
EXPECT_EQ(fees->base, XRPAmount(1));
EXPECT_EQ(fees->increment, XRPAmount(2));
EXPECT_EQ(fees->reserve, XRPAmount(3));
});
}
3 changes: 2 additions & 1 deletion unittests/data/cassandra/BackendTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@
using namespace util;
using namespace std;
using namespace rpc;
using namespace prometheus;
namespace json = boost::json;

using namespace data::cassandra;

class BackendCassandraTest : public SyncAsioContextTest {
class BackendCassandraTest : public SyncAsioContextTest, public WithPrometheus {
protected:
Config cfg{json::parse(fmt::format(
R"JSON({{
Expand Down
6 changes: 3 additions & 3 deletions unittests/etl/LedgerPublisherTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ TEST_F(ETLLedgerPublisherTest, PublishLedgerInfoInRange)
// mock fetch fee
EXPECT_CALL(*backend, doFetchLedgerObject).Times(1);
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)));

// mock fetch transactions
EXPECT_CALL(*backend, fetchAllTransactionsInLedger).Times(1);
Expand Down Expand Up @@ -180,7 +180,7 @@ TEST_F(ETLLedgerPublisherTest, PublishLedgerInfoCloseTimeGreaterThanNow)
// mock fetch fee
EXPECT_CALL(*backend, doFetchLedgerObject).Times(1);
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)));

// mock fetch transactions
EXPECT_CALL(*backend, fetchAllTransactionsInLedger).Times(1);
Expand Down Expand Up @@ -269,7 +269,7 @@ TEST_F(ETLLedgerPublisherTest, PublishMultipleTxInOrder)
// mock fetch fee
EXPECT_CALL(*backend, doFetchLedgerObject).Times(1);
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)));

// mock fetch transactions
EXPECT_CALL(*backend, fetchAllTransactionsInLedger).Times(1);
Expand Down
4 changes: 2 additions & 2 deletions unittests/feed/LedgerFeedTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TEST_F(FeedLedgerTest, SubPub)
auto const ledgerInfo = CreateLedgerInfo(LEDGERHASH, 30);
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(testing::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(testing::Return(feeBlob));
// check the function response
// Information about the ledgers on hand and current fee schedule. This
Expand Down Expand Up @@ -103,7 +103,7 @@ TEST_F(FeedLedgerTest, AutoDisconnect)
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, 30);
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(testing::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(testing::Return(feeBlob));
constexpr static auto LedgerResponse =
R"({
Expand Down
2 changes: 1 addition & 1 deletion unittests/feed/SubscriptionManagerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ TEST_F(SubscriptionManagerTest, LedgerTest)
auto const ledgerinfo = CreateLedgerInfo(LEDGERHASH, 30);
EXPECT_CALL(*backend, fetchLedgerBySequence).WillOnce(testing::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(testing::Return(feeBlob));
// check the function response
// Information about the ledgers on hand and current fee schedule. This
Expand Down
18 changes: 9 additions & 9 deletions unittests/rpc/handlers/AMMInfoTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::_))
Expand Down Expand Up @@ -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
);
Expand Down Expand Up @@ -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::_))
Expand Down Expand Up @@ -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::_))
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions unittests/rpc/handlers/AccountInfoTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions unittests/rpc/handlers/BookOffersTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions unittests/rpc/handlers/LedgerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions unittests/rpc/handlers/NoRippleCheckTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down
Loading

0 comments on commit 8e75818

Please sign in to comment.