From 9eca2770f9776d4eebe484158e01acba2ccf797a Mon Sep 17 00:00:00 2001 From: Bronek Kozicki Date: Thu, 17 Oct 2024 12:26:03 +0000 Subject: [PATCH] Reformat code with clang-format-18 --- include/xrpl/basics/Expected.h | 53 ++-- include/xrpl/basics/FeeUnits.h | 24 +- include/xrpl/basics/IOUAmount.h | 6 +- include/xrpl/basics/Number.h | 6 +- include/xrpl/basics/XRPAmount.h | 6 +- include/xrpl/basics/base_uint.h | 3 +- include/xrpl/basics/safe_cast.h | 4 +- include/xrpl/basics/tagged_integer.h | 3 +- .../container/detail/aged_ordered_container.h | 8 +- .../detail/aged_unordered_container.h | 10 +- include/xrpl/beast/hash/xxhasher.h | 3 +- include/xrpl/beast/unit_test.h | 2 +- include/xrpl/beast/utility/Journal.h | 3 +- include/xrpl/json/json_value.h | 6 +- include/xrpl/protocol/AccountID.h | 2 +- include/xrpl/protocol/ApiVersion.h | 41 ++- include/xrpl/protocol/MultiApiJson.h | 84 +++--- include/xrpl/protocol/STAmount.h | 6 +- include/xrpl/protocol/STBase.h | 6 +- include/xrpl/protocol/STObject.h | 3 +- include/xrpl/protocol/STVector256.h | 3 +- include/xrpl/protocol/TER.h | 57 ++-- include/xrpl/protocol/digest.h | 21 +- include/xrpl/server/detail/BaseHTTPPeer.h | 4 +- src/libxrpl/basics/ResolverAsio.cpp | 6 +- src/libxrpl/beast/insight/NullCollector.cpp | 12 +- .../beast/utility/src/beast_Journal.cpp | 6 +- src/libxrpl/json/Writer.cpp | 3 +- src/libxrpl/protocol/STAmount.cpp | 3 +- src/libxrpl/protocol/STBase.cpp | 3 +- src/libxrpl/protocol/STCurrency.cpp | 3 +- src/libxrpl/protocol/STInteger.cpp | 12 +- src/libxrpl/protocol/STIssue.cpp | 3 +- src/libxrpl/protocol/STParsedJSON.cpp | 3 +- src/libxrpl/protocol/STPathSet.cpp | 3 +- src/libxrpl/protocol/STVector256.cpp | 3 +- src/test/app/NFTokenBurn_test.cpp | 3 +- src/test/app/ValidatorList_test.cpp | 4 +- src/test/app/ValidatorSite_test.cpp | 25 +- src/test/basics/IOUAmount_test.cpp | 91 +++--- src/test/basics/XRPAmount_test.cpp | 104 +++---- src/test/basics/base_uint_test.cpp | 3 +- src/test/beast/beast_Zero_test.cpp | 6 +- .../consensus/ByzantineFailureSim_test.cpp | 4 +- src/test/csf/Peer.h | 3 +- src/test/csf/collectors.h | 225 ++++++-------- src/test/jtx/TestHelpers.h | 10 +- src/test/jtx/TrustedPublisherServer.h | 12 +- src/test/jtx/amount.h | 14 +- src/test/jtx/impl/AMM.cpp | 4 +- src/test/jtx/impl/amount.cpp | 3 +- src/test/jtx/multisign.h | 5 +- src/test/overlay/reduce_relay_test.cpp | 5 +- src/test/protocol/MultiApiJson_test.cpp | 280 +++++------------- src/test/protocol/STObject_test.cpp | 276 ++++++++--------- src/xrpld/app/ledger/LedgerHistory.cpp | 58 ++-- .../app/ledger/detail/TimeoutCounter.cpp | 4 +- src/xrpld/app/main/GRPCServer.cpp | 4 +- src/xrpld/app/misc/AMMHelpers.h | 6 +- src/xrpld/app/misc/NetworkOPs.cpp | 4 +- src/xrpld/app/misc/detail/TxQ.cpp | 10 +- src/xrpld/app/misc/detail/ValidatorList.cpp | 3 +- src/xrpld/app/paths/Pathfinder.cpp | 3 +- src/xrpld/app/paths/detail/BookStep.cpp | 3 +- src/xrpld/app/paths/detail/DirectStep.cpp | 6 +- .../app/paths/detail/XRPEndpointStep.cpp | 3 +- src/xrpld/app/rdb/RelationalDatabase.h | 4 +- src/xrpld/app/tx/detail/CancelOffer.cpp | 8 +- src/xrpld/app/tx/detail/Payment.cpp | 18 +- src/xrpld/app/tx/detail/Transactor.cpp | 6 +- src/xrpld/conditions/detail/PreimageSha256.h | 3 +- src/xrpld/consensus/Consensus.h | 10 +- src/xrpld/consensus/Validations.h | 3 +- src/xrpld/core/DatabaseCon.h | 3 +- src/xrpld/ledger/detail/View.cpp | 6 +- src/xrpld/nodestore/detail/DatabaseNodeImp.h | 3 +- .../nodestore/detail/DatabaseRotatingImp.h | 3 +- src/xrpld/overlay/detail/PeerImp.cpp | 6 +- src/xrpld/overlay/detail/ProtocolVersion.cpp | 2 +- src/xrpld/peerfinder/detail/Logic.h | 6 +- src/xrpld/rpc/detail/ServerHandler.cpp | 6 +- src/xrpld/shamap/detail/TaggedPointer.ipp | 20 +- src/xrpld/unity/rocksdb.h | 2 +- 83 files changed, 811 insertions(+), 903 deletions(-) diff --git a/include/xrpl/basics/Expected.h b/include/xrpl/basics/Expected.h index 745fa50a69f..10f188af11c 100644 --- a/include/xrpl/basics/Expected.h +++ b/include/xrpl/basics/Expected.h @@ -136,44 +136,49 @@ class [[nodiscard]] Expected public: template - requires std::convertible_to constexpr Expected(U && r) - : Base(T(std::forward(r))) + requires std::convertible_to + constexpr Expected(U&& r) : Base(T(std::forward(r))) { } template - requires std::convertible_to && - (!std::is_reference_v)constexpr Expected(Unexpected e) - : Base(E(std::move(e.value()))) + requires std::convertible_to && (!std::is_reference_v) + constexpr Expected(Unexpected e) : Base(E(std::move(e.value()))) { } - constexpr bool has_value() const + constexpr bool + has_value() const { return Base::has_value(); } - constexpr T const& value() const + constexpr T const& + value() const { return Base::value(); } - constexpr T& value() + constexpr T& + value() { return Base::value(); } - constexpr E const& error() const + constexpr E const& + error() const { return Base::error(); } - constexpr E& error() + constexpr E& + error() { return Base::error(); } - constexpr explicit operator bool() const + constexpr explicit + operator bool() const { return has_value(); } @@ -181,22 +186,26 @@ class [[nodiscard]] Expected // Add operator* and operator-> so the Expected API looks a bit more like // what std::expected is likely to look like. See: // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0323r10.html - [[nodiscard]] constexpr T& operator*() + [[nodiscard]] constexpr T& + operator*() { return this->value(); } - [[nodiscard]] constexpr T const& operator*() const + [[nodiscard]] constexpr T const& + operator*() const { return this->value(); } - [[nodiscard]] constexpr T* operator->() + [[nodiscard]] constexpr T* + operator->() { return &this->value(); } - [[nodiscard]] constexpr T const* operator->() const + [[nodiscard]] constexpr T const* + operator->() const { return &this->value(); } @@ -218,23 +227,25 @@ class [[nodiscard]] Expected } template - requires std::convertible_to && - (!std::is_reference_v)constexpr Expected(Unexpected e) - : Base(E(std::move(e.value()))) + requires std::convertible_to && (!std::is_reference_v) + constexpr Expected(Unexpected e) : Base(E(std::move(e.value()))) { } - constexpr E const& error() const + constexpr E const& + error() const { return Base::error(); } - constexpr E& error() + constexpr E& + error() { return Base::error(); } - constexpr explicit operator bool() const + constexpr explicit + operator bool() const { return Base::has_value(); } diff --git a/include/xrpl/basics/FeeUnits.h b/include/xrpl/basics/FeeUnits.h index 9d5e6e216a4..c63a169f00e 100644 --- a/include/xrpl/basics/FeeUnits.h +++ b/include/xrpl/basics/FeeUnits.h @@ -84,13 +84,13 @@ class TaggedFee : private boost::totally_ordered>, protected: template static constexpr bool is_compatible_v = - std::is_arithmetic_v&& std::is_arithmetic_v&& - std::is_convertible_v; + std::is_arithmetic_v && std::is_arithmetic_v && + std::is_convertible_v; template > static constexpr bool is_compatiblefee_v = - is_compatible_v&& - std::is_same_v; + is_compatible_v && + std::is_same_v; template using enable_if_compatible_t = @@ -110,7 +110,8 @@ class TaggedFee : private boost::totally_ordered>, { } - constexpr TaggedFee& operator=(beast::Zero) + constexpr TaggedFee& + operator=(beast::Zero) { fee_ = 0; return *this; @@ -250,7 +251,8 @@ class TaggedFee : private boost::totally_ordered>, } /** Returns true if the amount is not zero */ - explicit constexpr operator bool() const noexcept + explicit constexpr + operator bool() const noexcept { return fee_ != 0; } @@ -344,8 +346,8 @@ constexpr bool can_muldiv_source_v = template > constexpr bool can_muldiv_dest_v = - can_muldiv_source_v&& // Dest is also a source - std::is_convertible_v && + can_muldiv_source_v && // Dest is also a source + std::is_convertible_v && sizeof(typename Dest::value_type) >= sizeof(std::uint64_t); template < @@ -354,8 +356,8 @@ template < class = enable_if_unit_t, class = enable_if_unit_t> constexpr bool can_muldiv_sources_v = - can_muldiv_source_v&& can_muldiv_source_v&& std:: - is_same_v; + can_muldiv_source_v && can_muldiv_source_v && + std::is_same_v; template < class Source1, @@ -365,7 +367,7 @@ template < class = enable_if_unit_t, class = enable_if_unit_t> constexpr bool can_muldiv_v = - can_muldiv_sources_v&& can_muldiv_dest_v; + can_muldiv_sources_v && can_muldiv_dest_v; // Source and Dest can be the same by default template < diff --git a/include/xrpl/basics/IOUAmount.h b/include/xrpl/basics/IOUAmount.h index 221434aa85a..e89feb123d0 100644 --- a/include/xrpl/basics/IOUAmount.h +++ b/include/xrpl/basics/IOUAmount.h @@ -82,7 +82,8 @@ class IOUAmount : private boost::totally_ordered, operator<(IOUAmount const& other) const; /** Returns true if the amount is not zero */ - explicit operator bool() const noexcept; + explicit + operator bool() const noexcept; /** Return the sign of the amount */ int @@ -109,7 +110,8 @@ inline IOUAmount::IOUAmount(std::int64_t mantissa, int exponent) normalize(); } -inline IOUAmount& IOUAmount::operator=(beast::Zero) +inline IOUAmount& +IOUAmount::operator=(beast::Zero) { // The -100 is used to allow 0 to sort less than small positive values // which will have a large negative exponent. diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index 30ce3f73173..5856ef325dc 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -88,8 +88,10 @@ class Number static constexpr Number lowest() noexcept; - explicit operator XRPAmount() const; // round to nearest, even on tie - explicit operator rep() const; // round to nearest, even on tie + explicit + operator XRPAmount() const; // round to nearest, even on tie + explicit + operator rep() const; // round to nearest, even on tie friend constexpr bool operator==(Number const& x, Number const& y) noexcept diff --git a/include/xrpl/basics/XRPAmount.h b/include/xrpl/basics/XRPAmount.h index 1d3b32f169b..9a322695168 100644 --- a/include/xrpl/basics/XRPAmount.h +++ b/include/xrpl/basics/XRPAmount.h @@ -65,7 +65,8 @@ class XRPAmount : private boost::totally_ordered, { } - constexpr XRPAmount& operator=(beast::Zero) + constexpr XRPAmount& + operator=(beast::Zero) { drops_ = 0; return *this; @@ -155,7 +156,8 @@ class XRPAmount : private boost::totally_ordered, } /** Returns true if the amount is not zero */ - explicit constexpr operator bool() const noexcept + explicit constexpr + operator bool() const noexcept { return drops_ != 0; } diff --git a/include/xrpl/basics/base_uint.h b/include/xrpl/basics/base_uint.h index 2b44d3072ee..88d21c17d22 100644 --- a/include/xrpl/basics/base_uint.h +++ b/include/xrpl/basics/base_uint.h @@ -521,7 +521,8 @@ class base_uint return bytes; } - base_uint& operator=(beast::Zero) + base_uint& + operator=(beast::Zero) { data_.fill(0); return *this; diff --git a/include/xrpl/basics/safe_cast.h b/include/xrpl/basics/safe_cast.h index e52bceca759..f193f1793f2 100644 --- a/include/xrpl/basics/safe_cast.h +++ b/include/xrpl/basics/safe_cast.h @@ -30,8 +30,8 @@ namespace ripple { template static constexpr bool is_safetocasttovalue_v = - (std::is_integral_v && std::is_integral_v)&&( - std::is_signed::value || std::is_unsigned::value) && + (std::is_integral_v && std::is_integral_v) && + (std::is_signed::value || std::is_unsigned::value) && (std::is_signed::value != std::is_signed::value ? sizeof(Dest) > sizeof(Src) : sizeof(Dest) >= sizeof(Src)); diff --git a/include/xrpl/basics/tagged_integer.h b/include/xrpl/basics/tagged_integer.h index 3ab8c534098..4629e830916 100644 --- a/include/xrpl/basics/tagged_integer.h +++ b/include/xrpl/basics/tagged_integer.h @@ -187,7 +187,8 @@ class tagged_integer return *this; } - explicit operator Int() const noexcept + explicit + operator Int() const noexcept { return m_value; } diff --git a/include/xrpl/beast/container/detail/aged_ordered_container.h b/include/xrpl/beast/container/detail/aged_ordered_container.h index 90a8ea147ae..ad807e92cfe 100644 --- a/include/xrpl/beast/container/detail/aged_ordered_container.h +++ b/include/xrpl/beast/container/detail/aged_ordered_container.h @@ -846,8 +846,9 @@ class aged_ordered_container // set template auto - insert(value_type&& value) -> typename std:: - enable_if>::type; + insert(value_type&& value) -> typename std::enable_if< + !maybe_multi && !maybe_map, + std::pair>::type; // multiset template @@ -1795,7 +1796,8 @@ template < template auto aged_ordered_container:: - insert(value_type&& value) -> typename std:: + insert(value_type&& value) -> + typename std:: enable_if>::type { typename cont_type::insert_commit_data d; diff --git a/include/xrpl/beast/container/detail/aged_unordered_container.h b/include/xrpl/beast/container/detail/aged_unordered_container.h index 45efb3f5561..72e3334801b 100644 --- a/include/xrpl/beast/container/detail/aged_unordered_container.h +++ b/include/xrpl/beast/container/detail/aged_unordered_container.h @@ -1057,8 +1057,9 @@ class aged_unordered_container // map, set template auto - insert(value_type&& value) -> typename std:: - enable_if>::type; + insert(value_type&& value) -> typename std::enable_if< + !maybe_multi && !maybe_map, + std::pair>::type; // multimap, multiset template @@ -2799,8 +2800,9 @@ aged_unordered_container< Clock, Hash, KeyEqual, - Allocator>::insert(value_type&& value) -> typename std:: - enable_if>::type + Allocator>::insert(value_type&& value) -> + typename std:: + enable_if>::type { maybe_rehash(1); typename cont_type::insert_commit_data d; diff --git a/include/xrpl/beast/hash/xxhasher.h b/include/xrpl/beast/hash/xxhasher.h index 1a6fc502321..30af05ef0a1 100644 --- a/include/xrpl/beast/hash/xxhasher.h +++ b/include/xrpl/beast/hash/xxhasher.h @@ -90,7 +90,8 @@ class xxhasher XXH3_64bits_update(state_, key, len); } - explicit operator std::size_t() noexcept + explicit + operator std::size_t() noexcept { return XXH3_64bits_digest(state_); } diff --git a/include/xrpl/beast/unit_test.h b/include/xrpl/beast/unit_test.h index eff82583ea7..bf33b205e62 100644 --- a/include/xrpl/beast/unit_test.h +++ b/include/xrpl/beast/unit_test.h @@ -34,7 +34,7 @@ #ifndef BEAST_EXPECT #define BEAST_EXPECT_S1(x) #x #define BEAST_EXPECT_S2(x) BEAST_EXPECT_S1(x) -//#define BEAST_EXPECT(cond) {expect(cond, __FILE__ ":" ## +// #define BEAST_EXPECT(cond) {expect(cond, __FILE__ ":" ## //__LINE__);}while(false){} #define BEAST_EXPECT(cond) expect(cond, __FILE__ ":" BEAST_EXPECT_S2(__LINE__)) #endif diff --git a/include/xrpl/beast/utility/Journal.h b/include/xrpl/beast/utility/Journal.h index 0738748b6c5..059355ccae7 100644 --- a/include/xrpl/beast/utility/Journal.h +++ b/include/xrpl/beast/utility/Journal.h @@ -238,7 +238,8 @@ class Journal return m_sink.active(m_level); } - explicit operator bool() const + explicit + operator bool() const { return active(); } diff --git a/include/xrpl/json/json_value.h b/include/xrpl/json/json_value.h index c2f9184d79a..e419940171e 100644 --- a/include/xrpl/json/json_value.h +++ b/include/xrpl/json/json_value.h @@ -64,7 +64,8 @@ class StaticString { } - constexpr operator const char*() const + constexpr + operator const char*() const { return str_; } @@ -296,7 +297,8 @@ class Value /** Returns false if this is an empty array, empty object, empty string, or null. */ - explicit operator bool() const; + explicit + operator bool() const; /// Remove all object members and array elements. /// \pre type() is arrayValue, objectValue, or nullValue diff --git a/include/xrpl/protocol/AccountID.h b/include/xrpl/protocol/AccountID.h index ebe7f014d9c..7edf8d388f7 100644 --- a/include/xrpl/protocol/AccountID.h +++ b/include/xrpl/protocol/AccountID.h @@ -22,7 +22,7 @@ #include // VFALCO Uncomment when the header issues are resolved -//#include +// #include #include #include #include diff --git a/include/xrpl/protocol/ApiVersion.h b/include/xrpl/protocol/ApiVersion.h index 1cd03b0651d..dd09cf6bd1a 100644 --- a/include/xrpl/protocol/ApiVersion.h +++ b/include/xrpl/protocol/ApiVersion.h @@ -76,38 +76,35 @@ static_assert(apiMaximumValidVersion >= apiMaximumSupportedVersion); } // namespace RPC template - void - forApiVersions(Fn const& fn, Args&&... args) requires // - (maxVer >= minVer) && // - (minVer >= RPC::apiMinimumSupportedVersion) && // - (RPC::apiMaximumValidVersion >= maxVer) && - requires -{ - fn(std::integral_constant{}, - std::forward(args)...); - fn(std::integral_constant{}, - std::forward(args)...); -} +void +forApiVersions(Fn const& fn, Args&&... args) + requires // + (maxVer >= minVer) && // + (minVer >= RPC::apiMinimumSupportedVersion) && // + (RPC::apiMaximumValidVersion >= maxVer) && requires { + fn(std::integral_constant{}, + std::forward(args)...); + fn(std::integral_constant{}, + std::forward(args)...); + } { constexpr auto size = maxVer + 1 - minVer; - [&](std::index_sequence) - { + [&](std::index_sequence) { (((void)fn( std::integral_constant{}, std::forward(args)...)), ...); - } - (std::make_index_sequence{}); + }(std::make_index_sequence{}); } template void -forAllApiVersions(Fn const& fn, Args&&... args) requires requires -{ - forApiVersions< - RPC::apiMinimumSupportedVersion, - RPC::apiMaximumValidVersion>(fn, std::forward(args)...); -} +forAllApiVersions(Fn const& fn, Args&&... args) + requires requires { + forApiVersions< + RPC::apiMinimumSupportedVersion, + RPC::apiMaximumValidVersion>(fn, std::forward(args)...); + } { forApiVersions< RPC::apiMinimumSupportedVersion, diff --git a/include/xrpl/protocol/MultiApiJson.h b/include/xrpl/protocol/MultiApiJson.h index 4514c54ea34..73c274ff7f7 100644 --- a/include/xrpl/protocol/MultiApiJson.h +++ b/include/xrpl/protocol/MultiApiJson.h @@ -80,9 +80,8 @@ struct MultiApiJson } void - set(const char* key, - auto const& - v) requires std::constructible_from + set(const char* key, auto const& v) + requires std::constructible_from { for (auto& a : this->val) a[key] = v; @@ -110,7 +109,8 @@ struct MultiApiJson unsigned int Version, typename... Args, typename Fn> - requires std::same_as, MultiApiJson> auto + requires std::same_as, MultiApiJson> + auto operator()( Json& json, std::integral_constant const version, @@ -133,7 +133,8 @@ struct MultiApiJson // integral_constant version, Json only template - requires std::same_as, MultiApiJson> auto + requires std::same_as, MultiApiJson> + auto operator()( Json& json, std::integral_constant const, @@ -151,10 +152,10 @@ struct MultiApiJson typename... Args, typename Fn> requires(!some_integral_constant) && - std::convertible_to&& std::same_as< - std::remove_cvref_t, - MultiApiJson> auto - operator()(Json& json, Version version, Fn fn, Args&&... args) const + std::convertible_to && + std::same_as, MultiApiJson> + auto + operator()(Json& json, Version version, Fn fn, Args&&... args) const -> std:: invoke_result_t { @@ -170,9 +171,10 @@ struct MultiApiJson // unsigned int version, Json only template requires(!some_integral_constant) && - std::convertible_to&& std:: - same_as, MultiApiJson> auto - operator()(Json& json, Version version, Fn fn) const + std::convertible_to && + std::same_as, MultiApiJson> + auto + operator()(Json& json, Version version, Fn fn) const -> std::invoke_result_t { assert( @@ -184,53 +186,43 @@ struct MultiApiJson auto visit() { - return [self = this](auto... args) requires requires - { - visitor( - std::declval(), - std::declval()...); - } - { - return visitor(*self, std::forward(args)...); - }; + return [self = this](auto... args) + requires requires { + visitor( + std::declval(), + std::declval()...); + } + { return visitor(*self, std::forward(args)...); }; } auto visit() const { - return [self = this](auto... args) requires requires - { - visitor( - std::declval(), - std::declval()...); - } - { - return visitor(*self, std::forward(args)...); - }; + return [self = this](auto... args) + requires requires { + visitor( + std::declval(), + std::declval()...); + } + { return visitor(*self, std::forward(args)...); }; } template - auto - visit(Args... args) - -> std::invoke_result_t requires( - sizeof...(args) > 0) && - requires - { - visitor(*this, std::forward(args)...); - } + auto + visit(Args... args) + -> std::invoke_result_t + requires(sizeof...(args) > 0) && + requires { visitor(*this, std::forward(args)...); } { return visitor(*this, std::forward(args)...); } template - auto - visit(Args... args) const -> std:: - invoke_result_t requires( - sizeof...(args) > 0) && - requires - { - visitor(*this, std::forward(args)...); - } + auto + visit(Args... args) const + -> std::invoke_result_t + requires(sizeof...(args) > 0) && + requires { visitor(*this, std::forward(args)...); } { return visitor(*this, std::forward(args)...); } diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 3eed0860f54..34f82d4cebb 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -197,7 +197,8 @@ class STAmount final : public STBase, public CountedObject // //-------------------------------------------------------------------------- - explicit operator bool() const noexcept; + explicit + operator bool() const noexcept; STAmount& operator+=(STAmount const&); @@ -388,7 +389,8 @@ inline STAmount::operator Number() const return iou(); } -inline STAmount& STAmount::operator=(beast::Zero) +inline STAmount& +STAmount::operator=(beast::Zero) { clear(); return *this; diff --git a/include/xrpl/protocol/STBase.h b/include/xrpl/protocol/STBase.h index e13ef6c5b3e..097341384f3 100644 --- a/include/xrpl/protocol/STBase.h +++ b/include/xrpl/protocol/STBase.h @@ -52,11 +52,13 @@ struct JsonOptions { } - [[nodiscard]] constexpr explicit operator underlying_t() const noexcept + [[nodiscard]] constexpr explicit + operator underlying_t() const noexcept { return value; } - [[nodiscard]] constexpr explicit operator bool() const noexcept + [[nodiscard]] constexpr explicit + operator bool() const noexcept { return value != 0u; } diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index b3cef83de5f..a226733e986 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -539,7 +539,8 @@ class STObject::OptionalProxy : private Proxy Fields with soeDEFAULT and set to the default value will return `true` */ - explicit operator bool() const noexcept; + explicit + operator bool() const noexcept; /** Return the contained value diff --git a/include/xrpl/protocol/STVector256.h b/include/xrpl/protocol/STVector256.h index e70297a40bf..d81ddf977ff 100644 --- a/include/xrpl/protocol/STVector256.h +++ b/include/xrpl/protocol/STVector256.h @@ -65,7 +65,8 @@ class STVector256 : public STBase, public CountedObject setValue(const STVector256& v); /** Retrieve a copy of the vector we contain */ - explicit operator std::vector() const; + explicit + operator std::vector() const; std::size_t size() const; diff --git a/include/xrpl/protocol/TER.h b/include/xrpl/protocol/TER.h index aae3c7107bd..5b659249dfd 100644 --- a/include/xrpl/protocol/TER.h +++ b/include/xrpl/protocol/TER.h @@ -434,7 +434,8 @@ class TERSubset } // Conversion to bool. - explicit operator bool() const + explicit + operator bool() const { return code_ != tesSUCCESS; } @@ -480,60 +481,66 @@ class TERSubset // Only enabled if both arguments return int if TERtiInt is called with them. template constexpr auto -operator==(L const& lhs, R const& rhs) -> std::enable_if_t< - std::is_same::value && - std::is_same::value, - bool> +operator==(L const& lhs, R const& rhs) + -> std::enable_if_t< + std::is_same::value && + std::is_same::value, + bool> { return TERtoInt(lhs) == TERtoInt(rhs); } template constexpr auto -operator!=(L const& lhs, R const& rhs) -> std::enable_if_t< - std::is_same::value && - std::is_same::value, - bool> +operator!=(L const& lhs, R const& rhs) + -> std::enable_if_t< + std::is_same::value && + std::is_same::value, + bool> { return TERtoInt(lhs) != TERtoInt(rhs); } template constexpr auto -operator<(L const& lhs, R const& rhs) -> std::enable_if_t< - std::is_same::value && - std::is_same::value, - bool> +operator<(L const& lhs, R const& rhs) + -> std::enable_if_t< + std::is_same::value && + std::is_same::value, + bool> { return TERtoInt(lhs) < TERtoInt(rhs); } template constexpr auto -operator<=(L const& lhs, R const& rhs) -> std::enable_if_t< - std::is_same::value && - std::is_same::value, - bool> +operator<=(L const& lhs, R const& rhs) + -> std::enable_if_t< + std::is_same::value && + std::is_same::value, + bool> { return TERtoInt(lhs) <= TERtoInt(rhs); } template constexpr auto -operator>(L const& lhs, R const& rhs) -> std::enable_if_t< - std::is_same::value && - std::is_same::value, - bool> +operator>(L const& lhs, R const& rhs) + -> std::enable_if_t< + std::is_same::value && + std::is_same::value, + bool> { return TERtoInt(lhs) > TERtoInt(rhs); } template constexpr auto -operator>=(L const& lhs, R const& rhs) -> std::enable_if_t< - std::is_same::value && - std::is_same::value, - bool> +operator>=(L const& lhs, R const& rhs) + -> std::enable_if_t< + std::is_same::value && + std::is_same::value, + bool> { return TERtoInt(lhs) >= TERtoInt(rhs); } diff --git a/include/xrpl/protocol/digest.h b/include/xrpl/protocol/digest.h index f3fc2ea5c5d..b3c7a014100 100644 --- a/include/xrpl/protocol/digest.h +++ b/include/xrpl/protocol/digest.h @@ -55,7 +55,8 @@ struct openssl_ripemd160_hasher void operator()(void const* data, std::size_t size) noexcept; - explicit operator result_type() noexcept; + explicit + operator result_type() noexcept; private: char ctx_[96]; @@ -77,7 +78,8 @@ struct openssl_sha512_hasher void operator()(void const* data, std::size_t size) noexcept; - explicit operator result_type() noexcept; + explicit + operator result_type() noexcept; private: char ctx_[216]; @@ -99,7 +101,8 @@ struct openssl_sha256_hasher void operator()(void const* data, std::size_t size) noexcept; - explicit operator result_type() noexcept; + explicit + operator result_type() noexcept; private: char ctx_[112]; @@ -144,7 +147,8 @@ struct ripesha_hasher h_(data, size); } - explicit operator result_type() noexcept + explicit + operator result_type() noexcept { auto const d0 = sha256_hasher::result_type(h_); ripemd160_hasher rh; @@ -184,18 +188,21 @@ struct basic_sha512_half_hasher h_(data, size); } - explicit operator result_type() noexcept + explicit + operator result_type() noexcept { auto const digest = sha512_hasher::result_type(h_); return result_type::fromVoid(digest.data()); } private: - inline void erase(std::false_type) + inline void + erase(std::false_type) { } - inline void erase(std::true_type) + inline void + erase(std::true_type) { secure_erase(&h_, sizeof(h_)); } diff --git a/include/xrpl/server/detail/BaseHTTPPeer.h b/include/xrpl/server/detail/BaseHTTPPeer.h index 171eb7134e1..32ec4d3009d 100644 --- a/include/xrpl/server/detail/BaseHTTPPeer.h +++ b/include/xrpl/server/detail/BaseHTTPPeer.h @@ -244,7 +244,7 @@ BaseHTTPPeer::close() return post( strand_, std::bind( - (void (BaseHTTPPeer::*)(void)) & BaseHTTPPeer::close, + (void(BaseHTTPPeer::*)(void)) & BaseHTTPPeer::close, impl().shared_from_this())); boost::beast::get_lowest_layer(impl().stream_).close(); } @@ -507,7 +507,7 @@ BaseHTTPPeer::close(bool graceful) return post( strand_, std::bind( - (void (BaseHTTPPeer::*)(bool)) & + (void(BaseHTTPPeer::*)(bool)) & BaseHTTPPeer::close, impl().shared_from_this(), graceful)); diff --git a/src/libxrpl/basics/ResolverAsio.cpp b/src/libxrpl/basics/ResolverAsio.cpp index 53530da9d8f..7105eb12a74 100644 --- a/src/libxrpl/basics/ResolverAsio.cpp +++ b/src/libxrpl/basics/ResolverAsio.cpp @@ -232,7 +232,8 @@ class ResolverAsioImpl : public ResolverAsio, //------------------------------------------------------------------------- // Resolver - void do_stop(CompletionCounter) + void + do_stop(CompletionCounter) { assert(m_stop_called == true); @@ -330,7 +331,8 @@ class ResolverAsioImpl : public ResolverAsio, std::string(port_first, port_last)); } - void do_work(CompletionCounter) + void + do_work(CompletionCounter) { if (m_stop_called == true) return; diff --git a/src/libxrpl/beast/insight/NullCollector.cpp b/src/libxrpl/beast/insight/NullCollector.cpp index 637cd06ec3b..12ea817014e 100644 --- a/src/libxrpl/beast/insight/NullCollector.cpp +++ b/src/libxrpl/beast/insight/NullCollector.cpp @@ -41,7 +41,8 @@ class NullCounterImpl : public CounterImpl public: explicit NullCounterImpl() = default; - void increment(value_type) override + void + increment(value_type) override { } @@ -74,11 +75,13 @@ class NullGaugeImpl : public GaugeImpl public: explicit NullGaugeImpl() = default; - void set(value_type) override + void + set(value_type) override { } - void increment(difference_type) override + void + increment(difference_type) override { } @@ -94,7 +97,8 @@ class NullMeterImpl : public MeterImpl public: explicit NullMeterImpl() = default; - void increment(value_type) override + void + increment(value_type) override { } diff --git a/src/libxrpl/beast/utility/src/beast_Journal.cpp b/src/libxrpl/beast/utility/src/beast_Journal.cpp index 261e1f6ccab..8ce7ea8d47c 100644 --- a/src/libxrpl/beast/utility/src/beast_Journal.cpp +++ b/src/libxrpl/beast/utility/src/beast_Journal.cpp @@ -34,7 +34,8 @@ class NullJournalSink : public Journal::Sink ~NullJournalSink() override = default; - bool active(severities::Severity) const override + bool + active(severities::Severity) const override { return false; } @@ -56,7 +57,8 @@ class NullJournalSink : public Journal::Sink return severities::kDisabled; } - void threshold(severities::Severity) override + void + threshold(severities::Severity) override { } diff --git a/src/libxrpl/json/Writer.cpp b/src/libxrpl/json/Writer.cpp index ba7336209e6..2f7c0b523c6 100644 --- a/src/libxrpl/json/Writer.cpp +++ b/src/libxrpl/json/Writer.cpp @@ -285,7 +285,8 @@ Writer::output(double f) impl_->output({s.data(), lengthWithoutTrailingZeros(s)}); } -void Writer::output(std::nullptr_t) +void +Writer::output(std::nullptr_t) { impl_->output("null"); } diff --git a/src/libxrpl/protocol/STAmount.cpp b/src/libxrpl/protocol/STAmount.cpp index 236603d6cb8..bb9a24c1271 100644 --- a/src/libxrpl/protocol/STAmount.cpp +++ b/src/libxrpl/protocol/STAmount.cpp @@ -650,7 +650,8 @@ STAmount::getText() const return ret; } -Json::Value STAmount::getJson(JsonOptions) const +Json::Value +STAmount::getJson(JsonOptions) const { Json::Value elem; setJson(elem); diff --git a/src/libxrpl/protocol/STBase.cpp b/src/libxrpl/protocol/STBase.cpp index b7e9c94ca24..73565cbf765 100644 --- a/src/libxrpl/protocol/STBase.cpp +++ b/src/libxrpl/protocol/STBase.cpp @@ -96,7 +96,8 @@ STBase::getText() const return std::string(); } -Json::Value STBase::getJson(JsonOptions /*options*/) const +Json::Value +STBase::getJson(JsonOptions /*options*/) const { return getText(); } diff --git a/src/libxrpl/protocol/STCurrency.cpp b/src/libxrpl/protocol/STCurrency.cpp index c8fc650135a..56ac19da114 100644 --- a/src/libxrpl/protocol/STCurrency.cpp +++ b/src/libxrpl/protocol/STCurrency.cpp @@ -50,7 +50,8 @@ STCurrency::getText() const return to_string(currency_); } -Json::Value STCurrency::getJson(JsonOptions) const +Json::Value +STCurrency::getJson(JsonOptions) const { return to_string(currency_); } diff --git a/src/libxrpl/protocol/STInteger.cpp b/src/libxrpl/protocol/STInteger.cpp index 7b7420006f9..af0c18a5155 100644 --- a/src/libxrpl/protocol/STInteger.cpp +++ b/src/libxrpl/protocol/STInteger.cpp @@ -61,7 +61,8 @@ STUInt8::getText() const } template <> -Json::Value STUInt8::getJson(JsonOptions) const +Json::Value +STUInt8::getJson(JsonOptions) const { if (getFName() == sfTransactionResult) { @@ -118,7 +119,8 @@ STUInt16::getText() const } template <> -Json::Value STUInt16::getJson(JsonOptions) const +Json::Value +STUInt16::getJson(JsonOptions) const { if (getFName() == sfLedgerEntryType) { @@ -164,7 +166,8 @@ STUInt32::getText() const } template <> -Json::Value STUInt32::getJson(JsonOptions) const +Json::Value +STUInt32::getJson(JsonOptions) const { return value_; } @@ -192,7 +195,8 @@ STUInt64::getText() const } template <> -Json::Value STUInt64::getJson(JsonOptions) const +Json::Value +STUInt64::getJson(JsonOptions) const { std::string str(16, 0); auto ret = std::to_chars(str.data(), str.data() + str.size(), value_, 16); diff --git a/src/libxrpl/protocol/STIssue.cpp b/src/libxrpl/protocol/STIssue.cpp index 9dcee6498ab..00fe86b3287 100644 --- a/src/libxrpl/protocol/STIssue.cpp +++ b/src/libxrpl/protocol/STIssue.cpp @@ -65,7 +65,8 @@ STIssue::getSType() const return STI_ISSUE; } -Json::Value STIssue::getJson(JsonOptions) const +Json::Value +STIssue::getJson(JsonOptions) const { return to_json(issue_); } diff --git a/src/libxrpl/protocol/STParsedJSON.cpp b/src/libxrpl/protocol/STParsedJSON.cpp index dec5e87eaee..327b9ee31c4 100644 --- a/src/libxrpl/protocol/STParsedJSON.cpp +++ b/src/libxrpl/protocol/STParsedJSON.cpp @@ -967,8 +967,7 @@ parseArray( Json::Value const objectFields(json[i][objectName]); std::stringstream ss; - ss << json_name << "." - << "[" << i << "]." << objectName; + ss << json_name << "." << "[" << i << "]." << objectName; auto ret = parseObject( ss.str(), objectFields, nameField, depth + 1, error); diff --git a/src/libxrpl/protocol/STPathSet.cpp b/src/libxrpl/protocol/STPathSet.cpp index b658465272e..78c47cadc66 100644 --- a/src/libxrpl/protocol/STPathSet.cpp +++ b/src/libxrpl/protocol/STPathSet.cpp @@ -163,7 +163,8 @@ STPath::hasSeen( return false; } -Json::Value STPath::getJson(JsonOptions) const +Json::Value +STPath::getJson(JsonOptions) const { Json::Value ret(Json::arrayValue); diff --git a/src/libxrpl/protocol/STVector256.cpp b/src/libxrpl/protocol/STVector256.cpp index 2d8bc4ee225..385c0ef76db 100644 --- a/src/libxrpl/protocol/STVector256.cpp +++ b/src/libxrpl/protocol/STVector256.cpp @@ -80,7 +80,8 @@ STVector256::isEquivalent(const STBase& t) const return v && (mValue == v->mValue); } -Json::Value STVector256::getJson(JsonOptions) const +Json::Value +STVector256::getJson(JsonOptions) const { Json::Value ret(Json::arrayValue); diff --git a/src/test/app/NFTokenBurn_test.cpp b/src/test/app/NFTokenBurn_test.cpp index 35a8858f868..a84ac63da9d 100644 --- a/src/test/app/NFTokenBurn_test.cpp +++ b/src/test/app/NFTokenBurn_test.cpp @@ -323,7 +323,8 @@ class NFTokenBurnBaseUtil_test : public beast::unit_test::suite // Otherwise either alice or minter can burn. AcctStat& burner = owner.acct == becky.acct ? *(stats[acctDist(engine)]) - : mintDist(engine) ? alice : minter; + : mintDist(engine) ? alice + : minter; if (owner.acct == burner.acct) env(token::burn(burner, nft)); diff --git a/src/test/app/ValidatorList_test.cpp b/src/test/app/ValidatorList_test.cpp index 12652c9dbfe..00e4127838d 100644 --- a/src/test/app/ValidatorList_test.cpp +++ b/src/test/app/ValidatorList_test.cpp @@ -1741,7 +1741,9 @@ class ValidatorList_test : public beast::unit_test::suite using namespace std::chrono_literals; // Want to drop 1 sooner NetClock::time_point const validUntil = env.timeKeeper().now() + - (i == 2 ? 120s : i == 1 ? 60s : 3600s); + (i == 2 ? 120s + : i == 1 ? 60s + : 3600s); if (i == 1) validUntil1 = validUntil; else if (i == 2) diff --git a/src/test/app/ValidatorSite_test.cpp b/src/test/app/ValidatorSite_test.cpp index 4bc7f2f270d..1ec302efef8 100644 --- a/src/test/app/ValidatorSite_test.cpp +++ b/src/test/app/ValidatorSite_test.cpp @@ -78,20 +78,21 @@ class ValidatorSite_test : public beast::unit_test::suite BEAST_EXPECT(trustedSites->load(emptyCfgSites)); // load should accept valid validator site uris - std::vector cfgSites({ - "http://ripple.com/", "http://ripple.com/validators", - "http://ripple.com:8080/validators", - "http://207.261.33.37/validators", - "http://207.261.33.37:8080/validators", - "https://ripple.com/validators", - "https://ripple.com:443/validators", - "file:///etc/opt/ripple/validators.txt", - "file:///C:/Lib/validators.txt" + std::vector cfgSites( + {"http://ripple.com/", + "http://ripple.com/validators", + "http://ripple.com:8080/validators", + "http://207.261.33.37/validators", + "http://207.261.33.37:8080/validators", + "https://ripple.com/validators", + "https://ripple.com:443/validators", + "file:///etc/opt/ripple/validators.txt", + "file:///C:/Lib/validators.txt" #if !_MSC_VER - , - "file:///" + , + "file:///" #endif - }); + }); BEAST_EXPECT(trustedSites->load(cfgSites)); // load should reject validator site uris with invalid schemes diff --git a/src/test/basics/IOUAmount_test.cpp b/src/test/basics/IOUAmount_test.cpp index 6e7c662635f..e588a08dc02 100644 --- a/src/test/basics/IOUAmount_test.cpp +++ b/src/test/basics/IOUAmount_test.cpp @@ -219,55 +219,56 @@ class IOUAmount_test : public beast::unit_test::suite tinyNeg == mulRatio(tinyNeg, maxUInt - 1, maxUInt, false)); } - {// rounding - {IOUAmount one(1, 0); - auto const rup = mulRatio(one, maxUInt - 1, maxUInt, true); - auto const rdown = mulRatio(one, maxUInt - 1, maxUInt, false); - BEAST_EXPECT(rup.mantissa() - rdown.mantissa() == 1); - } - { - IOUAmount big(maxMantissa, maxExponent); - auto const rup = mulRatio(big, maxUInt - 1, maxUInt, true); - auto const rdown = mulRatio(big, maxUInt - 1, maxUInt, false); - BEAST_EXPECT(rup.mantissa() - rdown.mantissa() == 1); - } - - { - IOUAmount negOne(-1, 0); - auto const rup = mulRatio(negOne, maxUInt - 1, maxUInt, true); - auto const rdown = mulRatio(negOne, maxUInt - 1, maxUInt, false); - BEAST_EXPECT(rup.mantissa() - rdown.mantissa() == 1); - } -} + { // rounding + { + IOUAmount one(1, 0); + auto const rup = mulRatio(one, maxUInt - 1, maxUInt, true); + auto const rdown = mulRatio(one, maxUInt - 1, maxUInt, false); + BEAST_EXPECT(rup.mantissa() - rdown.mantissa() == 1); + } + { + IOUAmount big(maxMantissa, maxExponent); + auto const rup = mulRatio(big, maxUInt - 1, maxUInt, true); + auto const rdown = mulRatio(big, maxUInt - 1, maxUInt, false); + BEAST_EXPECT(rup.mantissa() - rdown.mantissa() == 1); + } + + { + IOUAmount negOne(-1, 0); + auto const rup = mulRatio(negOne, maxUInt - 1, maxUInt, true); + auto const rdown = + mulRatio(negOne, maxUInt - 1, maxUInt, false); + BEAST_EXPECT(rup.mantissa() - rdown.mantissa() == 1); + } + } -{ - // division by zero - IOUAmount one(1, 0); - except([&] { mulRatio(one, 1, 0, true); }); -} + { + // division by zero + IOUAmount one(1, 0); + except([&] { mulRatio(one, 1, 0, true); }); + } -{ - // overflow - IOUAmount big(maxMantissa, maxExponent); - except([&] { mulRatio(big, 2, 0, true); }); -} -} // namespace ripple + { + // overflow + IOUAmount big(maxMantissa, maxExponent); + except([&] { mulRatio(big, 2, 0, true); }); + } + } // namespace ripple -//-------------------------------------------------------------------------- + //-------------------------------------------------------------------------- -void -run() override -{ - testZero(); - testSigNum(); - testBeastZero(); - testComparisons(); - testToString(); - testMulRatio(); -} -} -; + void + run() override + { + testZero(); + testSigNum(); + testBeastZero(); + testComparisons(); + testToString(); + testMulRatio(); + } +}; BEAST_DEFINE_TESTSUITE(IOUAmount, protocol, ripple); -} // ripple +} // namespace ripple diff --git a/src/test/basics/XRPAmount_test.cpp b/src/test/basics/XRPAmount_test.cpp index c4c96dbfbde..c57890fcfa5 100644 --- a/src/test/basics/XRPAmount_test.cpp +++ b/src/test/basics/XRPAmount_test.cpp @@ -283,63 +283,67 @@ class XRPAmount_test : public beast::unit_test::suite tinyNeg == mulRatio(tinyNeg, maxUInt32 - 1, maxUInt32, false)); } - {// rounding - {XRPAmount one(1); - auto const rup = mulRatio(one, maxUInt32 - 1, maxUInt32, true); - auto const rdown = mulRatio(one, maxUInt32 - 1, maxUInt32, false); - BEAST_EXPECT(rup.drops() - rdown.drops() == 1); - } + { // rounding + { + XRPAmount one(1); + auto const rup = mulRatio(one, maxUInt32 - 1, maxUInt32, true); + auto const rdown = + mulRatio(one, maxUInt32 - 1, maxUInt32, false); + BEAST_EXPECT(rup.drops() - rdown.drops() == 1); + } - { - XRPAmount big(maxXRP); - auto const rup = mulRatio(big, maxUInt32 - 1, maxUInt32, true); - auto const rdown = mulRatio(big, maxUInt32 - 1, maxUInt32, false); - BEAST_EXPECT(rup.drops() - rdown.drops() == 1); - } + { + XRPAmount big(maxXRP); + auto const rup = mulRatio(big, maxUInt32 - 1, maxUInt32, true); + auto const rdown = + mulRatio(big, maxUInt32 - 1, maxUInt32, false); + BEAST_EXPECT(rup.drops() - rdown.drops() == 1); + } - { - XRPAmount negOne(-1); - auto const rup = mulRatio(negOne, maxUInt32 - 1, maxUInt32, true); - auto const rdown = mulRatio(negOne, maxUInt32 - 1, maxUInt32, false); - BEAST_EXPECT(rup.drops() - rdown.drops() == 1); - } -} + { + XRPAmount negOne(-1); + auto const rup = + mulRatio(negOne, maxUInt32 - 1, maxUInt32, true); + auto const rdown = + mulRatio(negOne, maxUInt32 - 1, maxUInt32, false); + BEAST_EXPECT(rup.drops() - rdown.drops() == 1); + } + } -{ - // division by zero - XRPAmount one(1); - except([&] { mulRatio(one, 1, 0, true); }); -} + { + // division by zero + XRPAmount one(1); + except([&] { mulRatio(one, 1, 0, true); }); + } -{ - // overflow - XRPAmount big(maxXRP); - except([&] { mulRatio(big, 2, 1, true); }); -} + { + // overflow + XRPAmount big(maxXRP); + except([&] { mulRatio(big, 2, 1, true); }); + } -{ - // underflow - XRPAmount bigNegative(minXRP + 10); - BEAST_EXPECT(mulRatio(bigNegative, 2, 1, true) == minXRP); -} -} // namespace ripple + { + // underflow + XRPAmount bigNegative(minXRP + 10); + BEAST_EXPECT(mulRatio(bigNegative, 2, 1, true) == minXRP); + } + } // namespace ripple -//-------------------------------------------------------------------------- + //-------------------------------------------------------------------------- -void -run() override -{ - testSigNum(); - testBeastZero(); - testComparisons(); - testAddSub(); - testDecimal(); - testFunctions(); - testMulRatio(); -} -} -; + void + run() override + { + testSigNum(); + testBeastZero(); + testComparisons(); + testAddSub(); + testDecimal(); + testFunctions(); + testMulRatio(); + } +}; BEAST_DEFINE_TESTSUITE(XRPAmount, protocol, ripple); -} // ripple +} // namespace ripple diff --git a/src/test/basics/base_uint_test.cpp b/src/test/basics/base_uint_test.cpp index 43000a1128c..9f3194f4fbc 100644 --- a/src/test/basics/base_uint_test.cpp +++ b/src/test/basics/base_uint_test.cpp @@ -48,7 +48,8 @@ struct nonhash memcpy(data_.data(), key, len); } - explicit operator std::size_t() noexcept + explicit + operator std::size_t() noexcept { return WIDTH; } diff --git a/src/test/beast/beast_Zero_test.cpp b/src/test/beast/beast_Zero_test.cpp index b6071636255..8fd16a4d51f 100644 --- a/src/test/beast/beast_Zero_test.cpp +++ b/src/test/beast/beast_Zero_test.cpp @@ -27,7 +27,8 @@ struct adl_tester { }; -int signum(adl_tester) +int +signum(adl_tester) { return 0; } @@ -38,7 +39,8 @@ struct adl_tester2 { }; -int signum(adl_tester2) +int +signum(adl_tester2) { return 0; } diff --git a/src/test/consensus/ByzantineFailureSim_test.cpp b/src/test/consensus/ByzantineFailureSim_test.cpp index ce59adbe9f0..92dbfc0174d 100644 --- a/src/test/consensus/ByzantineFailureSim_test.cpp +++ b/src/test/consensus/ByzantineFailureSim_test.cpp @@ -66,8 +66,8 @@ class ByzantineFailureSim_test : public beast::unit_test::suite for (TrustGraph::ForkInfo const& fi : sim.trustGraph.forkablePairs(0.8)) { - std::cout << "Can fork " << PeerGroup{fi.unlA} << " " - << " " << PeerGroup{fi.unlB} << " overlap " << fi.overlap + std::cout << "Can fork " << PeerGroup{fi.unlA} << " " << " " + << PeerGroup{fi.unlB} << " overlap " << fi.overlap << " required " << fi.required << "\n"; }; diff --git a/src/test/csf/Peer.h b/src/test/csf/Peer.h index 5eed78569f6..2f3b460e02f 100644 --- a/src/test/csf/Peer.h +++ b/src/test/csf/Peer.h @@ -644,7 +644,8 @@ struct Peer } // Not interested in tracking consensus mode changes for now - void onModeChange(ConsensusMode, ConsensusMode) + void + onModeChange(ConsensusMode, ConsensusMode) { } diff --git a/src/test/csf/collectors.h b/src/test/csf/collectors.h index 511fb2c4b0f..8dcaa035314 100644 --- a/src/test/csf/collectors.h +++ b/src/test/csf/collectors.h @@ -281,66 +281,62 @@ struct TxCollector if (printBreakline) { - log << std::setw(11) << std::setfill('-') << "-" - << "-" << std::setw(7) << std::setfill('-') << "-" - << "-" << std::setw(7) << std::setfill('-') << "-" - << "-" << std::setw(36) << std::setfill('-') << "-" - << std::endl; + log << std::setw(11) << std::setfill('-') << "-" << "-" + << std::setw(7) << std::setfill('-') << "-" << "-" + << std::setw(7) << std::setfill('-') << "-" << "-" + << std::setw(36) << std::setfill('-') << "-" << std::endl; log << std::setfill(' '); } - log << std::left << std::setw(11) << "TxStats" - << "|" << std::setw(7) << "Count" - << "|" << std::setw(7) << "Per Sec" - << "|" << std::setw(15) << "Latency (sec)" << std::right - << std::setw(7) << "10-ile" << std::setw(7) << "50-ile" - << std::setw(7) << "90-ile" << std::left << std::endl; + log << std::left << std::setw(11) << "TxStats" << "|" << std::setw(7) + << "Count" << "|" << std::setw(7) << "Per Sec" << "|" + << std::setw(15) << "Latency (sec)" << std::right << std::setw(7) + << "10-ile" << std::setw(7) << "50-ile" << std::setw(7) << "90-ile" + << std::left << std::endl; - log << std::setw(11) << std::setfill('-') << "-" - << "|" << std::setw(7) << std::setfill('-') << "-" - << "|" << std::setw(7) << std::setfill('-') << "-" - << "|" << std::setw(36) << std::setfill('-') << "-" << std::endl; + log << std::setw(11) << std::setfill('-') << "-" << "|" << std::setw(7) + << std::setfill('-') << "-" << "|" << std::setw(7) + << std::setfill('-') << "-" << "|" << std::setw(36) + << std::setfill('-') << "-" << std::endl; log << std::setfill(' '); - log << std::left << std::setw(11) << "Submit " - << "|" << std::right << std::setw(7) << submitted << "|" - << std::setw(7) << std::setprecision(2) << perSec(submitted) << "|" - << std::setw(36) << "" << std::endl; + log << std::left << std::setw(11) << "Submit " << "|" << std::right + << std::setw(7) << submitted << "|" << std::setw(7) + << std::setprecision(2) << perSec(submitted) << "|" << std::setw(36) + << "" << std::endl; - log << std::left << std::setw(11) << "Accept " - << "|" << std::right << std::setw(7) << accepted << "|" - << std::setw(7) << std::setprecision(2) << perSec(accepted) << "|" - << std::setw(15) << std::left << "From Submit" << std::right - << std::setw(7) << std::setprecision(2) - << fmtS(submitToAccept.percentile(0.1f)) << std::setw(7) - << std::setprecision(2) << fmtS(submitToAccept.percentile(0.5f)) + log << std::left << std::setw(11) << "Accept " << "|" << std::right + << std::setw(7) << accepted << "|" << std::setw(7) + << std::setprecision(2) << perSec(accepted) << "|" << std::setw(15) + << std::left << "From Submit" << std::right << std::setw(7) + << std::setprecision(2) << fmtS(submitToAccept.percentile(0.1f)) << std::setw(7) << std::setprecision(2) - << fmtS(submitToAccept.percentile(0.9f)) << std::endl; + << fmtS(submitToAccept.percentile(0.5f)) << std::setw(7) + << std::setprecision(2) << fmtS(submitToAccept.percentile(0.9f)) + << std::endl; - log << std::left << std::setw(11) << "Validate " - << "|" << std::right << std::setw(7) << validated << "|" - << std::setw(7) << std::setprecision(2) << perSec(validated) << "|" - << std::setw(15) << std::left << "From Submit" << std::right - << std::setw(7) << std::setprecision(2) - << fmtS(submitToValidate.percentile(0.1f)) << std::setw(7) - << std::setprecision(2) << fmtS(submitToValidate.percentile(0.5f)) + log << std::left << std::setw(11) << "Validate " << "|" << std::right + << std::setw(7) << validated << "|" << std::setw(7) + << std::setprecision(2) << perSec(validated) << "|" << std::setw(15) + << std::left << "From Submit" << std::right << std::setw(7) + << std::setprecision(2) << fmtS(submitToValidate.percentile(0.1f)) << std::setw(7) << std::setprecision(2) - << fmtS(submitToValidate.percentile(0.9f)) << std::endl; - - log << std::left << std::setw(11) << "Orphan" - << "|" << std::right << std::setw(7) << orphaned() << "|" - << std::setw(7) << "" - << "|" << std::setw(36) << std::endl; - - log << std::left << std::setw(11) << "Unvalidated" - << "|" << std::right << std::setw(7) << unvalidated() << "|" - << std::setw(7) << "" - << "|" << std::setw(43) << std::endl; - - log << std::setw(11) << std::setfill('-') << "-" - << "-" << std::setw(7) << std::setfill('-') << "-" - << "-" << std::setw(7) << std::setfill('-') << "-" - << "-" << std::setw(36) << std::setfill('-') << "-" << std::endl; + << fmtS(submitToValidate.percentile(0.5f)) << std::setw(7) + << std::setprecision(2) << fmtS(submitToValidate.percentile(0.9f)) + << std::endl; + + log << std::left << std::setw(11) << "Orphan" << "|" << std::right + << std::setw(7) << orphaned() << "|" << std::setw(7) << "" << "|" + << std::setw(36) << std::endl; + + log << std::left << std::setw(11) << "Unvalidated" << "|" << std::right + << std::setw(7) << unvalidated() << "|" << std::setw(7) << "" << "|" + << std::setw(43) << std::endl; + + log << std::setw(11) << std::setfill('-') << "-" << "-" << std::setw(7) + << std::setfill('-') << "-" << "-" << std::setw(7) + << std::setfill('-') << "-" << "-" << std::setw(36) + << std::setfill('-') << "-" << std::endl; log << std::setfill(' '); } @@ -362,34 +358,15 @@ struct TxCollector if (printHeaders) { - log << "tag" - << "," - << "txNumSubmitted" - << "," - << "txNumAccepted" - << "," - << "txNumValidated" - << "," - << "txNumOrphaned" - << "," - << "txUnvalidated" - << "," - << "txRateSumbitted" - << "," - << "txRateAccepted" - << "," - << "txRateValidated" - << "," - << "txLatencySubmitToAccept10Pctl" - << "," - << "txLatencySubmitToAccept50Pctl" - << "," - << "txLatencySubmitToAccept90Pctl" - << "," - << "txLatencySubmitToValidatet10Pctl" - << "," - << "txLatencySubmitToValidatet50Pctl" - << "," + log << "tag" << "," << "txNumSubmitted" << "," << "txNumAccepted" + << "," << "txNumValidated" << "," << "txNumOrphaned" << "," + << "txUnvalidated" << "," << "txRateSumbitted" << "," + << "txRateAccepted" << "," << "txRateValidated" << "," + << "txLatencySubmitToAccept10Pctl" << "," + << "txLatencySubmitToAccept50Pctl" << "," + << "txLatencySubmitToAccept90Pctl" << "," + << "txLatencySubmitToValidatet10Pctl" << "," + << "txLatencySubmitToValidatet50Pctl" << "," << "txLatencySubmitToValidatet90Pctl" << std::endl; } @@ -548,52 +525,50 @@ struct LedgerCollector if (printBreakline) { - log << std::setw(11) << std::setfill('-') << "-" - << "-" << std::setw(7) << std::setfill('-') << "-" - << "-" << std::setw(7) << std::setfill('-') << "-" - << "-" << std::setw(36) << std::setfill('-') << "-" - << std::endl; + log << std::setw(11) << std::setfill('-') << "-" << "-" + << std::setw(7) << std::setfill('-') << "-" << "-" + << std::setw(7) << std::setfill('-') << "-" << "-" + << std::setw(36) << std::setfill('-') << "-" << std::endl; log << std::setfill(' '); } - log << std::left << std::setw(11) << "LedgerStats" - << "|" << std::setw(7) << "Count" - << "|" << std::setw(7) << "Per Sec" + log << std::left << std::setw(11) << "LedgerStats" << "|" + << std::setw(7) << "Count" << "|" << std::setw(7) << "Per Sec" << "|" << std::setw(15) << "Latency (sec)" << std::right << std::setw(7) << "10-ile" << std::setw(7) << "50-ile" << std::setw(7) << "90-ile" << std::left << std::endl; - log << std::setw(11) << std::setfill('-') << "-" - << "|" << std::setw(7) << std::setfill('-') << "-" - << "|" << std::setw(7) << std::setfill('-') << "-" - << "|" << std::setw(36) << std::setfill('-') << "-" << std::endl; + log << std::setw(11) << std::setfill('-') << "-" << "|" << std::setw(7) + << std::setfill('-') << "-" << "|" << std::setw(7) + << std::setfill('-') << "-" << "|" << std::setw(36) + << std::setfill('-') << "-" << std::endl; log << std::setfill(' '); - log << std::left << std::setw(11) << "Accept " - << "|" << std::right << std::setw(7) << accepted << "|" - << std::setw(7) << std::setprecision(2) << perSec(accepted) << "|" - << std::setw(15) << std::left << "From Accept" << std::right - << std::setw(7) << std::setprecision(2) - << fmtS(acceptToAccept.percentile(0.1f)) << std::setw(7) - << std::setprecision(2) << fmtS(acceptToAccept.percentile(0.5f)) + log << std::left << std::setw(11) << "Accept " << "|" << std::right + << std::setw(7) << accepted << "|" << std::setw(7) + << std::setprecision(2) << perSec(accepted) << "|" << std::setw(15) + << std::left << "From Accept" << std::right << std::setw(7) + << std::setprecision(2) << fmtS(acceptToAccept.percentile(0.1f)) << std::setw(7) << std::setprecision(2) - << fmtS(acceptToAccept.percentile(0.9f)) << std::endl; + << fmtS(acceptToAccept.percentile(0.5f)) << std::setw(7) + << std::setprecision(2) << fmtS(acceptToAccept.percentile(0.9f)) + << std::endl; - log << std::left << std::setw(11) << "Validate " - << "|" << std::right << std::setw(7) << fullyValidated << "|" - << std::setw(7) << std::setprecision(2) << perSec(fullyValidated) - << "|" << std::setw(15) << std::left << "From Validate " - << std::right << std::setw(7) << std::setprecision(2) + log << std::left << std::setw(11) << "Validate " << "|" << std::right + << std::setw(7) << fullyValidated << "|" << std::setw(7) + << std::setprecision(2) << perSec(fullyValidated) << "|" + << std::setw(15) << std::left << "From Validate " << std::right + << std::setw(7) << std::setprecision(2) << fmtS(fullyValidToFullyValid.percentile(0.1f)) << std::setw(7) << std::setprecision(2) << fmtS(fullyValidToFullyValid.percentile(0.5f)) << std::setw(7) << std::setprecision(2) << fmtS(fullyValidToFullyValid.percentile(0.9f)) << std::endl; - log << std::setw(11) << std::setfill('-') << "-" - << "-" << std::setw(7) << std::setfill('-') << "-" - << "-" << std::setw(7) << std::setfill('-') << "-" - << "-" << std::setw(36) << std::setfill('-') << "-" << std::endl; + log << std::setw(11) << std::setfill('-') << "-" << "-" << std::setw(7) + << std::setfill('-') << "-" << "-" << std::setw(7) + << std::setfill('-') << "-" << "-" << std::setw(36) + << std::setfill('-') << "-" << std::endl; log << std::setfill(' '); } @@ -615,26 +590,14 @@ struct LedgerCollector if (printHeaders) { - log << "tag" - << "," - << "ledgerNumAccepted" - << "," - << "ledgerNumFullyValidated" - << "," - << "ledgerRateAccepted" - << "," - << "ledgerRateFullyValidated" - << "," - << "ledgerLatencyAcceptToAccept10Pctl" - << "," - << "ledgerLatencyAcceptToAccept50Pctl" - << "," - << "ledgerLatencyAcceptToAccept90Pctl" - << "," - << "ledgerLatencyFullyValidToFullyValid10Pctl" - << "," - << "ledgerLatencyFullyValidToFullyValid50Pctl" - << "," + log << "tag" << "," << "ledgerNumAccepted" << "," + << "ledgerNumFullyValidated" << "," << "ledgerRateAccepted" + << "," << "ledgerRateFullyValidated" << "," + << "ledgerLatencyAcceptToAccept10Pctl" << "," + << "ledgerLatencyAcceptToAccept50Pctl" << "," + << "ledgerLatencyAcceptToAccept90Pctl" << "," + << "ledgerLatencyFullyValidToFullyValid10Pctl" << "," + << "ledgerLatencyFullyValidToFullyValid50Pctl" << "," << "ledgerLatencyFullyValidToFullyValid90Pctl" << std::endl; } @@ -695,16 +658,16 @@ struct StreamCollector on(PeerID who, SimTime when, AcceptLedger const& e) { out << when.time_since_epoch().count() << ": Node " << who - << " accepted " - << "L" << e.ledger.id() << " " << e.ledger.txs() << "\n"; + << " accepted " << "L" << e.ledger.id() << " " << e.ledger.txs() + << "\n"; } void on(PeerID who, SimTime when, FullyValidateLedger const& e) { out << when.time_since_epoch().count() << ": Node " << who - << " fully-validated " - << "L" << e.ledger.id() << " " << e.ledger.txs() << "\n"; + << " fully-validated " << "L" << e.ledger.id() << " " + << e.ledger.txs() << "\n"; } }; diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 800662aa05b..7165bc26970 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -39,11 +39,11 @@ namespace jtx { // when we have moved to better compilers. template auto -make_vector(Input const& input) requires requires(Input& v) -{ - std::begin(v); - std::end(v); -} +make_vector(Input const& input) + requires requires(Input& v) { + std::begin(v); + std::end(v); + } { return std::vector(std::begin(input), std::end(input)); } diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index a10b9999ad2..b786cae2846 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -217,9 +217,8 @@ class TrustedPublisherServer getList_ = [blob = blob, sig, manifest, version](int interval) { // Build the contents of a version 1 format UNL file std::stringstream l; - l << "{\"blob\":\"" << blob << "\"" - << ",\"signature\":\"" << sig << "\"" - << ",\"manifest\":\"" << manifest << "\"" + l << "{\"blob\":\"" << blob << "\"" << ",\"signature\":\"" << sig + << "\"" << ",\"manifest\":\"" << manifest << "\"" << ",\"refresh_interval\": " << interval << ",\"version\":" << version << '}'; return l.str(); @@ -254,15 +253,14 @@ class TrustedPublisherServer std::stringstream l; for (auto const& info : blobInfo) { - l << "{\"blob\":\"" << info.blob << "\"" - << ",\"signature\":\"" << info.signature << "\"},"; + l << "{\"blob\":\"" << info.blob << "\"" << ",\"signature\":\"" + << info.signature << "\"},"; } std::string blobs = l.str(); blobs.pop_back(); l.str(std::string()); l << "{\"blobs_v2\": [ " << blobs << "],\"manifest\":\"" << manifest - << "\"" - << ",\"refresh_interval\": " << interval + << "\"" << ",\"refresh_interval\": " << interval << ",\"version\":" << (version + 1) << '}'; return l.str(); }; diff --git a/src/test/jtx/amount.h b/src/test/jtx/amount.h index c8e0d0c3701..459ec5b5c65 100644 --- a/src/test/jtx/amount.h +++ b/src/test/jtx/amount.h @@ -126,7 +126,7 @@ struct PrettyAmount return amount_; } - operator STAmount const &() const + operator STAmount const&() const { return amount_; } @@ -211,7 +211,8 @@ struct XRP_t /** @} */ /** Returns None-of-XRP */ - None operator()(none_t) const + None + operator()(none_t) const { return {xrpIssue()}; } @@ -327,14 +328,17 @@ class IOU return {amountFromString(issue(), std::to_string(v)), account.name()}; } - PrettyAmount operator()(epsilon_t) const; - PrettyAmount operator()(detail::epsilon_multiple) const; + PrettyAmount + operator()(epsilon_t) const; + PrettyAmount + operator()(detail::epsilon_multiple) const; // VFALCO TODO // STAmount operator()(char const* s) const; /** Returns None-of-Issue */ - None operator()(none_t) const + None + operator()(none_t) const { return {issue()}; } diff --git a/src/test/jtx/impl/AMM.cpp b/src/test/jtx/impl/AMM.cpp index c083b6df35c..8c369e68527 100644 --- a/src/test/jtx/impl/AMM.cpp +++ b/src/test/jtx/impl/AMM.cpp @@ -42,8 +42,8 @@ static IOUAmount initialTokens(STAmount const& asset1, STAmount const& asset2) { auto const product = number(asset1) * number(asset2); - return (IOUAmount)( - product.mantissa() >= 0 ? root2(product) : root2(-product)); + return (IOUAmount)(product.mantissa() >= 0 ? root2(product) + : root2(-product)); } AMM::AMM( diff --git a/src/test/jtx/impl/amount.cpp b/src/test/jtx/impl/amount.cpp index 01fa5369592..9f374c2cb58 100644 --- a/src/test/jtx/impl/amount.cpp +++ b/src/test/jtx/impl/amount.cpp @@ -104,7 +104,8 @@ operator<<(std::ostream& os, PrettyAmount const& amount) XRP_t const XRP{}; -PrettyAmount IOU::operator()(epsilon_t) const +PrettyAmount +IOU::operator()(epsilon_t) const { return {STAmount(issue(), 1, -81), account.name()}; } diff --git a/src/test/jtx/multisign.h b/src/test/jtx/multisign.h index 3946ea14b26..44cee17b7bf 100644 --- a/src/test/jtx/multisign.h +++ b/src/test/jtx/multisign.h @@ -100,9 +100,8 @@ class msig msig(std::vector signers_); template - requires std::convertible_to explicit msig( - AccountType&& a0, - Accounts&&... aN) + requires std::convertible_to + explicit msig(AccountType&& a0, Accounts&&... aN) : msig{std::vector{ std::forward(a0), std::forward(aN)...}} diff --git a/src/test/overlay/reduce_relay_test.cpp b/src/test/overlay/reduce_relay_test.cpp index 4d9086dab10..e0b0d006a2f 100644 --- a/src/test/overlay/reduce_relay_test.cpp +++ b/src/test/overlay/reduce_relay_test.cpp @@ -888,9 +888,8 @@ class reduce_relay_test : public beast::unit_test::suite printPeers(const std::string& msg, std::uint16_t validator = 0) { auto peers = network_.overlay().getPeers(network_.validator(validator)); - std::cout << msg << " " - << "num peers " << (int)network_.overlay().getNumPeers() - << std::endl; + std::cout << msg << " " << "num peers " + << (int)network_.overlay().getNumPeers() << std::endl; for (auto& [k, v] : peers) std::cout << k << ":" << (int)std::get(v) << " "; diff --git a/src/test/protocol/MultiApiJson_test.cpp b/src/test/protocol/MultiApiJson_test.cpp index 2c0b410f899..a5c37d257c4 100644 --- a/src/test/protocol/MultiApiJson_test.cpp +++ b/src/test/protocol/MultiApiJson_test.cpp @@ -105,8 +105,8 @@ struct MultiApiJson_test : beast::unit_test::suite BEAST_EXPECT(!s1.valid(0)); BEAST_EXPECT(!s1.valid(RPC::apiMaximumValidVersion + 1)); BEAST_EXPECT( - !s1.valid(std::numeric_limits::max())); + !s1.valid(std::numeric_limits< + decltype(RPC::apiMaximumValidVersion.value)>::max())); int result = 1; static_assert( @@ -165,32 +165,28 @@ struct MultiApiJson_test : beast::unit_test::suite // Several overloads we want to fail static_assert([](auto&& v) { - return !requires - { + return !requires { forAllApiVersions( std::forward(v).visit(), // [](Json::Value&, auto) {}); // missing const }; }(std::as_const(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { forAllApiVersions( std::forward(v).visit(), // [](Json::Value&) {}); // missing const }; }(std::as_const(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { forAllApiVersions( std::forward(v).visit(), // []() {}); // missing parameters }; }(std::as_const(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { forAllApiVersions( std::forward(v).visit(), // [](auto) {}, @@ -198,8 +194,7 @@ struct MultiApiJson_test : beast::unit_test::suite }; }(std::as_const(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { forAllApiVersions( std::forward(v).visit(), // [](auto, auto) {}, @@ -207,8 +202,7 @@ struct MultiApiJson_test : beast::unit_test::suite }; }(std::as_const(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { forAllApiVersions( std::forward(v).visit(), // [](auto, auto, const char*) {}, @@ -218,40 +212,35 @@ struct MultiApiJson_test : beast::unit_test::suite // Sanity checks static_assert([](auto&& v) { - return requires - { + return requires { forAllApiVersions( std::forward(v).visit(), // [](auto) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { + return requires { forAllApiVersions( std::forward(v).visit(), // [](Json::Value const&) {}); }; }(std::as_const(s1))); static_assert([](auto&& v) { - return requires - { + return requires { forAllApiVersions( std::forward(v).visit(), // [](auto...) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { + return requires { forAllApiVersions( std::forward(v).visit(), // [](Json::Value const&, auto...) {}); }; }(std::as_const(s1))); static_assert([](auto&& v) { - return requires - { + return requires { forAllApiVersions( std::forward(v).visit(), // [](Json::Value&, auto, auto, auto...) {}, @@ -260,8 +249,7 @@ struct MultiApiJson_test : beast::unit_test::suite }; }(s1)); static_assert([](auto&& v) { - return requires - { + return requires { forAllApiVersions( std::forward(v).visit(), // []( @@ -274,16 +262,14 @@ struct MultiApiJson_test : beast::unit_test::suite }; }(std::as_const(s1))); static_assert([](auto&& v) { - return requires - { + return requires { forAllApiVersions( std::forward(v).visit(), // [](auto...) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return requires - { + return requires { forAllApiVersions( std::forward(v).visit(), // [](auto...) {}); @@ -342,45 +328,25 @@ struct MultiApiJson_test : beast::unit_test::suite // Tests of requires clause - these are expected to match static_assert([](auto&& v) { - return requires - { - v.set("name", Json::nullValue); - }; + return requires { v.set("name", Json::nullValue); }; }(x)); static_assert([](auto&& v) { - return requires - { - v.set("name", "value"); - }; - }(x)); - static_assert([](auto&& v) { - return requires - { - v.set("name", true); - }; - }(x)); - static_assert([](auto&& v) { - return requires - { - v.set("name", 42); - }; + return requires { v.set("name", "value"); }; }(x)); + static_assert( + [](auto&& v) { return requires { v.set("name", true); }; }(x)); + static_assert( + [](auto&& v) { return requires { v.set("name", 42); }; }(x)); // Tests of requires clause - these are expected NOT to match struct foo_t final { }; static_assert([](auto&& v) { - return !requires - { - v.set("name", foo_t{}); - }; + return !requires { v.set("name", foo_t{}); }; }(x)); static_assert([](auto&& v) { - return !requires - { - v.set("name", std::nullopt); - }; + return !requires { v.set("name", std::nullopt); }; }(x)); } @@ -436,8 +402,7 @@ struct MultiApiJson_test : beast::unit_test::suite // Test different overloads static_assert([](auto&& v) { - return requires - { + return requires { v.visitor( v, std::integral_constant{}, @@ -458,8 +423,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto, auto) { return 0; }}) == 2); static_assert([](auto&& v) { - return requires - { + return requires { v.visitor( v, std::integral_constant{}, @@ -476,8 +440,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto...) { return 0; }}) == 2); static_assert([](auto&& v) { - return requires - { + return requires { v.visitor( v, std::integral_constant{}, @@ -498,8 +461,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto, auto) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { + return requires { v.visitor( v, std::integral_constant{}, @@ -516,8 +478,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto...) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { + return requires { v.visitor(v, 1, [](Json::Value&, unsigned) {}); }; }(s1)); @@ -533,10 +494,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto, auto) { return 0; }}) == 5); static_assert([](auto&& v) { - return requires - { - v.visitor(v, 1, [](Json::Value&) {}); - }; + return requires { v.visitor(v, 1, [](Json::Value&) {}); }; }(s1)); BEAST_EXPECT( s1.visitor( @@ -548,8 +506,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto...) { return 0; }}) == 5); static_assert([](auto&& v) { - return requires - { + return requires { v.visitor(v, 1, [](Json::Value const&, unsigned) {}); }; }(std::as_const(s1))); @@ -565,10 +522,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto, auto) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { - v.visitor(v, 1, [](Json::Value const&) {}); - }; + return requires { v.visitor(v, 1, [](Json::Value const&) {}); }; }(std::as_const(s1))); BEAST_EXPECT( s1.visitor( @@ -671,8 +625,7 @@ struct MultiApiJson_test : beast::unit_test::suite // Several overloads we want to fail static_assert([](auto&& v) { - return !requires - { + return !requires { v.visitor( v, 1, // @@ -681,8 +634,7 @@ struct MultiApiJson_test : beast::unit_test::suite }(std::as_const(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { v.visitor( std::move(v), // cannot bind rvalue 1, @@ -691,8 +643,7 @@ struct MultiApiJson_test : beast::unit_test::suite }(s1)); static_assert([](auto&& v) { - return !requires - { + return !requires { v.visitor( v, 1, // @@ -701,8 +652,7 @@ struct MultiApiJson_test : beast::unit_test::suite }(s1)); static_assert([](auto&& v) { - return !requires - { + return !requires { v.visitor( v, 1, // @@ -712,74 +662,52 @@ struct MultiApiJson_test : beast::unit_test::suite // Want these to be unambiguous static_assert([](auto&& v) { - return requires - { - v.visitor(v, 1, [](auto) {}); - }; + return requires { v.visitor(v, 1, [](auto) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { - v.visitor(v, 1, [](Json::Value&) {}); - }; + return requires { v.visitor(v, 1, [](Json::Value&) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { + return requires { v.visitor(v, 1, [](Json::Value&, auto...) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { - v.visitor(v, 1, [](Json::Value const&) {}); - }; + return requires { v.visitor(v, 1, [](Json::Value const&) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { + return requires { v.visitor(v, 1, [](Json::Value const&, auto...) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { - v.visitor(v, 1, [](auto...) {}); - }; + return requires { v.visitor(v, 1, [](auto...) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { - v.visitor(v, 1, [](auto, auto...) {}); - }; + return requires { v.visitor(v, 1, [](auto, auto...) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { + return requires { v.visitor(v, 1, [](auto, auto, auto...) {}); }; }(s1)); static_assert([](auto&& v) { - return requires - { - v.visitor( - v, 1, [](auto, auto, auto...) {}, ""); + return requires { + v.visitor(v, 1, [](auto, auto, auto...) {}, ""); }; }(s1)); static_assert([](auto&& v) { - return requires - { - v.visitor( - v, 1, [](auto, auto, auto, auto...) {}, ""); + return requires { + v.visitor(v, 1, [](auto, auto, auto, auto...) {}, ""); }; }(s1)); } @@ -794,8 +722,7 @@ struct MultiApiJson_test : beast::unit_test::suite // Test different overloads static_assert([](auto&& v) { - return requires - { + return requires { v.visit( std::integral_constant{}, [](Json::Value&, std::integral_constant) { @@ -813,8 +740,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](Json::Value const&, auto) { return 0; }, [](auto, auto) { return 0; }}) == 2); static_assert([](auto&& v) { - return requires - { + return requires { v.visit()( std::integral_constant{}, [](Json::Value&, std::integral_constant) { @@ -833,8 +759,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto, auto) { return 0; }}) == 2); static_assert([](auto&& v) { - return requires - { + return requires { v.visit( std::integral_constant{}, [](Json::Value&) {}); @@ -848,8 +773,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](Json::Value const&) { return 0; }, [](auto...) { return 0; }}) == 2); static_assert([](auto&& v) { - return requires - { + return requires { v.visit()( std::integral_constant{}, [](Json::Value&) {}); @@ -864,8 +788,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto...) { return 0; }}) == 2); static_assert([](auto&& v) { - return requires - { + return requires { v.visit( std::integral_constant{}, [](Json::Value const&, @@ -883,8 +806,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](Json::Value&, auto) { return 0; }, [](auto, auto) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { + return requires { v.visit()( std::integral_constant{}, [](Json::Value const&, @@ -903,8 +825,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto, auto) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { + return requires { v.visit( std::integral_constant{}, [](Json::Value const&) {}); @@ -918,8 +839,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](Json::Value&) { return 0; }, [](auto...) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { + return requires { v.visit()( std::integral_constant{}, [](Json::Value const&) {}); @@ -934,10 +854,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto...) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { - v.visit(1, [](Json::Value&, unsigned) {}); - }; + return requires { v.visit(1, [](Json::Value&, unsigned) {}); }; }(s1)); BEAST_EXPECT( s1.visit( @@ -950,8 +867,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](Json::Value&, auto) { return 0; }, [](auto, auto) { return 0; }}) == 5); static_assert([](auto&& v) { - return requires - { + return requires { v.visit()(1, [](Json::Value&, unsigned) {}); }; }(s1)); @@ -967,10 +883,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto, auto) { return 0; }}) == 5); static_assert([](auto&& v) { - return requires - { - v.visit(1, [](Json::Value&) {}); - }; + return requires { v.visit(1, [](Json::Value&) {}); }; }(s1)); BEAST_EXPECT( s1.visit( @@ -980,10 +893,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](Json::Value const&) { return 0; }, [](auto...) { return 0; }}) == 5); static_assert([](auto&& v) { - return requires - { - v.visit()(1, [](Json::Value&) {}); - }; + return requires { v.visit()(1, [](Json::Value&) {}); }; }(s1)); BEAST_EXPECT( s1.visit()( @@ -994,8 +904,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto...) { return 0; }}) == 5); static_assert([](auto&& v) { - return requires - { + return requires { v.visit(1, [](Json::Value const&, unsigned) {}); }; }(std::as_const(s1))); @@ -1010,8 +919,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](Json::Value&, unsigned) { return 0; }, [](auto, auto) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { + return requires { v.visit()(1, [](Json::Value const&, unsigned) {}); }; }(std::as_const(s1))); @@ -1027,10 +935,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](auto, auto) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { - v.visit(1, [](Json::Value const&) {}); - }; + return requires { v.visit(1, [](Json::Value const&) {}); }; }(std::as_const(s1))); BEAST_EXPECT( std::as_const(s1).visit( @@ -1040,10 +945,7 @@ struct MultiApiJson_test : beast::unit_test::suite [](Json::Value&) { return 0; }, [](auto...) { return 0; }}) == 3); static_assert([](auto&& v) { - return requires - { - v.visit()(1, [](Json::Value const&) {}); - }; + return requires { v.visit()(1, [](Json::Value const&) {}); }; }(std::as_const(s1))); BEAST_EXPECT( std::as_const(s1).visit()( @@ -1055,83 +957,71 @@ struct MultiApiJson_test : beast::unit_test::suite // Rvalue MultivarJson visitor only binds to regular reference static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit(1, [](Json::Value&&) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit( 1, [](Json::Value const&&) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return requires - { + return requires { std::forward(v).visit(1, [](Json::Value&) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return requires - { + return requires { std::forward(v).visit( 1, [](Json::Value const&) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit()( 1, [](Json::Value&&) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit()( 1, [](Json::Value const&&) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return requires - { + return requires { std::forward(v).visit()( 1, [](Json::Value&) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return requires - { + return requires { std::forward(v).visit()( 1, [](Json::Value const&) {}); }; }(std::move(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit( 1, [](Json::Value const&&) {}); }; }(std::move(std::as_const(s1)))); static_assert([](auto&& v) { - return requires - { + return requires { std::forward(v).visit( 1, [](Json::Value const&) {}); }; }(std::move(std::as_const(s1)))); static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit()( 1, [](Json::Value const&&) {}); }; }(std::move(std::as_const(s1)))); static_assert([](auto&& v) { - return requires - { + return requires { std::forward(v).visit()( 1, [](Json::Value const&) {}); }; @@ -1139,15 +1029,13 @@ struct MultiApiJson_test : beast::unit_test::suite // Missing const static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit( 1, [](Json::Value&, auto) {}); }; }(std::as_const(s1))); static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit()( 1, [](Json::Value&, auto) {}); }; @@ -1155,28 +1043,24 @@ struct MultiApiJson_test : beast::unit_test::suite // Missing parameter static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit(1, []() {}); }; }(s1)); static_assert([](auto&& v) { - return !requires - { + return !requires { std::forward(v).visit()(1, []() {}); }; }(s1)); // Sanity checks static_assert([](auto&& v) { - return requires - { + return requires { std::forward(v).visit(1, [](auto...) {}); }; }(std::as_const(s1))); static_assert([](auto&& v) { - return requires - { + return requires { std::forward(v).visit()(1, [](auto...) {}); }; }(std::as_const(s1))); diff --git a/src/test/protocol/STObject_test.cpp b/src/test/protocol/STObject_test.cpp index 39a5b9c2f65..41c3800bce4 100644 --- a/src/test/protocol/STObject_test.cpp +++ b/src/test/protocol/STObject_test.cpp @@ -243,9 +243,8 @@ class STObject_test : public beast::unit_test::suite unexpected(sfGeneric.isUseful(), "sfGeneric must not be useful"); { // Try to put sfGeneric in an SOTemplate. - except([&]() { - SOTemplate elements{{sfGeneric, soeREQUIRED}}; - }); + except( + [&]() { SOTemplate elements{{sfGeneric, soeREQUIRED}}; }); } unexpected(sfInvalid.isUseful(), "sfInvalid must not be useful"); @@ -263,9 +262,8 @@ class STObject_test : public beast::unit_test::suite } { // Try to put sfInvalid in an SOTemplate. - except([&]() { - SOTemplate elements{{sfInvalid, soeREQUIRED}}; - }); + except( + [&]() { SOTemplate elements{{sfInvalid, soeREQUIRED}}; }); } { // Try to put the same SField into an SOTemplate twice. @@ -570,150 +568,152 @@ class STObject_test : public beast::unit_test::suite // STBlob and slice - {{STObject st(sfGeneric); - Buffer b(1); - BEAST_EXPECT(!b.empty()); - st[sf4] = std::move(b); - BEAST_EXPECT(b.empty()); - BEAST_EXPECT(Slice(st[sf4]).size() == 1); - st[~sf4] = std::nullopt; - BEAST_EXPECT(!~st[~sf4]); - b = Buffer{2}; - st[sf4] = Slice(b); - BEAST_EXPECT(b.size() == 2); - BEAST_EXPECT(Slice(st[sf4]).size() == 2); - st[sf5] = st[sf4]; - BEAST_EXPECT(Slice(st[sf4]).size() == 2); - BEAST_EXPECT(Slice(st[sf5]).size() == 2); - } - { - STObject st(sotOuter, sfGeneric); - BEAST_EXPECT(st[sf5] == Slice{}); - BEAST_EXPECT(!!st[~sf5]); - BEAST_EXPECT(!!~st[~sf5]); - Buffer b(1); - st[sf5] = std::move(b); - BEAST_EXPECT(b.empty()); - BEAST_EXPECT(Slice(st[sf5]).size() == 1); - st[~sf4] = std::nullopt; - BEAST_EXPECT(!~st[~sf4]); - } -} + { + { + STObject st(sfGeneric); + Buffer b(1); + BEAST_EXPECT(!b.empty()); + st[sf4] = std::move(b); + BEAST_EXPECT(b.empty()); + BEAST_EXPECT(Slice(st[sf4]).size() == 1); + st[~sf4] = std::nullopt; + BEAST_EXPECT(!~st[~sf4]); + b = Buffer{2}; + st[sf4] = Slice(b); + BEAST_EXPECT(b.size() == 2); + BEAST_EXPECT(Slice(st[sf4]).size() == 2); + st[sf5] = st[sf4]; + BEAST_EXPECT(Slice(st[sf4]).size() == 2); + BEAST_EXPECT(Slice(st[sf5]).size() == 2); + } + { + STObject st(sotOuter, sfGeneric); + BEAST_EXPECT(st[sf5] == Slice{}); + BEAST_EXPECT(!!st[~sf5]); + BEAST_EXPECT(!!~st[~sf5]); + Buffer b(1); + st[sf5] = std::move(b); + BEAST_EXPECT(b.empty()); + BEAST_EXPECT(Slice(st[sf5]).size() == 1); + st[~sf4] = std::nullopt; + BEAST_EXPECT(!~st[~sf4]); + } + } -// UDT blobs + // UDT blobs -{ - STObject st(sfGeneric); - BEAST_EXPECT(!st[~sf5]); - auto const kp = - generateKeyPair(KeyType::secp256k1, generateSeed("masterpassphrase")); - st[sf5] = kp.first; - st[~sf5] = std::nullopt; -} + { + STObject st(sfGeneric); + BEAST_EXPECT(!st[~sf5]); + auto const kp = generateKeyPair( + KeyType::secp256k1, generateSeed("masterpassphrase")); + st[sf5] = kp.first; + st[~sf5] = std::nullopt; + } -// By reference fields + // By reference fields -{ - auto const& sf = sfIndexes; - STObject st(sfGeneric); - std::vector v; - v.emplace_back(1); - v.emplace_back(2); - st[sf] = v; - st[sf] = std::move(v); - auto const& cst = st; - BEAST_EXPECT(cst[sf].size() == 2); - BEAST_EXPECT(cst[~sf]->size() == 2); - BEAST_EXPECT(cst[sf][0] == 1); - BEAST_EXPECT(cst[sf][1] == 2); - static_assert( - std::is_same const&>:: - value, - ""); -} - -// Default by reference field + { + auto const& sf = sfIndexes; + STObject st(sfGeneric); + std::vector v; + v.emplace_back(1); + v.emplace_back(2); + st[sf] = v; + st[sf] = std::move(v); + auto const& cst = st; + BEAST_EXPECT(cst[sf].size() == 2); + BEAST_EXPECT(cst[~sf]->size() == 2); + BEAST_EXPECT(cst[sf][0] == 1); + BEAST_EXPECT(cst[sf][1] == 2); + static_assert( + std::is_same< + decltype(cst[sfIndexes]), + std::vector const&>::value, + ""); + } -{ - auto const& sf1 = sfIndexes; - auto const& sf2 = sfHashes; - auto const& sf3 = sfAmendments; - SOTemplate const sot{ - {sf1, soeREQUIRED}, - {sf2, soeOPTIONAL}, - {sf3, soeDEFAULT}, - }; - - STObject st(sot, sfGeneric); - auto const& cst(st); - BEAST_EXPECT(cst[sf1].size() == 0); - BEAST_EXPECT(!cst[~sf2]); - BEAST_EXPECT(cst[sf3].size() == 0); - std::vector v; - v.emplace_back(1); - st[sf1] = v; - BEAST_EXPECT(cst[sf1].size() == 1); - BEAST_EXPECT(cst[sf1][0] == uint256{1}); - st[sf2] = v; - BEAST_EXPECT(cst[sf2].size() == 1); - BEAST_EXPECT(cst[sf2][0] == uint256{1}); - st[~sf2] = std::nullopt; - BEAST_EXPECT(!st[~sf2]); - st[sf3] = v; - BEAST_EXPECT(cst[sf3].size() == 1); - BEAST_EXPECT(cst[sf3][0] == uint256{1}); - st[sf3] = std::vector{}; - BEAST_EXPECT(cst[sf3].size() == 0); -} -} // namespace ripple + // Default by reference field -void -testMalformed() -{ - testcase("Malformed serialized forms"); + { + auto const& sf1 = sfIndexes; + auto const& sf2 = sfHashes; + auto const& sf3 = sfAmendments; + SOTemplate const sot{ + {sf1, soeREQUIRED}, + {sf2, soeOPTIONAL}, + {sf3, soeDEFAULT}, + }; - try - { - std::array const payload{ - {0xe9, 0x12, 0xab, 0xcd, 0x12, 0xfe, 0xdc}}; - SerialIter sit{makeSlice(payload)}; - auto obj = std::make_shared(sit, sfMetadata); - BEAST_EXPECT(!obj); - } - catch (std::exception const& e) - { - BEAST_EXPECT(strcmp(e.what(), "Duplicate field detected") == 0); - } + STObject st(sot, sfGeneric); + auto const& cst(st); + BEAST_EXPECT(cst[sf1].size() == 0); + BEAST_EXPECT(!cst[~sf2]); + BEAST_EXPECT(cst[sf3].size() == 0); + std::vector v; + v.emplace_back(1); + st[sf1] = v; + BEAST_EXPECT(cst[sf1].size() == 1); + BEAST_EXPECT(cst[sf1][0] == uint256{1}); + st[sf2] = v; + BEAST_EXPECT(cst[sf2].size() == 1); + BEAST_EXPECT(cst[sf2][0] == uint256{1}); + st[~sf2] = std::nullopt; + BEAST_EXPECT(!st[~sf2]); + st[sf3] = v; + BEAST_EXPECT(cst[sf3].size() == 1); + BEAST_EXPECT(cst[sf3][0] == uint256{1}); + st[sf3] = std::vector{}; + BEAST_EXPECT(cst[sf3].size() == 0); + } + } // namespace ripple - try + void + testMalformed() { - std::array const payload{{0xe2, 0xe1, 0xe2}}; - SerialIter sit{makeSlice(payload)}; - auto obj = std::make_shared(sit, sfMetadata); - BEAST_EXPECT(!obj); + testcase("Malformed serialized forms"); + + try + { + std::array const payload{ + {0xe9, 0x12, 0xab, 0xcd, 0x12, 0xfe, 0xdc}}; + SerialIter sit{makeSlice(payload)}; + auto obj = std::make_shared(sit, sfMetadata); + BEAST_EXPECT(!obj); + } + catch (std::exception const& e) + { + BEAST_EXPECT(strcmp(e.what(), "Duplicate field detected") == 0); + } + + try + { + std::array const payload{{0xe2, 0xe1, 0xe2}}; + SerialIter sit{makeSlice(payload)}; + auto obj = std::make_shared(sit, sfMetadata); + BEAST_EXPECT(!obj); + } + catch (std::exception const& e) + { + BEAST_EXPECT(strcmp(e.what(), "Duplicate field detected") == 0); + } } - catch (std::exception const& e) + + void + run() override { - BEAST_EXPECT(strcmp(e.what(), "Duplicate field detected") == 0); + // Instantiate a jtx::Env so debugLog writes are exercised. + test::jtx::Env env(*this); + + testFields(); + testSerialization(); + testParseJSONArray(); + testParseJSONArrayWithInvalidChildrenObjects(); + testParseJSONEdgeCases(); + testMalformed(); } -} - -void -run() override -{ - // Instantiate a jtx::Env so debugLog writes are exercised. - test::jtx::Env env(*this); - - testFields(); - testSerialization(); - testParseJSONArray(); - testParseJSONArrayWithInvalidChildrenObjects(); - testParseJSONEdgeCases(); - testMalformed(); -} -} -; +}; BEAST_DEFINE_TESTSUITE(STObject, protocol, ripple); -} // ripple +} // namespace ripple diff --git a/src/xrpld/app/ledger/LedgerHistory.cpp b/src/xrpld/app/ledger/LedgerHistory.cpp index 30139e2155f..b63cd84772a 100644 --- a/src/xrpld/app/ledger/LedgerHistory.cpp +++ b/src/xrpld/app/ledger/LedgerHistory.cpp @@ -204,30 +204,30 @@ log_metadata_difference( { JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different result and index!"; - JLOG(j.debug()) << " Built:" - << " Result: " << builtMetaData->getResult() - << " Index: " << builtMetaData->getIndex(); - JLOG(j.debug()) << " Valid:" - << " Result: " << validMetaData->getResult() - << " Index: " << validMetaData->getIndex(); + JLOG(j.debug()) + << " Built:" << " Result: " << builtMetaData->getResult() + << " Index: " << builtMetaData->getIndex(); + JLOG(j.debug()) + << " Valid:" << " Result: " << validMetaData->getResult() + << " Index: " << validMetaData->getIndex(); } else if (result_diff) { JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different result!"; - JLOG(j.debug()) << " Built:" - << " Result: " << builtMetaData->getResult(); - JLOG(j.debug()) << " Valid:" - << " Result: " << validMetaData->getResult(); + JLOG(j.debug()) + << " Built:" << " Result: " << builtMetaData->getResult(); + JLOG(j.debug()) + << " Valid:" << " Result: " << validMetaData->getResult(); } else if (index_diff) { JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different index!"; - JLOG(j.debug()) << " Built:" - << " Index: " << builtMetaData->getIndex(); - JLOG(j.debug()) << " Valid:" - << " Index: " << validMetaData->getIndex(); + JLOG(j.debug()) + << " Built:" << " Index: " << builtMetaData->getIndex(); + JLOG(j.debug()) + << " Valid:" << " Index: " << validMetaData->getIndex(); } } else @@ -246,12 +246,12 @@ log_metadata_difference( JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different result and nodes!"; JLOG(j.debug()) - << " Built:" - << " Result: " << builtMetaData->getResult() << " Nodes:\n" + << " Built:" << " Result: " << builtMetaData->getResult() + << " Nodes:\n" << builtNodes.getJson(JsonOptions::none); JLOG(j.debug()) - << " Valid:" - << " Result: " << validMetaData->getResult() << " Nodes:\n" + << " Valid:" << " Result: " << validMetaData->getResult() + << " Nodes:\n" << validNodes.getJson(JsonOptions::none); } else if (index_diff) @@ -259,23 +259,21 @@ log_metadata_difference( JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different index and nodes!"; JLOG(j.debug()) - << " Built:" - << " Index: " << builtMetaData->getIndex() << " Nodes:\n" + << " Built:" << " Index: " << builtMetaData->getIndex() + << " Nodes:\n" << builtNodes.getJson(JsonOptions::none); JLOG(j.debug()) - << " Valid:" - << " Index: " << validMetaData->getIndex() << " Nodes:\n" + << " Valid:" << " Index: " << validMetaData->getIndex() + << " Nodes:\n" << validNodes.getJson(JsonOptions::none); } else // nodes_diff { JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different nodes!"; - JLOG(j.debug()) << " Built:" - << " Nodes:\n" + JLOG(j.debug()) << " Built:" << " Nodes:\n" << builtNodes.getJson(JsonOptions::none); - JLOG(j.debug()) << " Valid:" - << " Nodes:\n" + JLOG(j.debug()) << " Valid:" << " Nodes:\n" << validNodes.getJson(JsonOptions::none); } } @@ -330,10 +328,10 @@ LedgerHistory::handleMismatch( if (!builtLedger || !validLedger) { - JLOG(j_.error()) << "MISMATCH cannot be analyzed:" - << " builtLedger: " << to_string(built) << " -> " - << builtLedger << " validLedger: " << to_string(valid) - << " -> " << validLedger; + JLOG(j_.error()) << "MISMATCH cannot be analyzed:" << " builtLedger: " + << to_string(built) << " -> " << builtLedger + << " validLedger: " << to_string(valid) << " -> " + << validLedger; return; } diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp index 9d677dbe5a1..f70e54f8cd4 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp @@ -100,8 +100,8 @@ TimeoutCounter::invokeOnTimer() if (!progress_) { ++timeouts_; - JLOG(journal_.debug()) << "Timeout(" << timeouts_ << ") " - << " acquiring " << hash_; + JLOG(journal_.debug()) + << "Timeout(" << timeouts_ << ") " << " acquiring " << hash_; onTimer(false, sl); } else diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index 89c3d813caa..5a231dfc9e6 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -447,8 +447,8 @@ GRPCServerImpl::handleRpcs() if (!ok) { - JLOG(journal_.debug()) << "Request listener cancelled. " - << "Destroying object"; + JLOG(journal_.debug()) + << "Request listener cancelled. " << "Destroying object"; erase(ptr); } else diff --git a/src/xrpld/app/misc/AMMHelpers.h b/src/xrpld/app/misc/AMMHelpers.h index 8bf5a5c5f12..7ad0093a2e4 100644 --- a/src/xrpld/app/misc/AMMHelpers.h +++ b/src/xrpld/app/misc/AMMHelpers.h @@ -385,9 +385,9 @@ changeSpotPriceQuality( { JLOG(j.error()) << "changeSpotPriceQuality failed: " << to_string(pool.in) - << " " << to_string(pool.out) << " " - << " " << quality << " " << tfee << " " - << to_string(amounts.in) << " " << to_string(amounts.out); + << " " << to_string(pool.out) << " " << " " << quality + << " " << tfee << " " << to_string(amounts.in) << " " + << to_string(amounts.out); Throw("changeSpotPriceQuality failed"); } else diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 02eb0435b57..a95afd56933 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -3177,8 +3177,8 @@ NetworkOPsImp::pubAccountTransaction( } JLOG(m_journal.trace()) - << "pubAccountTransaction: " - << "proposed=" << iProposed << ", accepted=" << iAccepted; + << "pubAccountTransaction: " << "proposed=" << iProposed + << ", accepted=" << iAccepted; if (!notify.empty() || !accountHistoryNotify.empty()) { diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index 159a700cc3f..a4e62b382a7 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -1485,11 +1485,11 @@ TxQ::accept(Application& app, OpenView& view) } else { - JLOG(j_.debug()) << "Queued transaction " << candidateIter->txID - << " failed with " << transToken(txnResult) - << ". Leave in queue." - << " Applied: " << didApply - << ". Flags: " << candidateIter->flags; + JLOG(j_.debug()) + << "Queued transaction " << candidateIter->txID + << " failed with " << transToken(txnResult) + << ". Leave in queue." << " Applied: " << didApply + << ". Flags: " << candidateIter->flags; if (account.retryPenalty && candidateIter->retriesRemaining > 2) candidateIter->retriesRemaining = 1; else diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index d7c025ab4c9..8cdda0dcf31 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -717,8 +717,7 @@ ValidatorList::sendValidatorList( beast::Journal j) { std::size_t const messageVersion = - peer.supportsFeature(ProtocolFeature::ValidatorList2Propagation) - ? 2 + peer.supportsFeature(ProtocolFeature::ValidatorList2Propagation) ? 2 : peer.supportsFeature(ProtocolFeature::ValidatorListPropagation) ? 1 : 0; if (!messageVersion) diff --git a/src/xrpld/app/paths/Pathfinder.cpp b/src/xrpld/app/paths/Pathfinder.cpp index 885a8ae9b47..a2c1be4cc7c 100644 --- a/src/xrpld/app/paths/Pathfinder.cpp +++ b/src/xrpld/app/paths/Pathfinder.cpp @@ -233,8 +233,7 @@ Pathfinder::findPaths( mSource = STPathElement(account, mSrcCurrency, issuer); auto issuerString = mSrcIssuer ? to_string(*mSrcIssuer) : std::string("none"); - JLOG(j_.trace()) << "findPaths>" - << " mSrcAccount=" << mSrcAccount + JLOG(j_.trace()) << "findPaths>" << " mSrcAccount=" << mSrcAccount << " mDstAccount=" << mDstAccount << " mDstAmount=" << mDstAmount.getFullText() << " mSrcCurrency=" << mSrcCurrency diff --git a/src/xrpld/app/paths/detail/BookStep.cpp b/src/xrpld/app/paths/detail/BookStep.cpp index 96971a516fc..b22102119df 100644 --- a/src/xrpld/app/paths/detail/BookStep.cpp +++ b/src/xrpld/app/paths/detail/BookStep.cpp @@ -188,8 +188,7 @@ class BookStep : public StepImp> logStringImpl(char const* name) const { std::ostringstream ostr; - ostr << name << ": " - << "\ninIss: " << book_.in.account + ostr << name << ": " << "\ninIss: " << book_.in.account << "\noutIss: " << book_.out.account << "\ninCur: " << book_.in.currency << "\noutCur: " << book_.out.currency; diff --git a/src/xrpld/app/paths/detail/DirectStep.cpp b/src/xrpld/app/paths/detail/DirectStep.cpp index 25e78e9c47e..7df06751140 100644 --- a/src/xrpld/app/paths/detail/DirectStep.cpp +++ b/src/xrpld/app/paths/detail/DirectStep.cpp @@ -204,8 +204,7 @@ class DirectStepI : public StepImp> logStringImpl(char const* name) const { std::ostringstream ostr; - ostr << name << ": " - << "\nSrc: " << src_ << "\nDst: " << dst_; + ostr << name << ": " << "\nSrc: " << src_ << "\nDst: " << dst_; return ostr.str(); } @@ -236,7 +235,8 @@ class DirectIPaymentStep : public DirectStepI using DirectStepI::DirectStepI; using DirectStepI::check; - bool verifyPrevStepDebtDirection(DebtDirection) const + bool + verifyPrevStepDebtDirection(DebtDirection) const { // A payment doesn't care whether or not prevStepRedeems. return true; diff --git a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp index ac88152c9dd..ac178cbe2f2 100644 --- a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp @@ -132,8 +132,7 @@ class XRPEndpointStep logStringImpl(char const* name) const { std::ostringstream ostr; - ostr << name << ": " - << "\nAcc: " << acc_; + ostr << name << ": " << "\nAcc: " << acc_; return ostr.str(); } diff --git a/src/xrpld/app/rdb/RelationalDatabase.h b/src/xrpld/app/rdb/RelationalDatabase.h index 00e236f20db..5b06aa24d0e 100644 --- a/src/xrpld/app/rdb/RelationalDatabase.h +++ b/src/xrpld/app/rdb/RelationalDatabase.h @@ -237,8 +237,8 @@ rangeCheckedCast(C c) /* This should never happen */ assert(0); JLOG(debugLog().error()) - << "rangeCheckedCast domain error:" - << " value = " << c << " min = " << std::numeric_limits::lowest() + << "rangeCheckedCast domain error:" << " value = " << c + << " min = " << std::numeric_limits::lowest() << " max: " << std::numeric_limits::max(); } diff --git a/src/xrpld/app/tx/detail/CancelOffer.cpp b/src/xrpld/app/tx/detail/CancelOffer.cpp index 11b07f06df3..30e955a8282 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.cpp +++ b/src/xrpld/app/tx/detail/CancelOffer.cpp @@ -34,8 +34,8 @@ CancelOffer::preflight(PreflightContext const& ctx) if (uTxFlags & tfUniversalMask) { - JLOG(ctx.j.trace()) << "Malformed transaction: " - << "Invalid flags set."; + JLOG(ctx.j.trace()) + << "Malformed transaction: " << "Invalid flags set."; return temINVALID_FLAG; } @@ -62,8 +62,8 @@ CancelOffer::preclaim(PreclaimContext const& ctx) if ((*sle)[sfSequence] <= offerSequence) { - JLOG(ctx.j.trace()) << "Malformed transaction: " - << "Sequence " << offerSequence << " is invalid."; + JLOG(ctx.j.trace()) << "Malformed transaction: " << "Sequence " + << offerSequence << " is invalid."; return temBAD_SEQUENCE; } diff --git a/src/xrpld/app/tx/detail/Payment.cpp b/src/xrpld/app/tx/detail/Payment.cpp index 309e9d4a498..46a76bffc28 100644 --- a/src/xrpld/app/tx/detail/Payment.cpp +++ b/src/xrpld/app/tx/detail/Payment.cpp @@ -56,8 +56,7 @@ Payment::preflight(PreflightContext const& ctx) if (uTxFlags & tfPaymentMask) { - JLOG(j.trace()) << "Malformed transaction: " - << "Invalid flags set."; + JLOG(j.trace()) << "Malformed transaction: " << "Invalid flags set."; return temINVALID_FLAG; } @@ -102,20 +101,19 @@ Payment::preflight(PreflightContext const& ctx) } if (bMax && maxSourceAmount <= beast::zero) { - JLOG(j.trace()) << "Malformed transaction: " - << "bad max amount: " << maxSourceAmount.getFullText(); + JLOG(j.trace()) << "Malformed transaction: " << "bad max amount: " + << maxSourceAmount.getFullText(); return temBAD_AMOUNT; } if (saDstAmount <= beast::zero) { - JLOG(j.trace()) << "Malformed transaction: " - << "bad dst amount: " << saDstAmount.getFullText(); + JLOG(j.trace()) << "Malformed transaction: " << "bad dst amount: " + << saDstAmount.getFullText(); return temBAD_AMOUNT; } if (badCurrency() == uSrcCurrency || badCurrency() == uDstCurrency) { - JLOG(j.trace()) << "Malformed transaction: " - << "Bad currency."; + JLOG(j.trace()) << "Malformed transaction: " << "Bad currency."; return temBAD_CURRENCY; } if (account == uDstAccountID && uSrcCurrency == uDstCurrency && !bPaths) @@ -445,8 +443,8 @@ Payment::doApply() { // Vote no. However the transaction might succeed, if applied in // a different order. - JLOG(j_.trace()) << "Delay transaction: Insufficient funds: " - << " " << to_string(mPriorBalance) << " / " + JLOG(j_.trace()) << "Delay transaction: Insufficient funds: " << " " + << to_string(mPriorBalance) << " / " << to_string(saDstAmount.xrp() + mmm) << " (" << to_string(reserve) << ")"; diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index 18e11415c0a..7ea024ee6dc 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -226,9 +226,9 @@ Transactor::checkFee(PreclaimContext const& ctx, XRPAmount baseFee) if (balance < feePaid) { - JLOG(ctx.j.trace()) << "Insufficient balance:" - << " balance=" << to_string(balance) - << " paid=" << to_string(feePaid); + JLOG(ctx.j.trace()) + << "Insufficient balance:" << " balance=" << to_string(balance) + << " paid=" << to_string(feePaid); if ((balance > beast::zero) && !ctx.view.open()) { diff --git a/src/xrpld/conditions/detail/PreimageSha256.h b/src/xrpld/conditions/detail/PreimageSha256.h index c0eca96b066..5185ded7a67 100644 --- a/src/xrpld/conditions/detail/PreimageSha256.h +++ b/src/xrpld/conditions/detail/PreimageSha256.h @@ -137,7 +137,8 @@ class PreimageSha256 final : public Fulfillment return {type(), cost(), fingerprint()}; } - bool validate(Slice) const override + bool + validate(Slice) const override { // Perhaps counterintuitively, the message isn't // relevant. diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index fd3560b1744..06c12b4f150 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -1060,8 +1060,7 @@ Consensus::checkLedger() { JLOG(j_.warn()) << "View of consensus changed during " << to_string(phase_) << " status=" << to_string(phase_) - << ", " - << " mode=" << to_string(mode_.get()); + << ", " << " mode=" << to_string(mode_.get()); JLOG(j_.warn()) << prevLedgerID_ << " to " << netLgr; JLOG(j_.warn()) << Json::Compact{previousLedger_.getJson()}; JLOG(j_.debug()) << "State on consensus change " @@ -1164,8 +1163,7 @@ Consensus::shouldPause() const << "roundTime: " << result_->roundTime.read().count() << ", " << "max consensus time: " << parms.ledgerMAX_CONSENSUS.count() << ", " << "validators: " << totalValidators << ", " - << "laggards: " << laggards << ", " - << "offline: " << offline << ", " + << "laggards: " << laggards << ", " << "offline: " << offline << ", " << "quorum: " << quorum << ")"; if (!ahead || !laggards || !totalValidators || !adaptor_.validator() || @@ -1491,8 +1489,8 @@ Consensus::updateOurPositions() if (!haveCloseTimeConsensus_) { JLOG(j_.debug()) - << "No CT consensus:" - << " Proposers:" << currPeerPositions_.size() + << "No CT consensus:" << " Proposers:" + << currPeerPositions_.size() << " Mode:" << to_string(mode_.get()) << " Thresh:" << threshConsensus << " Pos:" << consensusCloseTime.time_since_epoch().count(); diff --git a/src/xrpld/consensus/Validations.h b/src/xrpld/consensus/Validations.h index ed07858d321..a1171effb56 100644 --- a/src/xrpld/consensus/Validations.h +++ b/src/xrpld/consensus/Validations.h @@ -482,8 +482,7 @@ class Validations withTrie(std::lock_guard const& lock, F&& f) { // Call current to flush any stale validations - current( - lock, [](auto) {}, [](auto, auto) {}); + current(lock, [](auto) {}, [](auto, auto) {}); checkAcquired(lock); return f(trie_); } diff --git a/src/xrpld/core/DatabaseCon.h b/src/xrpld/core/DatabaseCon.h index 935147815ca..c8c40dec662 100644 --- a/src/xrpld/core/DatabaseCon.h +++ b/src/xrpld/core/DatabaseCon.h @@ -73,7 +73,8 @@ class LockedSociSession { return session_.get(); } - explicit operator bool() const + explicit + operator bool() const { return bool(session_); } diff --git a/src/xrpld/ledger/detail/View.cpp b/src/xrpld/ledger/detail/View.cpp index 13ac07e5e74..55baeadff66 100644 --- a/src/xrpld/ledger/detail/View.cpp +++ b/src/xrpld/ledger/detail/View.cpp @@ -259,8 +259,7 @@ accountHolds( } amount.setIssuer(issuer); } - JLOG(j.trace()) << "accountHolds:" - << " account=" << to_string(account) + JLOG(j.trace()) << "accountHolds:" << " account=" << to_string(account) << " amount=" << amount.getFullText(); return view.balanceHook(account, issuer, amount); @@ -369,8 +368,7 @@ xrpLiquid( STAmount const amount = (balance < reserve) ? STAmount{0} : balance - reserve; - JLOG(j.trace()) << "accountHolds:" - << " account=" << to_string(id) + JLOG(j.trace()) << "accountHolds:" << " account=" << to_string(id) << " amount=" << amount.getFullText() << " fullBalance=" << fullBalance.getFullText() << " balance=" << balance.getFullText() diff --git a/src/xrpld/nodestore/detail/DatabaseNodeImp.h b/src/xrpld/nodestore/detail/DatabaseNodeImp.h index b8a9a3fa2b4..326db38a661 100644 --- a/src/xrpld/nodestore/detail/DatabaseNodeImp.h +++ b/src/xrpld/nodestore/detail/DatabaseNodeImp.h @@ -106,7 +106,8 @@ class DatabaseNodeImp : public Database store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t) override; - bool isSameDB(std::uint32_t, std::uint32_t) override + bool + isSameDB(std::uint32_t, std::uint32_t) override { // only one database return true; diff --git a/src/xrpld/nodestore/detail/DatabaseRotatingImp.h b/src/xrpld/nodestore/detail/DatabaseRotatingImp.h index 0c17dc59ceb..5183aa1e2e4 100644 --- a/src/xrpld/nodestore/detail/DatabaseRotatingImp.h +++ b/src/xrpld/nodestore/detail/DatabaseRotatingImp.h @@ -62,7 +62,8 @@ class DatabaseRotatingImp : public DatabaseRotating void importDatabase(Database& source) override; - bool isSameDB(std::uint32_t, std::uint32_t) override + bool + isSameDB(std::uint32_t, std::uint32_t) override { // rotating store acts as one logical database return true; diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 308a4e8b284..4f5f1470f8e 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -591,7 +591,7 @@ PeerImp::fail(std::string const& reason) return post( strand_, std::bind( - (void (Peer::*)(std::string const&)) & PeerImp::fail, + (void(Peer::*)(std::string const&)) & PeerImp::fail, shared_from_this(), reason)); if (journal_.active(beast::severities::kWarning) && socket_.is_open()) @@ -1226,8 +1226,8 @@ PeerImp::handleTransaction( { // If we've never been in synch, there's nothing we can do // with a transaction - JLOG(p_journal_.debug()) << "Ignoring incoming transaction: " - << "Need network ledger"; + JLOG(p_journal_.debug()) + << "Ignoring incoming transaction: " << "Need network ledger"; return; } diff --git a/src/xrpld/overlay/detail/ProtocolVersion.cpp b/src/xrpld/overlay/detail/ProtocolVersion.cpp index bd2effa6341..0fecb301f7f 100644 --- a/src/xrpld/overlay/detail/ProtocolVersion.cpp +++ b/src/xrpld/overlay/detail/ProtocolVersion.cpp @@ -45,7 +45,7 @@ constexpr ProtocolVersion const supportedProtocolList[] // ascending order and doesn't contain any duplicates. // FIXME: With C++20 we can use std::is_sorted with an appropriate comparator static_assert( - []() constexpr->bool { + []() constexpr -> bool { auto const len = std::distance( std::begin(supportedProtocolList), std::end(supportedProtocolList)); diff --git a/src/xrpld/peerfinder/detail/Logic.h b/src/xrpld/peerfinder/detail/Logic.h index 0403530ecf2..3bfb9942c3a 100644 --- a/src/xrpld/peerfinder/detail/Logic.h +++ b/src/xrpld/peerfinder/detail/Logic.h @@ -1109,9 +1109,9 @@ class Logic } else { - JLOG(m_journal.error()) << beast::leftw(18) << "Logic failed " - << "'" << source->name() << "' fetch, " - << results.error.message(); + JLOG(m_journal.error()) + << beast::leftw(18) << "Logic failed " << "'" << source->name() + << "' fetch, " << results.error.message(); } } diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index c006111894b..ccf0c12b5ad 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -388,9 +388,9 @@ logDuration( beast::Journal& journal) { using namespace std::chrono_literals; - auto const level = (duration >= 10s) - ? journal.error() - : (duration >= 1s) ? journal.warn() : journal.debug(); + auto const level = (duration >= 10s) ? journal.error() + : (duration >= 1s) ? journal.warn() + : journal.debug(); JLOG(level) << "RPC request processing duration = " << std::chrono::duration_cast( diff --git a/src/xrpld/shamap/detail/TaggedPointer.ipp b/src/xrpld/shamap/detail/TaggedPointer.ipp index 309913c79c0..487b88e3461 100644 --- a/src/xrpld/shamap/detail/TaggedPointer.ipp +++ b/src/xrpld/shamap/detail/TaggedPointer.ipp @@ -55,8 +55,8 @@ constexpr size_t elementSizeBytes = constexpr size_t blockSizeBytes = kilobytes(512); template -constexpr std::array initArrayChunkSizeBytes( - std::index_sequence) +constexpr std::array +initArrayChunkSizeBytes(std::index_sequence) { return std::array{ boundaries[I] * elementSizeBytes..., @@ -66,8 +66,8 @@ constexpr auto arrayChunkSizeBytes = initArrayChunkSizeBytes(std::make_index_sequence{}); template -constexpr std::array initArrayChunksPerBlock( - std::index_sequence) +constexpr std::array +initArrayChunksPerBlock(std::index_sequence) { return std::array{ blockSizeBytes / arrayChunkSizeBytes[I]..., @@ -93,8 +93,8 @@ boundariesIndex(std::uint8_t numChildren) } template -std::array, boundaries.size()> initAllocateArrayFuns( - std::index_sequence) +std::array, boundaries.size()> +initAllocateArrayFuns(std::index_sequence) { return std::array, boundaries.size()>{ boost::singleton_pool< @@ -110,8 +110,8 @@ std::array, boundaries.size()> const allocateArrayFuns = initAllocateArrayFuns(std::make_index_sequence{}); template -std::array, boundaries.size()> initFreeArrayFuns( - std::index_sequence) +std::array, boundaries.size()> +initFreeArrayFuns(std::index_sequence) { return std::array, boundaries.size()>{ static_cast(boost::singleton_pool< @@ -127,8 +127,8 @@ std::array, boundaries.size()> const freeArrayFuns = initFreeArrayFuns(std::make_index_sequence{}); template -std::array, boundaries.size()> initIsFromArrayFuns( - std::index_sequence) +std::array, boundaries.size()> +initIsFromArrayFuns(std::index_sequence) { return std::array, boundaries.size()>{ boost::singleton_pool< diff --git a/src/xrpld/unity/rocksdb.h b/src/xrpld/unity/rocksdb.h index 06ccb116da1..4a71dc4b57f 100644 --- a/src/xrpld/unity/rocksdb.h +++ b/src/xrpld/unity/rocksdb.h @@ -21,7 +21,7 @@ #define RIPPLE_UNITY_ROCKSDB_H_INCLUDED #if RIPPLE_ROCKSDB_AVAILABLE -//#include +// #include #include #include #include