From 052bb02c07a161ce683a5bfca0db90e32ee9ab7e Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 10 Jun 2026 22:52:20 -0400 Subject: [PATCH] roll back unrelated clang-tidy changes --- include/xrpl/basics/Buffer.h | 2 +- include/xrpl/basics/LocalValue.h | 2 +- include/xrpl/basics/RangeSet.h | 2 +- include/xrpl/basics/TaggedCache.h | 8 ++-- include/xrpl/basics/TaggedCache.ipp | 2 +- .../detail/aged_unordered_container.h | 6 +-- include/xrpl/beast/core/LexicalCast.h | 2 +- include/xrpl/beast/core/LockFreeStack.h | 2 +- include/xrpl/beast/rfc2616.h | 4 +- include/xrpl/beast/unit_test/reporter.h | 10 ++-- include/xrpl/beast/unit_test/results.h | 8 ++-- include/xrpl/beast/unit_test/suite.h | 2 +- include/xrpl/conditions/Condition.h | 2 +- include/xrpl/core/Coro.ipp | 2 +- include/xrpl/core/HashRouter.h | 32 ++++++++----- include/xrpl/core/JobQueue.h | 4 +- include/xrpl/core/JobTypes.h | 2 +- include/xrpl/core/PeerReservationTable.h | 4 +- include/xrpl/ledger/AmendmentTable.h | 4 +- include/xrpl/ledger/ApplyView.h | 2 +- include/xrpl/ledger/BookListeners.h | 2 +- include/xrpl/ledger/CachedView.h | 2 +- include/xrpl/ledger/CanonicalTXSet.h | 2 +- include/xrpl/ledger/OpenView.h | 30 ++++++------ include/xrpl/ledger/PaymentSandbox.h | 8 ++-- include/xrpl/ledger/ReadView.h | 4 +- include/xrpl/ledger/detail/ApplyStateTable.h | 2 +- include/xrpl/ledger/detail/RawStateTable.h | 4 +- include/xrpl/nodestore/Database.h | 2 +- include/xrpl/protocol/Asset.h | 20 ++++---- include/xrpl/protocol/Book.h | 10 ++-- include/xrpl/protocol/LedgerHeader.h | 4 +- include/xrpl/protocol/MPTIssue.h | 2 +- include/xrpl/protocol/MultiApiJson.h | 8 +++- include/xrpl/protocol/PathAsset.h | 8 ++-- include/xrpl/protocol/SOTemplate.h | 4 +- include/xrpl/protocol/STAmount.h | 4 +- include/xrpl/protocol/STArray.h | 4 +- include/xrpl/protocol/STIssue.h | 6 +-- include/xrpl/protocol/STPathSet.h | 4 +- include/xrpl/protocol/STTx.h | 46 +++++++++---------- include/xrpl/protocol/STValidation.h | 28 +++++------ include/xrpl/protocol/STVector256.h | 2 +- include/xrpl/protocol/Serializer.h | 12 ++--- include/xrpl/protocol/XChainAttestations.h | 2 +- include/xrpl/protocol/digest.h | 2 +- include/xrpl/protocol/json_get_or_throw.h | 4 +- include/xrpl/rdb/RelationalDatabase.h | 2 +- include/xrpl/rdb/SociDB.h | 2 +- include/xrpl/resource/Gossip.h | 2 +- include/xrpl/server/Manifest.h | 4 +- include/xrpl/server/Port.h | 20 ++++---- include/xrpl/server/detail/BaseHTTPPeer.h | 12 ++--- include/xrpl/server/detail/BasePeer.h | 2 +- include/xrpl/server/detail/BaseWSPeer.h | 8 ++-- include/xrpl/server/detail/Door.h | 12 ++--- include/xrpl/server/detail/PlainHTTPPeer.h | 2 +- include/xrpl/server/detail/PlainWSPeer.h | 2 +- include/xrpl/server/detail/SSLHTTPPeer.h | 2 +- include/xrpl/server/detail/SSLWSPeer.h | 4 +- include/xrpl/server/detail/ServerImpl.h | 6 +-- include/xrpl/server/detail/io_list.h | 6 +-- include/xrpl/shamap/FullBelowCache.h | 2 +- include/xrpl/shamap/SHAMap.h | 12 ++--- include/xrpl/tx/applySteps.h | 6 +-- .../xrpl/tx/invariants/DirectoryInvariant.h | 2 +- include/xrpl/tx/invariants/FreezeInvariant.h | 10 ++-- include/xrpl/tx/invariants/InvariantCheck.h | 12 ++--- .../xrpl/tx/invariants/LoanBrokerInvariant.h | 8 ++-- include/xrpl/tx/invariants/LoanInvariant.h | 2 +- include/xrpl/tx/invariants/MPTInvariant.h | 8 ++-- .../tx/invariants/PermissionedDEXInvariant.h | 2 +- .../invariants/PermissionedDomainInvariant.h | 2 +- include/xrpl/tx/invariants/VaultInvariant.h | 28 +++++------ include/xrpl/tx/paths/detail/Steps.h | 4 +- .../tx/transactors/account/SignerListSet.h | 6 +-- src/test/app/PermissionedDEX_test.cpp | 15 ++++-- src/test/jtx/AMM.h | 4 +- src/test/jtx/Env.h | 10 ++-- src/test/jtx/JTx.h | 8 ++-- src/test/jtx/ManualTimeKeeper.h | 2 +- src/test/jtx/TestHelpers.h | 18 ++++++-- src/test/jtx/amount.h | 2 +- src/test/jtx/credentials.h | 2 +- src/test/jtx/multisign.h | 2 +- src/test/jtx/ter.h | 2 +- src/test/unit_test/SuiteJournal.h | 2 +- .../app/consensus/RCLCensorshipDetector.h | 2 +- src/xrpld/app/consensus/RCLConsensus.h | 4 +- src/xrpld/app/consensus/RCLCxLedger.h | 8 ++-- src/xrpld/app/consensus/RCLCxPeerPos.h | 14 +++--- src/xrpld/app/consensus/RCLCxTx.h | 4 +- src/xrpld/consensus/Consensus.h | 22 ++++----- src/xrpld/consensus/ConsensusProposal.h | 18 ++++---- src/xrpld/consensus/ConsensusTypes.h | 6 +-- src/xrpld/consensus/DisputedTx.h | 12 ++--- src/xrpld/consensus/LedgerTrie.h | 16 ++++--- src/xrpld/consensus/Validations.h | 8 ++-- src/xrpld/core/TimeKeeper.h | 6 +-- src/xrpld/overlay/Message.h | 4 +- 100 files changed, 373 insertions(+), 336 deletions(-) diff --git a/include/xrpl/basics/Buffer.h b/include/xrpl/basics/Buffer.h index b7af419631..59968a4fa4 100644 --- a/include/xrpl/basics/Buffer.h +++ b/include/xrpl/basics/Buffer.h @@ -15,7 +15,7 @@ namespace xrpl { class Buffer { private: - std::unique_ptr p_{}; + std::unique_ptr p_; std::size_t size_ = 0; public: diff --git a/include/xrpl/basics/LocalValue.h b/include/xrpl/basics/LocalValue.h index cd834470e5..1c2a657a18 100644 --- a/include/xrpl/basics/LocalValue.h +++ b/include/xrpl/basics/LocalValue.h @@ -41,7 +41,7 @@ struct LocalValues }; // Keys are the address of a LocalValue. - std::unordered_map> values{}; + std::unordered_map> values; static void cleanup(LocalValues* lvs) diff --git a/include/xrpl/basics/RangeSet.h b/include/xrpl/basics/RangeSet.h index 02088e40fd..e1cee8b6c4 100644 --- a/include/xrpl/basics/RangeSet.h +++ b/include/xrpl/basics/RangeSet.h @@ -105,7 +105,7 @@ fromString(RangeSet& rs, std::string const& s) { std::vector intervals; std::vector tokens; - bool const result{true}; + bool result{true}; rs.clear(); boost::split(tokens, s, boost::algorithm::is_any_of(",")); diff --git a/include/xrpl/basics/TaggedCache.h b/include/xrpl/basics/TaggedCache.h index 4797f6d1f4..380b7c687f 100644 --- a/include/xrpl/basics/TaggedCache.h +++ b/include/xrpl/basics/TaggedCache.h @@ -197,7 +197,7 @@ private: class KeyOnlyEntry { public: - clock_type::time_point lastAccess{}; + clock_type::time_point lastAccess; explicit KeyOnlyEntry(clock_type::time_point const& lastAccess) : lastAccess(lastAccess) { @@ -214,7 +214,7 @@ private: { public: shared_weak_combo_pointer_type ptr; - clock_type::time_point lastAccess{}; + clock_type::time_point lastAccess; ValueEntry(clock_type::time_point const& lastAccess, shared_pointer_type const& ptr) : ptr(ptr), lastAccess(lastAccess) @@ -289,11 +289,11 @@ private: int const targetSize_; // Desired maximum cache age - clock_type::duration const targetAge_{}; + clock_type::duration const targetAge_; // Number of items cached int cacheCount_{0}; - cache_type cache_{}; // Hold strong reference to recent objects + cache_type cache_; // Hold strong reference to recent objects std::uint64_t hits_{0}; std::uint64_t misses_{0}; }; diff --git a/include/xrpl/basics/TaggedCache.ipp b/include/xrpl/basics/TaggedCache.ipp index aed5a26702..cee02749c6 100644 --- a/include/xrpl/basics/TaggedCache.ipp +++ b/include/xrpl/basics/TaggedCache.ipp @@ -232,7 +232,7 @@ TaggedCache workers; workers.reserve(cache_.partitions()); - std::atomic const allRemovals = 0; + std::atomic allRemovals = 0; for (std::size_t p = 0; p < cache_.partitions(); ++p) { diff --git a/include/xrpl/beast/container/detail/aged_unordered_container.h b/include/xrpl/beast/container/detail/aged_unordered_container.h index 285016d781..7162c237d6 100644 --- a/include/xrpl/beast/container/detail/aged_unordered_container.h +++ b/include/xrpl/beast/container/detail/aged_unordered_container.h @@ -119,7 +119,7 @@ private: { } - value_type value{}; + value_type value; time_point when; }; @@ -493,7 +493,7 @@ private: private: float maxLoadFactor_; - vec_type vec{}; + vec_type vec_; }; template @@ -1446,7 +1446,7 @@ private: private: ConfigT config_; Buckets buck_; - cont_type mutable cont_{}; + cont_type mutable cont_; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/beast/core/LexicalCast.h b/include/xrpl/beast/core/LexicalCast.h index 20b44ea2db..18e63c9c10 100644 --- a/include/xrpl/beast/core/LexicalCast.h +++ b/include/xrpl/beast/core/LexicalCast.h @@ -72,7 +72,7 @@ struct LexicalCast bool operator()(bool& out, std::string_view in) const { - std::string const result; + std::string result; // Convert the input to lowercase std::transform(in.begin(), in.end(), std::back_inserter(result), [](auto c) { diff --git a/include/xrpl/beast/core/LockFreeStack.h b/include/xrpl/beast/core/LockFreeStack.h index 77268fd3d4..6b8f686246 100644 --- a/include/xrpl/beast/core/LockFreeStack.h +++ b/include/xrpl/beast/core/LockFreeStack.h @@ -58,7 +58,7 @@ public: return result; } - [[nodiscard]] NodePtr + NodePtr node() const { return node_; diff --git a/include/xrpl/beast/rfc2616.h b/include/xrpl/beast/rfc2616.h index 793a4d53ae..cf80bd26c0 100644 --- a/include/xrpl/beast/rfc2616.h +++ b/include/xrpl/beast/rfc2616.h @@ -200,8 +200,8 @@ class ListIterator { using iter_type = boost::string_ref::const_iterator; - iter_type it_{}; - iter_type end_{}; + iter_type it_; + iter_type end_; boost::string_ref value_; public: diff --git a/include/xrpl/beast/unit_test/reporter.h b/include/xrpl/beast/unit_test/reporter.h index 9b167c8f79..1fdbb451a6 100644 --- a/include/xrpl/beast/unit_test/reporter.h +++ b/include/xrpl/beast/unit_test/reporter.h @@ -18,7 +18,9 @@ #include #include -namespace beast::unit_test::detail { +namespace beast::unit_test { + +namespace detail { /** A simple test runner that writes everything to a stream in real time. The totals are output when the object is destroyed. @@ -66,7 +68,7 @@ private: std::size_t cases = 0; std::size_t total = 0; std::size_t failed = 0; - std::vector top{}; + std::vector top; typename clock_type::time_point start = clock_type::now(); void @@ -244,6 +246,8 @@ Reporter::onLog(std::string const& s) os_ << s; } -} // namespace beast::unit_test::detail +} // namespace detail using reporter = detail::Reporter<>; + +} // namespace beast::unit_test diff --git a/include/xrpl/beast/unit_test/results.h b/include/xrpl/beast/unit_test/results.h index 7e188fbc2d..02aa9730d1 100644 --- a/include/xrpl/beast/unit_test/results.h +++ b/include/xrpl/beast/unit_test/results.h @@ -41,8 +41,8 @@ private: TestsT() = default; /** Returns the total number of test conditions. */ - static [[nodiscard]] std::size_t - total() + [[nodiscard]] std::size_t + total() const { return cont().size(); } @@ -55,7 +55,7 @@ private: } /** Register a successful test condition. */ - static void + void pass() { cont().emplace_back(true); @@ -74,7 +74,7 @@ private: { public: /** Insert a string into the log. */ - static void + void insert(std::string const& s) { cont().push_back(s); diff --git a/include/xrpl/beast/unit_test/suite.h b/include/xrpl/beast/unit_test/suite.h index 8da4a2b1d8..fded866da0 100644 --- a/include/xrpl/beast/unit_test/suite.h +++ b/include/xrpl/beast/unit_test/suite.h @@ -143,7 +143,7 @@ public: Text sent to the log output stream will be forwarded to the output stream associated with the runner. */ - LogOs log{}; + LogOs log; /** Memberspace for declaring test cases. */ TestcaseT testcase; diff --git a/include/xrpl/conditions/Condition.h b/include/xrpl/conditions/Condition.h index 8897fb94e8..66d1d24736 100644 --- a/include/xrpl/conditions/Condition.h +++ b/include/xrpl/conditions/Condition.h @@ -56,7 +56,7 @@ public: std::uint32_t cost; /** For compound conditions, set of conditions includes */ - std::set subtypes{}; + std::set subtypes; Condition(Type t, std::uint32_t c, Slice fp) : type(t), fingerprint(fp), cost(c) { diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index 088964e599..133caf37a9 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -127,7 +127,7 @@ JobQueue::Coro::expectEarlyExit() inline void JobQueue::Coro::join() { - std::unique_lock const lk(mutexRun_); + std::unique_lock lk(mutexRun_); cv_.wait(lk, [this]() { return !running_; }); } diff --git a/include/xrpl/core/HashRouter.h b/include/xrpl/core/HashRouter.h index 18a5ab9f1a..d36b8aee6e 100644 --- a/include/xrpl/core/HashRouter.h +++ b/include/xrpl/core/HashRouter.h @@ -32,7 +32,9 @@ enum class HashRouterFlags : std::uint16_t { constexpr HashRouterFlags operator|(HashRouterFlags lhs, HashRouterFlags rhs) { - return (lhs) | static_cast>(rhs); + return static_cast( + static_cast>(lhs) | + static_cast>(rhs)); } constexpr HashRouterFlags& @@ -45,7 +47,9 @@ operator|=(HashRouterFlags& lhs, HashRouterFlags rhs) constexpr HashRouterFlags operator&(HashRouterFlags lhs, HashRouterFlags rhs) { - return (lhs) & static_cast>(rhs); + return static_cast( + static_cast>(lhs) & + static_cast>(rhs)); } constexpr HashRouterFlags& @@ -127,7 +131,7 @@ private: } /** Return set of peers we've relayed to and reset tracking */ - static std::set + std::set releasePeerSet() { return std::move(peers_); @@ -146,25 +150,31 @@ private: If it has, return false. If it has not, update the last relay timestamp and return true. */ - static bool + bool shouldRelay(Stopwatch::time_point const& now, std::chrono::seconds relayTime) { - return !relayed_ && *relayed_ + relayTime > now; + if (relayed_ && *relayed_ + relayTime > now) + return false; + relayed_.emplace(now); + return true; } - static bool + bool shouldProcess(Stopwatch::time_point now, std::chrono::seconds interval) { - return !processed_ && ((*processed_ + interval) > now); + if (processed_ && ((*processed_ + interval) > now)) + return false; + processed_.emplace(now); + return true; } private: HashRouterFlags flags_ = HashRouterFlags::UNDEFINED; - std::set peers_{}; + std::set peers_; // This could be generalized to a map, if more // than one flag needs to expire independently. - std::optional relayed_{}; - std::optional processed_{}; + std::optional relayed_; + std::optional processed_; }; public: @@ -241,7 +251,7 @@ private: // Stores all suppressed hashes and their expiration time beast::aged_unordered_map> - suppressionMap_{}; + suppressionMap_; }; } // namespace xrpl diff --git a/include/xrpl/core/JobQueue.h b/include/xrpl/core/JobQueue.h index feb5bc2f69..fc15e9a064 100644 --- a/include/xrpl/core/JobQueue.h +++ b/include/xrpl/core/JobQueue.h @@ -55,7 +55,7 @@ public: std::mutex mutexRun_; std::condition_variable cv_; boost::coroutines2::coroutine::push_type* yield_{}; - boost::coroutines2::coroutine::pull_type coro_{}; + boost::coroutines2::coroutine::pull_type coro_; #ifndef NDEBUG bool finished_ = false; #endif @@ -112,7 +112,7 @@ public: resume(); /** Returns true if the Coro is still runnable (has not returned). */ - [[nodiscard]] bool + bool runnable() const; /** Once called, the Coro allows early exit without an assert. */ diff --git a/include/xrpl/core/JobTypes.h b/include/xrpl/core/JobTypes.h index 99675daf8a..fb5c7988cb 100644 --- a/include/xrpl/core/JobTypes.h +++ b/include/xrpl/core/JobTypes.h @@ -160,7 +160,7 @@ public: } JobTypeInfo unknown; - Map map{}; + Map map; }; } // namespace xrpl diff --git a/include/xrpl/core/PeerReservationTable.h b/include/xrpl/core/PeerReservationTable.h index 73d8ff40af..a9ab894124 100644 --- a/include/xrpl/core/PeerReservationTable.h +++ b/include/xrpl/core/PeerReservationTable.h @@ -66,7 +66,7 @@ public: std::vector list() const; - static bool + bool contains(PublicKey const& nodeId) { std::scoped_lock const lock(this->mutex_); @@ -95,7 +95,7 @@ private: beast::Journal mutable journal_; std::mutex mutable mutex_; DatabaseCon* connection_{}; - std::unordered_set, KeyEqual> table_{}; + std::unordered_set, KeyEqual> table_; }; } // namespace xrpl diff --git a/include/xrpl/ledger/AmendmentTable.h b/include/xrpl/ledger/AmendmentTable.h index d314c0b16a..8ed3cb81ff 100644 --- a/include/xrpl/ledger/AmendmentTable.h +++ b/include/xrpl/ledger/AmendmentTable.h @@ -128,7 +128,7 @@ public: // implementation. These APIs will merge when the view code // supports a full ledger API - static void + void doVoting( std::shared_ptr const& lastClosedLedger, std::vector> const& parentValidations, @@ -155,7 +155,7 @@ public: obj.setFieldU32(sfFlags, it.second); }); - Serializer const s; + Serializer s; amendTx.add(s); JLOG(j.debug()) << "Amendments: Adding pseudo-transaction: " diff --git a/include/xrpl/ledger/ApplyView.h b/include/xrpl/ledger/ApplyView.h index e80e8f0a5e..362eae0f79 100644 --- a/include/xrpl/ledger/ApplyView.h +++ b/include/xrpl/ledger/ApplyView.h @@ -374,7 +374,7 @@ public: bool dirRemove(Keylet const& directory, std::uint64_t page, uint256 const& key, bool keepRoot); - static bool + bool dirRemove(Keylet const& directory, std::uint64_t page, Keylet const& key, bool keepRoot) { return dirRemove(directory, page, key.key, keepRoot); diff --git a/include/xrpl/ledger/BookListeners.h b/include/xrpl/ledger/BookListeners.h index 87804721cb..3b96aca680 100644 --- a/include/xrpl/ledger/BookListeners.h +++ b/include/xrpl/ledger/BookListeners.h @@ -43,7 +43,7 @@ public: private: std::recursive_mutex lock_; - hash_map listeners_{}; + hash_map listeners_; }; } // namespace xrpl diff --git a/include/xrpl/ledger/CachedView.h b/include/xrpl/ledger/CachedView.h index 18a2e7adc2..462db48ee3 100644 --- a/include/xrpl/ledger/CachedView.h +++ b/include/xrpl/ledger/CachedView.h @@ -17,7 +17,7 @@ private: DigestAwareReadView const& base_; CachedSLEs& cache_; std::mutex mutable mutex_; - std::unordered_map> mutable map_{}; + std::unordered_map> mutable map_; public: CachedViewImpl() = delete; diff --git a/include/xrpl/ledger/CanonicalTXSet.h b/include/xrpl/ledger/CanonicalTXSet.h index 5691ac625c..4dffadd52f 100644 --- a/include/xrpl/ledger/CanonicalTXSet.h +++ b/include/xrpl/ledger/CanonicalTXSet.h @@ -148,7 +148,7 @@ public: } private: - std::map> map_{}; + std::map> map_; // Used to salt the accounts so people can't mine for low account numbers uint256 salt_; diff --git a/include/xrpl/ledger/OpenView.h b/include/xrpl/ledger/OpenView.h index 009f96dea7..4ba2a7759b 100644 --- a/include/xrpl/ledger/OpenView.h +++ b/include/xrpl/ledger/OpenView.h @@ -162,7 +162,7 @@ public: OpenView(ReadView const* base, std::shared_ptr hold = nullptr); /** Returns true if this reflects an open ledger. */ - [[nodiscard]] bool + bool open() const override { return open_; @@ -173,7 +173,7 @@ public: This is used to set the "apply ordinal" when calculating transaction metadata. */ - [[nodiscard]] std::size_t + std::size_t txCount() const; /** Apply changes. */ @@ -182,43 +182,43 @@ public: // ReadView - [[nodiscard]] LedgerHeader const& + LedgerHeader const& header() const override; - [[nodiscard]] Fees const& + Fees const& fees() const override; - [[nodiscard]] Rules const& + Rules const& rules() const override; - [[nodiscard]] bool + bool exists(Keylet const& k) const override; - [[nodiscard]] std::optional + std::optional succ(key_type const& key, std::optional const& last = std::nullopt) const override; - [[nodiscard]] SLE::const_pointer + SLE::const_pointer read(Keylet const& k) const override; - [[nodiscard]] std::unique_ptr + std::unique_ptr slesBegin() const override; - [[nodiscard]] std::unique_ptr + std::unique_ptr slesEnd() const override; - [[nodiscard]] std::unique_ptr + std::unique_ptr slesUpperBound(uint256 const& key) const override; - [[nodiscard]] std::unique_ptr + std::unique_ptr txsBegin() const override; - [[nodiscard]] std::unique_ptr + std::unique_ptr txsEnd() const override; - [[nodiscard]] bool + bool txExists(key_type const& key) const override; - [[nodiscard]] tx_type + tx_type txRead(key_type const& key) const override; // RawView diff --git a/include/xrpl/ledger/PaymentSandbox.h b/include/xrpl/ledger/PaymentSandbox.h index f3b92c69dc..1cd89d9388 100644 --- a/include/xrpl/ledger/PaymentSandbox.h +++ b/include/xrpl/ledger/PaymentSandbox.h @@ -37,7 +37,7 @@ private: struct IssuerValueMPT { IssuerValueMPT() = default; - std::map holders{}; + std::map holders; // Credit to holder std::uint64_t credit = 0; // OutstandingAmount might overflow when MPTs are credited to a holder. @@ -114,9 +114,9 @@ private: static KeyIOU makeKeyIOU(AccountID const& a1, AccountID const& a2, Currency const& currency); - std::map creditsIOU_{}; - std::map creditsMPT_{}; - std::map ownerCounts_{}; + std::map creditsIOU_; + std::map creditsMPT_; + std::map ownerCounts_; }; } // namespace detail diff --git a/include/xrpl/ledger/ReadView.h b/include/xrpl/ledger/ReadView.h index e07285fe8f..f4ee7e6fd2 100644 --- a/include/xrpl/ledger/ReadView.h +++ b/include/xrpl/ledger/ReadView.h @@ -65,7 +65,9 @@ public: ReadView& operator=(ReadView const& other) = delete; - ReadView() : sles(*this), txs(*this) = default; + ReadView() : sles(*this), txs(*this) + { + } ReadView(ReadView const& other) : sles(*this), txs(*this) { diff --git a/include/xrpl/ledger/detail/ApplyStateTable.h b/include/xrpl/ledger/detail/ApplyStateTable.h index 0124b1f112..f40e3d0d1c 100644 --- a/include/xrpl/ledger/detail/ApplyStateTable.h +++ b/include/xrpl/ledger/detail/ApplyStateTable.h @@ -26,7 +26,7 @@ private: using items_t = std::map>; - items_t items_{}; + items_t items_; XRPAmount dropsDestroyed_{0}; public: diff --git a/include/xrpl/ledger/detail/RawStateTable.h b/include/xrpl/ledger/detail/RawStateTable.h index f880e14cf9..d2567e34f1 100644 --- a/include/xrpl/ledger/detail/RawStateTable.h +++ b/include/xrpl/ledger/detail/RawStateTable.h @@ -24,7 +24,7 @@ public: RawStateTable() : monotonicResource_{std::make_unique( kInitialBufferSize)} - , items_{monotonicResource_.get()} = default; + , items_{monotonicResource_.get()} {}; RawStateTable(RawStateTable const& rhs) : monotonicResource_{std::make_unique( @@ -101,7 +101,7 @@ private: boost::container::pmr::polymorphic_allocator>>; // monotonic_resource_ must outlive `items_`. Make a pointer so it may be // easily moved. - std::unique_ptr monotonicResource_{}; + std::unique_ptr monotonicResource_; items_t items_; XRPAmount dropsDestroyed_{0}; diff --git a/include/xrpl/nodestore/Database.h b/include/xrpl/nodestore/Database.h index bd6581292a..68c5dcefb6 100644 --- a/include/xrpl/nodestore/Database.h +++ b/include/xrpl/nodestore/Database.h @@ -217,7 +217,7 @@ protected: // advanced tunable, via the config file. The default value is 4. int const requestBundle_; - static void + void storeStats(std::uint64_t count, std::uint64_t sz) { XRPL_ASSERT(count <= sz, "xrpl::NodeStore::Database::storeStats : valid inputs"); diff --git a/include/xrpl/protocol/Asset.h b/include/xrpl/protocol/Asset.h index b1a5da8be3..ec9d8db02f 100644 --- a/include/xrpl/protocol/Asset.h +++ b/include/xrpl/protocol/Asset.h @@ -89,8 +89,8 @@ public: [[nodiscard]] constexpr value_type const& value() const; - static [[nodiscard]] constexpr token_type - token(); + [[nodiscard]] constexpr token_type + token() const; void setJson(json::Value& jv) const; @@ -111,16 +111,16 @@ public: return detail::visit(issue_, std::forward(visitors)...); } - static [[nodiscard]] constexpr bool - native() + [[nodiscard]] constexpr bool + native() const { return visit( [&](Issue const& issue) { return issue.native(); }, [&](MPTIssue const&) { return false; }); } - static [[nodiscard]] bool - integral() + [[nodiscard]] bool + integral() const { return visit( [&](Issue const& issue) { return issue.native(); }, @@ -192,16 +192,16 @@ Asset::value() const return issue_; } -static constexpr Asset::token_type -Asset::token() +constexpr Asset::token_type +Asset::token() const { return visit( [&](Issue const& issue) -> Asset::token_type { return issue.currency; }, [&](MPTIssue const& issue) -> Asset::token_type { return issue.getMptID(); }); } -static constexpr Asset::AmtType -Asset::getAmountType() +constexpr Asset::AmtType +Asset::getAmountType() const { return visit( [&](Issue const& issue) -> Asset::AmtType { diff --git a/include/xrpl/protocol/Book.h b/include/xrpl/protocol/Book.h index 895c2e4f57..01dc40075b 100644 --- a/include/xrpl/protocol/Book.h +++ b/include/xrpl/protocol/Book.h @@ -103,7 +103,7 @@ public: value_type operator()(argument_type const& value) const { - value_type result(currency_hash_type::member(value.currency)) = 0; + value_type result(currency_hash_type::member(value.currency)); if (!isXRP(value.currency)) boost::hash_combine(result, issuer_hash_type::member(value.account)); return result; @@ -125,7 +125,7 @@ public: value_type operator()(argument_type const& value) const { - value_type const result(id_hash_type::member(value.getMptID())) = 0; + value_type const result(id_hash_type::member(value.getMptID())); return result; } }; @@ -151,11 +151,11 @@ public: { return asset.visit( [&](xrpl::Issue const& issue) { - value_type const result(mIssueHasher_(issue)) = 0; + value_type const result(mIssueHasher_(issue)); return result; }, [&](xrpl::MPTIssue const& issue) { - value_type const result(mMptissueHasher_(issue)) = 0; + value_type const result(mMptissueHasher_(issue)); return result; }); } @@ -182,7 +182,7 @@ public: value_type operator()(argument_type const& value) const { - value_type result(issueHasher_(value.in)) = 0; + value_type result(issueHasher_(value.in)); boost::hash_combine(result, issueHasher_(value.out)); if (value.domain) diff --git a/include/xrpl/protocol/LedgerHeader.h b/include/xrpl/protocol/LedgerHeader.h index cf7f846a91..f05b11d1eb 100644 --- a/include/xrpl/protocol/LedgerHeader.h +++ b/include/xrpl/protocol/LedgerHeader.h @@ -19,7 +19,7 @@ struct LedgerHeader // LedgerIndex seq = 0; - NetClock::time_point parentCloseTime{}; + NetClock::time_point parentCloseTime; // // For closed ledgers @@ -49,7 +49,7 @@ struct LedgerHeader // closed. For open ledgers, the time the ledger // will close if there's no transactions. // - NetClock::time_point closeTime{}; + NetClock::time_point closeTime; }; // ledger close flags diff --git a/include/xrpl/protocol/MPTIssue.h b/include/xrpl/protocol/MPTIssue.h index 029e41e4fd..f55029f50d 100644 --- a/include/xrpl/protocol/MPTIssue.h +++ b/include/xrpl/protocol/MPTIssue.h @@ -12,7 +12,7 @@ namespace xrpl { class MPTIssue { private: - MPTID mptID_{}; + MPTID mptID_; public: MPTIssue() = default; diff --git a/include/xrpl/protocol/MultiApiJson.h b/include/xrpl/protocol/MultiApiJson.h index c1504e3d3f..9a4882ec55 100644 --- a/include/xrpl/protocol/MultiApiJson.h +++ b/include/xrpl/protocol/MultiApiJson.h @@ -11,7 +11,9 @@ #include #include -namespace xrpl::detail { +namespace xrpl { + +namespace detail { template constexpr bool kIsIntegralConstant = false; template @@ -182,8 +184,10 @@ struct MultiApiJson } }; -} // namespace xrpl::detail +} // namespace detail // Wrapper for Json for all supported API versions. using MultiApiJson = detail::MultiApiJson; + +} // namespace xrpl diff --git a/include/xrpl/protocol/PathAsset.h b/include/xrpl/protocol/PathAsset.h index 3a727e0f7f..b51dc52b47 100644 --- a/include/xrpl/protocol/PathAsset.h +++ b/include/xrpl/protocol/PathAsset.h @@ -10,7 +10,7 @@ namespace xrpl { class PathAsset { private: - std::variant easset_{}; + std::variant easset_; public: PathAsset() = default; @@ -27,8 +27,8 @@ public: [[nodiscard]] constexpr bool holds() const; - static [[nodiscard]] constexpr bool - isXRP(); + [[nodiscard]] constexpr bool + isXRP() const; template T const& @@ -87,7 +87,7 @@ PathAsset::value() const } constexpr bool -PathAsset::isXRP() +PathAsset::isXRP() const { return visit( [&](Currency const& currency) { return xrpl::isXRP(currency); }, diff --git a/include/xrpl/protocol/SOTemplate.h b/include/xrpl/protocol/SOTemplate.h index 338b7d60bf..72e0573d29 100644 --- a/include/xrpl/protocol/SOTemplate.h +++ b/include/xrpl/protocol/SOTemplate.h @@ -38,8 +38,8 @@ class SOElement SOETxMPTIssue supportMpt_ = SoeMptNone; private: - static void - init(SField const& fieldName) + void + init(SField const& fieldName) const { if (!sField_.get().isUseful()) { diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 62d5c57226..1a5b442d8b 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -556,12 +556,12 @@ STAmount::fromNumber(A const& a, Number const& number) if (asset.integral()) { std::uint64_t const intValue = static_cast(working); - return STAmount{asset, static_cast(intValue), 0, negative}; + return STAmount{asset, intValue, 0, negative}; } auto const [mantissa, exponent] = working.normalizeToRange(); - return STAmount{asset, static_cast(mantissa), exponent, negative}; + return STAmount{asset, mantissa, exponent, negative}; } inline void diff --git a/include/xrpl/protocol/STArray.h b/include/xrpl/protocol/STArray.h index 53ec88280b..61753c52dc 100644 --- a/include/xrpl/protocol/STArray.h +++ b/include/xrpl/protocol/STArray.h @@ -10,7 +10,7 @@ class STArray final : public STBase, public CountedObject private: using list_type = std::vector; - list_type v_{}; + list_type v_; public: using value_type = STObject; @@ -74,7 +74,7 @@ public: pushBack(object); } - static void + void // NOLINTNEXTLINE(readability-identifier-naming) push_back(STObject&& object) { diff --git a/include/xrpl/protocol/STIssue.h b/include/xrpl/protocol/STIssue.h index 88065d03cb..f5e1f61168 100644 --- a/include/xrpl/protocol/STIssue.h +++ b/include/xrpl/protocol/STIssue.h @@ -40,8 +40,8 @@ public: [[nodiscard]] value_type const& value() const noexcept; - static void - setIssue(Asset const& issue) const; + void + setIssue(Asset const& issue); [[nodiscard]] SerializedTypeID getSType() const override; @@ -114,7 +114,7 @@ STIssue::value() const noexcept } inline void -STIssue::setIssue(Asset const& asset) const +STIssue::setIssue(Asset const& asset) { if (holds() && !isConsistent(asset_.get())) Throw("Invalid asset: currency and account native mismatch"); diff --git a/include/xrpl/protocol/STPathSet.h b/include/xrpl/protocol/STPathSet.h index 3348c34b5e..1508dcb727 100644 --- a/include/xrpl/protocol/STPathSet.h +++ b/include/xrpl/protocol/STPathSet.h @@ -118,7 +118,7 @@ private: class STPath final : public CountedObject { - std::vector path_{}; + std::vector path_; public: STPath() = default; @@ -173,7 +173,7 @@ public: // A set of zero or more payment paths class STPathSet final : public STBase, public CountedObject { - std::vector value_{}; + std::vector value_; public: STPathSet() = default; diff --git a/include/xrpl/protocol/STTx.h b/include/xrpl/protocol/STTx.h index 07cc20ee5c..659fede31d 100644 --- a/include/xrpl/protocol/STTx.h +++ b/include/xrpl/protocol/STTx.h @@ -51,51 +51,51 @@ public: STTx(TxType type, std::function assembler); // STObject functions. - [[nodiscard]] SerializedTypeID + SerializedTypeID getSType() const override; - [[nodiscard]] std::string + std::string getFullText() const override; // Outer transaction functions / signature functions. static Blob getSignature(STObject const& sigObject); - [[nodiscard]] Blob + Blob getSignature() const { return getSignature(*this); } - [[nodiscard]] uint256 + uint256 getSigningHash() const; - [[nodiscard]] TxType + TxType getTxnType() const; - [[nodiscard]] Blob + Blob getSigningPubKey() const; - [[nodiscard]] SeqProxy + SeqProxy getSeqProxy() const; /** Returns the first non-zero value of (Sequence, TicketSequence). */ - [[nodiscard]] std::uint32_t + std::uint32_t getSeqValue() const; - [[nodiscard]] AccountID + AccountID getFeePayer() const; - [[nodiscard]] boost::container::flat_set + boost::container::flat_set getMentionedAccounts() const; - [[nodiscard]] uint256 + uint256 getTransactionID() const; - [[nodiscard]] json::Value + json::Value getJson(JsonOptions options) const override; - [[nodiscard]] json::Value + json::Value getJson(JsonOptions options, bool binary) const; void @@ -108,27 +108,27 @@ public: @param rules The current ledger rules. @return `true` if valid signature. If invalid, the error message string. */ - [[nodiscard]] std::expected + std::expected checkSign(Rules const& rules) const; - [[nodiscard]] std::expected + std::expected checkBatchSign(Rules const& rules) const; // SQL Functions with metadata. static std::string const& getMetaSQLInsertReplaceHeader(); - [[nodiscard]] std::string + std::string getMetaSQL(std::uint32_t inLedger, std::string const& escapedMetaData) const; - [[nodiscard]] std::string + std::string getMetaSQL( Serializer rawTxn, std::uint32_t inLedger, TxnSql status, std::string const& escapedMetaData) const; - [[nodiscard]] std::vector const& + std::vector const& getBatchTransactionIDs() const; private: @@ -138,19 +138,19 @@ private: Will be *this more often than not. @return `true` if valid signature. If invalid, the error message string. */ - [[nodiscard]] std::expected + std::expected checkSign(Rules const& rules, STObject const& sigObject) const; - [[nodiscard]] std::expected + std::expected checkSingleSign(STObject const& sigObject) const; - [[nodiscard]] std::expected + std::expected checkMultiSign(Rules const& rules, STObject const& sigObject) const; - [[nodiscard]] std::expected + std::expected checkBatchSingleSign(STObject const& batchSigner) const; - [[nodiscard]] std::expected + std::expected checkBatchMultiSign(STObject const& batchSigner, Rules const& rules) const; STBase* diff --git a/include/xrpl/protocol/STValidation.h b/include/xrpl/protocol/STValidation.h index d006520241..91ce88b441 100644 --- a/include/xrpl/protocol/STValidation.h +++ b/include/xrpl/protocol/STValidation.h @@ -36,7 +36,7 @@ class STValidation final : public STObject, public CountedObject // that use manifests this will be derived from the master public key. NodeID const nodeID_; - NetClock::time_point seenTime_{}; + NetClock::time_point seenTime_; public: /** Construct a STValidation from a peer from serialized data. @@ -72,35 +72,35 @@ public: F&& f); // Hash of the validated ledger - [[nodiscard]] uint256 + uint256 getLedgerHash() const; // Hash of consensus transaction set used to generate ledger - [[nodiscard]] uint256 + uint256 getConsensusHash() const; - [[nodiscard]] NetClock::time_point + NetClock::time_point getSignTime() const; - [[nodiscard]] NetClock::time_point + NetClock::time_point getSeenTime() const noexcept; - [[nodiscard]] PublicKey const& + PublicKey const& getSignerPublic() const noexcept; - [[nodiscard]] NodeID const& + NodeID const& getNodeID() const noexcept; - [[nodiscard]] bool + bool isValid() const noexcept; - [[nodiscard]] bool + bool isFull() const noexcept; - [[nodiscard]] bool + bool isTrusted() const noexcept; - [[nodiscard]] uint256 + uint256 getSigningHash() const; void @@ -112,13 +112,13 @@ public: void setSeen(NetClock::time_point s); - [[nodiscard]] Blob + Blob getSerialized() const; - [[nodiscard]] Blob + Blob getSignature() const; - [[nodiscard]] std::string + std::string render() const { std::stringstream ss; diff --git a/include/xrpl/protocol/STVector256.h b/include/xrpl/protocol/STVector256.h index 01c55385c8..5c454b6be0 100644 --- a/include/xrpl/protocol/STVector256.h +++ b/include/xrpl/protocol/STVector256.h @@ -9,7 +9,7 @@ namespace xrpl { class STVector256 : public STBase, public CountedObject { - std::vector value_{}; + std::vector value_; public: using value_type = std::vector const&; diff --git a/include/xrpl/protocol/Serializer.h b/include/xrpl/protocol/Serializer.h index 462d5e0459..ffe9afabe8 100644 --- a/include/xrpl/protocol/Serializer.h +++ b/include/xrpl/protocol/Serializer.h @@ -21,7 +21,7 @@ class Serializer { private: // DEPRECATED - Blob data_{}; + Blob data_; public: explicit Serializer(int n = 256) @@ -161,7 +161,7 @@ public: int addFieldID(int type, int name); - static int + int addFieldID(SerializedTypeID type, int name) { return addFieldID(safeCast(type), name); @@ -372,25 +372,25 @@ public: BaseUInt getBitString(); - static uint128 + uint128 get128() { return getBitString<128>(); } - static uint160 + uint160 get160() { return getBitString<160>(); } - static uint192 + uint192 get192() { return getBitString<192>(); } - static uint256 + uint256 get256() { return getBitString<256>(); diff --git a/include/xrpl/protocol/XChainAttestations.h b/include/xrpl/protocol/XChainAttestations.h index 36e80db304..457af727a2 100644 --- a/include/xrpl/protocol/XChainAttestations.h +++ b/include/xrpl/protocol/XChainAttestations.h @@ -358,7 +358,7 @@ private: // allocated and processing time. This number is much larger than the actual // number of attestation a server would ever expect. static constexpr std::uint32_t kMaxAttestations = 256; - AttCollection attestations_{}; + AttCollection attestations_; protected: // Prevent slicing to the base class diff --git a/include/xrpl/protocol/digest.h b/include/xrpl/protocol/digest.h index b063d702ae..50bf2735fb 100644 --- a/include/xrpl/protocol/digest.h +++ b/include/xrpl/protocol/digest.h @@ -132,7 +132,7 @@ public: operator result_type() noexcept { auto const d0 = sha256_hasher::result_type(h_); - ripemd160_hasher const rh; + ripemd160_hasher rh; rh(d0.data(), d0.size()); return ripemd160_hasher::result_type(rh); } diff --git a/include/xrpl/protocol/json_get_or_throw.h b/include/xrpl/protocol/json_get_or_throw.h index 3b8dc30738..9399f25827 100644 --- a/include/xrpl/protocol/json_get_or_throw.h +++ b/include/xrpl/protocol/json_get_or_throw.h @@ -112,9 +112,9 @@ getOrThrow(json::Value const& v, xrpl::SField const& field) { auto const s = inner.asString(); // parse as hex - std::uint64_t const val = 0; + std::uint64_t val = 0; - auto [p, ec] = std::from_chars(s.data(), s.data() + s.size(), val != 0u, 16); + auto [p, ec] = std::from_chars(s.data(), s.data() + s.size(), val, 16); if (ec != std::errc() || (p != s.data() + s.size())) Throw(key, "uint64"); diff --git a/include/xrpl/rdb/RelationalDatabase.h b/include/xrpl/rdb/RelationalDatabase.h index 83a10e3f17..a38d6a997f 100644 --- a/include/xrpl/rdb/RelationalDatabase.h +++ b/include/xrpl/rdb/RelationalDatabase.h @@ -87,7 +87,7 @@ public: struct AccountTxResult { - std::variant transactions{}; + std::variant transactions; LedgerRange ledgerRange{}; uint32_t limit = 0; std::optional marker; diff --git a/include/xrpl/rdb/SociDB.h b/include/xrpl/rdb/SociDB.h index 57550a534c..e87aa2a182 100644 --- a/include/xrpl/rdb/SociDB.h +++ b/include/xrpl/rdb/SociDB.h @@ -93,7 +93,7 @@ convert(std::string const& from, soci::blob& to); class Checkpointer : public std::enable_shared_from_this { public: - [[nodiscard]] virtual std::uintptr_t + virtual std::uintptr_t id() const = 0; virtual ~Checkpointer() = default; diff --git a/include/xrpl/resource/Gossip.h b/include/xrpl/resource/Gossip.h index 091dc44030..e626af37c3 100644 --- a/include/xrpl/resource/Gossip.h +++ b/include/xrpl/resource/Gossip.h @@ -20,7 +20,7 @@ struct Gossip beast::IP::Endpoint address; }; - std::vector items{}; + std::vector items; }; } // namespace xrpl::Resource diff --git a/include/xrpl/server/Manifest.h b/include/xrpl/server/Manifest.h index db589455f0..eed1c14dae 100644 --- a/include/xrpl/server/Manifest.h +++ b/include/xrpl/server/Manifest.h @@ -239,10 +239,10 @@ private: std::shared_mutex mutable mutex_; /** Active manifests stored by master public key. */ - hash_map map_{}; + hash_map map_; /** Master public keys stored by current ephemeral public key. */ - hash_map signingToMasterKeys_{}; + hash_map signingToMasterKeys_; std::atomic seq_{0}; diff --git a/include/xrpl/server/Port.h b/include/xrpl/server/Port.h index 4916b185c1..fd773c78fc 100644 --- a/include/xrpl/server/Port.h +++ b/include/xrpl/server/Port.h @@ -31,11 +31,11 @@ struct Port std::string name; boost::asio::ip::address ip; std::uint16_t port = 0; - std::set protocol{}; - std::vector adminNetsV4{}; - std::vector adminNetsV6{}; - std::vector secureGatewayNetsV4{}; - std::vector secureGatewayNetsV6{}; + std::set protocol; + std::vector adminNetsV4; + std::vector adminNetsV6; + std::vector secureGatewayNetsV4; + std::vector secureGatewayNetsV6; std::string user; std::string password; std::string adminUser; @@ -77,7 +77,7 @@ struct ParsedPort explicit ParsedPort() = default; std::string name; - std::set protocol{}; + std::set protocol; std::string user; std::string password; std::string adminUser; @@ -92,10 +92,10 @@ struct ParsedPort std::optional ip; std::optional port; - std::vector adminNetsV4{}; - std::vector adminNetsV6{}; - std::vector secureGatewayNetsV4{}; - std::vector secureGatewayNetsV6{}; + std::vector adminNetsV4; + std::vector adminNetsV6; + std::vector secureGatewayNetsV4; + std::vector secureGatewayNetsV6; }; void diff --git a/include/xrpl/server/detail/BaseHTTPPeer.h b/include/xrpl/server/detail/BaseHTTPPeer.h index d2c702c39f..d26817bc45 100644 --- a/include/xrpl/server/detail/BaseHTTPPeer.h +++ b/include/xrpl/server/detail/BaseHTTPPeer.h @@ -49,14 +49,14 @@ protected: memcpy(data.get(), ptr, len); } - std::unique_ptr data{}; + std::unique_ptr data; std::size_t bytes; std::size_t used{0}; }; Port const& port_; Handler& handler_; - boost::asio::executor_work_guard work_{}; + boost::asio::executor_work_guard work_; boost::asio::strand strand_; endpoint_type remoteAddress_; beast::Journal const journal_; @@ -65,9 +65,9 @@ protected: std::size_t nid_; boost::asio::streambuf readBuf_; - http_request_type message_{}; - std::vector wq_{}; - std::vector wq2_{}; + http_request_type message_; + std::vector wq_; + std::vector wq2_; std::mutex mutex_; bool graceful_ = false; bool complete_ = false; @@ -340,7 +340,7 @@ BaseHTTPPeer::doWriter( bool keepAlive, yield_context doYield) { - std::function const resume; + std::function resume; { auto const p = impl().shared_from_this(); resume = std::function([this, p, writer, keepAlive]() { diff --git a/include/xrpl/server/detail/BasePeer.h b/include/xrpl/server/detail/BasePeer.h index d7897a13be..edde28981c 100644 --- a/include/xrpl/server/detail/BasePeer.h +++ b/include/xrpl/server/detail/BasePeer.h @@ -31,7 +31,7 @@ protected: beast::WrappedSink sink_; beast::Journal const j_; - boost::asio::executor_work_guard work_{}; + boost::asio::executor_work_guard work_; boost::asio::strand strand_; public: diff --git a/include/xrpl/server/detail/BaseWSPeer.h b/include/xrpl/server/detail/BaseWSPeer.h index bf57864698..13225dcba1 100644 --- a/include/xrpl/server/detail/BaseWSPeer.h +++ b/include/xrpl/server/detail/BaseWSPeer.h @@ -35,19 +35,19 @@ protected: private: friend class BasePeer; - http_request_type request_{}; + http_request_type request_; boost::beast::multi_buffer rb_; boost::beast::multi_buffer wb_; - std::list> wq_{}; + std::list> wq_; /// The socket has been closed, or will close after the next write /// finishes. Do not do any more writes, and don't try to close /// again. bool doClose_ = false; boost::beast::websocket::close_reason cr_; - waitable_timer timer_{}; + waitable_timer timer_; bool closeOnTimer_ = false; bool pingActive_ = false; - boost::beast::websocket::ping_data payload_{}; + boost::beast::websocket::ping_data payload_; error_code ec_; std::function controlCallback_; diff --git a/include/xrpl/server/detail/Door.h b/include/xrpl/server/detail/Door.h index b0312f7735..79d36cae0c 100644 --- a/include/xrpl/server/detail/Door.h +++ b/include/xrpl/server/detail/Door.h @@ -193,7 +193,7 @@ Door::Detector::doDetect(boost::asio::yield_context doYield) { boost::beast::multi_buffer buf(16); stream_.expires_after(std::chrono::seconds(15)); - boost::system::error_code const ec; + boost::system::error_code ec; bool const ssl = async_detect_ssl(stream_, buf, doYield[ec]); stream_.expires_never(); if (!ec) @@ -222,7 +222,7 @@ template void Door::reOpen() { - error_code const ec; + error_code ec; if (acceptor_.is_open()) { @@ -306,7 +306,7 @@ Door::close() strand_, std::bind(&Door::close, this->shared_from_this())); } backoffTimer_.cancel(); - error_code const ec; + error_code ec; acceptor_.close(ec); } @@ -343,13 +343,13 @@ Door::doAccept(boost::asio::yield_context doYield) { JLOG(j_.warn()) << "Throttling do_accept for " << acceptDelay_.count() << "ms."; backoffTimer_.expires_after(acceptDelay_); - boost::system::error_code const tec; + boost::system::error_code tec; backoffTimer_.async_wait(doYield[tec]); acceptDelay_ = std::min(acceptDelay_ * 2, kMaxAcceptDelay); continue; } - error_code const ec; + error_code ec; endpoint_type remoteAddress; stream_type stream(ioc_); socket_type& socket = stream.socket(); @@ -369,7 +369,7 @@ Door::doAccept(boost::asio::yield_context doYield) << "ms."; backoffTimer_.expires_after(acceptDelay_); - boost::system::error_code const tec; + boost::system::error_code tec; backoffTimer_.async_wait(doYield[tec]); acceptDelay_ = std::min(acceptDelay_ * 2, kMaxAcceptDelay); diff --git a/include/xrpl/server/detail/PlainHTTPPeer.h b/include/xrpl/server/detail/PlainHTTPPeer.h index 7b945d57c1..791ab91acf 100644 --- a/include/xrpl/server/detail/PlainHTTPPeer.h +++ b/include/xrpl/server/detail/PlainHTTPPeer.h @@ -143,7 +143,7 @@ template void PlainHTTPPeer::doClose() { - boost::system::error_code const ec; + boost::system::error_code ec; socket_.shutdown(socket_type::shutdown_send, ec); } diff --git a/include/xrpl/server/detail/PlainWSPeer.h b/include/xrpl/server/detail/PlainWSPeer.h index 81a804732c..593973a3ed 100644 --- a/include/xrpl/server/detail/PlainWSPeer.h +++ b/include/xrpl/server/detail/PlainWSPeer.h @@ -21,7 +21,7 @@ class PlainWSPeer : public BaseWSPeer>, using waitable_timer = boost::asio::basic_waitable_timer; using socket_type = boost::beast::tcp_stream; - boost::beast::websocket::stream ws_{}; + boost::beast::websocket::stream ws_; public: template diff --git a/include/xrpl/server/detail/SSLHTTPPeer.h b/include/xrpl/server/detail/SSLHTTPPeer.h index 4e6757c4d8..f3b047150f 100644 --- a/include/xrpl/server/detail/SSLHTTPPeer.h +++ b/include/xrpl/server/detail/SSLHTTPPeer.h @@ -26,7 +26,7 @@ private: using yield_context = boost::asio::yield_context; using error_code = boost::system::error_code; - std::unique_ptr streamPtr_{}; + std::unique_ptr streamPtr_; stream_type& stream_; socket_type& socket_; diff --git a/include/xrpl/server/detail/SSLWSPeer.h b/include/xrpl/server/detail/SSLWSPeer.h index 552037e446..cb03d5a796 100644 --- a/include/xrpl/server/detail/SSLWSPeer.h +++ b/include/xrpl/server/detail/SSLWSPeer.h @@ -28,8 +28,8 @@ class SSLWSPeer : public BaseWSPeer>, using stream_type = boost::beast::ssl_stream; using waitable_timer = boost::asio::basic_waitable_timer; - std::unique_ptr streamPtr_{}; - boost::beast::websocket::stream ws_{}; + std::unique_ptr streamPtr_; + boost::beast::websocket::stream ws_; public: template diff --git a/include/xrpl/server/detail/ServerImpl.h b/include/xrpl/server/detail/ServerImpl.h index 11cc2cabf8..48ffa26cfe 100644 --- a/include/xrpl/server/detail/ServerImpl.h +++ b/include/xrpl/server/detail/ServerImpl.h @@ -68,11 +68,11 @@ private: beast::Journal const j_; boost::asio::io_context& ioContext_; boost::asio::strand strand_; - std::optional> work_{}; + std::optional> work_; std::mutex m_; - std::vector ports_{}; - std::vector>> list_{}; + std::vector ports_; + std::vector>> list_; int high_ = 0; std::array hist_{}; diff --git a/include/xrpl/server/detail/io_list.h b/include/xrpl/server/detail/io_list.h index 379cd31fc6..4daa23fb7e 100644 --- a/include/xrpl/server/detail/io_list.h +++ b/include/xrpl/server/detail/io_list.h @@ -55,7 +55,7 @@ private: std::size_t n_ = 0; bool closed_ = false; std::condition_variable cv_; - boost::container::flat_map> map_{}; + boost::container::flat_map> map_; std::function f_; public: @@ -130,7 +130,7 @@ public: void close(Finisher&& f); - static void + void close() { close([] {}); @@ -163,7 +163,7 @@ IOList::Work::destroy() { if (!ios_) return; - std::function const f; + std::function f; { std::scoped_lock const lock(ios_->m_); ios_->map_.erase(this); diff --git a/include/xrpl/shamap/FullBelowCache.h b/include/xrpl/shamap/FullBelowCache.h index 552eaa2d16..07290dfbd1 100644 --- a/include/xrpl/shamap/FullBelowCache.h +++ b/include/xrpl/shamap/FullBelowCache.h @@ -119,7 +119,7 @@ public: } private: - CacheType cache_{}; + CacheType cache_; std::atomic gen_; }; diff --git a/include/xrpl/shamap/SHAMap.h b/include/xrpl/shamap/SHAMap.h index 0cf8b05ad9..3d08318cf6 100644 --- a/include/xrpl/shamap/SHAMap.h +++ b/include/xrpl/shamap/SHAMap.h @@ -466,8 +466,8 @@ private: std::uint32_t generation; // nodes we have discovered to be missing - std::vector> missingNodes{}; - std::set missingHashes{}; + std::vector> missingNodes; + std::set missingHashes; // nodes we are in the process of traversing using StackEntry = std::tuple< @@ -482,7 +482,7 @@ private: // elements will not be invalidated during the course of element // insertion and removal. Containers that do not offer this guarantee, // such as std::vector, can't be used here. - std::stack> stack{}; + std::stack> stack; // nodes we may have acquired from deferred reads using DeferredNode = std::tuple< @@ -494,11 +494,11 @@ private: int deferred; std::mutex deferLock; std::condition_variable deferCondVar; - std::vector finishedReads{}; + std::vector finishedReads; // nodes we need to resume after we get their children from deferred // reads - std::map resumes{}; + std::map resumes; MissingNodes( int max, @@ -584,7 +584,7 @@ public: using pointer = value_type const*; private: - SharedPtrNodeStack stack_{}; + SharedPtrNodeStack stack_; SHAMap const* map_ = nullptr; pointer item_ = nullptr; diff --git a/include/xrpl/tx/applySteps.h b/include/xrpl/tx/applySteps.h index c28ac3532c..897cf500d6 100644 --- a/include/xrpl/tx/applySteps.h +++ b/include/xrpl/tx/applySteps.h @@ -11,7 +11,7 @@ class TxQ; struct ApplyResult { - TER ter{}; + TER ter; bool applied; std::optional metadata; @@ -156,7 +156,7 @@ public: beast::Journal const j; /// Intermediate transaction result - NotTEC const ter{}; + NotTEC const ter; /// Constructor template @@ -198,7 +198,7 @@ public: beast::Journal const j; /// Intermediate transaction result - TER const ter{}; + TER const ter; /// Success flag - whether the transaction is likely to /// claim a fee diff --git a/include/xrpl/tx/invariants/DirectoryInvariant.h b/include/xrpl/tx/invariants/DirectoryInvariant.h index 23db3e0579..96643ea465 100644 --- a/include/xrpl/tx/invariants/DirectoryInvariant.h +++ b/include/xrpl/tx/invariants/DirectoryInvariant.h @@ -14,7 +14,7 @@ namespace xrpl { class ValidBookDirectory { bool badBookDirectory_ = false; - hash_set rootIndexes_{}; + hash_set rootIndexes_; public: void diff --git a/include/xrpl/tx/invariants/FreezeInvariant.h b/include/xrpl/tx/invariants/FreezeInvariant.h index f4b0e5d0db..a76eb66497 100644 --- a/include/xrpl/tx/invariants/FreezeInvariant.h +++ b/include/xrpl/tx/invariants/FreezeInvariant.h @@ -23,19 +23,19 @@ class TransfersNotFrozen struct BalanceChange { SLE::const_pointer const line; - int const balanceChangeSign{}; + int const balanceChangeSign; }; struct IssuerChanges { - std::vector senders{}; - std::vector receivers{}; + std::vector senders; + std::vector receivers; }; using ByIssuer = std::map; - ByIssuer balanceChanges_{}; + ByIssuer balanceChanges_; - std::map possibleIssuers_{}; + std::map possibleIssuers_; public: void diff --git a/include/xrpl/tx/invariants/InvariantCheck.h b/include/xrpl/tx/invariants/InvariantCheck.h index f3c3fd14e7..9378062726 100644 --- a/include/xrpl/tx/invariants/InvariantCheck.h +++ b/include/xrpl/tx/invariants/InvariantCheck.h @@ -171,7 +171,7 @@ class AccountRootsDeletedClean // deleted, it can still be found. After is used specifically for any checks // that are expected as part of the deletion, such as zeroing out the // balance. - std::vector> accountsDeleted_{}; + std::vector> accountsDeleted_; public: void @@ -340,10 +340,10 @@ public: */ class ValidPseudoAccounts { - std::vector errors_{}; + std::vector errors_; public: - static void + void visitEntry(bool, SLE::const_ref, SLE::const_ref); bool @@ -360,10 +360,10 @@ public: class NoModifiedUnmodifiableFields { // Pair is . - std::set> changedEntries_{}; + std::set> changedEntries_; public: - static void + void visitEntry(bool, SLE::const_ref, SLE::const_ref); bool @@ -375,7 +375,7 @@ public: */ class ValidAmounts { - std::vector> afterEntries_{}; + std::vector> afterEntries_; public: void diff --git a/include/xrpl/tx/invariants/LoanBrokerInvariant.h b/include/xrpl/tx/invariants/LoanBrokerInvariant.h index 90554e14d0..684bbff423 100644 --- a/include/xrpl/tx/invariants/LoanBrokerInvariant.h +++ b/include/xrpl/tx/invariants/LoanBrokerInvariant.h @@ -33,19 +33,19 @@ class ValidLoanBroker // Collect all the LoanBrokers found directly or indirectly through // pseudo-accounts. Key is the brokerID / index. It will be used to find the // LoanBroker object if brokerBefore and brokerAfter are nullptr - std::map brokers_{}; + std::map brokers_; // Collect all the modified trust lines. Their high and low accounts will be // loaded to look for LoanBroker pseudo-accounts. - std::vector lines_{}; + std::vector lines_; // Collect all the modified MPTokens. Their accounts will be loaded to look // for LoanBroker pseudo-accounts. - std::vector mpts_{}; + std::vector mpts_; static bool goodZeroDirectory(ReadView const& view, SLE::const_ref dir, beast::Journal const& j); public: - static void + void visitEntry(bool, SLE::const_ref, SLE::const_ref); bool diff --git a/include/xrpl/tx/invariants/LoanInvariant.h b/include/xrpl/tx/invariants/LoanInvariant.h index 3f64e67d47..3f408d169a 100644 --- a/include/xrpl/tx/invariants/LoanInvariant.h +++ b/include/xrpl/tx/invariants/LoanInvariant.h @@ -19,7 +19,7 @@ class ValidLoan { // Pair is . After is used for most of the checks, except // those that check changed values. - std::vector> loans_{}; + std::vector> loans_; public: void diff --git a/include/xrpl/tx/invariants/MPTInvariant.h b/include/xrpl/tx/invariants/MPTInvariant.h index 7f01b2f3b3..b4b76a290f 100644 --- a/include/xrpl/tx/invariants/MPTInvariant.h +++ b/include/xrpl/tx/invariants/MPTInvariant.h @@ -33,7 +33,7 @@ class ValidMPTIssuance /// MPTokens and RippleStates deleted during apply. finalize() checks each /// holder's AccountRoot to detect vault pseudo-account holdings deleted /// outside VaultDelete. All these checks are gated on fixCleanup3_2_0. - std::vector> deletedHoldings_{}; + std::vector> deletedHoldings_; public: void @@ -61,7 +61,7 @@ class ValidMPTPayment // true if OutstandingAmount > MaximumAmount in after for any MPT bool overflow_{false}; // mptid:MPTData - hash_map data_{}; + hash_map data_; public: void @@ -79,10 +79,10 @@ class ValidMPTTransfer std::optional amtAfter; }; // MPTID: {holder: Value} - hash_map> amount_{}; + hash_map> amount_; // Deleted MPToken // MPToken key: true if MPTAuthorized is set - hash_map deletedAuthorized_{}; + hash_map deletedAuthorized_; public: void diff --git a/include/xrpl/tx/invariants/PermissionedDEXInvariant.h b/include/xrpl/tx/invariants/PermissionedDEXInvariant.h index 833f2c0a68..2ec22ded88 100644 --- a/include/xrpl/tx/invariants/PermissionedDEXInvariant.h +++ b/include/xrpl/tx/invariants/PermissionedDEXInvariant.h @@ -14,7 +14,7 @@ class ValidPermissionedDEX bool regularOffers_ = false; // post-fixCleanup3_2_0: excludes deleted offers bool badHybridsOld_ = false; // pre-fixCleanup3_1_3: missing field/domain or size > 1 bool badHybrids_ = false; // post-fixCleanup3_1_3: also catches size == 0 (size != 1) - hash_set domains_{}; + hash_set domains_; public: void diff --git a/include/xrpl/tx/invariants/PermissionedDomainInvariant.h b/include/xrpl/tx/invariants/PermissionedDomainInvariant.h index e07ded760a..19edcc0b39 100644 --- a/include/xrpl/tx/invariants/PermissionedDomainInvariant.h +++ b/include/xrpl/tx/invariants/PermissionedDomainInvariant.h @@ -28,7 +28,7 @@ class ValidPermissionedDomain bool isUnique = false; bool isDelete = false; }; - std::vector sleStatus_{}; + std::vector sleStatus_; public: void diff --git a/include/xrpl/tx/invariants/VaultInvariant.h b/include/xrpl/tx/invariants/VaultInvariant.h index e344a0029d..2a9ffc8282 100644 --- a/include/xrpl/tx/invariants/VaultInvariant.h +++ b/include/xrpl/tx/invariants/VaultInvariant.h @@ -75,11 +75,11 @@ public: }; private: - std::vector afterVault_{}; - std::vector afterMPTs_{}; - std::vector beforeVault_{}; - std::vector beforeMPTs_{}; - std::unordered_map deltas_{}; + std::vector afterVault_; + std::vector afterMPTs_; + std::vector beforeVault_; + std::vector beforeMPTs_; + std::unordered_map deltas_; /** * @brief Compute the minimum STAmount scale for rounding invariant @@ -93,8 +93,8 @@ private: * @param rules Active ledger rules (used to check the amendment). * @returns The minimum scale to apply when rounding vault-related amounts. */ - static [[nodiscard]] std::int32_t - computeVaultMinScale(DeltaInfo const& vaultDelta, Rules const& rules); + [[nodiscard]] std::int32_t + computeVaultMinScale(DeltaInfo const& vaultDelta, Rules const& rules) const; /** * @brief Return the vault-asset balance-change delta for an account. @@ -106,8 +106,8 @@ private: * @param id Account whose asset delta is requested. * @returns The delta, or @c std::nullopt if the entry was not touched. */ - static [[nodiscard]] std::optional - deltaAssets(AccountID const& id); + [[nodiscard]] std::optional + deltaAssets(AccountID const& id) const; /** * @brief Return the vault-asset delta for the transaction's sending @@ -122,8 +122,8 @@ private: * @returns The fee-adjusted delta, or @c std::nullopt if the net delta is * zero or the account entry was not touched. */ - static [[nodiscard]] std::optional - deltaAssetsTxAccount(STTx const& tx, XRPAmount fee); + [[nodiscard]] std::optional + deltaAssetsTxAccount(STTx const& tx, XRPAmount fee) const; /** * @brief Return the vault-share balance-change delta for an account. @@ -135,8 +135,8 @@ private: * @param id Account whose share delta is requested. * @returns The delta, or @c std::nullopt if the entry was not touched. */ - static [[nodiscard]] std::optional - deltaShares(AccountID const& id); + [[nodiscard]] std::optional + deltaShares(AccountID const& id) const; /** * @brief Check whether a vault holds no assets. @@ -153,7 +153,7 @@ public: [[nodiscard]] static std::int32_t computeCoarsestScale(std::vector const& numbers); - static void + void visitEntry(bool, SLE::const_ref, SLE::const_ref); bool diff --git a/include/xrpl/tx/paths/detail/Steps.h b/include/xrpl/tx/paths/detail/Steps.h index aace848237..9909c4bdcd 100644 --- a/include/xrpl/tx/paths/detail/Steps.h +++ b/include/xrpl/tx/paths/detail/Steps.h @@ -300,7 +300,7 @@ using Strand = std::vector>; inline std::uint32_t offersUsed(Strand const& strand) { - std::uint32_t const r = 0; + std::uint32_t r = 0; for (auto const& step : strand) { if (step) @@ -483,7 +483,7 @@ public: class FlowException : public std::runtime_error { public: - TER ter{}; + TER ter; FlowException(TER t, std::string const& msg) : std::runtime_error(msg), ter(t) { diff --git a/include/xrpl/tx/transactors/account/SignerListSet.h b/include/xrpl/tx/transactors/account/SignerListSet.h index a8ca99ad25..46e3191323 100644 --- a/include/xrpl/tx/transactors/account/SignerListSet.h +++ b/include/xrpl/tx/transactors/account/SignerListSet.h @@ -21,7 +21,7 @@ private: enum class Operation { Unknown, Set, Destroy }; Operation do_{Operation::Unknown}; std::uint32_t quorum_{0}; - std::vector signers_{}; + std::vector signers_; public: static constexpr auto kConsequencesFactory = ConsequencesFactoryType::Blocker; @@ -77,8 +77,8 @@ private: TER destroySignerList(); - static void - writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t flags); + void + writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t flags) const; }; } // namespace xrpl diff --git a/src/test/app/PermissionedDEX_test.cpp b/src/test/app/PermissionedDEX_test.cpp index 030f830897..99e69ce482 100644 --- a/src/test/app/PermissionedDEX_test.cpp +++ b/src/test/app/PermissionedDEX_test.cpp @@ -15,7 +15,9 @@ #include #include #include +#include #include +#include #include #include @@ -37,10 +39,15 @@ #include #include +#include #include #include +#include #include #include +#include +#include +#include namespace xrpl::test { @@ -1480,7 +1487,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite auto const domainDir = getBookDirKey(domainBook, XRP(10), USD(10)); auto const openDir = getBookDirKey(openBook, XRP(10), USD(10)); - size_t const dirCnt = 100; + size_t dirCnt = 100; for (size_t i = 1; i <= dirCnt; i++) { @@ -1552,7 +1559,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite void testHybridMalformedOffer(FeatureBitset features) { - bool const fixEnabled = features[fixCleanup3_1_3] = false; + bool const fixEnabled = features[fixCleanup3_1_3]; testcase << "Hybrid offer with empty AdditionalBooks" << (fixEnabled ? " (fixCleanup3_1_3 enabled)" : " (fixCleanup3_1_3 disabled)"); @@ -1618,7 +1625,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite void testHybridOfferCrossingQuality(FeatureBitset features) { - bool const fixEnabled = features[fixCleanup3_2_0] = false; + bool const fixEnabled = features[fixCleanup3_2_0]; testcase << "Hybrid offer crossing quality" << (fixEnabled ? " (fixCleanup3_2_0)" : " (pre-fix)"); @@ -1875,7 +1882,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite void testCancelRegularOfferWithDomainCreate(FeatureBitset features) { - bool const fixEnabled = features[fixCleanup3_2_0] = false; + bool const fixEnabled = features[fixCleanup3_2_0]; testcase << "Cancel regular offer via domain OfferCreate" << (fixEnabled ? " (fixCleanup3_2_0 enabled)" : " (fixCleanup3_2_0 disabled)"); diff --git a/src/test/jtx/AMM.h b/src/test/jtx/AMM.h index b35afd99b6..deadd80290 100644 --- a/src/test/jtx/AMM.h +++ b/src/test/jtx/AMM.h @@ -282,7 +282,7 @@ public: std::optional const& flags = std::nullopt, std::optional const& ter = std::nullopt); - static IOUAmount + IOUAmount withdrawAll( std::optional const& account, std::optional const& asset1OutDetails = std::nullopt, @@ -413,7 +413,7 @@ public: struct Pool { AMM const& amm; - std::vector names{}; + std::vector names; Pool(AMM const& a, std::vector const& n = {}) : amm(a), names(n) { } diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index eb0ba52483..3d813d993c 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -144,10 +144,10 @@ private: struct AppBundle { Application* app = nullptr; - std::unique_ptr owned{}; + std::unique_ptr owned; ManualTimeKeeper* timeKeeper = nullptr; std::thread thread; - std::unique_ptr client{}; + std::unique_ptr client; AppBundle() = default; AppBundle( @@ -161,7 +161,7 @@ private: AppBundle bundle_; public: - beast::Journal const journal{}; + beast::Journal const journal; Env() = delete; Env& @@ -391,7 +391,7 @@ public: @return true if no error, false if error */ - static bool + bool close() { // VFALCO Is this the correct time? @@ -836,7 +836,7 @@ protected: } // Map of account IDs to Account - std::unordered_map map_{}; + std::unordered_map map_; }; template diff --git a/src/test/jtx/JTx.h b/src/test/jtx/JTx.h index 13324553c3..121e6cc825 100644 --- a/src/test/jtx/JTx.h +++ b/src/test/jtx/JTx.h @@ -22,7 +22,7 @@ class Env; struct JTx { json::Value jv; - requires_t require{}; + requires_t require; std::optional ter = TER{tesSUCCESS}; std::optional> rpcCode = std::nullopt; std::optional>> rpcException = std::nullopt; @@ -32,10 +32,10 @@ struct JTx bool fillNetid = true; std::shared_ptr stx; // Functions that sign the transaction from the Account - std::vector> mainSigners{}; + std::vector> mainSigners; // Functions that sign something else after the mainSigners, such as // sfCounterpartySignature - std::vector> postSigners{}; + std::vector> postSigners; JTx() = default; JTx(JTx const&) = default; @@ -144,7 +144,7 @@ private: PropList& operator=(PropList&& src) = default; - std::vector> list{}; + std::vector> list; }; PropList props_; diff --git a/src/test/jtx/ManualTimeKeeper.h b/src/test/jtx/ManualTimeKeeper.h index 1d6915e2cc..0e9da76b52 100644 --- a/src/test/jtx/ManualTimeKeeper.h +++ b/src/test/jtx/ManualTimeKeeper.h @@ -9,7 +9,7 @@ namespace xrpl::test { class ManualTimeKeeper : public TimeKeeper { private: - std::atomic now_{}; + std::atomic now_; public: ManualTimeKeeper() = default; diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 0aa0169d1b..27c54d830b 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -116,8 +116,8 @@ public: { } - static [[nodiscard]] OV - value() override + [[nodiscard]] OV + value() const override { return to_string(value_); } @@ -138,8 +138,8 @@ public: { } - static [[nodiscard]] OV - value() override + [[nodiscard]] OV + value() const override { return toBase58(value_); } @@ -412,7 +412,15 @@ same(STPathSet const& st1, Args const&... args) { STPathSet st2; stpathsetAppend(st2, args...); - return static_cast(st1.size() == st2.size()); + if (st1.size() != st2.size()) + return false; + + for (auto const& p : st2) + { + if (std::ranges::find(st1, p) == st1.end()) + return false; + } + return true; } json::Value diff --git a/src/test/jtx/amount.h b/src/test/jtx/amount.h index 61ef66c8b6..db281419ef 100644 --- a/src/test/jtx/amount.h +++ b/src/test/jtx/amount.h @@ -594,7 +594,7 @@ struct AnyAmount // Reset the issue to a specific account void - to(AccountID const& id) const + to(AccountID const& id) { if (!isAny) return; diff --git a/src/test/jtx/credentials.h b/src/test/jtx/credentials.h index 3e06b6dc9a..4bdd716918 100644 --- a/src/test/jtx/credentials.h +++ b/src/test/jtx/credentials.h @@ -37,7 +37,7 @@ public: class Ids { private: - std::vector const credentials_{}; + std::vector const credentials_; public: explicit Ids(std::vector creds) : credentials_(std::move(creds)) diff --git a/src/test/jtx/multisign.h b/src/test/jtx/multisign.h index 23df4b0c81..3fef2ab446 100644 --- a/src/test/jtx/multisign.h +++ b/src/test/jtx/multisign.h @@ -38,7 +38,7 @@ signers(Account const& account, NoneT); class Msig { public: - std::vector signers{}; + std::vector signers; /** Alternative transaction object field in which to place the signer list. * * subField is only supported if an account_ is provided as well. diff --git a/src/test/jtx/ter.h b/src/test/jtx/ter.h index 4f2f933ac6..c410b46a1e 100644 --- a/src/test/jtx/ter.h +++ b/src/test/jtx/ter.h @@ -12,7 +12,7 @@ namespace xrpl::test::jtx { class Ter { private: - std::optional v_{}; + std::optional v_; public: explicit Ter(decltype(std::ignore)) diff --git a/src/test/unit_test/SuiteJournal.h b/src/test/unit_test/SuiteJournal.h index 587c035dbe..bd54683031 100644 --- a/src/test/unit_test/SuiteJournal.h +++ b/src/test/unit_test/SuiteJournal.h @@ -68,7 +68,7 @@ SuiteJournalSink::writeAlways(beast::Severity level, std::string const& text) return "FTL:"; }(); - static std::mutex const kLogMutex; + static std::mutex kLogMutex; std::scoped_lock const lock(kLogMutex); suite_.log << s << partition_ << text << std::endl; } diff --git a/src/xrpld/app/consensus/RCLCensorshipDetector.h b/src/xrpld/app/consensus/RCLCensorshipDetector.h index 08a1b0b9f2..48df7368d9 100644 --- a/src/xrpld/app/consensus/RCLCensorshipDetector.h +++ b/src/xrpld/app/consensus/RCLCensorshipDetector.h @@ -46,7 +46,7 @@ public: using TxIDSeqVec = std::vector; private: - TxIDSeqVec tracker_{}; + TxIDSeqVec tracker_; public: RCLCensorshipDetector() = default; diff --git a/src/xrpld/app/consensus/RCLConsensus.h b/src/xrpld/app/consensus/RCLConsensus.h index c16769e8d0..32759300fa 100644 --- a/src/xrpld/app/consensus/RCLConsensus.h +++ b/src/xrpld/app/consensus/RCLConsensus.h @@ -469,8 +469,8 @@ public: gotTxSet(NetClock::time_point const& now, RCLTxSet const& txSet); // @see Consensus::prevLedgerID - static RCLCxLedger::ID - prevLedgerID() + RCLCxLedger::ID + prevLedgerID() const { std::scoped_lock const _{mutex_}; return consensus_.prevLedgerID(); diff --git a/src/xrpld/app/consensus/RCLCxLedger.h b/src/xrpld/app/consensus/RCLCxLedger.h index 223a16d8d6..9f7984aaa6 100644 --- a/src/xrpld/app/consensus/RCLCxLedger.h +++ b/src/xrpld/app/consensus/RCLCxLedger.h @@ -65,8 +65,8 @@ public: } //! Whether consensus process agreed on close time of the ledger. - static [[nodiscard]] bool - closeAgree() + [[nodiscard]] bool + closeAgree() const { return xrpl::getCloseAgree(ledger->header()); } @@ -86,8 +86,8 @@ public: } //! JSON representation of this ledger. - static [[nodiscard]] json::Value - getJson() + [[nodiscard]] json::Value + getJson() const { return xrpl::getJson({*ledger, {}}); } diff --git a/src/xrpld/app/consensus/RCLCxPeerPos.h b/src/xrpld/app/consensus/RCLCxPeerPos.h index 4fd9fe5dca..4618bdb746 100644 --- a/src/xrpld/app/consensus/RCLCxPeerPos.h +++ b/src/xrpld/app/consensus/RCLCxPeerPos.h @@ -43,41 +43,41 @@ public: Proposal const& proposal); // trivially copyable //! Verify the signing hash of the proposal - [[nodiscard]] bool + bool checkSign() const; //! Signature of the proposal (not necessarily verified) - [[nodiscard]] Slice + Slice signature() const { return {signature_.data(), signature_.size()}; } //! Public key of peer that sent the proposal - [[nodiscard]] PublicKey const& + PublicKey const& publicKey() const { return publicKey_; } //! Unique id used by hash router to suppress duplicates - [[nodiscard]] uint256 const& + uint256 const& suppressionID() const { return suppression_; } - [[nodiscard]] Proposal const& + Proposal const& proposal() const { return proposal_; } //! JSON representation of proposal - [[nodiscard]] json::Value + json::Value getJson() const; - [[nodiscard]] std::string + std::string render() const { return proposal_.render(); diff --git a/src/xrpld/app/consensus/RCLCxTx.h b/src/xrpld/app/consensus/RCLCxTx.h index d721a3b782..52637d32b3 100644 --- a/src/xrpld/app/consensus/RCLCxTx.h +++ b/src/xrpld/app/consensus/RCLCxTx.h @@ -142,8 +142,8 @@ public: is the transaction ID and the value is a bool of the transaction exists in this set. */ - static [[nodiscard]] std::map - compare(RCLTxSet const& j) + [[nodiscard]] std::map + compare(RCLTxSet const& j) const { SHAMap::Delta delta; diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index 6da6954a9f..131db30ce0 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -573,7 +573,7 @@ private: Ledger_t previousLedger_; // Transaction Sets, indexed by hash of transaction tree - hash_map acquired_{}; + hash_map acquired_; std::optional result_; ConsensusCloseTimes rawCloseTimes_; @@ -589,17 +589,17 @@ private: // Peer related consensus data // Peer proposed positions for the current round - hash_map currPeerPositions_{}; + hash_map currPeerPositions_; // Recently received peer positions, available when transitioning between // ledgers or rounds - hash_map> recentPeerPositions_{}; + hash_map> recentPeerPositions_; // The number of proposers who participated in the last consensus round std::size_t prevProposers_ = 0; // nodes that have bowed out of this consensus process - hash_set deadNodes_{}; + hash_set deadNodes_; // Journal for debugging beast::Journal const j_; @@ -887,7 +887,7 @@ Consensus::gotTxSet(NetClock::time_point const& now, TxSet_t const& txS XRPL_ASSERT( id != result_->position.position(), "xrpl::Consensus::gotTxSet : updated transaction set"); - bool const any = false; + bool any = false; for (auto const& [nodeId, peerPos] : currPeerPositions_) { if (peerPos.proposal().position() == id) @@ -968,7 +968,7 @@ Consensus::getJson(bool full) const if (!currPeerPositions_.empty()) { - json::Value const ppj(json::ValueType::Object); + json::Value ppj(json::ValueType::Object); for (auto const& [nodeId, peerPos] : currPeerPositions_) { @@ -979,7 +979,7 @@ Consensus::getJson(bool full) const if (!acquired_.empty()) { - json::Value const acq(json::ValueType::Array); + json::Value acq(json::ValueType::Array); for (auto const& at : acquired_) { acq.append(to_string(at.first)); @@ -999,7 +999,7 @@ Consensus::getJson(bool full) const if (!rawCloseTimes_.peers.empty()) { - json::Value const ctj(json::ValueType::Object); + json::Value ctj(json::ValueType::Object); for (auto const& ct : rawCloseTimes_.peers) { ctj[std::to_string(ct.first.time_since_epoch().count())] = ct.second; @@ -1009,7 +1009,7 @@ Consensus::getJson(bool full) const if (!deadNodes_.empty()) { - json::Value const dnj(json::ValueType::Array); + json::Value dnj(json::ValueType::Array); for (auto const& dn : deadNodes_) { dnj.append(to_string(dn)); @@ -1531,7 +1531,7 @@ Consensus::updateOurPositions(std::unique_ptr const& closeTimeAvalancheState_ = *newState; CLOG(clog) << "neededWeight " << neededWeight << ". "; - int participants = currPeerPositions_.size() = 0; + int participants = currPeerPositions_.size(); if (mode_.get() == ConsensusMode::Proposing) { ++closeTimeVotes[asCloseTime(result_->position.closeTime())]; @@ -1544,7 +1544,7 @@ Consensus::updateOurPositions(std::unique_ptr const& // Threshold to declare consensus int const threshConsensus = participantsNeeded(participants, parms.avCtConsensusPct); - std::stringstream const ss; + std::stringstream ss; ss << "Proposers:" << currPeerPositions_.size() << " nw:" << neededWeight << " thrV:" << threshVote << " thrC:" << threshConsensus; JLOG(j_.info()) << ss.str(); diff --git a/src/xrpld/consensus/ConsensusProposal.h b/src/xrpld/consensus/ConsensusProposal.h index d048b927bf..d16679bfb5 100644 --- a/src/xrpld/consensus/ConsensusProposal.h +++ b/src/xrpld/consensus/ConsensusProposal.h @@ -100,21 +100,21 @@ public: @return the sequence number */ - [[nodiscard]] std::uint32_t + std::uint32_t proposeSeq() const { return proposeSeq_; } //! The current position on the consensus close time. - [[nodiscard]] NetClock::time_point const& + NetClock::time_point const& closeTime() const { return closeTime_; } //! Get when this position was taken. - [[nodiscard]] NetClock::time_point const& + NetClock::time_point const& seenTime() const { return time_; @@ -123,21 +123,21 @@ public: /** Whether this is the first position taken during the current consensus round. */ - [[nodiscard]] bool + bool isInitial() const { return proposeSeq_ == kSeqJoin; } //! Get whether this node left the consensus process - [[nodiscard]] bool + bool isBowOut() const { return proposeSeq_ == kSeqLeave; } //! Get whether this position is stale relative to the provided cutoff - [[nodiscard]] bool + bool isStale(NetClock::time_point cutoff) const { return time_ <= cutoff; @@ -178,7 +178,7 @@ public: proposeSeq_ = kSeqLeave; } - [[nodiscard]] std::string + std::string render() const { std::stringstream ss; @@ -190,7 +190,7 @@ public: } //! Get JSON representation for debugging - [[nodiscard]] json::Value + json::Value getJson() const { using std::to_string; @@ -210,7 +210,7 @@ public: } //! The digest for this proposal, used for signing purposes. - [[nodiscard]] uint256 const& + uint256 const& signingHash() const { if (!signingHash_) diff --git a/src/xrpld/consensus/ConsensusTypes.h b/src/xrpld/consensus/ConsensusTypes.h index c50457045c..64a7f5fdea 100644 --- a/src/xrpld/consensus/ConsensusTypes.h +++ b/src/xrpld/consensus/ConsensusTypes.h @@ -158,7 +158,7 @@ struct ConsensusCloseTimes explicit ConsensusCloseTimes() = default; //! Close time estimates, keep ordered for predictable traverse - std::map peers{}; + std::map peers; //! Our close time estimate NetClock::time_point self; @@ -203,10 +203,10 @@ struct ConsensusResult Proposal_t position; //! Transactions which are under dispute with our peers - hash_map disputes{}; + hash_map disputes; // Set of TxSet ids we have already compared/created disputes - hash_set compares{}; + hash_set compares; // Measures the duration of the establish phase for this consensus round ConsensusTimer roundTime; diff --git a/src/xrpld/consensus/DisputedTx.h b/src/xrpld/consensus/DisputedTx.h index 14d8201165..1c0c069f54 100644 --- a/src/xrpld/consensus/DisputedTx.h +++ b/src/xrpld/consensus/DisputedTx.h @@ -177,11 +177,11 @@ public: getJson() const; private: - int yays_{0}; //< Number of yes votes - int nays_{0}; //< Number of no votes - bool ourVote_; //< Our vote (true is yes) - Tx tx_; //< Transaction under dispute - Map_t votes_{}; //< Map from NodeID to vote + int yays_{0}; //< Number of yes votes + int nays_{0}; //< Number of no votes + bool ourVote_; //< Our vote (true is yes) + Tx tx_; //< Transaction under dispute + Map_t votes_; //< Map from NodeID to vote //! The number of rounds we've gone without changing our vote std::size_t currentVoteCounter_ = 0; //! Which minimum acceptance percentage phase we are currently in @@ -328,7 +328,7 @@ DisputedTx::getJson() const if (!votes_.empty()) { - json::Value const votes(json::ValueType::Object); + json::Value votes(json::ValueType::Object); for (auto const& [nodeId, vote] : votes_) votes[to_string(nodeId)] = vote; ret["votes"] = std::move(votes); diff --git a/src/xrpld/consensus/LedgerTrie.h b/src/xrpld/consensus/LedgerTrie.h index 739666cdd7..9d76c7f283 100644 --- a/src/xrpld/consensus/LedgerTrie.h +++ b/src/xrpld/consensus/LedgerTrie.h @@ -192,7 +192,7 @@ struct Node std::uint32_t tipSupport = 0; std::uint32_t branchSupport = 0; - std::vector> children{}; + std::vector> children; Node* parent = nullptr; /** Remove the given node from this Node's children @@ -232,7 +232,7 @@ struct Node res["branchSupport"] = branchSupport; if (!children.empty()) { - json::Value const& cs = (res["children"] = json::ValueType::Array); + json::Value& cs = (res["children"] = json::ValueType::Array); for (auto const& child : children) { cs.append(child->getJson()); @@ -331,10 +331,10 @@ class LedgerTrie // The root of the trie. The root is allowed to break the no-single child // invariant. - std::unique_ptr root_{}; + std::unique_ptr root_; // Count of the tip support for each sequence number - std::map seqSupport_{}; + std::map seqSupport_; /** Find the node in the trie that represents the longest common ancestry with the given ledger. @@ -346,7 +346,7 @@ class LedgerTrie find(Ledger const& ledger) const { // NOLINTNEXTLINE(misc-const-correctness) - Node* curr = root_.get() = nullptr; + Node* curr = root_.get(); // Root is always defined and is in common with all ledgers XRPL_ASSERT(curr, "xrpl::LedgerTrie::find : non-null root"); @@ -414,7 +414,9 @@ class LedgerTrie } public: - LedgerTrie() : root_{std::make_unique()} = default; + LedgerTrie() : root_{std::make_unique()} + { + } /** Insert and/or increment the support for the given ledger. @@ -659,7 +661,7 @@ public: if (empty()) return std::nullopt; - Node* curr = root_.get() = nullptr; + Node* curr = root_.get(); bool done = false; diff --git a/src/xrpld/consensus/Validations.h b/src/xrpld/consensus/Validations.h index bf3177734c..2f5762ce83 100644 --- a/src/xrpld/consensus/Validations.h +++ b/src/xrpld/consensus/Validations.h @@ -282,13 +282,13 @@ class Validations mutable Mutex mutex_; // Validations from currently listed and trusted nodes (partial and full) - hash_map current_{}; + hash_map current_; // Used to enforce the largest validation invariant for the local node SeqEnforcer localSeqEnforcer_; // Sequence of the largest validation received from each node - hash_map> seqEnforcers_{}; + hash_map> seqEnforcers_; //! Validations from listed nodes, indexed by ledger id (partial and full) beast::aged_unordered_map< @@ -319,10 +319,10 @@ class Validations // Last (validated) ledger successfully acquired. If in this map, it is // accounted for in the trie. - hash_map lastLedger_{}; + hash_map lastLedger_; // Set of ledgers being acquired from the network - hash_map, hash_set> acquiring_{}; + hash_map, hash_set> acquiring_; // Parameters to determine validation staleness ValidationParms const parms_; diff --git a/src/xrpld/core/TimeKeeper.h b/src/xrpld/core/TimeKeeper.h index 70561b5f95..8eb13e75c0 100644 --- a/src/xrpld/core/TimeKeeper.h +++ b/src/xrpld/core/TimeKeeper.h @@ -40,8 +40,8 @@ public: code. No rationale has been provided for this curious and annoying, but otherwise unimportant, choice. */ - static [[nodiscard]] time_point - now() override + [[nodiscard]] time_point + now() const override { return adjust(std::chrono::system_clock::now()); } @@ -66,7 +66,7 @@ public: } /** Adjust the close time, based on the network's view of time. */ - static std::chrono::seconds + std::chrono::seconds adjustCloseTime(std::chrono::seconds by) { using namespace std::chrono_literals; diff --git a/src/xrpld/overlay/Message.h b/src/xrpld/overlay/Message.h index 908a1886d8..cd21ca40c6 100644 --- a/src/xrpld/overlay/Message.h +++ b/src/xrpld/overlay/Message.h @@ -63,14 +63,14 @@ public: getBuffer(Compressed tryCompressed); /** Get the traffic category */ - [[nodiscard]] std::size_t + std::size_t getCategory() const { return category_; } /** Get the validator's key */ - [[nodiscard]] std::optional const& + std::optional const& getValidatorKey() const { return validatorKey_;