Merge branch 'develop' into gregtatcam/mpt/assorted-fixes-dev

This commit is contained in:
Gregory Tsipenyuk
2026-05-15 13:03:33 -04:00
648 changed files with 6582 additions and 6686 deletions

View File

@@ -171,7 +171,7 @@ CheckOptions:
readability-identifier-naming.EnumCase: CamelCase
readability-identifier-naming.EnumConstantCase: CamelCase
readability-identifier-naming.ScopedEnumConstantCase: CamelCase
readability-identifier-naming.GlobalConstantCase: UPPER_CASE
readability-identifier-naming.GlobalConstantCase: CamelCase
readability-identifier-naming.GlobalConstantPrefix: "k"
readability-identifier-naming.GlobalVariableCase: CamelCase
readability-identifier-naming.GlobalVariablePrefix: "g"
@@ -179,14 +179,12 @@ CheckOptions:
readability-identifier-naming.ConstexprMethodCase: camelBack
readability-identifier-naming.ClassMethodCase: camelBack
readability-identifier-naming.ClassMemberCase: camelBack
readability-identifier-naming.ClassConstantCase: UPPER_CASE
readability-identifier-naming.ClassConstantCase: CamelCase
readability-identifier-naming.ClassConstantPrefix: "k"
readability-identifier-naming.StaticConstantCase: UPPER_CASE
readability-identifier-naming.StaticConstantCase: CamelCase
readability-identifier-naming.StaticConstantPrefix: "k"
readability-identifier-naming.StaticVariableCase: UPPER_CASE
readability-identifier-naming.StaticVariablePrefix: "k"
readability-identifier-naming.ConstexprVariableCase: UPPER_CASE
readability-identifier-naming.ConstexprVariablePrefix: "k"
readability-identifier-naming.StaticVariableCase: camelBack
readability-identifier-naming.ConstexprVariableCase: camelBack
readability-identifier-naming.LocalConstantCase: camelBack
readability-identifier-naming.LocalVariableCase: camelBack
readability-identifier-naming.TemplateParameterCase: CamelCase

View File

@@ -62,7 +62,7 @@ ${SED_COMMAND} -i 's@ripple/@xrpld/@g' src/test/core/Config_test.cpp
${SED_COMMAND} -i 's/Rippled/File/g' src/test/core/Config_test.cpp
# Restore the old config file name in the code that maintains support for now.
${SED_COMMAND} -i 's/kCONFIG_LEGACY_NAME = "xrpld.cfg"/kCONFIG_LEGACY_NAME = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp
# Restore an URL.
${SED_COMMAND} -i 's/connect-your-xrpld-to-the-xrp-test-net.html/connect-your-rippled-to-the-xrp-test-net.html/g' cfg/xrpld-example.cfg

View File

@@ -90,7 +90,7 @@ ${SED_COMMAND} -i 's/www.ripple.com/www.xrpl.org/g' src/test/protocol/Seed_test.
# Restore specific changes.
${SED_COMMAND} -i 's@b5efcc/src/xrpld@b5efcc/src/ripple@' include/xrpl/protocol/README.md
${SED_COMMAND} -i 's/dbPrefix_ = "xrpldb"/dbPrefix_ = "rippledb"/' src/xrpld/app/misc/SHAMapStoreImp.h # cspell: disable-line
${SED_COMMAND} -i 's/kCONFIG_LEGACY_NAME = "xrpld.cfg"/kCONFIG_LEGACY_NAME = "rippled.cfg"/' src/xrpld/core/detail/Config.cpp
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/' src/xrpld/core/detail/Config.cpp
popd
echo "Renaming complete."

View File

@@ -406,8 +406,8 @@ private:
// pointer. The low bit must be masked to zero when converting back to a
// pointer. If the low bit is '1', this is a weak pointer.
std::uintptr_t tp_{0};
static constexpr std::uintptr_t kTAG_MASK = 1;
static constexpr std::uintptr_t kPTR_MASK = ~kTAG_MASK;
static constexpr std::uintptr_t kTagMask = 1;
static constexpr std::uintptr_t kPtrMask = ~kTagMask;
private:
/** Return the raw pointer held by this object.

View File

@@ -567,14 +567,14 @@ template <class T>
bool
SharedWeakUnion<T>::isStrong() const
{
return (tp_ & kTAG_MASK) == 0u;
return (tp_ & kTagMask) == 0u;
}
template <class T>
bool
SharedWeakUnion<T>::isWeak() const
{
return (tp_ & kTAG_MASK) != 0u;
return (tp_ & kTagMask) != 0u;
}
template <class T>
@@ -641,7 +641,7 @@ template <class T>
T*
SharedWeakUnion<T>::unsafeGetRawPtr() const
{
return reinterpret_cast<T*>(tp_ & kPTR_MASK);
return reinterpret_cast<T*>(tp_ & kPtrMask);
}
template <class T>
@@ -650,7 +650,7 @@ SharedWeakUnion<T>::unsafeSetRawPtr(T* p, RefStrength rs)
{
tp_ = reinterpret_cast<std::uintptr_t>(p);
if (tp_ && rs == RefStrength::Weak)
tp_ |= kTAG_MASK;
tp_ |= kTagMask;
}
template <class T>

View File

@@ -98,11 +98,11 @@ private:
// enough for strong pointers and 14 bit counts are enough for weak
// pointers. Use type aliases to make it easy to switch types.
using CountType = std::uint16_t;
static constexpr size_t kSTRONG_COUNT_NUM_BITS = sizeof(CountType) * 8;
static constexpr size_t kWEAK_COUNT_NUM_BITS = kSTRONG_COUNT_NUM_BITS - 2;
static constexpr size_t kStrongCountNumBits = sizeof(CountType) * 8;
static constexpr size_t kWeakCountNumBits = kStrongCountNumBits - 2;
using FieldType = std::uint32_t;
static constexpr size_t kFIELD_TYPE_BITS = sizeof(FieldType) * 8;
static constexpr FieldType kONE = 1;
static constexpr size_t kFieldTypeBits = sizeof(FieldType) * 8;
static constexpr FieldType kOne = 1;
/** `refCounts` consists of four fields that are treated atomically:
@@ -137,21 +137,21 @@ private:
*/
mutable std::atomic<FieldType> refCounts_{kSTRONG_DELTA};
mutable std::atomic<FieldType> refCounts_{kStrongDelta};
/** Amount to change the strong count when adding or releasing a reference
Note: The strong count is stored in the low `StrongCountNumBits` bits
of refCounts
*/
static constexpr FieldType kSTRONG_DELTA = 1;
static constexpr FieldType kStrongDelta = 1;
/** Amount to change the weak count when adding or releasing a reference
Note: The weak count is stored in the high `WeakCountNumBits` bits of
refCounts
*/
static constexpr FieldType kWEAK_DELTA = (kONE << kSTRONG_COUNT_NUM_BITS);
static constexpr FieldType kWeakDelta = (kOne << kStrongCountNumBits);
/** Flag that is set when the partialDestroy function has started running
(or is about to start running).
@@ -159,34 +159,33 @@ private:
See description of the `refCounts` field for a fuller description of
this field.
*/
static constexpr FieldType kPARTIAL_DESTROY_STARTED_MASK = (kONE << (kFIELD_TYPE_BITS - 1));
static constexpr FieldType kPartialDestroyStartedMask = (kOne << (kFieldTypeBits - 1));
/** Flag that is set when the partialDestroy function has finished running
See description of the `refCounts` field for a fuller description of
this field.
*/
static constexpr FieldType kPARTIAL_DESTROY_FINISHED_MASK = (kONE << (kFIELD_TYPE_BITS - 2));
static constexpr FieldType kPartialDestroyFinishedMask = (kOne << (kFieldTypeBits - 2));
/** Mask that will zero out all the `count` bits and leave the tag bits
unchanged.
*/
static constexpr FieldType kTAG_MASK =
kPARTIAL_DESTROY_STARTED_MASK | kPARTIAL_DESTROY_FINISHED_MASK;
static constexpr FieldType kTagMask = kPartialDestroyStartedMask | kPartialDestroyFinishedMask;
/** Mask that will zero out the `tag` bits and leave the count bits
unchanged.
*/
static constexpr FieldType kVALUE_MASK = ~kTAG_MASK;
static constexpr FieldType kValueMask = ~kTagMask;
/** Mask that will zero out everything except the strong count.
*/
static constexpr FieldType kSTRONG_MASK = ((kONE << kSTRONG_COUNT_NUM_BITS) - 1) & kVALUE_MASK;
static constexpr FieldType kStrongMask = ((kOne << kStrongCountNumBits) - 1) & kValueMask;
/** Mask that will zero out everything except the weak count.
*/
static constexpr FieldType kWEAK_MASK =
(((kONE << kWEAK_COUNT_NUM_BITS) - 1) << kSTRONG_COUNT_NUM_BITS) & kVALUE_MASK;
static constexpr FieldType kWeakMask =
(((kOne << kWeakCountNumBits) - 1) << kStrongCountNumBits) & kValueMask;
/** Unpack the count and tag fields from the packed atomic integer form. */
struct RefCountPair
@@ -211,29 +210,29 @@ private:
[[nodiscard]] FieldType
combinedValue() const noexcept;
static constexpr CountType kMAX_STRONG_VALUE =
static_cast<CountType>((kONE << kSTRONG_COUNT_NUM_BITS) - 1);
static constexpr CountType kMAX_WEAK_VALUE =
static_cast<CountType>((kONE << kWEAK_COUNT_NUM_BITS) - 1);
static constexpr CountType kMaxStrongValue =
static_cast<CountType>((kOne << kStrongCountNumBits) - 1);
static constexpr CountType kMaxWeakValue =
static_cast<CountType>((kOne << kWeakCountNumBits) - 1);
/** Put an extra margin to detect when running up against limits.
This is only used in debug code, and is useful if we reduce the
number of bits in the strong and weak counts (to 16 and 14 bits).
*/
static constexpr CountType kCHECK_STRONG_MAX_VALUE = kMAX_STRONG_VALUE - 32;
static constexpr CountType kCHECK_WEAK_MAX_VALUE = kMAX_WEAK_VALUE - 32;
static constexpr CountType kCheckStrongMaxValue = kMaxStrongValue - 32;
static constexpr CountType kCheckWeakMaxValue = kMaxWeakValue - 32;
};
};
inline void
IntrusiveRefCounts::addStrongRef() const noexcept
{
refCounts_.fetch_add(kSTRONG_DELTA, std::memory_order_acq_rel);
refCounts_.fetch_add(kStrongDelta, std::memory_order_acq_rel);
}
inline void
IntrusiveRefCounts::addWeakRef() const noexcept
{
refCounts_.fetch_add(kWEAK_DELTA, std::memory_order_acq_rel);
refCounts_.fetch_add(kWeakDelta, std::memory_order_acq_rel);
}
inline ReleaseStrongRefAction
@@ -252,10 +251,10 @@ IntrusiveRefCounts::releaseStrongRef() const
{
RefCountPair const prevVal{prevIntVal};
XRPL_ASSERT(
(prevVal.strong >= kSTRONG_DELTA),
(prevVal.strong >= kStrongDelta),
"xrpl::IntrusiveRefCounts::releaseStrongRef : previous ref "
"higher than new");
auto nextIntVal = prevIntVal - kSTRONG_DELTA;
auto nextIntVal = prevIntVal - kStrongDelta;
ReleaseStrongRefAction action = NoOp;
if (prevVal.strong == 1)
{
@@ -265,7 +264,7 @@ IntrusiveRefCounts::releaseStrongRef() const
}
else
{
nextIntVal |= kPARTIAL_DESTROY_STARTED_MASK;
nextIntVal |= kPartialDestroyStartedMask;
action = PartialDestroy;
}
}
@@ -276,7 +275,7 @@ IntrusiveRefCounts::releaseStrongRef() const
// count to zero can start a partial destroy, and that can't happen
// twice.
XRPL_ASSERT(
(action == NoOp) || !(prevIntVal & kPARTIAL_DESTROY_STARTED_MASK),
(action == NoOp) || !(prevIntVal & kPartialDestroyStartedMask),
"xrpl::IntrusiveRefCounts::releaseStrongRef : not in partial "
"destroy");
return action;
@@ -289,8 +288,8 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
{
using enum ReleaseStrongRefAction;
static_assert(kWEAK_DELTA > kSTRONG_DELTA);
auto constexpr kDELTA = kWEAK_DELTA - kSTRONG_DELTA;
static_assert(kWeakDelta > kStrongDelta);
static constexpr auto kDelta = kWeakDelta - kStrongDelta;
auto prevIntVal = refCounts_.load(std::memory_order_acquire);
// This loop will almost always run once. The loop is needed to atomically
// change the counts and flags (the count could be atomically changed, but
@@ -312,7 +311,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not in "
"partial destroy");
auto nextIntVal = prevIntVal + kDELTA;
auto nextIntVal = prevIntVal + kDelta;
ReleaseStrongRefAction action = NoOp;
if (prevVal.strong == 1)
{
@@ -322,14 +321,14 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
}
else
{
nextIntVal |= kPARTIAL_DESTROY_STARTED_MASK;
nextIntVal |= kPartialDestroyStartedMask;
action = PartialDestroy;
}
}
if (refCounts_.compare_exchange_weak(prevIntVal, nextIntVal, std::memory_order_acq_rel))
{
XRPL_ASSERT(
(!(prevIntVal & kPARTIAL_DESTROY_STARTED_MASK)),
(!(prevIntVal & kPartialDestroyStartedMask)),
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not "
"started partial destroy");
return action;
@@ -340,7 +339,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
inline ReleaseWeakRefAction
IntrusiveRefCounts::releaseWeakRef() const
{
auto prevIntVal = refCounts_.fetch_sub(kWEAK_DELTA, std::memory_order_acq_rel);
auto prevIntVal = refCounts_.fetch_sub(kWeakDelta, std::memory_order_acq_rel);
RefCountPair prev = prevIntVal;
if (prev.weak == 1 && prev.strong == 0)
{
@@ -357,7 +356,7 @@ IntrusiveRefCounts::releaseWeakRef() const
{
// partial destroy MUST finish before running a full destroy (when
// using weak pointers)
refCounts_.wait(prevIntVal - kWEAK_DELTA, std::memory_order_acquire);
refCounts_.wait(prevIntVal - kWeakDelta, std::memory_order_acquire);
}
return ReleaseWeakRefAction::Destroy;
}
@@ -376,7 +375,7 @@ IntrusiveRefCounts::checkoutStrongRefFromWeak() const noexcept
if (prev.strong == 0u)
return false;
desiredValue = curValue + kSTRONG_DELTA;
desiredValue = curValue + kStrongDelta;
}
return true;
}
@@ -400,23 +399,22 @@ inline IntrusiveRefCounts::~IntrusiveRefCounts() noexcept
#ifndef NDEBUG
auto v = refCounts_.load(std::memory_order_acquire);
XRPL_ASSERT(
(!(v & kVALUE_MASK)), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
auto t = v & kTAG_MASK;
XRPL_ASSERT(
(!t || t == kTAG_MASK), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
(!(v & kValueMask)), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
auto t = v & kTagMask;
XRPL_ASSERT((!t || t == kTagMask), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
#endif
}
//------------------------------------------------------------------------------
inline IntrusiveRefCounts::RefCountPair::RefCountPair(IntrusiveRefCounts::FieldType v) noexcept
: strong{static_cast<CountType>(v & kSTRONG_MASK)}
, weak{static_cast<CountType>((v & kWEAK_MASK) >> kSTRONG_COUNT_NUM_BITS)}
, partialDestroyStartedBit{v & kPARTIAL_DESTROY_STARTED_MASK}
, partialDestroyFinishedBit{v & kPARTIAL_DESTROY_FINISHED_MASK}
: strong{static_cast<CountType>(v & kStrongMask)}
, weak{static_cast<CountType>((v & kWeakMask) >> kStrongCountNumBits)}
, partialDestroyStartedBit{v & kPartialDestroyStartedMask}
, partialDestroyFinishedBit{v & kPartialDestroyFinishedMask}
{
XRPL_ASSERT(
(strong < kCHECK_STRONG_MAX_VALUE && weak < kCHECK_WEAK_MAX_VALUE),
(strong < kCheckStrongMaxValue && weak < kCheckWeakMaxValue),
"xrpl::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside "
"range");
}
@@ -427,7 +425,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair(
: strong{s}, weak{w}
{
XRPL_ASSERT(
(strong < kCHECK_STRONG_MAX_VALUE && weak < kCHECK_WEAK_MAX_VALUE),
(strong < kCheckStrongMaxValue && weak < kCheckWeakMaxValue),
"xrpl::IntrusiveRefCounts::RefCountPair(CountType, CountType) : "
"inputs inside range");
}
@@ -436,11 +434,11 @@ inline IntrusiveRefCounts::FieldType
IntrusiveRefCounts::RefCountPair::combinedValue() const noexcept
{
XRPL_ASSERT(
(strong < kCHECK_STRONG_MAX_VALUE && weak < kCHECK_WEAK_MAX_VALUE),
(strong < kCheckStrongMaxValue && weak < kCheckWeakMaxValue),
"xrpl::IntrusiveRefCounts::RefCountPair::combinedValue : inputs "
"inside range");
return (static_cast<IntrusiveRefCounts::FieldType>(weak)
<< IntrusiveRefCounts::kSTRONG_COUNT_NUM_BITS) |
<< IntrusiveRefCounts::kStrongCountNumBits) |
static_cast<IntrusiveRefCounts::FieldType>(strong) | partialDestroyStartedBit |
partialDestroyFinishedBit;
}
@@ -451,7 +449,7 @@ partialDestructorFinished(T** o)
{
T& self = **o;
IntrusiveRefCounts::RefCountPair const p =
self.refCounts_.fetch_or(IntrusiveRefCounts::kPARTIAL_DESTROY_FINISHED_MASK);
self.refCounts_.fetch_or(IntrusiveRefCounts::kPartialDestroyFinishedMask);
XRPL_ASSERT(
(!p.partialDestroyFinishedBit && p.partialDestroyStartedBit && !p.strong),
"xrpl::partialDestructorFinished : not a weak ref");

View File

@@ -55,8 +55,8 @@ template <class = void>
boost::thread_specific_ptr<detail::LocalValues>&
getLocalValues()
{
static boost::thread_specific_ptr<detail::LocalValues> kTSP(&detail::LocalValues::cleanup);
return kTSP;
static boost::thread_specific_ptr<detail::LocalValues> kTsp(&detail::LocalValues::cleanup);
return kTsp;
}
} // namespace detail

View File

@@ -191,7 +191,7 @@ public:
private:
// Maximum line length for log messages.
// If the message exceeds this length it will be truncated with ellipses.
static constexpr auto kMAXIMUM_MESSAGE_CHARACTERS = 12 * 1024;
static constexpr auto kMaximumMessageCharacters = 12 * 1024;
static void
format(

View File

@@ -214,12 +214,12 @@ class Number
public:
// The range for the exponent when normalized
constexpr static int kMIN_EXPONENT = -32768;
constexpr static int kMAX_EXPONENT = 32768;
static constexpr int kMinExponent = -32768;
static constexpr int kMaxExponent = 32768;
constexpr static internalrep kMAX_REP = std::numeric_limits<rep>::max();
static_assert(kMAX_REP == 9'223'372'036'854'775'807);
static_assert(-kMAX_REP == std::numeric_limits<rep>::min() + 1);
static constexpr internalrep kMaxRep = std::numeric_limits<rep>::max();
static_assert(kMaxRep == 9'223'372'036'854'775'807);
static_assert(-kMaxRep == std::numeric_limits<rep>::min() + 1);
// May need to make unchecked private
struct Unchecked
@@ -409,26 +409,26 @@ public:
static internalrep
minMantissa()
{
return kRANGE.get().min;
return kRange.get().min;
}
static internalrep
maxMantissa()
{
return kRANGE.get().max;
return kRange.get().max;
}
static int
mantissaLog()
{
return kRANGE.get().log;
return kRange.get().log;
}
/// oneSmall is needed because the ranges are private
constexpr static Number
static constexpr Number
oneSmall();
/// oneLarge is needed because the ranges are private
constexpr static Number
static constexpr Number
oneLarge();
// And one is needed because it needs to choose between oneSmall and
@@ -445,25 +445,25 @@ private:
static thread_local RoundingMode mode;
// The available ranges for mantissa
constexpr static MantissaRange kSMALL_RANGE{MantissaRange::MantissaScale::Small};
static_assert(isPowerOfTen(kSMALL_RANGE.min));
static_assert(kSMALL_RANGE.min == 1'000'000'000'000'000LL);
static_assert(kSMALL_RANGE.max == 9'999'999'999'999'999LL);
static_assert(kSMALL_RANGE.log == 15);
static_assert(kSMALL_RANGE.min < kMAX_REP);
static_assert(kSMALL_RANGE.max < kMAX_REP);
constexpr static MantissaRange kLARGE_RANGE{MantissaRange::MantissaScale::Large};
static_assert(isPowerOfTen(kLARGE_RANGE.min));
static_assert(kLARGE_RANGE.min == 1'000'000'000'000'000'000ULL);
static_assert(kLARGE_RANGE.max == internalrep(9'999'999'999'999'999'999ULL));
static_assert(kLARGE_RANGE.log == 18);
static_assert(kLARGE_RANGE.min < kMAX_REP);
static_assert(kLARGE_RANGE.max > kMAX_REP);
static constexpr MantissaRange kSmallRange{MantissaRange::MantissaScale::Small};
static_assert(isPowerOfTen(kSmallRange.min));
static_assert(kSmallRange.min == 1'000'000'000'000'000LL);
static_assert(kSmallRange.max == 9'999'999'999'999'999LL);
static_assert(kSmallRange.log == 15);
static_assert(kSmallRange.min < kMaxRep);
static_assert(kSmallRange.max < kMaxRep);
static constexpr MantissaRange kLargeRange{MantissaRange::MantissaScale::Large};
static_assert(isPowerOfTen(kLargeRange.min));
static_assert(kLargeRange.min == 1'000'000'000'000'000'000ULL);
static_assert(kLargeRange.max == internalrep(9'999'999'999'999'999'999ULL));
static_assert(kLargeRange.log == 18);
static_assert(kLargeRange.min < kMaxRep);
static_assert(kLargeRange.max > kMaxRep);
// The range for the mantissa when normalized.
// Use reference_wrapper to avoid making copies, and prevent accidentally
// changing the values inside the range.
static thread_local std::reference_wrapper<MantissaRange const> kRANGE;
static thread_local std::reference_wrapper<MantissaRange const> kRange;
void
normalize();
@@ -471,7 +471,7 @@ private:
/** Normalize Number components to an arbitrary range.
*
* min/maxMantissa are parameters because this function is used by both
* normalize(), which reads from kRANGE, and by normalizeToRange,
* normalize(), which reads from kRange, and by normalizeToRange,
* which is public and can accept an arbitrary range from the caller.
*/
template <class T>
@@ -521,7 +521,7 @@ constexpr Number::Number(internalrep mantissa, int exponent, Unchecked) noexcept
{
}
constexpr static Number kNUM_ZERO{};
static constexpr Number kNumZero{};
inline Number::Number(bool negative, internalrep mantissa, int exponent, Normalized)
: Number(negative, mantissa, exponent, Unchecked{})
@@ -552,10 +552,10 @@ constexpr Number::rep
Number::mantissa() const noexcept
{
auto m = mantissa_;
if (m > kMAX_REP)
if (m > kMaxRep)
{
XRPL_ASSERT_PARTS(
!isnormal() || (m % 10 == 0 && m / 10 <= kMAX_REP),
!isnormal() || (m % 10 == 0 && m / 10 <= kMaxRep),
"xrpl::Number::mantissa",
"large normalized mantissa has no remainder");
m /= 10;
@@ -573,10 +573,10 @@ constexpr int
Number::exponent() const noexcept
{
auto e = exponent_;
if (mantissa_ > kMAX_REP)
if (mantissa_ > kMaxRep)
{
XRPL_ASSERT_PARTS(
!isnormal() || (mantissa_ % 10 == 0 && mantissa_ / 10 <= kMAX_REP),
!isnormal() || (mantissa_ % 10 == 0 && mantissa_ / 10 <= kMaxRep),
"xrpl::Number::exponent",
"large normalized mantissa has no remainder");
++e;
@@ -671,29 +671,29 @@ operator/(Number const& x, Number const& y)
inline Number
Number::min() noexcept
{
return Number{false, kRANGE.get().min, kMIN_EXPONENT, Unchecked{}};
return Number{false, kRange.get().min, kMinExponent, Unchecked{}};
}
inline Number
Number::max() noexcept
{
return Number{false, std::min(kRANGE.get().max, kMAX_REP), kMAX_EXPONENT, Unchecked{}};
return Number{false, std::min(kRange.get().max, kMaxRep), kMaxExponent, Unchecked{}};
}
inline Number
Number::lowest() noexcept
{
return Number{true, std::min(kRANGE.get().max, kMAX_REP), kMAX_EXPONENT, Unchecked{}};
return Number{true, std::min(kRange.get().max, kMaxRep), kMaxExponent, Unchecked{}};
}
inline bool
Number::isnormal() const noexcept
{
MantissaRange const& range = kRANGE;
MantissaRange const& range = kRange;
auto const absM = mantissa_;
return *this == Number{} ||
(range.min <= absM && absM <= range.max && (absM <= kMAX_REP || absM % 10 == 0) &&
kMIN_EXPONENT <= exponent_ && exponent_ <= kMAX_EXPONENT);
(range.min <= absM && absM <= range.max && (absM <= kMaxRep || absM % 10 == 0) &&
kMinExponent <= exponent_ && exponent_ <= kMaxExponent);
}
template <Integral64 T>

View File

@@ -57,10 +57,10 @@ template <class T>
std::shared_ptr<T> const&
SharedWeakCachePointer<T>::getStrong() const
{
static std::shared_ptr<T> const kEMPTY;
static std::shared_ptr<T> const kEmpty;
if (auto p = std::get_if<std::shared_ptr<T>>(&combo_))
return *p;
return kEMPTY;
return kEmpty;
}
template <class T>

View File

@@ -34,7 +34,7 @@ template <typename T>
concept SomeChar = std::same_as<std::remove_cvref_t<T>, int8_t> ||
std::same_as<std::remove_cvref_t<T>, char> || std::same_as<std::remove_cvref_t<T>, uint8_t>;
inline constexpr std::array<std::optional<int>, 256> const kDIGIT_LOOKUP_TABLE = []() {
inline constexpr std::array<std::optional<int>, 256> const kDigitLookupTable = []() {
std::array<std::optional<int>, 256> t{};
for (int i = 0; i < 10; ++i)
@@ -52,7 +52,7 @@ inline constexpr std::array<std::optional<int>, 256> const kDIGIT_LOOKUP_TABLE =
inline std::optional<int>
hexCharToInt(SomeChar auto hexChar)
{
return kDIGIT_LOOKUP_TABLE[static_cast<uint8_t>(hexChar)];
return kDigitLookupTable[static_cast<uint8_t>(hexChar)];
}
} // namespace detail

View File

@@ -30,8 +30,8 @@ public:
now(); // seconds since xrpld program start
private:
static std::atomic<rep> kNOW;
static std::atomic<bool> kSTOP;
static std::atomic<rep> kNow;
static std::atomic<bool> kStop;
struct UpdateThread : private std::thread
{

View File

@@ -73,12 +73,12 @@ class BaseUInt
static_assert(Bits >= 64, "The length of a base_uint in bits must be at least 64.");
static constexpr std::size_t kWIDTH = Bits / 32;
static constexpr std::size_t kWidth = Bits / 32;
// This is really big-endian in byte order.
// We sometimes use std::uint32_t for speed.
std::array<std::uint32_t, kWIDTH> data_;
std::array<std::uint32_t, kWidth> data_;
public:
//--------------------------------------------------------------------------
@@ -86,8 +86,8 @@ public:
// STL Container Interface
//
static std::size_t constexpr kBYTES = Bits / 8;
static_assert(sizeof(data_) == kBYTES, "");
static constexpr std::size_t kBytes = Bits / 8;
static_assert(sizeof(data_) == kBytes, "");
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
@@ -121,7 +121,7 @@ public:
iterator
end()
{
return data() + kBYTES;
return data() + kBytes;
}
[[nodiscard]] const_iterator
begin() const
@@ -131,7 +131,7 @@ public:
[[nodiscard]] const_iterator
end() const
{
return data() + kBYTES;
return data() + kBytes;
}
[[nodiscard]] const_iterator
cbegin() const
@@ -141,7 +141,7 @@ public:
[[nodiscard]] const_iterator
cend() const
{
return data() + kBYTES;
return data() + kBytes;
}
/** Value hashing function.
@@ -167,7 +167,7 @@ private:
explicit BaseUInt(void const* data, VoidHelper)
{
memcpy(data_.data(), data, kBYTES);
memcpy(data_.data(), data, kBytes);
}
// Helper function to initialize a base_uint from a std::string_view.
@@ -336,7 +336,7 @@ public:
[[nodiscard]] constexpr int
signum() const
{
for (int i = 0; i < kWIDTH; i++)
for (int i = 0; i < kWidth; i++)
{
if (data_[i] != 0)
return 1;
@@ -348,7 +348,7 @@ public:
bool
operator!() const
{
return *this == beast::kZERO;
return *this == beast::kZero;
}
constexpr BaseUInt
@@ -356,7 +356,7 @@ public:
{
BaseUInt ret;
for (int i = 0; i < kWIDTH; i++)
for (int i = 0; i < kWidth; i++)
ret.data_[i] = ~data_[i];
return ret;
@@ -365,7 +365,7 @@ public:
BaseUInt&
operator=(std::uint64_t uHost)
{
*this = beast::kZERO;
*this = beast::kZero;
// NOLINTBEGIN(cppcoreguidelines-pro-type-member-init)
union
{
@@ -375,15 +375,15 @@ public:
// NOLINTEND(cppcoreguidelines-pro-type-member-init)
// Put in least significant bits.
ul = boost::endian::native_to_big(uHost);
data_[kWIDTH - 2] = u[0];
data_[kWIDTH - 1] = u[1];
data_[kWidth - 2] = u[0];
data_[kWidth - 1] = u[1];
return *this;
}
BaseUInt&
operator^=(BaseUInt const& b)
{
for (int i = 0; i < kWIDTH; i++)
for (int i = 0; i < kWidth; i++)
data_[i] ^= b.data_[i];
return *this;
@@ -392,7 +392,7 @@ public:
BaseUInt&
operator&=(BaseUInt const& b)
{
for (int i = 0; i < kWIDTH; i++)
for (int i = 0; i < kWidth; i++)
data_[i] &= b.data_[i];
return *this;
@@ -401,7 +401,7 @@ public:
BaseUInt&
operator|=(BaseUInt const& b)
{
for (int i = 0; i < kWIDTH; i++)
for (int i = 0; i < kWidth; i++)
data_[i] |= b.data_[i];
return *this;
@@ -411,7 +411,7 @@ public:
operator++()
{
// prefix operator
for (int i = kWIDTH - 1; i >= 0; --i)
for (int i = kWidth - 1; i >= 0; --i)
{
data_[i] = boost::endian::native_to_big(boost::endian::big_to_native(data_[i]) + 1);
if (data_[i] != 0)
@@ -434,7 +434,7 @@ public:
BaseUInt&
operator--()
{
for (int i = kWIDTH - 1; i >= 0; --i)
for (int i = kWidth - 1; i >= 0; --i)
{
auto prev = data_[i];
data_[i] = boost::endian::native_to_big(boost::endian::big_to_native(data_[i]) - 1);
@@ -475,7 +475,7 @@ public:
{
std::uint64_t carry = 0;
for (int i = kWIDTH - 1; i >= 0; i--)
for (int i = kWidth - 1; i >= 0; i--)
{
std::uint64_t const n = carry + boost::endian::big_to_native(data_[i]) +
boost::endian::big_to_native(b.data_[i]);
@@ -526,10 +526,10 @@ public:
return parseHex(std::string_view{str});
}
constexpr static std::size_t
static constexpr std::size_t
size()
{
return kBYTES;
return kBytes;
}
BaseUInt<Bits, Tag>&
@@ -543,17 +543,17 @@ public:
[[nodiscard]] bool
isZero() const
{
return *this == beast::kZERO;
return *this == beast::kZero;
}
[[nodiscard]] bool
isNonZero() const
{
return *this != beast::kZERO;
return *this != beast::kZero;
}
void
zero()
{
*this = beast::kZERO;
*this = beast::kZero;
}
};
@@ -639,7 +639,7 @@ template <std::size_t Bits, class Tag>
inline std::string
toShortString(BaseUInt<Bits, Tag> const& a)
{
static_assert(BaseUInt<Bits, Tag>::kBYTES > 4, "For 4 bytes or less, use a native type");
static_assert(BaseUInt<Bits, Tag>::kBytes > 4, "For 4 bytes or less, use a native type");
return strHex(a.cbegin(), a.cbegin() + 4) + "...";
}

View File

@@ -30,10 +30,10 @@ using weeks = std::chrono::duration<int, std::ratio_multiply<days::period, std::
= seconds(946684800)
*/
constexpr static std::chrono::seconds kEPOCH_OFFSET =
static constexpr std::chrono::seconds kEpochOffset =
date::sys_days{date::year{2000} / 1 / 1} - date::sys_days{date::year{1970} / 1 / 1};
static_assert(kEPOCH_OFFSET.count() == 946684800);
static_assert(kEpochOffset.count() == 946684800);
class NetClock
{
@@ -60,7 +60,7 @@ to_string(NetClock::time_point tp)
{
// 2000-01-01 00:00:00 UTC is 946684800s from 1970-01-01 00:00:00 UTC
using namespace std::chrono;
return to_string(system_clock::time_point{tp.time_since_epoch() + kEPOCH_OFFSET});
return to_string(system_clock::time_point{tp.time_since_epoch() + kEpochOffset});
}
template <class Duration>
@@ -77,7 +77,7 @@ toStringIso(NetClock::time_point tp)
// 2000-01-01 00:00:00 UTC is 946684800s from 1970-01-01 00:00:00 UTC
// Note, NetClock::duration is seconds, as checked by static_assert
static_assert(std::is_same_v<NetClock::duration::period, std::ratio<1>>);
return toStringIso(date::sys_time<NetClock::duration>{tp.time_since_epoch() + kEPOCH_OFFSET});
return toStringIso(date::sys_time<NetClock::duration>{tp.time_since_epoch() + kEpochOffset});
}
/** A clock for measuring elapsed time.

View File

@@ -31,9 +31,9 @@ makeSeedPair() noexcept
// state_t(state_t const&) = delete;
// state_t& operator=(state_t const&) = delete;
};
static StateT kSTATE;
std::scoped_lock const lock(kSTATE.mutex);
return {kSTATE.dist(kSTATE.gen), kSTATE.dist(kSTATE.gen)};
static StateT kState;
std::scoped_lock const lock(kState.mutex);
return {kState.dist(kState.gen), kState.dist(kState.gen)};
}
} // namespace detail

View File

@@ -5,7 +5,7 @@
#include <optional>
namespace xrpl {
auto constexpr kMULDIV_MAX = std::numeric_limits<std::uint64_t>::max();
constexpr auto kMuldivMax = std::numeric_limits<std::uint64_t>::max();
/** Return value*mul/div accurately.
Computes the result of the multiplication and division in

View File

@@ -47,7 +47,7 @@ inline beast::xor_shift_engine&
defaultPrng()
{
// This is used to seed the thread-specific PRNGs on demand
static beast::xor_shift_engine kSEEDER = [] {
static beast::xor_shift_engine kSeeder = [] {
std::random_device rng;
std::uniform_int_distribution<std::uint64_t> distribution{1};
return beast::xor_shift_engine(distribution(rng));
@@ -57,17 +57,17 @@ defaultPrng()
static std::mutex kM;
// The thread-specific PRNGs:
thread_local beast::xor_shift_engine kENGINE = [] {
thread_local beast::xor_shift_engine kEngine = [] {
std::uint64_t seed = 0;
{
std::scoped_lock const lk(kM);
std::uniform_int_distribution<std::uint64_t> distribution{1};
seed = distribution(kSEEDER);
seed = distribution(kSeeder);
}
return beast::xor_shift_engine{seed};
}();
return kENGINE;
return kEngine;
}
/** Return a uniformly distributed random integer.

View File

@@ -22,9 +22,9 @@ safeCast(Src s) noexcept
{
static_assert(
std::is_signed_v<Dest> || std::is_unsigned_v<Src>, "Cannot cast signed to unsigned");
constexpr unsigned kNOT_SAME = std::is_signed_v<Dest> != std::is_signed_v<Src>;
constexpr unsigned kNotSame = std::is_signed_v<Dest> != std::is_signed_v<Src>;
static_assert(
sizeof(Dest) >= sizeof(Src) + kNOT_SAME,
sizeof(Dest) >= sizeof(Src) + kNotSame,
"Destination is too small to hold all values of source");
return static_cast<Dest>(s);
}

View File

@@ -83,8 +83,8 @@ template <class Facade, class Clock = Facade>
AbstractClock<Facade>&
getAbstractClock()
{
static detail::AbstractClockWrapper<Facade, Clock> kCLOCK;
return kCLOCK;
static detail::AbstractClockWrapper<Facade, Clock> kClock;
return kClock;
}
} // namespace beast

View File

@@ -21,7 +21,7 @@ setCurrentThreadName(std::string_view newThreadName);
// On Linux, thread names are limited to 16 bytes including the null terminator.
// Maximum number of characters is therefore 15.
constexpr std::size_t kMAX_THREAD_NAME_LENGTH = 15;
constexpr std::size_t kMaxThreadNameLength = 15;
/** Sets the name of the caller thread with compile-time size checking.
@tparam N The size of the string literal including null terminator
@@ -34,7 +34,7 @@ template <std::size_t N>
void
setCurrentThreadName(char const (&newThreadName)[N])
{
static_assert(N <= kMAX_THREAD_NAME_LENGTH + 1, "Thread name cannot exceed 15 characters");
static_assert(N <= kMaxThreadNameLength + 1, "Thread name cannot exceed 15 characters");
setCurrentThreadName(std::string_view(newThreadName, N - 1));
}

View File

@@ -53,7 +53,7 @@ inline void
maybeReverseBytes(T& t, Hasher&)
{
maybeReverseBytes(
t, std::integral_constant<bool, Hasher::kENDIAN != boost::endian::order::native>{});
t, std::integral_constant<bool, Hasher::kEndian != boost::endian::order::native>{});
}
} // namespace detail
@@ -154,7 +154,7 @@ struct IsContiguouslyHashable
: public std::integral_constant<
bool,
IsUniquelyRepresented<T>::value &&
(sizeof(T) == 1 || HashAlgorithm::kENDIAN == boost::endian::order::native)>
(sizeof(T) == 1 || HashAlgorithm::kEndian == boost::endian::order::native)>
{
explicit IsContiguouslyHashable() = default;
};

View File

@@ -21,9 +21,9 @@ private:
static_assert(sizeof(std::size_t) == 8, "requires 64-bit std::size_t");
// Have an internal buffer to avoid the streaming API
// A 64-byte buffer should to be big enough for us
static constexpr std::size_t kINTERNAL_BUFFER_SIZE = 64;
static constexpr std::size_t kInternalBufferSize = 64;
alignas(64) std::array<std::uint8_t, kINTERNAL_BUFFER_SIZE> buffer_{};
alignas(64) std::array<std::uint8_t, kInternalBufferSize> buffer_{};
std::span<std::uint8_t> readBuffer_;
std::span<std::uint8_t> writeBuffer_;
@@ -102,7 +102,7 @@ private:
}
public:
static constexpr auto const kENDIAN = boost::endian::order::native;
static constexpr auto kEndian = boost::endian::order::native;
Xxhasher(Xxhasher const&) = delete;
Xxhasher&

View File

@@ -62,7 +62,7 @@ private:
{
using run_time = std::pair<std::string, typename clock_type::duration>;
static constexpr auto kMAX_TOP = 10;
static constexpr auto kMaxTop = 10;
std::size_t suites = 0;
std::size_t cases = 0;
@@ -146,11 +146,11 @@ Reporter<Unused>::Results::add(SuiteResults const& r)
});
if (iter != top.end())
{
if (top.size() == kMAX_TOP)
if (top.size() == kMaxTop)
top.resize(top.size() - 1);
top.emplace(iter, r.name, elapsed);
}
else if (top.size() < kMAX_TOP)
else if (top.size() < kMaxTop)
{
top.emplace_back(r.name, elapsed);
}

View File

@@ -299,8 +299,8 @@ private:
static Suite**
pThisSuite()
{
static Suite* kP_TS = nullptr; // NOLINT TODO
return &kP_TS;
static Suite* kPTs = nullptr; // NOLINT TODO
return &kPTs;
}
/** Runs the suite. */

View File

@@ -27,7 +27,7 @@ struct Zero
};
namespace {
constexpr Zero kZERO{};
constexpr Zero kZero{};
} // namespace
/** Default implementation of signum calls the method on the class. */
@@ -102,42 +102,42 @@ template <typename T>
bool
operator==(Zero, T const& t)
{
return t == kZERO;
return t == kZero;
}
template <typename T>
bool
operator!=(Zero, T const& t)
{
return t != kZERO;
return t != kZero;
}
template <typename T>
bool
operator<(Zero, T const& t)
{
return t > kZERO;
return t > kZero;
}
template <typename T>
bool
operator>(Zero, T const& t)
{
return t < kZERO;
return t < kZero;
}
template <typename T>
bool
operator>=(Zero, T const& t)
{
return t <= kZERO;
return t <= kZero;
}
template <typename T>
bool
operator<=(Zero, T const& t)
{
return t >= kZERO;
return t >= kZero;
}
} // namespace beast

View File

@@ -14,23 +14,23 @@ void
rngfill(void* const buffer, std::size_t const bytes, Generator& g)
{
using result_type = typename Generator::result_type;
constexpr std::size_t kRESULT_SIZE = sizeof(result_type);
constexpr std::size_t kResultSize = sizeof(result_type);
std::uint8_t* const bufferStart = static_cast<std::uint8_t*>(buffer);
std::size_t const completeIterations = bytes / kRESULT_SIZE;
std::size_t const bytesRemaining = bytes % kRESULT_SIZE;
std::size_t const completeIterations = bytes / kResultSize;
std::size_t const bytesRemaining = bytes % kResultSize;
for (std::size_t count = 0; count < completeIterations; ++count)
{
result_type const v = g();
std::size_t const offset = count * kRESULT_SIZE;
std::memcpy(bufferStart + offset, &v, kRESULT_SIZE);
std::size_t const offset = count * kResultSize;
std::memcpy(bufferStart + offset, &v, kResultSize);
}
if (bytesRemaining > 0)
{
result_type const v = g();
std::size_t const offset = completeIterations * kRESULT_SIZE;
std::size_t const offset = completeIterations * kResultSize;
std::memcpy(bufferStart + offset, &v, bytesRemaining);
}
}

View File

@@ -26,12 +26,14 @@ public:
result_type
operator()();
static result_type constexpr min()
static constexpr result_type
min()
{
return std::numeric_limits<result_type>::min();
}
static result_type constexpr max()
static constexpr result_type
max()
{
return std::numeric_limits<result_type>::max();
}

View File

@@ -27,7 +27,7 @@ public:
that were previously considered valid to no longer
be allowed.
*/
static constexpr std::size_t kMAX_SERIALIZED_CONDITION = 128;
static constexpr std::size_t kMaxSerializedCondition = 128;
/** Load a condition from its binary form

View File

@@ -16,7 +16,7 @@ public:
that were previously considered valid to no longer
be allowed.
*/
static constexpr std::size_t kMAX_SERIALIZED_FULFILLMENT = 256;
static constexpr std::size_t kMaxSerializedFulfillment = 256;
/** Load a fulfillment from its binary form

View File

@@ -23,7 +23,7 @@ public:
While future versions of this code will never lower
this limit, they may opt to raise it.
*/
static constexpr std::size_t kMAX_PREIMAGE_LENGTH = 128;
static constexpr std::size_t kMaxPreimageLength = 128;
/** Parse the payload for a PreimageSha256 condition
@@ -65,7 +65,7 @@ public:
return {};
}
if (s.size() > kMAX_PREIMAGE_LENGTH)
if (s.size() > kMaxPreimageLength)
{
ec = Error::PreimageTooLong;
return {};

View File

@@ -6,7 +6,7 @@ namespace xrpl {
/// Coroutine stack size (1.5 MB). Increased from 1 MB because
/// ASAN-instrumented deep call stacks exceeded the original limit.
constexpr std::size_t kCORO_STACK_SIZE = 1536 * 1024;
constexpr std::size_t kCoroStackSize = 1536 * 1024;
template <class F>
JobQueue::Coro::Coro(CoroCreateT, JobQueue& jq, JobType type, std::string name, F&& f)
@@ -14,7 +14,7 @@ JobQueue::Coro::Coro(CoroCreateT, JobQueue& jq, JobType type, std::string name,
, type_(type)
, name_(std::move(name))
, coro_(
boost::context::protected_fixedsize_stack(kCORO_STACK_SIZE),
boost::context::protected_fixedsize_stack(kCoroStackSize),
[this, fn = std::forward<F>(f)](boost::coroutines2::coroutine<void>::push_type& doYield) {
yield_ = &doYield;
yield();

View File

@@ -101,8 +101,8 @@ public:
static JobTypes const&
instance()
{
static JobTypes const kTYPES;
return kTYPES;
static JobTypes const kTypes;
return kTypes;
}
static std::string const&

View File

@@ -67,7 +67,7 @@ public:
[[nodiscard]] std::string
getFormattedErrorMessages() const;
static constexpr unsigned kNEST_LIMIT{25};
static constexpr unsigned kNestLimit{25};
private:
enum class TokenType {

View File

@@ -102,8 +102,8 @@ operator!=(StaticString x, std::string const& y)
/** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
*
* This class is a discriminated union wrapper that can represent a:
* - signed integer [range: Value::kMIN_INT - Value::kMAX_INT]
* - unsigned integer (range: 0 - Value::kMAX_UINT)
* - signed integer [range: Value::kMinInt - Value::kMaxInt]
* - unsigned integer (range: 0 - Value::kMaxUInt)
* - double
* - UTF-8 string
* - boolean
@@ -138,10 +138,10 @@ public:
using Int = json::Int;
using ArrayIndex = UInt;
static Value const kNULL;
static constexpr Int kMIN_INT = std::numeric_limits<Int>::min();
static constexpr Int kMAX_INT = std::numeric_limits<Int>::max();
static constexpr UInt kMAX_UINT = std::numeric_limits<UInt>::max();
static Value const kNull;
static constexpr Int kMinInt = std::numeric_limits<Int>::min();
static constexpr Int kMaxInt = std::numeric_limits<Int>::max();
static constexpr UInt kMaxUInt = std::numeric_limits<UInt>::max();
private:
class CZString
@@ -472,7 +472,7 @@ operator>=(Value const& x, Value const& y)
class ValueAllocator
{
public:
static constexpr auto kUNKNOWN = (unsigned)-1;
static constexpr auto kUnknown = (unsigned)-1;
virtual ~ValueAllocator() = default;
@@ -481,7 +481,7 @@ public:
virtual void
releaseMemberName(char* memberName) = 0;
virtual char*
duplicateStringValue(char const* value, unsigned int length = kUNKNOWN) = 0;
duplicateStringValue(char const* value, unsigned int length = kUnknown) = 0;
virtual void
releaseStringValue(char* value) = 0;
};

View File

@@ -24,7 +24,7 @@ struct CreateGenesisT
{
explicit CreateGenesisT() = default;
};
extern CreateGenesisT const kCREATE_GENESIS;
extern CreateGenesisT const kCreateGenesis;
/** Holds a ledger.

View File

@@ -12,7 +12,7 @@ namespace xrpl {
Values should not be duplicated.
@see getNextLedgerTimeResolution
*/
std::chrono::seconds constexpr kLEDGER_POSSIBLE_TIME_RESOLUTIONS[] = {
constexpr std::chrono::seconds kLedgerPossibleTimeResolutions[] = {
std::chrono::seconds{10},
std::chrono::seconds{20},
std::chrono::seconds{30},
@@ -21,16 +21,16 @@ std::chrono::seconds constexpr kLEDGER_POSSIBLE_TIME_RESOLUTIONS[] = {
std::chrono::seconds{120}};
//! Initial resolution of ledger close time.
auto constexpr kLEDGER_DEFAULT_TIME_RESOLUTION = kLEDGER_POSSIBLE_TIME_RESOLUTIONS[2];
constexpr auto kLedgerDefaultTimeResolution = kLedgerPossibleTimeResolutions[2];
//! Close time resolution in genesis ledger
auto constexpr kLEDGER_GENESIS_TIME_RESOLUTION = kLEDGER_POSSIBLE_TIME_RESOLUTIONS[0];
constexpr auto kLedgerGenesisTimeResolution = kLedgerPossibleTimeResolutions[0];
//! How often we increase the close time resolution (in numbers of ledgers)
auto constexpr kINCREASE_LEDGER_TIME_RESOLUTION_EVERY = 8;
constexpr auto kIncreaseLedgerTimeResolutionEvery = 8;
//! How often we decrease the close time resolution (in numbers of ledgers)
auto constexpr kDECREASE_LEDGER_TIME_RESOLUTION_EVERY = 1;
constexpr auto kDecreaseLedgerTimeResolutionEvery = 1;
/** Calculates the close time resolution for the specified ledger.
@@ -46,7 +46,7 @@ auto constexpr kDECREASE_LEDGER_TIME_RESOLUTION_EVERY = 1;
@param ledgerSeq the sequence number of the new ledger
@pre previousResolution must be a valid bin
from @ref kLEDGER_POSSIBLE_TIME_RESOLUTIONS
from @ref kLedgerPossibleTimeResolutions
@tparam Rep Type representing number of ticks in std::chrono::duration
@tparam Period An std::ratio representing tick period in
@@ -67,30 +67,30 @@ getNextLedgerTimeResolution(
using namespace std::chrono;
// Find the current resolution:
auto iter = std::find(
std::begin(kLEDGER_POSSIBLE_TIME_RESOLUTIONS),
std::end(kLEDGER_POSSIBLE_TIME_RESOLUTIONS),
std::begin(kLedgerPossibleTimeResolutions),
std::end(kLedgerPossibleTimeResolutions),
previousResolution);
XRPL_ASSERT(
iter != std::end(kLEDGER_POSSIBLE_TIME_RESOLUTIONS),
iter != std::end(kLedgerPossibleTimeResolutions),
"xrpl::getNextLedgerTimeResolution : found time resolution");
// This should never happen, but just as a precaution
if (iter == std::end(kLEDGER_POSSIBLE_TIME_RESOLUTIONS))
if (iter == std::end(kLedgerPossibleTimeResolutions))
return previousResolution;
// If we did not previously agree, we try to decrease the resolution to
// improve the chance that we will agree now.
if (!previousAgree && (ledgerSeq % Seq{kDECREASE_LEDGER_TIME_RESOLUTION_EVERY} == Seq{0}))
if (!previousAgree && (ledgerSeq % Seq{kDecreaseLedgerTimeResolutionEvery} == Seq{0}))
{
if (++iter != std::end(kLEDGER_POSSIBLE_TIME_RESOLUTIONS))
if (++iter != std::end(kLedgerPossibleTimeResolutions))
return *iter;
}
// If we previously agreed, we try to increase the resolution to determine
// if we can continue to agree.
if (previousAgree && (ledgerSeq % Seq{kINCREASE_LEDGER_TIME_RESOLUTION_EVERY} == Seq{0}))
if (previousAgree && (ledgerSeq % Seq{kIncreaseLedgerTimeResolutionEvery} == Seq{0}))
{
if (iter-- != std::begin(kLEDGER_POSSIBLE_TIME_RESOLUTIONS))
if (iter-- != std::begin(kLedgerPossibleTimeResolutions))
return *iter;
}

View File

@@ -23,7 +23,7 @@ namespace xrpl {
inline constexpr struct OpenLedgerT
{
explicit constexpr OpenLedgerT() = default;
} kOPEN_LEDGER{};
} kOpenLedger{};
/** Batch view construction tag.
@@ -33,7 +33,7 @@ inline constexpr struct OpenLedgerT
inline constexpr struct BatchViewT
{
explicit constexpr BatchViewT() = default;
} kBATCH_VIEW{};
} kBatchView{};
//------------------------------------------------------------------------------
@@ -47,7 +47,7 @@ private:
// Initial size for the monotonic_buffer_resource used for allocations
// The size was chosen from the old `qalloc` code (which this replaces).
// It is unclear how the size initially chosen in qalloc.
static constexpr size_t kINITIAL_BUFFER_SIZE = kilobytes(256);
static constexpr size_t kInitialBufferSize = kilobytes(256);
class TxsIterImpl;
@@ -139,7 +139,7 @@ public:
std::shared_ptr<void const> hold = nullptr);
OpenView(OpenLedgerT, Rules const& rules, std::shared_ptr<ReadView const> const& base)
: OpenView(kOPEN_LEDGER, &*base, rules, base)
: OpenView(kOpenLedger, &*base, rules, base)
{
}

View File

@@ -19,16 +19,16 @@ public:
// Initial size for the monotonic_buffer_resource used for allocations
// The size was chosen from the old `qalloc` code (which this replaces).
// It is unclear how the size initially chosen in qalloc.
static constexpr size_t kINITIAL_BUFFER_SIZE = kilobytes(256);
static constexpr size_t kInitialBufferSize = kilobytes(256);
RawStateTable()
: monotonic_resource_{std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
kINITIAL_BUFFER_SIZE)}
kInitialBufferSize)}
, items_{monotonic_resource_.get()} {};
RawStateTable(RawStateTable const& rhs)
: monotonic_resource_{std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
kINITIAL_BUFFER_SIZE)}
kInitialBufferSize)}
, items_{rhs.items_, monotonic_resource_.get()}
, dropsDestroyed_{rhs.dropsDestroyed_} {};

View File

@@ -25,11 +25,11 @@ namespace detail {
Number
reduceOffer(auto const& amount)
{
static Number const kREDUCED_OFFER_PCT(9999, -4);
static Number const kReducedOfferPct(9999, -4);
// Make sure the result is always less than amount or zero.
NumberRoundModeGuard const mg(Number::RoundingMode::TowardsZero);
return amount * kREDUCED_OFFER_PCT;
return amount * kReducedOfferPct;
}
} // namespace detail
@@ -177,7 +177,7 @@ getAMMOfferStartWithTakerGets(
Quality const& targetQuality,
std::uint16_t const& tfee)
{
if (targetQuality.rate() == beast::kZERO)
if (targetQuality.rate() == beast::kZero)
return std::nullopt;
NumberRoundModeGuard const mg(Number::RoundingMode::ToNearest);
@@ -244,7 +244,7 @@ getAMMOfferStartWithTakerPays(
Quality const& targetQuality,
std::uint16_t tfee)
{
if (targetQuality.rate() == beast::kZERO)
if (targetQuality.rate() == beast::kZero)
return std::nullopt;
NumberRoundModeGuard const mg(Number::RoundingMode::ToNearest);

View File

@@ -111,7 +111,7 @@ escrowUnlockApplyHelper<Issue>(
// whereas in a normal payment, the transfer fee is taken on top of the
// sending amount.
auto finalAmt = amount;
if ((!senderIssuer && !receiverIssuer) && lockedRate != kPARITY_RATE)
if ((!senderIssuer && !receiverIssuer) && lockedRate != kParityRate)
{
// compute transfer fee, if any
auto const xferFee =
@@ -211,7 +211,7 @@ escrowUnlockApplyHelper<MPTIssue>(
// whereas in a normal payment, the transfer fee is taken on top of the
// sending amount.
auto finalAmt = amount;
if ((!senderIssuer && !receiverIssuer) && lockedRate != kPARITY_RATE)
if ((!senderIssuer && !receiverIssuer) && lockedRate != kParityRate)
{
// compute transfer fee, if any
auto const xferFee = amount.value() - divideRound(amount, lockedRate, amount.asset(), true);

View File

@@ -10,7 +10,7 @@ namespace xrpl {
bool
checkLendingProtocolDependencies(Rules const& rules, STTx const& tx);
static constexpr std::uint32_t kSECONDS_IN_YEAR = 365 * 24 * 60 * 60;
static constexpr std::uint32_t kSecondsInYear = 365 * 24 * 60 * 60;
Number
loanPeriodicRate(TenthBips32 interestRate, std::uint32_t paymentInterval);
@@ -42,14 +42,14 @@ struct LoanPaymentParts
// The amount of principal paid that reduces the loan balance.
// This amount is subtracted from sfPrincipalOutstanding in the Loan object
// and paid to the Vault
Number principalPaid = kNUM_ZERO;
Number principalPaid = kNumZero;
// The total amount of interest paid to the Vault.
// This includes:
// - Tracked interest from the amortization schedule
// - Untracked interest (e.g., late payment penalty interest)
// This value is always non-negative.
Number interestPaid = kNUM_ZERO;
Number interestPaid = kNumZero;
// The change in the loan's total value outstanding.
// - If valueChange < 0: Loan value decreased
@@ -62,7 +62,7 @@ struct LoanPaymentParts
// - Late payments add penalty interest to the loan value
// - Early full payment may increase or decrease the loan value based on
// terms
Number valueChange = kNUM_ZERO;
Number valueChange = kNumZero;
/* The total amount of fees paid to the Broker.
* This includes:
@@ -70,7 +70,7 @@ struct LoanPaymentParts
* - Untracked fees (e.g., late payment fees, service fees, origination
* fees) This value is always non-negative.
*/
Number feePaid = kNUM_ZERO;
Number feePaid = kNumZero;
LoanPaymentParts&
operator+=(LoanPaymentParts const& other);
@@ -161,7 +161,7 @@ adjustImpreciseNumber(
{
value = roundToAsset(asset, value + adjustment, vaultScale);
if (*value < beast::kZERO)
if (*value < beast::kZero)
value = 0;
}
@@ -169,7 +169,7 @@ inline int
getAssetsTotalScale(SLE::const_ref vaultSle)
{
if (!vaultSle)
return Number::kMIN_EXPONENT - 1; // LCOV_EXCL_LINE
return Number::kMinExponent - 1; // LCOV_EXCL_LINE
return scale(vaultSle->at(sfAssetsTotal), vaultSle->at(sfAsset));
}
@@ -311,7 +311,7 @@ struct ExtendedPaymentComponents : public PaymentComponents
// borrower is sufficient to cover all components of the payment.
Number totalDue;
ExtendedPaymentComponents(PaymentComponents const& p, Number fee, Number interest = kNUM_ZERO)
ExtendedPaymentComponents(PaymentComponents const& p, Number fee, Number interest = kNumZero)
: PaymentComponents(p)
, untrackedManagementFee(fee)
, untrackedInterest(interest)

View File

@@ -20,7 +20,7 @@ class HTTPClient
public:
explicit HTTPClient() = default;
static constexpr auto kMAX_CLIENT_HEADER_BYTES = kilobytes(32);
static constexpr auto kMaxClientHeaderBytes = kilobytes(32);
static void
initializeSSLContext(

View File

@@ -29,7 +29,7 @@ enum class NodeObjectType : std::uint32_t {
class NodeObject : public CountedObject<NodeObject>
{
public:
static constexpr std::size_t kKEY_BYTES = 32;
static constexpr std::size_t kKeyBytes = 32;
private:
// This hack is used to make the constructor effectively private

View File

@@ -9,13 +9,13 @@ namespace xrpl::NodeStore {
// This is only used to pre-allocate the array for
// batch objects and does not affect the amount written.
//
static constexpr auto kBATCH_WRITE_PREALLOCATION_SIZE = 256;
static constexpr auto kBatchWritePreallocationSize = 256;
// This sets a limit on the maximum number of writes
// in a batch. Actual usage can be twice this since
// we have a new batch growing as we write the old.
//
static constexpr auto kBATCH_WRITE_LIMIT_SIZE = 65536;
static constexpr auto kBatchWriteLimitSize = 65536;
/** Return codes from Backend operations. */
enum class Status {

View File

@@ -55,7 +55,7 @@ lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf)
using std::runtime_error;
using namespace nudb::detail;
std::pair<void const*, std::size_t> result;
std::array<std::uint8_t, varint_traits<std::size_t>::kMAX> vi{};
std::array<std::uint8_t, varint_traits<std::size_t>::kMax> vi{};
auto const n = writeVarint(vi.data(), inSize);
auto const outMax = LZ4_compressBound(inSize);
std::uint8_t* out = reinterpret_cast<std::uint8_t*>(bf(n + outMax));
@@ -254,12 +254,12 @@ nodeobjectCompress(void const* in, std::size_t inSize, BufferFactory&& bf)
}
}
std::array<std::uint8_t, varint_traits<std::size_t>::kMAX> vi{};
std::array<std::uint8_t, varint_traits<std::size_t>::kMax> vi{};
constexpr std::size_t kCODEC_TYPE = 1;
auto const vn = writeVarint(vi.data(), kCODEC_TYPE);
static constexpr std::size_t kCodecType = 1;
auto const vn = writeVarint(vi.data(), kCodecType);
std::pair<void const*, std::size_t> result;
switch (kCODEC_TYPE)
switch (kCodecType)
{
// case 0 was uncompressed data; we always compress now.
case 1: // lz4
@@ -275,7 +275,7 @@ nodeobjectCompress(void const* in, std::size_t inSize, BufferFactory&& bf)
break;
}
default:
Throw<std::logic_error>("nodeobject codec: unknown=" + std::to_string(kCODEC_TYPE));
Throw<std::logic_error>("nodeobject codec: unknown=" + std::to_string(kCodecType));
};
return result;
}

View File

@@ -25,7 +25,7 @@ struct varint_traits<T, true>
{
explicit varint_traits() = default;
static std::size_t constexpr kMAX = (8 * sizeof(T) + 6) / 7;
static constexpr std::size_t kMax = (8 * sizeof(T) + 6) / 7;
};
// Returns: Number of bytes consumed or 0 on error,

View File

@@ -8,21 +8,21 @@
namespace xrpl {
std::uint16_t constexpr kTRADING_FEE_THRESHOLD = 1000; // 1%
constexpr std::uint16_t kTradingFeeThreshold = 1000; // 1%
// Auction slot
std::uint32_t constexpr kTOTAL_TIME_SLOT_SECS = 24 * 3600;
std::uint16_t constexpr kAUCTION_SLOT_TIME_INTERVALS = 20;
std::uint16_t constexpr kAUCTION_SLOT_MAX_AUTH_ACCOUNTS = 4;
std::uint32_t constexpr kAUCTION_SLOT_FEE_SCALE_FACTOR = 100000;
std::uint32_t constexpr kAUCTION_SLOT_DISCOUNTED_FEE_FRACTION = 10;
std::uint32_t constexpr kAUCTION_SLOT_MIN_FEE_FRACTION = 25;
std::uint32_t constexpr kAUCTION_SLOT_INTERVAL_DURATION =
kTOTAL_TIME_SLOT_SECS / kAUCTION_SLOT_TIME_INTERVALS;
constexpr std::uint32_t kTotalTimeSlotSecs = 24 * 3600;
constexpr std::uint16_t kAuctionSlotTimeIntervals = 20;
constexpr std::uint16_t kAuctionSlotMaxAuthAccounts = 4;
constexpr std::uint32_t kAuctionSlotFeeScaleFactor = 100000;
constexpr std::uint32_t kAuctionSlotDiscountedFeeFraction = 10;
constexpr std::uint32_t kAuctionSlotMinFeeFraction = 25;
constexpr std::uint32_t kAuctionSlotIntervalDuration =
kTotalTimeSlotSecs / kAuctionSlotTimeIntervals;
// Votes
std::uint16_t constexpr kVOTE_MAX_SLOTS = 8;
std::uint32_t constexpr kVOTE_WEIGHT_SCALE_FACTOR = 100000;
constexpr std::uint16_t kVoteMaxSlots = 8;
constexpr std::uint32_t kVoteWeightScaleFactor = 100000;
class STObject;
class STAmount;
@@ -77,7 +77,7 @@ ammEnabled(Rules const&);
inline Number
getFee(std::uint16_t tfee)
{
return Number{tfee} / kAUCTION_SLOT_FEE_SCALE_FACTOR;
return Number{tfee} / kAuctionSlotFeeScaleFactor;
}
/** Get fee multiplier (1 - tfee)

View File

@@ -69,7 +69,7 @@ toIssuer(AccountID&, std::string const&);
inline bool
isXRP(AccountID const& c)
{
return c == beast::kZERO;
return c == beast::kZero;
}
// DEPRECATED

View File

@@ -96,9 +96,9 @@ inline MPTAmount
toAmount<MPTAmount>(STAmount const& amt)
{
XRPL_ASSERT(
amt.holds<MPTIssue>() && amt.mantissa() <= kMAX_MP_TOKEN_AMOUNT && amt.exponent() == 0,
amt.holds<MPTIssue>() && amt.mantissa() <= kMaxMpTokenAmount && amt.exponent() == 0,
"xrpl::toAmount<MPTAmount> : maximum mantissa");
if (amt.mantissa() > kMAX_MP_TOKEN_AMOUNT || amt.exponent() != 0)
if (amt.mantissa() > kMaxMpTokenAmount || amt.exponent() != 0)
Throw<std::runtime_error>("toAmount<MPTAmount>: invalid mantissa or exponent");
bool const isNeg = amt.negative();
std::int64_t const sMant = isNeg ? -std::int64_t(amt.mantissa()) : amt.mantissa();
@@ -167,8 +167,8 @@ toAmount(Asset const& asset, Number const& n, Number::RoundingMode mode = Number
}
else
{
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
static_assert(kALWAYS_FALSE, "Unsupported type for toAmount");
static constexpr bool kAlwaysFalse = !std::is_same_v<T, T>;
static_assert(kAlwaysFalse, "Unsupported type for toAmount");
}
}
@@ -178,30 +178,30 @@ toMaxAmount(Asset const& asset)
{
if constexpr (std::is_same_v<IOUAmount, T>)
{
return IOUAmount(STAmount::kMAX_VALUE, STAmount::kMAX_OFFSET);
return IOUAmount(STAmount::kMaxValue, STAmount::kMaxOffset);
}
else if constexpr (std::is_same_v<XRPAmount, T>)
{
return XRPAmount(static_cast<std::int64_t>(STAmount::kMAX_NATIVE_N));
return XRPAmount(static_cast<std::int64_t>(STAmount::kMaxNativeN));
}
else if constexpr (std::is_same_v<MPTAmount, T>)
{
return MPTAmount(kMAX_MP_TOKEN_AMOUNT);
return MPTAmount(kMaxMpTokenAmount);
}
else if constexpr (std::is_same_v<STAmount, T>)
{
return asset.visit(
[](Issue const& issue) {
if (isXRP(issue))
return STAmount(issue, static_cast<std::int64_t>(STAmount::kMAX_NATIVE_N));
return STAmount(issue, STAmount::kMAX_VALUE, STAmount::kMAX_OFFSET);
return STAmount(issue, static_cast<std::int64_t>(STAmount::kMaxNativeN));
return STAmount(issue, STAmount::kMaxValue, STAmount::kMaxOffset);
},
[](MPTIssue const& issue) { return STAmount(issue, kMAX_MP_TOKEN_AMOUNT); });
[](MPTIssue const& issue) { return STAmount(issue, kMaxMpTokenAmount); });
}
else
{
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
static_assert(kALWAYS_FALSE, "Unsupported type for toMaxAmount");
static constexpr bool kAlwaysFalse = !std::is_same_v<T, T>;
static_assert(kAlwaysFalse, "Unsupported type for toMaxAmount");
}
}
@@ -233,8 +233,8 @@ getAsset(T const& amt)
}
else
{
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
static_assert(kALWAYS_FALSE, "Unsupported type for getIssue");
static constexpr bool kAlwaysFalse = !std::is_same_v<T, T>;
static_assert(kAlwaysFalse, "Unsupported type for getIssue");
}
}
@@ -260,8 +260,8 @@ get(STAmount const& a)
}
else
{
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
static_assert(kALWAYS_FALSE, "Unsupported type for get");
constexpr bool kAlwaysFalse = !std::is_same_v<T, T>;
static_assert(kAlwaysFalse, "Unsupported type for get");
}
}

View File

@@ -35,49 +35,49 @@ namespace xrpl {
namespace RPC {
template <unsigned int Version>
constexpr static std::integral_constant<unsigned, Version> kAPI_VERSION = {};
static constexpr std::integral_constant<unsigned, Version> kApiVersion = {};
constexpr static auto kAPI_INVALID_VERSION = kAPI_VERSION<0>;
constexpr static auto kAPI_MINIMUM_SUPPORTED_VERSION = kAPI_VERSION<1>;
constexpr static auto kAPI_MAXIMUM_SUPPORTED_VERSION = kAPI_VERSION<2>;
constexpr static auto kAPI_VERSION_IF_UNSPECIFIED = kAPI_VERSION<1>;
constexpr static auto kAPI_COMMAND_LINE_VERSION = kAPI_VERSION<1>; // TODO Bump to 2 later
constexpr static auto kAPI_BETA_VERSION = kAPI_VERSION<3>;
constexpr static auto kAPI_MAXIMUM_VALID_VERSION = kAPI_BETA_VERSION;
static constexpr auto kApiInvalidVersion = kApiVersion<0>;
static constexpr auto kApiMinimumSupportedVersion = kApiVersion<1>;
static constexpr auto kApiMaximumSupportedVersion = kApiVersion<2>;
static constexpr auto kApiVersionIfUnspecified = kApiVersion<1>;
static constexpr auto kApiCommandLineVersion = kApiVersion<1>; // TODO Bump to 2 later
static constexpr auto kApiBetaVersion = kApiVersion<3>;
static constexpr auto kApiMaximumValidVersion = kApiBetaVersion;
static_assert(kAPI_INVALID_VERSION < kAPI_MINIMUM_SUPPORTED_VERSION);
static_assert(kApiInvalidVersion < kApiMinimumSupportedVersion);
static_assert(
kAPI_VERSION_IF_UNSPECIFIED >= kAPI_MINIMUM_SUPPORTED_VERSION &&
kAPI_VERSION_IF_UNSPECIFIED <= kAPI_MAXIMUM_SUPPORTED_VERSION);
kApiVersionIfUnspecified >= kApiMinimumSupportedVersion &&
kApiVersionIfUnspecified <= kApiMaximumSupportedVersion);
static_assert(
kAPI_COMMAND_LINE_VERSION >= kAPI_MINIMUM_SUPPORTED_VERSION &&
kAPI_COMMAND_LINE_VERSION <= kAPI_MAXIMUM_SUPPORTED_VERSION);
static_assert(kAPI_MAXIMUM_SUPPORTED_VERSION >= kAPI_MINIMUM_SUPPORTED_VERSION);
static_assert(kAPI_BETA_VERSION >= kAPI_MAXIMUM_SUPPORTED_VERSION);
static_assert(kAPI_MAXIMUM_VALID_VERSION >= kAPI_MAXIMUM_SUPPORTED_VERSION);
kApiCommandLineVersion >= kApiMinimumSupportedVersion &&
kApiCommandLineVersion <= kApiMaximumSupportedVersion);
static_assert(kApiMaximumSupportedVersion >= kApiMinimumSupportedVersion);
static_assert(kApiBetaVersion >= kApiMaximumSupportedVersion);
static_assert(kApiMaximumValidVersion >= kApiMaximumSupportedVersion);
inline void
setVersion(json::Value& parent, unsigned int apiVersion, bool betaEnabled)
{
XRPL_ASSERT(apiVersion != kAPI_INVALID_VERSION, "xrpl::RPC::setVersion : input is valid");
XRPL_ASSERT(apiVersion != kApiInvalidVersion, "xrpl::RPC::setVersion : input is valid");
auto& retObj = parent[jss::version] = json::ValueType::Object;
if (apiVersion == kAPI_VERSION_IF_UNSPECIFIED)
if (apiVersion == kApiVersionIfUnspecified)
{
// API version numbers used in API version 1
static beast::SemanticVersion const kFIRST_VERSION{"1.0.0"};
static beast::SemanticVersion const kGOOD_VERSION{"1.0.0"};
static beast::SemanticVersion const kLAST_VERSION{"1.0.0"};
static beast::SemanticVersion const kFirstVersion{"1.0.0"};
static beast::SemanticVersion const kGoodVersion{"1.0.0"};
static beast::SemanticVersion const kLastVersion{"1.0.0"};
retObj[jss::first] = kFIRST_VERSION.print();
retObj[jss::good] = kGOOD_VERSION.print();
retObj[jss::last] = kLAST_VERSION.print();
retObj[jss::first] = kFirstVersion.print();
retObj[jss::good] = kGoodVersion.print();
retObj[jss::last] = kLastVersion.print();
}
else
{
retObj[jss::first] = kAPI_MINIMUM_SUPPORTED_VERSION.value;
retObj[jss::last] = betaEnabled ? kAPI_BETA_VERSION : kAPI_MAXIMUM_SUPPORTED_VERSION;
retObj[jss::first] = kApiMinimumSupportedVersion.value;
retObj[jss::last] = betaEnabled ? kApiBetaVersion : kApiMaximumSupportedVersion;
}
}
@@ -98,9 +98,9 @@ setVersion(json::Value& parent, unsigned int apiVersion, bool betaEnabled)
inline unsigned int
getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
{
static json::Value const kMIN_VERSION(RPC::kAPI_MINIMUM_SUPPORTED_VERSION);
static json::Value const kMinVersion(RPC::kApiMinimumSupportedVersion);
json::Value const maxVersion(
betaEnabled ? RPC::kAPI_BETA_VERSION : RPC::kAPI_MAXIMUM_SUPPORTED_VERSION);
betaEnabled ? RPC::kApiBetaVersion : RPC::kApiMaximumSupportedVersion);
if (jv.isObject())
{
@@ -109,18 +109,18 @@ getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
auto const specifiedVersion = jv[jss::api_version];
if (!specifiedVersion.isInt() && !specifiedVersion.isUInt())
{
return RPC::kAPI_INVALID_VERSION;
return RPC::kApiInvalidVersion;
}
auto const specifiedVersionInt = specifiedVersion.asInt();
if (specifiedVersionInt < kMIN_VERSION || specifiedVersionInt > maxVersion)
if (specifiedVersionInt < kMinVersion || specifiedVersionInt > maxVersion)
{
return RPC::kAPI_INVALID_VERSION;
return RPC::kApiInvalidVersion;
}
return specifiedVersionInt;
}
}
return RPC::kAPI_VERSION_IF_UNSPECIFIED;
return RPC::kApiVersionIfUnspecified;
}
} // namespace RPC
@@ -128,33 +128,33 @@ getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
template <unsigned MinVer, unsigned MaxVer, typename Fn, typename... Args>
void
forApiVersions(Fn const& fn, Args&&... args)
requires //
(MaxVer >= MinVer) && //
(MinVer >= RPC::kAPI_MINIMUM_SUPPORTED_VERSION) && //
(RPC::kAPI_MAXIMUM_VALID_VERSION >= MaxVer) && requires {
requires //
(MaxVer >= MinVer) && //
(MinVer >= RPC::kApiMinimumSupportedVersion) && //
(RPC::kApiMaximumValidVersion >= MaxVer) && requires {
fn(std::integral_constant<unsigned int, MinVer>{}, std::forward<Args>(args)...);
fn(std::integral_constant<unsigned int, MaxVer>{}, std::forward<Args>(args)...);
}
{
constexpr auto kSIZE = MaxVer + 1 - MinVer;
static constexpr auto kSize = MaxVer + 1 - MinVer;
[&]<std::size_t... Offset>(std::index_sequence<Offset...>) {
// NOLINTBEGIN(bugprone-use-after-move)
(((void)fn(
std::integral_constant<unsigned int, MinVer + Offset>{}, std::forward<Args>(args)...)),
...);
// NOLINTEND(bugprone-use-after-move)
}(std::make_index_sequence<kSIZE>{});
}(std::make_index_sequence<kSize>{});
}
template <typename Fn, typename... Args>
void
forAllApiVersions(Fn const& fn, Args&&... args)
requires requires {
forApiVersions<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>(
forApiVersions<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>(
fn, std::forward<Args>(args)...);
}
{
forApiVersions<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>(
forApiVersions<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>(
fn, std::forward<Args>(args)...);
}

View File

@@ -148,10 +148,10 @@ public:
};
template <ValidIssueType TIss>
constexpr bool kIS_ISSUE_V = std::is_same_v<TIss, Issue>;
constexpr bool kIsIssueV = std::is_same_v<TIss, Issue>;
template <ValidIssueType TIss>
constexpr bool kIS_MPTISSUE_V = std::is_same_v<TIss, MPTIssue>;
constexpr bool kIsMptissueV = std::is_same_v<TIss, MPTIssue>;
inline json::Value
toJson(Asset const& asset)
@@ -242,7 +242,7 @@ operator<=>(Asset const& lhs, Asset const& rhs)
{
return std::weak_ordering(lhs <=> rhs);
}
else if constexpr (kIS_ISSUE_V<TLhs> && kIS_MPTISSUE_V<TRhs>)
else if constexpr (kIsIssueV<TLhs> && kIsMptissueV<TRhs>)
{
return std::weak_ordering::greater;
}

View File

@@ -65,11 +65,11 @@
namespace xrpl {
// Feature names must not exceed this length (in characters, excluding the null terminator).
static constexpr std::size_t kMAX_FEATURE_NAME_SIZE = 63;
static constexpr std::size_t kMaxFeatureNameSize = 63;
// Reserve this exact feature-name length (in characters/bytes, excluding the null terminator)
// so that a 32-byte uint256 (for example, in WASM or other interop contexts) can be used
// as a compact, fixed-size feature selector without conflicting with human-readable names.
static constexpr std::size_t kRESERVED_FEATURE_NAME_SIZE = 32;
static constexpr std::size_t kReservedFeatureNameSize = 32;
// Both validFeatureNameSize and validFeatureName are consteval functions that can be used in
// static_asserts to validate feature names at compile time. They are only used inside
@@ -81,14 +81,14 @@ validFeatureNameSize(auto fn) -> bool
{
constexpr char const* kN = fn();
// Note, std::strlen is not constexpr, we need to implement our own here.
constexpr std::size_t kLEN = [](auto n) {
constexpr std::size_t kLen = [](auto n) {
std::size_t ret = 0;
for (auto ptr = n; *ptr != '\0'; ret++, ++ptr)
;
return ret;
}(kN);
return kLEN != kRESERVED_FEATURE_NAME_SIZE && //
kLEN <= kMAX_FEATURE_NAME_SIZE;
return kLen != kReservedFeatureNameSize && //
kLen <= kMaxFeatureNameSize;
}
consteval auto
@@ -136,7 +136,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
// the actual number of amendments. A LogicError on startup will verify this.
static constexpr std::size_t kNUM_FEATURES =
static constexpr std::size_t kNumFeatures =
(0 +
#include <xrpl/protocol/detail/features.macro>
);
@@ -184,9 +184,9 @@ bitsetIndexToFeature(size_t i);
std::string
featureToName(uint256 const& f);
class FeatureBitset : private std::bitset<detail::kNUM_FEATURES>
class FeatureBitset : private std::bitset<detail::kNumFeatures>
{
using base = std::bitset<detail::kNUM_FEATURES>;
using base = std::bitset<detail::kNumFeatures>;
template <class... Fs>
void

View File

@@ -6,7 +6,7 @@ namespace xrpl {
// Deprecated constant for backwards compatibility with pre-XRPFees amendment.
// This was the reference fee units used in the old fee calculation.
inline constexpr std::uint32_t kFEE_UNITS_DEPRECATED = 10;
inline constexpr std::uint32_t kFeeUnitsDeprecated = 10;
/** Reflects the fee settings for a particular ledger.

View File

@@ -92,7 +92,7 @@ public:
inline IOUAmount::IOUAmount(beast::Zero)
{
*this = beast::kZERO;
*this = beast::kZero;
}
inline IOUAmount::IOUAmount(mantissa_type mantissa, exponent_type exponent)

View File

@@ -82,7 +82,7 @@ struct BookT
Keylet
operator()(Book const& b) const;
};
static BookT const kBOOK{};
static BookT const kBook{};
/** The index of a trust line for a given currency
@@ -126,7 +126,7 @@ struct NextT
Keylet
operator()(Keylet const& k) const;
};
static NextT const kNEXT{};
static NextT const kNext{};
/** A ticket belonging to an account */
struct TicketT
@@ -145,7 +145,7 @@ struct TicketT
return {ltTICKET, key};
}
};
static TicketT const kTICKET{};
static TicketT const kTicket{};
/** A SignerList */
Keylet
@@ -373,7 +373,7 @@ struct KeyletDesc
// This list should include all of the keylet functions that take a single
// AccountID parameter.
std::array<KeyletDesc<AccountID const&>, 6> const kDIRECT_ACCOUNT_KEYLETS{
std::array<KeyletDesc<AccountID const&>, 6> const kDirectAccountKeylets{
{{.function = &keylet::account, .expectedLEName = jss::AccountRoot, .includeInTests = false},
{.function = &keylet::ownerDir, .expectedLEName = jss::DirectoryNode, .includeInTests = true},
{.function = &keylet::signers, .expectedLEName = jss::SignerList, .includeInTests = true},

View File

@@ -96,16 +96,16 @@ operator<=>(Issue const& lhs, Issue const& rhs)
inline Issue const&
xrpIssue()
{
static Issue const kISSUE{xrpCurrency(), xrpAccount()};
return kISSUE;
static Issue const kIssue{xrpCurrency(), xrpAccount()};
return kIssue;
}
/** Returns an asset specifier that represents no account and currency. */
inline Issue const&
noIssue()
{
static Issue const kISSUE{noCurrency(), noAccount()};
return kISSUE;
static Issue const kIssue{noCurrency(), noAccount()};
return kIssue;
}
inline bool

View File

@@ -26,12 +26,12 @@ struct LedgerHeader
//
// Closed means "tx set already determined"
uint256 hash = beast::kZERO;
uint256 txHash = beast::kZERO;
uint256 accountHash = beast::kZERO;
uint256 parentHash = beast::kZERO;
uint256 hash = beast::kZero;
uint256 txHash = beast::kZero;
uint256 accountHash = beast::kZero;
uint256 parentHash = beast::kZero;
XRPAmount drops = beast::kZERO;
XRPAmount drops = beast::kZero;
// If validated is false, it means "not yet validated."
// Once validated is true, it will never be set false at a later time.
@@ -53,12 +53,12 @@ struct LedgerHeader
};
// ledger close flags
static std::uint32_t const kS_LCF_NO_CONSENSUS_TIME = 0x01;
static std::uint32_t const kSLcfNoConsensusTime = 0x01;
inline bool
getCloseAgree(LedgerHeader const& info)
{
return (info.closeFlags & kS_LCF_NO_CONSENSUS_TIME) == 0;
return (info.closeFlags & kSLcfNoConsensusTime) == 0;
}
void

View File

@@ -88,7 +88,7 @@ constexpr MPTAmount::MPTAmount(value_type value) : value_(value)
constexpr MPTAmount::MPTAmount(beast::Zero)
{
*this = beast::kZERO;
*this = beast::kZero;
}
constexpr MPTAmount&

View File

@@ -15,14 +15,14 @@ namespace xrpl {
namespace detail {
template <typename T>
constexpr bool kIS_INTEGRAL_CONSTANT = false;
constexpr bool kIsIntegralConstant = false;
template <typename I, auto A>
constexpr bool kIS_INTEGRAL_CONSTANT<std::integral_constant<I, A>&> = true;
constexpr bool kIsIntegralConstant<std::integral_constant<I, A>&> = true;
template <typename I, auto A>
constexpr bool kIS_INTEGRAL_CONSTANT<std::integral_constant<I, A> const&> = true;
constexpr bool kIsIntegralConstant<std::integral_constant<I, A> const&> = true;
template <typename T>
concept some_integral_constant = detail::kIS_INTEGRAL_CONSTANT<T&>;
concept some_integral_constant = detail::kIsIntegralConstant<T&>;
// This class is designed to wrap a collection of _almost_ identical json::Value
// objects, indexed by version (i.e. there is some mapping of version to object
@@ -47,8 +47,8 @@ struct MultiApiJson
return (v < MinVer) ? 0 : static_cast<std::size_t>(v - MinVer);
}
constexpr static std::size_t kSIZE = MaxVer + 1 - MinVer;
std::array<json::Value, kSIZE> val = {};
static constexpr std::size_t kSize = MaxVer + 1 - MinVer;
std::array<json::Value, kSize> val = {};
explicit MultiApiJson(json::Value const& init = {})
{
@@ -80,7 +80,7 @@ struct MultiApiJson
if (count == 0)
return IsMemberResult::None;
return count < kSIZE ? IsMemberResult::Some : IsMemberResult::All;
return count < kSize ? IsMemberResult::Some : IsMemberResult::All;
}
static constexpr struct VisitorT final
@@ -100,7 +100,7 @@ struct MultiApiJson
std::integral_constant<unsigned int, Version>,
Args&&...>
{
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSIZE);
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSize);
return std::invoke(fn, json.val[index(Version)], version, std::forward<Args>(args)...);
}
@@ -111,7 +111,7 @@ struct MultiApiJson
operator()(Json& json, std::integral_constant<unsigned int, Version> const, Fn fn) const
-> std::invoke_result_t<Fn, decltype(json.val[0])>
{
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSIZE);
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSize);
return std::invoke(fn, json.val[index(Version)]);
}
@@ -124,7 +124,7 @@ struct MultiApiJson
-> std::invoke_result_t<Fn, decltype(json.val[0]), Version, Args&&...>
{
XRPL_ASSERT(
valid(version) && index(version) >= 0 && index(version) < kSIZE,
valid(version) && index(version) >= 0 && index(version) < kSize,
"xrpl::detail::MultiApijson::operator<Args...>() : valid "
"version");
return std::invoke(fn, json.val[index(version)], version, std::forward<Args>(args)...);
@@ -139,20 +139,20 @@ struct MultiApiJson
-> std::invoke_result_t<Fn, decltype(json.val[0])>
{
XRPL_ASSERT(
valid(version) && index(version) >= 0 && index(version) < kSIZE,
valid(version) && index(version) >= 0 && index(version) < kSize,
"xrpl::detail::MultiApijson::operator() : valid version");
return std::invoke(fn, json.val[index(version)]);
}
} kVISITOR = {};
} kVisitor = {};
auto
visit()
{
return [self = this](auto... args)
requires requires {
kVISITOR(std::declval<MultiApiJson&>(), std::declval<decltype(args)>()...);
kVisitor(std::declval<MultiApiJson&>(), std::declval<decltype(args)>()...);
}
{ return kVISITOR(*self, std::forward<decltype(args)>(args)...); };
{ return kVisitor(*self, std::forward<decltype(args)>(args)...); };
}
[[nodiscard]] auto
@@ -160,27 +160,27 @@ struct MultiApiJson
{
return [self = this](auto... args)
requires requires {
kVISITOR(std::declval<MultiApiJson const&>(), std::declval<decltype(args)>()...);
kVisitor(std::declval<MultiApiJson const&>(), std::declval<decltype(args)>()...);
}
{ return kVISITOR(*self, std::forward<decltype(args)>(args)...); };
{ return kVisitor(*self, std::forward<decltype(args)>(args)...); };
}
template <typename... Args>
auto
visit(Args... args) -> std::invoke_result_t<VisitorT, MultiApiJson&, Args...>
requires(sizeof...(args) > 0) &&
requires { kVISITOR(*this, std::forward<decltype(args)>(args)...); }
requires { kVisitor(*this, std::forward<decltype(args)>(args)...); }
{
return kVISITOR(*this, std::forward<decltype(args)>(args)...);
return kVisitor(*this, std::forward<decltype(args)>(args)...);
}
template <typename... Args>
[[nodiscard]] auto
visit(Args... args) const -> std::invoke_result_t<VisitorT, MultiApiJson const&, Args...>
requires(sizeof...(args) > 0) &&
requires { kVISITOR(*this, std::forward<decltype(args)>(args)...); }
requires { kVisitor(*this, std::forward<decltype(args)>(args)...); }
{
return kVISITOR(*this, std::forward<decltype(args)>(args)...);
return kVisitor(*this, std::forward<decltype(args)>(args)...);
}
};
@@ -188,6 +188,6 @@ struct MultiApiJson
// Wrapper for Json for all supported API versions.
using MultiApiJson =
detail::MultiApiJson<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>;
detail::MultiApiJson<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>;
} // namespace xrpl

View File

@@ -52,10 +52,10 @@ public:
};
template <ValidPathAsset PA>
constexpr bool kIS_CURRENCY_V = std::is_same_v<PA, Currency>;
constexpr bool kIsCurrencyV = std::is_same_v<PA, Currency>;
template <ValidPathAsset PA>
constexpr bool kIS_MPTID_V = std::is_same_v<PA, MPTID>;
constexpr bool kIsMptidV = std::is_same_v<PA, MPTID>;
inline PathAsset::PathAsset(Asset const& asset)
{

View File

@@ -19,40 +19,40 @@ namespace xrpl {
@ingroup protocol
*/
/** Smallest legal byte size of a transaction. */
std::size_t constexpr kTX_MIN_SIZE_BYTES = 32;
constexpr std::size_t kTxMinSizeBytes = 32;
/** Largest legal byte size of a transaction. */
std::size_t constexpr kTX_MAX_SIZE_BYTES = megabytes(1);
constexpr std::size_t kTxMaxSizeBytes = megabytes(1);
/** The maximum number of unfunded offers to delete at once */
std::size_t constexpr kUNFUNDED_OFFER_REMOVE_LIMIT = 1000;
constexpr std::size_t kUnfundedOfferRemoveLimit = 1000;
/** The maximum number of expired offers to delete at once */
std::size_t constexpr kEXPIRED_OFFER_REMOVE_LIMIT = 256;
constexpr std::size_t kExpiredOfferRemoveLimit = 256;
/** The maximum number of metadata entries allowed in one transaction */
std::size_t constexpr kOVERSIZE_META_DATA_CAP = 5200;
constexpr std::size_t kOversizeMetaDataCap = 5200;
/** The maximum number of entries per directory page */
std::size_t constexpr kDIR_NODE_MAX_ENTRIES = 32;
constexpr std::size_t kDirNodeMaxEntries = 32;
/** The maximum number of pages allowed in a directory
Made obsolete by fixDirectoryLimit amendment.
*/
std::uint64_t constexpr kDIR_NODE_MAX_PAGES = 262144;
constexpr std::uint64_t kDirNodeMaxPages = 262144;
/** The maximum number of items in an NFT page */
std::size_t constexpr kDIR_MAX_TOKENS_PER_PAGE = 32;
constexpr std::size_t kDirMaxTokensPerPage = 32;
/** The maximum number of owner directory entries for account to be deletable */
std::size_t constexpr kMAX_DELETABLE_DIR_ENTRIES = 1000;
constexpr std::size_t kMaxDeletableDirEntries = 1000;
/** The maximum number of token offers that can be canceled at once */
std::size_t constexpr kMAX_TOKEN_OFFER_CANCEL_COUNT = 500;
constexpr std::size_t kMaxTokenOfferCancelCount = 500;
/** The maximum number of offers in an offer directory for NFT to be burnable */
std::size_t constexpr kMAX_DELETABLE_TOKEN_OFFER_ENTRIES = 500;
constexpr std::size_t kMaxDeletableTokenOfferEntries = 500;
/** The maximum token transfer fee allowed.
@@ -63,7 +63,7 @@ std::size_t constexpr kMAX_DELETABLE_TOKEN_OFFER_ENTRIES = 500;
Note that for extremely low transfer fees values, it is possible that the
calculated fee will be 0.
*/
std::uint16_t constexpr kMAX_TRANSFER_FEE = 50000;
constexpr std::uint16_t kMaxTransferFee = 50000;
/** There are 10,000 basis points (bips) in 100%.
*
@@ -81,32 +81,32 @@ std::uint16_t constexpr kMAX_TRANSFER_FEE = 50000;
*
* Example: 50% is 0.50 * bipsPerUnity = 5,000 bps.
*/
Bips32 constexpr kBIPS_PER_UNITY(100 * 100);
static_assert(kBIPS_PER_UNITY == Bips32{10'000});
TenthBips32 constexpr kTENTH_BIPS_PER_UNITY(kBIPS_PER_UNITY.value() * 10);
static_assert(kTENTH_BIPS_PER_UNITY == TenthBips32(100'000));
constexpr Bips32 kBipsPerUnity(100 * 100);
static_assert(kBipsPerUnity == Bips32{10'000});
constexpr TenthBips32 kTenthBipsPerUnity(kBipsPerUnity.value() * 10);
static_assert(kTenthBipsPerUnity == TenthBips32(100'000));
constexpr Bips32
percentageToBips(std::uint32_t percentage)
{
return Bips32(percentage * kBIPS_PER_UNITY.value() / 100);
return Bips32(percentage * kBipsPerUnity.value() / 100);
}
constexpr TenthBips32
percentageToTenthBips(std::uint32_t percentage)
{
return TenthBips32(percentage * kTENTH_BIPS_PER_UNITY.value() / 100);
return TenthBips32(percentage * kTenthBipsPerUnity.value() / 100);
}
template <typename T, class TBips>
constexpr T
bipsOfValue(T value, Bips<TBips> bips)
{
return value * bips.value() / kBIPS_PER_UNITY.value();
return value * bips.value() / kBipsPerUnity.value();
}
template <typename T, class TBips>
constexpr T
tenthBipsOfValue(T value, TenthBips<TBips> bips)
{
return value * bips.value() / kTENTH_BIPS_PER_UNITY.value();
return value * bips.value() / kTenthBipsPerUnity.value();
}
namespace Lending {
@@ -114,54 +114,54 @@ namespace Lending {
Valid values are between 0 and 10% inclusive.
*/
TenthBips16 constexpr kMAX_MANAGEMENT_FEE_RATE(
constexpr TenthBips16 kMaxManagementFeeRate(
unsafeCast<std::uint16_t>(percentageToTenthBips(10).value()));
static_assert(kMAX_MANAGEMENT_FEE_RATE == TenthBips16(std::uint16_t(10'000u)));
static_assert(kMaxManagementFeeRate == TenthBips16(std::uint16_t(10'000u)));
/** The maximum coverage rate required of a loan broker in 1/10 bips.
Valid values are between 0 and 100% inclusive.
*/
TenthBips32 constexpr kMAX_COVER_RATE = percentageToTenthBips(100);
static_assert(kMAX_COVER_RATE == TenthBips32(100'000u));
constexpr TenthBips32 kMaxCoverRate = percentageToTenthBips(100);
static_assert(kMaxCoverRate == TenthBips32(100'000u));
/** The maximum overpayment fee on a loan in 1/10 bips.
*
Valid values are between 0 and 100% inclusive.
*/
TenthBips32 constexpr kMAX_OVERPAYMENT_FEE = percentageToTenthBips(100);
static_assert(kMAX_OVERPAYMENT_FEE == TenthBips32(100'000u));
constexpr TenthBips32 kMaxOverpaymentFee = percentageToTenthBips(100);
static_assert(kMaxOverpaymentFee == TenthBips32(100'000u));
/** Annualized interest rate of the Loan in 1/10 bips.
*
* Valid values are between 0 and 100% inclusive.
*/
TenthBips32 constexpr kMAX_INTEREST_RATE = percentageToTenthBips(100);
static_assert(kMAX_INTEREST_RATE == TenthBips32(100'000u));
constexpr TenthBips32 kMaxInterestRate = percentageToTenthBips(100);
static_assert(kMaxInterestRate == TenthBips32(100'000u));
/** The maximum premium added to the interest rate for late payments on a loan
* in 1/10 bips.
*
* Valid values are between 0 and 100% inclusive.
*/
TenthBips32 constexpr kMAX_LATE_INTEREST_RATE = percentageToTenthBips(100);
static_assert(kMAX_LATE_INTEREST_RATE == TenthBips32(100'000u));
constexpr TenthBips32 kMaxLateInterestRate = percentageToTenthBips(100);
static_assert(kMaxLateInterestRate == TenthBips32(100'000u));
/** The maximum close interest rate charged for repaying a loan early in 1/10
* bips.
*
* Valid values are between 0 and 100% inclusive.
*/
TenthBips32 constexpr kMAX_CLOSE_INTEREST_RATE = percentageToTenthBips(100);
static_assert(kMAX_CLOSE_INTEREST_RATE == TenthBips32(100'000u));
constexpr TenthBips32 kMaxCloseInterestRate = percentageToTenthBips(100);
static_assert(kMaxCloseInterestRate == TenthBips32(100'000u));
/** The maximum overpayment interest rate charged on loan overpayments in 1/10
* bips.
*
* Valid values are between 0 and 100% inclusive.
*/
TenthBips32 constexpr kMAX_OVERPAYMENT_INTEREST_RATE = percentageToTenthBips(100);
static_assert(kMAX_OVERPAYMENT_INTEREST_RATE == TenthBips32(100'000u));
constexpr TenthBips32 kMaxOverpaymentInterestRate = percentageToTenthBips(100);
static_assert(kMaxOverpaymentInterestRate == TenthBips32(100'000u));
/** LoanPay transaction cost will be one base fee per X combined payments
*
@@ -172,7 +172,7 @@ static_assert(kMAX_OVERPAYMENT_INTEREST_RATE == TenthBips32(100'000u));
* This number was chosen arbitrarily, but should not be changed once released
* without an amendment
*/
static constexpr int kLOAN_PAYMENTS_PER_FEE_INCREMENT = 5;
static constexpr int kLoanPaymentsPerFeeIncrement = 5;
/** Maximum number of combined payments that a LoanPay transaction will process
*
@@ -196,65 +196,65 @@ static constexpr int kLOAN_PAYMENTS_PER_FEE_INCREMENT = 5;
* This number was chosen arbitrarily, but should not be changed once released
* without an amendment
*/
static constexpr int kLOAN_MAXIMUM_PAYMENTS_PER_TRANSACTION = 100;
static constexpr int kLoanMaximumPaymentsPerTransaction = 100;
} // namespace Lending
/** The maximum length of a URI inside an NFT */
std::size_t constexpr kMAX_TOKEN_URI_LENGTH = 256;
constexpr std::size_t kMaxTokenUriLength = 256;
/** The maximum length of a Data element inside a DID */
std::size_t constexpr kMAX_DID_DOCUMENT_LENGTH = 256;
constexpr std::size_t kMaxDidDocumentLength = 256;
/** The maximum length of a URI inside a DID */
std::size_t constexpr kMAX_DIDURI_LENGTH = 256;
constexpr std::size_t kMaxDidUriLength = 256;
/** The maximum length of an Attestation inside a DID */
std::size_t constexpr kMAX_DID_DATA_LENGTH = 256;
constexpr std::size_t kMaxDidDataLength = 256;
/** The maximum length of a domain */
std::size_t constexpr kMAX_DOMAIN_LENGTH = 256;
constexpr std::size_t kMaxDomainLength = 256;
/** The maximum length of a URI inside a Credential */
std::size_t constexpr kMAX_CREDENTIAL_URI_LENGTH = 256;
constexpr std::size_t kMaxCredentialUriLength = 256;
/** The maximum length of a CredentialType inside a Credential */
std::size_t constexpr kMAX_CREDENTIAL_TYPE_LENGTH = 64;
constexpr std::size_t kMaxCredentialTypeLength = 64;
/** The maximum number of credentials can be passed in array */
std::size_t constexpr kMAX_CREDENTIALS_ARRAY_SIZE = 8;
constexpr std::size_t kMaxCredentialsArraySize = 8;
/** The maximum number of credentials can be passed in array for permissioned
* domain */
std::size_t constexpr kMAX_PERMISSIONED_DOMAIN_CREDENTIALS_ARRAY_SIZE = 10;
constexpr std::size_t kMaxPermissionedDomainCredentialsArraySize = 10;
/** The maximum length of MPTokenMetadata */
std::size_t constexpr kMAX_MP_TOKEN_METADATA_LENGTH = 1024;
constexpr std::size_t kMaxMpTokenMetadataLength = 1024;
/** The maximum amount of MPTokenIssuance */
std::uint64_t constexpr kMAX_MP_TOKEN_AMOUNT = 0x7FFF'FFFF'FFFF'FFFFull;
static_assert(Number::kMAX_REP >= kMAX_MP_TOKEN_AMOUNT);
constexpr std::uint64_t kMaxMpTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
static_assert(Number::kMaxRep >= kMaxMpTokenAmount);
/** The maximum length of Data payload */
std::size_t constexpr kMAX_DATA_PAYLOAD_LENGTH = 256;
constexpr std::size_t kMaxDataPayloadLength = 256;
/** Vault withdrawal policies */
std::uint8_t constexpr kVAULT_STRATEGY_FIRST_COME_FIRST_SERVE = 1;
constexpr std::uint8_t kVaultStrategyFirstComeFirstServe = 1;
/** Default IOU scale factor for a Vault */
std::uint8_t constexpr kVAULT_DEFAULT_IOU_SCALE = 6;
constexpr std::uint8_t kVaultDefaultIouScale = 6;
/** Maximum scale factor for a Vault. The number is chosen to ensure that
1 IOU can be always converted to shares.
10^19 > maxMPTokenAmount (2^64-1) > 10^18 */
std::uint8_t constexpr kVAULT_MAXIMUM_IOU_SCALE = 18;
constexpr std::uint8_t kVaultMaximumIouScale = 18;
/** Maximum recursion depth for vault shares being put as an asset inside
* another vault; counted from 0 */
std::uint8_t constexpr kMAX_ASSET_CHECK_DEPTH = 5;
constexpr std::uint8_t kMaxAssetCheckDepth = 5;
/** A ledger index. */
using LedgerIndex = std::uint32_t;
std::uint32_t constexpr kFLAG_LEDGER_INTERVAL = 256;
constexpr std::uint32_t kFlagLedgerInterval = 256;
/** Returns true if the given ledgerIndex is a voting ledgerIndex */
bool
@@ -273,38 +273,38 @@ using TxID = uint256;
/** The maximum number of trustlines to delete as part of AMM account
* deletion cleanup.
*/
std::uint16_t constexpr kMAX_DELETABLE_AMM_TRUST_LINES = 512;
constexpr std::uint16_t kMaxDeletableAmmTrustLines = 512;
/** The maximum length of a URI inside an Oracle */
std::size_t constexpr kMAX_ORACLE_URI = 256;
constexpr std::size_t kMaxOracleUri = 256;
/** The maximum length of a Provider inside an Oracle */
std::size_t constexpr kMAX_ORACLE_PROVIDER = 256;
constexpr std::size_t kMaxOracleProvider = 256;
/** The maximum size of a data series array inside an Oracle */
std::size_t constexpr kMAX_ORACLE_DATA_SERIES = 10;
constexpr std::size_t kMaxOracleDataSeries = 10;
/** The maximum length of a SymbolClass inside an Oracle */
std::size_t constexpr kMAX_ORACLE_SYMBOL_CLASS = 16;
constexpr std::size_t kMaxOracleSymbolClass = 16;
/** The maximum allowed time difference between lastUpdateTime and the time
of the last closed ledger
*/
std::size_t constexpr kMAX_LAST_UPDATE_TIME_DELTA = 300;
constexpr std::size_t kMaxLastUpdateTimeDelta = 300;
/** The maximum price scaling factor
*/
std::size_t constexpr kMAX_PRICE_SCALE = 20;
constexpr std::size_t kMaxPriceScale = 20;
/** The maximum percentage of outliers to trim
*/
std::size_t constexpr kMAX_TRIM = 25;
constexpr std::size_t kMaxTrim = 25;
/** The maximum number of delegate permissions an account can grant
*/
std::size_t constexpr kPERMISSION_MAX_SIZE = 10;
constexpr std::size_t kPermissionMaxSize = 10;
/** The maximum number of transactions that can be in a batch. */
std::size_t constexpr kMAX_BATCH_TX_COUNT = 8;
constexpr std::size_t kMaxBatchTxCount = 8;
} // namespace xrpl

View File

@@ -43,8 +43,8 @@ class PublicKey
protected:
// All the constructed public keys are valid, non-empty and contain 33
// bytes of data.
static constexpr std::size_t kSIZE = 33;
std::uint8_t buf_[kSIZE]{}; // should be large enough
static constexpr std::size_t kSize = 33;
std::uint8_t buf_[kSize]{}; // should be large enough
public:
using const_iterator = std::uint8_t const*;
@@ -72,7 +72,7 @@ public:
static std::size_t
size() noexcept
{
return kSIZE;
return kSize;
}
[[nodiscard]] const_iterator
@@ -90,19 +90,19 @@ public:
[[nodiscard]] const_iterator
end() const noexcept
{
return buf_ + kSIZE;
return buf_ + kSize;
}
[[nodiscard]] const_iterator
cend() const noexcept
{
return buf_ + kSIZE;
return buf_ + kSize;
}
[[nodiscard]] Slice
slice() const noexcept
{
return {buf_, kSIZE};
return {buf_, kSize};
}
operator Slice() const noexcept

View File

@@ -26,7 +26,7 @@ struct TAmounts
{
TAmounts() = default;
TAmounts(beast::Zero, beast::Zero) : in(beast::kZERO), out(beast::kZERO)
TAmounts(beast::Zero, beast::Zero) : in(beast::kZero), out(beast::kZero)
{
}
@@ -38,7 +38,7 @@ struct TAmounts
[[nodiscard]] bool
empty() const noexcept
{
return in <= beast::kZERO || out <= beast::kZERO;
return in <= beast::kZero || out <= beast::kZero;
}
TAmounts&
@@ -94,8 +94,8 @@ public:
// have lower unsigned integer representations.
using value_type = std::uint64_t;
static int const kMIN_TICK_SIZE = 3;
static int const kMAX_TICK_SIZE = 16;
static int const kMinTickSize = 3;
static int const kMaxTickSize = 16;
private:
// This has the same representation as STAmount, see the comment on the
@@ -316,10 +316,10 @@ TAmounts<In, Out>
Quality::ceilIn(TAmounts<In, Out> const& amount, In const& limit) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCEIL_IN_FN_PTR)(Amounts const&, STAmount const&) const =
static constexpr Amounts (Quality::*kCeilInFnPtr)(Amounts const&, STAmount const&) const =
&Quality::ceilIn;
return ceilTAmountsHelper(amount, limit, amount.in, kCEIL_IN_FN_PTR);
return ceilTAmountsHelper(amount, limit, amount.in, kCeilInFnPtr);
}
template <class In, class Out>
@@ -327,10 +327,10 @@ TAmounts<In, Out>
Quality::ceilInStrict(TAmounts<In, Out> const& amount, In const& limit, bool roundUp) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCEIL_IN_FN_PTR)(Amounts const&, STAmount const&, bool)
const = &Quality::ceilInStrict;
static constexpr Amounts (Quality::*kCeilInFnPtr)(Amounts const&, STAmount const&, bool) const =
&Quality::ceilInStrict;
return ceilTAmountsHelper(amount, limit, amount.in, kCEIL_IN_FN_PTR, roundUp);
return ceilTAmountsHelper(amount, limit, amount.in, kCeilInFnPtr, roundUp);
}
template <class In, class Out>
@@ -338,10 +338,10 @@ TAmounts<In, Out>
Quality::ceilOut(TAmounts<In, Out> const& amount, Out const& limit) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCEIL_OUT_FN_PTR)(Amounts const&, STAmount const&) const =
static constexpr Amounts (Quality::*kCeilOutFnPtr)(Amounts const&, STAmount const&) const =
&Quality::ceilOut;
return ceil_TAmounts_helper(amount, limit, amount.out, kCEIL_OUT_FN_PTR);
return ceil_TAmounts_helper(amount, limit, amount.out, kCeilOutFnPtr);
}
template <class In, class Out>
@@ -349,10 +349,10 @@ TAmounts<In, Out>
Quality::ceilOutStrict(TAmounts<In, Out> const& amount, Out const& limit, bool roundUp) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCEIL_OUT_FN_PTR)(Amounts const&, STAmount const&, bool)
static constexpr Amounts (Quality::*kCeilOutFnPtr)(Amounts const&, STAmount const&, bool)
const = &Quality::ceilOutStrict;
return ceilTAmountsHelper(amount, limit, amount.out, kCEIL_OUT_FN_PTR, roundUp);
return ceilTAmountsHelper(amount, limit, amount.out, kCeilOutFnPtr, roundUp);
}
/** Calculate the quality of a two-hop path given the two hops.

View File

@@ -72,7 +72,7 @@ QualityFunction::QualityFunction(
std::uint32_t tfee,
QualityFunction::AMMTag)
{
if (amounts.in <= beast::kZERO || amounts.out <= beast::kZERO)
if (amounts.in <= beast::kZero || amounts.out <= beast::kZero)
Throw<std::runtime_error>("QualityFunction amounts are 0.");
Number const cfee = feeMult(tfee);
m_ = -cfee / amounts.in;

View File

@@ -72,6 +72,6 @@ transferFeeAsRate(std::uint16_t fee);
} // namespace nft
/** A transfer rate signifying a 1:1 exchange */
extern Rate const kPARITY_RATE;
extern Rate const kParityRate;
} // namespace xrpl

View File

@@ -92,7 +92,7 @@ class STCurrency;
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum SerializedTypeID { XMACRO(TO_ENUM) };
static std::map<std::string, int> const kS_TYPE_MAP = {XMACRO(TO_MAP)};
static std::map<std::string, int> const kSTypeMap = {XMACRO(TO_MAP)};
#undef XMACRO
#undef TO_ENUM
@@ -129,23 +129,23 @@ fieldCode(int id, int index)
class SField
{
public:
static constexpr auto kSMD_NEVER = 0x00;
static constexpr auto kSMD_CHANGE_ORIG = 0x01; // original value when it changes
static constexpr auto kSMD_CHANGE_NEW = 0x02; // new value when it changes
static constexpr auto kSMD_DELETE_FINAL = 0x04; // final value when it is deleted
static constexpr auto kSMD_CREATE = 0x08; // value when it's created
static constexpr auto kSMD_ALWAYS = 0x10; // value when node containing it is affected at all
static constexpr auto kSMD_BASE_TEN = 0x20; // value is treated as base 10, overriding behavior
static constexpr auto kSMD_PSEUDO_ACCOUNT = 0x40; // if this field is set in an ACCOUNT_ROOT
// _only_, then it is a pseudo-account
static constexpr auto kSMD_NEEDS_ASSET = 0x80; // This field needs to be associated with an
// asset before it is serialized as a ledger
// object. Intended for STNumber.
static constexpr auto kSMD_DEFAULT =
kSMD_CHANGE_ORIG | kSMD_CHANGE_NEW | kSMD_DELETE_FINAL | kSMD_CREATE;
static constexpr auto kSmdNever = 0x00;
static constexpr auto kSmdChangeOrig = 0x01; // original value when it changes
static constexpr auto kSmdChangeNew = 0x02; // new value when it changes
static constexpr auto kSmdDeleteFinal = 0x04; // final value when it is deleted
static constexpr auto kSmdCreate = 0x08; // value when it's created
static constexpr auto kSmdAlways = 0x10; // value when node containing it is affected at all
static constexpr auto kSmdBaseTen = 0x20; // value is treated as base 10, overriding behavior
static constexpr auto kSmdPseudoAccount = 0x40; // if this field is set in an ACCOUNT_ROOT
// _only_, then it is a pseudo-account
static constexpr auto kSmdNeedsAsset = 0x80; // This field needs to be associated with an
// asset before it is serialized as a ledger
// object. Intended for STNumber.
static constexpr auto kSmdDefault =
kSmdChangeOrig | kSmdChangeNew | kSmdDeleteFinal | kSmdCreate;
enum class IsSigning : unsigned char { No, Yes };
static IsSigning const kNOT_SIGNING = IsSigning::No;
static IsSigning const kNotSigning = IsSigning::No;
int const fieldCodeMem; // (type<<16)|index // TODO: rename, clashes with function
SerializedTypeID const fieldType; // STI_*
@@ -172,7 +172,7 @@ public:
SerializedTypeID tid,
int fv,
char const* fn,
int meta = kSMD_DEFAULT,
int meta = kSmdDefault,
IsSigning signing = IsSigning::Yes);
explicit SField(PrivateAccessTagT, int fc, char const* fn);
@@ -365,8 +365,8 @@ using SF_XCHAIN_BRIDGE = TypedField<STXChainBridge>;
#define UNTYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) extern SField const sfName;
#define TYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) extern SF_##stiSuffix const sfName;
extern SField const kSF_INVALID;
extern SField const kSF_GENERIC;
extern SField const kSfInvalid;
extern SField const kSfGeneric;
#include <xrpl/protocol/detail/sfields.macro>

View File

@@ -42,24 +42,24 @@ private:
public:
using value_type = STAmount;
constexpr static int kMIN_OFFSET = -96;
constexpr static int kMAX_OFFSET = 80;
static constexpr int kMinOffset = -96;
static constexpr int kMaxOffset = 80;
// Maximum native value supported by the code
constexpr static std::uint64_t kMIN_VALUE = 1'000'000'000'000'000ull;
static_assert(isPowerOfTen(kMIN_VALUE));
constexpr static std::uint64_t kMAX_VALUE = (kMIN_VALUE * 10) - 1;
static_assert(kMAX_VALUE == 9'999'999'999'999'999ull);
constexpr static std::uint64_t kMAX_NATIVE = 9'000'000'000'000'000'000ull;
static constexpr std::uint64_t kMinValue = 1'000'000'000'000'000ull;
static_assert(isPowerOfTen(kMinValue));
static constexpr std::uint64_t kMaxValue = (kMinValue * 10) - 1;
static_assert(kMaxValue == 9'999'999'999'999'999ull);
static constexpr std::uint64_t kMaxNative = 9'000'000'000'000'000'000ull;
// Max native value on network.
constexpr static std::uint64_t kMAX_NATIVE_N = 100'000'000'000'000'000ull;
constexpr static std::uint64_t kISSUED_CURRENCY = 0x8'000'000'000'000'000ull;
constexpr static std::uint64_t kPOSITIVE = 0x4'000'000'000'000'000ull;
constexpr static std::uint64_t kMP_TOKEN = 0x2'000'000'000'000'000ull;
constexpr static std::uint64_t kVALUE_MASK = ~(kPOSITIVE | kMP_TOKEN);
static constexpr std::uint64_t kMaxNativeN = 100'000'000'000'000'000ull;
static constexpr std::uint64_t kIssuedCurrency = 0x8'000'000'000'000'000ull;
static constexpr std::uint64_t kPositive = 0x4'000'000'000'000'000ull;
static constexpr std::uint64_t kMpToken = 0x2'000'000'000'000'000ull;
static constexpr std::uint64_t kValueMask = ~(kPositive | kMpToken);
static std::uint64_t const kU_RATE_ONE;
static std::uint64_t const kURateOne;
//--------------------------------------------------------------------------
STAmount(SerialIter& sit, SField const& name);
@@ -356,7 +356,7 @@ STAmount::STAmount(A const& asset, int mantissa, int exponent)
// Legacy support for new-style amounts
inline STAmount::STAmount(IOUAmount const& amount, Issue const& issue)
: asset_(issue), offset_(amount.exponent()), isNegative_(amount < beast::kZERO)
: asset_(issue), offset_(amount.exponent()), isNegative_(amount < beast::kZero)
{
if (isNegative_)
{
@@ -371,7 +371,7 @@ inline STAmount::STAmount(IOUAmount const& amount, Issue const& issue)
}
inline STAmount::STAmount(MPTAmount const& amount, MPTIssue const& mptIssue)
: asset_(mptIssue), offset_(0), isNegative_(amount < beast::kZERO)
: asset_(mptIssue), offset_(0), isNegative_(amount < beast::kZero)
{
if (isNegative_)
{
@@ -498,7 +498,7 @@ STAmount::zeroed() const
inline STAmount::
operator bool() const noexcept
{
return *this != beast::kZERO;
return *this != beast::kZero;
}
inline STAmount::
@@ -540,7 +540,7 @@ STAmount::fromNumber(A const& a, Number const& number)
return STAmount{asset, intValue, 0, negative};
}
auto const [mantissa, exponent] = working.normalizeToRange(kMIN_VALUE, kMAX_VALUE);
auto const [mantissa, exponent] = working.normalizeToRange(kMinValue, kMaxValue);
return STAmount{asset, mantissa, exponent, negative};
}
@@ -548,7 +548,7 @@ STAmount::fromNumber(A const& a, Number const& number)
inline void
STAmount::negate()
{
if (*this != beast::kZERO)
if (*this != beast::kZero)
isNegative_ = !isNegative_;
}
@@ -578,7 +578,7 @@ STAmount::value() const noexcept
inline bool
isLegalNet(STAmount const& value)
{
return !value.native() || (value.mantissa() <= STAmount::kMAX_NATIVE_N);
return !value.native() || (value.mantissa() <= STAmount::kMaxNativeN);
}
//------------------------------------------------------------------------------

View File

@@ -65,7 +65,7 @@ struct JsonOptions
}
/// Returns JsonOptions binary negation, can be used with & (above) for set
/// difference e.g. `(options & ~JsonOptions::kINCLUDE_DATE)`
/// difference e.g. `(options & ~JsonOptions::kIncludeDate)`
[[nodiscard]] constexpr JsonOptions friend
operator~(JsonOptions v) noexcept
{

View File

@@ -180,7 +180,7 @@ template <int Bits>
bool
STBitString<Bits>::isDefault() const
{
return value_ == beast::kZERO;
return value_ == beast::kZero;
}
} // namespace xrpl

View File

@@ -24,7 +24,7 @@ public:
STBlob(SField const& f, void const* data, std::size_t size);
STBlob(SField const& f, Buffer&& b);
STBlob(SField const& n);
STBlob(SerialIter&, SField const& name = kSF_GENERIC);
STBlob(SerialIter&, SField const& name = kSfGeneric);
[[nodiscard]] std::size_t
size() const;

View File

@@ -7,11 +7,11 @@
namespace xrpl {
/** Maximum JSON object nesting depth permitted during parsing. */
inline constexpr std::size_t kMAX_PARSED_JSON_DEPTH = 64;
inline constexpr std::size_t kMaxParsedJsonDepth = 64;
/** Maximum number of elements permitted in any JSON array field during parsing.
Requests exceeding this limit are rejected with an invalidParams error. */
inline constexpr std::size_t kMAX_PARSED_JSON_ARRAY_SIZE = 512;
inline constexpr std::size_t kMaxParsedJsonArraySize = 512;
/** Holds the serialized result of parsing an input JSON object.
This does validation and checking on the provided JSON.

View File

@@ -30,8 +30,8 @@ class STTx final : public STObject, public CountedObject<STTx>
TxType tx_type_;
public:
static constexpr std::size_t kMIN_MULTI_SIGNERS = 1;
static constexpr std::size_t kMAX_MULTI_SIGNERS = 32;
static constexpr std::size_t kMinMultiSigners = 1;
static constexpr std::size_t kMaxMultiSigners = 32;
STTx() = delete;
STTx(STTx const& other) = default;

View File

@@ -16,10 +16,10 @@ namespace xrpl {
// Validation flags
// This is a full (as opposed to a partial) validation
constexpr std::uint32_t kVF_FULL_VALIDATION = 0x00000001;
constexpr std::uint32_t kVfFullValidation = 0x00000001;
// The signature is fully canonical
constexpr std::uint32_t kVF_FULLY_CANONICAL_SIG = 0x80000000;
constexpr std::uint32_t kVfFullyCanonicalSig = 0x80000000;
class STValidation final : public STObject, public CountedObject<STValidation>
{
@@ -204,7 +204,7 @@ STValidation::STValidation(
f(*this);
// Finally, sign the validation and mark it as trusted:
setFlag(kVF_FULLY_CANONICAL_SIG);
setFlag(kVfFullyCanonicalSig);
setFieldVL(sfSignature, signDigest(pk, sk, getSigningHash()));
setTrusted();

View File

@@ -17,10 +17,10 @@ namespace xrpl {
class SecretKey
{
public:
static constexpr std::size_t kSIZE = 32;
static constexpr std::size_t kSize = 32;
private:
std::uint8_t buf_[kSIZE]{};
std::uint8_t buf_[kSize]{};
public:
using const_iterator = std::uint8_t const*;
@@ -37,7 +37,7 @@ public:
~SecretKey();
SecretKey(std::array<std::uint8_t, kSIZE> const& data);
SecretKey(std::array<std::uint8_t, kSize> const& data);
SecretKey(Slice const& slice);
[[nodiscard]] std::uint8_t const*

View File

@@ -134,13 +134,13 @@ public:
bool
getInteger(Integer& number, int offset)
{
static auto const kBYTES = sizeof(Integer);
if ((offset + kBYTES) > data_.size())
static auto const kBytes = sizeof(Integer);
if ((offset + kBytes) > data_.size())
return false;
number = 0;
auto ptr = &data_[offset];
for (auto i = 0; i < kBYTES; ++i)
for (auto i = 0; i < kBytes; ++i)
{
if (i)
number <<= 8;

View File

@@ -14,22 +14,22 @@ namespace xrpl {
static inline std::string const&
systemName()
{
static std::string const kNAME = "xrpld";
return kNAME;
static std::string const kName = "xrpld";
return kName;
}
/** Configure the native currency. */
/** Number of drops in the genesis account. */
constexpr XRPAmount kINITIAL_XRP{100'000'000'000 * kDROPS_PER_XRP};
static_assert(kINITIAL_XRP.drops() == 100'000'000'000'000'000);
static_assert(Number::kMAX_REP >= kINITIAL_XRP.drops());
constexpr XRPAmount kInitialXrp{100'000'000'000 * kDropsPerXrp};
static_assert(kInitialXrp.drops() == 100'000'000'000'000'000);
static_assert(Number::kMaxRep >= kInitialXrp.drops());
/** Returns true if the amount does not exceed the initial XRP in existence. */
inline bool
isLegalAmount(XRPAmount const& amount)
{
return amount <= kINITIAL_XRP;
return amount <= kInitialXrp;
}
/** Returns true if the absolute value of the amount does not exceed the initial
@@ -37,31 +37,31 @@ isLegalAmount(XRPAmount const& amount)
inline bool
isLegalAmountSigned(XRPAmount const& amount)
{
return amount >= -kINITIAL_XRP && amount <= kINITIAL_XRP;
return amount >= -kInitialXrp && amount <= kInitialXrp;
}
/* The currency code for the native currency. */
static inline std::string const&
systemCurrencyCode()
{
static std::string const kCODE = "XRP";
return kCODE;
static std::string const kCode = "XRP";
return kCode;
}
/** The XRP ledger network's earliest allowed sequence */
static constexpr std::uint32_t kXRP_LEDGER_EARLIEST_SEQ{32570u};
static constexpr std::uint32_t kXrpLedgerEarliestSeq{32570u};
/** The XRP Ledger mainnet's earliest ledger with a FeeSettings object. Only
* used in asserts and tests. */
static constexpr std::uint32_t kXRP_LEDGER_EARLIEST_FEES{562177u};
static constexpr std::uint32_t kXrpLedgerEarliestFees{562177u};
/** The minimum amount of support an amendment should have. */
constexpr std::ratio<80, 100> kAMENDMENT_MAJORITY_CALC_THRESHOLD;
constexpr std::ratio<80, 100> kAmendmentMajorityCalcThreshold;
/** The minimum amount of time an amendment must hold a majority */
constexpr std::chrono::seconds const kDEFAULT_AMENDMENT_MAJORITY_TIME = weeks{2};
constexpr std::chrono::seconds const kDefaultAmendmentMajorityTime = weeks{2};
} // namespace xrpl
/** Default peer port (IANA registered) */
inline std::uint16_t constexpr kDEFAULT_PEER_PORT{2459};
inline constexpr std::uint16_t kDefaultPeerPort{2459};

View File

@@ -62,7 +62,7 @@ badCurrency();
inline bool
isXRP(Currency const& c)
{
return c == beast::kZERO;
return c == beast::kZero;
}
/** Returns "", "XRP", or three letter ISO code. */

View File

@@ -300,13 +300,13 @@ public:
using jsontype =
std::conditional_t<std::is_signed_v<value_type>, json::Int, json::UInt>;
constexpr auto kMIN = std::numeric_limits<jsontype>::min();
constexpr auto kMAX = std::numeric_limits<jsontype>::max();
constexpr auto kMin = std::numeric_limits<jsontype>::min();
constexpr auto kMax = std::numeric_limits<jsontype>::max();
if (value_ < kMIN)
return kMIN;
if (value_ > kMAX)
return kMAX;
if (value_ < kMin)
return kMin;
if (value_ > kMax)
return kMax;
return static_cast<jsontype>(value_);
}
else
@@ -392,14 +392,14 @@ mulDivU(Source1 value, Dest mul, Source2 div)
}
using desttype = typename Dest::value_type;
constexpr auto kMAX = std::numeric_limits<desttype>::max();
constexpr auto kMax = std::numeric_limits<desttype>::max();
// Shortcuts, since these happen a lot in the real world
if (value == div)
return mul;
if (mul.value() == div.value())
{
if (value.value() > kMAX)
if (value.value() > kMax)
return std::nullopt;
return Dest{static_cast<desttype>(value.value())};
}
@@ -414,7 +414,7 @@ mulDivU(Source1 value, Dest mul, Source2 div)
auto quotient = product / div.value();
if (quotient > kMAX)
if (quotient > kMax)
return std::nullopt;
return Dest{static_cast<desttype>(quotient)};

View File

@@ -357,7 +357,7 @@ private:
// Set a max number of allowed attestations to limit the amount of memory
// 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 kMAX_ATTESTATIONS = 256;
static constexpr std::uint32_t kMaxAttestations = 256;
AttCollection attestations_;
protected:

View File

@@ -202,13 +202,13 @@ public:
std::is_signed_v<value_type> && std::is_integral_v<value_type>,
"Expected XRPAmount to be a signed integral type");
constexpr auto kMIN = std::numeric_limits<json::Int>::min();
constexpr auto kMAX = std::numeric_limits<json::Int>::max();
constexpr auto kMin = std::numeric_limits<json::Int>::min();
constexpr auto kMax = std::numeric_limits<json::Int>::max();
if (drops_ < kMIN)
return kMIN;
if (drops_ > kMAX)
return kMAX;
if (drops_ < kMin)
return kMin;
if (drops_ > kMax)
return kMax;
return static_cast<json::Int>(drops_);
}
@@ -237,12 +237,12 @@ public:
};
/** Number of drops per 1 XRP */
constexpr XRPAmount kDROPS_PER_XRP{1'000'000};
constexpr XRPAmount kDropsPerXrp{1'000'000};
constexpr double
XRPAmount::decimalXRP() const
{
return static_cast<double>(drops_) / kDROPS_PER_XRP.drops();
return static_cast<double>(drops_) / kDropsPerXrp.drops();
}
// Output XRPAmount as just the drops value.

View File

@@ -35,9 +35,9 @@ class STVar
{
private:
// The largest "small object" we can accommodate
static std::size_t constexpr kMAX_SIZE = 72;
static constexpr std::size_t kMaxSize = 72;
std::aligned_storage<kMAX_SIZE>::type d_ = {};
std::aligned_storage<kMaxSize>::type d_ = {};
STBase* p_ = nullptr;
public:
@@ -51,12 +51,12 @@ public:
STVar(STBase&& t) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
{
p_ = t.move(kMAX_SIZE, &d_);
p_ = t.move(kMaxSize, &d_);
}
STVar(STBase const& t)
{
p_ = t.copy(kMAX_SIZE, &d_);
p_ = t.copy(kMaxSize, &d_);
}
STVar(DefaultObjectT, SField const& name);
@@ -110,7 +110,7 @@ private:
void
construct(Args&&... args)
{
if constexpr (sizeof(T) > kMAX_SIZE)
if constexpr (sizeof(T) > kMaxSize)
{
p_ = new T(std::forward<Args>(args)...);
}

View File

@@ -155,16 +155,16 @@ inplaceBigintDivRem(std::span<uint64_t> numerator, std::uint64_t divisor)
[[nodiscard]] inline std::array<std::uint8_t, 10>
b5810ToB58Be(std::uint64_t input)
{
[[maybe_unused]] static constexpr std::uint64_t kB_58_10 = 430804206899405824; // 58^10;
XRPL_ASSERT(input < kB_58_10, "xrpl::b58_fast::detail::b5810ToB58Be : valid input");
constexpr std::size_t kRESULT_SIZE = 10;
std::array<std::uint8_t, kRESULT_SIZE> result{};
[[maybe_unused]] static constexpr std::uint64_t kB5810 = 430804206899405824; // 58^10;
XRPL_ASSERT(input < kB5810, "xrpl::b58_fast::detail::b5810ToB58Be : valid input");
static constexpr std::size_t kResultSize = 10;
std::array<std::uint8_t, kResultSize> result{};
int i = 0;
while (input > 0)
{
std::uint64_t rem = 0;
std::tie(input, rem) = divRem(input, 58);
result[kRESULT_SIZE - 1 - i] = rem;
result[kResultSize - 1 - i] = rem;
i += 1;
}

View File

@@ -27,7 +27,7 @@ TYPED_SFIELD(sfWasLockingChainSend, UINT8, 19)
TYPED_SFIELD(sfWithdrawalPolicy, UINT8, 20)
// 16-bit integers (common)
TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::kSMD_NEVER)
TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::kSmdNever)
TYPED_SFIELD(sfTransactionType, UINT16, 2)
TYPED_SFIELD(sfSignerWeight, UINT16, 3)
TYPED_SFIELD(sfTransferFee, UINT16, 4)
@@ -48,7 +48,7 @@ TYPED_SFIELD(sfNetworkID, UINT32, 1)
TYPED_SFIELD(sfFlags, UINT32, 2)
TYPED_SFIELD(sfSourceTag, UINT32, 3)
TYPED_SFIELD(sfSequence, UINT32, 4)
TYPED_SFIELD(sfPreviousTxnLgrSeq, UINT32, 5, SField::kSMD_DELETE_FINAL)
TYPED_SFIELD(sfPreviousTxnLgrSeq, UINT32, 5, SField::kSmdDeleteFinal)
TYPED_SFIELD(sfLedgerSequence, UINT32, 6)
TYPED_SFIELD(sfCloseTime, UINT32, 7)
TYPED_SFIELD(sfParentCloseTime, UINT32, 8)
@@ -138,12 +138,12 @@ TYPED_SFIELD(sfXChainClaimID, UINT64, 20)
TYPED_SFIELD(sfXChainAccountCreateCount, UINT64, 21)
TYPED_SFIELD(sfXChainAccountClaimCount, UINT64, 22)
TYPED_SFIELD(sfAssetPrice, UINT64, 23)
TYPED_SFIELD(sfMaximumAmount, UINT64, 24, SField::kSMD_BASE_TEN|SField::kSMD_DEFAULT)
TYPED_SFIELD(sfOutstandingAmount, UINT64, 25, SField::kSMD_BASE_TEN|SField::kSMD_DEFAULT)
TYPED_SFIELD(sfMPTAmount, UINT64, 26, SField::kSMD_BASE_TEN|SField::kSMD_DEFAULT)
TYPED_SFIELD(sfMaximumAmount, UINT64, 24, SField::kSmdBaseTen|SField::kSmdDefault)
TYPED_SFIELD(sfOutstandingAmount, UINT64, 25, SField::kSmdBaseTen|SField::kSmdDefault)
TYPED_SFIELD(sfMPTAmount, UINT64, 26, SField::kSmdBaseTen|SField::kSmdDefault)
TYPED_SFIELD(sfIssuerNode, UINT64, 27)
TYPED_SFIELD(sfSubjectNode, UINT64, 28)
TYPED_SFIELD(sfLockedAmount, UINT64, 29, SField::kSMD_BASE_TEN|SField::kSMD_DEFAULT)
TYPED_SFIELD(sfLockedAmount, UINT64, 29, SField::kSmdBaseTen|SField::kSmdDefault)
TYPED_SFIELD(sfVaultNode, UINT64, 30)
TYPED_SFIELD(sfLoanBrokerNode, UINT64, 31)
@@ -167,17 +167,17 @@ TYPED_SFIELD(sfLedgerHash, UINT256, 1)
TYPED_SFIELD(sfParentHash, UINT256, 2)
TYPED_SFIELD(sfTransactionHash, UINT256, 3)
TYPED_SFIELD(sfAccountHash, UINT256, 4)
TYPED_SFIELD(sfPreviousTxnID, UINT256, 5, SField::kSMD_DELETE_FINAL)
TYPED_SFIELD(sfPreviousTxnID, UINT256, 5, SField::kSmdDeleteFinal)
TYPED_SFIELD(sfLedgerIndex, UINT256, 6)
TYPED_SFIELD(sfWalletLocator, UINT256, 7)
TYPED_SFIELD(sfRootIndex, UINT256, 8, SField::kSMD_ALWAYS)
TYPED_SFIELD(sfRootIndex, UINT256, 8, SField::kSmdAlways)
TYPED_SFIELD(sfAccountTxnID, UINT256, 9)
TYPED_SFIELD(sfNFTokenID, UINT256, 10)
TYPED_SFIELD(sfEmitParentTxnID, UINT256, 11)
TYPED_SFIELD(sfEmitNonce, UINT256, 12)
TYPED_SFIELD(sfEmitHookHash, UINT256, 13)
TYPED_SFIELD(sfAMMID, UINT256, 14,
SField::kSMD_PSEUDO_ACCOUNT | SField::kSMD_DEFAULT)
SField::kSmdPseudoAccount | SField::kSmdDefault)
// 256-bit (uncommon)
TYPED_SFIELD(sfBookDirectory, UINT256, 16)
@@ -200,30 +200,30 @@ TYPED_SFIELD(sfHookNamespace, UINT256, 32)
TYPED_SFIELD(sfHookSetTxnID, UINT256, 33)
TYPED_SFIELD(sfDomainID, UINT256, 34)
TYPED_SFIELD(sfVaultID, UINT256, 35,
SField::kSMD_PSEUDO_ACCOUNT | SField::kSMD_DEFAULT)
SField::kSmdPseudoAccount | SField::kSmdDefault)
TYPED_SFIELD(sfParentBatchID, UINT256, 36)
TYPED_SFIELD(sfLoanBrokerID, UINT256, 37,
SField::kSMD_PSEUDO_ACCOUNT | SField::kSMD_DEFAULT)
SField::kSmdPseudoAccount | SField::kSmdDefault)
TYPED_SFIELD(sfLoanID, UINT256, 38)
// number (common)
TYPED_SFIELD(sfNumber, NUMBER, 1)
TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfDebtTotal, NUMBER, 6, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfDebtMaximum, NUMBER, 7, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfCoverAvailable, NUMBER, 8, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfDebtTotal, NUMBER, 6, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfDebtMaximum, NUMBER, 7, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfCoverAvailable, NUMBER, 8, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfLoanOriginationFee, NUMBER, 9)
TYPED_SFIELD(sfLoanServiceFee, NUMBER, 10)
TYPED_SFIELD(sfLatePaymentFee, NUMBER, 11)
TYPED_SFIELD(sfClosePaymentFee, NUMBER, 12)
TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 13, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 13, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfPrincipalRequested, NUMBER, 14)
TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfPeriodicPayment, NUMBER, 16)
TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::kSmdNeedsAsset | SField::kSmdDefault)
// int32
TYPED_SFIELD(sfLoanScale, INT32, 1)
@@ -269,9 +269,9 @@ TYPED_SFIELD(sfLPTokenBalance, AMOUNT, 31)
TYPED_SFIELD(sfPublicKey, VL, 1)
TYPED_SFIELD(sfMessageKey, VL, 2)
TYPED_SFIELD(sfSigningPubKey, VL, 3)
TYPED_SFIELD(sfTxnSignature, VL, 4, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
TYPED_SFIELD(sfTxnSignature, VL, 4, SField::kSmdDefault, SField::kNotSigning)
TYPED_SFIELD(sfURI, VL, 5)
TYPED_SFIELD(sfSignature, VL, 6, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
TYPED_SFIELD(sfSignature, VL, 6, SField::kSmdDefault, SField::kNotSigning)
TYPED_SFIELD(sfDomain, VL, 7)
TYPED_SFIELD(sfFundCode, VL, 8)
TYPED_SFIELD(sfRemoveCode, VL, 9)
@@ -284,7 +284,7 @@ TYPED_SFIELD(sfMemoFormat, VL, 14)
// variable length (uncommon)
TYPED_SFIELD(sfFulfillment, VL, 16)
TYPED_SFIELD(sfCondition, VL, 17)
TYPED_SFIELD(sfMasterSignature, VL, 18, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
TYPED_SFIELD(sfMasterSignature, VL, 18, SField::kSmdDefault, SField::kNotSigning)
TYPED_SFIELD(sfUNLModifyValidator, VL, 19)
TYPED_SFIELD(sfValidatorToDisable, VL, 20)
TYPED_SFIELD(sfValidatorToReEnable, VL, 21)
@@ -326,7 +326,7 @@ TYPED_SFIELD(sfBorrower, ACCOUNT, 25)
TYPED_SFIELD(sfCounterparty, ACCOUNT, 26)
// vector of 256-bit
TYPED_SFIELD(sfIndexes, VECTOR256, 1, SField::kSMD_NEVER)
TYPED_SFIELD(sfIndexes, VECTOR256, 1, SField::kSmdNever)
TYPED_SFIELD(sfHashes, VECTOR256, 2)
TYPED_SFIELD(sfAmendments, VECTOR256, 3)
TYPED_SFIELD(sfNFTokenOffers, VECTOR256, 4)
@@ -387,13 +387,13 @@ UNTYPED_SFIELD(sfCredential, OBJECT, 33)
UNTYPED_SFIELD(sfRawTransaction, OBJECT, 34)
UNTYPED_SFIELD(sfBatchSigner, OBJECT, 35)
UNTYPED_SFIELD(sfBook, OBJECT, 36)
UNTYPED_SFIELD(sfCounterpartySignature, OBJECT, 37, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
UNTYPED_SFIELD(sfCounterpartySignature, OBJECT, 37, SField::kSmdDefault, SField::kNotSigning)
// array of objects (common)
// ARRAY/1 is reserved for end of array
// sfSigningAccounts has never been used.
//UNTYPED_SFIELD(sfSigningAccounts, ARRAY, 2)
UNTYPED_SFIELD(sfSigners, ARRAY, 3, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
UNTYPED_SFIELD(sfSigners, ARRAY, 3, SField::kSmdDefault, SField::kNotSigning)
UNTYPED_SFIELD(sfSignerEntries, ARRAY, 4)
UNTYPED_SFIELD(sfTemplate, ARRAY, 5)
UNTYPED_SFIELD(sfNecessary, ARRAY, 6)
@@ -421,4 +421,4 @@ UNTYPED_SFIELD(sfUnauthorizeCredentials, ARRAY, 27)
UNTYPED_SFIELD(sfAcceptedCredentials, ARRAY, 28)
UNTYPED_SFIELD(sfPermissions, ARRAY, 29)
UNTYPED_SFIELD(sfRawTransactions, ARRAY, 30)
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::kSmdDefault, SField::kNotSigning)

View File

@@ -27,7 +27,7 @@ namespace xrpl {
struct OpensslRipemd160Hasher
{
public:
static constexpr auto const kENDIAN = boost::endian::order::native;
static constexpr auto kEndian = boost::endian::order::native;
using result_type = std::array<std::uint8_t, 20>;
@@ -50,7 +50,7 @@ private:
struct OpensslSha512Hasher
{
public:
static constexpr auto const kENDIAN = boost::endian::order::native;
static constexpr auto kEndian = boost::endian::order::native;
using result_type = std::array<std::uint8_t, 64>;
@@ -73,7 +73,7 @@ private:
struct OpensslSha256Hasher
{
public:
static constexpr auto const kENDIAN = boost::endian::order::native;
static constexpr auto kEndian = boost::endian::order::native;
using result_type = std::array<std::uint8_t, 32>;
@@ -118,7 +118,7 @@ private:
sha256_hasher h_;
public:
static constexpr auto const kENDIAN = boost::endian::order::native;
static constexpr auto kEndian = boost::endian::order::native;
using result_type = std::array<std::uint8_t, 20>;
@@ -154,7 +154,7 @@ private:
sha512_hasher h_;
public:
static constexpr auto const kENDIAN = boost::endian::order::big;
static constexpr auto kEndian = boost::endian::order::big;
using result_type = uint256;

View File

@@ -29,11 +29,11 @@ toUInt32(Taxon t)
return static_cast<std::uint32_t>(t);
}
constexpr std::uint16_t const kFLAG_BURNABLE = 0x0001;
constexpr std::uint16_t const kFLAG_ONLY_XRP = 0x0002;
constexpr std::uint16_t const kFLAG_CREATE_TRUST_LINES = 0x0004;
constexpr std::uint16_t const kFLAG_TRANSFERABLE = 0x0008;
constexpr std::uint16_t const kFLAG_MUTABLE = 0x0010;
constexpr std::uint16_t const kFlagBurnable = 0x0001;
constexpr std::uint16_t const kFlagOnlyXrp = 0x0002;
constexpr std::uint16_t const kFlagCreateTrustLines = 0x0004;
constexpr std::uint16_t const kFlagTransferable = 0x0008;
constexpr std::uint16_t const kFlagMutable = 0x0010;
inline std::uint16_t
getFlags(uint256 const& id)

View File

@@ -8,7 +8,7 @@ namespace xrpl::nft {
// NFT directory pages order their contents based only on the low 96 bits of
// the NFToken value. This mask provides easy access to the necessary mask.
uint256 constexpr kPAGE_MASK(
constexpr uint256 kPageMask(
std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff"));
} // namespace xrpl::nft

View File

@@ -9,20 +9,20 @@ namespace xrpl {
// These pragmas are built at startup and applied to all database
// connections, unless otherwise noted.
inline constexpr char const* kCOMMON_DB_PRAGMA_JOURNAL{"PRAGMA journal_mode=%s;"};
inline constexpr char const* kCOMMON_DB_PRAGMA_SYNC{"PRAGMA synchronous=%s;"};
inline constexpr char const* kCOMMON_DB_PRAGMA_TEMP{"PRAGMA temp_store=%s;"};
inline constexpr char const* kCommonDbPragmaJournal{"PRAGMA journal_mode=%s;"};
inline constexpr char const* kCommonDbPragmaSync{"PRAGMA synchronous=%s;"};
inline constexpr char const* kCommonDbPragmaTemp{"PRAGMA temp_store=%s;"};
// A warning will be logged if any lower-safety sqlite tuning settings
// are used and at least this much ledger history is configured. This
// includes full history nodes. This is because such a large amount of
// data will be more difficult to recover if a rare failure occurs,
// which are more likely with some of the other available tuning settings.
inline constexpr std::uint32_t kSQLITE_TUNING_CUTOFF = 10'000'000;
inline constexpr std::uint32_t kSqliteTuningCutoff = 10'000'000;
// Ledger database holds ledgers and ledger confirmations
inline constexpr auto kLGR_DB_NAME{"ledger.db"};
inline constexpr auto kLgrDbName{"ledger.db"};
inline constexpr std::array<char const*, 5> kLGR_DB_INIT{
inline constexpr std::array<char const*, 5> kLgrDbInit{
{"BEGIN TRANSACTION;",
"CREATE TABLE IF NOT EXISTS Ledgers ( \
@@ -47,9 +47,9 @@ inline constexpr std::array<char const*, 5> kLGR_DB_INIT{
////////////////////////////////////////////////////////////////////////////////
// Transaction database holds transactions and public keys
inline constexpr auto kTX_DB_NAME{"transaction.db"};
inline constexpr auto kTxDbName{"transaction.db"};
inline constexpr std::array<char const*, 8> kTX_DB_INIT{
inline constexpr std::array<char const*, 8> kTxDbInit{
{"BEGIN TRANSACTION;",
"CREATE TABLE IF NOT EXISTS Transactions ( \
@@ -82,9 +82,9 @@ inline constexpr std::array<char const*, 8> kTX_DB_INIT{
////////////////////////////////////////////////////////////////////////////////
inline constexpr auto kWALLET_DB_NAME{"wallet.db"};
inline constexpr auto kWalletDbName{"wallet.db"};
inline constexpr std::array<char const*, 6> kWALLET_DB_INIT{
inline constexpr std::array<char const*, 6> kWalletDbInit{
{"BEGIN TRANSACTION;",
// A node's identity must be persisted, including

View File

@@ -6,28 +6,27 @@ namespace xrpl::Resource {
/** Schedule of fees charged for imposing load on the server. */
/** @{ */
extern Charge const kFEE_MALFORMED_REQUEST; // A request that we can immediately tell is invalid.
extern Charge const kFEE_REQUEST_NO_REPLY; // A request that we cannot satisfy.
extern Charge const
kFEE_INVALID_SIGNATURE; // An object whose signature we had to check that failed.
extern Charge const kFEE_USELESS_DATA; // Data we have no use for.
extern Charge const kFEE_INVALID_DATA; // Data we have to verify before rejecting.
extern Charge const kFeeMalformedRequest; // A request that we can immediately tell is invalid.
extern Charge const kFeeRequestNoReply; // A request that we cannot satisfy.
extern Charge const kFeeInvalidSignature; // An object whose signature we had to check that failed.
extern Charge const kFeeUselessData; // Data we have no use for.
extern Charge const kFeeInvalidData; // Data we have to verify before rejecting.
// RPC loads
extern Charge const kFEE_MALFORMED_RPC; // An RPC request that we can immediately tell is invalid.
extern Charge const kFEE_REFERENCE_RPC; // A default "reference" unspecified load.
extern Charge const kFEE_EXCEPTION_RPC; // RPC load that causes an exception.
extern Charge const kFEE_MEDIUM_BURDEN_RPC; // A somewhat burdensome RPC load.
extern Charge const kFEE_HEAVY_BURDEN_RPC; // A very burdensome RPC load.
extern Charge const kFeeMalformedRpc; // An RPC request that we can immediately tell is invalid.
extern Charge const kFeeReferenceRpc; // A default "reference" unspecified load.
extern Charge const kFeeExceptionRpc; // RPC load that causes an exception.
extern Charge const kFeeMediumBurdenRpc; // A somewhat burdensome RPC load.
extern Charge const kFeeHeavyBurdenRpc; // A very burdensome RPC load.
// Peer loads
extern Charge const kFEE_TRIVIAL_PEER; // Requires no reply.
extern Charge const kFEE_MODERATE_BURDEN_PEER; // Requires some work.
extern Charge const kFEE_HEAVY_BURDEN_PEER; // Extensive work.
extern Charge const kFeeTrivialPeer; // Requires no reply.
extern Charge const kFeeModerateBurdenPeer; // Requires some work.
extern Charge const kFeeHeavyBurdenPeer; // Extensive work.
// Administrative
extern Charge const kFEE_WARNING; // The cost of receiving a warning.
extern Charge const kFEE_DROP; // The cost of being dropped for excess load.
extern Charge const kFeeWarning; // The cost of receiving a warning.
extern Charge const kFeeDrop; // The cost of being dropped for excess load.
/** @} */
} // namespace xrpl::Resource

View File

@@ -67,7 +67,7 @@ struct Entry : public beast::List<Entry>::Node
int refcount;
// Exponentially decaying balance of resource consumption
DecayingSample<kDECAY_WINDOW_SECONDS, clock_type> local_balance;
DecayingSample<kDecayWindowSeconds, clock_type> local_balance;
// Normalized balance contribution from imports
int remote_balance;

View File

@@ -180,7 +180,7 @@ public:
json::Value
getJson()
{
return getJson(kWARNING_THRESHOLD);
return getJson(kWarningThreshold);
}
/** Returns a json::ValueType::Object. */
@@ -243,7 +243,7 @@ public:
{
Gossip::Item item;
item.balance = inboundEntry.local_balance.value(now);
if (item.balance >= kMINIMUM_GOSSIP_BALANCE)
if (item.balance >= kMinimumGossipBalance)
{
item.address = inboundEntry.key->address;
gossip.items.push_back(item);
@@ -270,7 +270,7 @@ public:
{
// This is a new import
Import& next(resultIt->second);
next.whenExpires = elapsed + kGOSSIP_EXPIRATION_SECONDS;
next.whenExpires = elapsed + kGossipExpirationSeconds;
next.items.reserve(gossip.items.size());
for (auto const& gossipItem : gossip.items)
@@ -288,7 +288,7 @@ public:
// balances and then deduct the old remote balances.
Import next;
next.whenExpires = elapsed + kGOSSIP_EXPIRATION_SECONDS;
next.whenExpires = elapsed + kGossipExpirationSeconds;
next.items.reserve(gossip.items.size());
for (auto const& gossipItem : gossip.items)
{
@@ -363,10 +363,10 @@ public:
static Disposition
disposition(int balance)
{
if (balance >= kDROP_THRESHOLD)
if (balance >= kDropThreshold)
return Disposition::Drop;
if (balance >= kWARNING_THRESHOLD)
if (balance >= kWarningThreshold)
return Disposition::Warn;
return Disposition::Ok;
@@ -417,26 +417,25 @@ public:
// LCOV_EXCL_STOP
}
inactive_.pushBack(entry);
entry.whenExpires = clock_.now() + kSECONDS_UNTIL_EXPIRATION;
entry.whenExpires = clock_.now() + kSecondsUntilExpiration;
}
}
Disposition
charge(Entry& entry, Charge const& fee, std::string context = {})
{
static constexpr Charge::value_type kFEE_LOG_AS_WARN = 3000;
static constexpr Charge::value_type kFEE_LOG_AS_INFO = 1000;
static constexpr Charge::value_type kFEE_LOG_AS_DEBUG = 100;
static constexpr Charge::value_type kFeeLogAsWarn = 3000;
static constexpr Charge::value_type kFeeLogAsInfo = 1000;
static constexpr Charge::value_type kFeeLogAsDebug = 100;
static_assert(
kFEE_LOG_AS_WARN > kFEE_LOG_AS_INFO && kFEE_LOG_AS_INFO > kFEE_LOG_AS_DEBUG &&
kFEE_LOG_AS_DEBUG > 10);
kFeeLogAsWarn > kFeeLogAsInfo && kFeeLogAsInfo > kFeeLogAsDebug && kFeeLogAsDebug > 10);
static auto kGET_STREAM = [](Resource::Charge::value_type cost, beast::Journal& journal) {
if (cost >= kFEE_LOG_AS_WARN)
static auto kGetStream = [](Resource::Charge::value_type cost, beast::Journal& journal) {
if (cost >= kFeeLogAsWarn)
return journal.warn();
if (cost >= kFEE_LOG_AS_INFO)
if (cost >= kFeeLogAsInfo)
return journal.info();
if (cost >= kFEE_LOG_AS_DEBUG)
if (cost >= kFeeLogAsDebug)
return journal.debug();
return journal.trace();
};
@@ -447,8 +446,7 @@ public:
std::scoped_lock const _(lock_);
clock_type::time_point const now(clock_.now());
int const balance(entry.add(fee.cost(), now));
JLOG(kGET_STREAM(fee.cost(), journal_))
<< "Charging " << entry << " for " << fee << context;
JLOG(kGetStream(fee.cost(), journal_)) << "Charging " << entry << " for " << fee << context;
return disposition(balance);
}
@@ -461,9 +459,9 @@ public:
std::scoped_lock const _(lock_);
bool notify(false);
auto const elapsed = clock_.now();
if (entry.balance(clock_.now()) >= kWARNING_THRESHOLD && elapsed != entry.lastWarningTime)
if (entry.balance(clock_.now()) >= kWarningThreshold && elapsed != entry.lastWarningTime)
{
charge(entry, kFEE_WARNING);
charge(entry, kFeeWarning);
notify = true;
entry.lastWarningTime = elapsed;
}
@@ -485,15 +483,15 @@ public:
bool drop(false);
clock_type::time_point const now(clock_.now());
int const balance(entry.balance(now));
if (balance >= kDROP_THRESHOLD)
if (balance >= kDropThreshold)
{
JLOG(journal_.warn()) << "Consumer entry " << entry << " dropped with balance "
<< balance << " at or above drop threshold " << kDROP_THRESHOLD;
<< balance << " at or above drop threshold " << kDropThreshold;
// Adding feeDrop at this point keeps the dropped connection
// from re-connecting for at least a little while after it is
// dropped.
charge(entry, kFEE_DROP);
charge(entry, kFeeDrop);
++stats_.drop;
drop = true;
}

View File

@@ -7,21 +7,21 @@ namespace xrpl::Resource {
/** Tunable constants. */
// balance at which a warning is issued
static constexpr auto kWARNING_THRESHOLD = 5000;
static constexpr auto kWarningThreshold = 5000;
// balance at which the consumer is disconnected
static constexpr auto kDROP_THRESHOLD = 25000;
static constexpr auto kDropThreshold = 25000;
// seconds in exponential decay window (power of two)
static constexpr auto kDECAY_WINDOW_SECONDS = 32;
static constexpr auto kDecayWindowSeconds = 32;
// minimum balance to include a load source in gossip
static constexpr auto kMINIMUM_GOSSIP_BALANCE = 1000;
static constexpr auto kMinimumGossipBalance = 1000;
// The number of seconds until an inactive table item is removed
static constexpr std::chrono::seconds kSECONDS_UNTIL_EXPIRATION{300};
static constexpr std::chrono::seconds kSecondsUntilExpiration{300};
// Number of seconds until imported gossip expires
static constexpr std::chrono::seconds kGOSSIP_EXPIRATION_SECONDS{30};
static constexpr std::chrono::seconds kGossipExpirationSeconds{30};
} // namespace xrpl::Resource

View File

@@ -63,7 +63,7 @@ public:
static std::uint32_t
getLoadBase()
{
return kLFT_NORMAL_FEE;
return kLftNormalFee;
}
std::uint32_t
@@ -100,29 +100,29 @@ public:
isLoadedLocal() const
{
std::scoped_lock const sl(lock_);
return (raiseCount_ != 0) || (localTxnLoadFee_ != kLFT_NORMAL_FEE);
return (raiseCount_ != 0) || (localTxnLoadFee_ != kLftNormalFee);
}
bool
isLoadedCluster() const
{
std::scoped_lock const sl(lock_);
return (raiseCount_ != 0) || (localTxnLoadFee_ != kLFT_NORMAL_FEE) ||
(clusterTxnLoadFee_ != kLFT_NORMAL_FEE);
return (raiseCount_ != 0) || (localTxnLoadFee_ != kLftNormalFee) ||
(clusterTxnLoadFee_ != kLftNormalFee);
}
private:
static std::uint32_t constexpr kLFT_NORMAL_FEE = 256; // 256 is the minimum/normal load factor
static std::uint32_t constexpr kLFT_FEE_INC_FRACTION = 4; // increase fee by 1/4
static std::uint32_t constexpr kLFT_FEE_DEC_FRACTION = 4; // decrease fee by 1/4
static std::uint32_t constexpr kLFT_FEE_MAX = kLFT_NORMAL_FEE * 1000000;
static constexpr std::uint32_t kLftNormalFee = 256; // 256 is the minimum/normal load factor
static constexpr std::uint32_t kLftFeeIncFraction = 4; // increase fee by 1/4
static constexpr std::uint32_t kLftFeeDecFraction = 4; // decrease fee by 1/4
static constexpr std::uint32_t kLftFeeMax = kLftNormalFee * 1000000;
beast::Journal const j_;
std::mutex mutable lock_;
std::uint32_t localTxnLoadFee_{kLFT_NORMAL_FEE}; // Scale factor, lftNormalFee = normal fee
std::uint32_t remoteTxnLoadFee_{kLFT_NORMAL_FEE}; // Scale factor, lftNormalFee = normal fee
std::uint32_t clusterTxnLoadFee_{kLFT_NORMAL_FEE}; // Scale factor, lftNormalFee = normal fee
std::uint32_t localTxnLoadFee_{kLftNormalFee}; // Scale factor, lftNormalFee = normal fee
std::uint32_t remoteTxnLoadFee_{kLftNormalFee}; // Scale factor, lftNormalFee = normal fee
std::uint32_t clusterTxnLoadFee_{kLftNormalFee}; // Scale factor, lftNormalFee = normal fee
std::uint32_t raiseCount_{0};
};

View File

@@ -38,9 +38,9 @@ protected:
using endpoint_type = boost::asio::ip::tcp::endpoint;
using yield_context = boost::asio::yield_context;
static constexpr auto kBUFFER_SIZE = 4 * 1024; // size of read/write buffer
static constexpr auto kTIMEOUT_SECONDS = 30; // max seconds without completing a message
static constexpr auto kTIMEOUT_SECONDS_LOCAL = 3; // used for localhost clients
static constexpr auto kBufferSize = 4 * 1024; // size of read/write buffer
static constexpr auto kTimeoutSeconds = 30; // max seconds without completing a message
static constexpr auto kTimeoutSecondsLocal = 3; // used for localhost clients
struct Buffer
{
@@ -196,8 +196,8 @@ BaseHTTPPeer<Handler, Impl>::BaseHTTPPeer(
{
read_buf_.commit(
boost::asio::buffer_copy(read_buf_.prepare(boost::asio::buffer_size(buffers)), buffers));
static std::atomic<int> kSID;
nid_ = ++kSID;
static std::atomic<int> kSid;
nid_ = ++kSid;
id_ = std::string("#") + std::to_string(nid_) + " ";
JLOG(journal_.trace()) << id_ << "accept: " << remote_address_.address();
}
@@ -245,8 +245,7 @@ BaseHTTPPeer<Handler, Impl>::startTimer()
boost::beast::get_lowest_layer(impl().stream_)
.expires_after(
std::chrono::seconds(
remote_address_.address().is_loopback() ? kTIMEOUT_SECONDS_LOCAL
: kTIMEOUT_SECONDS));
remote_address_.address().is_loopback() ? kTimeoutSecondsLocal : kTimeoutSeconds));
}
// Convenience for discarding the error code
@@ -358,7 +357,7 @@ BaseHTTPPeer<Handler, Impl>::doWriter(
for (;;)
{
if (!writer->prepare(kBUFFER_SIZE, resume))
if (!writer->prepare(kBufferSize, resume))
return;
error_code ec;
auto const bytesTransferred = boost::asio::async_write(

View File

@@ -368,12 +368,12 @@ void
BaseWSPeer<Handler, Impl>::startTimer()
{
// Max seconds without completing a message
static constexpr std::chrono::seconds kTIMEOUT{30};
static constexpr std::chrono::seconds kTIMEOUT_LOCAL{3};
static constexpr std::chrono::seconds kTimeout{30};
static constexpr std::chrono::seconds kTimeoutLocal{3};
try
{
timer_.expires_after(remoteEndpoint().address().is_loopback() ? kTIMEOUT_LOCAL : kTIMEOUT);
timer_.expires_after(remoteEndpoint().address().is_loopback() ? kTimeoutLocal : kTimeout);
}
catch (boost::system::system_error const& e)
{

View File

@@ -95,11 +95,11 @@ private:
bool plain_{
port_.protocol.count("http") > 0 || port_.protocol.count("ws") > 0 ||
(port_.protocol.count("ws2") != 0u)};
static constexpr std::chrono::milliseconds kINITIAL_ACCEPT_DELAY{50};
static constexpr std::chrono::milliseconds kMAX_ACCEPT_DELAY{2000};
std::chrono::milliseconds accept_delay_{kINITIAL_ACCEPT_DELAY};
static constexpr std::chrono::milliseconds kInitialAcceptDelay{50};
static constexpr std::chrono::milliseconds kMaxAcceptDelay{2000};
std::chrono::milliseconds accept_delay_{kInitialAcceptDelay};
boost::asio::steady_timer backoff_timer_;
static constexpr double kFREE_FD_THRESHOLD = 0.70;
static constexpr double kFreeFdThreshold = 0.70;
struct FDStats
{
@@ -341,7 +341,7 @@ Door<Handler>::doAccept(boost::asio::yield_context doYield)
backoff_timer_.expires_after(accept_delay_);
boost::system::error_code tec;
backoff_timer_.async_wait(doYield[tec]);
accept_delay_ = std::min(accept_delay_ * 2, kMAX_ACCEPT_DELAY);
accept_delay_ = std::min(accept_delay_ * 2, kMaxAcceptDelay);
JLOG(j_.warn()) << "Throttling do_accept for " << accept_delay_.count() << "ms.";
continue;
}
@@ -366,7 +366,7 @@ Door<Handler>::doAccept(boost::asio::yield_context doYield)
boost::system::error_code tec;
backoff_timer_.async_wait(doYield[tec]);
accept_delay_ = std::min(accept_delay_ * 2, kMAX_ACCEPT_DELAY);
accept_delay_ = std::min(accept_delay_ * 2, kMaxAcceptDelay);
}
else
{
@@ -375,7 +375,7 @@ Door<Handler>::doAccept(boost::asio::yield_context doYield)
continue;
}
accept_delay_ = kINITIAL_ACCEPT_DELAY;
accept_delay_ = kInitialAcceptDelay;
if (ssl_ && plain_)
{
@@ -403,11 +403,11 @@ Door<Handler>::queryFdStats() const
return std::nullopt;
s.limit = static_cast<std::uint64_t>(rl.rlim_cur);
#if BOOST_OS_LINUX
constexpr char const* kFD_DIR = "/proc/self/fd";
static constexpr char const* kFdDir = "/proc/self/fd";
#else
constexpr char const* kFD_DIR = "/dev/fd";
static constexpr char const* kFdDir = "/dev/fd";
#endif
if (DIR* d = ::opendir(kFD_DIR))
if (DIR* d = ::opendir(kFdDir))
{
std::uint64_t cnt = 0;
while (::readdir(d) != nullptr)
@@ -435,7 +435,7 @@ Door<Handler>::shouldThrottleForFds()
auto const& s = *stats;
auto const free = (s.limit > s.used) ? (s.limit - s.used) : 0ull;
double const freeRatio = static_cast<double>(free) / static_cast<double>(s.limit);
return freeRatio < kFREE_FD_THRESHOLD;
return freeRatio < kFreeFdThreshold;
#endif
}

View File

@@ -62,7 +62,7 @@ class ServerImpl : public Server
private:
using clock_type = std::chrono::system_clock;
static constexpr auto kHISTORY_SIZE = 100;
static constexpr auto kHistorySize = 100;
Handler& handler_;
beast::Journal const j_;

View File

@@ -25,7 +25,7 @@ concept IsStrand = std::
*
* @param ePtr The exception that was caught on the coroutine
*/
inline constexpr auto kPROPAGATE_EXCEPTIONS = [](std::exception_ptr ePtr) {
inline constexpr auto kPropagateExceptions = [](std::exception_ptr ePtr) {
if (ePtr)
{
try
@@ -50,7 +50,7 @@ inline constexpr auto kPROPAGATE_EXCEPTIONS = [](std::exception_ptr ePtr) {
/**
* @brief Spawns a coroutine using `boost::asio::spawn`
*
* @note This uses kPROPAGATE_EXCEPTIONS to force asio to propagate exceptions
* @note This uses kPropagateExceptions to force asio to propagate exceptions
* through `io_context`
* @note Since implicit strand was removed from boost::asio::spawn this helper
* function adds the strand back
@@ -68,14 +68,14 @@ spawn(Ctx&& ctx, F&& func)
if constexpr (impl::IsStrand<Ctx>)
{
boost::asio::spawn(
std::forward<Ctx>(ctx), std::forward<F>(func), impl::kPROPAGATE_EXCEPTIONS);
std::forward<Ctx>(ctx), std::forward<F>(func), impl::kPropagateExceptions);
}
else
{
boost::asio::spawn(
boost::asio::make_strand(boost::asio::get_associated_executor(std::forward<Ctx>(ctx))),
std::forward<F>(func),
impl::kPROPAGATE_EXCEPTIONS);
impl::kPropagateExceptions);
}
}

View File

@@ -22,7 +22,7 @@ private:
using CacheType = KeyCache;
public:
static constexpr auto kDEFAULT_CACHE_TARGET_SIZE = 0;
static constexpr auto kDefaultCacheTargetSize = 0;
using key_type = uint256;
using clock_type = typename CacheType::clock_type;
@@ -39,7 +39,7 @@ public:
clock_type& clock,
beast::Journal j,
beast::insight::Collector::ptr const& collector = beast::insight::NullCollector::make(),
std::size_t targetSize = kDEFAULT_CACHE_TARGET_SIZE,
std::size_t targetSize = kDefaultCacheTargetSize,
std::chrono::seconds expiration = std::chrono::minutes{2})
: cache_(name, targetSize, expiration, clock, j, collector), gen_(1)
{

View File

@@ -94,10 +94,10 @@ private:
public:
/** Number of children each non-leaf node has (the 'radix tree' part of the
* map) */
static constexpr unsigned int kBRANCH_FACTOR = SHAMapInnerNode::kBRANCH_FACTOR;
static constexpr unsigned int kBranchFactor = SHAMapInnerNode::kBranchFactor;
/** The depth of the hash map: data is only present in the leaves */
static constexpr unsigned int kLEAF_DEPTH = 64;
static constexpr unsigned int kLeafDepth = 64;
using DeltaItem =
std::pair<boost::intrusive_ptr<SHAMapItem const>, boost::intrusive_ptr<SHAMapItem const>>;
@@ -390,7 +390,7 @@ private:
lastBelow(
intr_ptr::SharedPtr<SHAMapTreeNode> node,
SharedPtrNodeStack& stack,
int branch = kBRANCH_FACTOR) const;
int branch = kBranchFactor) const;
// helper function for firstBelow and lastBelow
SHAMapLeafNode*

View File

@@ -50,7 +50,7 @@ public:
{
s.addRaw(item_->slice());
s.addBitString(item_->key());
s.add8(kWIRE_TYPE_ACCOUNT_STATE);
s.add8(kWireTypeAccountState);
}
void

Some files were not shown because too many files have changed in this diff Show More