mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 11:55:51 +00:00
Compare commits
6 Commits
7e4e12385f
...
release/2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1037785a1 | ||
|
|
b1aafbaacb | ||
|
|
965a2883fe | ||
|
|
1e9eaee311 | ||
|
|
a15ee2a8cc | ||
|
|
26ed78fc05 |
@@ -17,6 +17,13 @@ set(COMPILER_FLAGS
|
||||
-pedantic
|
||||
-Wpedantic
|
||||
-Wunused
|
||||
# FIXME: The following bunch are needed for gcc12 atm.
|
||||
-Wno-missing-requires
|
||||
-Wno-restrict
|
||||
-Wno-null-dereference
|
||||
-Wno-maybe-uninitialized
|
||||
-Wno-unknown-warning-option # and this to work with clang
|
||||
# TODO: Address these and others in https://github.com/XRPLF/clio/issues/1273
|
||||
)
|
||||
|
||||
#TODO: reenable when we change CI #884
|
||||
|
||||
@@ -267,6 +267,7 @@ if (tests)
|
||||
unittests/rpc/handlers/AMMInfoTests.cpp
|
||||
# Backend
|
||||
unittests/data/BackendFactoryTests.cpp
|
||||
unittests/data/BackendInterfaceTests.cpp
|
||||
unittests/data/BackendCountersTests.cpp
|
||||
unittests/data/cassandra/BaseTests.cpp
|
||||
unittests/data/cassandra/BackendTests.cpp
|
||||
|
||||
@@ -23,10 +23,10 @@ class Clio(ConanFile):
|
||||
'boost/1.82.0',
|
||||
'cassandra-cpp-driver/2.17.0',
|
||||
'fmt/10.1.1',
|
||||
'protobuf/3.21.12',
|
||||
'protobuf/3.21.9',
|
||||
'grpc/1.50.1',
|
||||
'openssl/1.1.1u',
|
||||
'xrpl/2.0.0',
|
||||
'xrpl/2.2.0',
|
||||
'libbacktrace/cci.20210118'
|
||||
]
|
||||
|
||||
|
||||
@@ -344,14 +344,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;
|
||||
}
|
||||
|
||||
177
unittests/CMakeLists.txt
Normal file
177
unittests/CMakeLists.txt
Normal file
@@ -0,0 +1,177 @@
|
||||
add_executable(clio_tests)
|
||||
|
||||
target_sources(
|
||||
clio_tests
|
||||
PRIVATE # Common
|
||||
ConfigTests.cpp
|
||||
data/BackendCountersTests.cpp
|
||||
data/BackendFactoryTests.cpp
|
||||
data/BackendInterfaceTests.cpp
|
||||
data/cassandra/AsyncExecutorTests.cpp
|
||||
# Webserver
|
||||
data/cassandra/BackendTests.cpp
|
||||
data/cassandra/BaseTests.cpp
|
||||
data/cassandra/ExecutionStrategyTests.cpp
|
||||
data/cassandra/RetryPolicyTests.cpp
|
||||
data/cassandra/SettingsProviderTests.cpp
|
||||
DOSGuardTests.cpp
|
||||
etl/AmendmentBlockHandlerTests.cpp
|
||||
etl/CacheLoaderSettingsTests.cpp
|
||||
etl/CacheLoaderTests.cpp
|
||||
etl/CursorFromAccountProviderTests.cpp
|
||||
etl/CursorFromDiffProviderTests.cpp
|
||||
etl/CursorFromFixDiffNumProviderTests.cpp
|
||||
etl/ETLStateTests.cpp
|
||||
etl/ExtractionDataPipeTests.cpp
|
||||
etl/ExtractorTests.cpp
|
||||
etl/ForwardingCacheTests.cpp
|
||||
etl/ForwardingSourceTests.cpp
|
||||
etl/GrpcSourceTests.cpp
|
||||
etl/LedgerPublisherTests.cpp
|
||||
etl/SourceTests.cpp
|
||||
etl/SubscriptionSourceDependenciesTests.cpp
|
||||
etl/SubscriptionSourceTests.cpp
|
||||
etl/TransformerTests.cpp
|
||||
# RPC
|
||||
feed/BookChangesFeedTests.cpp
|
||||
feed/ForwardFeedTests.cpp
|
||||
feed/LedgerFeedTests.cpp
|
||||
feed/ProposedTransactionFeedTests.cpp
|
||||
feed/SingleFeedBaseTests.cpp
|
||||
feed/SubscriptionManagerTests.cpp
|
||||
feed/TrackableSignalTests.cpp
|
||||
feed/TransactionFeedTests.cpp
|
||||
JsonUtilTests.cpp
|
||||
LoggerTests.cpp
|
||||
Main.cpp
|
||||
Playground.cpp
|
||||
ProfilerTests.cpp
|
||||
rpc/AmendmentsTests.cpp
|
||||
rpc/APIVersionTests.cpp
|
||||
rpc/BaseTests.cpp
|
||||
rpc/CountersTests.cpp
|
||||
rpc/ErrorTests.cpp
|
||||
rpc/ForwardingProxyTests.cpp
|
||||
rpc/handlers/AccountChannelsTests.cpp
|
||||
rpc/handlers/AccountCurrenciesTests.cpp
|
||||
rpc/handlers/AccountInfoTests.cpp
|
||||
rpc/handlers/AccountLinesTests.cpp
|
||||
rpc/handlers/AccountNFTsTests.cpp
|
||||
rpc/handlers/AccountObjectsTests.cpp
|
||||
rpc/handlers/AccountOffersTests.cpp
|
||||
rpc/handlers/AccountTxTests.cpp
|
||||
rpc/handlers/AMMInfoTests.cpp
|
||||
# Backend
|
||||
rpc/handlers/BookChangesTests.cpp
|
||||
rpc/handlers/BookOffersTests.cpp
|
||||
rpc/handlers/DefaultProcessorTests.cpp
|
||||
rpc/handlers/DepositAuthorizedTests.cpp
|
||||
rpc/handlers/GatewayBalancesTests.cpp
|
||||
rpc/handlers/LedgerDataTests.cpp
|
||||
rpc/handlers/LedgerEntryTests.cpp
|
||||
rpc/handlers/LedgerRangeTests.cpp
|
||||
rpc/handlers/LedgerTests.cpp
|
||||
rpc/handlers/NFTBuyOffersTests.cpp
|
||||
rpc/handlers/NFTHistoryTests.cpp
|
||||
rpc/handlers/NFTInfoTests.cpp
|
||||
rpc/handlers/NFTsByIssuerTest.cpp
|
||||
rpc/handlers/NFTSellOffersTests.cpp
|
||||
rpc/handlers/NoRippleCheckTests.cpp
|
||||
rpc/handlers/PingTests.cpp
|
||||
rpc/handlers/RandomTests.cpp
|
||||
rpc/handlers/ServerInfoTests.cpp
|
||||
rpc/handlers/SubscribeTests.cpp
|
||||
rpc/handlers/TestHandlerTests.cpp
|
||||
rpc/handlers/TransactionEntryTests.cpp
|
||||
rpc/handlers/TxTests.cpp
|
||||
rpc/handlers/UnsubscribeTests.cpp
|
||||
rpc/handlers/VersionHandlerTests.cpp
|
||||
rpc/JsonBoolTests.cpp
|
||||
# RPC handlers
|
||||
rpc/RPCHelpersTests.cpp
|
||||
rpc/WorkQueueTests.cpp
|
||||
util/AssertTests.cpp
|
||||
util/async/AnyExecutionContextTests.cpp
|
||||
util/async/AnyOperationTests.cpp
|
||||
util/async/AnyStopTokenTests.cpp
|
||||
util/async/AnyStrandTests.cpp
|
||||
util/async/AsyncExecutionContextTests.cpp
|
||||
# Requests framework
|
||||
util/BatchingTests.cpp
|
||||
util/LedgerUtilsTests.cpp
|
||||
# Prometheus support
|
||||
util/prometheus/BoolTests.cpp
|
||||
util/prometheus/CounterTests.cpp
|
||||
util/prometheus/GaugeTests.cpp
|
||||
util/prometheus/HistogramTests.cpp
|
||||
util/prometheus/HttpTests.cpp
|
||||
util/prometheus/LabelTests.cpp
|
||||
util/prometheus/MetricBuilderTests.cpp
|
||||
util/prometheus/MetricsFamilyTests.cpp
|
||||
util/prometheus/OStreamTests.cpp
|
||||
util/requests/RequestBuilderTests.cpp
|
||||
util/requests/SslContextTests.cpp
|
||||
util/requests/WsConnectionTests.cpp
|
||||
# ETL
|
||||
util/RetryTests.cpp
|
||||
# Async framework
|
||||
util/StringUtils.cpp
|
||||
util/TestGlobals.cpp
|
||||
util/TestHttpServer.cpp
|
||||
util/TestObject.cpp
|
||||
util/TestWsServer.cpp
|
||||
util/TxUtilTests.cpp
|
||||
web/AdminVerificationTests.cpp
|
||||
web/RPCServerHandlerTests.cpp
|
||||
web/ServerTests.cpp
|
||||
web/SweepHandlerTests.cpp
|
||||
# Feed
|
||||
web/WhitelistHandlerTests.cpp
|
||||
)
|
||||
|
||||
include(deps/gtest)
|
||||
|
||||
# See https://github.com/google/googletest/issues/3475
|
||||
gtest_discover_tests(clio_tests DISCOVERY_TIMEOUT 90)
|
||||
|
||||
# Fix for dwarf5 bug on ci
|
||||
target_compile_options(clio_options INTERFACE -gdwarf-4)
|
||||
|
||||
target_compile_definitions(clio_tests PUBLIC UNITTEST_BUILD)
|
||||
target_include_directories(clio_tests PRIVATE .)
|
||||
target_link_libraries(clio_tests PUBLIC clio gtest::gtest)
|
||||
set_target_properties(clio_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
# Generate `coverage_report` target if coverage is enabled
|
||||
if (coverage)
|
||||
if (DEFINED CODE_COVERAGE_REPORT_FORMAT)
|
||||
set(CODE_COVERAGE_FORMAT ${CODE_COVERAGE_REPORT_FORMAT})
|
||||
else ()
|
||||
set(CODE_COVERAGE_FORMAT html-details)
|
||||
endif ()
|
||||
|
||||
if (DEFINED CODE_COVERAGE_TESTS_ARGS)
|
||||
set(TESTS_ADDITIONAL_ARGS ${CODE_COVERAGE_TESTS_ARGS})
|
||||
separate_arguments(TESTS_ADDITIONAL_ARGS)
|
||||
else ()
|
||||
set(TESTS_ADDITIONAL_ARGS "")
|
||||
endif ()
|
||||
|
||||
set(GCOVR_ADDITIONAL_ARGS --exclude-throw-branches -s)
|
||||
|
||||
setup_target_for_coverage_gcovr(
|
||||
NAME
|
||||
coverage_report
|
||||
FORMAT
|
||||
${CODE_COVERAGE_FORMAT}
|
||||
EXECUTABLE
|
||||
clio_tests
|
||||
EXECUTABLE_ARGS
|
||||
--gtest_brief=1
|
||||
${TESTS_ADDITIONAL_ARGS}
|
||||
EXCLUDE
|
||||
"unittests"
|
||||
DEPENDENCIES
|
||||
clio_tests
|
||||
)
|
||||
endif ()
|
||||
73
unittests/data/BackendInterfaceTests.cpp
Normal file
73
unittests/data/BackendInterfaceTests.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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/MockPrometheus.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));
|
||||
});
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "rpc/RPCHelpers.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/LedgerUtils.hpp"
|
||||
#include "util/MockPrometheus.hpp"
|
||||
#include "util/Random.hpp"
|
||||
#include "util/StringUtils.hpp"
|
||||
#include "util/TestGlobals.hpp"
|
||||
@@ -65,11 +66,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({{
|
||||
@@ -432,12 +434,12 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
auto allTransactions = backend->fetchAllTransactionsInLedger(lgrInfoNext.seq, yield);
|
||||
ASSERT_EQ(allTransactions.size(), 1);
|
||||
EXPECT_STREQ(
|
||||
reinterpret_cast<const char*>(allTransactions[0].transaction.data()),
|
||||
static_cast<const char*>(txnBlob.data())
|
||||
reinterpret_cast<char const*>(allTransactions[0].transaction.data()),
|
||||
static_cast<char const*>(txnBlob.data())
|
||||
);
|
||||
EXPECT_STREQ(
|
||||
reinterpret_cast<const char*>(allTransactions[0].metadata.data()),
|
||||
static_cast<const char*>(metaBlob.data())
|
||||
reinterpret_cast<char const*>(allTransactions[0].metadata.data()),
|
||||
static_cast<char const*>(metaBlob.data())
|
||||
);
|
||||
auto hashes = backend->fetchAllTransactionHashesInLedger(lgrInfoNext.seq, yield);
|
||||
EXPECT_EQ(hashes.size(), 1);
|
||||
@@ -459,10 +461,10 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
||||
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlob.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlob.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||
EXPECT_FALSE(obj);
|
||||
}
|
||||
@@ -496,13 +498,13 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
||||
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlob.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlob.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 1, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlobOld.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlobOld.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||
EXPECT_FALSE(obj);
|
||||
}
|
||||
@@ -538,7 +540,7 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
EXPECT_FALSE(obj);
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 2, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlobOld.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlobOld.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||
EXPECT_FALSE(obj);
|
||||
}
|
||||
@@ -550,7 +552,7 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
|
||||
for (auto& blob : res) {
|
||||
++key;
|
||||
std::string const keyStr{reinterpret_cast<const char*>(key.data()), ripple::uint256::size()};
|
||||
std::string const keyStr{reinterpret_cast<char const*>(key.data()), ripple::uint256::size()};
|
||||
blob.first = keyStr;
|
||||
blob.second = std::to_string(ledgerSequence) + keyStr;
|
||||
}
|
||||
@@ -568,7 +570,7 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
base = ledgerSequence * 100000ul;
|
||||
for (auto& blob : res) {
|
||||
++base;
|
||||
std::string const hashStr{reinterpret_cast<const char*>(base.data()), ripple::uint256::size()};
|
||||
std::string const hashStr{reinterpret_cast<char const*>(base.data()), ripple::uint256::size()};
|
||||
std::string const txnStr = "tx" + std::to_string(ledgerSequence) + hashStr;
|
||||
std::string const metaStr = "meta" + std::to_string(ledgerSequence) + hashStr;
|
||||
blob = std::make_tuple(hashStr, txnStr, metaStr);
|
||||
@@ -668,13 +670,13 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
bool found = false;
|
||||
for (auto [retTxn, retMeta, retSeq, retDate] : retTxns) {
|
||||
if (std::strncmp(
|
||||
reinterpret_cast<const char*>(retTxn.data()),
|
||||
static_cast<const char*>(txn.data()),
|
||||
reinterpret_cast<char const*>(retTxn.data()),
|
||||
static_cast<char const*>(txn.data()),
|
||||
txn.size()
|
||||
) == 0 &&
|
||||
std::strncmp(
|
||||
reinterpret_cast<const char*>(retMeta.data()),
|
||||
static_cast<const char*>(meta.data()),
|
||||
reinterpret_cast<char const*>(retMeta.data()),
|
||||
static_cast<char const*>(meta.data()),
|
||||
meta.size()
|
||||
) == 0)
|
||||
found = true;
|
||||
@@ -697,8 +699,8 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
for (size_t i = 0; i < retData.size(); ++i) {
|
||||
auto [txn, meta, _, _2] = retData[i];
|
||||
auto [_3, expTxn, expMeta] = data[i];
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(txn.data()), static_cast<const char*>(expTxn.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(meta.data()), static_cast<const char*>(expMeta.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(txn.data()), static_cast<char const*>(expTxn.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(meta.data()), static_cast<char const*>(expMeta.data()));
|
||||
}
|
||||
}
|
||||
std::vector<ripple::uint256> keys;
|
||||
@@ -706,7 +708,7 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
auto retObj = backend->fetchLedgerObject(binaryStringToUint256(key), seq, yield);
|
||||
if (obj.size()) {
|
||||
ASSERT_TRUE(retObj.has_value());
|
||||
EXPECT_STREQ(static_cast<const char*>(obj.data()), reinterpret_cast<const char*>(retObj->data()));
|
||||
EXPECT_STREQ(static_cast<char const*>(obj.data()), reinterpret_cast<char const*>(retObj->data()));
|
||||
} else {
|
||||
ASSERT_FALSE(retObj.has_value());
|
||||
}
|
||||
@@ -723,7 +725,7 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
if (obj.size()) {
|
||||
ASSERT_TRUE(retObj.size());
|
||||
EXPECT_STREQ(
|
||||
static_cast<const char*>(obj.data()), reinterpret_cast<const char*>(retObj.data())
|
||||
static_cast<char const*>(obj.data()), reinterpret_cast<char const*>(retObj.data())
|
||||
);
|
||||
} else {
|
||||
ASSERT_FALSE(retObj.size());
|
||||
@@ -739,9 +741,9 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
retObjs.insert(retObjs.end(), page.objects.begin(), page.objects.end());
|
||||
} while (page.cursor);
|
||||
|
||||
for (const auto& obj : objs) {
|
||||
for (auto const& obj : objs) {
|
||||
bool found = false;
|
||||
for (const auto& retObj : retObjs) {
|
||||
for (auto const& retObj : retObjs) {
|
||||
if (ripple::strHex(obj.first) == ripple::strHex(retObj.key)) {
|
||||
found = true;
|
||||
ASSERT_EQ(ripple::strHex(obj.second), ripple::strHex(retObj.blob));
|
||||
@@ -765,7 +767,7 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
for (auto rec : accountTx) {
|
||||
for (auto account : rec.accounts) {
|
||||
allAccountTx[lgrInfoNext.seq][account].emplace_back(
|
||||
reinterpret_cast<const char*>(rec.txHash.data()), ripple::uint256::size()
|
||||
reinterpret_cast<char const*>(rec.txHash.data()), ripple::uint256::size()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -796,7 +798,7 @@ TEST_F(BackendCassandraTest, Basic)
|
||||
for (auto rec : accountTx) {
|
||||
for (auto account : rec.accounts) {
|
||||
allAccountTx[lgrInfoNext.seq][account].emplace_back(
|
||||
reinterpret_cast<const char*>(rec.txHash.data()), ripple::uint256::size()
|
||||
reinterpret_cast<char const*>(rec.txHash.data()), ripple::uint256::size()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -986,10 +988,10 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
||||
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
||||
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlob.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlob.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||
EXPECT_FALSE(obj);
|
||||
}
|
||||
@@ -1022,13 +1024,13 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
||||
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
||||
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlob.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlob.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 1, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlobOld.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlobOld.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||
EXPECT_FALSE(obj);
|
||||
}
|
||||
@@ -1064,7 +1066,7 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
||||
EXPECT_FALSE(obj);
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 2, yield);
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlobOld.data()));
|
||||
EXPECT_STREQ(reinterpret_cast<char const*>(obj->data()), static_cast<char const*>(accountBlobOld.data()));
|
||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||
EXPECT_FALSE(obj);
|
||||
}
|
||||
@@ -1076,7 +1078,7 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
||||
|
||||
for (auto& blob : res) {
|
||||
++key;
|
||||
std::string const keyStr{reinterpret_cast<const char*>(key.data()), ripple::uint256::size()};
|
||||
std::string const keyStr{reinterpret_cast<char const*>(key.data()), ripple::uint256::size()};
|
||||
blob.first = keyStr;
|
||||
blob.second = std::to_string(ledgerSequence) + keyStr;
|
||||
}
|
||||
@@ -1156,7 +1158,7 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
||||
auto retObj = backend->fetchLedgerObject(binaryStringToUint256(key), seq, yield);
|
||||
if (obj.size()) {
|
||||
ASSERT_TRUE(retObj.has_value());
|
||||
EXPECT_STREQ(static_cast<const char*>(obj.data()), reinterpret_cast<const char*>(retObj->data()));
|
||||
EXPECT_STREQ(static_cast<char const*>(obj.data()), reinterpret_cast<char const*>(retObj->data()));
|
||||
} else {
|
||||
ASSERT_FALSE(retObj.has_value());
|
||||
}
|
||||
@@ -1173,7 +1175,7 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
||||
if (obj.size()) {
|
||||
ASSERT_TRUE(retObj.size());
|
||||
EXPECT_STREQ(
|
||||
static_cast<const char*>(obj.data()), reinterpret_cast<const char*>(retObj.data())
|
||||
static_cast<char const*>(obj.data()), reinterpret_cast<char const*>(retObj.data())
|
||||
);
|
||||
} else {
|
||||
ASSERT_FALSE(retObj.size());
|
||||
@@ -1187,9 +1189,9 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
||||
page = backend->fetchLedgerPage(page.cursor, seq, limit, false, yield);
|
||||
retObjs.insert(retObjs.end(), page.objects.begin(), page.objects.end());
|
||||
} while (page.cursor);
|
||||
for (const auto& obj : objs) {
|
||||
for (auto const& obj : objs) {
|
||||
bool found = false;
|
||||
for (const auto& retObj : retObjs) {
|
||||
for (auto const& retObj : retObjs) {
|
||||
if (ripple::strHex(obj.first) == ripple::strHex(retObj.key)) {
|
||||
found = true;
|
||||
ASSERT_EQ(ripple::strHex(obj.second), ripple::strHex(retObj.blob));
|
||||
|
||||
@@ -128,7 +128,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);
|
||||
@@ -176,7 +176,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);
|
||||
@@ -265,7 +265,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);
|
||||
|
||||
@@ -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
|
||||
@@ -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"({
|
||||
|
||||
@@ -280,7 +280,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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -507,7 +507,7 @@ TEST_F(RPCAccountTxHandlerTest, IndexSpecificForwardTrue)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -550,7 +550,7 @@ TEST_F(RPCAccountTxHandlerTest, IndexSpecificForwardFalse)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -593,7 +593,7 @@ TEST_F(RPCAccountTxHandlerTest, IndexNotSpecificForwardTrue)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -636,7 +636,7 @@ TEST_F(RPCAccountTxHandlerTest, IndexNotSpecificForwardFalse)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -679,7 +679,7 @@ TEST_F(RPCAccountTxHandlerTest, BinaryTrue)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -735,7 +735,7 @@ TEST_F(RPCAccountTxHandlerTest, BinaryTrueV2)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -788,7 +788,7 @@ TEST_F(RPCAccountTxHandlerTest, LimitAndMarker)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -838,7 +838,7 @@ TEST_F(RPCAccountTxHandlerTest, SpecificLedgerIndex)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index": {}
|
||||
@@ -866,7 +866,7 @@ TEST_F(RPCAccountTxHandlerTest, SpecificNonexistLedgerIntIndex)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index": {}
|
||||
@@ -891,7 +891,7 @@ TEST_F(RPCAccountTxHandlerTest, SpecificNonexistLedgerStringIndex)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index": "{}"
|
||||
@@ -933,7 +933,7 @@ TEST_F(RPCAccountTxHandlerTest, SpecificLedgerHash)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_hash": "{}"
|
||||
@@ -978,7 +978,7 @@ TEST_F(RPCAccountTxHandlerTest, SpecificLedgerIndexValidated)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index": "validated"
|
||||
@@ -1017,7 +1017,7 @@ TEST_F(RPCAccountTxHandlerTest, TxLessThanMinSeq)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -1060,7 +1060,7 @@ TEST_F(RPCAccountTxHandlerTest, TxLargerThanMaxSeq)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -1295,7 +1295,7 @@ TEST_F(RPCAccountTxHandlerTest, NFTTxs_API_v1)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -1537,7 +1537,7 @@ TEST_F(RPCAccountTxHandlerTest, NFTTxs_API_v2)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountTxHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"account": "{}",
|
||||
"ledger_index_min": {},
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -292,7 +292,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexSpecificForwardTrue)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -437,7 +437,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexSpecificForwardFalseV1)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -592,7 +592,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexSpecificForwardFalseV2)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -626,7 +626,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexNotSpecificForwardTrue)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -669,7 +669,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexNotSpecificForwardFalse)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -712,7 +712,7 @@ TEST_F(RPCNFTHistoryHandlerTest, BinaryTrueV1)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -768,7 +768,7 @@ TEST_F(RPCNFTHistoryHandlerTest, BinaryTrueV2)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -821,7 +821,7 @@ TEST_F(RPCNFTHistoryHandlerTest, LimitAndMarker)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -871,7 +871,7 @@ TEST_F(RPCNFTHistoryHandlerTest, SpecificLedgerIndex)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index":{}
|
||||
@@ -899,7 +899,7 @@ TEST_F(RPCNFTHistoryHandlerTest, SpecificNonexistLedgerIntIndex)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index":{}
|
||||
@@ -924,7 +924,7 @@ TEST_F(RPCNFTHistoryHandlerTest, SpecificNonexistLedgerStringIndex)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index":"{}"
|
||||
@@ -966,7 +966,7 @@ TEST_F(RPCNFTHistoryHandlerTest, SpecificLedgerHash)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_hash":"{}"
|
||||
@@ -1006,7 +1006,7 @@ TEST_F(RPCNFTHistoryHandlerTest, TxLessThanMinSeq)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -1049,7 +1049,7 @@ TEST_F(RPCNFTHistoryHandlerTest, TxLargerThanMaxSeq)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
@@ -1092,7 +1092,7 @@ TEST_F(RPCNFTHistoryHandlerTest, LimitMoreThanMax)
|
||||
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{NFTHistoryHandler{backend}};
|
||||
auto const static input = json::parse(fmt::format(
|
||||
auto static const input = json::parse(fmt::format(
|
||||
R"({{
|
||||
"nft_id":"{}",
|
||||
"ledger_index_min": {},
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -699,7 +699,7 @@ TEST_F(RPCTxTest, NFTCancelOffer)
|
||||
|
||||
for (auto const& id : output->at("meta").at("nftoken_ids").as_array()) {
|
||||
auto const idStr = id.as_string();
|
||||
const auto it = std::find(ids.begin(), ids.end(), idStr);
|
||||
auto const it = std::find(ids.begin(), ids.end(), idStr);
|
||||
ASSERT_NE(it, ids.end()) << "Unexpected NFT ID: " << idStr;
|
||||
ids.erase(it);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ CreateLedgerInfo(std::string_view ledgerHash, ripple::LedgerIndex seq, std::opti
|
||||
}
|
||||
|
||||
ripple::STObject
|
||||
CreateFeeSettingLedgerObject(
|
||||
CreateLegacyFeeSettingLedgerObject(
|
||||
uint64_t base,
|
||||
uint32_t reserveInc,
|
||||
uint32_t reserveBase,
|
||||
@@ -112,10 +112,34 @@ CreateFeeSettingLedgerObject(
|
||||
return obj;
|
||||
}
|
||||
|
||||
ripple::Blob
|
||||
CreateFeeSettingBlob(uint64_t base, uint32_t reserveInc, uint32_t reserveBase, uint32_t refFeeUnit, uint32_t flag)
|
||||
ripple::STObject
|
||||
CreateFeeSettingLedgerObject(
|
||||
ripple::STAmount base,
|
||||
ripple::STAmount reserveInc,
|
||||
ripple::STAmount reserveBase,
|
||||
uint32_t flag
|
||||
)
|
||||
{
|
||||
auto lo = CreateFeeSettingLedgerObject(base, reserveInc, reserveBase, refFeeUnit, flag);
|
||||
ripple::STObject obj(ripple::sfFee);
|
||||
obj.setFieldU16(ripple::sfLedgerEntryType, ripple::ltFEE_SETTINGS);
|
||||
obj.setFieldAmount(ripple::sfBaseFeeDrops, base);
|
||||
obj.setFieldAmount(ripple::sfReserveBaseDrops, reserveBase);
|
||||
obj.setFieldAmount(ripple::sfReserveIncrementDrops, reserveInc);
|
||||
obj.setFieldU32(ripple::sfFlags, flag);
|
||||
return obj;
|
||||
}
|
||||
|
||||
ripple::Blob
|
||||
CreateLegacyFeeSettingBlob(uint64_t base, uint32_t reserveInc, uint32_t reserveBase, uint32_t refFeeUnit, uint32_t flag)
|
||||
{
|
||||
auto lo = CreateLegacyFeeSettingLedgerObject(base, reserveInc, reserveBase, refFeeUnit, flag);
|
||||
return lo.getSerializer().peekData();
|
||||
}
|
||||
|
||||
ripple::Blob
|
||||
CreateFeeSettingBlob(ripple::STAmount base, ripple::STAmount reserveInc, ripple::STAmount reserveBase, uint32_t flag)
|
||||
{
|
||||
auto lo = CreateFeeSettingLedgerObject(base, reserveInc, reserveBase, flag);
|
||||
return lo.getSerializer().peekData();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,10 +66,33 @@ GetAccountKey(ripple::AccountID const& acc);
|
||||
CreateLedgerInfo(std::string_view ledgerHash, ripple::LedgerIndex seq, std::optional<uint32_t> age = std::nullopt);
|
||||
|
||||
/*
|
||||
* Create a FeeSetting ledger object
|
||||
* Create a Legacy (pre XRPFees amendment) FeeSetting ledger object
|
||||
*/
|
||||
[[nodiscard]] ripple::STObject
|
||||
CreateLegacyFeeSettingLedgerObject(
|
||||
uint64_t base,
|
||||
uint32_t reserveInc,
|
||||
uint32_t reserveBase,
|
||||
uint32_t refFeeUnit,
|
||||
uint32_t flag
|
||||
);
|
||||
|
||||
/*
|
||||
* Create a FeeSetting ledger object
|
||||
*/
|
||||
ripple::STObject
|
||||
CreateFeeSettingLedgerObject(
|
||||
ripple::STAmount base,
|
||||
ripple::STAmount reserveInc,
|
||||
ripple::STAmount reserveBase,
|
||||
uint32_t flag
|
||||
);
|
||||
|
||||
/*
|
||||
* Create a Legacy (pre XRPFees amendment) FeeSetting ledger object and return its blob
|
||||
*/
|
||||
[[nodiscard]] ripple::Blob
|
||||
CreateLegacyFeeSettingBlob(
|
||||
uint64_t base,
|
||||
uint32_t reserveInc,
|
||||
uint32_t reserveBase,
|
||||
@@ -80,8 +103,8 @@ CreateFeeSettingLedgerObject(
|
||||
/*
|
||||
* Create a FeeSetting ledger object and return its blob
|
||||
*/
|
||||
[[nodiscard]] ripple::Blob
|
||||
CreateFeeSettingBlob(uint64_t base, uint32_t reserveInc, uint32_t reserveBase, uint32_t refFeeUnit, uint32_t flag);
|
||||
ripple::Blob
|
||||
CreateFeeSettingBlob(ripple::STAmount base, ripple::STAmount reserveInc, ripple::STAmount reserveBase, uint32_t flag);
|
||||
|
||||
/*
|
||||
* Create a payment transaction object
|
||||
|
||||
Reference in New Issue
Block a user