Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into action
Browse files Browse the repository at this point in the history
* upstream/develop:
  Fix Windows build by removing two unused declarations (4708)
  Match unit tests on start of test name (4634)
  Revert ThreadName due to problems on Windows (4702)
  `XChainBridge`: Introduce sidechain support (XLS-38): (4292)
  APIv2(account_tx, noripple_check): return error on invalid input (4620)
  • Loading branch information
ximinez committed Sep 15, 2023
2 parents a35dd82 + 237b406 commit efd32a6
Show file tree
Hide file tree
Showing 87 changed files with 12,735 additions and 551 deletions.
6 changes: 4 additions & 2 deletions Builds/CMake/CMakeFuncs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ macro(group_sources curdir)
endmacro()

macro (exclude_from_default target_)
set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_ALL ON)
set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON)
if(target_)
set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_ALL ON)
set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON)
endif()
endmacro ()

macro (exclude_if_included target_)
Expand Down
15 changes: 12 additions & 3 deletions Builds/CMake/RippledCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ add_library(xrpl::libxrpl ALIAS libxrpl)
#]===============================]
target_sources (xrpl_core PRIVATE
src/ripple/beast/clock/basic_seconds_clock.cpp
src/ripple/beast/core/CurrentThreadName.cpp
src/ripple/beast/core/SemanticVersion.cpp
src/ripple/beast/hash/impl/xxhash.cpp
src/ripple/beast/insight/impl/Collector.cpp
Expand Down Expand Up @@ -55,7 +56,6 @@ target_sources (xrpl_core PRIVATE
src/ripple/basics/impl/Log.cpp
src/ripple/basics/impl/Number.cpp
src/ripple/basics/impl/StringUtilities.cpp
src/ripple/basics/impl/ThreadUtilities.cpp
#[===============================[
main sources:
subdir: json
Expand Down Expand Up @@ -103,7 +103,9 @@ target_sources (xrpl_core PRIVATE
src/ripple/protocol/impl/STObject.cpp
src/ripple/protocol/impl/STParsedJSON.cpp
src/ripple/protocol/impl/STPathSet.cpp
src/ripple/protocol/impl/STXChainBridge.cpp
src/ripple/protocol/impl/STTx.cpp
src/ripple/protocol/impl/XChainAttestations.cpp
src/ripple/protocol/impl/STValidation.cpp
src/ripple/protocol/impl/STVar.cpp
src/ripple/protocol/impl/STVector256.cpp
Expand Down Expand Up @@ -201,7 +203,6 @@ install (
src/ripple/basics/tagged_integer.h
src/ripple/basics/SubmitSync.h
src/ripple/basics/ThreadSafetyAnalysis.h
src/ripple/basics/ThreadUtilities.h
src/ripple/basics/ToString.h
src/ripple/basics/UnorderedContainers.h
src/ripple/basics/UptimeClock.h
Expand Down Expand Up @@ -243,6 +244,7 @@ install (
src/ripple/protocol/Indexes.h
src/ripple/protocol/InnerObjectFormats.h
src/ripple/protocol/Issue.h
src/ripple/protocol/json_get_or_throw.h
src/ripple/protocol/KeyType.h
src/ripple/protocol/Keylet.h
src/ripple/protocol/KnownFormats.h
Expand Down Expand Up @@ -273,6 +275,8 @@ install (
src/ripple/protocol/STParsedJSON.h
src/ripple/protocol/STPathSet.h
src/ripple/protocol/STTx.h
src/ripple/protocol/XChainAttestations.h
src/ripple/protocol/STXChainBridge.h
src/ripple/protocol/STValidation.h
src/ripple/protocol/STVector256.h
src/ripple/protocol/SecretKey.h
Expand Down Expand Up @@ -310,6 +314,7 @@ install (
DESTINATION include/ripple/beast/clock)
install (
FILES
src/ripple/beast/core/CurrentThreadName.h
src/ripple/beast/core/LexicalCast.h
src/ripple/beast/core/List.h
src/ripple/beast/core/SemanticVersion.h
Expand Down Expand Up @@ -528,6 +533,7 @@ target_sources (rippled PRIVATE
src/ripple/app/tx/impl/SetRegularKey.cpp
src/ripple/app/tx/impl/SetSignerList.cpp
src/ripple/app/tx/impl/SetTrust.cpp
src/ripple/app/tx/impl/XChainBridge.cpp
src/ripple/app/tx/impl/SignerEntries.cpp
src/ripple/app/tx/impl/Taker.cpp
src/ripple/app/tx/impl/Transactor.cpp
Expand Down Expand Up @@ -809,6 +815,7 @@ if (tests)
src/test/app/ReducedOffer_test.cpp
src/test/app/Regression_test.cpp
src/test/app/SHAMapStore_test.cpp
src/test/app/XChain_test.cpp
src/test/app/SetAuth_test.cpp
src/test/app/SetRegularKey_test.cpp
src/test/app/SetTrust_test.cpp
Expand Down Expand Up @@ -839,7 +846,6 @@ if (tests)
src/test/basics/Slice_test.cpp
src/test/basics/StringUtilities_test.cpp
src/test/basics/TaggedCache_test.cpp
src/test/basics/ThreadName_test.cpp
src/test/basics/XRPAmount_test.cpp
src/test/basics/base64_test.cpp
src/test/basics/base_uint_test.cpp
Expand All @@ -857,6 +863,7 @@ if (tests)
src/test/beast/LexicalCast_test.cpp
src/test/beast/SemanticVersion_test.cpp
src/test/beast/aged_associative_container_test.cpp
src/test/beast/beast_CurrentThreadName_test.cpp
src/test/beast/beast_Journal_test.cpp
src/test/beast/beast_PropertyStream_test.cpp
src/test/beast/beast_Zero_test.cpp
Expand Down Expand Up @@ -927,6 +934,7 @@ if (tests)
src/test/jtx/impl/acctdelete.cpp
src/test/jtx/impl/account_txn_id.cpp
src/test/jtx/impl/amount.cpp
src/test/jtx/impl/attester.cpp
src/test/jtx/impl/balance.cpp
src/test/jtx/impl/check.cpp
src/test/jtx/impl/delivermin.cpp
Expand All @@ -948,6 +956,7 @@ if (tests)
src/test/jtx/impl/regkey.cpp
src/test/jtx/impl/sendmax.cpp
src/test/jtx/impl/seq.cpp
src/test/jtx/impl/xchain_bridge.cpp
src/test/jtx/impl/sig.cpp
src/test/jtx/impl/tag.cpp
src/test/jtx/impl/ticket.cpp
Expand Down
6 changes: 6 additions & 0 deletions Builds/CMake/RippledRelease.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
package/container targets - (optional)
#]===================================================================]

# Early return if the `containers` directory is missing,
# e.g. when we are building a Conan package.
if(NOT EXISTS containers)
return()
endif()

if (is_root_project)
if (NOT DOCKER)
find_program (DOCKER docker)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# make GIT_COMMIT_HASH define available to all sources
find_package(Git)
if(Git_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=40
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git describe --always --abbrev=40
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE gch)
if(gch)
set(GIT_COMMIT_HASH "${gch}")
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/ledger/impl/LedgerCleaner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <ripple/app/ledger/LedgerCleaner.h>
#include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/app/misc/LoadFeeTrack.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/protocol/jss.h>

namespace ripple {
Expand Down Expand Up @@ -218,7 +218,7 @@ class LedgerCleanerImp : public LedgerCleaner
void
run()
{
this_thread::set_name("LedgerCleaner");
beast::setCurrentThreadName("LedgerCleaner");
JLOG(j_.debug()) << "Started";

while (true)
Expand Down
6 changes: 6 additions & 0 deletions src/ripple/app/main/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,12 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline)
}
}

if (auto const& forcedRange = config().FORCED_LEDGER_RANGE_PRESENT)
{
m_ledgerMaster->setLedgerRangePresent(
forcedRange->first, forcedRange->second);
}

if (!config().reporting())
m_orderBookDB.setup(getLedgerMaster().getCurrentLedger());

Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/main/BasicApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//==============================================================================

#include <ripple/app/main/BasicApp.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/beast/core/CurrentThreadName.h>

BasicApp::BasicApp(std::size_t numberOfThreads)
{
Expand All @@ -28,7 +28,7 @@ BasicApp::BasicApp(std::size_t numberOfThreads)
while (numberOfThreads--)
{
threads_.emplace_back([this, numberOfThreads]() {
ripple::this_thread::set_name(
beast::setCurrentThreadName(
"io svc #" + std::to_string(numberOfThreads));
this->io_service_.run();
});
Expand Down
5 changes: 3 additions & 2 deletions src/ripple/app/main/GRPCServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <ripple/app/main/GRPCServer.h>
#include <ripple/app/reporting/P2pProxy.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/resource/Fees.h>

#include <ripple/beast/net/IPAddressConversion.h>
Expand Down Expand Up @@ -692,8 +692,9 @@ GRPCServer::start()
if (running_ = impl_.start(); running_)
{
thread_ = std::thread([this]() {
beast::setCurrentThreadName("rippled : GRPCServer");
// Start the event loop and begin handling requests
this_thread::set_name("rippled: grpc");
beast::setCurrentThreadName("rippled: grpc");
this->impl_.handleRpcs();
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/main/LoadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <ripple/app/main/LoadManager.h>
#include <ripple/app/misc/LoadFeeTrack.h>
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/basics/UptimeClock.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/json/to_string.h>
#include <memory>
#include <mutex>
Expand Down Expand Up @@ -99,7 +99,7 @@ LoadManager::stop()
void
LoadManager::run()
{
this_thread::set_name("LoadManager");
beast::setCurrentThreadName("LoadManager");

using namespace std::chrono_literals;
using clock_type = std::chrono::steady_clock;
Expand Down
61 changes: 56 additions & 5 deletions src/ripple/app/main/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <ripple/app/rdb/Vacuum.h>
#include <ripple/basics/Log.h>
#include <ripple/basics/StringUtilities.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/basics/contract.h>
#include <ripple/beast/clock/basic_seconds_clock.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/core/Config.h>
#include <ripple/core/ConfigSections.h>
#include <ripple/core/TimeKeeper.h>
Expand Down Expand Up @@ -348,7 +348,8 @@ run(int argc, char** argv)
{
using namespace std;

this_thread::set_name("main " + BuildInfo::getVersionString());
beast::setCurrentThreadName(
"rippled: main " + BuildInfo::getVersionString());

po::variables_map vm;

Expand Down Expand Up @@ -378,8 +379,13 @@ run(int argc, char** argv)
"Override the minimum validation quorum.")(
"reportingReadOnly", "Run in read-only reporting mode")(
"silent", "No output to the console after startup.")(
"standalone,a", "Run with no peers.")("verbose,v", "Verbose logging.")(
"version", "Display the build version.");
"standalone,a", "Run with no peers.")("verbose,v", "Verbose logging.")

("force_ledger_present_range",
po::value<std::string>(),
"Specify the range of present ledgers for testing purposes. Min and "
"max values are comma separated.")(
"version", "Display the build version.");

po::options_description data("Ledger/Data Options");
data.add_options()("import", importText.c_str())(
Expand Down Expand Up @@ -602,6 +608,51 @@ run(int argc, char** argv)
return 0;
}

if (vm.contains("force_ledger_present_range"))
{
try
{
auto const r = [&vm]() -> std::vector<std::uint32_t> {
std::vector<std::string> strVec;
boost::split(
strVec,
vm["force_ledger_present_range"].as<std::string>(),
boost::algorithm::is_any_of(","));
std::vector<std::uint32_t> result;
for (auto& s : strVec)
{
boost::trim(s);
if (!s.empty())
result.push_back(std::stoi(s));
}
return result;
}();

if (r.size() == 2)
{
if (r[0] > r[1])
{
throw std::runtime_error(
"Invalid force_ledger_present_range parameter");
}
config->FORCED_LEDGER_RANGE_PRESENT.emplace(r[0], r[1]);
}
else
{
throw std::runtime_error(
"Invalid force_ledger_present_range parameter");
}
}
catch (std::exception const& e)
{
std::cerr << "invalid 'force_ledger_present_range' parameter. The "
"parameter must be two numbers separated by a comma. "
"The first number must be <= the second."
<< std::endl;
return -1;
}
}

if (vm.count("start"))
{
config->START_UP = Config::FRESH;
Expand Down Expand Up @@ -776,7 +827,7 @@ run(int argc, char** argv)
}

// We have an RPC command to process:
this_thread::set_name("rippled: rpc");
beast::setCurrentThreadName("rippled: rpc");
return RPCCall::fromCommandLine(
*config, vm["parameters"].as<std::vector<std::string>>(), *logs);
}
Expand Down
Loading

0 comments on commit efd32a6

Please sign in to comment.