From ffa323808d592f59405a3344651a56fae862a774 Mon Sep 17 00:00:00 2001 From: JCW Date: Thu, 28 Aug 2025 21:55:14 +0100 Subject: [PATCH] Fix issues --- include/xrpl/beast/utility/Journal.h | 106 +++++++++----------- include/xrpl/server/detail/BasePeer.h | 12 +-- src/libxrpl/beast/utility/beast_Journal.cpp | 14 +-- src/test/core/Coroutine_test.cpp | 6 +- src/tests/libxrpl/basics/log.cpp | 97 ++++++++++++------ src/xrpld/app/consensus/RCLConsensus.cpp | 5 +- src/xrpld/app/misc/NetworkOPs.cpp | 3 +- src/xrpld/app/tx/detail/Transactor.cpp | 3 +- src/xrpld/app/tx/detail/Transactor.h | 6 +- src/xrpld/core/Coro.ipp | 6 +- src/xrpld/core/detail/JobQueue.cpp | 5 +- src/xrpld/overlay/detail/OverlayImpl.cpp | 3 +- src/xrpld/overlay/detail/PeerImp.cpp | 15 +-- src/xrpld/overlay/detail/PeerImp.h | 12 ++- 14 files changed, 162 insertions(+), 131 deletions(-) diff --git a/include/xrpl/beast/utility/Journal.h b/include/xrpl/beast/utility/Journal.h index 6a232cf57c..d8f2e369ba 100644 --- a/include/xrpl/beast/utility/Journal.h +++ b/include/xrpl/beast/utility/Journal.h @@ -21,13 +21,14 @@ #define BEAST_UTILITY_JOURNAL_H_INCLUDED #include + #include #include -#include +#include #include #include - +#include namespace ripple::log { template @@ -75,7 +76,7 @@ operator<<(std::ostream& os, LogField const& param); template std::ostream& operator<<(std::ostream& os, LogParameter const& param); -} +} // namespace ripple::log namespace beast { @@ -117,7 +118,9 @@ class Journal public: template friend std::ostream& - ripple::log::operator<<(std::ostream& os, ripple::log::LogField const& param); + ripple::log::operator<<( + std::ostream& os, + ripple::log::LogField const& param); template friend std::ostream& @@ -198,7 +201,6 @@ private: static thread_local JsonLogContext currentJsonLogContext_; - // Invariant: m_sink always points to a valid Sink Sink* m_sink = nullptr; @@ -206,9 +208,11 @@ private: initMessageContext(std::source_location location); static std::string - formatLog(std::string const& message, + formatLog( + std::string const& message, severities::Severity severity, std::optional const& attributes = std::nullopt); + public: //-------------------------------------------------------------------------- @@ -300,10 +304,7 @@ public: { public: ScopedStream(ScopedStream const& other) - : ScopedStream( - other.m_attributes, - other.m_sink, - other.m_level) + : ScopedStream(other.m_attributes, other.m_sink, other.m_level) { } @@ -390,10 +391,7 @@ public: /** Construct or copy another Stream. */ Stream(Stream const& other) - : Stream( - other.m_attributes, - other.m_sink, - other.m_level) + : Stream(other.m_attributes, other.m_sink, other.m_level) { } @@ -471,8 +469,7 @@ public: if (m_attributes.has_value()) m_attributes = JsonLogAttributes::combine( other.m_attributes->contextValues_, - m_attributes->contextValues_ - ); + m_attributes->contextValues_); else m_attributes = other.m_attributes; } @@ -521,8 +518,7 @@ public: Stream stream(Severity level) const { - return Stream( - m_attributes, *m_sink, level); + return Stream(m_attributes, *m_sink, level); } /** Returns `true` if any message would be logged at this severity level. @@ -542,10 +538,7 @@ public: { if (m_jsonLogsEnabled) initMessageContext(location); - return { - m_attributes, - *m_sink, - severities::kTrace}; + return {m_attributes, *m_sink, severities::kTrace}; } Stream @@ -553,10 +546,7 @@ public: { if (m_jsonLogsEnabled) initMessageContext(location); - return { - m_attributes, - *m_sink, - severities::kDebug}; + return {m_attributes, *m_sink, severities::kDebug}; } Stream @@ -564,23 +554,17 @@ public: { if (m_jsonLogsEnabled) initMessageContext(location); - return { - m_attributes, - *m_sink, - severities::kInfo}; + return {m_attributes, *m_sink, severities::kInfo}; } Stream warn(std::source_location location = std::source_location::current()) const { - const char* a = "a"; + char const* a = "a"; rapidjson::Value v{a, 1}; if (m_jsonLogsEnabled) initMessageContext(location); - return { - m_attributes, - *m_sink, - severities::kWarning}; + return {m_attributes, *m_sink, severities::kWarning}; } Stream @@ -588,10 +572,7 @@ public: { if (m_jsonLogsEnabled) initMessageContext(location); - return { - m_attributes, - *m_sink, - severities::kError}; + return {m_attributes, *m_sink, severities::kError}; } Stream @@ -599,10 +580,7 @@ public: { if (m_jsonLogsEnabled) initMessageContext(location); - return { - m_attributes, - *m_sink, - severities::kFatal}; + return {m_attributes, *m_sink, severities::kFatal}; } /** @} */ @@ -614,7 +592,9 @@ public: { globalLogAttributes_ = JsonLogAttributes{}; } - globalLogAttributes_ = JsonLogAttributes::combine(globalLogAttributes_->contextValues(), globalLogAttributes.contextValues()); + globalLogAttributes_ = JsonLogAttributes::combine( + globalLogAttributes_->contextValues(), + globalLogAttributes.contextValues()); } }; @@ -725,12 +705,12 @@ using logwstream = basic_logstream; } // namespace beast - namespace ripple::log { namespace detail { template -void setJsonValue( +void +setJsonValue( rapidjson::Value& object, rapidjson::MemoryPoolAllocator<>& allocator, char const* name, @@ -739,7 +719,10 @@ void setJsonValue( { using ValueType = std::decay_t; rapidjson::Value jsonValue; - if constexpr (std::constructible_from&>) + if constexpr (std::constructible_from< + rapidjson::Value, + ValueType, + rapidjson::MemoryPoolAllocator<>&>) { jsonValue = rapidjson::Value{value, allocator}; if (outStream) @@ -777,12 +760,9 @@ void setJsonValue( } object.AddMember( - rapidjson::StringRef(name), - std::move(jsonValue), - allocator - ); -} + rapidjson::StringRef(name), std::move(jsonValue), allocator); } +} // namespace detail template std::ostream& @@ -793,7 +773,9 @@ operator<<(std::ostream& os, LogParameter const& param) detail::setJsonValue( beast::Journal::currentJsonLogContext_.messageParams, beast::Journal::currentJsonLogContext_.allocator, - param.name_, param.value_, &os); + param.name_, + param.value_, + &os); return os; } @@ -806,7 +788,9 @@ operator<<(std::ostream& os, LogField const& param) detail::setJsonValue( beast::Journal::currentJsonLogContext_.messageParams, beast::Journal::currentJsonLogContext_.allocator, - param.name_, param.value_, nullptr); + param.name_, + param.value_, + nullptr); return os; } @@ -824,17 +808,19 @@ field(char const* name, T&& value) return LogField{name, std::forward(value)}; } -template +template [[nodiscard]] beast::Journal::JsonLogAttributes attributes(Pair&&... pairs) { beast::Journal::JsonLogAttributes result; (detail::setJsonValue( - result.contextValues(), - result.allocator(), - pairs.first, - pairs.second, nullptr), ...); + result.contextValues(), + result.allocator(), + pairs.first, + pairs.second, + nullptr), + ...); return result; } @@ -846,6 +832,6 @@ attr(char const* name, T&& value) return std::make_pair(name, std::forward(value)); } -} +} // namespace ripple::log #endif diff --git a/include/xrpl/server/detail/BasePeer.h b/include/xrpl/server/detail/BasePeer.h index cafce239bc..3c2aeb15d4 100644 --- a/include/xrpl/server/detail/BasePeer.h +++ b/include/xrpl/server/detail/BasePeer.h @@ -84,12 +84,12 @@ BasePeer::BasePeer( , handler_(handler) , remote_address_(remote_address) , j_(journal, - log::attributes( - log::attr("PeerID", - [] { - static std::atomic id{0}; - return "##" + std::to_string(++id) + " "; - }()))) + log::attributes(log::attr( + "PeerID", + [] { + static std::atomic id{0}; + return "##" + std::to_string(++id) + " "; + }()))) , work_(executor) , strand_(executor) { diff --git a/src/libxrpl/beast/utility/beast_Journal.cpp b/src/libxrpl/beast/utility/beast_Journal.cpp index bcb9c3048e..122bc11f5e 100644 --- a/src/libxrpl/beast/utility/beast_Journal.cpp +++ b/src/libxrpl/beast/utility/beast_Journal.cpp @@ -20,14 +20,14 @@ #include #include -#include #include +#include -#include -#include #include #include +#include #include +#include namespace beast { @@ -151,8 +151,7 @@ Journal::JsonLogAttributes::setModuleName(std::string const& name) contextValues_.AddMember( rapidjson::StringRef("Module"), rapidjson::Value{name.c_str(), allocator_}, - allocator_ - ); + allocator_); } Journal::JsonLogAttributes @@ -166,7 +165,7 @@ Journal::JsonLogAttributes::combine( for (auto& member : b.GetObject()) { - auto val = rapidjson::Value{ member.value, result.allocator_ }; + auto val = rapidjson::Value{member.value, result.allocator_}; if (result.contextValues_.HasMember(member.name)) { result.contextValues_[member.name] = std::move(val); @@ -206,7 +205,8 @@ Journal::formatLog( if (globalLogAttributes_) { - for (auto const& [key, value] : globalLogAttributes_->contextValues().GetObject()) + for (auto const& [key, value] : + globalLogAttributes_->contextValues().GetObject()) { rapidjson::Value jsonValue; jsonValue.CopyFrom(value, currentJsonLogContext_.allocator); diff --git a/src/test/core/Coroutine_test.cpp b/src/test/core/Coroutine_test.cpp index bbdd2e9b00..e4e829919d 100644 --- a/src/test/core/Coroutine_test.cpp +++ b/src/test/core/Coroutine_test.cpp @@ -178,7 +178,6 @@ public: void test_yield_and_stop() { - using namespace std::chrono_literals; using namespace jtx; @@ -230,7 +229,10 @@ public: try { th.join(); - } catch (const std::exception& e) {} + } + catch (std::exception const& e) + { + } pass(); } diff --git a/src/tests/libxrpl/basics/log.cpp b/src/tests/libxrpl/basics/log.cpp index 5d6e7ca2cc..fb634a3a71 100644 --- a/src/tests/libxrpl/basics/log.cpp +++ b/src/tests/libxrpl/basics/log.cpp @@ -19,8 +19,8 @@ #include -#include #include +#include using namespace ripple; @@ -152,14 +152,16 @@ TEST_CASE("Global attributes") MockLogs logs{logStream, beast::severities::kAll}; beast::Journal::enableStructuredJournal(); - beast::Journal::addGlobalAttributes(log::attributes(log::attr("Field1", "Value1"))); + beast::Journal::addGlobalAttributes( + log::attributes(log::attr("Field1", "Value1"))); logs.journal("Test").debug() << "Test"; rapidjson::Document jsonLog; jsonLog.Parse(logStream.str().c_str()); - CHECK(jsonLog.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + jsonLog.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(jsonLog.IsObject()); CHECK(jsonLog.HasMember("Field1")); @@ -175,18 +177,21 @@ TEST_CASE("Global attributes inheritable") MockLogs logs{logStream, beast::severities::kAll}; beast::Journal::enableStructuredJournal(); - beast::Journal::addGlobalAttributes(log::attributes(log::attr("Field1", "Value1"))); + beast::Journal::addGlobalAttributes( + log::attributes(log::attr("Field1", "Value1"))); logs.journal( "Test", - log::attributes(log::attr("Field1", "Value3"), log::attr("Field2", "Value2"))) + log::attributes( + log::attr("Field1", "Value3"), log::attr("Field2", "Value2"))) .debug() << "Test"; rapidjson::Document jsonLog; jsonLog.Parse(logStream.str().c_str()); - CHECK(jsonLog.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + jsonLog.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(jsonLog.IsObject()); CHECK(jsonLog.HasMember("Field1")); @@ -265,7 +270,8 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogFields") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(logValue.IsObject()); CHECK(logValue.HasMember("Function")); @@ -294,7 +300,9 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogLevels") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == + rapidjson::ParseErrorCode::kParseErrorNone); CHECK( logValue["Level"].GetString() == @@ -308,8 +316,9 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogLevels") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); - + CHECK( + logValue.GetParseError() == + rapidjson::ParseErrorCode::kParseErrorNone); CHECK( logValue["Level"].GetString() == @@ -323,8 +332,9 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogLevels") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); - + CHECK( + logValue.GetParseError() == + rapidjson::ParseErrorCode::kParseErrorNone); CHECK( logValue["Level"].GetString() == @@ -338,8 +348,9 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogLevels") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); - + CHECK( + logValue.GetParseError() == + rapidjson::ParseErrorCode::kParseErrorNone); CHECK( logValue["Level"].GetString() == @@ -353,8 +364,9 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogLevels") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); - + CHECK( + logValue.GetParseError() == + rapidjson::ParseErrorCode::kParseErrorNone); CHECK( logValue["Level"].GetString() == @@ -368,7 +380,9 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogLevels") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == + rapidjson::ParseErrorCode::kParseErrorNone); CHECK( logValue["Level"].GetString() == @@ -383,7 +397,8 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogStream") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK( logValue["Level"].GetString() == @@ -400,7 +415,8 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogParams") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(logValue["Params"].IsObject()); CHECK(logValue["Params"]["Field1"].IsNumber()); @@ -409,9 +425,13 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogParams") // NOTE: We should expect it to be an int64 after we make the json library // support in64 and uint64 CHECK(logValue["Params"]["Field2"].IsNumber()); - CHECK(logValue["Params"]["Field2"].GetUint64() == std::numeric_limits::max()); + CHECK( + logValue["Params"]["Field2"].GetUint64() == + std::numeric_limits::max()); CHECK(logValue["Message"].IsString()); - CHECK(logValue["Message"].GetString() == std::string{"Test: 1, 18446744073709551615"}); + CHECK( + logValue["Message"].GetString() == + std::string{"Test: 1, 18446744073709551615"}); } TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogFields") @@ -424,8 +444,8 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogFields") rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); - + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(logValue["Params"].IsObject()); CHECK(logValue["Params"]["Field1"].IsNumber()); @@ -434,7 +454,9 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogFields") // NOTE: We should expect it to be an int64 after we make the json library // support in64 and uint64 CHECK(logValue["Params"]["Field2"].IsNumber()); - CHECK(logValue["Params"]["Field2"].GetUint64() == std::numeric_limits::max()); + CHECK( + logValue["Params"]["Field2"].GetUint64() == + std::numeric_limits::max()); CHECK(logValue["Message"].IsString()); CHECK(logValue["Message"].GetString() == std::string{"Test"}); } @@ -442,14 +464,16 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJsonLogFields") TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJournalAttributes") { beast::Journal j{ - journal(), log::attributes(log::attr("Field1", "Value1"), log::attr("Field2", 2))}; + journal(), + log::attributes(log::attr("Field1", "Value1"), log::attr("Field2", 2))}; j.debug() << "Test"; rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(logValue["Field1"].IsString()); CHECK(logValue["Field1"].GetString() == std::string{"Value1"}); @@ -460,16 +484,19 @@ TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJournalAttributes") TEST_CASE_FIXTURE(JsonLogStreamFixture, "TestJournalAttributesInheritable") { beast::Journal j{ - journal(), log::attributes(log::attr("Field1", "Value1"), log::attr("Field2", 2))}; + journal(), + log::attributes(log::attr("Field1", "Value1"), log::attr("Field2", 2))}; beast::Journal j2{ - j, log::attributes(log::attr("Field3", "Value3"), log::attr("Field2", 0))}; + j, + log::attributes(log::attr("Field3", "Value3"), log::attr("Field2", 0))}; j2.debug() << "Test"; rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(logValue["Field1"].IsString()); CHECK(logValue["Field1"].GetString() == std::string{"Value1"}); @@ -488,14 +515,16 @@ TEST_CASE_FIXTURE( journal(), log::attributes(log::attr("Field1", "Value1"), log::attr("Field2", 2))}; beast::Journal j2{ - j, log::attributes(log::attr("Field3", "Value3"), log::attr("Field2", 0))}; + j, + log::attributes(log::attr("Field3", "Value3"), log::attr("Field2", 0))}; j2.debug() << "Test"; rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(logValue["Field1"].IsString()); CHECK(logValue["Field1"].GetString() == std::string{"Value1"}); @@ -523,7 +552,8 @@ TEST_CASE_FIXTURE( rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(logValue["Field1"].IsString()); CHECK(logValue["Field1"].GetString() == std::string{"Value1"}); @@ -548,7 +578,8 @@ TEST_CASE_FIXTURE( rapidjson::Document logValue; logValue.Parse(stream().str().c_str()); - CHECK(logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); + CHECK( + logValue.GetParseError() == rapidjson::ParseErrorCode::kParseErrorNone); CHECK(logValue["Field1"].IsString()); CHECK(logValue["Field1"].GetString() == std::string{"Value1"}); diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index b95f8cd5db..431b9e6bc2 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -1109,7 +1109,10 @@ RclConsensusLogger::RclConsensusLogger( bool const validating, beast::Journal j, std::source_location location) - : j_(j, log::attributes(log::attr("Role", "ConsensusLogger"), log::attr("Label", label))) + : j_(j, + log::attributes( + log::attr("Role", "ConsensusLogger"), + log::attr("Label", label))) , location_(location) { if (!validating && !j.info()) diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index b22071d870..5df8433451 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -1260,7 +1260,8 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) { beast::Journal journal{ m_journal, - log::attributes(log::attr("TransactionID", to_string(transaction->getID())))}; + log::attributes( + log::attr("TransactionID", to_string(transaction->getID())))}; auto const newFlags = app_.getHashRouter().getFlags(transaction->getID()); if ((newFlags & HashRouterFlags::BAD) != HashRouterFlags::UNDEFINED) diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index 9c0deea3b9..ddcb050cf1 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -211,8 +211,7 @@ Transactor::Transactor(ApplyContext& ctx) , j_(ctx.journal, log::attributes( log::attr("TransactionID", to_string(ctx_.tx.getTransactionID())), - log::attr("AccountID", to_string(account_)) - )) + log::attr("AccountID", to_string(account_)))) { } diff --git a/src/xrpld/app/tx/detail/Transactor.h b/src/xrpld/app/tx/detail/Transactor.h index 2bbfd0f8e7..c607ad0516 100644 --- a/src/xrpld/app/tx/detail/Transactor.h +++ b/src/xrpld/app/tx/detail/Transactor.h @@ -55,8 +55,7 @@ public: , j(j_, log::attributes( log::attr("TransactionID", to_string(tx.getTransactionID())), - log::attr("AccountID", to_string(tx.getAccountID(sfAccount))) - )) + log::attr("AccountID", to_string(tx.getAccountID(sfAccount))))) { XRPL_ASSERT( (flags_ & tapBATCH) == tapBATCH, "Batch apply flag should be set"); @@ -107,8 +106,7 @@ public: , j(j_, log::attributes( log::attr("TransactionID", to_string(tx.getTransactionID())), - log::attr("AccountID", to_string(tx.getAccountID(sfAccount))) - )) + log::attr("AccountID", to_string(tx.getAccountID(sfAccount))))) { XRPL_ASSERT( parentBatchId.has_value() == ((flags_ & tapBATCH) == tapBATCH), diff --git a/src/xrpld/core/Coro.ipp b/src/xrpld/core/Coro.ipp index 3f67568e39..9abf4bbf81 100644 --- a/src/xrpld/core/Coro.ipp +++ b/src/xrpld/core/Coro.ipp @@ -101,7 +101,8 @@ JobQueue::Coro::resume() XRPL_ASSERT( jq_.nSuspend_ > 0, - "ripple::JobQueue::Coro::resume jq_.nSuspend_ should be greater than 0"); + "ripple::JobQueue::Coro::resume jq_.nSuspend_ should be greater " + "than 0"); --jq_.nSuspend_; } auto saved = detail::getLocalValues().release(); @@ -141,7 +142,8 @@ JobQueue::Coro::expectEarlyExit() XRPL_ASSERT( jq_.nSuspend_ > 0, - "ripple::JobQueue::Coro::expectEarlyExit() jq_.nSuspend_ should be greater than 0"); + "ripple::JobQueue::Coro::expectEarlyExit() jq_.nSuspend_ should be " + "greater than 0"); --jq_.nSuspend_; #ifndef NDEBUG finished_ = true; diff --git a/src/xrpld/core/detail/JobQueue.cpp b/src/xrpld/core/detail/JobQueue.cpp index ceb449f3b9..986bb68545 100644 --- a/src/xrpld/core/detail/JobQueue.cpp +++ b/src/xrpld/core/detail/JobQueue.cpp @@ -305,8 +305,9 @@ JobQueue::stop() // `Job::doJob` and the return of `JobQueue::processTask`. That is why // we must wait on the condition variable to make these assertions. std::unique_lock lock(m_mutex); - cv_.wait( - lock, [this] { return m_processCount == 0 && nSuspend_ == 0 && m_jobSet.empty(); }); + cv_.wait(lock, [this] { + return m_processCount == 0 && nSuspend_ == 0 && m_jobSet.empty(); + }); XRPL_ASSERT( m_processCount == 0, "ripple::JobQueue::stop : all processes completed"); diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index 0aa949b533..ae3d20665c 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -165,7 +165,8 @@ OverlayImpl::onHandoff( endpoint_type remote_endpoint) { auto const id = next_id_++; - auto journal = app_.journal("Peer", log::attributes(log::attr("NodeID", id))); + auto journal = + app_.journal("Peer", log::attributes(log::attr("NodeID", id))); Handoff handoff; if (processRequest(request, handoff)) diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index ffd4435bc0..c097d71d8c 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -81,14 +81,18 @@ PeerImp::PeerImp( app_.journal("Peer"), log::attributes( log::attr("NodeID", id), - log::attr("RemoteAddress", to_string(slot->remote_endpoint())), - log::attr("PublicKey", toBase58(TokenType::NodePublic, publicKey)))) + log::attr("RemoteAddress", to_string(slot->remote_endpoint())), + log::attr( + "PublicKey", + toBase58(TokenType::NodePublic, publicKey)))) , p_journal_( app_.journal("Protocol"), log::attributes( log::attr("NodeID", id), - log::attr("RemoteAddress", to_string(slot->remote_endpoint())), - log::attr("PublicKey", toBase58(TokenType::NodePublic, publicKey)))) + log::attr("RemoteAddress", to_string(slot->remote_endpoint())), + log::attr( + "PublicKey", + toBase58(TokenType::NodePublic, publicKey)))) , stream_ptr_(std::move(stream_ptr)) , socket_(stream_ptr_->next_layer().socket()) , stream_(*stream_ptr_) @@ -1306,8 +1310,7 @@ PeerImp::handleTransaction( p_journal_, log::attributes( log::attr("TransactionID", to_string(txID)), - log::attr("RawTransaction", strHex(m->rawtransaction())) - )}; + log::attr("RawTransaction", strHex(m->rawtransaction())))}; // Charge strongly for attempting to relay a txn with tfInnerBatchTxn // LCOV_EXCL_START diff --git a/src/xrpld/overlay/detail/PeerImp.h b/src/xrpld/overlay/detail/PeerImp.h index ac47ce725c..dafb9e0ddf 100644 --- a/src/xrpld/overlay/detail/PeerImp.h +++ b/src/xrpld/overlay/detail/PeerImp.h @@ -661,14 +661,18 @@ PeerImp::PeerImp( app_.journal("Peer"), log::attributes( log::attr("NodeID", id), - log::attr("RemoteAddress", to_string(slot->remote_endpoint())), - log::attr("PublicKey", toBase58(TokenType::NodePublic, publicKey)))) + log::attr("RemoteAddress", to_string(slot->remote_endpoint())), + log::attr( + "PublicKey", + toBase58(TokenType::NodePublic, publicKey)))) , p_journal_( app_.journal("Protocol"), log::attributes( log::attr("NodeID", id), - log::attr("RemoteAddress", to_string(slot->remote_endpoint())), - log::attr("PublicKey", toBase58(TokenType::NodePublic, publicKey)))) + log::attr("RemoteAddress", to_string(slot->remote_endpoint())), + log::attr( + "PublicKey", + toBase58(TokenType::NodePublic, publicKey)))) , stream_ptr_(std::move(stream_ptr)) , socket_(stream_ptr_->next_layer().socket()) , stream_(*stream_ptr_)