roll back unrelated clang-tidy changes

This commit is contained in:
Mayukha Vadari
2026-06-10 22:52:20 -04:00
parent 7098e49dbb
commit 052bb02c07
100 changed files with 373 additions and 336 deletions

View File

@@ -15,7 +15,7 @@ namespace xrpl {
class Buffer
{
private:
std::unique_ptr<std::uint8_t[]> p_{};
std::unique_ptr<std::uint8_t[]> p_;
std::size_t size_ = 0;
public:

View File

@@ -41,7 +41,7 @@ struct LocalValues
};
// Keys are the address of a LocalValue.
std::unordered_map<void const*, std::unique_ptr<BasicValue>> values{};
std::unordered_map<void const*, std::unique_ptr<BasicValue>> values;
static void
cleanup(LocalValues* lvs)

View File

@@ -105,7 +105,7 @@ fromString(RangeSet<T>& rs, std::string const& s)
{
std::vector<std::string> intervals;
std::vector<std::string> tokens;
bool const result{true};
bool result{true};
rs.clear();
boost::split(tokens, s, boost::algorithm::is_any_of(","));

View File

@@ -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};
};

View File

@@ -232,7 +232,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
std::vector<std::thread> workers;
workers.reserve(cache_.partitions());
std::atomic<int> const allRemovals = 0;
std::atomic<int> allRemovals = 0;
for (std::size_t p = 0; p < cache_.partitions(); ++p)
{

View File

@@ -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 <class... Args>
@@ -1446,7 +1446,7 @@ private:
private:
ConfigT config_;
Buckets buck_;
cont_type mutable cont_{};
cont_type mutable cont_;
};
//------------------------------------------------------------------------------

View File

@@ -72,7 +72,7 @@ struct LexicalCast<Out, std::string_view>
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) {

View File

@@ -58,7 +58,7 @@ public:
return result;
}
[[nodiscard]] NodePtr
NodePtr
node() const
{
return node_;

View File

@@ -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:

View File

@@ -18,7 +18,9 @@
#include <string>
#include <utility>
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<run_time> top{};
std::vector<run_time> top;
typename clock_type::time_point start = clock_type::now();
void
@@ -244,6 +246,8 @@ Reporter<Unused>::onLog(std::string const& s)
os_ << s;
}
} // namespace beast::unit_test::detail
} // namespace detail
using reporter = detail::Reporter<>;
} // namespace beast::unit_test

View File

@@ -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);

View File

@@ -143,7 +143,7 @@ public:
Text sent to the log output stream will be forwarded to
the output stream associated with the runner.
*/
LogOs<char> log{};
LogOs<char> log;
/** Memberspace for declaring test cases. */
TestcaseT testcase;

View File

@@ -56,7 +56,7 @@ public:
std::uint32_t cost;
/** For compound conditions, set of conditions includes */
std::set<Type> subtypes{};
std::set<Type> subtypes;
Condition(Type t, std::uint32_t c, Slice fp) : type(t), fingerprint(fp), cost(c)
{

View File

@@ -127,7 +127,7 @@ JobQueue::Coro::expectEarlyExit()
inline void
JobQueue::Coro::join()
{
std::unique_lock<std::mutex> const lk(mutexRun_);
std::unique_lock<std::mutex> lk(mutexRun_);
cv_.wait(lk, [this]() { return !running_; });
}

View File

@@ -32,7 +32,9 @@ enum class HashRouterFlags : std::uint16_t {
constexpr HashRouterFlags
operator|(HashRouterFlags lhs, HashRouterFlags rhs)
{
return (lhs) | static_cast<std::underlying_type_t<HashRouterFlags>>(rhs);
return static_cast<HashRouterFlags>(
static_cast<std::underlying_type_t<HashRouterFlags>>(lhs) |
static_cast<std::underlying_type_t<HashRouterFlags>>(rhs));
}
constexpr HashRouterFlags&
@@ -45,7 +47,9 @@ operator|=(HashRouterFlags& lhs, HashRouterFlags rhs)
constexpr HashRouterFlags
operator&(HashRouterFlags lhs, HashRouterFlags rhs)
{
return (lhs) & static_cast<std::underlying_type_t<HashRouterFlags>>(rhs);
return static_cast<HashRouterFlags>(
static_cast<std::underlying_type_t<HashRouterFlags>>(lhs) &
static_cast<std::underlying_type_t<HashRouterFlags>>(rhs));
}
constexpr HashRouterFlags&
@@ -127,7 +131,7 @@ private:
}
/** Return set of peers we've relayed to and reset tracking */
static std::set<PeerShortID>
std::set<PeerShortID>
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<PeerShortID> peers_{};
std::set<PeerShortID> peers_;
// This could be generalized to a map, if more
// than one flag needs to expire independently.
std::optional<Stopwatch::time_point> relayed_{};
std::optional<Stopwatch::time_point> processed_{};
std::optional<Stopwatch::time_point> relayed_;
std::optional<Stopwatch::time_point> processed_;
};
public:
@@ -241,7 +251,7 @@ private:
// Stores all suppressed hashes and their expiration time
beast::aged_unordered_map<uint256, Entry, Stopwatch::clock_type, HardenedHash<strong_hash>>
suppressionMap_{};
suppressionMap_;
};
} // namespace xrpl

View File

@@ -55,7 +55,7 @@ public:
std::mutex mutexRun_;
std::condition_variable cv_;
boost::coroutines2::coroutine<void>::push_type* yield_{};
boost::coroutines2::coroutine<void>::pull_type coro_{};
boost::coroutines2::coroutine<void>::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. */

View File

@@ -160,7 +160,7 @@ public:
}
JobTypeInfo unknown;
Map map{};
Map map;
};
} // namespace xrpl

View File

@@ -66,7 +66,7 @@ public:
std::vector<PeerReservation>
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<PeerReservation, beast::Uhash<>, KeyEqual> table_{};
std::unordered_set<PeerReservation, beast::Uhash<>, KeyEqual> table_;
};
} // namespace xrpl

View File

@@ -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<ReadView const> const& lastClosedLedger,
std::vector<std::shared_ptr<STValidation>> 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: "

View File

@@ -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);

View File

@@ -43,7 +43,7 @@ public:
private:
std::recursive_mutex lock_;
hash_map<std::uint64_t, InfoSub::wptr> listeners_{};
hash_map<std::uint64_t, InfoSub::wptr> listeners_;
};
} // namespace xrpl

View File

@@ -17,7 +17,7 @@ private:
DigestAwareReadView const& base_;
CachedSLEs& cache_;
std::mutex mutable mutex_;
std::unordered_map<key_type, uint256, HardenedHash<>> mutable map_{};
std::unordered_map<key_type, uint256, HardenedHash<>> mutable map_;
public:
CachedViewImpl() = delete;

View File

@@ -148,7 +148,7 @@ public:
}
private:
std::map<Key, std::shared_ptr<STTx const>> map_{};
std::map<Key, std::shared_ptr<STTx const>> map_;
// Used to salt the accounts so people can't mine for low account numbers
uint256 salt_;

View File

@@ -162,7 +162,7 @@ public:
OpenView(ReadView const* base, std::shared_ptr<void const> 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<key_type>
std::optional<key_type>
succ(key_type const& key, std::optional<key_type> const& last = std::nullopt) const override;
[[nodiscard]] SLE::const_pointer
SLE::const_pointer
read(Keylet const& k) const override;
[[nodiscard]] std::unique_ptr<SlesType::iter_base>
std::unique_ptr<SlesType::iter_base>
slesBegin() const override;
[[nodiscard]] std::unique_ptr<SlesType::iter_base>
std::unique_ptr<SlesType::iter_base>
slesEnd() const override;
[[nodiscard]] std::unique_ptr<SlesType::iter_base>
std::unique_ptr<SlesType::iter_base>
slesUpperBound(uint256 const& key) const override;
[[nodiscard]] std::unique_ptr<TxsType::iter_base>
std::unique_ptr<TxsType::iter_base>
txsBegin() const override;
[[nodiscard]] std::unique_ptr<TxsType::iter_base>
std::unique_ptr<TxsType::iter_base>
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

View File

@@ -37,7 +37,7 @@ private:
struct IssuerValueMPT
{
IssuerValueMPT() = default;
std::map<AccountID, HolderValueMPT> holders{};
std::map<AccountID, HolderValueMPT> 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<KeyIOU, ValueIOU> creditsIOU_{};
std::map<MPTID, IssuerValueMPT> creditsMPT_{};
std::map<AccountID, std::uint32_t> ownerCounts_{};
std::map<KeyIOU, ValueIOU> creditsIOU_;
std::map<MPTID, IssuerValueMPT> creditsMPT_;
std::map<AccountID, std::uint32_t> ownerCounts_;
};
} // namespace detail

View File

@@ -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)
{

View File

@@ -26,7 +26,7 @@ private:
using items_t = std::map<key_type, std::pair<Action, SLE::pointer>>;
items_t items_{};
items_t items_;
XRPAmount dropsDestroyed_{0};
public:

View File

@@ -24,7 +24,7 @@ public:
RawStateTable()
: monotonicResource_{std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
kInitialBufferSize)}
, items_{monotonicResource_.get()} = default;
, items_{monotonicResource_.get()} {};
RawStateTable(RawStateTable const& rhs)
: monotonicResource_{std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
@@ -101,7 +101,7 @@ private:
boost::container::pmr::polymorphic_allocator<std::pair<key_type const, SleAction>>>;
// monotonic_resource_ must outlive `items_`. Make a pointer so it may be
// easily moved.
std::unique_ptr<boost::container::pmr::monotonic_buffer_resource> monotonicResource_{};
std::unique_ptr<boost::container::pmr::monotonic_buffer_resource> monotonicResource_;
items_t items_;
XRPAmount dropsDestroyed_{0};

View File

@@ -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");

View File

@@ -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>(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 {

View File

@@ -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)

View File

@@ -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

View File

@@ -12,7 +12,7 @@ namespace xrpl {
class MPTIssue
{
private:
MPTID mptID_{};
MPTID mptID_;
public:
MPTIssue() = default;

View File

@@ -11,7 +11,9 @@
#include <type_traits>
#include <utility>
namespace xrpl::detail {
namespace xrpl {
namespace detail {
template <typename T>
constexpr bool kIsIntegralConstant = false;
template <typename I, auto A>
@@ -182,8 +184,10 @@ struct MultiApiJson
}
};
} // namespace xrpl::detail
} // namespace detail
// Wrapper for Json for all supported API versions.
using MultiApiJson =
detail::MultiApiJson<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>;
} // namespace xrpl

View File

@@ -10,7 +10,7 @@ namespace xrpl {
class PathAsset
{
private:
std::variant<Currency, MPTID> easset_{};
std::variant<Currency, MPTID> 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 <ValidPathAsset T>
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); },

View File

@@ -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())
{

View File

@@ -556,12 +556,12 @@ STAmount::fromNumber(A const& a, Number const& number)
if (asset.integral())
{
std::uint64_t const intValue = static_cast<std::int64_t>(working);
return STAmount{asset, static_cast<uint32_t>(intValue), 0, negative};
return STAmount{asset, intValue, 0, negative};
}
auto const [mantissa, exponent] = working.normalizeToRange<kMinValue, kMaxValue>();
return STAmount{asset, static_cast<uint32_t>(mantissa), exponent, negative};
return STAmount{asset, mantissa, exponent, negative};
}
inline void

View File

@@ -10,7 +10,7 @@ class STArray final : public STBase, public CountedObject<STArray>
private:
using list_type = std::vector<STObject>;
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)
{

View File

@@ -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<Issue>() && !isConsistent(asset_.get<Issue>()))
Throw<std::runtime_error>("Invalid asset: currency and account native mismatch");

View File

@@ -118,7 +118,7 @@ private:
class STPath final : public CountedObject<STPath>
{
std::vector<STPathElement> path_{};
std::vector<STPathElement> path_;
public:
STPath() = default;
@@ -173,7 +173,7 @@ public:
// A set of zero or more payment paths
class STPathSet final : public STBase, public CountedObject<STPathSet>
{
std::vector<STPath> value_{};
std::vector<STPath> value_;
public:
STPathSet() = default;

View File

@@ -51,51 +51,51 @@ public:
STTx(TxType type, std::function<void(STObject&)> 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<AccountID>
boost::container::flat_set<AccountID>
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<void, std::string>
std::expected<void, std::string>
checkSign(Rules const& rules) const;
[[nodiscard]] std::expected<void, std::string>
std::expected<void, std::string>
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<uint256> const&
std::vector<uint256> 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<void, std::string>
std::expected<void, std::string>
checkSign(Rules const& rules, STObject const& sigObject) const;
[[nodiscard]] std::expected<void, std::string>
std::expected<void, std::string>
checkSingleSign(STObject const& sigObject) const;
[[nodiscard]] std::expected<void, std::string>
std::expected<void, std::string>
checkMultiSign(Rules const& rules, STObject const& sigObject) const;
[[nodiscard]] std::expected<void, std::string>
std::expected<void, std::string>
checkBatchSingleSign(STObject const& batchSigner) const;
[[nodiscard]] std::expected<void, std::string>
std::expected<void, std::string>
checkBatchMultiSign(STObject const& batchSigner, Rules const& rules) const;
STBase*

View File

@@ -36,7 +36,7 @@ class STValidation final : public STObject, public CountedObject<STValidation>
// 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;

View File

@@ -9,7 +9,7 @@ namespace xrpl {
class STVector256 : public STBase, public CountedObject<STVector256>
{
std::vector<uint256> value_{};
std::vector<uint256> value_;
public:
using value_type = std::vector<uint256> const&;

View File

@@ -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<int>(type), name);
@@ -372,25 +372,25 @@ public:
BaseUInt<Bits, Tag>
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>();

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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<JsonTypeMismatchError>(key, "uint64");

View File

@@ -87,7 +87,7 @@ public:
struct AccountTxResult
{
std::variant<AccountTxs, MetaTxsList> transactions{};
std::variant<AccountTxs, MetaTxsList> transactions;
LedgerRange ledgerRange{};
uint32_t limit = 0;
std::optional<AccountTxMarker> marker;

View File

@@ -93,7 +93,7 @@ convert(std::string const& from, soci::blob& to);
class Checkpointer : public std::enable_shared_from_this<Checkpointer>
{
public:
[[nodiscard]] virtual std::uintptr_t
virtual std::uintptr_t
id() const = 0;
virtual ~Checkpointer() = default;

View File

@@ -20,7 +20,7 @@ struct Gossip
beast::IP::Endpoint address;
};
std::vector<Item> items{};
std::vector<Item> items;
};
} // namespace xrpl::Resource

View File

@@ -239,10 +239,10 @@ private:
std::shared_mutex mutable mutex_;
/** Active manifests stored by master public key. */
hash_map<PublicKey, Manifest> map_{};
hash_map<PublicKey, Manifest> map_;
/** Master public keys stored by current ephemeral public key. */
hash_map<PublicKey, PublicKey> signingToMasterKeys_{};
hash_map<PublicKey, PublicKey> signingToMasterKeys_;
std::atomic<std::uint32_t> seq_{0};

View File

@@ -31,11 +31,11 @@ struct Port
std::string name;
boost::asio::ip::address ip;
std::uint16_t port = 0;
std::set<std::string, boost::beast::iless> protocol{};
std::vector<boost::asio::ip::network_v4> adminNetsV4{};
std::vector<boost::asio::ip::network_v6> adminNetsV6{};
std::vector<boost::asio::ip::network_v4> secureGatewayNetsV4{};
std::vector<boost::asio::ip::network_v6> secureGatewayNetsV6{};
std::set<std::string, boost::beast::iless> protocol;
std::vector<boost::asio::ip::network_v4> adminNetsV4;
std::vector<boost::asio::ip::network_v6> adminNetsV6;
std::vector<boost::asio::ip::network_v4> secureGatewayNetsV4;
std::vector<boost::asio::ip::network_v6> secureGatewayNetsV6;
std::string user;
std::string password;
std::string adminUser;
@@ -77,7 +77,7 @@ struct ParsedPort
explicit ParsedPort() = default;
std::string name;
std::set<std::string, boost::beast::iless> protocol{};
std::set<std::string, boost::beast::iless> protocol;
std::string user;
std::string password;
std::string adminUser;
@@ -92,10 +92,10 @@ struct ParsedPort
std::optional<boost::asio::ip::address> ip;
std::optional<std::uint16_t> port;
std::vector<boost::asio::ip::network_v4> adminNetsV4{};
std::vector<boost::asio::ip::network_v6> adminNetsV6{};
std::vector<boost::asio::ip::network_v4> secureGatewayNetsV4{};
std::vector<boost::asio::ip::network_v6> secureGatewayNetsV6{};
std::vector<boost::asio::ip::network_v4> adminNetsV4;
std::vector<boost::asio::ip::network_v6> adminNetsV6;
std::vector<boost::asio::ip::network_v4> secureGatewayNetsV4;
std::vector<boost::asio::ip::network_v6> secureGatewayNetsV6;
};
void

View File

@@ -49,14 +49,14 @@ protected:
memcpy(data.get(), ptr, len);
}
std::unique_ptr<char[]> data{};
std::unique_ptr<char[]> data;
std::size_t bytes;
std::size_t used{0};
};
Port const& port_;
Handler& handler_;
boost::asio::executor_work_guard<boost::asio::executor> work_{};
boost::asio::executor_work_guard<boost::asio::executor> work_;
boost::asio::strand<boost::asio::executor> 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<Buffer> wq_{};
std::vector<Buffer> wq2_{};
http_request_type message_;
std::vector<Buffer> wq_;
std::vector<Buffer> wq2_;
std::mutex mutex_;
bool graceful_ = false;
bool complete_ = false;
@@ -340,7 +340,7 @@ BaseHTTPPeer<Handler, Impl>::doWriter(
bool keepAlive,
yield_context doYield)
{
std::function<void(void)> const resume;
std::function<void(void)> resume;
{
auto const p = impl().shared_from_this();
resume = std::function<void(void)>([this, p, writer, keepAlive]() {

View File

@@ -31,7 +31,7 @@ protected:
beast::WrappedSink sink_;
beast::Journal const j_;
boost::asio::executor_work_guard<boost::asio::executor> work_{};
boost::asio::executor_work_guard<boost::asio::executor> work_;
boost::asio::strand<boost::asio::executor> strand_;
public:

View File

@@ -35,19 +35,19 @@ protected:
private:
friend class BasePeer<Handler, Impl>;
http_request_type request_{};
http_request_type request_;
boost::beast::multi_buffer rb_;
boost::beast::multi_buffer wb_;
std::list<std::shared_ptr<WSMsg>> wq_{};
std::list<std::shared_ptr<WSMsg>> 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<void(boost::beast::websocket::frame_type, boost::beast::string_view)>
controlCallback_;

View File

@@ -193,7 +193,7 @@ Door<Handler>::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 <class Handler>
void
Door<Handler>::reOpen()
{
error_code const ec;
error_code ec;
if (acceptor_.is_open())
{
@@ -306,7 +306,7 @@ Door<Handler>::close()
strand_, std::bind(&Door<Handler>::close, this->shared_from_this()));
}
backoffTimer_.cancel();
error_code const ec;
error_code ec;
acceptor_.close(ec);
}
@@ -343,13 +343,13 @@ Door<Handler>::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<Handler>::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);

View File

@@ -143,7 +143,7 @@ template <class Handler>
void
PlainHTTPPeer<Handler>::doClose()
{
boost::system::error_code const ec;
boost::system::error_code ec;
socket_.shutdown(socket_type::shutdown_send, ec);
}

View File

@@ -21,7 +21,7 @@ class PlainWSPeer : public BaseWSPeer<Handler, PlainWSPeer<Handler>>,
using waitable_timer = boost::asio::basic_waitable_timer<clock_type>;
using socket_type = boost::beast::tcp_stream;
boost::beast::websocket::stream<socket_type> ws_{};
boost::beast::websocket::stream<socket_type> ws_;
public:
template <class Body, class Headers>

View File

@@ -26,7 +26,7 @@ private:
using yield_context = boost::asio::yield_context;
using error_code = boost::system::error_code;
std::unique_ptr<stream_type> streamPtr_{};
std::unique_ptr<stream_type> streamPtr_;
stream_type& stream_;
socket_type& socket_;

View File

@@ -28,8 +28,8 @@ class SSLWSPeer : public BaseWSPeer<Handler, SSLWSPeer<Handler>>,
using stream_type = boost::beast::ssl_stream<socket_type>;
using waitable_timer = boost::asio::basic_waitable_timer<clock_type>;
std::unique_ptr<stream_type> streamPtr_{};
boost::beast::websocket::stream<stream_type&> ws_{};
std::unique_ptr<stream_type> streamPtr_;
boost::beast::websocket::stream<stream_type&> ws_;
public:
template <class Body, class Headers>

View File

@@ -68,11 +68,11 @@ private:
beast::Journal const j_;
boost::asio::io_context& ioContext_;
boost::asio::strand<boost::asio::io_context::executor_type> strand_;
std::optional<boost::asio::executor_work_guard<boost::asio::io_context::executor_type>> work_{};
std::optional<boost::asio::executor_work_guard<boost::asio::io_context::executor_type>> work_;
std::mutex m_;
std::vector<Port> ports_{};
std::vector<std::weak_ptr<Door<Handler>>> list_{};
std::vector<Port> ports_;
std::vector<std::weak_ptr<Door<Handler>>> list_;
int high_ = 0;
std::array<std::size_t, 64> hist_{};

View File

@@ -55,7 +55,7 @@ private:
std::size_t n_ = 0;
bool closed_ = false;
std::condition_variable cv_;
boost::container::flat_map<Work*, std::weak_ptr<Work>> map_{};
boost::container::flat_map<Work*, std::weak_ptr<Work>> map_;
std::function<void(void)> 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<void(void)> const f;
std::function<void(void)> f;
{
std::scoped_lock const lock(ios_->m_);
ios_->map_.erase(this);

View File

@@ -119,7 +119,7 @@ public:
}
private:
CacheType cache_{};
CacheType cache_;
std::atomic<std::uint32_t> gen_;
};

View File

@@ -466,8 +466,8 @@ private:
std::uint32_t generation;
// nodes we have discovered to be missing
std::vector<std::pair<SHAMapNodeID, uint256>> missingNodes{};
std::set<SHAMapHash> missingHashes{};
std::vector<std::pair<SHAMapNodeID, uint256>> missingNodes;
std::set<SHAMapHash> 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<StackEntry, std::deque<StackEntry>> stack{};
std::stack<StackEntry, std::deque<StackEntry>> 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<DeferredNode> finishedReads{};
std::vector<DeferredNode> finishedReads;
// nodes we need to resume after we get their children from deferred
// reads
std::map<SHAMapInnerNode*, SHAMapNodeID> resumes{};
std::map<SHAMapInnerNode*, SHAMapNodeID> 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;

View File

@@ -11,7 +11,7 @@ class TxQ;
struct ApplyResult
{
TER ter{};
TER ter;
bool applied;
std::optional<TxMeta> metadata;
@@ -156,7 +156,7 @@ public:
beast::Journal const j;
/// Intermediate transaction result
NotTEC const ter{};
NotTEC const ter;
/// Constructor
template <class Context>
@@ -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

View File

@@ -14,7 +14,7 @@ namespace xrpl {
class ValidBookDirectory
{
bool badBookDirectory_ = false;
hash_set<uint256> rootIndexes_{};
hash_set<uint256> rootIndexes_;
public:
void

View File

@@ -23,19 +23,19 @@ class TransfersNotFrozen
struct BalanceChange
{
SLE::const_pointer const line;
int const balanceChangeSign{};
int const balanceChangeSign;
};
struct IssuerChanges
{
std::vector<BalanceChange> senders{};
std::vector<BalanceChange> receivers{};
std::vector<BalanceChange> senders;
std::vector<BalanceChange> receivers;
};
using ByIssuer = std::map<Issue, IssuerChanges>;
ByIssuer balanceChanges_{};
ByIssuer balanceChanges_;
std::map<AccountID, SLE::const_pointer const> possibleIssuers_{};
std::map<AccountID, SLE::const_pointer const> possibleIssuers_;
public:
void

View File

@@ -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<std::pair<SLE::const_pointer, SLE::const_pointer>> accountsDeleted_{};
std::vector<std::pair<SLE::const_pointer, SLE::const_pointer>> accountsDeleted_;
public:
void
@@ -340,10 +340,10 @@ public:
*/
class ValidPseudoAccounts
{
std::vector<std::string> errors_{};
std::vector<std::string> errors_;
public:
static void
void
visitEntry(bool, SLE::const_ref, SLE::const_ref);
bool
@@ -360,10 +360,10 @@ public:
class NoModifiedUnmodifiableFields
{
// Pair is <before, after>.
std::set<std::pair<SLE::const_pointer, SLE::const_pointer>> changedEntries_{};
std::set<std::pair<SLE::const_pointer, SLE::const_pointer>> changedEntries_;
public:
static void
void
visitEntry(bool, SLE::const_ref, SLE::const_ref);
bool
@@ -375,7 +375,7 @@ public:
*/
class ValidAmounts
{
std::vector<std::shared_ptr<SLE const>> afterEntries_{};
std::vector<std::shared_ptr<SLE const>> afterEntries_;
public:
void

View File

@@ -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<uint256, BrokerInfo> brokers_{};
std::map<uint256, BrokerInfo> brokers_;
// Collect all the modified trust lines. Their high and low accounts will be
// loaded to look for LoanBroker pseudo-accounts.
std::vector<SLE::const_pointer> lines_{};
std::vector<SLE::const_pointer> lines_;
// Collect all the modified MPTokens. Their accounts will be loaded to look
// for LoanBroker pseudo-accounts.
std::vector<SLE::const_pointer> mpts_{};
std::vector<SLE::const_pointer> 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

View File

@@ -19,7 +19,7 @@ class ValidLoan
{
// Pair is <before, after>. After is used for most of the checks, except
// those that check changed values.
std::vector<std::pair<SLE::const_pointer, SLE::const_pointer>> loans_{};
std::vector<std::pair<SLE::const_pointer, SLE::const_pointer>> loans_;
public:
void

View File

@@ -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<std::shared_ptr<SLE const>> deletedHoldings_{};
std::vector<std::shared_ptr<SLE const>> 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<uint192, MPTData> data_{};
hash_map<uint192, MPTData> data_;
public:
void
@@ -79,10 +79,10 @@ class ValidMPTTransfer
std::optional<std::uint64_t> amtAfter;
};
// MPTID: {holder: Value}
hash_map<uint192, hash_map<AccountID, Value>> amount_{};
hash_map<uint192, hash_map<AccountID, Value>> amount_;
// Deleted MPToken
// MPToken key: true if MPTAuthorized is set
hash_map<uint256, bool> deletedAuthorized_{};
hash_map<uint256, bool> deletedAuthorized_;
public:
void

View File

@@ -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<uint256> domains_{};
hash_set<uint256> domains_;
public:
void

View File

@@ -28,7 +28,7 @@ class ValidPermissionedDomain
bool isUnique = false;
bool isDelete = false;
};
std::vector<SleStatus> sleStatus_{};
std::vector<SleStatus> sleStatus_;
public:
void

View File

@@ -75,11 +75,11 @@ public:
};
private:
std::vector<Vault> afterVault_{};
std::vector<Shares> afterMPTs_{};
std::vector<Vault> beforeVault_{};
std::vector<Shares> beforeMPTs_{};
std::unordered_map<uint256, DeltaInfo> deltas_{};
std::vector<Vault> afterVault_;
std::vector<Shares> afterMPTs_;
std::vector<Vault> beforeVault_;
std::vector<Shares> beforeMPTs_;
std::unordered_map<uint256, DeltaInfo> 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<DeltaInfo>
deltaAssets(AccountID const& id);
[[nodiscard]] std::optional<DeltaInfo>
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<DeltaInfo>
deltaAssetsTxAccount(STTx const& tx, XRPAmount fee);
[[nodiscard]] std::optional<DeltaInfo>
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<DeltaInfo>
deltaShares(AccountID const& id);
[[nodiscard]] std::optional<DeltaInfo>
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<DeltaInfo> const& numbers);
static void
void
visitEntry(bool, SLE::const_ref, SLE::const_ref);
bool

View File

@@ -300,7 +300,7 @@ using Strand = std::vector<std::unique_ptr<Step>>;
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)
{

View File

@@ -21,7 +21,7 @@ private:
enum class Operation { Unknown, Set, Destroy };
Operation do_{Operation::Unknown};
std::uint32_t quorum_{0};
std::vector<SignerEntries::SignerEntry> signers_{};
std::vector<SignerEntries::SignerEntry> 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

View File

@@ -15,7 +15,9 @@
#include <test/jtx/paths.h>
#include <test/jtx/pay.h>
#include <test/jtx/permissioned_dex.h>
#include <test/jtx/permissioned_domains.h>
#include <test/jtx/sendmax.h>
#include <test/jtx/ter.h>
#include <test/jtx/trust.h>
#include <test/jtx/txflags.h>
@@ -37,10 +39,15 @@
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/jss.h>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
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)");

View File

@@ -282,7 +282,7 @@ public:
std::optional<std::uint32_t> const& flags = std::nullopt,
std::optional<Ter> const& ter = std::nullopt);
static IOUAmount
IOUAmount
withdrawAll(
std::optional<Account> const& account,
std::optional<STAmount> const& asset1OutDetails = std::nullopt,
@@ -413,7 +413,7 @@ public:
struct Pool
{
AMM const& amm;
std::vector<json::StaticString> names{};
std::vector<json::StaticString> names;
Pool(AMM const& a, std::vector<json::StaticString> const& n = {}) : amm(a), names(n)
{
}

View File

@@ -144,10 +144,10 @@ private:
struct AppBundle
{
Application* app = nullptr;
std::unique_ptr<Application> owned{};
std::unique_ptr<Application> owned;
ManualTimeKeeper* timeKeeper = nullptr;
std::thread thread;
std::unique_ptr<AbstractClient> client{};
std::unique_ptr<AbstractClient> 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<AccountID, Account> map_{};
std::unordered_map<AccountID, Account> map_;
};
template <class... Args>

View File

@@ -22,7 +22,7 @@ class Env;
struct JTx
{
json::Value jv;
requires_t require{};
requires_t require;
std::optional<TER> ter = TER{tesSUCCESS};
std::optional<std::pair<ErrorCodeI, std::string>> rpcCode = std::nullopt;
std::optional<std::pair<std::string, std::optional<std::string>>> rpcException = std::nullopt;
@@ -32,10 +32,10 @@ struct JTx
bool fillNetid = true;
std::shared_ptr<STTx const> stx;
// Functions that sign the transaction from the Account
std::vector<std::function<void(Env&, JTx&)>> mainSigners{};
std::vector<std::function<void(Env&, JTx&)>> mainSigners;
// Functions that sign something else after the mainSigners, such as
// sfCounterpartySignature
std::vector<std::function<void(Env&, JTx&)>> postSigners{};
std::vector<std::function<void(Env&, JTx&)>> postSigners;
JTx() = default;
JTx(JTx const&) = default;
@@ -144,7 +144,7 @@ private:
PropList&
operator=(PropList&& src) = default;
std::vector<std::unique_ptr<BasicProp>> list{};
std::vector<std::unique_ptr<BasicProp>> list;
};
PropList props_;

View File

@@ -9,7 +9,7 @@ namespace xrpl::test {
class ManualTimeKeeper : public TimeKeeper
{
private:
std::atomic<time_point> now_{};
std::atomic<time_point> now_;
public:
ManualTimeKeeper() = default;

View File

@@ -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<bool>(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

View File

@@ -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;

View File

@@ -37,7 +37,7 @@ public:
class Ids
{
private:
std::vector<std::string> const credentials_{};
std::vector<std::string> const credentials_;
public:
explicit Ids(std::vector<std::string> creds) : credentials_(std::move(creds))

View File

@@ -38,7 +38,7 @@ signers(Account const& account, NoneT);
class Msig
{
public:
std::vector<Reg> signers{};
std::vector<Reg> signers;
/** Alternative transaction object field in which to place the signer list.
*
* subField is only supported if an account_ is provided as well.

View File

@@ -12,7 +12,7 @@ namespace xrpl::test::jtx {
class Ter
{
private:
std::optional<TER> v_{};
std::optional<TER> v_;
public:
explicit Ter(decltype(std::ignore))

View File

@@ -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;
}

View File

@@ -46,7 +46,7 @@ public:
using TxIDSeqVec = std::vector<TxIDSeq>;
private:
TxIDSeqVec tracker_{};
TxIDSeqVec tracker_;
public:
RCLCensorshipDetector() = default;

View File

@@ -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();

View File

@@ -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, {}});
}

View File

@@ -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();

View File

@@ -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<Tx::ID, bool>
compare(RCLTxSet const& j)
[[nodiscard]] std::map<Tx::ID, bool>
compare(RCLTxSet const& j) const
{
SHAMap::Delta delta;

View File

@@ -573,7 +573,7 @@ private:
Ledger_t previousLedger_;
// Transaction Sets, indexed by hash of transaction tree
hash_map<typename TxSet_t::ID, TxSet_t const> acquired_{};
hash_map<typename TxSet_t::ID, TxSet_t const> acquired_;
std::optional<Result> result_;
ConsensusCloseTimes rawCloseTimes_;
@@ -589,17 +589,17 @@ private:
// Peer related consensus data
// Peer proposed positions for the current round
hash_map<NodeID_t, PeerPosition_t> currPeerPositions_{};
hash_map<NodeID_t, PeerPosition_t> currPeerPositions_;
// Recently received peer positions, available when transitioning between
// ledgers or rounds
hash_map<NodeID_t, std::deque<PeerPosition_t>> recentPeerPositions_{};
hash_map<NodeID_t, std::deque<PeerPosition_t>> 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<NodeID_t> deadNodes_{};
hash_set<NodeID_t> deadNodes_;
// Journal for debugging
beast::Journal const j_;
@@ -887,7 +887,7 @@ Consensus<Adaptor>::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<Adaptor>::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<Adaptor>::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<Adaptor>::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<Adaptor>::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<Adaptor>::updateOurPositions(std::unique_ptr<std::stringstream> 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<Adaptor>::updateOurPositions(std::unique_ptr<std::stringstream> 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();

View File

@@ -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_)

View File

@@ -158,7 +158,7 @@ struct ConsensusCloseTimes
explicit ConsensusCloseTimes() = default;
//! Close time estimates, keep ordered for predictable traverse
std::map<NetClock::time_point, int> peers{};
std::map<NetClock::time_point, int> 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<typename Tx_t::ID, Dispute_t> disputes{};
hash_map<typename Tx_t::ID, Dispute_t> disputes;
// Set of TxSet ids we have already compared/created disputes
hash_set<typename TxSet_t::ID> compares{};
hash_set<typename TxSet_t::ID> compares;
// Measures the duration of the establish phase for this consensus round
ConsensusTimer roundTime;

View File

@@ -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<Tx, NodeId>::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);

View File

@@ -192,7 +192,7 @@ struct Node
std::uint32_t tipSupport = 0;
std::uint32_t branchSupport = 0;
std::vector<std::unique_ptr<Node>> children{};
std::vector<std::unique_ptr<Node>> 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<Node> root_{};
std::unique_ptr<Node> root_;
// Count of the tip support for each sequence number
std::map<Seq, std::uint32_t> seqSupport_{};
std::map<Seq, std::uint32_t> 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<Node>()} = default;
LedgerTrie() : root_{std::make_unique<Node>()}
{
}
/** 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;

View File

@@ -282,13 +282,13 @@ class Validations
mutable Mutex mutex_;
// Validations from currently listed and trusted nodes (partial and full)
hash_map<NodeID, Validation> current_{};
hash_map<NodeID, Validation> current_;
// Used to enforce the largest validation invariant for the local node
SeqEnforcer<Seq> localSeqEnforcer_;
// Sequence of the largest validation received from each node
hash_map<NodeID, SeqEnforcer<Seq>> seqEnforcers_{};
hash_map<NodeID, SeqEnforcer<Seq>> 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<NodeID, Ledger> lastLedger_{};
hash_map<NodeID, Ledger> lastLedger_;
// Set of ledgers being acquired from the network
hash_map<std::pair<Seq, ID>, hash_set<NodeID>> acquiring_{};
hash_map<std::pair<Seq, ID>, hash_set<NodeID>> acquiring_;
// Parameters to determine validation staleness
ValidationParms const parms_;

View File

@@ -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;

View File

@@ -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<PublicKey> const&
std::optional<PublicKey> const&
getValidatorKey() const
{
return validatorKey_;