mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 01:06:48 +00:00
Merge remote-tracking branch 'XRPLF/develop' into ximinez/directory
* XRPLF/develop: fix: Fix regressions in `server_definitions` (7008) chore: Do not duplicate sanitizer flags (7058) ci: Run pre-commit on diff in clang-tidy workflow (7078) ci: Use XRPLF/create-issue (7076) ci: Rewrite clang-tidy workflow(s) in a reusable manner (7062) chore: Ignore identifier-naming update in git blame (7066) refactor: Enable clang-tidy `readability-identifier-naming` check (6571)
This commit is contained in:
@@ -8,21 +8,21 @@
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
std::uint16_t constexpr TRADING_FEE_THRESHOLD = 1000; // 1%
|
||||
std::uint16_t constexpr kTRADING_FEE_THRESHOLD = 1000; // 1%
|
||||
|
||||
// Auction slot
|
||||
std::uint32_t constexpr TOTAL_TIME_SLOT_SECS = 24 * 3600;
|
||||
std::uint16_t constexpr AUCTION_SLOT_TIME_INTERVALS = 20;
|
||||
std::uint16_t constexpr AUCTION_SLOT_MAX_AUTH_ACCOUNTS = 4;
|
||||
std::uint32_t constexpr AUCTION_SLOT_FEE_SCALE_FACTOR = 100000;
|
||||
std::uint32_t constexpr AUCTION_SLOT_DISCOUNTED_FEE_FRACTION = 10;
|
||||
std::uint32_t constexpr AUCTION_SLOT_MIN_FEE_FRACTION = 25;
|
||||
std::uint32_t constexpr AUCTION_SLOT_INTERVAL_DURATION =
|
||||
TOTAL_TIME_SLOT_SECS / AUCTION_SLOT_TIME_INTERVALS;
|
||||
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;
|
||||
|
||||
// Votes
|
||||
std::uint16_t constexpr VOTE_MAX_SLOTS = 8;
|
||||
std::uint32_t constexpr VOTE_WEIGHT_SCALE_FACTOR = 100000;
|
||||
std::uint16_t constexpr kVOTE_MAX_SLOTS = 8;
|
||||
std::uint32_t constexpr kVOTE_WEIGHT_SCALE_FACTOR = 100000;
|
||||
|
||||
class STObject;
|
||||
class STAmount;
|
||||
@@ -77,7 +77,7 @@ ammEnabled(Rules const&);
|
||||
inline Number
|
||||
getFee(std::uint16_t tfee)
|
||||
{
|
||||
return Number{tfee} / AUCTION_SLOT_FEE_SCALE_FACTOR;
|
||||
return Number{tfee} / kAUCTION_SLOT_FEE_SCALE_FACTOR;
|
||||
}
|
||||
|
||||
/** Get fee multiplier (1 - tfee)
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
} // namespace detail
|
||||
|
||||
/** A 160-bit unsigned that uniquely identifies an account. */
|
||||
using AccountID = base_uint<160, detail::AccountIDTag>;
|
||||
using AccountID = BaseUint<160, detail::AccountIDTag>;
|
||||
|
||||
/** Convert AccountID to base58 checked string */
|
||||
std::string
|
||||
@@ -63,13 +63,13 @@ noAccount();
|
||||
*/
|
||||
// DEPRECATED
|
||||
bool
|
||||
to_issuer(AccountID&, std::string const&);
|
||||
toIssuer(AccountID&, std::string const&);
|
||||
|
||||
// DEPRECATED Should be checking the currency or native flag
|
||||
inline bool
|
||||
isXRP(AccountID const& c)
|
||||
{
|
||||
return c == beast::zero;
|
||||
return c == beast::kZERO;
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
@@ -105,10 +105,10 @@ initAccountIdCache(std::size_t count);
|
||||
} // namespace xrpl
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
namespace Json {
|
||||
namespace json {
|
||||
template <>
|
||||
inline xrpl::AccountID
|
||||
getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
getOrThrow(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
using namespace xrpl;
|
||||
|
||||
@@ -117,7 +117,7 @@ getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
return *r;
|
||||
Throw<JsonTypeMismatchError>(field.getJsonName(), "AccountID");
|
||||
}
|
||||
} // namespace Json
|
||||
} // namespace json
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ toSTAmount(IOUAmount const& iou, Asset const& asset)
|
||||
XRPL_ASSERT(asset.holds<Issue>(), "xrpl::toSTAmount : is Issue");
|
||||
bool const isNeg = iou.signum() < 0;
|
||||
std::uint64_t const umant = isNeg ? -iou.mantissa() : iou.mantissa();
|
||||
return STAmount(asset, umant, iou.exponent(), isNeg, STAmount::unchecked());
|
||||
return STAmount(asset, umant, iou.exponent(), isNeg, STAmount::Unchecked());
|
||||
}
|
||||
|
||||
inline STAmount
|
||||
@@ -96,9 +96,9 @@ inline MPTAmount
|
||||
toAmount<MPTAmount>(STAmount const& amt)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
amt.holds<MPTIssue>() && amt.mantissa() <= maxMPTokenAmount && amt.exponent() == 0,
|
||||
amt.holds<MPTIssue>() && amt.mantissa() <= kMAX_MP_TOKEN_AMOUNT && amt.exponent() == 0,
|
||||
"xrpl::toAmount<MPTAmount> : maximum mantissa");
|
||||
if (amt.mantissa() > maxMPTokenAmount || amt.exponent() != 0)
|
||||
if (amt.mantissa() > kMAX_MP_TOKEN_AMOUNT || 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();
|
||||
@@ -141,9 +141,9 @@ toAmount<MPTAmount>(MPTAmount const& amt)
|
||||
|
||||
template <typename T>
|
||||
T
|
||||
toAmount(Asset const& asset, Number const& n, Number::rounding_mode mode = Number::getround())
|
||||
toAmount(Asset const& asset, Number const& n, Number::RoundingMode mode = Number::getround())
|
||||
{
|
||||
saveNumberRoundMode const rm(Number::getround());
|
||||
SaveNumberRoundMode const rm(Number::getround());
|
||||
if (isXRP(asset))
|
||||
Number::setround(mode);
|
||||
|
||||
@@ -167,8 +167,8 @@ toAmount(Asset const& asset, Number const& n, Number::rounding_mode mode = Numbe
|
||||
}
|
||||
else
|
||||
{
|
||||
constexpr bool alwaysFalse = !std::is_same_v<T, T>;
|
||||
static_assert(alwaysFalse, "Unsupported type for toAmount");
|
||||
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
|
||||
static_assert(kALWAYS_FALSE, "Unsupported type for toAmount");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,35 +178,35 @@ toMaxAmount(Asset const& asset)
|
||||
{
|
||||
if constexpr (std::is_same_v<IOUAmount, T>)
|
||||
{
|
||||
return IOUAmount(STAmount::cMaxValue, STAmount::cMaxOffset);
|
||||
return IOUAmount(STAmount::kMAX_VALUE, STAmount::kMAX_OFFSET);
|
||||
}
|
||||
else if constexpr (std::is_same_v<XRPAmount, T>)
|
||||
{
|
||||
return XRPAmount(static_cast<std::int64_t>(STAmount::cMaxNativeN));
|
||||
return XRPAmount(static_cast<std::int64_t>(STAmount::kMAX_NATIVE_N));
|
||||
}
|
||||
else if constexpr (std::is_same_v<MPTAmount, T>)
|
||||
{
|
||||
return MPTAmount(maxMPTokenAmount);
|
||||
return MPTAmount(kMAX_MP_TOKEN_AMOUNT);
|
||||
}
|
||||
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::cMaxNativeN));
|
||||
return STAmount(issue, STAmount::cMaxValue, STAmount::cMaxOffset);
|
||||
return STAmount(issue, static_cast<std::int64_t>(STAmount::kMAX_NATIVE_N));
|
||||
return STAmount(issue, STAmount::kMAX_VALUE, STAmount::kMAX_OFFSET);
|
||||
},
|
||||
[](MPTIssue const& issue) { return STAmount(issue, maxMPTokenAmount); });
|
||||
[](MPTIssue const& issue) { return STAmount(issue, kMAX_MP_TOKEN_AMOUNT); });
|
||||
}
|
||||
else
|
||||
{
|
||||
constexpr bool alwaysFalse = !std::is_same_v<T, T>;
|
||||
static_assert(alwaysFalse, "Unsupported type for toMaxAmount");
|
||||
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
|
||||
static_assert(kALWAYS_FALSE, "Unsupported type for toMaxAmount");
|
||||
}
|
||||
}
|
||||
|
||||
inline STAmount
|
||||
toSTAmount(Asset const& asset, Number const& n, Number::rounding_mode mode = Number::getround())
|
||||
toSTAmount(Asset const& asset, Number const& n, Number::RoundingMode mode = Number::getround())
|
||||
{
|
||||
return toAmount<STAmount>(asset, n, mode);
|
||||
}
|
||||
@@ -233,8 +233,8 @@ getAsset(T const& amt)
|
||||
}
|
||||
else
|
||||
{
|
||||
constexpr bool alwaysFalse = !std::is_same_v<T, T>;
|
||||
static_assert(alwaysFalse, "Unsupported type for getIssue");
|
||||
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
|
||||
static_assert(kALWAYS_FALSE, "Unsupported type for getIssue");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,8 +260,8 @@ get(STAmount const& a)
|
||||
}
|
||||
else
|
||||
{
|
||||
constexpr bool alwaysFalse = !std::is_same_v<T, T>;
|
||||
static_assert(alwaysFalse, "Unsupported type for get");
|
||||
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
|
||||
static_assert(kALWAYS_FALSE, "Unsupported type for get");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,49 +35,49 @@ namespace xrpl {
|
||||
namespace RPC {
|
||||
|
||||
template <unsigned int Version>
|
||||
constexpr static std::integral_constant<unsigned, Version> apiVersion = {};
|
||||
constexpr static std::integral_constant<unsigned, Version> kAPI_VERSION = {};
|
||||
|
||||
constexpr static auto apiInvalidVersion = apiVersion<0>;
|
||||
constexpr static auto apiMinimumSupportedVersion = apiVersion<1>;
|
||||
constexpr static auto apiMaximumSupportedVersion = apiVersion<2>;
|
||||
constexpr static auto apiVersionIfUnspecified = apiVersion<1>;
|
||||
constexpr static auto apiCommandLineVersion = apiVersion<1>; // TODO Bump to 2 later
|
||||
constexpr static auto apiBetaVersion = apiVersion<3>;
|
||||
constexpr static auto apiMaximumValidVersion = apiBetaVersion;
|
||||
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_assert(apiInvalidVersion < apiMinimumSupportedVersion);
|
||||
static_assert(kAPI_INVALID_VERSION < kAPI_MINIMUM_SUPPORTED_VERSION);
|
||||
static_assert(
|
||||
apiVersionIfUnspecified >= apiMinimumSupportedVersion &&
|
||||
apiVersionIfUnspecified <= apiMaximumSupportedVersion);
|
||||
kAPI_VERSION_IF_UNSPECIFIED >= kAPI_MINIMUM_SUPPORTED_VERSION &&
|
||||
kAPI_VERSION_IF_UNSPECIFIED <= kAPI_MAXIMUM_SUPPORTED_VERSION);
|
||||
static_assert(
|
||||
apiCommandLineVersion >= apiMinimumSupportedVersion &&
|
||||
apiCommandLineVersion <= apiMaximumSupportedVersion);
|
||||
static_assert(apiMaximumSupportedVersion >= apiMinimumSupportedVersion);
|
||||
static_assert(apiBetaVersion >= apiMaximumSupportedVersion);
|
||||
static_assert(apiMaximumValidVersion >= apiMaximumSupportedVersion);
|
||||
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);
|
||||
|
||||
inline void
|
||||
setVersion(Json::Value& parent, unsigned int apiVersion, bool betaEnabled)
|
||||
setVersion(json::Value& parent, unsigned int apiVersion, bool betaEnabled)
|
||||
{
|
||||
XRPL_ASSERT(apiVersion != apiInvalidVersion, "xrpl::RPC::setVersion : input is valid");
|
||||
XRPL_ASSERT(apiVersion != kAPI_INVALID_VERSION, "xrpl::RPC::setVersion : input is valid");
|
||||
|
||||
auto& retObj = parent[jss::version] = Json::objectValue;
|
||||
auto& retObj = parent[jss::version] = json::ObjectValue;
|
||||
|
||||
if (apiVersion == apiVersionIfUnspecified)
|
||||
if (apiVersion == kAPI_VERSION_IF_UNSPECIFIED)
|
||||
{
|
||||
// API version numbers used in API version 1
|
||||
static beast::SemanticVersion const firstVersion{"1.0.0"};
|
||||
static beast::SemanticVersion const goodVersion{"1.0.0"};
|
||||
static beast::SemanticVersion const lastVersion{"1.0.0"};
|
||||
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"};
|
||||
|
||||
retObj[jss::first] = firstVersion.print();
|
||||
retObj[jss::good] = goodVersion.print();
|
||||
retObj[jss::last] = lastVersion.print();
|
||||
retObj[jss::first] = kFIRST_VERSION.print();
|
||||
retObj[jss::good] = kGOOD_VERSION.print();
|
||||
retObj[jss::last] = kLAST_VERSION.print();
|
||||
}
|
||||
else
|
||||
{
|
||||
retObj[jss::first] = apiMinimumSupportedVersion.value;
|
||||
retObj[jss::last] = betaEnabled ? apiBetaVersion : apiMaximumSupportedVersion;
|
||||
retObj[jss::first] = kAPI_MINIMUM_SUPPORTED_VERSION.value;
|
||||
retObj[jss::last] = betaEnabled ? kAPI_BETA_VERSION : kAPI_MAXIMUM_SUPPORTED_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ setVersion(Json::Value& parent, unsigned int apiVersion, bool betaEnabled)
|
||||
* @return the api version number
|
||||
*/
|
||||
inline unsigned int
|
||||
getAPIVersionNumber(Json::Value const& jv, bool betaEnabled)
|
||||
getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
|
||||
{
|
||||
static Json::Value const minVersion(RPC::apiMinimumSupportedVersion);
|
||||
Json::Value const maxVersion(
|
||||
betaEnabled ? RPC::apiBetaVersion : RPC::apiMaximumSupportedVersion);
|
||||
static json::Value const kMIN_VERSION(RPC::kAPI_MINIMUM_SUPPORTED_VERSION);
|
||||
json::Value const maxVersion(
|
||||
betaEnabled ? RPC::kAPI_BETA_VERSION : RPC::kAPI_MAXIMUM_SUPPORTED_VERSION);
|
||||
|
||||
if (jv.isObject())
|
||||
{
|
||||
@@ -109,52 +109,52 @@ getAPIVersionNumber(Json::Value const& jv, bool betaEnabled)
|
||||
auto const specifiedVersion = jv[jss::api_version];
|
||||
if (!specifiedVersion.isInt() && !specifiedVersion.isUInt())
|
||||
{
|
||||
return RPC::apiInvalidVersion;
|
||||
return RPC::kAPI_INVALID_VERSION;
|
||||
}
|
||||
auto const specifiedVersionInt = specifiedVersion.asInt();
|
||||
if (specifiedVersionInt < minVersion || specifiedVersionInt > maxVersion)
|
||||
if (specifiedVersionInt < kMIN_VERSION || specifiedVersionInt > maxVersion)
|
||||
{
|
||||
return RPC::apiInvalidVersion;
|
||||
return RPC::kAPI_INVALID_VERSION;
|
||||
}
|
||||
return specifiedVersionInt;
|
||||
}
|
||||
}
|
||||
|
||||
return RPC::apiVersionIfUnspecified;
|
||||
return RPC::kAPI_VERSION_IF_UNSPECIFIED;
|
||||
}
|
||||
|
||||
} // namespace RPC
|
||||
|
||||
template <unsigned minVer, unsigned maxVer, typename Fn, typename... Args>
|
||||
template <unsigned MinVer, unsigned MaxVer, typename Fn, typename... Args>
|
||||
void
|
||||
forApiVersions(Fn const& fn, Args&&... args)
|
||||
requires //
|
||||
(maxVer >= minVer) && //
|
||||
(minVer >= RPC::apiMinimumSupportedVersion) && //
|
||||
(RPC::apiMaximumValidVersion >= maxVer) && requires {
|
||||
fn(std::integral_constant<unsigned int, minVer>{}, std::forward<Args>(args)...);
|
||||
fn(std::integral_constant<unsigned int, maxVer>{}, std::forward<Args>(args)...);
|
||||
requires //
|
||||
(MaxVer >= MinVer) && //
|
||||
(MinVer >= RPC::kAPI_MINIMUM_SUPPORTED_VERSION) && //
|
||||
(RPC::kAPI_MAXIMUM_VALID_VERSION >= 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 size = maxVer + 1 - minVer;
|
||||
[&]<std::size_t... offset>(std::index_sequence<offset...>) {
|
||||
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)...)),
|
||||
std::integral_constant<unsigned int, MinVer + Offset>{}, std::forward<Args>(args)...)),
|
||||
...);
|
||||
// NOLINTEND(bugprone-use-after-move)
|
||||
}(std::make_index_sequence<size>{});
|
||||
}(std::make_index_sequence<kSIZE>{});
|
||||
}
|
||||
|
||||
template <typename Fn, typename... Args>
|
||||
void
|
||||
forAllApiVersions(Fn const& fn, Args&&... args)
|
||||
requires requires {
|
||||
forApiVersions<RPC::apiMinimumSupportedVersion, RPC::apiMaximumValidVersion>(
|
||||
forApiVersions<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>(
|
||||
fn, std::forward<Args>(args)...);
|
||||
}
|
||||
{
|
||||
forApiVersions<RPC::apiMinimumSupportedVersion, RPC::apiMaximumValidVersion>(
|
||||
forApiVersions<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>(
|
||||
fn, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ struct BadAsset
|
||||
inline BadAsset const&
|
||||
badAsset()
|
||||
{
|
||||
static BadAsset const a;
|
||||
return a;
|
||||
static BadAsset const kA;
|
||||
return kA;
|
||||
}
|
||||
|
||||
/* Asset is an abstraction of three different issue types: XRP, IOU, MPT.
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
token() const;
|
||||
|
||||
void
|
||||
setJson(Json::Value& jv) const;
|
||||
setJson(json::Value& jv) const;
|
||||
|
||||
STAmount
|
||||
operator()(Number const&) const;
|
||||
@@ -148,15 +148,15 @@ public:
|
||||
};
|
||||
|
||||
template <ValidIssueType TIss>
|
||||
constexpr bool is_issue_v = std::is_same_v<TIss, Issue>;
|
||||
constexpr bool kIS_ISSUE_V = std::is_same_v<TIss, Issue>;
|
||||
|
||||
template <ValidIssueType TIss>
|
||||
constexpr bool is_mptissue_v = std::is_same_v<TIss, MPTIssue>;
|
||||
constexpr bool kIS_MPTISSUE_V = std::is_same_v<TIss, MPTIssue>;
|
||||
|
||||
inline Json::Value
|
||||
to_json(Asset const& asset)
|
||||
inline json::Value
|
||||
toJson(Asset const& asset)
|
||||
{
|
||||
Json::Value jv;
|
||||
json::Value jv;
|
||||
asset.setJson(jv);
|
||||
return jv;
|
||||
}
|
||||
@@ -205,13 +205,13 @@ Asset::getAmountType() const
|
||||
{
|
||||
return visit(
|
||||
[&](Issue const& issue) -> Asset::AmtType {
|
||||
constexpr AmountType<XRPAmount> xrp;
|
||||
constexpr AmountType<IOUAmount> iou;
|
||||
return native() ? AmtType(xrp) : AmtType(iou);
|
||||
constexpr AmountType<XRPAmount> kXRP;
|
||||
constexpr AmountType<IOUAmount> kIOU;
|
||||
return native() ? AmtType(kXRP) : AmtType(kIOU);
|
||||
},
|
||||
[&](MPTIssue const& issue) -> Asset::AmtType {
|
||||
constexpr AmountType<MPTAmount> mpt;
|
||||
return AmtType(mpt);
|
||||
constexpr AmountType<MPTAmount> kMPT;
|
||||
return AmtType(kMPT);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -237,12 +237,12 @@ constexpr std::weak_ordering
|
||||
operator<=>(Asset const& lhs, Asset const& rhs)
|
||||
{
|
||||
return std::visit(
|
||||
[]<ValidIssueType TLhs, ValidIssueType TRhs>(TLhs const& lhs_, TRhs const& rhs_) {
|
||||
[]<ValidIssueType TLhs, ValidIssueType TRhs>(TLhs const& lhs, TRhs const& rhs) {
|
||||
if constexpr (std::is_same_v<TLhs, TRhs>)
|
||||
{
|
||||
return std::weak_ordering(lhs_ <=> rhs_);
|
||||
return std::weak_ordering(lhs <=> rhs);
|
||||
}
|
||||
else if constexpr (is_issue_v<TLhs> && is_mptissue_v<TRhs>)
|
||||
else if constexpr (kIS_ISSUE_V<TLhs> && kIS_MPTISSUE_V<TRhs>)
|
||||
{
|
||||
return std::weak_ordering::greater;
|
||||
}
|
||||
@@ -303,10 +303,10 @@ std::string
|
||||
to_string(Asset const& asset);
|
||||
|
||||
bool
|
||||
validJSONAsset(Json::Value const& jv);
|
||||
validJSONAsset(json::Value const& jv);
|
||||
|
||||
Asset
|
||||
assetFromJson(Json::Value const& jv);
|
||||
assetFromJson(json::Value const& jv);
|
||||
|
||||
inline bool
|
||||
isConsistent(Asset const& asset)
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace xrpl {
|
||||
inline void
|
||||
serializeBatch(Serializer& msg, std::uint32_t const& flags, std::vector<uint256> const& txids)
|
||||
{
|
||||
msg.add32(HashPrefix::batch);
|
||||
msg.add32(HashPrefix::Batch);
|
||||
msg.add32(flags);
|
||||
msg.add32(std::uint32_t(txids.size()));
|
||||
for (auto const& txid : txids)
|
||||
|
||||
@@ -21,8 +21,8 @@ public:
|
||||
|
||||
Book() = default;
|
||||
|
||||
Book(Asset const& in_, Asset const& out_, std::optional<uint256> const& domain_)
|
||||
: in(in_), out(out_), domain(domain_)
|
||||
Book(Asset const& in, Asset const& out, std::optional<uint256> const& domain)
|
||||
: in(in), out(out), domain(domain)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -140,8 +140,8 @@ private:
|
||||
using issue_hasher = std::hash<xrpl::Issue>;
|
||||
using mptissue_hasher = std::hash<xrpl::MPTIssue>;
|
||||
|
||||
issue_hasher m_issue_hasher;
|
||||
mptissue_hasher m_mptissue_hasher;
|
||||
issue_hasher m_issue_hasher_;
|
||||
mptissue_hasher m_mptissue_hasher_;
|
||||
|
||||
public:
|
||||
explicit hash() = default;
|
||||
@@ -151,11 +151,11 @@ public:
|
||||
{
|
||||
return asset.visit(
|
||||
[&](xrpl::Issue const& issue) {
|
||||
value_type const result(m_issue_hasher(issue));
|
||||
value_type const result(m_issue_hasher_(issue));
|
||||
return result;
|
||||
},
|
||||
[&](xrpl::MPTIssue const& issue) {
|
||||
value_type const result(m_mptissue_hasher(issue));
|
||||
value_type const result(m_mptissue_hasher_(issue));
|
||||
return result;
|
||||
});
|
||||
}
|
||||
@@ -170,8 +170,8 @@ private:
|
||||
using asset_hasher = std::hash<xrpl::Asset>;
|
||||
using uint256_hasher = xrpl::uint256::hasher;
|
||||
|
||||
asset_hasher m_asset_hasher;
|
||||
uint256_hasher m_uint256_hasher;
|
||||
asset_hasher issue_hasher_;
|
||||
uint256_hasher uint256_hasher_;
|
||||
|
||||
public:
|
||||
hash() = default;
|
||||
@@ -182,11 +182,11 @@ public:
|
||||
value_type
|
||||
operator()(argument_type const& value) const
|
||||
{
|
||||
value_type result(m_asset_hasher(value.in));
|
||||
boost::hash_combine(result, m_asset_hasher(value.out));
|
||||
value_type result(issue_hasher_(value.in));
|
||||
boost::hash_combine(result, issue_hasher_(value.out));
|
||||
|
||||
if (value.domain)
|
||||
boost::hash_combine(result, m_uint256_hasher(*value.domain));
|
||||
boost::hash_combine(result, uint256_hasher_(*value.domain));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ struct CombineVisitors : Ts...
|
||||
// robust than class template argument deduction (CTAD) via the deduction guide.
|
||||
template <typename... Ts>
|
||||
constexpr CombineVisitors<std::decay_t<Ts>...>
|
||||
make_combine_visitors(Ts&&... ts)
|
||||
makeCombineVisitors(Ts&&... ts)
|
||||
{
|
||||
// std::decay_t<Ts> is used to remove references/constness from the lambda
|
||||
// types before they are passed as template arguments to the CombineVisitors
|
||||
@@ -74,11 +74,11 @@ constexpr auto
|
||||
visit(Variant&& v, Visitors&&... visitors) -> decltype(auto)
|
||||
{
|
||||
// Use the function template helper instead of raw CTAD.
|
||||
auto visitor_set = make_combine_visitors(std::forward<Visitors>(visitors)...);
|
||||
auto visitorSet = makeCombineVisitors(std::forward<Visitors>(visitors)...);
|
||||
|
||||
// Delegate to std::visit, perfectly forwarding the variant and the visitor
|
||||
// set.
|
||||
return std::visit(visitor_set, std::forward<Variant>(v));
|
||||
return std::visit(visitorSet, std::forward<Variant>(v));
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -19,131 +19,131 @@ namespace xrpl {
|
||||
// or repurpose error code values.
|
||||
// Protocol-wide, 50+ files
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum error_code_i {
|
||||
enum ErrorCodeI {
|
||||
// -1 represents codes not listed in this enumeration
|
||||
rpcUNKNOWN = -1,
|
||||
RpcUnknown = -1,
|
||||
|
||||
rpcSUCCESS = 0,
|
||||
RpcSuccess = 0,
|
||||
|
||||
rpcBAD_SYNTAX = 1,
|
||||
rpcJSON_RPC = 2,
|
||||
rpcFORBIDDEN = 3,
|
||||
RpcBadSyntax = 1,
|
||||
RpcJsonRpc = 2,
|
||||
RpcForbidden = 3,
|
||||
|
||||
rpcWRONG_NETWORK = 4,
|
||||
RpcWrongNetwork = 4,
|
||||
// Misc failure
|
||||
// unused 5,
|
||||
rpcNO_PERMISSION = 6,
|
||||
rpcNO_EVENTS = 7,
|
||||
RpcNoPermission = 6,
|
||||
RpcNoEvents = 7,
|
||||
// unused 8,
|
||||
rpcTOO_BUSY = 9,
|
||||
rpcSLOW_DOWN = 10,
|
||||
rpcHIGH_FEE = 11,
|
||||
rpcNOT_ENABLED = 12,
|
||||
rpcNOT_READY = 13,
|
||||
rpcAMENDMENT_BLOCKED = 14,
|
||||
RpcTooBusy = 9,
|
||||
RpcSlowDown = 10,
|
||||
RpcHighFee = 11,
|
||||
RpcNotEnabled = 12,
|
||||
RpcNotReady = 13,
|
||||
RpcAmendmentBlocked = 14,
|
||||
|
||||
// Networking
|
||||
rpcNO_CLOSED = 15,
|
||||
rpcNO_CURRENT = 16,
|
||||
rpcNO_NETWORK = 17,
|
||||
rpcNOT_SYNCED = 18,
|
||||
RpcNoClosed = 15,
|
||||
RpcNoCurrent = 16,
|
||||
RpcNoNetwork = 17,
|
||||
RpcNotSynced = 18,
|
||||
|
||||
// Ledger state
|
||||
rpcACT_NOT_FOUND = 19,
|
||||
RpcActNotFound = 19,
|
||||
// unused 20,
|
||||
rpcLGR_NOT_FOUND = 21,
|
||||
rpcLGR_NOT_VALIDATED = 22,
|
||||
rpcMASTER_DISABLED = 23,
|
||||
RpcLgrNotFound = 21,
|
||||
RpcLgrNotValidated = 22,
|
||||
RpcMasterDisabled = 23,
|
||||
// unused 24,
|
||||
// unused 25,
|
||||
// unused 26,
|
||||
// unused 27,
|
||||
// unused 28,
|
||||
rpcTXN_NOT_FOUND = 29,
|
||||
rpcINVALID_HOTWALLET = 30,
|
||||
RpcTxnNotFound = 29,
|
||||
RpcInvalidHotwallet = 30,
|
||||
|
||||
// Malformed command
|
||||
rpcINVALID_PARAMS = 31,
|
||||
rpcUNKNOWN_COMMAND = 32,
|
||||
rpcNO_PF_REQUEST = 33,
|
||||
RpcInvalidParams = 31,
|
||||
RpcUnknownCommand = 32,
|
||||
RpcNoPfRequest = 33,
|
||||
|
||||
// Bad parameter
|
||||
// NOT USED DO NOT USE AGAIN rpcACT_BITCOIN = 34,
|
||||
rpcACT_MALFORMED = 35,
|
||||
rpcALREADY_MULTISIG = 36,
|
||||
rpcALREADY_SINGLE_SIG = 37,
|
||||
RpcActMalformed = 35,
|
||||
RpcAlreadyMultisig = 36,
|
||||
RpcAlreadySingleSig = 37,
|
||||
// unused 38,
|
||||
// unused 39,
|
||||
rpcBAD_FEATURE = 40,
|
||||
rpcBAD_ISSUER = 41,
|
||||
rpcBAD_MARKET = 42,
|
||||
rpcBAD_SECRET = 43,
|
||||
rpcBAD_SEED = 44,
|
||||
rpcCHANNEL_MALFORMED = 45,
|
||||
rpcCHANNEL_AMT_MALFORMED = 46,
|
||||
rpcCOMMAND_MISSING = 47,
|
||||
rpcDST_ACT_MALFORMED = 48,
|
||||
rpcDST_ACT_MISSING = 49,
|
||||
rpcDST_ACT_NOT_FOUND = 50,
|
||||
rpcDST_AMT_MALFORMED = 51,
|
||||
rpcDST_AMT_MISSING = 52,
|
||||
rpcDST_ISR_MALFORMED = 53,
|
||||
RpcBadFeature = 40,
|
||||
RpcBadIssuer = 41,
|
||||
RpcBadMarket = 42,
|
||||
RpcBadSecret = 43,
|
||||
RpcBadSeed = 44,
|
||||
RpcChannelMalformed = 45,
|
||||
RpcChannelAmtMalformed = 46,
|
||||
RpcCommandMissing = 47,
|
||||
RpcDstActMalformed = 48,
|
||||
RpcDstActMissing = 49,
|
||||
RpcDstActNotFound = 50,
|
||||
RpcDstAmtMalformed = 51,
|
||||
RpcDstAmtMissing = 52,
|
||||
RpcDstIsrMalformed = 53,
|
||||
// unused 54,
|
||||
// unused 55,
|
||||
// unused 56,
|
||||
rpcLGR_IDXS_INVALID = 57,
|
||||
rpcLGR_IDX_MALFORMED = 58,
|
||||
RpcLgrIdxsInvalid = 57,
|
||||
RpcLgrIdxMalformed = 58,
|
||||
// unused 59,
|
||||
// unused 60,
|
||||
// unused 61,
|
||||
rpcPUBLIC_MALFORMED = 62,
|
||||
rpcSIGNING_MALFORMED = 63,
|
||||
rpcSENDMAX_MALFORMED = 64,
|
||||
rpcSRC_ACT_MALFORMED = 65,
|
||||
rpcSRC_ACT_MISSING = 66,
|
||||
rpcSRC_ACT_NOT_FOUND = 67,
|
||||
rpcDELEGATE_ACT_NOT_FOUND = 68,
|
||||
rpcSRC_CUR_MALFORMED = 69,
|
||||
rpcSRC_ISR_MALFORMED = 70,
|
||||
rpcSTREAM_MALFORMED = 71,
|
||||
rpcATX_DEPRECATED = 72,
|
||||
RpcPublicMalformed = 62,
|
||||
RpcSigningMalformed = 63,
|
||||
RpcSendmaxMalformed = 64,
|
||||
RpcSrcActMalformed = 65,
|
||||
RpcSrcActMissing = 66,
|
||||
RpcSrcActNotFound = 67,
|
||||
RpcDelegateActNotFound = 68,
|
||||
RpcSrcCurMalformed = 69,
|
||||
RpcSrcIsrMalformed = 70,
|
||||
RpcStreamMalformed = 71,
|
||||
RpcAtxDeprecated = 72,
|
||||
|
||||
// Internal error (should never happen)
|
||||
rpcINTERNAL = 73, // Generic internal error.
|
||||
rpcNOT_IMPL = 74,
|
||||
rpcNOT_SUPPORTED = 75,
|
||||
rpcBAD_KEY_TYPE = 76,
|
||||
rpcDB_DESERIALIZATION = 77,
|
||||
rpcEXCESSIVE_LGR_RANGE = 78,
|
||||
rpcINVALID_LGR_RANGE = 79,
|
||||
rpcEXPIRED_VALIDATOR_LIST = 80,
|
||||
RpcInternal = 73, // Generic internal error.
|
||||
RpcNotImpl = 74,
|
||||
RpcNotSupported = 75,
|
||||
RpcBadKeyType = 76,
|
||||
RpcDbDeserialization = 77,
|
||||
RpcExcessiveLgrRange = 78,
|
||||
RpcInvalidLgrRange = 79,
|
||||
RpcExpiredValidatorList = 80,
|
||||
|
||||
// unused = 90,
|
||||
// DEPRECATED. New code must not use this value.
|
||||
rpcREPORTING_UNSUPPORTED = 91,
|
||||
RpcReportingUnsupported = 91,
|
||||
|
||||
rpcOBJECT_NOT_FOUND = 92,
|
||||
RpcObjectNotFound = 92,
|
||||
|
||||
// AMM
|
||||
rpcISSUE_MALFORMED = 93,
|
||||
RpcIssueMalformed = 93,
|
||||
|
||||
// Oracle
|
||||
rpcORACLE_MALFORMED = 94,
|
||||
RpcOracleMalformed = 94,
|
||||
|
||||
// deposit_authorized + credentials
|
||||
rpcBAD_CREDENTIALS = 95,
|
||||
RpcBadCredentials = 95,
|
||||
|
||||
// Simulate
|
||||
rpcTX_SIGNED = 96,
|
||||
RpcTxSigned = 96,
|
||||
|
||||
// Pathfinding
|
||||
rpcDOMAIN_MALFORMED = 97,
|
||||
RpcDomainMalformed = 97,
|
||||
|
||||
// ledger_entry
|
||||
rpcENTRY_NOT_FOUND = 98,
|
||||
rpcUNEXPECTED_LEDGER_TYPE = 99,
|
||||
RpcEntryNotFound = 98,
|
||||
RpcUnexpectedLedgerType = 99,
|
||||
|
||||
rpcLAST = rpcUNEXPECTED_LEDGER_TYPE // rpcLAST should always equal the last code.
|
||||
RpcLast = RpcUnexpectedLedgerType // rpcLAST should always equal the last code.
|
||||
};
|
||||
|
||||
/** Codes returned in the `warnings` array of certain RPC commands.
|
||||
@@ -152,13 +152,13 @@ enum error_code_i {
|
||||
*/
|
||||
// Protocol-wide, 50+ files
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum warning_code_i {
|
||||
warnRPC_UNSUPPORTED_MAJORITY = 1001,
|
||||
warnRPC_AMENDMENT_BLOCKED = 1002,
|
||||
warnRPC_EXPIRED_VALIDATOR_LIST = 1003,
|
||||
enum WarningCodeI {
|
||||
WarnRpcUnsupportedMajority = 1001,
|
||||
WarnRpcAmendmentBlocked = 1002,
|
||||
WarnRpcExpiredValidatorList = 1003,
|
||||
// unused = 1004
|
||||
warnRPC_FIELDS_DEPRECATED = 2004, // xrpld needs to maintain
|
||||
// compatibility with Clio on this code.
|
||||
WarnRpcFieldsDeprecated = 2004, // xrpld needs to maintain
|
||||
// compatibility with Clio on this code.
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -172,163 +172,159 @@ struct ErrorInfo
|
||||
{
|
||||
// Default ctor needed to produce an empty std::array during constexpr eval.
|
||||
constexpr ErrorInfo()
|
||||
: code(rpcUNKNOWN), token("unknown"), message("An unknown error code."), http_status(200)
|
||||
: code(RpcUnknown), token("unknown"), message("An unknown error code."), http_status(200)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr ErrorInfo(error_code_i code_, char const* token_, char const* message_)
|
||||
: code(code_), token(token_), message(message_), http_status(200)
|
||||
constexpr ErrorInfo(ErrorCodeI code, char const* token, char const* message)
|
||||
: code(code), token(token), message(message), http_status(200)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr ErrorInfo(
|
||||
error_code_i code_,
|
||||
char const* token_,
|
||||
char const* message_,
|
||||
int http_status_)
|
||||
: code(code_), token(token_), message(message_), http_status(http_status_)
|
||||
constexpr ErrorInfo(ErrorCodeI code, char const* token, char const* message, int httpStatus)
|
||||
: code(code), token(token), message(message), http_status(httpStatus)
|
||||
{
|
||||
}
|
||||
|
||||
error_code_i code;
|
||||
Json::StaticString token;
|
||||
Json::StaticString message;
|
||||
ErrorCodeI code;
|
||||
json::StaticString token;
|
||||
json::StaticString message;
|
||||
int http_status;
|
||||
};
|
||||
|
||||
/** Returns an ErrorInfo that reflects the error code. */
|
||||
ErrorInfo const&
|
||||
get_error_info(error_code_i code);
|
||||
getErrorInfo(ErrorCodeI code);
|
||||
|
||||
/** Add or update the json update to reflect the error code. */
|
||||
/** @{ */
|
||||
void
|
||||
inject_error(error_code_i code, Json::Value& json);
|
||||
injectError(ErrorCodeI code, json::Value& json);
|
||||
|
||||
void
|
||||
inject_error(error_code_i code, std::string const& message, Json::Value& json);
|
||||
injectError(ErrorCodeI code, std::string const& message, json::Value& json);
|
||||
/** @} */
|
||||
|
||||
/** Returns a new json object that reflects the error code. */
|
||||
/** @{ */
|
||||
Json::Value
|
||||
make_error(error_code_i code);
|
||||
Json::Value
|
||||
make_error(error_code_i code, std::string const& message);
|
||||
json::Value
|
||||
makeError(ErrorCodeI code);
|
||||
json::Value
|
||||
makeError(ErrorCodeI code, std::string const& message);
|
||||
/** @} */
|
||||
|
||||
/** Returns a new json object that indicates invalid parameters. */
|
||||
/** @{ */
|
||||
inline Json::Value
|
||||
make_param_error(std::string const& message)
|
||||
inline json::Value
|
||||
makeParamError(std::string const& message)
|
||||
{
|
||||
return make_error(rpcINVALID_PARAMS, message);
|
||||
return makeError(RpcInvalidParams, message);
|
||||
}
|
||||
|
||||
inline std::string
|
||||
missing_field_message(std::string const& name)
|
||||
missingFieldMessage(std::string const& name)
|
||||
{
|
||||
return "Missing field '" + name + "'.";
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
missing_field_error(std::string const& name)
|
||||
inline json::Value
|
||||
missingFieldError(std::string const& name)
|
||||
{
|
||||
return make_param_error(missing_field_message(name));
|
||||
return makeParamError(missingFieldMessage(name));
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
missing_field_error(Json::StaticString name)
|
||||
inline json::Value
|
||||
missingFieldError(json::StaticString name)
|
||||
{
|
||||
return missing_field_error(std::string(name));
|
||||
return missingFieldError(std::string(name));
|
||||
}
|
||||
|
||||
inline std::string
|
||||
object_field_message(std::string const& name)
|
||||
objectFieldMessage(std::string const& name)
|
||||
{
|
||||
return "Invalid field '" + name + "', not object.";
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
object_field_error(std::string const& name)
|
||||
inline json::Value
|
||||
objectFieldError(std::string const& name)
|
||||
{
|
||||
return make_param_error(object_field_message(name));
|
||||
return makeParamError(objectFieldMessage(name));
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
object_field_error(Json::StaticString name)
|
||||
inline json::Value
|
||||
objectFieldError(json::StaticString name)
|
||||
{
|
||||
return object_field_error(std::string(name));
|
||||
return objectFieldError(std::string(name));
|
||||
}
|
||||
|
||||
inline std::string
|
||||
invalid_field_message(std::string const& name)
|
||||
invalidFieldMessage(std::string const& name)
|
||||
{
|
||||
return "Invalid field '" + name + "'.";
|
||||
}
|
||||
|
||||
inline std::string
|
||||
invalid_field_message(Json::StaticString name)
|
||||
invalidFieldMessage(json::StaticString name)
|
||||
{
|
||||
return invalid_field_message(std::string(name));
|
||||
return invalidFieldMessage(std::string(name));
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
invalid_field_error(std::string const& name)
|
||||
inline json::Value
|
||||
invalidFieldError(std::string const& name)
|
||||
{
|
||||
return make_param_error(invalid_field_message(name));
|
||||
return makeParamError(invalidFieldMessage(name));
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
invalid_field_error(Json::StaticString name)
|
||||
inline json::Value
|
||||
invalidFieldError(json::StaticString name)
|
||||
{
|
||||
return invalid_field_error(std::string(name));
|
||||
return invalidFieldError(std::string(name));
|
||||
}
|
||||
|
||||
inline std::string
|
||||
expected_field_message(std::string const& name, std::string const& type)
|
||||
expectedFieldMessage(std::string const& name, std::string const& type)
|
||||
{
|
||||
return "Invalid field '" + name + "', not " + type + ".";
|
||||
}
|
||||
|
||||
inline std::string
|
||||
expected_field_message(Json::StaticString name, std::string const& type)
|
||||
expectedFieldMessage(json::StaticString name, std::string const& type)
|
||||
{
|
||||
return expected_field_message(std::string(name), type);
|
||||
return expectedFieldMessage(std::string(name), type);
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
expected_field_error(std::string const& name, std::string const& type)
|
||||
inline json::Value
|
||||
expectedFieldError(std::string const& name, std::string const& type)
|
||||
{
|
||||
return make_param_error(expected_field_message(name, type));
|
||||
return makeParamError(expectedFieldMessage(name, type));
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
expected_field_error(Json::StaticString name, std::string const& type)
|
||||
inline json::Value
|
||||
expectedFieldError(json::StaticString name, std::string const& type)
|
||||
{
|
||||
return expected_field_error(std::string(name), type);
|
||||
return expectedFieldError(std::string(name), type);
|
||||
}
|
||||
|
||||
inline Json::Value
|
||||
not_validator_error()
|
||||
inline json::Value
|
||||
notValidatorError()
|
||||
{
|
||||
return make_param_error("not a validator");
|
||||
return makeParamError("not a validator");
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
/** Returns `true` if the json contains an rpc error specification. */
|
||||
bool
|
||||
contains_error(Json::Value const& json);
|
||||
containsError(json::Value const& json);
|
||||
|
||||
/** Returns http status that corresponds to the error code. */
|
||||
int
|
||||
error_code_http_status(error_code_i code);
|
||||
errorCodeHttpStatus(ErrorCodeI code);
|
||||
|
||||
} // namespace RPC
|
||||
|
||||
/** Returns a single string with the contents of an RPC error. */
|
||||
std::string
|
||||
rpcErrorString(Json::Value const& jv);
|
||||
rpcErrorString(json::Value const& jv);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -65,11 +65,11 @@
|
||||
namespace xrpl {
|
||||
|
||||
// Feature names must not exceed this length (in characters, excluding the null terminator).
|
||||
static constexpr std::size_t maxFeatureNameSize = 63;
|
||||
static constexpr std::size_t kMAX_FEATURE_NAME_SIZE = 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 reservedFeatureNameSize = 32;
|
||||
static constexpr std::size_t kRESERVED_FEATURE_NAME_SIZE = 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
|
||||
@@ -79,27 +79,27 @@ static constexpr std::size_t reservedFeatureNameSize = 32;
|
||||
consteval auto
|
||||
validFeatureNameSize(auto fn) -> bool
|
||||
{
|
||||
constexpr char const* n = fn();
|
||||
constexpr char const* kN = fn();
|
||||
// Note, std::strlen is not constexpr, we need to implement our own here.
|
||||
constexpr std::size_t N = [](auto n) {
|
||||
constexpr std::size_t kLEN = [](auto n) {
|
||||
std::size_t ret = 0;
|
||||
for (auto ptr = n; *ptr != '\0'; ret++, ++ptr)
|
||||
;
|
||||
return ret;
|
||||
}(n);
|
||||
return N != reservedFeatureNameSize && //
|
||||
N <= maxFeatureNameSize;
|
||||
}(kN);
|
||||
return kLEN != kRESERVED_FEATURE_NAME_SIZE && //
|
||||
kLEN <= kMAX_FEATURE_NAME_SIZE;
|
||||
}
|
||||
|
||||
consteval auto
|
||||
validFeatureName(auto fn) -> bool
|
||||
{
|
||||
constexpr char const* n = fn();
|
||||
constexpr char const* kN = fn();
|
||||
// Prevent the use of visually confusable characters and enforce that feature names
|
||||
// are always valid ASCII. This is needed because C++ allows Unicode identifiers.
|
||||
// Characters below 0x20 are nonprintable control characters, and characters with the 0x80 bit
|
||||
// set are non-ASCII (e.g. UTF-8 encoding of Unicode), so both are disallowed.
|
||||
for (auto ptr = n; *ptr != '\0'; ++ptr)
|
||||
for (auto ptr = kN; *ptr != '\0'; ++ptr)
|
||||
{
|
||||
if (*ptr & 0x80 || *ptr < 0x20)
|
||||
return false;
|
||||
@@ -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 numFeatures =
|
||||
static constexpr std::size_t kNUM_FEATURES =
|
||||
(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::numFeatures>
|
||||
class FeatureBitset : private std::bitset<detail::kNUM_FEATURES>
|
||||
{
|
||||
using base = std::bitset<detail::numFeatures>;
|
||||
using base = std::bitset<detail::kNUM_FEATURES>;
|
||||
|
||||
template <class... Fs>
|
||||
void
|
||||
|
||||
@@ -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 FEE_UNITS_DEPRECATED = 10;
|
||||
inline constexpr std::uint32_t kFEE_UNITS_DEPRECATED = 10;
|
||||
|
||||
/** Reflects the fee settings for a particular ledger.
|
||||
|
||||
@@ -29,8 +29,8 @@ struct Fees
|
||||
Fees&
|
||||
operator=(Fees const&) = default;
|
||||
|
||||
Fees(XRPAmount base_, XRPAmount reserve_, XRPAmount increment_)
|
||||
: base(base_), reserve(reserve_), increment(increment_)
|
||||
Fees(XRPAmount base, XRPAmount reserve, XRPAmount increment)
|
||||
: base(base), reserve(reserve), increment(increment)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace xrpl {
|
||||
namespace detail {
|
||||
|
||||
constexpr std::uint32_t
|
||||
make_hash_prefix(char a, char b, char c)
|
||||
makeHashPrefix(char a, char b, char c)
|
||||
{
|
||||
return (static_cast<std::uint32_t>(a) << 24) + (static_cast<std::uint32_t>(b) << 16) +
|
||||
(static_cast<std::uint32_t>(c) << 8);
|
||||
@@ -33,40 +33,40 @@ make_hash_prefix(char a, char b, char c)
|
||||
*/
|
||||
enum class HashPrefix : std::uint32_t {
|
||||
/** transaction plus signature to give transaction ID */
|
||||
transactionID = detail::make_hash_prefix('T', 'X', 'N'),
|
||||
TransactionId = detail::makeHashPrefix('T', 'X', 'N'),
|
||||
|
||||
/** transaction plus metadata */
|
||||
txNode = detail::make_hash_prefix('S', 'N', 'D'),
|
||||
TxNode = detail::makeHashPrefix('S', 'N', 'D'),
|
||||
|
||||
/** account state */
|
||||
leafNode = detail::make_hash_prefix('M', 'L', 'N'),
|
||||
LeafNode = detail::makeHashPrefix('M', 'L', 'N'),
|
||||
|
||||
/** inner node in V1 tree */
|
||||
innerNode = detail::make_hash_prefix('M', 'I', 'N'),
|
||||
InnerNode = detail::makeHashPrefix('M', 'I', 'N'),
|
||||
|
||||
/** ledger master data for signing */
|
||||
ledgerMaster = detail::make_hash_prefix('L', 'W', 'R'),
|
||||
LedgerMaster = detail::makeHashPrefix('L', 'W', 'R'),
|
||||
|
||||
/** inner transaction to sign */
|
||||
txSign = detail::make_hash_prefix('S', 'T', 'X'),
|
||||
TxSign = detail::makeHashPrefix('S', 'T', 'X'),
|
||||
|
||||
/** inner transaction to multi-sign */
|
||||
txMultiSign = detail::make_hash_prefix('S', 'M', 'T'),
|
||||
TxMultiSign = detail::makeHashPrefix('S', 'M', 'T'),
|
||||
|
||||
/** validation for signing */
|
||||
validation = detail::make_hash_prefix('V', 'A', 'L'),
|
||||
Validation = detail::makeHashPrefix('V', 'A', 'L'),
|
||||
|
||||
/** proposal for signing */
|
||||
proposal = detail::make_hash_prefix('P', 'R', 'P'),
|
||||
Proposal = detail::makeHashPrefix('P', 'R', 'P'),
|
||||
|
||||
/** Manifest */
|
||||
manifest = detail::make_hash_prefix('M', 'A', 'N'),
|
||||
Manifest = detail::makeHashPrefix('M', 'A', 'N'),
|
||||
|
||||
/** Payment Channel Claim */
|
||||
paymentChannelClaim = detail::make_hash_prefix('C', 'L', 'M'),
|
||||
PaymentChannelClaim = detail::makeHashPrefix('C', 'L', 'M'),
|
||||
|
||||
/** Batch */
|
||||
batch = detail::make_hash_prefix('B', 'C', 'H'),
|
||||
Batch = detail::makeHashPrefix('B', 'C', 'H'),
|
||||
};
|
||||
|
||||
template <class Hasher>
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
|
||||
inline IOUAmount::IOUAmount(beast::Zero)
|
||||
{
|
||||
*this = beast::zero;
|
||||
*this = beast::kZERO;
|
||||
}
|
||||
|
||||
inline IOUAmount::IOUAmount(mantissa_type mantissa, exponent_type exponent)
|
||||
|
||||
@@ -75,14 +75,14 @@ Keylet const&
|
||||
negativeUNL() noexcept;
|
||||
|
||||
/** The beginning of an order book */
|
||||
struct book_t
|
||||
struct BookT
|
||||
{
|
||||
explicit book_t() = default;
|
||||
explicit BookT() = default;
|
||||
|
||||
Keylet
|
||||
operator()(Book const& b) const;
|
||||
};
|
||||
static book_t const book{};
|
||||
static BookT const kBOOK{};
|
||||
|
||||
/** The index of a trust line for a given currency
|
||||
|
||||
@@ -119,19 +119,19 @@ Keylet
|
||||
quality(Keylet const& k, std::uint64_t q) noexcept;
|
||||
|
||||
/** The directory for the next lower quality */
|
||||
struct next_t
|
||||
struct NextT
|
||||
{
|
||||
explicit next_t() = default;
|
||||
explicit NextT() = default;
|
||||
|
||||
Keylet
|
||||
operator()(Keylet const& k) const;
|
||||
};
|
||||
static next_t const next{};
|
||||
static NextT const kNEXT{};
|
||||
|
||||
/** A ticket belonging to an account */
|
||||
struct ticket_t
|
||||
struct TicketT
|
||||
{
|
||||
explicit ticket_t() = default;
|
||||
explicit TicketT() = default;
|
||||
|
||||
Keylet
|
||||
operator()(AccountID const& id, std::uint32_t ticketSeq) const;
|
||||
@@ -145,7 +145,7 @@ struct ticket_t
|
||||
return {ltTICKET, key};
|
||||
}
|
||||
};
|
||||
static ticket_t const ticket{};
|
||||
static TicketT const kTICKET{};
|
||||
|
||||
/** A SignerList */
|
||||
Keylet
|
||||
@@ -221,11 +221,11 @@ payChan(AccountID const& src, AccountID const& dst, std::uint32_t seq) noexcept;
|
||||
/** @{ */
|
||||
/** A keylet for the owner's first possible NFT page. */
|
||||
Keylet
|
||||
nftpage_min(AccountID const& owner);
|
||||
nftpageMin(AccountID const& owner);
|
||||
|
||||
/** A keylet for the owner's last possible NFT page. */
|
||||
Keylet
|
||||
nftpage_max(AccountID const& owner);
|
||||
nftpageMax(AccountID const& owner);
|
||||
|
||||
Keylet
|
||||
nftpage(Keylet const& k, uint256 const& token);
|
||||
@@ -243,11 +243,11 @@ nftoffer(uint256 const& offer)
|
||||
|
||||
/** The directory of buy offers for the specified NFT */
|
||||
Keylet
|
||||
nft_buys(uint256 const& id) noexcept;
|
||||
nftBuys(uint256 const& id) noexcept;
|
||||
|
||||
/** The directory of sell offers for the specified NFT */
|
||||
Keylet
|
||||
nft_sells(uint256 const& id) noexcept;
|
||||
nftSells(uint256 const& id) noexcept;
|
||||
|
||||
/** AMM entry */
|
||||
Keylet
|
||||
@@ -362,25 +362,25 @@ getTicketIndex(AccountID const& account, std::uint32_t uSequence);
|
||||
uint256
|
||||
getTicketIndex(AccountID const& account, SeqProxy ticketSeq);
|
||||
|
||||
template <class... keyletParams>
|
||||
template <class... KeyletParams>
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||
struct keyletDesc
|
||||
struct KeyletDesc
|
||||
{
|
||||
std::function<Keylet(keyletParams...)> function;
|
||||
Json::StaticString expectedLEName;
|
||||
std::function<Keylet(KeyletParams...)> function;
|
||||
json::StaticString expectedLEName;
|
||||
bool includeInTests{};
|
||||
};
|
||||
|
||||
// This list should include all of the keylet functions that take a single
|
||||
// AccountID parameter.
|
||||
std::array<keyletDesc<AccountID const&>, 6> const directAccountKeylets{
|
||||
std::array<KeyletDesc<AccountID const&>, 6> const kDIRECT_ACCOUNT_KEYLETS{
|
||||
{{.function = &keylet::account, .expectedLEName = jss::AccountRoot, .includeInTests = false},
|
||||
{.function = &keylet::ownerDir, .expectedLEName = jss::DirectoryNode, .includeInTests = true},
|
||||
{.function = &keylet::signers, .expectedLEName = jss::SignerList, .includeInTests = true},
|
||||
// It's normally impossible to create an item at nftpage_min, but
|
||||
// test it anyway, since the invariant checks for it.
|
||||
{.function = &keylet::nftpage_min, .expectedLEName = jss::NFTokenPage, .includeInTests = true},
|
||||
{.function = &keylet::nftpage_max, .expectedLEName = jss::NFTokenPage, .includeInTests = true},
|
||||
{.function = &keylet::nftpageMin, .expectedLEName = jss::NFTokenPage, .includeInTests = true},
|
||||
{.function = &keylet::nftpageMax, .expectedLEName = jss::NFTokenPage, .includeInTests = true},
|
||||
{.function = &keylet::did, .expectedLEName = jss::DID, .includeInTests = true}}};
|
||||
|
||||
MPTID
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
getText() const;
|
||||
|
||||
void
|
||||
setJson(Json::Value& jv) const;
|
||||
setJson(json::Value& jv) const;
|
||||
|
||||
[[nodiscard]] bool
|
||||
native() const;
|
||||
@@ -49,11 +49,11 @@ isConsistent(Issue const& ac);
|
||||
std::string
|
||||
to_string(Issue const& ac);
|
||||
|
||||
Json::Value
|
||||
to_json(Issue const& is);
|
||||
json::Value
|
||||
toJson(Issue const& is);
|
||||
|
||||
Issue
|
||||
issueFromJson(Json::Value const& v);
|
||||
issueFromJson(json::Value const& v);
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, Issue const& x);
|
||||
@@ -96,16 +96,16 @@ operator<=>(Issue const& lhs, Issue const& rhs)
|
||||
inline Issue const&
|
||||
xrpIssue()
|
||||
{
|
||||
static Issue const issue{xrpCurrency(), xrpAccount()};
|
||||
return issue;
|
||||
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 issue{noCurrency(), noAccount()};
|
||||
return issue;
|
||||
static Issue const kISSUE{noCurrency(), noAccount()};
|
||||
return kISSUE;
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
namespace xrpl {
|
||||
|
||||
enum class KeyType {
|
||||
secp256k1 = 0,
|
||||
ed25519 = 1,
|
||||
Secp256k1 = 0,
|
||||
Ed25519 = 1,
|
||||
};
|
||||
|
||||
inline std::optional<KeyType>
|
||||
keyTypeFromString(std::string const& s)
|
||||
{
|
||||
if (s == "secp256k1")
|
||||
return KeyType::secp256k1;
|
||||
return KeyType::Secp256k1;
|
||||
|
||||
if (s == "ed25519")
|
||||
return KeyType::ed25519;
|
||||
return KeyType::Ed25519;
|
||||
|
||||
return {};
|
||||
}
|
||||
@@ -25,10 +25,10 @@ keyTypeFromString(std::string const& s)
|
||||
inline char const*
|
||||
to_string(KeyType type)
|
||||
{
|
||||
if (type == KeyType::secp256k1)
|
||||
if (type == KeyType::Secp256k1)
|
||||
return "secp256k1";
|
||||
|
||||
if (type == KeyType::ed25519)
|
||||
if (type == KeyType::Ed25519)
|
||||
return "ed25519";
|
||||
|
||||
return "INVALID";
|
||||
|
||||
@@ -20,7 +20,7 @@ struct Keylet
|
||||
uint256 key;
|
||||
LedgerEntryType type;
|
||||
|
||||
Keylet(LedgerEntryType type_, uint256 const& key_) : key(key_), type(type_)
|
||||
Keylet(LedgerEntryType type, uint256 const& key) : key(key), type(type)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
Derived classes will load the object with all the known formats.
|
||||
*/
|
||||
private:
|
||||
KnownFormats() : name_(beast::type_name<Derived>())
|
||||
KnownFormats() : name_(beast::typeName<Derived>())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ protected:
|
||||
{
|
||||
if (auto const item = findByType(type))
|
||||
{
|
||||
LogicError(
|
||||
logicError(
|
||||
std::string("Duplicate key for item '") + name + "': already maps to " +
|
||||
item->getName());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
|
||||
#include <xrpl/protocol/KnownFormats.h>
|
||||
|
||||
#include <map>
|
||||
@@ -298,3 +300,5 @@ public:
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
|
||||
@@ -26,12 +26,12 @@ struct LedgerHeader
|
||||
//
|
||||
|
||||
// Closed means "tx set already determined"
|
||||
uint256 hash = beast::zero;
|
||||
uint256 txHash = beast::zero;
|
||||
uint256 accountHash = beast::zero;
|
||||
uint256 parentHash = beast::zero;
|
||||
uint256 hash = beast::kZERO;
|
||||
uint256 txHash = beast::kZERO;
|
||||
uint256 accountHash = beast::kZERO;
|
||||
uint256 parentHash = beast::kZERO;
|
||||
|
||||
XRPAmount drops = beast::zero;
|
||||
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 sLCF_NoConsensusTime = 0x01;
|
||||
static std::uint32_t const kS_LCF_NO_CONSENSUS_TIME = 0x01;
|
||||
|
||||
inline bool
|
||||
getCloseAgree(LedgerHeader const& info)
|
||||
{
|
||||
return (info.closeFlags & sLCF_NoConsensusTime) == 0;
|
||||
return (info.closeFlags & kS_LCF_NO_CONSENSUS_TIME) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -88,7 +88,7 @@ constexpr MPTAmount::MPTAmount(value_type value) : value_(value)
|
||||
|
||||
constexpr MPTAmount::MPTAmount(beast::Zero)
|
||||
{
|
||||
*this = beast::zero;
|
||||
*this = beast::kZERO;
|
||||
}
|
||||
|
||||
constexpr MPTAmount&
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
getText() const;
|
||||
|
||||
void
|
||||
setJson(Json::Value& jv) const;
|
||||
setJson(json::Value& jv) const;
|
||||
|
||||
friend constexpr bool
|
||||
operator==(MPTIssue const& lhs, MPTIssue const& rhs);
|
||||
@@ -102,15 +102,15 @@ getMPTIssuer(MPTID&&) = delete;
|
||||
inline MPTID
|
||||
noMPT()
|
||||
{
|
||||
static MPTIssue const mpt{0, noAccount()};
|
||||
return mpt.getMptID();
|
||||
static MPTIssue const kMPT{0, noAccount()};
|
||||
return kMPT.getMptID();
|
||||
}
|
||||
|
||||
inline MPTID
|
||||
badMPT()
|
||||
{
|
||||
static MPTIssue const mpt{0, xrpAccount()};
|
||||
return mpt.getMptID();
|
||||
static MPTIssue const kMPT{0, xrpAccount()};
|
||||
return kMPT.getMptID();
|
||||
}
|
||||
|
||||
template <class Hasher>
|
||||
@@ -121,14 +121,14 @@ hash_append(Hasher& h, MPTIssue const& r)
|
||||
hash_append(h, r.getMptID());
|
||||
}
|
||||
|
||||
Json::Value
|
||||
to_json(MPTIssue const& mptIssue);
|
||||
json::Value
|
||||
toJson(MPTIssue const& mptIssue);
|
||||
|
||||
std::string
|
||||
to_string(MPTIssue const& mptIssue);
|
||||
|
||||
MPTIssue
|
||||
mptIssueFromJson(Json::Value const& jv);
|
||||
mptIssueFromJson(json::Value const& jv);
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, MPTIssue const& x);
|
||||
|
||||
@@ -15,16 +15,16 @@ namespace xrpl {
|
||||
|
||||
namespace detail {
|
||||
template <typename T>
|
||||
constexpr bool is_integral_constant = false;
|
||||
constexpr bool kIS_INTEGRAL_CONSTANT = false;
|
||||
template <typename I, auto A>
|
||||
constexpr bool is_integral_constant<std::integral_constant<I, A>&> = true;
|
||||
constexpr bool kIS_INTEGRAL_CONSTANT<std::integral_constant<I, A>&> = true;
|
||||
template <typename I, auto A>
|
||||
constexpr bool is_integral_constant<std::integral_constant<I, A> const&> = true;
|
||||
constexpr bool kIS_INTEGRAL_CONSTANT<std::integral_constant<I, A> const&> = true;
|
||||
|
||||
template <typename T>
|
||||
concept some_integral_constant = detail::is_integral_constant<T&>;
|
||||
concept some_integral_constant = detail::kIS_INTEGRAL_CONSTANT<T&>;
|
||||
|
||||
// This class is designed to wrap a collection of _almost_ identical Json::Value
|
||||
// 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
|
||||
// index). It is used e.g. when we need to publish JSON data to users supporting
|
||||
// different API versions. We allow manipulation and inspection of all objects
|
||||
@@ -47,12 +47,12 @@ struct MultiApiJson
|
||||
return (v < MinVer) ? 0 : static_cast<std::size_t>(v - MinVer);
|
||||
}
|
||||
|
||||
constexpr static std::size_t size = MaxVer + 1 - MinVer;
|
||||
std::array<Json::Value, size> val = {};
|
||||
constexpr static std::size_t kSIZE = MaxVer + 1 - MinVer;
|
||||
std::array<json::Value, kSIZE> val = {};
|
||||
|
||||
explicit MultiApiJson(Json::Value const& init = {})
|
||||
explicit MultiApiJson(json::Value const& init = {})
|
||||
{
|
||||
if (init == Json::Value{})
|
||||
if (init == json::Value{})
|
||||
return; // All elements are already default-initialized
|
||||
for (auto& v : val)
|
||||
v = init;
|
||||
@@ -60,13 +60,13 @@ struct MultiApiJson
|
||||
|
||||
void
|
||||
set(char const* key, auto const& v)
|
||||
requires std::constructible_from<Json::Value, decltype(v)>
|
||||
requires std::constructible_from<json::Value, decltype(v)>
|
||||
{
|
||||
for (auto& a : this->val)
|
||||
a[key] = v;
|
||||
}
|
||||
|
||||
enum class IsMemberResult : int { none = 0, some, all };
|
||||
enum class IsMemberResult : int { None = 0, Some, All };
|
||||
|
||||
[[nodiscard]] IsMemberResult
|
||||
isMember(char const* key) const
|
||||
@@ -79,11 +79,11 @@ struct MultiApiJson
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
return IsMemberResult::none;
|
||||
return count < size ? IsMemberResult::some : IsMemberResult::all;
|
||||
return IsMemberResult::None;
|
||||
return count < kSIZE ? IsMemberResult::Some : IsMemberResult::All;
|
||||
}
|
||||
|
||||
static constexpr struct visitor_t final
|
||||
static constexpr struct VisitorT final
|
||||
{
|
||||
// integral_constant version, extra arguments
|
||||
template <typename Json, unsigned int Version, typename... Args, typename Fn>
|
||||
@@ -100,7 +100,7 @@ struct MultiApiJson
|
||||
std::integral_constant<unsigned int, Version>,
|
||||
Args&&...>
|
||||
{
|
||||
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < size);
|
||||
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) < size);
|
||||
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSIZE);
|
||||
return std::invoke(fn, json.val[index(Version)]);
|
||||
}
|
||||
|
||||
@@ -124,8 +124,8 @@ struct MultiApiJson
|
||||
-> std::invoke_result_t<Fn, decltype(json.val[0]), Version, Args&&...>
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
valid(version) && index(version) >= 0 && index(version) < size,
|
||||
"xrpl::detail::MultiApiJson::operator<Args...>() : valid "
|
||||
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) < size,
|
||||
"xrpl::detail::MultiApiJson::operator() : valid version");
|
||||
valid(version) && index(version) >= 0 && index(version) < kSIZE,
|
||||
"xrpl::detail::MultiApijson::operator() : valid version");
|
||||
return std::invoke(fn, json.val[index(version)]);
|
||||
}
|
||||
} visitor = {};
|
||||
} kVISITOR = {};
|
||||
|
||||
auto
|
||||
visit()
|
||||
{
|
||||
return [self = this](auto... args)
|
||||
requires requires {
|
||||
visitor(std::declval<MultiApiJson&>(), std::declval<decltype(args)>()...);
|
||||
kVISITOR(std::declval<MultiApiJson&>(), std::declval<decltype(args)>()...);
|
||||
}
|
||||
{ return visitor(*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 {
|
||||
visitor(std::declval<MultiApiJson const&>(), std::declval<decltype(args)>()...);
|
||||
kVISITOR(std::declval<MultiApiJson const&>(), std::declval<decltype(args)>()...);
|
||||
}
|
||||
{ return visitor(*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<visitor_t, MultiApiJson&, Args...>
|
||||
visit(Args... args) -> std::invoke_result_t<VisitorT, MultiApiJson&, Args...>
|
||||
requires(sizeof...(args) > 0) &&
|
||||
requires { visitor(*this, std::forward<decltype(args)>(args)...); }
|
||||
requires { kVISITOR(*this, std::forward<decltype(args)>(args)...); }
|
||||
{
|
||||
return visitor(*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<visitor_t, MultiApiJson const&, Args...>
|
||||
visit(Args... args) const -> std::invoke_result_t<VisitorT, MultiApiJson const&, Args...>
|
||||
requires(sizeof...(args) > 0) &&
|
||||
requires { visitor(*this, std::forward<decltype(args)>(args)...); }
|
||||
requires { kVISITOR(*this, std::forward<decltype(args)>(args)...); }
|
||||
{
|
||||
return visitor(*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::apiMinimumSupportedVersion, RPC::apiMaximumValidVersion>;
|
||||
detail::MultiApiJson<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>;
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace xrpl::RPC {
|
||||
@{
|
||||
*/
|
||||
void
|
||||
insertNFTSyntheticInJson(Json::Value&, std::shared_ptr<STTx const> const&, TxMeta const&);
|
||||
insertNFTSyntheticInJson(json::Value&, std::shared_ptr<STTx const> const&, TxMeta const&);
|
||||
/** @} */
|
||||
|
||||
} // namespace xrpl::RPC
|
||||
|
||||
@@ -30,7 +30,7 @@ getNFTokenIDFromDeletedOffer(TxMeta const& transactionMeta);
|
||||
|
||||
void
|
||||
insertNFTokenID(
|
||||
Json::Value& response,
|
||||
json::Value& response,
|
||||
std::shared_ptr<STTx const> const& transaction,
|
||||
TxMeta const& transactionMeta);
|
||||
/** @} */
|
||||
|
||||
@@ -27,7 +27,7 @@ getOfferIDFromCreatedOffer(TxMeta const& transactionMeta);
|
||||
|
||||
void
|
||||
insertNFTokenOfferID(
|
||||
Json::Value& response,
|
||||
json::Value& response,
|
||||
std::shared_ptr<STTx const> const& transaction,
|
||||
TxMeta const& transactionMeta);
|
||||
/** @} */
|
||||
|
||||
@@ -52,10 +52,10 @@ public:
|
||||
};
|
||||
|
||||
template <ValidPathAsset PA>
|
||||
constexpr bool is_currency_v = std::is_same_v<PA, Currency>;
|
||||
constexpr bool kIS_CURRENCY_V = std::is_same_v<PA, Currency>;
|
||||
|
||||
template <ValidPathAsset PA>
|
||||
constexpr bool is_mptid_v = std::is_same_v<PA, MPTID>;
|
||||
constexpr bool kIS_MPTID_V = std::is_same_v<PA, MPTID>;
|
||||
|
||||
inline PathAsset::PathAsset(Asset const& asset)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ PathAsset::holds() const
|
||||
}
|
||||
|
||||
template <ValidPathAsset T>
|
||||
T const&
|
||||
[[nodiscard]] [[nodiscard]] T const&
|
||||
PathAsset::get() const
|
||||
{
|
||||
if (!holds<T>())
|
||||
@@ -98,10 +98,10 @@ constexpr bool
|
||||
operator==(PathAsset const& lhs, PathAsset const& rhs)
|
||||
{
|
||||
return std::visit(
|
||||
[]<ValidPathAsset TLhs, ValidPathAsset TRhs>(TLhs const& lhs_, TRhs const& rhs_) {
|
||||
[]<ValidPathAsset TLhs, ValidPathAsset TRhs>(TLhs const& lhs, TRhs const& rhs) {
|
||||
if constexpr (std::is_same_v<TLhs, TRhs>)
|
||||
{
|
||||
return lhs_ == rhs_;
|
||||
return lhs == rhs;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace xrpl {
|
||||
inline void
|
||||
serializePayChanAuthorization(Serializer& msg, uint256 const& key, XRPAmount const& amt)
|
||||
{
|
||||
msg.add32(HashPrefix::paymentChannelClaim);
|
||||
msg.add32(HashPrefix::PaymentChannelClaim);
|
||||
msg.addBitString(key);
|
||||
msg.add64(amt.drops());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ enum GranularPermissionType : std::uint32_t {
|
||||
// Injected bare enumerators (xrpl::delegable / xrpl::notDelegable) are required by preprocessor
|
||||
// tricks in tests and macro-generated code; enum class would break that.
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum Delegation { delegable, notDelegable };
|
||||
enum Delegation { Delegable, NotDelegable };
|
||||
|
||||
class Permission
|
||||
{
|
||||
|
||||
@@ -19,40 +19,40 @@ namespace xrpl {
|
||||
@ingroup protocol
|
||||
*/
|
||||
/** Smallest legal byte size of a transaction. */
|
||||
std::size_t constexpr txMinSizeBytes = 32;
|
||||
std::size_t constexpr kTX_MIN_SIZE_BYTES = 32;
|
||||
|
||||
/** Largest legal byte size of a transaction. */
|
||||
std::size_t constexpr txMaxSizeBytes = megabytes(1);
|
||||
std::size_t constexpr kTX_MAX_SIZE_BYTES = megabytes(1);
|
||||
|
||||
/** The maximum number of unfunded offers to delete at once */
|
||||
std::size_t constexpr unfundedOfferRemoveLimit = 1000;
|
||||
std::size_t constexpr kUNFUNDED_OFFER_REMOVE_LIMIT = 1000;
|
||||
|
||||
/** The maximum number of expired offers to delete at once */
|
||||
std::size_t constexpr expiredOfferRemoveLimit = 256;
|
||||
std::size_t constexpr kEXPIRED_OFFER_REMOVE_LIMIT = 256;
|
||||
|
||||
/** The maximum number of metadata entries allowed in one transaction */
|
||||
std::size_t constexpr oversizeMetaDataCap = 5200;
|
||||
std::size_t constexpr kOVERSIZE_META_DATA_CAP = 5200;
|
||||
|
||||
/** The maximum number of entries per directory page */
|
||||
std::size_t constexpr dirNodeMaxEntries = 32;
|
||||
std::size_t constexpr kDIR_NODE_MAX_ENTRIES = 32;
|
||||
|
||||
/** The maximum number of pages allowed in a directory
|
||||
|
||||
Made obsolete by fixDirectoryLimit amendment.
|
||||
*/
|
||||
std::uint64_t constexpr dirNodeMaxPages = 262144;
|
||||
std::uint64_t constexpr kDIR_NODE_MAX_PAGES = 262144;
|
||||
|
||||
/** The maximum number of items in an NFT page */
|
||||
std::size_t constexpr dirMaxTokensPerPage = 32;
|
||||
std::size_t constexpr kDIR_MAX_TOKENS_PER_PAGE = 32;
|
||||
|
||||
/** The maximum number of owner directory entries for account to be deletable */
|
||||
std::size_t constexpr maxDeletableDirEntries = 1000;
|
||||
std::size_t constexpr kMAX_DELETABLE_DIR_ENTRIES = 1000;
|
||||
|
||||
/** The maximum number of token offers that can be canceled at once */
|
||||
std::size_t constexpr maxTokenOfferCancelCount = 500;
|
||||
std::size_t constexpr kMAX_TOKEN_OFFER_CANCEL_COUNT = 500;
|
||||
|
||||
/** The maximum number of offers in an offer directory for NFT to be burnable */
|
||||
std::size_t constexpr maxDeletableTokenOfferEntries = 500;
|
||||
std::size_t constexpr kMAX_DELETABLE_TOKEN_OFFER_ENTRIES = 500;
|
||||
|
||||
/** The maximum token transfer fee allowed.
|
||||
|
||||
@@ -63,7 +63,7 @@ std::size_t constexpr maxDeletableTokenOfferEntries = 500;
|
||||
Note that for extremely low transfer fees values, it is possible that the
|
||||
calculated fee will be 0.
|
||||
*/
|
||||
std::uint16_t constexpr maxTransferFee = 50000;
|
||||
std::uint16_t constexpr kMAX_TRANSFER_FEE = 50000;
|
||||
|
||||
/** There are 10,000 basis points (bips) in 100%.
|
||||
*
|
||||
@@ -81,32 +81,32 @@ std::uint16_t constexpr maxTransferFee = 50000;
|
||||
*
|
||||
* Example: 50% is 0.50 * bipsPerUnity = 5,000 bps.
|
||||
*/
|
||||
Bips32 constexpr bipsPerUnity(100 * 100);
|
||||
static_assert(bipsPerUnity == Bips32{10'000});
|
||||
TenthBips32 constexpr tenthBipsPerUnity(bipsPerUnity.value() * 10);
|
||||
static_assert(tenthBipsPerUnity == TenthBips32(100'000));
|
||||
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
|
||||
percentageToBips(std::uint32_t percentage)
|
||||
{
|
||||
return Bips32(percentage * bipsPerUnity.value() / 100);
|
||||
return Bips32(percentage * kBIPS_PER_UNITY.value() / 100);
|
||||
}
|
||||
constexpr TenthBips32
|
||||
percentageToTenthBips(std::uint32_t percentage)
|
||||
{
|
||||
return TenthBips32(percentage * tenthBipsPerUnity.value() / 100);
|
||||
return TenthBips32(percentage * kTENTH_BIPS_PER_UNITY.value() / 100);
|
||||
}
|
||||
template <typename T, class TBips>
|
||||
constexpr T
|
||||
bipsOfValue(T value, Bips<TBips> bips)
|
||||
{
|
||||
return value * bips.value() / bipsPerUnity.value();
|
||||
return value * bips.value() / kBIPS_PER_UNITY.value();
|
||||
}
|
||||
template <typename T, class TBips>
|
||||
constexpr T
|
||||
tenthBipsOfValue(T value, TenthBips<TBips> bips)
|
||||
{
|
||||
return value * bips.value() / tenthBipsPerUnity.value();
|
||||
return value * bips.value() / kTENTH_BIPS_PER_UNITY.value();
|
||||
}
|
||||
|
||||
namespace Lending {
|
||||
@@ -114,54 +114,54 @@ namespace Lending {
|
||||
|
||||
Valid values are between 0 and 10% inclusive.
|
||||
*/
|
||||
TenthBips16 constexpr maxManagementFeeRate(
|
||||
unsafe_cast<std::uint16_t>(percentageToTenthBips(10).value()));
|
||||
static_assert(maxManagementFeeRate == TenthBips16(std::uint16_t(10'000u)));
|
||||
TenthBips16 constexpr kMAX_MANAGEMENT_FEE_RATE(
|
||||
unsafeCast<std::uint16_t>(percentageToTenthBips(10).value()));
|
||||
static_assert(kMAX_MANAGEMENT_FEE_RATE == 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 maxCoverRate = percentageToTenthBips(100);
|
||||
static_assert(maxCoverRate == TenthBips32(100'000u));
|
||||
TenthBips32 constexpr kMAX_COVER_RATE = percentageToTenthBips(100);
|
||||
static_assert(kMAX_COVER_RATE == TenthBips32(100'000u));
|
||||
|
||||
/** The maximum overpayment fee on a loan in 1/10 bips.
|
||||
*
|
||||
Valid values are between 0 and 100% inclusive.
|
||||
*/
|
||||
TenthBips32 constexpr maxOverpaymentFee = percentageToTenthBips(100);
|
||||
static_assert(maxOverpaymentFee == TenthBips32(100'000u));
|
||||
TenthBips32 constexpr kMAX_OVERPAYMENT_FEE = percentageToTenthBips(100);
|
||||
static_assert(kMAX_OVERPAYMENT_FEE == TenthBips32(100'000u));
|
||||
|
||||
/** Annualized interest rate of the Loan in 1/10 bips.
|
||||
*
|
||||
* Valid values are between 0 and 100% inclusive.
|
||||
*/
|
||||
TenthBips32 constexpr maxInterestRate = percentageToTenthBips(100);
|
||||
static_assert(maxInterestRate == TenthBips32(100'000u));
|
||||
TenthBips32 constexpr kMAX_INTEREST_RATE = percentageToTenthBips(100);
|
||||
static_assert(kMAX_INTEREST_RATE == 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 maxLateInterestRate = percentageToTenthBips(100);
|
||||
static_assert(maxLateInterestRate == TenthBips32(100'000u));
|
||||
TenthBips32 constexpr kMAX_LATE_INTEREST_RATE = percentageToTenthBips(100);
|
||||
static_assert(kMAX_LATE_INTEREST_RATE == 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 maxCloseInterestRate = percentageToTenthBips(100);
|
||||
static_assert(maxCloseInterestRate == TenthBips32(100'000u));
|
||||
TenthBips32 constexpr kMAX_CLOSE_INTEREST_RATE = percentageToTenthBips(100);
|
||||
static_assert(kMAX_CLOSE_INTEREST_RATE == 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 maxOverpaymentInterestRate = percentageToTenthBips(100);
|
||||
static_assert(maxOverpaymentInterestRate == TenthBips32(100'000u));
|
||||
TenthBips32 constexpr kMAX_OVERPAYMENT_INTEREST_RATE = percentageToTenthBips(100);
|
||||
static_assert(kMAX_OVERPAYMENT_INTEREST_RATE == TenthBips32(100'000u));
|
||||
|
||||
/** LoanPay transaction cost will be one base fee per X combined payments
|
||||
*
|
||||
@@ -172,7 +172,7 @@ static_assert(maxOverpaymentInterestRate == TenthBips32(100'000u));
|
||||
* This number was chosen arbitrarily, but should not be changed once released
|
||||
* without an amendment
|
||||
*/
|
||||
static constexpr int loanPaymentsPerFeeIncrement = 5;
|
||||
static constexpr int kLOAN_PAYMENTS_PER_FEE_INCREMENT = 5;
|
||||
|
||||
/** Maximum number of combined payments that a LoanPay transaction will process
|
||||
*
|
||||
@@ -196,65 +196,65 @@ static constexpr int loanPaymentsPerFeeIncrement = 5;
|
||||
* This number was chosen arbitrarily, but should not be changed once released
|
||||
* without an amendment
|
||||
*/
|
||||
static constexpr int loanMaximumPaymentsPerTransaction = 100;
|
||||
static constexpr int kLOAN_MAXIMUM_PAYMENTS_PER_TRANSACTION = 100;
|
||||
} // namespace Lending
|
||||
|
||||
/** The maximum length of a URI inside an NFT */
|
||||
std::size_t constexpr maxTokenURILength = 256;
|
||||
std::size_t constexpr kMAX_TOKEN_URI_LENGTH = 256;
|
||||
|
||||
/** The maximum length of a Data element inside a DID */
|
||||
std::size_t constexpr maxDIDDocumentLength = 256;
|
||||
std::size_t constexpr kMAX_DID_DOCUMENT_LENGTH = 256;
|
||||
|
||||
/** The maximum length of a URI inside a DID */
|
||||
std::size_t constexpr maxDIDURILength = 256;
|
||||
std::size_t constexpr kMAX_DIDURI_LENGTH = 256;
|
||||
|
||||
/** The maximum length of an Attestation inside a DID */
|
||||
std::size_t constexpr maxDIDDataLength = 256;
|
||||
std::size_t constexpr kMAX_DID_DATA_LENGTH = 256;
|
||||
|
||||
/** The maximum length of a domain */
|
||||
std::size_t constexpr maxDomainLength = 256;
|
||||
std::size_t constexpr kMAX_DOMAIN_LENGTH = 256;
|
||||
|
||||
/** The maximum length of a URI inside a Credential */
|
||||
std::size_t constexpr maxCredentialURILength = 256;
|
||||
std::size_t constexpr kMAX_CREDENTIAL_URI_LENGTH = 256;
|
||||
|
||||
/** The maximum length of a CredentialType inside a Credential */
|
||||
std::size_t constexpr maxCredentialTypeLength = 64;
|
||||
std::size_t constexpr kMAX_CREDENTIAL_TYPE_LENGTH = 64;
|
||||
|
||||
/** The maximum number of credentials can be passed in array */
|
||||
std::size_t constexpr maxCredentialsArraySize = 8;
|
||||
std::size_t constexpr kMAX_CREDENTIALS_ARRAY_SIZE = 8;
|
||||
|
||||
/** The maximum number of credentials can be passed in array for permissioned
|
||||
* domain */
|
||||
std::size_t constexpr maxPermissionedDomainCredentialsArraySize = 10;
|
||||
std::size_t constexpr kMAX_PERMISSIONED_DOMAIN_CREDENTIALS_ARRAY_SIZE = 10;
|
||||
|
||||
/** The maximum length of MPTokenMetadata */
|
||||
std::size_t constexpr maxMPTokenMetadataLength = 1024;
|
||||
std::size_t constexpr kMAX_MP_TOKEN_METADATA_LENGTH = 1024;
|
||||
|
||||
/** The maximum amount of MPTokenIssuance */
|
||||
std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
|
||||
static_assert(Number::maxRep >= maxMPTokenAmount);
|
||||
std::uint64_t constexpr kMAX_MP_TOKEN_AMOUNT = 0x7FFF'FFFF'FFFF'FFFFull;
|
||||
static_assert(Number::kMAX_REP >= kMAX_MP_TOKEN_AMOUNT);
|
||||
|
||||
/** The maximum length of Data payload */
|
||||
std::size_t constexpr maxDataPayloadLength = 256;
|
||||
std::size_t constexpr kMAX_DATA_PAYLOAD_LENGTH = 256;
|
||||
|
||||
/** Vault withdrawal policies */
|
||||
std::uint8_t constexpr vaultStrategyFirstComeFirstServe = 1;
|
||||
std::uint8_t constexpr kVAULT_STRATEGY_FIRST_COME_FIRST_SERVE = 1;
|
||||
|
||||
/** Default IOU scale factor for a Vault */
|
||||
std::uint8_t constexpr vaultDefaultIOUScale = 6;
|
||||
std::uint8_t constexpr kVAULT_DEFAULT_IOU_SCALE = 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 vaultMaximumIOUScale = 18;
|
||||
std::uint8_t constexpr kVAULT_MAXIMUM_IOU_SCALE = 18;
|
||||
|
||||
/** Maximum recursion depth for vault shares being put as an asset inside
|
||||
* another vault; counted from 0 */
|
||||
std::uint8_t constexpr maxAssetCheckDepth = 5;
|
||||
std::uint8_t constexpr kMAX_ASSET_CHECK_DEPTH = 5;
|
||||
|
||||
/** A ledger index. */
|
||||
using LedgerIndex = std::uint32_t;
|
||||
|
||||
std::uint32_t constexpr FLAG_LEDGER_INTERVAL = 256;
|
||||
std::uint32_t constexpr kFLAG_LEDGER_INTERVAL = 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 maxDeletableAMMTrustLines = 512;
|
||||
std::uint16_t constexpr kMAX_DELETABLE_AMM_TRUST_LINES = 512;
|
||||
|
||||
/** The maximum length of a URI inside an Oracle */
|
||||
std::size_t constexpr maxOracleURI = 256;
|
||||
std::size_t constexpr kMAX_ORACLE_URI = 256;
|
||||
|
||||
/** The maximum length of a Provider inside an Oracle */
|
||||
std::size_t constexpr maxOracleProvider = 256;
|
||||
std::size_t constexpr kMAX_ORACLE_PROVIDER = 256;
|
||||
|
||||
/** The maximum size of a data series array inside an Oracle */
|
||||
std::size_t constexpr maxOracleDataSeries = 10;
|
||||
std::size_t constexpr kMAX_ORACLE_DATA_SERIES = 10;
|
||||
|
||||
/** The maximum length of a SymbolClass inside an Oracle */
|
||||
std::size_t constexpr maxOracleSymbolClass = 16;
|
||||
std::size_t constexpr kMAX_ORACLE_SYMBOL_CLASS = 16;
|
||||
|
||||
/** The maximum allowed time difference between lastUpdateTime and the time
|
||||
of the last closed ledger
|
||||
*/
|
||||
std::size_t constexpr maxLastUpdateTimeDelta = 300;
|
||||
std::size_t constexpr kMAX_LAST_UPDATE_TIME_DELTA = 300;
|
||||
|
||||
/** The maximum price scaling factor
|
||||
*/
|
||||
std::size_t constexpr maxPriceScale = 20;
|
||||
std::size_t constexpr kMAX_PRICE_SCALE = 20;
|
||||
|
||||
/** The maximum percentage of outliers to trim
|
||||
*/
|
||||
std::size_t constexpr maxTrim = 25;
|
||||
std::size_t constexpr kMAX_TRIM = 25;
|
||||
|
||||
/** The maximum number of delegate permissions an account can grant
|
||||
*/
|
||||
std::size_t constexpr permissionMaxSize = 10;
|
||||
std::size_t constexpr kPERMISSION_MAX_SIZE = 10;
|
||||
|
||||
/** The maximum number of transactions that can be in a batch. */
|
||||
std::size_t constexpr maxBatchTxCount = 8;
|
||||
std::size_t constexpr kMAX_BATCH_TX_COUNT = 8;
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -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 size_ = 33;
|
||||
std::uint8_t buf_[size_]{}; // 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 size_;
|
||||
return kSIZE;
|
||||
}
|
||||
|
||||
[[nodiscard]] const_iterator
|
||||
@@ -90,19 +90,19 @@ public:
|
||||
[[nodiscard]] const_iterator
|
||||
end() const noexcept
|
||||
{
|
||||
return buf_ + size_;
|
||||
return buf_ + kSIZE;
|
||||
}
|
||||
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const noexcept
|
||||
{
|
||||
return buf_ + size_;
|
||||
return buf_ + kSIZE;
|
||||
}
|
||||
|
||||
[[nodiscard]] Slice
|
||||
slice() const noexcept
|
||||
{
|
||||
return {buf_, size_};
|
||||
return {buf_, kSIZE};
|
||||
}
|
||||
|
||||
operator Slice() const noexcept
|
||||
@@ -168,7 +168,7 @@ template <>
|
||||
std::optional<PublicKey>
|
||||
parseBase58(TokenType type, std::string const& s);
|
||||
|
||||
enum class ECDSACanonicality { canonical, fullyCanonical };
|
||||
enum class ECDSACanonicality { Canonical, FullyCanonical };
|
||||
|
||||
/** Determines the canonicality of a signature.
|
||||
|
||||
@@ -260,10 +260,10 @@ getFingerprint(
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Json {
|
||||
namespace json {
|
||||
template <>
|
||||
inline xrpl::PublicKey
|
||||
getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
getOrThrow(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
using namespace xrpl;
|
||||
std::string const b58 = getOrThrow<std::string>(v, field);
|
||||
@@ -279,4 +279,4 @@ getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
}
|
||||
Throw<JsonTypeMismatchError>(field.getJsonName(), "PublicKey");
|
||||
}
|
||||
} // namespace Json
|
||||
} // namespace json
|
||||
|
||||
@@ -26,11 +26,11 @@ struct TAmounts
|
||||
{
|
||||
TAmounts() = default;
|
||||
|
||||
TAmounts(beast::Zero, beast::Zero) : in(beast::zero), out(beast::zero)
|
||||
TAmounts(beast::Zero, beast::Zero) : in(beast::kZERO), out(beast::kZERO)
|
||||
{
|
||||
}
|
||||
|
||||
TAmounts(In in_, Out out_) : in(std::move(in_)), out(std::move(out_))
|
||||
TAmounts(In in, Out out) : in(std::move(in)), out(std::move(out))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ struct TAmounts
|
||||
[[nodiscard]] bool
|
||||
empty() const noexcept
|
||||
{
|
||||
return in <= beast::zero || out <= beast::zero;
|
||||
return in <= beast::kZERO || out <= beast::kZERO;
|
||||
}
|
||||
|
||||
TAmounts&
|
||||
@@ -94,15 +94,15 @@ public:
|
||||
// have lower unsigned integer representations.
|
||||
using value_type = std::uint64_t;
|
||||
|
||||
static int const minTickSize = 3;
|
||||
static int const maxTickSize = 16;
|
||||
static int const kMIN_TICK_SIZE = 3;
|
||||
static int const kMAX_TICK_SIZE = 16;
|
||||
|
||||
private:
|
||||
// This has the same representation as STAmount, see the comment on the
|
||||
// STAmount. However, this class does not always use the canonical
|
||||
// representation. In particular, the increment and decrement operators may
|
||||
// cause a non-canonical representation.
|
||||
value_type m_value;
|
||||
value_type value_;
|
||||
|
||||
public:
|
||||
Quality() = default;
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
[[nodiscard]] STAmount
|
||||
rate() const
|
||||
{
|
||||
return amountFromQuality(m_value);
|
||||
return amountFromQuality(value_);
|
||||
}
|
||||
|
||||
/** Returns the quality rounded up to the specified number
|
||||
@@ -162,42 +162,42 @@ public:
|
||||
to prevent money creation.
|
||||
*/
|
||||
[[nodiscard]] Amounts
|
||||
ceil_in(Amounts const& amount, STAmount const& limit) const;
|
||||
ceilIn(Amounts const& amount, STAmount const& limit) const;
|
||||
|
||||
template <class In, class Out>
|
||||
[[nodiscard]] TAmounts<In, Out>
|
||||
ceil_in(TAmounts<In, Out> const& amount, In const& limit) const;
|
||||
ceilIn(TAmounts<In, Out> const& amount, In const& limit) const;
|
||||
|
||||
// Some of the underlying rounding functions called by ceil_in() ignored
|
||||
// low order bits that could influence rounding decisions. This "strict"
|
||||
// method uses underlying functions that pay attention to all the bits.
|
||||
[[nodiscard]] Amounts
|
||||
ceil_in_strict(Amounts const& amount, STAmount const& limit, bool roundUp) const;
|
||||
ceilInStrict(Amounts const& amount, STAmount const& limit, bool roundUp) const;
|
||||
|
||||
template <class In, class Out>
|
||||
[[nodiscard]] TAmounts<In, Out>
|
||||
ceil_in_strict(TAmounts<In, Out> const& amount, In const& limit, bool roundUp) const;
|
||||
ceilInStrict(TAmounts<In, Out> const& amount, In const& limit, bool roundUp) const;
|
||||
|
||||
/** Returns the scaled amount with out capped.
|
||||
Math is avoided if the result is exact. The input is clamped
|
||||
to prevent money creation.
|
||||
*/
|
||||
[[nodiscard]] Amounts
|
||||
ceil_out(Amounts const& amount, STAmount const& limit) const;
|
||||
ceilOut(Amounts const& amount, STAmount const& limit) const;
|
||||
|
||||
template <class In, class Out>
|
||||
[[nodiscard]] TAmounts<In, Out>
|
||||
ceil_out(TAmounts<In, Out> const& amount, Out const& limit) const;
|
||||
ceilOut(TAmounts<In, Out> const& amount, Out const& limit) const;
|
||||
|
||||
// Some of the underlying rounding functions called by ceil_out() ignored
|
||||
// low order bits that could influence rounding decisions. This "strict"
|
||||
// method uses underlying functions that pay attention to all the bits.
|
||||
[[nodiscard]] Amounts
|
||||
ceil_out_strict(Amounts const& amount, STAmount const& limit, bool roundUp) const;
|
||||
ceilOutStrict(Amounts const& amount, STAmount const& limit, bool roundUp) const;
|
||||
|
||||
template <class In, class Out>
|
||||
[[nodiscard]] TAmounts<In, Out>
|
||||
ceil_out_strict(TAmounts<In, Out> const& amount, Out const& limit, bool roundUp) const;
|
||||
ceilOutStrict(TAmounts<In, Out> const& amount, Out const& limit, bool roundUp) const;
|
||||
|
||||
private:
|
||||
// The ceil_in and ceil_out methods that deal in TAmount all convert
|
||||
@@ -205,11 +205,11 @@ private:
|
||||
// This helper function takes care of all the conversion operations.
|
||||
template <class In, class Out, class Lim, typename FnPtr, std::same_as<bool>... Round>
|
||||
[[nodiscard]] TAmounts<In, Out>
|
||||
ceil_TAmounts_helper(
|
||||
ceilTAmountsHelper(
|
||||
TAmounts<In, Out> const& amount,
|
||||
Lim const& limit,
|
||||
Lim const& limit_cmp,
|
||||
FnPtr ceil_function,
|
||||
Lim const& limitCmp,
|
||||
FnPtr ceilFunction,
|
||||
Round... round) const;
|
||||
|
||||
public:
|
||||
@@ -220,13 +220,13 @@ public:
|
||||
friend bool
|
||||
operator<(Quality const& lhs, Quality const& rhs) noexcept
|
||||
{
|
||||
return lhs.m_value > rhs.m_value;
|
||||
return lhs.value_ > rhs.value_;
|
||||
}
|
||||
|
||||
friend bool
|
||||
operator>(Quality const& lhs, Quality const& rhs) noexcept
|
||||
{
|
||||
return lhs.m_value < rhs.m_value;
|
||||
return lhs.value_ < rhs.value_;
|
||||
}
|
||||
|
||||
friend bool
|
||||
@@ -244,7 +244,7 @@ public:
|
||||
friend bool
|
||||
operator==(Quality const& lhs, Quality const& rhs) noexcept
|
||||
{
|
||||
return lhs.m_value == rhs.m_value;
|
||||
return lhs.value_ == rhs.value_;
|
||||
}
|
||||
|
||||
friend bool
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
friend std::ostream&
|
||||
operator<<(std::ostream& os, Quality const& quality)
|
||||
{
|
||||
os << quality.m_value;
|
||||
os << quality.value_;
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -266,12 +266,12 @@ public:
|
||||
relativeDistance(Quality const& q1, Quality const& q2)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
q1.m_value > 0 && q2.m_value > 0, "xrpl::Quality::relativeDistance : minimum inputs");
|
||||
q1.value_ > 0 && q2.value_ > 0, "xrpl::Quality::relativeDistance : minimum inputs");
|
||||
|
||||
if (q1.m_value == q2.m_value) // make expected common case fast
|
||||
if (q1.value_ == q2.value_) // make expected common case fast
|
||||
return 0;
|
||||
|
||||
auto const [minV, maxV] = std::minmax(q1.m_value, q2.m_value);
|
||||
auto const [minV, maxV] = std::minmax(q1.value_, q2.value_);
|
||||
|
||||
auto mantissa = [](std::uint64_t rate) { return rate & ~(255ull << (64 - 8)); };
|
||||
auto exponent = [](std::uint64_t rate) { return static_cast<int>(rate >> (64 - 8)) - 100; };
|
||||
@@ -293,66 +293,66 @@ public:
|
||||
|
||||
template <class In, class Out, class Lim, typename FnPtr, std::same_as<bool>... Round>
|
||||
TAmounts<In, Out>
|
||||
Quality::ceil_TAmounts_helper(
|
||||
Quality::ceilTAmountsHelper(
|
||||
TAmounts<In, Out> const& amount,
|
||||
Lim const& limit,
|
||||
Lim const& limit_cmp,
|
||||
FnPtr ceil_function,
|
||||
Lim const& limitCmp,
|
||||
FnPtr ceilFunction,
|
||||
Round... roundUp) const
|
||||
{
|
||||
if (limit_cmp <= limit)
|
||||
if (limitCmp <= limit)
|
||||
return amount;
|
||||
|
||||
// Use the existing STAmount implementation for now, but consider
|
||||
// replacing with code specific to IOUAMount and XRPAmount
|
||||
Amounts const stAmt(toSTAmount(amount.in), toSTAmount(amount.out));
|
||||
STAmount const stLim(toSTAmount(limit));
|
||||
Amounts const stRes = ((*this).*ceil_function)(stAmt, stLim, roundUp...);
|
||||
Amounts const stRes = ((*this).*ceilFunction)(stAmt, stLim, roundUp...);
|
||||
return TAmounts<In, Out>(toAmount<In>(stRes.in), toAmount<Out>(stRes.out));
|
||||
}
|
||||
|
||||
template <class In, class Out>
|
||||
TAmounts<In, Out>
|
||||
Quality::ceil_in(TAmounts<In, Out> const& amount, In const& limit) const
|
||||
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::*ceil_in_fn_ptr)(Amounts const&, STAmount const&) const =
|
||||
&Quality::ceil_in;
|
||||
static constexpr Amounts (Quality::*kCEIL_IN_FN_PTR)(Amounts const&, STAmount const&) const =
|
||||
&Quality::ceilIn;
|
||||
|
||||
return ceil_TAmounts_helper(amount, limit, amount.in, ceil_in_fn_ptr);
|
||||
return ceilTAmountsHelper(amount, limit, amount.in, kCEIL_IN_FN_PTR);
|
||||
}
|
||||
|
||||
template <class In, class Out>
|
||||
TAmounts<In, Out>
|
||||
Quality::ceil_in_strict(TAmounts<In, Out> const& amount, In const& limit, bool roundUp) const
|
||||
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::*ceil_in_fn_ptr)(Amounts const&, STAmount const&, bool)
|
||||
const = &Quality::ceil_in_strict;
|
||||
static constexpr Amounts (Quality::*kCEIL_IN_FN_PTR)(Amounts const&, STAmount const&, bool)
|
||||
const = &Quality::ceilInStrict;
|
||||
|
||||
return ceil_TAmounts_helper(amount, limit, amount.in, ceil_in_fn_ptr, roundUp);
|
||||
return ceilTAmountsHelper(amount, limit, amount.in, kCEIL_IN_FN_PTR, roundUp);
|
||||
}
|
||||
|
||||
template <class In, class Out>
|
||||
TAmounts<In, Out>
|
||||
Quality::ceil_out(TAmounts<In, Out> const& amount, Out const& limit) const
|
||||
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::*ceil_out_fn_ptr)(Amounts const&, STAmount const&) const =
|
||||
&Quality::ceil_out;
|
||||
static constexpr Amounts (Quality::*kCEIL_OUT_FN_PTR)(Amounts const&, STAmount const&) const =
|
||||
&Quality::ceilOut;
|
||||
|
||||
return ceil_TAmounts_helper(amount, limit, amount.out, ceil_out_fn_ptr);
|
||||
return ceil_TAmounts_helper(amount, limit, amount.out, kCEIL_OUT_FN_PTR);
|
||||
}
|
||||
|
||||
template <class In, class Out>
|
||||
TAmounts<In, Out>
|
||||
Quality::ceil_out_strict(TAmounts<In, Out> const& amount, Out const& limit, bool roundUp) const
|
||||
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::*ceil_out_fn_ptr)(Amounts const&, STAmount const&, bool)
|
||||
const = &Quality::ceil_out_strict;
|
||||
static constexpr Amounts (Quality::*kCEIL_OUT_FN_PTR)(Amounts const&, STAmount const&, bool)
|
||||
const = &Quality::ceilOutStrict;
|
||||
|
||||
return ceil_TAmounts_helper(amount, limit, amount.out, ceil_out_fn_ptr, roundUp);
|
||||
return ceilTAmountsHelper(amount, limit, amount.out, kCEIL_OUT_FN_PTR, roundUp);
|
||||
}
|
||||
|
||||
/** Calculate the quality of a two-hop path given the two hops.
|
||||
@@ -360,6 +360,6 @@ Quality::ceil_out_strict(TAmounts<In, Out> const& amount, Out const& limit, bool
|
||||
@param rhs The second leg of the path: intermediate to output.
|
||||
*/
|
||||
Quality
|
||||
composed_quality(Quality const& lhs, Quality const& rhs);
|
||||
composedQuality(Quality const& lhs, Quality const& rhs);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -72,7 +72,7 @@ QualityFunction::QualityFunction(
|
||||
std::uint32_t tfee,
|
||||
QualityFunction::AMMTag)
|
||||
{
|
||||
if (amounts.in <= beast::zero || amounts.out <= beast::zero)
|
||||
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;
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace xrpl {
|
||||
|
||||
// VFALCO NOTE these are deprecated
|
||||
bool
|
||||
isRpcError(Json::Value jvResult);
|
||||
Json::Value
|
||||
rpcError(error_code_i iError);
|
||||
isRpcError(json::Value jvResult);
|
||||
json::Value
|
||||
rpcError(ErrorCodeI iError);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -72,6 +72,6 @@ transferFeeAsRate(std::uint16_t fee);
|
||||
} // namespace nft
|
||||
|
||||
/** A transfer rate signifying a 1:1 exchange */
|
||||
extern Rate const parityRate;
|
||||
extern Rate const kPARITY_RATE;
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
These are the rules reflected by
|
||||
the genesis ledger.
|
||||
*/
|
||||
explicit Rules(std::unordered_set<uint256, beast::uhash<>> const& presets);
|
||||
explicit Rules(std::unordered_set<uint256, beast::Uhash<>> const& presets);
|
||||
|
||||
private:
|
||||
// Allow a friend function to construct Rules.
|
||||
@@ -66,14 +66,14 @@ private:
|
||||
friend Rules
|
||||
makeRulesGivenLedger(
|
||||
DigestAwareReadView const& ledger,
|
||||
std::unordered_set<uint256, beast::uhash<>> const& presets);
|
||||
std::unordered_set<uint256, beast::Uhash<>> const& presets);
|
||||
|
||||
Rules(
|
||||
std::unordered_set<uint256, beast::uhash<>> const& presets,
|
||||
std::unordered_set<uint256, beast::Uhash<>> const& presets,
|
||||
std::optional<uint256> const& digest,
|
||||
STVector256 const& amendments);
|
||||
|
||||
[[nodiscard]] std::unordered_set<uint256, beast::uhash<>> const&
|
||||
[[nodiscard]] std::unordered_set<uint256, beast::Uhash<>> const&
|
||||
presets() const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -34,6 +34,7 @@ class STXChainBridge;
|
||||
class STVector256;
|
||||
class STCurrency;
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
#pragma push_macro("XMACRO")
|
||||
#undef XMACRO
|
||||
|
||||
@@ -91,7 +92,7 @@ class STCurrency;
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum SerializedTypeID { XMACRO(TO_ENUM) };
|
||||
|
||||
static std::map<std::string, int> const sTypeMap = {XMACRO(TO_MAP)};
|
||||
static std::map<std::string, int> const kS_TYPE_MAP = {XMACRO(TO_MAP)};
|
||||
|
||||
#undef XMACRO
|
||||
#undef TO_ENUM
|
||||
@@ -99,17 +100,18 @@ static std::map<std::string, int> const sTypeMap = {XMACRO(TO_MAP)};
|
||||
#pragma pop_macro("XMACRO")
|
||||
#pragma pop_macro("TO_ENUM")
|
||||
#pragma pop_macro("TO_MAP")
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
|
||||
// constexpr
|
||||
inline int
|
||||
field_code(SerializedTypeID id, int index)
|
||||
fieldCode(SerializedTypeID id, int index)
|
||||
{
|
||||
return (safe_cast<int>(id) << 16) | index;
|
||||
return (safeCast<int>(id) << 16) | index;
|
||||
}
|
||||
|
||||
// constexpr
|
||||
inline int
|
||||
field_code(int id, int index)
|
||||
fieldCode(int id, int index)
|
||||
{
|
||||
return (id << 16) | index;
|
||||
}
|
||||
@@ -130,32 +132,32 @@ public:
|
||||
// Need to be named before converting
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum {
|
||||
sMD_Never = 0x00,
|
||||
sMD_ChangeOrig = 0x01, // original value when it changes
|
||||
sMD_ChangeNew = 0x02, // new value when it changes
|
||||
sMD_DeleteFinal = 0x04, // final value when it is deleted
|
||||
sMD_Create = 0x08, // value when it's created
|
||||
sMD_Always = 0x10, // value when node containing it is affected at all
|
||||
sMD_BaseTen = 0x20, // value is treated as base 10, overriding behavior
|
||||
sMD_PseudoAccount = 0x40, // if this field is set in an ACCOUNT_ROOT
|
||||
// _only_, then it is a pseudo-account
|
||||
sMD_NeedsAsset = 0x80, // This field needs to be associated with an
|
||||
// asset before it is serialized as a ledger
|
||||
// object. Intended for STNumber.
|
||||
sMD_Default = sMD_ChangeOrig | sMD_ChangeNew | sMD_DeleteFinal | sMD_Create
|
||||
SMdNever = 0x00,
|
||||
SMdChangeOrig = 0x01, // original value when it changes
|
||||
SMdChangeNew = 0x02, // new value when it changes
|
||||
SMdDeleteFinal = 0x04, // final value when it is deleted
|
||||
SMdCreate = 0x08, // value when it's created
|
||||
SMdAlways = 0x10, // value when node containing it is affected at all
|
||||
SMdBaseTen = 0x20, // value is treated as base 10, overriding behavior
|
||||
SMdPseudoAccount = 0x40, // if this field is set in an ACCOUNT_ROOT
|
||||
// _only_, then it is a pseudo-account
|
||||
SMdNeedsAsset = 0x80, // This field needs to be associated with an
|
||||
// asset before it is serialized as a ledger
|
||||
// object. Intended for STNumber.
|
||||
SMdDefault = SMdChangeOrig | SMdChangeNew | SMdDeleteFinal | SMdCreate
|
||||
};
|
||||
|
||||
enum class IsSigning : unsigned char { no, yes };
|
||||
static IsSigning const notSigning = IsSigning::no;
|
||||
enum class IsSigning : unsigned char { No, Yes };
|
||||
static IsSigning const kNOT_SIGNING = IsSigning::No;
|
||||
|
||||
int const fieldCode; // (type<<16)|index
|
||||
int const fieldCodeMem; // (type<<16)|index // TODO: rename, clashes with function
|
||||
SerializedTypeID const fieldType; // STI_*
|
||||
int const fieldValue; // Code number for protocol
|
||||
std::string const fieldName;
|
||||
int const fieldMeta;
|
||||
int const fieldNum;
|
||||
IsSigning const signingField;
|
||||
Json::StaticString const jsonName;
|
||||
json::StaticString const jsonName;
|
||||
|
||||
SField(SField const&) = delete;
|
||||
SField&
|
||||
@@ -165,17 +167,17 @@ public:
|
||||
operator=(SField&&) = delete;
|
||||
|
||||
public:
|
||||
struct private_access_tag_t; // public, but still an implementation detail
|
||||
struct PrivateAccessTagT; // public, but still an implementation detail
|
||||
|
||||
// These constructors can only be called from SField.cpp
|
||||
SField(
|
||||
private_access_tag_t,
|
||||
PrivateAccessTagT,
|
||||
SerializedTypeID tid,
|
||||
int fv,
|
||||
char const* fn,
|
||||
int meta = sMD_Default,
|
||||
IsSigning signing = IsSigning::yes);
|
||||
explicit SField(private_access_tag_t, int fc, char const* fn);
|
||||
int meta = SMdDefault,
|
||||
IsSigning signing = IsSigning::Yes);
|
||||
explicit SField(PrivateAccessTagT, int fc, char const* fn);
|
||||
|
||||
static SField const&
|
||||
getField(int fieldCode);
|
||||
@@ -184,13 +186,13 @@ public:
|
||||
static SField const&
|
||||
getField(int type, int value)
|
||||
{
|
||||
return getField(field_code(type, value));
|
||||
return getField(fieldCode(type, value));
|
||||
}
|
||||
|
||||
static SField const&
|
||||
getField(SerializedTypeID type, int value)
|
||||
{
|
||||
return getField(field_code(type, value));
|
||||
return getField(fieldCode(type, value));
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string const&
|
||||
@@ -202,16 +204,16 @@ public:
|
||||
[[nodiscard]] bool
|
||||
hasName() const
|
||||
{
|
||||
return fieldCode > 0;
|
||||
return fieldCodeMem > 0;
|
||||
}
|
||||
|
||||
[[nodiscard]] Json::StaticString const&
|
||||
[[nodiscard]] json::StaticString const&
|
||||
getJsonName() const
|
||||
{
|
||||
return jsonName;
|
||||
}
|
||||
|
||||
operator Json::StaticString const&() const
|
||||
operator json::StaticString const&() const
|
||||
{
|
||||
return jsonName;
|
||||
}
|
||||
@@ -219,13 +221,13 @@ public:
|
||||
[[nodiscard]] bool
|
||||
isInvalid() const
|
||||
{
|
||||
return fieldCode == -1;
|
||||
return fieldCodeMem == -1;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
isUseful() const
|
||||
{
|
||||
return fieldCode > 0;
|
||||
return fieldCodeMem > 0;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
@@ -247,7 +249,7 @@ public:
|
||||
[[nodiscard]] int
|
||||
getCode() const
|
||||
{
|
||||
return fieldCode;
|
||||
return fieldCodeMem;
|
||||
}
|
||||
[[nodiscard]] int
|
||||
getNum() const
|
||||
@@ -269,19 +271,19 @@ public:
|
||||
[[nodiscard]] bool
|
||||
shouldInclude(bool withSigningField) const
|
||||
{
|
||||
return (fieldValue < 256) && (withSigningField || (signingField == IsSigning::yes));
|
||||
return (fieldValue < 256) && (withSigningField || (signingField == IsSigning::Yes));
|
||||
}
|
||||
|
||||
bool
|
||||
operator==(SField const& f) const
|
||||
{
|
||||
return fieldCode == f.fieldCode;
|
||||
return fieldCodeMem == f.fieldCodeMem;
|
||||
}
|
||||
|
||||
bool
|
||||
operator!=(SField const& f) const
|
||||
{
|
||||
return fieldCode != f.fieldCode;
|
||||
return fieldCodeMem != f.fieldCodeMem;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -306,7 +308,7 @@ struct TypedField : SField
|
||||
using type = T;
|
||||
|
||||
template <class... Args>
|
||||
explicit TypedField(private_access_tag_t pat, Args&&... args);
|
||||
explicit TypedField(PrivateAccessTagT pat, Args&&... args);
|
||||
};
|
||||
|
||||
/** Indicate std::optional field semantics. */
|
||||
@@ -315,7 +317,7 @@ struct OptionaledField
|
||||
{
|
||||
TypedField<T> const* f;
|
||||
|
||||
explicit OptionaledField(TypedField<T> const& f_) : f(&f_)
|
||||
explicit OptionaledField(TypedField<T> const& f) : f(&f)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -366,8 +368,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 sfInvalid;
|
||||
extern SField const sfGeneric;
|
||||
extern SField const kSF_INVALID;
|
||||
extern SField const kSF_GENERIC;
|
||||
|
||||
#include <xrpl/protocol/detail/sfields.macro>
|
||||
|
||||
|
||||
@@ -14,17 +14,18 @@ namespace xrpl {
|
||||
// 2026 usages, 129 files
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum SOEStyle {
|
||||
soeINVALID = -1,
|
||||
soeREQUIRED = 0, // required
|
||||
soeOPTIONAL = 1, // optional, may be present with default value
|
||||
soeDEFAULT = 2, // optional, if present, must not have default value
|
||||
SoeInvalid = -1,
|
||||
SoeRequired = 0, // required
|
||||
SoeOptional = 1, // optional, may be present with default value
|
||||
SoeDefault = 2, // optional, if present, must not have default value
|
||||
// inner object with the default fields has to be
|
||||
// constructed with STObject::makeInnerObject()
|
||||
};
|
||||
|
||||
// Part of a Python-parsed DSL (transactions.macro); bare enumerator names required by the parser
|
||||
/** Amount fields that can support MPT */
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum SOETxMPTIssue { soeMPTNone, soeMPTSupported, soeMPTNotSupported };
|
||||
enum SOETxMPTIssue { SoeMptNone, SoeMptSupported, SoeMptNotSupported };
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -34,7 +35,7 @@ class SOElement
|
||||
// Use std::reference_wrapper so SOElement can be stored in a std::vector.
|
||||
std::reference_wrapper<SField const> sField_;
|
||||
SOEStyle style_;
|
||||
SOETxMPTIssue supportMpt_ = soeMPTNone;
|
||||
SOETxMPTIssue supportMpt_ = SoeMptNone;
|
||||
|
||||
private:
|
||||
void
|
||||
@@ -60,7 +61,7 @@ public:
|
||||
SOElement(
|
||||
TypedField<T> const& fieldName,
|
||||
SOEStyle style,
|
||||
SOETxMPTIssue supportMpt = soeMPTNotSupported)
|
||||
SOETxMPTIssue supportMpt = SoeMptNotSupported)
|
||||
: sField_(fieldName), style_(style), supportMpt_(supportMpt)
|
||||
{
|
||||
init(fieldName);
|
||||
|
||||
@@ -34,39 +34,39 @@ public:
|
||||
using rep = std::pair<mantissa_type, exponent_type>;
|
||||
|
||||
private:
|
||||
Asset mAsset;
|
||||
mantissa_type mValue{};
|
||||
exponent_type mOffset;
|
||||
bool mIsNegative{};
|
||||
Asset asset_;
|
||||
mantissa_type value_{};
|
||||
exponent_type offset_;
|
||||
bool isNegative_{};
|
||||
|
||||
public:
|
||||
using value_type = STAmount;
|
||||
|
||||
constexpr static int cMinOffset = -96;
|
||||
constexpr static int cMaxOffset = 80;
|
||||
constexpr static int kMIN_OFFSET = -96;
|
||||
constexpr static int kMAX_OFFSET = 80;
|
||||
|
||||
// Maximum native value supported by the code
|
||||
constexpr static std::uint64_t cMinValue = 1'000'000'000'000'000ull;
|
||||
static_assert(isPowerOfTen(cMinValue));
|
||||
constexpr static std::uint64_t cMaxValue = (cMinValue * 10) - 1;
|
||||
static_assert(cMaxValue == 9'999'999'999'999'999ull);
|
||||
constexpr static std::uint64_t cMaxNative = 9'000'000'000'000'000'000ull;
|
||||
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;
|
||||
|
||||
// Max native value on network.
|
||||
constexpr static std::uint64_t cMaxNativeN = 100'000'000'000'000'000ull;
|
||||
constexpr static std::uint64_t cIssuedCurrency = 0x8'000'000'000'000'000ull;
|
||||
constexpr static std::uint64_t cPositive = 0x4'000'000'000'000'000ull;
|
||||
constexpr static std::uint64_t cMPToken = 0x2'000'000'000'000'000ull;
|
||||
constexpr static std::uint64_t cValueMask = ~(cPositive | cMPToken);
|
||||
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 std::uint64_t const uRateOne;
|
||||
static std::uint64_t const kU_RATE_ONE;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
STAmount(SerialIter& sit, SField const& name);
|
||||
|
||||
struct unchecked
|
||||
struct Unchecked
|
||||
{
|
||||
explicit unchecked() = default;
|
||||
explicit Unchecked() = default;
|
||||
};
|
||||
|
||||
// Do not call canonicalize
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
mantissa_type mantissa,
|
||||
exponent_type exponent,
|
||||
bool negative,
|
||||
unchecked);
|
||||
Unchecked);
|
||||
|
||||
template <AssetType A>
|
||||
STAmount(
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
mantissa_type mantissa,
|
||||
exponent_type exponent,
|
||||
bool negative,
|
||||
unchecked);
|
||||
Unchecked);
|
||||
|
||||
// Call canonicalize
|
||||
template <AssetType A>
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
|
||||
template <AssetType A>
|
||||
STAmount(A const& asset, std::uint64_t mantissa = 0, int exponent = 0, bool negative = false)
|
||||
: mAsset(asset), mValue(mantissa), mOffset(exponent), mIsNegative(negative)
|
||||
: asset_(asset), value_(mantissa), offset_(exponent), isNegative_(negative)
|
||||
{
|
||||
canonicalize();
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
zeroed() const;
|
||||
|
||||
void
|
||||
setJson(Json::Value&) const;
|
||||
setJson(json::Value&) const;
|
||||
|
||||
[[nodiscard]] STAmount const&
|
||||
value() const noexcept;
|
||||
@@ -241,7 +241,7 @@ public:
|
||||
[[nodiscard]] std::string
|
||||
getText() const override;
|
||||
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions = JsonOptions::none) const override;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions = JsonOptions::KNone) const override;
|
||||
|
||||
void
|
||||
add(Serializer& s) const override;
|
||||
@@ -293,8 +293,8 @@ STAmount::STAmount(
|
||||
mantissa_type mantissa,
|
||||
exponent_type exponent,
|
||||
bool negative,
|
||||
unchecked)
|
||||
: STBase(name), mAsset(asset), mValue(mantissa), mOffset(exponent), mIsNegative(negative)
|
||||
Unchecked)
|
||||
: STBase(name), asset_(asset), value_(mantissa), offset_(exponent), isNegative_(negative)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -304,8 +304,8 @@ STAmount::STAmount(
|
||||
mantissa_type mantissa,
|
||||
exponent_type exponent,
|
||||
bool negative,
|
||||
unchecked)
|
||||
: mAsset(asset), mValue(mantissa), mOffset(exponent), mIsNegative(negative)
|
||||
Unchecked)
|
||||
: asset_(asset), value_(mantissa), offset_(exponent), isNegative_(negative)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -316,19 +316,19 @@ STAmount::STAmount(
|
||||
std::uint64_t mantissa,
|
||||
int exponent,
|
||||
bool negative)
|
||||
: STBase(name), mAsset(asset), mValue(mantissa), mOffset(exponent), mIsNegative(negative)
|
||||
: STBase(name), asset_(asset), value_(mantissa), offset_(exponent), isNegative_(negative)
|
||||
{
|
||||
// mValue is uint64, but needs to fit in the range of int64
|
||||
if (Number::getMantissaScale() == MantissaRange::mantissa_scale::small)
|
||||
// value_ is uint64, but needs to fit in the range of int64
|
||||
if (Number::getMantissaScale() == MantissaRange::MantissaScale::Small)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
mValue <= std::numeric_limits<std::int64_t>::max(),
|
||||
value_ <= std::numeric_limits<std::int64_t>::max(),
|
||||
"xrpl::STAmount::STAmount(SField, A, std::uint64_t, int, bool) : "
|
||||
"maximum mantissa input");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (integral() && mValue > std::numeric_limits<std::int64_t>::max())
|
||||
if (integral() && value_ > std::numeric_limits<std::int64_t>::max())
|
||||
throw std::overflow_error("STAmount mantissa is too large " + std::to_string(mantissa));
|
||||
}
|
||||
canonicalize();
|
||||
@@ -336,7 +336,7 @@ STAmount::STAmount(
|
||||
|
||||
template <AssetType A>
|
||||
STAmount::STAmount(A const& asset, std::int64_t mantissa, int exponent)
|
||||
: mAsset(asset), mOffset(exponent)
|
||||
: asset_(asset), offset_(exponent)
|
||||
{
|
||||
set(mantissa);
|
||||
canonicalize();
|
||||
@@ -344,42 +344,42 @@ STAmount::STAmount(A const& asset, std::int64_t mantissa, int exponent)
|
||||
|
||||
template <AssetType A>
|
||||
STAmount::STAmount(A const& asset, std::uint32_t mantissa, int exponent, bool negative)
|
||||
: STAmount(asset, safe_cast<std::uint64_t>(mantissa), exponent, negative)
|
||||
: STAmount(asset, safeCast<std::uint64_t>(mantissa), exponent, negative)
|
||||
{
|
||||
}
|
||||
|
||||
template <AssetType A>
|
||||
STAmount::STAmount(A const& asset, int mantissa, int exponent)
|
||||
: STAmount(asset, safe_cast<std::int64_t>(mantissa), exponent)
|
||||
: STAmount(asset, safeCast<std::int64_t>(mantissa), exponent)
|
||||
{
|
||||
}
|
||||
|
||||
// Legacy support for new-style amounts
|
||||
inline STAmount::STAmount(IOUAmount const& amount, Issue const& issue)
|
||||
: mAsset(issue), mOffset(amount.exponent()), mIsNegative(amount < beast::zero)
|
||||
: asset_(issue), offset_(amount.exponent()), isNegative_(amount < beast::kZERO)
|
||||
{
|
||||
if (mIsNegative)
|
||||
if (isNegative_)
|
||||
{
|
||||
mValue = unsafe_cast<std::uint64_t>(-amount.mantissa());
|
||||
value_ = unsafeCast<std::uint64_t>(-amount.mantissa());
|
||||
}
|
||||
else
|
||||
{
|
||||
mValue = unsafe_cast<std::uint64_t>(amount.mantissa());
|
||||
value_ = unsafeCast<std::uint64_t>(amount.mantissa());
|
||||
}
|
||||
|
||||
canonicalize();
|
||||
}
|
||||
|
||||
inline STAmount::STAmount(MPTAmount const& amount, MPTIssue const& mptIssue)
|
||||
: mAsset(mptIssue), mOffset(0), mIsNegative(amount < beast::zero)
|
||||
: asset_(mptIssue), offset_(0), isNegative_(amount < beast::kZERO)
|
||||
{
|
||||
if (mIsNegative)
|
||||
if (isNegative_)
|
||||
{
|
||||
mValue = unsafe_cast<std::uint64_t>(-amount.value());
|
||||
value_ = unsafeCast<std::uint64_t>(-amount.value());
|
||||
}
|
||||
else
|
||||
{
|
||||
mValue = unsafe_cast<std::uint64_t>(amount.value());
|
||||
value_ = unsafeCast<std::uint64_t>(amount.value());
|
||||
}
|
||||
|
||||
canonicalize();
|
||||
@@ -399,10 +399,10 @@ STAmount
|
||||
amountFromString(Asset const& asset, std::string const& amount);
|
||||
|
||||
STAmount
|
||||
amountFromJson(SField const& name, Json::Value const& v);
|
||||
amountFromJson(SField const& name, json::Value const& v);
|
||||
|
||||
bool
|
||||
amountFromJsonNoThrow(STAmount& result, Json::Value const& jvSource);
|
||||
amountFromJsonNoThrow(STAmount& result, json::Value const& jvSource);
|
||||
|
||||
// IOUAmount and XRPAmount define toSTAmount, defining this
|
||||
// trivial conversion here makes writing generic code easier
|
||||
@@ -421,84 +421,84 @@ toSTAmount(STAmount const& a)
|
||||
inline int
|
||||
STAmount::exponent() const noexcept
|
||||
{
|
||||
return mOffset;
|
||||
return offset_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
STAmount::integral() const noexcept
|
||||
{
|
||||
return mAsset.integral();
|
||||
return asset_.integral();
|
||||
}
|
||||
|
||||
inline bool
|
||||
STAmount::native() const noexcept
|
||||
{
|
||||
return mAsset.native();
|
||||
return asset_.native();
|
||||
}
|
||||
|
||||
template <ValidIssueType TIss>
|
||||
constexpr bool
|
||||
STAmount::holds() const noexcept
|
||||
{
|
||||
return mAsset.holds<TIss>();
|
||||
return asset_.holds<TIss>();
|
||||
}
|
||||
|
||||
inline bool
|
||||
STAmount::negative() const noexcept
|
||||
{
|
||||
return mIsNegative;
|
||||
return isNegative_;
|
||||
}
|
||||
|
||||
inline std::uint64_t
|
||||
STAmount::mantissa() const noexcept
|
||||
{
|
||||
return mValue;
|
||||
return value_;
|
||||
}
|
||||
|
||||
inline Asset const&
|
||||
STAmount::asset() const
|
||||
{
|
||||
return mAsset;
|
||||
return asset_;
|
||||
}
|
||||
|
||||
template <ValidIssueType TIss>
|
||||
[[nodiscard]] constexpr TIss const&
|
||||
STAmount::get() const
|
||||
{
|
||||
return mAsset.get<TIss>();
|
||||
return asset_.get<TIss>();
|
||||
}
|
||||
|
||||
template <ValidIssueType TIss>
|
||||
TIss&
|
||||
STAmount::get()
|
||||
{
|
||||
return mAsset.get<TIss>();
|
||||
return asset_.get<TIss>();
|
||||
}
|
||||
|
||||
inline AccountID const&
|
||||
STAmount::getIssuer() const
|
||||
{
|
||||
return mAsset.getIssuer();
|
||||
return asset_.getIssuer();
|
||||
}
|
||||
|
||||
inline int
|
||||
STAmount::signum() const noexcept
|
||||
{
|
||||
if (mValue == 0u)
|
||||
if (value_ == 0u)
|
||||
return 0;
|
||||
return mIsNegative ? -1 : 1;
|
||||
return isNegative_ ? -1 : 1;
|
||||
}
|
||||
|
||||
inline STAmount
|
||||
STAmount::zeroed() const
|
||||
{
|
||||
return STAmount(mAsset);
|
||||
return STAmount(asset_);
|
||||
}
|
||||
|
||||
inline STAmount::
|
||||
operator bool() const noexcept
|
||||
{
|
||||
return *this != beast::zero;
|
||||
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(cMinValue, cMaxValue);
|
||||
auto const [mantissa, exponent] = working.normalizeToRange(kMIN_VALUE, kMAX_VALUE);
|
||||
|
||||
return STAmount{asset, mantissa, exponent, negative};
|
||||
}
|
||||
@@ -548,8 +548,8 @@ STAmount::fromNumber(A const& a, Number const& number)
|
||||
inline void
|
||||
STAmount::negate()
|
||||
{
|
||||
if (*this != beast::zero)
|
||||
mIsNegative = !mIsNegative;
|
||||
if (*this != beast::kZERO)
|
||||
isNegative_ = !isNegative_;
|
||||
}
|
||||
|
||||
inline void
|
||||
@@ -557,9 +557,9 @@ STAmount::clear()
|
||||
{
|
||||
// The -100 is used to allow 0 to sort less than a small positive values
|
||||
// which have a negative exponent.
|
||||
mOffset = integral() ? 0 : -100;
|
||||
mValue = 0;
|
||||
mIsNegative = false;
|
||||
offset_ = integral() ? 0 : -100;
|
||||
value_ = 0;
|
||||
isNegative_ = false;
|
||||
}
|
||||
|
||||
inline void
|
||||
@@ -578,7 +578,7 @@ STAmount::value() const noexcept
|
||||
inline bool
|
||||
isLegalNet(STAmount const& value)
|
||||
{
|
||||
return !value.native() || (value.mantissa() <= STAmount::cMaxNativeN);
|
||||
return !value.native() || (value.mantissa() <= STAmount::kMAX_NATIVE_N);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -674,7 +674,7 @@ getRate(STAmount const& offerOut, STAmount const& offerIn);
|
||||
roundToScale(
|
||||
STAmount const& value,
|
||||
std::int32_t scale,
|
||||
Number::rounding_mode rounding = Number::getround());
|
||||
Number::RoundingMode rounding = Number::getround());
|
||||
|
||||
/** Round an arbitrary precision Number IN PLACE to the precision of a given
|
||||
* Asset.
|
||||
@@ -709,7 +709,7 @@ roundToAsset(
|
||||
A const& asset,
|
||||
Number const& value,
|
||||
std::int32_t scale,
|
||||
Number::rounding_mode rounding = Number::getround())
|
||||
Number::RoundingMode rounding = Number::getround())
|
||||
{
|
||||
NumberRoundModeGuard const mg(rounding);
|
||||
STAmount const ret{asset, value};
|
||||
@@ -752,16 +752,16 @@ scale(Number const& number, Asset const& asset)
|
||||
} // namespace xrpl
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
namespace Json {
|
||||
namespace json {
|
||||
template <>
|
||||
inline xrpl::STAmount
|
||||
getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
getOrThrow(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
using namespace xrpl;
|
||||
Json::StaticString const& key = field.getJsonName();
|
||||
json::StaticString const& key = field.getJsonName();
|
||||
if (!v.isMember(key))
|
||||
Throw<JsonMissingKeyError>(key);
|
||||
Json::Value const& inner = v[key];
|
||||
json::Value const& inner = v[key];
|
||||
return amountFromJson(field, inner);
|
||||
}
|
||||
} // namespace Json
|
||||
} // namespace json
|
||||
|
||||
@@ -58,13 +58,28 @@ public:
|
||||
|
||||
template <class... Args>
|
||||
void
|
||||
emplace_back(Args&&... args);
|
||||
emplaceBack(Args&&... args);
|
||||
|
||||
void
|
||||
push_back(STObject const& object);
|
||||
pushBack(STObject const& object);
|
||||
|
||||
void
|
||||
push_back(STObject&& object);
|
||||
pushBack(STObject&& object);
|
||||
|
||||
// STL-compatible alias required by std::back_insert_iterator
|
||||
void
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
push_back(STObject const& object)
|
||||
{
|
||||
pushBack(object);
|
||||
}
|
||||
|
||||
void
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
push_back(STObject&& object)
|
||||
{
|
||||
pushBack(std::move(object));
|
||||
}
|
||||
|
||||
iterator
|
||||
begin();
|
||||
@@ -99,7 +114,7 @@ public:
|
||||
[[nodiscard]] std::string
|
||||
getText() const override;
|
||||
|
||||
[[nodiscard]] Json::Value
|
||||
[[nodiscard]] json::Value
|
||||
getJson(JsonOptions index) const override;
|
||||
|
||||
void
|
||||
@@ -180,19 +195,19 @@ STArray::back() const
|
||||
|
||||
template <class... Args>
|
||||
inline void
|
||||
STArray::emplace_back(Args&&... args)
|
||||
STArray::emplaceBack(Args&&... args)
|
||||
{
|
||||
v_.emplace_back(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
inline void
|
||||
STArray::push_back(STObject const& object)
|
||||
STArray::pushBack(STObject const& object)
|
||||
{
|
||||
v_.push_back(object);
|
||||
}
|
||||
|
||||
inline void
|
||||
STArray::push_back(STObject&& object)
|
||||
STArray::pushBack(STObject&& object)
|
||||
{
|
||||
v_.push_back(std::move(object));
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ struct JsonOptions
|
||||
|
||||
// Bitwise flags with operator~
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum values : underlying_t {
|
||||
enum Values : underlying_t {
|
||||
// clang-format off
|
||||
none = 0b0000'0000,
|
||||
include_date = 0b0000'0001,
|
||||
disable_API_prior_V2 = 0b0000'0010,
|
||||
KNone = 0b0000'0000,
|
||||
KIncludeDate = 0b0000'0001,
|
||||
KDisableApiPriorV2 = 0b0000'0010,
|
||||
|
||||
// IMPORTANT `_all` must be union of all of the above; see also operator~
|
||||
_all = 0b0000'0011
|
||||
// IMPORTANT `kALL` must be union of all of the above; see also operator~
|
||||
KAll = 0b0000'0011
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -65,22 +65,22 @@ struct JsonOptions
|
||||
}
|
||||
|
||||
/// Returns JsonOptions binary negation, can be used with & (above) for set
|
||||
/// difference e.g. `(options & ~JsonOptions::include_date)`
|
||||
/// difference e.g. `(options & ~JsonOptions::kINCLUDE_DATE)`
|
||||
[[nodiscard]] constexpr JsonOptions friend
|
||||
operator~(JsonOptions v) noexcept
|
||||
{
|
||||
return {~v.value & static_cast<underlying_t>(_all)};
|
||||
return {~v.value & static_cast<underlying_t>(KAll)};
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
requires requires(T const& t) {
|
||||
{ t.getJson(JsonOptions::none) } -> std::convertible_to<Json::Value>;
|
||||
{ t.getJson(JsonOptions::KNone) } -> std::convertible_to<json::Value>;
|
||||
}
|
||||
Json::Value
|
||||
to_json(T const& t)
|
||||
json::Value
|
||||
toJson(T const& t)
|
||||
{
|
||||
return t.getJson(JsonOptions::none);
|
||||
return t.getJson(JsonOptions::KNone);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
@@ -115,7 +115,7 @@ class STVar;
|
||||
*/
|
||||
class STBase
|
||||
{
|
||||
SField const* fName;
|
||||
SField const* fName_;
|
||||
|
||||
public:
|
||||
virtual ~STBase() = default;
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
[[nodiscard]] virtual std::string
|
||||
getText() const;
|
||||
|
||||
[[nodiscard]] virtual Json::Value getJson(JsonOptions = JsonOptions::none) const;
|
||||
[[nodiscard]] virtual json::Value getJson(JsonOptions = JsonOptions::KNone) const;
|
||||
|
||||
virtual void
|
||||
add(Serializer& s) const;
|
||||
|
||||
@@ -16,7 +16,7 @@ class STBitString final : public STBase, public CountedObject<STBitString<Bits>>
|
||||
static_assert(Bits > 0, "Number of bits must be positive");
|
||||
|
||||
public:
|
||||
using value_type = base_uint<Bits>;
|
||||
using value_type = BaseUint<Bits>;
|
||||
|
||||
private:
|
||||
value_type value_{};
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
template <typename Tag>
|
||||
void
|
||||
setValue(base_uint<Bits, Tag> const& v);
|
||||
setValue(BaseUint<Bits, Tag> const& v);
|
||||
|
||||
[[nodiscard]] value_type const&
|
||||
value() const;
|
||||
@@ -157,7 +157,7 @@ STBitString<Bits>::add(Serializer& s) const
|
||||
template <int Bits>
|
||||
template <typename Tag>
|
||||
void
|
||||
STBitString<Bits>::setValue(base_uint<Bits, Tag> const& v)
|
||||
STBitString<Bits>::setValue(BaseUint<Bits, Tag> const& v)
|
||||
{
|
||||
value_ = v;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ template <int Bits>
|
||||
bool
|
||||
STBitString<Bits>::isDefault() const
|
||||
{
|
||||
return value_ == beast::zero;
|
||||
return value_ == beast::kZERO;
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -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 = sfGeneric);
|
||||
STBlob(SerialIter&, SField const& name = kSF_GENERIC);
|
||||
|
||||
[[nodiscard]] std::size_t
|
||||
size() const;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
[[nodiscard]] std::string
|
||||
getText() const override;
|
||||
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions) const override;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions) const override;
|
||||
|
||||
void
|
||||
add(Serializer& s) const override;
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
};
|
||||
|
||||
STCurrency
|
||||
currencyFromJson(SField const& name, Json::Value const& v);
|
||||
currencyFromJson(SField const& name, json::Value const& v);
|
||||
|
||||
inline Currency const&
|
||||
STCurrency::currency() const
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
[[nodiscard]] SerializedTypeID
|
||||
getSType() const override;
|
||||
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions) const override;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions) const override;
|
||||
|
||||
[[nodiscard]] std::string
|
||||
getText() const override;
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
[[nodiscard]] std::string
|
||||
getText() const override;
|
||||
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions) const override;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions) const override;
|
||||
|
||||
void
|
||||
add(Serializer& s) const override;
|
||||
@@ -89,7 +89,7 @@ STIssue::STIssue(SField const& name, A const& asset) : STBase{name}, asset_{asse
|
||||
}
|
||||
|
||||
STIssue
|
||||
issueFromJson(SField const& name, Json::Value const& v);
|
||||
issueFromJson(SField const& name, json::Value const& v);
|
||||
|
||||
template <ValidIssueType TIss>
|
||||
bool
|
||||
|
||||
@@ -37,8 +37,8 @@ public:
|
||||
[[nodiscard]] std::string
|
||||
getText() const override;
|
||||
|
||||
[[nodiscard]] Json::Value
|
||||
getJson(JsonOptions options = JsonOptions::none) const override;
|
||||
[[nodiscard]] json::Value
|
||||
getJson(JsonOptions options = JsonOptions::KNone) const override;
|
||||
|
||||
/** Returns the 'key' (or 'index') of this item.
|
||||
The key identifies this entry's position in
|
||||
|
||||
@@ -96,6 +96,6 @@ NumberParts
|
||||
partsFromString(std::string const& number);
|
||||
|
||||
STNumber
|
||||
numberFromJson(SField const& field, Json::Value const& value);
|
||||
numberFromJson(SField const& field, json::Value const& value);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -57,7 +57,7 @@ class STObject : public STBase, public CountedObject<STObject>
|
||||
using list_type = std::vector<detail::STVar>;
|
||||
|
||||
list_type v_;
|
||||
SOTemplate const* mType{};
|
||||
SOTemplate const* type_{};
|
||||
|
||||
public:
|
||||
using iterator = boost::transform_iterator<Transform, STObject::list_type::const_iterator>;
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
getText() const override;
|
||||
|
||||
// TODO(tom): options should be an enum.
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions = JsonOptions::none) const override;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions = JsonOptions::KNone) const override;
|
||||
|
||||
void
|
||||
addWithoutSigningFields(Serializer& s) const;
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
|
||||
template <class... Args>
|
||||
std::size_t
|
||||
emplace_back(Args&&... args);
|
||||
emplaceBack(Args&&... args);
|
||||
|
||||
[[nodiscard]] int
|
||||
getCount() const;
|
||||
@@ -381,7 +381,7 @@ public:
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
setFieldH160(SField const& field, base_uint<160, Tag> const& v);
|
||||
setFieldH160(SField const& field, BaseUint<160, Tag> const& v);
|
||||
|
||||
STObject&
|
||||
peekFieldObject(SField const& field);
|
||||
@@ -415,9 +415,9 @@ public:
|
||||
private:
|
||||
enum class WhichFields : bool {
|
||||
// These values are carefully chosen to do the right thing if passed
|
||||
// to SField::shouldInclude (bool) via static_cast<bool>
|
||||
omitSigningFields = false,
|
||||
withAllFields = true
|
||||
// to SField::shouldInclude (bool)
|
||||
OmitSigningFields = false,
|
||||
WithAllFields = true
|
||||
};
|
||||
|
||||
void
|
||||
@@ -667,7 +667,7 @@ public:
|
||||
|
||||
// Emulate std::optional::value_or
|
||||
[[nodiscard]] value_type
|
||||
value_or(value_type val) const;
|
||||
valueOr(value_type val) const;
|
||||
|
||||
OptionalProxy&
|
||||
operator=(std::nullopt_t const&);
|
||||
@@ -692,7 +692,7 @@ private:
|
||||
disengage();
|
||||
|
||||
[[nodiscard]] optional_type
|
||||
optional_value() const;
|
||||
optionalValue() const;
|
||||
};
|
||||
|
||||
class STObject::FieldErr : public std::runtime_error
|
||||
@@ -703,16 +703,16 @@ class STObject::FieldErr : public std::runtime_error
|
||||
template <class T>
|
||||
STObject::Proxy<T>::Proxy(STObject* st, TypedField<T> const* f) : st_(st), f_(f)
|
||||
{
|
||||
if (st_->mType != nullptr)
|
||||
if (st_->type_ != nullptr)
|
||||
{
|
||||
// STObject has associated template
|
||||
if (!st_->peekAtPField(*f_))
|
||||
Throw<STObject::FieldErr>("Template field error '" + this->f_->getName() + "'");
|
||||
style_ = st_->mType->style(*f_);
|
||||
style_ = st_->type_->style(*f_);
|
||||
}
|
||||
else
|
||||
{
|
||||
style_ = soeINVALID;
|
||||
style_ = SoeInvalid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,11 +723,11 @@ STObject::Proxy<T>::value() const -> value_type
|
||||
auto const t = find();
|
||||
if (t)
|
||||
return t->value();
|
||||
if (style_ == soeINVALID)
|
||||
if (style_ == SoeInvalid)
|
||||
{
|
||||
Throw<STObject::FieldErr>("Value requested from invalid STObject.");
|
||||
}
|
||||
if (style_ != soeDEFAULT)
|
||||
if (style_ != SoeDefault)
|
||||
{
|
||||
Throw<STObject::FieldErr>("Missing field '" + this->f_->getName() + "'");
|
||||
}
|
||||
@@ -762,13 +762,13 @@ template <class U>
|
||||
void
|
||||
STObject::Proxy<T>::assign(U&& u)
|
||||
{
|
||||
if (style_ == soeDEFAULT && u == value_type{})
|
||||
if (style_ == SoeDefault && u == value_type{})
|
||||
{
|
||||
st_->makeFieldAbsent(*f_);
|
||||
return;
|
||||
}
|
||||
T* t = nullptr;
|
||||
if (style_ == soeINVALID)
|
||||
if (style_ == SoeInvalid)
|
||||
{
|
||||
t = dynamic_cast<T*>(st_->getPField(*f_, true));
|
||||
}
|
||||
@@ -836,14 +836,14 @@ template <class T>
|
||||
STObject::OptionalProxy<T>::
|
||||
operator typename STObject::OptionalProxy<T>::optional_type() const
|
||||
{
|
||||
return optional_value();
|
||||
return optionalValue();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename STObject::OptionalProxy<T>::optional_type
|
||||
STObject::OptionalProxy<T>::operator~() const
|
||||
{
|
||||
return optional_value();
|
||||
return optionalValue();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -904,16 +904,16 @@ template <class T>
|
||||
bool
|
||||
STObject::OptionalProxy<T>::engaged() const noexcept
|
||||
{
|
||||
return this->style_ == soeDEFAULT || this->find() != nullptr;
|
||||
return this->style_ == SoeDefault || this->find() != nullptr;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
STObject::OptionalProxy<T>::disengage()
|
||||
{
|
||||
if (this->style_ == soeREQUIRED || this->style_ == soeDEFAULT)
|
||||
if (this->style_ == SoeRequired || this->style_ == SoeDefault)
|
||||
Throw<STObject::FieldErr>("Template field error '" + this->f_->getName() + "'");
|
||||
if (this->style_ == soeINVALID)
|
||||
if (this->style_ == SoeInvalid)
|
||||
{
|
||||
this->st_->delField(*this->f_);
|
||||
}
|
||||
@@ -925,7 +925,7 @@ STObject::OptionalProxy<T>::disengage()
|
||||
|
||||
template <class T>
|
||||
auto
|
||||
STObject::OptionalProxy<T>::optional_value() const -> optional_type
|
||||
STObject::OptionalProxy<T>::optionalValue() const -> optional_type
|
||||
{
|
||||
if (!engaged())
|
||||
return std::nullopt;
|
||||
@@ -934,7 +934,7 @@ STObject::OptionalProxy<T>::optional_value() const -> optional_type
|
||||
|
||||
template <class T>
|
||||
typename STObject::OptionalProxy<T>::value_type
|
||||
STObject::OptionalProxy<T>::value_or(value_type val) const
|
||||
STObject::OptionalProxy<T>::valueOr(value_type val) const
|
||||
{
|
||||
return engaged() ? this->value() : val;
|
||||
}
|
||||
@@ -981,13 +981,13 @@ STObject::reserve(std::size_t n)
|
||||
inline bool
|
||||
STObject::isFree() const
|
||||
{
|
||||
return mType == nullptr;
|
||||
return type_ == nullptr;
|
||||
}
|
||||
|
||||
inline void
|
||||
STObject::addWithoutSigningFields(Serializer& s) const
|
||||
{
|
||||
add(s, WhichFields::omitSigningFields);
|
||||
add(s, WhichFields::OmitSigningFields);
|
||||
}
|
||||
|
||||
// VFALCO NOTE does this return an expensive copy of an object with a
|
||||
@@ -997,13 +997,13 @@ inline Serializer
|
||||
STObject::getSerializer() const
|
||||
{
|
||||
Serializer s;
|
||||
add(s, WhichFields::withAllFields);
|
||||
add(s, WhichFields::WithAllFields);
|
||||
return s;
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
inline std::size_t
|
||||
STObject::emplace_back(Args&&... args)
|
||||
STObject::emplaceBack(Args&&... args)
|
||||
{
|
||||
v_.emplace_back(std::forward<Args>(args)...);
|
||||
return v_.size() - 1;
|
||||
@@ -1082,21 +1082,21 @@ STObject::at(TypedField<T> const& f) const
|
||||
if (auto const u = dynamic_cast<T const*>(b))
|
||||
return u->value();
|
||||
|
||||
XRPL_ASSERT(mType, "xrpl::STObject::at(TypedField auto) : field template non-null");
|
||||
XRPL_ASSERT(type_, "xrpl::STObject::at(TypedField auto) : field template non-null");
|
||||
XRPL_ASSERT(
|
||||
b->getSType() == STI_NOTPRESENT, "xrpl::STObject::at(TypedField auto) : type not present");
|
||||
|
||||
if (mType->style(f) == soeOPTIONAL)
|
||||
if (type_->style(f) == SoeOptional)
|
||||
Throw<STObject::FieldErr>("Missing optional field: " + f.getName());
|
||||
|
||||
XRPL_ASSERT(
|
||||
mType->style(f) == soeDEFAULT,
|
||||
type_->style(f) == SoeDefault,
|
||||
"xrpl::STObject::at(TypedField auto) : template style is default");
|
||||
|
||||
// Used to help handle the case where value_type is a const reference,
|
||||
// otherwise we would return the address of a temporary.
|
||||
static std::decay_t<typename T::value_type> const dv{};
|
||||
return dv;
|
||||
static std::decay_t<typename T::value_type> const kDV{};
|
||||
return kDV;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -1110,16 +1110,16 @@ STObject::at(OptionaledField<T> const& of) const
|
||||
if (!u)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
mType,
|
||||
type_,
|
||||
"xrpl::STObject::at(OptionaledField auto) : field template "
|
||||
"non-null");
|
||||
XRPL_ASSERT(
|
||||
b->getSType() == STI_NOTPRESENT,
|
||||
"xrpl::STObject::at(OptionaledField auto) : type not present");
|
||||
if (mType->style(*of.f) == soeOPTIONAL)
|
||||
if (type_->style(*of.f) == SoeOptional)
|
||||
return std::nullopt;
|
||||
XRPL_ASSERT(
|
||||
mType->style(*of.f) == soeDEFAULT,
|
||||
type_->style(*of.f) == SoeDefault,
|
||||
"xrpl::STObject::at(OptionaledField auto) : template style is "
|
||||
"default");
|
||||
return typename T::value_type{};
|
||||
@@ -1143,7 +1143,7 @@ STObject::at(OptionaledField<T> const& of) -> OptionalProxy<T>
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
STObject::setFieldH160(SField const& field, base_uint<160, Tag> const& v)
|
||||
STObject::setFieldH160(SField const& field, BaseUint<160, Tag> const& v)
|
||||
{
|
||||
STBase* rf = getPField(field, true);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
@param name The name of the JSON field, used in diagnostics.
|
||||
@param json The JSON-RPC to parse.
|
||||
*/
|
||||
STParsedJSONObject(std::string const& name, Json::Value const& json);
|
||||
STParsedJSONObject(std::string const& name, json::Value const& json);
|
||||
|
||||
STParsedJSONObject() = delete;
|
||||
STParsedJSONObject(STParsedJSONObject const&) = delete;
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
std::optional<STObject> object;
|
||||
|
||||
/** On failure, an appropriate set of error values. */
|
||||
Json::Value error;
|
||||
json::Value error;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -16,10 +16,10 @@ namespace xrpl {
|
||||
|
||||
class STPathElement final : public CountedObject<STPathElement>
|
||||
{
|
||||
unsigned int mType;
|
||||
AccountID mAccountID;
|
||||
PathAsset mAssetID;
|
||||
AccountID mIssuerID;
|
||||
unsigned int type_;
|
||||
AccountID accountID_;
|
||||
PathAsset assetID_;
|
||||
AccountID issuerID_;
|
||||
|
||||
bool is_offer_;
|
||||
std::size_t hash_value_;
|
||||
@@ -28,14 +28,14 @@ public:
|
||||
// Bitwise values (typeCurrency | typeMPT)
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum Type {
|
||||
typeNone = 0x00,
|
||||
typeAccount = 0x01, // Rippling through an account (vs taking an offer).
|
||||
typeCurrency = 0x10, // Currency follows.
|
||||
typeIssuer = 0x20, // Issuer follows.
|
||||
typeMPT = 0x40, // MPT follows.
|
||||
typeBoundary = 0xFF, // Boundary between alternate paths.
|
||||
typeAsset = typeCurrency | typeMPT,
|
||||
typeAll = typeAccount | typeCurrency | typeIssuer | typeMPT,
|
||||
TypeNone = 0x00,
|
||||
TypeAccount = 0x01, // Rippling through an account (vs taking an offer).
|
||||
TypeCurrency = 0x10, // Currency follows.
|
||||
TypeIssuer = 0x20, // Issuer follows.
|
||||
TypeMpt = 0x40, // MPT follows.
|
||||
TypeBoundary = 0xFF, // Boundary between alternate paths.
|
||||
TypeAsset = TypeCurrency | TypeMpt,
|
||||
TypeAll = TypeAccount | TypeCurrency | TypeIssuer | TypeMpt,
|
||||
// Combination of all types.
|
||||
};
|
||||
|
||||
@@ -113,12 +113,12 @@ public:
|
||||
|
||||
private:
|
||||
static std::size_t
|
||||
get_hash(STPathElement const& element);
|
||||
getHash(STPathElement const& element);
|
||||
};
|
||||
|
||||
class STPath final : public CountedObject<STPath>
|
||||
{
|
||||
std::vector<STPathElement> mPath;
|
||||
std::vector<STPathElement> path_;
|
||||
|
||||
public:
|
||||
STPath() = default;
|
||||
@@ -132,16 +132,16 @@ public:
|
||||
empty() const;
|
||||
|
||||
void
|
||||
push_back(STPathElement const& e);
|
||||
pushBack(STPathElement const& e);
|
||||
|
||||
template <typename... Args>
|
||||
void
|
||||
emplace_back(Args&&... args);
|
||||
emplaceBack(Args&&... args);
|
||||
|
||||
[[nodiscard]] bool
|
||||
hasSeen(AccountID const& account, PathAsset const& asset, AccountID const& issuer) const;
|
||||
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions) const;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions) const;
|
||||
|
||||
[[nodiscard]] std::vector<STPathElement>::const_iterator
|
||||
begin() const;
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
// A set of zero or more payment paths
|
||||
class STPathSet final : public STBase, public CountedObject<STPathSet>
|
||||
{
|
||||
std::vector<STPath> value;
|
||||
std::vector<STPath> value_;
|
||||
|
||||
public:
|
||||
STPathSet() = default;
|
||||
@@ -184,7 +184,7 @@ public:
|
||||
void
|
||||
add(Serializer& s) const override;
|
||||
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions) const override;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions) const override;
|
||||
|
||||
[[nodiscard]] SerializedTypeID
|
||||
getSType() const override;
|
||||
@@ -218,11 +218,11 @@ public:
|
||||
empty() const;
|
||||
|
||||
void
|
||||
push_back(STPath const& e);
|
||||
pushBack(STPath const& e);
|
||||
|
||||
template <typename... Args>
|
||||
void
|
||||
emplace_back(Args&&... args);
|
||||
emplaceBack(Args&&... args);
|
||||
|
||||
private:
|
||||
STBase*
|
||||
@@ -235,16 +235,16 @@ private:
|
||||
|
||||
// ------------ STPathElement ------------
|
||||
|
||||
inline STPathElement::STPathElement() : mType(typeNone), is_offer_(true)
|
||||
inline STPathElement::STPathElement() : type_(TypeNone), is_offer_(true)
|
||||
{
|
||||
hash_value_ = get_hash(*this);
|
||||
hash_value_ = getHash(*this);
|
||||
}
|
||||
|
||||
inline STPathElement::STPathElement(
|
||||
std::optional<AccountID> const& account,
|
||||
std::optional<PathAsset> const& asset,
|
||||
std::optional<AccountID> const& issuer)
|
||||
: mType(typeNone)
|
||||
: type_(TypeNone)
|
||||
{
|
||||
if (!account)
|
||||
{
|
||||
@@ -253,26 +253,26 @@ inline STPathElement::STPathElement(
|
||||
else
|
||||
{
|
||||
is_offer_ = false;
|
||||
mAccountID = *account;
|
||||
mType |= typeAccount;
|
||||
accountID_ = *account;
|
||||
type_ |= TypeAccount;
|
||||
XRPL_ASSERT(
|
||||
mAccountID != noAccount(), "xrpl::STPathElement::STPathElement : account is set");
|
||||
accountID_ != noAccount(), "xrpl::STPathElement::STPathElement : account is set");
|
||||
}
|
||||
|
||||
if (asset)
|
||||
{
|
||||
mAssetID = *asset;
|
||||
mType |= mAssetID.holds<Currency>() ? typeCurrency : typeMPT;
|
||||
assetID_ = *asset;
|
||||
type_ |= assetID_.holds<Currency>() ? TypeCurrency : TypeMpt;
|
||||
}
|
||||
|
||||
if (issuer)
|
||||
{
|
||||
mIssuerID = *issuer;
|
||||
mType |= typeIssuer;
|
||||
XRPL_ASSERT(mIssuerID != noAccount(), "xrpl::STPathElement::STPathElement : issuer is set");
|
||||
issuerID_ = *issuer;
|
||||
type_ |= TypeIssuer;
|
||||
XRPL_ASSERT(issuerID_ != noAccount(), "xrpl::STPathElement::STPathElement : issuer is set");
|
||||
}
|
||||
|
||||
hash_value_ = get_hash(*this);
|
||||
hash_value_ = getHash(*this);
|
||||
}
|
||||
|
||||
inline STPathElement::STPathElement(
|
||||
@@ -280,22 +280,22 @@ inline STPathElement::STPathElement(
|
||||
PathAsset const& asset,
|
||||
AccountID const& issuer,
|
||||
bool forceAsset)
|
||||
: mType(typeNone)
|
||||
, mAccountID(account)
|
||||
, mAssetID(asset)
|
||||
, mIssuerID(issuer)
|
||||
, is_offer_(isXRP(mAccountID))
|
||||
: type_(TypeNone)
|
||||
, accountID_(account)
|
||||
, assetID_(asset)
|
||||
, issuerID_(issuer)
|
||||
, is_offer_(isXRP(accountID_))
|
||||
{
|
||||
if (!is_offer_)
|
||||
mType |= typeAccount;
|
||||
type_ |= TypeAccount;
|
||||
|
||||
if (forceAsset || !isXRP(mAssetID))
|
||||
mType |= asset.holds<Currency>() ? typeCurrency : typeMPT;
|
||||
if (forceAsset || !isXRP(assetID_))
|
||||
type_ |= asset.holds<Currency>() ? TypeCurrency : TypeMpt;
|
||||
|
||||
if (!isXRP(issuer))
|
||||
mType |= typeIssuer;
|
||||
type_ |= TypeIssuer;
|
||||
|
||||
hash_value_ = get_hash(*this);
|
||||
hash_value_ = getHash(*this);
|
||||
}
|
||||
|
||||
inline STPathElement::STPathElement(
|
||||
@@ -303,24 +303,22 @@ inline STPathElement::STPathElement(
|
||||
AccountID const& account,
|
||||
PathAsset const& asset,
|
||||
AccountID const& issuer)
|
||||
: mType(uType)
|
||||
, mAccountID(account)
|
||||
, mAssetID(asset)
|
||||
, mIssuerID(issuer)
|
||||
, is_offer_(isXRP(mAccountID))
|
||||
: type_(uType)
|
||||
, accountID_(account)
|
||||
, assetID_(asset)
|
||||
, issuerID_(issuer)
|
||||
, is_offer_(isXRP(accountID_))
|
||||
{
|
||||
// uType could be assetType; i.e. either Currency or MPTID.
|
||||
// Get the actual type.
|
||||
mAssetID.visit(
|
||||
[&](Currency const&) { mType = mType & (~Type::typeMPT); },
|
||||
[&](MPTID const&) { mType = mType & (~Type::typeCurrency); });
|
||||
hash_value_ = get_hash(*this);
|
||||
assetID_.visit(
|
||||
[&](Currency const&) { type_ = type_ & (~Type::TypeMpt); },
|
||||
[&](MPTID const&) { type_ = type_ & (~Type::TypeCurrency); });
|
||||
hash_value_ = getHash(*this);
|
||||
}
|
||||
|
||||
inline auto
|
||||
STPathElement::getNodeType() const
|
||||
{
|
||||
return mType;
|
||||
return type_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
@@ -338,37 +336,37 @@ STPathElement::isAccount() const
|
||||
inline bool
|
||||
STPathElement::isType(Type const& pe) const
|
||||
{
|
||||
return (mType & pe) != 0u;
|
||||
return (type_ & pe) != 0u;
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPathElement::hasIssuer() const
|
||||
{
|
||||
return isType(STPathElement::typeIssuer);
|
||||
return isType(STPathElement::TypeIssuer);
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPathElement::hasCurrency() const
|
||||
{
|
||||
return isType(STPathElement::typeCurrency);
|
||||
return isType(STPathElement::TypeCurrency);
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPathElement::hasMPT() const
|
||||
{
|
||||
return isType(STPathElement::typeMPT);
|
||||
return isType(STPathElement::TypeMpt);
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPathElement::hasAsset() const
|
||||
{
|
||||
return isType(STPathElement::typeAsset);
|
||||
return isType(STPathElement::TypeAsset);
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPathElement::isNone() const
|
||||
{
|
||||
return getNodeType() == STPathElement::typeNone;
|
||||
return getNodeType() == STPathElement::TypeNone;
|
||||
}
|
||||
|
||||
// Nodes are either an account ID or a offer prefix. Offer prefixs denote a
|
||||
@@ -376,38 +374,38 @@ STPathElement::isNone() const
|
||||
inline AccountID const&
|
||||
STPathElement::getAccountID() const
|
||||
{
|
||||
return mAccountID;
|
||||
return accountID_;
|
||||
}
|
||||
|
||||
inline PathAsset const&
|
||||
STPathElement::getPathAsset() const
|
||||
{
|
||||
return mAssetID;
|
||||
return assetID_;
|
||||
}
|
||||
|
||||
inline Currency const&
|
||||
STPathElement::getCurrency() const
|
||||
{
|
||||
return mAssetID.get<Currency>();
|
||||
return assetID_.get<Currency>();
|
||||
}
|
||||
|
||||
inline MPTID const&
|
||||
STPathElement::getMPTID() const
|
||||
{
|
||||
return mAssetID.get<MPTID>();
|
||||
return assetID_.get<MPTID>();
|
||||
}
|
||||
|
||||
inline AccountID const&
|
||||
STPathElement::getIssuerID() const
|
||||
{
|
||||
return mIssuerID;
|
||||
return issuerID_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPathElement::operator==(STPathElement const& t) const
|
||||
{
|
||||
return (mType & typeAccount) == (t.mType & typeAccount) && hash_value_ == t.hash_value_ &&
|
||||
mAccountID == t.mAccountID && mAssetID == t.mAssetID && mIssuerID == t.mIssuerID;
|
||||
return (type_ & TypeAccount) == (t.type_ & TypeAccount) && hash_value_ == t.hash_value_ &&
|
||||
accountID_ == t.accountID_ && assetID_ == t.assetID_ && issuerID_ == t.issuerID_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
@@ -418,81 +416,81 @@ STPathElement::operator!=(STPathElement const& t) const
|
||||
|
||||
// ------------ STPath ------------
|
||||
|
||||
inline STPath::STPath(std::vector<STPathElement> p) : mPath(std::move(p))
|
||||
inline STPath::STPath(std::vector<STPathElement> p) : path_(std::move(p))
|
||||
{
|
||||
}
|
||||
|
||||
inline std::vector<STPathElement>::size_type
|
||||
STPath::size() const
|
||||
{
|
||||
return mPath.size();
|
||||
return path_.size();
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPath::empty() const
|
||||
{
|
||||
return mPath.empty();
|
||||
return path_.empty();
|
||||
}
|
||||
|
||||
inline void
|
||||
STPath::push_back(STPathElement const& e)
|
||||
STPath::pushBack(STPathElement const& e)
|
||||
{
|
||||
mPath.push_back(e);
|
||||
path_.push_back(e);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void
|
||||
STPath::emplace_back(Args&&... args)
|
||||
STPath::emplaceBack(Args&&... args)
|
||||
{
|
||||
mPath.emplace_back(std::forward<Args>(args)...);
|
||||
path_.emplace_back(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
inline std::vector<STPathElement>::const_iterator
|
||||
STPath::begin() const
|
||||
{
|
||||
return mPath.begin();
|
||||
return path_.begin();
|
||||
}
|
||||
|
||||
inline std::vector<STPathElement>::const_iterator
|
||||
STPath::end() const
|
||||
{
|
||||
return mPath.end();
|
||||
return path_.end();
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPath::operator==(STPath const& t) const
|
||||
{
|
||||
return mPath == t.mPath;
|
||||
return path_ == t.path_;
|
||||
}
|
||||
|
||||
inline std::vector<STPathElement>::const_reference
|
||||
STPath::back() const
|
||||
{
|
||||
return mPath.back();
|
||||
return path_.back();
|
||||
}
|
||||
|
||||
inline std::vector<STPathElement>::const_reference
|
||||
STPath::front() const
|
||||
{
|
||||
return mPath.front();
|
||||
return path_.front();
|
||||
}
|
||||
|
||||
inline STPathElement&
|
||||
STPath::operator[](int i)
|
||||
{
|
||||
return mPath[i];
|
||||
return path_[i];
|
||||
}
|
||||
|
||||
inline STPathElement const&
|
||||
STPath::operator[](int i) const
|
||||
{
|
||||
return mPath[i];
|
||||
return path_[i];
|
||||
}
|
||||
|
||||
inline void
|
||||
STPath::reserve(size_t s)
|
||||
{
|
||||
mPath.reserve(s);
|
||||
path_.reserve(s);
|
||||
}
|
||||
|
||||
// ------------ STPathSet ------------
|
||||
@@ -505,50 +503,50 @@ inline STPathSet::STPathSet(SField const& n) : STBase(n)
|
||||
inline std::vector<STPath>::const_reference
|
||||
STPathSet::operator[](std::vector<STPath>::size_type n) const
|
||||
{
|
||||
return value[n];
|
||||
return value_[n];
|
||||
}
|
||||
|
||||
inline std::vector<STPath>::reference
|
||||
STPathSet::operator[](std::vector<STPath>::size_type n)
|
||||
{
|
||||
return value[n];
|
||||
return value_[n];
|
||||
}
|
||||
|
||||
inline std::vector<STPath>::const_iterator
|
||||
STPathSet::begin() const
|
||||
{
|
||||
return value.begin();
|
||||
return value_.begin();
|
||||
}
|
||||
|
||||
inline std::vector<STPath>::const_iterator
|
||||
STPathSet::end() const
|
||||
{
|
||||
return value.end();
|
||||
return value_.end();
|
||||
}
|
||||
|
||||
inline std::vector<STPath>::size_type
|
||||
STPathSet::size() const
|
||||
{
|
||||
return value.size();
|
||||
return value_.size();
|
||||
}
|
||||
|
||||
inline bool
|
||||
STPathSet::empty() const
|
||||
{
|
||||
return value.empty();
|
||||
return value_.empty();
|
||||
}
|
||||
|
||||
inline void
|
||||
STPathSet::push_back(STPath const& e)
|
||||
STPathSet::pushBack(STPath const& e)
|
||||
{
|
||||
value.push_back(e);
|
||||
value_.push_back(e);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void
|
||||
STPathSet::emplace_back(Args&&... args)
|
||||
STPathSet::emplaceBack(Args&&... args)
|
||||
{
|
||||
value.emplace_back(std::forward<Args>(args)...);
|
||||
value_.emplace_back(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
namespace xrpl {
|
||||
|
||||
enum class TxnSql : char {
|
||||
txnSqlNew = 'N',
|
||||
txnSqlConflict = 'C',
|
||||
txnSqlHeld = 'H',
|
||||
txnSqlValidated = 'V',
|
||||
txnSqlIncluded = 'I',
|
||||
txnSqlUnknown = 'U'
|
||||
New = 'N',
|
||||
Conflict = 'C',
|
||||
Held = 'H',
|
||||
Validated = 'V',
|
||||
Included = 'I',
|
||||
Unknown = 'U'
|
||||
};
|
||||
|
||||
class STTx final : public STObject, public CountedObject<STTx>
|
||||
@@ -30,8 +30,8 @@ class STTx final : public STObject, public CountedObject<STTx>
|
||||
TxType tx_type_;
|
||||
|
||||
public:
|
||||
static constexpr std::size_t minMultiSigners = 1;
|
||||
static constexpr std::size_t maxMultiSigners = 32;
|
||||
static constexpr std::size_t kMIN_MULTI_SIGNERS = 1;
|
||||
static constexpr std::size_t kMAX_MULTI_SIGNERS = 32;
|
||||
|
||||
STTx() = delete;
|
||||
STTx(STTx const& other) = default;
|
||||
@@ -92,10 +92,10 @@ public:
|
||||
uint256
|
||||
getTransactionID() const;
|
||||
|
||||
Json::Value
|
||||
json::Value
|
||||
getJson(JsonOptions options) const override;
|
||||
|
||||
Json::Value
|
||||
json::Value
|
||||
getJson(JsonOptions options, bool binary) const;
|
||||
|
||||
void
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace xrpl {
|
||||
// Validation flags
|
||||
|
||||
// This is a full (as opposed to a partial) validation
|
||||
constexpr std::uint32_t vfFullValidation = 0x00000001;
|
||||
constexpr std::uint32_t kVF_FULL_VALIDATION = 0x00000001;
|
||||
|
||||
// The signature is fully canonical
|
||||
constexpr std::uint32_t vfFullyCanonicalSig = 0x80000000;
|
||||
constexpr std::uint32_t kVF_FULLY_CANONICAL_SIG = 0x80000000;
|
||||
|
||||
class STValidation final : public STObject, public CountedObject<STValidation>
|
||||
{
|
||||
bool mTrusted = false;
|
||||
bool trusted_ = false;
|
||||
|
||||
// Determines the validity of the signature in this validation; unseated
|
||||
// optional if we haven't yet checked it, a boolean otherwise.
|
||||
@@ -151,7 +151,7 @@ STValidation::STValidation(SerialIter& sit, LookupNodeID&& lookupNodeID, bool ch
|
||||
, signingPubKey_([this]() {
|
||||
auto const spk = getFieldVL(sfSigningPubKey);
|
||||
|
||||
if (publicKeyType(makeSlice(spk)) != KeyType::secp256k1)
|
||||
if (publicKeyType(makeSlice(spk)) != KeyType::Secp256k1)
|
||||
Throw<std::runtime_error>("Invalid public key in validation");
|
||||
|
||||
return PublicKey{makeSlice(spk)};
|
||||
@@ -161,7 +161,7 @@ STValidation::STValidation(SerialIter& sit, LookupNodeID&& lookupNodeID, bool ch
|
||||
if (checkSignature && !isValid())
|
||||
{
|
||||
JLOG(debugLog().error()) << "Invalid signature in validation: "
|
||||
<< getJson(JsonOptions::none);
|
||||
<< getJson(JsonOptions::KNone);
|
||||
Throw<std::runtime_error>("Invalid signature in validation");
|
||||
}
|
||||
|
||||
@@ -194,8 +194,8 @@ STValidation::STValidation(
|
||||
"node");
|
||||
|
||||
// First, set our own public key:
|
||||
if (publicKeyType(pk) != KeyType::secp256k1)
|
||||
LogicError("We can only use secp256k1 keys for signing validations");
|
||||
if (publicKeyType(pk) != KeyType::Secp256k1)
|
||||
logicError("We can only use secp256k1 keys for signing validations");
|
||||
|
||||
setFieldVL(sfSigningPubKey, pk.slice());
|
||||
setFieldU32(sfSigningTime, signTime.time_since_epoch().count());
|
||||
@@ -204,15 +204,15 @@ STValidation::STValidation(
|
||||
f(*this);
|
||||
|
||||
// Finally, sign the validation and mark it as trusted:
|
||||
setFlag(vfFullyCanonicalSig);
|
||||
setFlag(kVF_FULLY_CANONICAL_SIG);
|
||||
setFieldVL(sfSignature, signDigest(pk, sk, getSigningHash()));
|
||||
setTrusted();
|
||||
|
||||
// Check to ensure that all required fields are present.
|
||||
for (auto const& e : validationFormat())
|
||||
{
|
||||
if (e.style() == soeREQUIRED && !isFieldPresent(e.sField()))
|
||||
LogicError("Required field '" + e.sField().getName() + "' missing from validation.");
|
||||
if (e.style() == SoeRequired && !isFieldPresent(e.sField()))
|
||||
logicError("Required field '" + e.sField().getName() + "' missing from validation.");
|
||||
}
|
||||
|
||||
// We just signed this, so it should be valid.
|
||||
@@ -234,19 +234,19 @@ STValidation::getNodeID() const noexcept
|
||||
inline bool
|
||||
STValidation::isTrusted() const noexcept
|
||||
{
|
||||
return mTrusted;
|
||||
return trusted_;
|
||||
}
|
||||
|
||||
inline void
|
||||
STValidation::setTrusted()
|
||||
{
|
||||
mTrusted = true;
|
||||
trusted_ = true;
|
||||
}
|
||||
|
||||
inline void
|
||||
STValidation::setUntrusted()
|
||||
{
|
||||
mTrusted = false;
|
||||
trusted_ = false;
|
||||
}
|
||||
|
||||
inline void
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace xrpl {
|
||||
|
||||
class STVector256 : public STBase, public CountedObject<STVector256>
|
||||
{
|
||||
std::vector<uint256> mValue;
|
||||
std::vector<uint256> value_;
|
||||
|
||||
public:
|
||||
using value_type = std::vector<uint256> const&;
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
void
|
||||
add(Serializer& s) const override;
|
||||
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions) const override;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions) const override;
|
||||
|
||||
[[nodiscard]] bool
|
||||
isEquivalent(STBase const& t) const override;
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
insert(std::vector<uint256>::const_iterator pos, uint256 const& value);
|
||||
|
||||
void
|
||||
push_back(uint256 const& v);
|
||||
pushBack(uint256 const& v);
|
||||
|
||||
std::vector<uint256>::iterator
|
||||
begin();
|
||||
@@ -103,124 +103,124 @@ inline STVector256::STVector256(SField const& n) : STBase(n)
|
||||
{
|
||||
}
|
||||
|
||||
inline STVector256::STVector256(std::vector<uint256> const& vector) : mValue(vector)
|
||||
inline STVector256::STVector256(std::vector<uint256> const& vector) : value_(vector)
|
||||
{
|
||||
}
|
||||
|
||||
inline STVector256::STVector256(SField const& n, std::vector<uint256> const& vector)
|
||||
: STBase(n), mValue(vector)
|
||||
: STBase(n), value_(vector)
|
||||
{
|
||||
}
|
||||
|
||||
inline STVector256&
|
||||
STVector256::operator=(std::vector<uint256> const& v)
|
||||
{
|
||||
mValue = v;
|
||||
value_ = v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline STVector256&
|
||||
STVector256::operator=(std::vector<uint256>&& v)
|
||||
{
|
||||
mValue = std::move(v);
|
||||
value_ = std::move(v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void
|
||||
STVector256::setValue(STVector256 const& v)
|
||||
{
|
||||
mValue = v.mValue;
|
||||
value_ = v.value_;
|
||||
}
|
||||
|
||||
/** Retrieve a copy of the vector we contain */
|
||||
inline STVector256::
|
||||
operator std::vector<uint256>() const
|
||||
{
|
||||
return mValue;
|
||||
return value_;
|
||||
}
|
||||
|
||||
inline std::size_t
|
||||
STVector256::size() const
|
||||
{
|
||||
return mValue.size();
|
||||
return value_.size();
|
||||
}
|
||||
|
||||
inline void
|
||||
STVector256::resize(std::size_t n)
|
||||
{
|
||||
mValue.resize(n);
|
||||
value_.resize(n);
|
||||
}
|
||||
|
||||
inline bool
|
||||
STVector256::empty() const
|
||||
{
|
||||
return mValue.empty();
|
||||
return value_.empty();
|
||||
}
|
||||
|
||||
inline std::vector<uint256>::reference
|
||||
STVector256::operator[](std::vector<uint256>::size_type n)
|
||||
{
|
||||
return mValue[n];
|
||||
return value_[n];
|
||||
}
|
||||
|
||||
inline std::vector<uint256>::const_reference
|
||||
STVector256::operator[](std::vector<uint256>::size_type n) const
|
||||
{
|
||||
return mValue[n];
|
||||
return value_[n];
|
||||
}
|
||||
|
||||
inline std::vector<uint256> const&
|
||||
STVector256::value() const
|
||||
{
|
||||
return mValue;
|
||||
return value_;
|
||||
}
|
||||
|
||||
inline std::vector<uint256>::iterator
|
||||
STVector256::insert(std::vector<uint256>::const_iterator pos, uint256 const& value)
|
||||
{
|
||||
return mValue.insert(pos, value);
|
||||
return value_.insert(pos, value);
|
||||
}
|
||||
|
||||
inline void
|
||||
STVector256::push_back(uint256 const& v)
|
||||
STVector256::pushBack(uint256 const& v)
|
||||
{
|
||||
mValue.push_back(v);
|
||||
value_.push_back(v);
|
||||
}
|
||||
|
||||
inline std::vector<uint256>::iterator
|
||||
STVector256::begin()
|
||||
{
|
||||
return mValue.begin();
|
||||
return value_.begin();
|
||||
}
|
||||
|
||||
inline std::vector<uint256>::const_iterator
|
||||
STVector256::begin() const
|
||||
{
|
||||
return mValue.begin();
|
||||
return value_.begin();
|
||||
}
|
||||
|
||||
inline std::vector<uint256>::iterator
|
||||
STVector256::end()
|
||||
{
|
||||
return mValue.end();
|
||||
return value_.end();
|
||||
}
|
||||
|
||||
inline std::vector<uint256>::const_iterator
|
||||
STVector256::end() const
|
||||
{
|
||||
return mValue.end();
|
||||
return value_.end();
|
||||
}
|
||||
|
||||
inline std::vector<uint256>::iterator
|
||||
STVector256::erase(std::vector<uint256>::iterator position)
|
||||
{
|
||||
return mValue.erase(position);
|
||||
return value_.erase(position);
|
||||
}
|
||||
|
||||
inline void
|
||||
STVector256::clear() noexcept
|
||||
{
|
||||
mValue.clear();
|
||||
value_.clear();
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -20,7 +20,7 @@ class STXChainBridge final : public STBase, public CountedObject<STXChainBridge>
|
||||
public:
|
||||
using value_type = STXChainBridge;
|
||||
|
||||
enum class ChainType { locking, issuing };
|
||||
enum class ChainType { Locking, Issuing };
|
||||
|
||||
static ChainType
|
||||
otherChain(ChainType ct);
|
||||
@@ -45,9 +45,9 @@ public:
|
||||
AccountID const& dstChainDoor,
|
||||
Issue const& dstChainIssue);
|
||||
|
||||
explicit STXChainBridge(Json::Value const& v);
|
||||
explicit STXChainBridge(json::Value const& v);
|
||||
|
||||
explicit STXChainBridge(SField const& name, Json::Value const& v);
|
||||
explicit STXChainBridge(SField const& name, json::Value const& v);
|
||||
|
||||
explicit STXChainBridge(SerialIter& sit, SField const& name);
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
[[nodiscard]] SerializedTypeID
|
||||
getSType() const override;
|
||||
|
||||
[[nodiscard]] Json::Value getJson(JsonOptions) const override;
|
||||
[[nodiscard]] json::Value getJson(JsonOptions) const override;
|
||||
|
||||
void
|
||||
add(Serializer& s) const override;
|
||||
@@ -174,7 +174,7 @@ STXChainBridge::value() const noexcept
|
||||
inline AccountID const&
|
||||
STXChainBridge::door(ChainType ct) const
|
||||
{
|
||||
if (ct == ChainType::locking)
|
||||
if (ct == ChainType::Locking)
|
||||
return lockingChainDoor();
|
||||
return issuingChainDoor();
|
||||
}
|
||||
@@ -182,7 +182,7 @@ STXChainBridge::door(ChainType ct) const
|
||||
inline Issue const&
|
||||
STXChainBridge::issue(ChainType ct) const
|
||||
{
|
||||
if (ct == ChainType::locking)
|
||||
if (ct == ChainType::Locking)
|
||||
return lockingChainIssue();
|
||||
return issuingChainIssue();
|
||||
}
|
||||
@@ -190,25 +190,25 @@ STXChainBridge::issue(ChainType ct) const
|
||||
inline STXChainBridge::ChainType
|
||||
STXChainBridge::otherChain(ChainType ct)
|
||||
{
|
||||
if (ct == ChainType::locking)
|
||||
return ChainType::issuing;
|
||||
return ChainType::locking;
|
||||
if (ct == ChainType::Locking)
|
||||
return ChainType::Issuing;
|
||||
return ChainType::Locking;
|
||||
}
|
||||
|
||||
inline STXChainBridge::ChainType
|
||||
STXChainBridge::srcChain(bool wasLockingChainSend)
|
||||
{
|
||||
if (wasLockingChainSend)
|
||||
return ChainType::locking;
|
||||
return ChainType::issuing;
|
||||
return ChainType::Locking;
|
||||
return ChainType::Issuing;
|
||||
}
|
||||
|
||||
inline STXChainBridge::ChainType
|
||||
STXChainBridge::dstChain(bool wasLockingChainSend)
|
||||
{
|
||||
if (wasLockingChainSend)
|
||||
return ChainType::issuing;
|
||||
return ChainType::locking;
|
||||
return ChainType::Issuing;
|
||||
return ChainType::Locking;
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace xrpl {
|
||||
class SecretKey
|
||||
{
|
||||
public:
|
||||
static constexpr std::size_t size_ = 32;
|
||||
static constexpr std::size_t kSIZE = 32;
|
||||
|
||||
private:
|
||||
std::uint8_t buf_[size_]{};
|
||||
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, size_> const& data);
|
||||
SecretKey(std::array<std::uint8_t, kSIZE> const& data);
|
||||
SecretKey(Slice const& slice);
|
||||
|
||||
[[nodiscard]] std::uint8_t const*
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
to avoid accidental exposure of secret key material.
|
||||
*/
|
||||
[[nodiscard]] std::string
|
||||
to_string() const;
|
||||
toString() const;
|
||||
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const noexcept
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace xrpl {
|
||||
class SeqProxy
|
||||
{
|
||||
public:
|
||||
enum class Type : std::uint8_t { seq = 0, ticket };
|
||||
enum class Type : std::uint8_t { Seq = 0, Ticket };
|
||||
|
||||
private:
|
||||
std::uint32_t value_;
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
static constexpr SeqProxy
|
||||
sequence(std::uint32_t v)
|
||||
{
|
||||
return SeqProxy{Type::seq, v};
|
||||
return SeqProxy{Type::Seq, v};
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr std::uint32_t
|
||||
@@ -67,13 +67,13 @@ public:
|
||||
[[nodiscard]] constexpr bool
|
||||
isSeq() const
|
||||
{
|
||||
return type_ == Type::seq;
|
||||
return type_ == Type::Seq;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool
|
||||
isTicket() const
|
||||
{
|
||||
return type_ == Type::ticket;
|
||||
return type_ == Type::Ticket;
|
||||
}
|
||||
|
||||
// Occasionally it is convenient to be able to increase the value_
|
||||
|
||||
@@ -21,41 +21,41 @@ class Serializer
|
||||
{
|
||||
private:
|
||||
// DEPRECATED
|
||||
Blob mData;
|
||||
Blob data_;
|
||||
|
||||
public:
|
||||
explicit Serializer(int n = 256)
|
||||
{
|
||||
mData.reserve(n);
|
||||
data_.reserve(n);
|
||||
}
|
||||
|
||||
Serializer(void const* data, std::size_t size)
|
||||
{
|
||||
mData.resize(size);
|
||||
data_.resize(size);
|
||||
|
||||
if (size != 0u)
|
||||
{
|
||||
XRPL_ASSERT(data, "xrpl::Serializer::Serializer(void const*) : non-null input");
|
||||
std::memcpy(mData.data(), data, size);
|
||||
std::memcpy(data_.data(), data, size);
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] Slice
|
||||
slice() const noexcept
|
||||
{
|
||||
return Slice(mData.data(), mData.size());
|
||||
return Slice(data_.data(), data_.size());
|
||||
}
|
||||
|
||||
[[nodiscard]] std::size_t
|
||||
size() const noexcept
|
||||
{
|
||||
return mData.size();
|
||||
return data_.size();
|
||||
}
|
||||
|
||||
[[nodiscard]] void const*
|
||||
data() const noexcept
|
||||
{
|
||||
return mData.data();
|
||||
return data_.data();
|
||||
}
|
||||
|
||||
// assemble functions
|
||||
@@ -69,11 +69,11 @@ public:
|
||||
int
|
||||
add32(T i)
|
||||
{
|
||||
int const ret = mData.size();
|
||||
mData.push_back(static_cast<unsigned char>((i >> 24) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>((i >> 16) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>((i >> 8) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>(i & 0xff));
|
||||
int const ret = data_.size();
|
||||
data_.push_back(static_cast<unsigned char>((i >> 24) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>((i >> 16) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>((i >> 8) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>(i & 0xff));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -85,15 +85,15 @@ public:
|
||||
int
|
||||
add64(T i)
|
||||
{
|
||||
int const ret = mData.size();
|
||||
mData.push_back(static_cast<unsigned char>((i >> 56) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>((i >> 48) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>((i >> 40) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>((i >> 32) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>((i >> 24) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>((i >> 16) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>((i >> 8) & 0xff));
|
||||
mData.push_back(static_cast<unsigned char>(i & 0xff));
|
||||
int const ret = data_.size();
|
||||
data_.push_back(static_cast<unsigned char>((i >> 56) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>((i >> 48) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>((i >> 40) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>((i >> 32) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>((i >> 24) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>((i >> 16) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>((i >> 8) & 0xff));
|
||||
data_.push_back(static_cast<unsigned char>(i & 0xff));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
int
|
||||
addBitString(base_uint<Bits, Tag> const& v)
|
||||
addBitString(BaseUint<Bits, Tag> const& v)
|
||||
{
|
||||
return addRaw(v.data(), v.size());
|
||||
}
|
||||
@@ -134,13 +134,13 @@ public:
|
||||
bool
|
||||
getInteger(Integer& number, int offset)
|
||||
{
|
||||
static auto const bytes = sizeof(Integer);
|
||||
if ((offset + bytes) > mData.size())
|
||||
static auto const kBYTES = sizeof(Integer);
|
||||
if ((offset + kBYTES) > data_.size())
|
||||
return false;
|
||||
number = 0;
|
||||
|
||||
auto ptr = &mData[offset];
|
||||
for (auto i = 0; i < bytes; ++i)
|
||||
auto ptr = &data_[offset];
|
||||
for (auto i = 0; i < kBYTES; ++i)
|
||||
{
|
||||
if (i)
|
||||
number <<= 8;
|
||||
@@ -151,11 +151,11 @@ public:
|
||||
|
||||
template <std::size_t Bits, typename Tag = void>
|
||||
bool
|
||||
getBitString(base_uint<Bits, Tag>& data, int offset) const
|
||||
getBitString(BaseUint<Bits, Tag>& data, int offset) const
|
||||
{
|
||||
auto success = (offset + (Bits / 8)) <= mData.size();
|
||||
auto success = (offset + (Bits / 8)) <= data_.size();
|
||||
if (success)
|
||||
memcpy(data.begin(), &(mData.front()) + offset, (Bits / 8));
|
||||
memcpy(data.begin(), &(data_.front()) + offset, (Bits / 8));
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
int
|
||||
addFieldID(SerializedTypeID type, int name)
|
||||
{
|
||||
return addFieldID(safe_cast<int>(type), name);
|
||||
return addFieldID(safeCast<int>(type), name);
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
@@ -175,38 +175,38 @@ public:
|
||||
[[nodiscard]] Blob const&
|
||||
peekData() const
|
||||
{
|
||||
return mData;
|
||||
return data_;
|
||||
}
|
||||
[[nodiscard]] Blob
|
||||
getData() const
|
||||
{
|
||||
return mData;
|
||||
return data_;
|
||||
}
|
||||
Blob&
|
||||
modData()
|
||||
{
|
||||
return mData;
|
||||
return data_;
|
||||
}
|
||||
|
||||
[[nodiscard]] int
|
||||
getDataLength() const
|
||||
{
|
||||
return mData.size();
|
||||
return data_.size();
|
||||
}
|
||||
[[nodiscard]] void const*
|
||||
getDataPtr() const
|
||||
{
|
||||
return mData.data();
|
||||
return data_.data();
|
||||
}
|
||||
void*
|
||||
getDataPtr()
|
||||
{
|
||||
return mData.data();
|
||||
return data_.data();
|
||||
}
|
||||
[[nodiscard]] int
|
||||
getLength() const
|
||||
{
|
||||
return mData.size();
|
||||
return data_.size();
|
||||
}
|
||||
[[nodiscard]] std::string
|
||||
getString() const
|
||||
@@ -216,7 +216,7 @@ public:
|
||||
void
|
||||
erase()
|
||||
{
|
||||
mData.clear();
|
||||
data_.clear();
|
||||
}
|
||||
bool
|
||||
chop(int num);
|
||||
@@ -225,58 +225,58 @@ public:
|
||||
Blob ::iterator
|
||||
begin()
|
||||
{
|
||||
return mData.begin();
|
||||
return data_.begin();
|
||||
}
|
||||
Blob ::iterator
|
||||
end()
|
||||
{
|
||||
return mData.end();
|
||||
return data_.end();
|
||||
}
|
||||
[[nodiscard]] Blob ::const_iterator
|
||||
begin() const
|
||||
{
|
||||
return mData.begin();
|
||||
return data_.begin();
|
||||
}
|
||||
[[nodiscard]] Blob ::const_iterator
|
||||
end() const
|
||||
{
|
||||
return mData.end();
|
||||
return data_.end();
|
||||
}
|
||||
void
|
||||
reserve(size_t n)
|
||||
{
|
||||
mData.reserve(n);
|
||||
data_.reserve(n);
|
||||
}
|
||||
void
|
||||
resize(size_t n)
|
||||
{
|
||||
mData.resize(n);
|
||||
data_.resize(n);
|
||||
}
|
||||
[[nodiscard]] size_t
|
||||
capacity() const
|
||||
{
|
||||
return mData.capacity();
|
||||
return data_.capacity();
|
||||
}
|
||||
|
||||
bool
|
||||
operator==(Blob const& v) const
|
||||
{
|
||||
return v == mData;
|
||||
return v == data_;
|
||||
}
|
||||
bool
|
||||
operator!=(Blob const& v) const
|
||||
{
|
||||
return v != mData;
|
||||
return v != data_;
|
||||
}
|
||||
bool
|
||||
operator==(Serializer const& v) const
|
||||
{
|
||||
return v.mData == mData;
|
||||
return v.data_ == data_;
|
||||
}
|
||||
bool
|
||||
operator!=(Serializer const& v) const
|
||||
{
|
||||
return v.mData != mData;
|
||||
return v.data_ != data_;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -369,7 +369,7 @@ public:
|
||||
geti64();
|
||||
|
||||
template <std::size_t Bits, class Tag = void>
|
||||
base_uint<Bits, Tag>
|
||||
BaseUint<Bits, Tag>
|
||||
getBitString();
|
||||
|
||||
uint128
|
||||
@@ -428,7 +428,7 @@ public:
|
||||
};
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
base_uint<Bits, Tag>
|
||||
BaseUint<Bits, Tag>
|
||||
SerialIter::getBitString()
|
||||
{
|
||||
auto const n = Bits / 8;
|
||||
@@ -442,7 +442,7 @@ SerialIter::getBitString()
|
||||
used_ += n;
|
||||
remain_ -= n;
|
||||
|
||||
return base_uint<Bits, Tag>::fromVoid(x);
|
||||
return BaseUint<Bits, Tag>::fromVoid(x);
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -14,22 +14,22 @@ namespace xrpl {
|
||||
static inline std::string const&
|
||||
systemName()
|
||||
{
|
||||
static std::string const name = "xrpld";
|
||||
return name;
|
||||
static std::string const kNAME = "xrpld";
|
||||
return kNAME;
|
||||
}
|
||||
|
||||
/** Configure the native currency. */
|
||||
|
||||
/** Number of drops in the genesis account. */
|
||||
constexpr XRPAmount INITIAL_XRP{100'000'000'000 * DROPS_PER_XRP};
|
||||
static_assert(INITIAL_XRP.drops() == 100'000'000'000'000'000);
|
||||
static_assert(Number::maxRep >= INITIAL_XRP.drops());
|
||||
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());
|
||||
|
||||
/** Returns true if the amount does not exceed the initial XRP in existence. */
|
||||
inline bool
|
||||
isLegalAmount(XRPAmount const& amount)
|
||||
{
|
||||
return amount <= INITIAL_XRP;
|
||||
return amount <= kINITIAL_XRP;
|
||||
}
|
||||
|
||||
/** 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 >= -INITIAL_XRP && amount <= INITIAL_XRP;
|
||||
return amount >= -kINITIAL_XRP && amount <= kINITIAL_XRP;
|
||||
}
|
||||
|
||||
/* The currency code for the native currency. */
|
||||
static inline std::string const&
|
||||
systemCurrencyCode()
|
||||
{
|
||||
static std::string const code = "XRP";
|
||||
return code;
|
||||
static std::string const kCODE = "XRP";
|
||||
return kCODE;
|
||||
}
|
||||
|
||||
/** The XRP ledger network's earliest allowed sequence */
|
||||
static constexpr std::uint32_t XRP_LEDGER_EARLIEST_SEQ{32570u};
|
||||
static constexpr std::uint32_t kXRP_LEDGER_EARLIEST_SEQ{32570u};
|
||||
|
||||
/** The XRP Ledger mainnet's earliest ledger with a FeeSettings object. Only
|
||||
* used in asserts and tests. */
|
||||
static constexpr std::uint32_t XRP_LEDGER_EARLIEST_FEES{562177u};
|
||||
static constexpr std::uint32_t kXRP_LEDGER_EARLIEST_FEES{562177u};
|
||||
|
||||
/** The minimum amount of support an amendment should have. */
|
||||
constexpr std::ratio<80, 100> amendmentMajorityCalcThreshold;
|
||||
constexpr std::ratio<80, 100> kAMENDMENT_MAJORITY_CALC_THRESHOLD;
|
||||
|
||||
/** The minimum amount of time an amendment must hold a majority */
|
||||
constexpr std::chrono::seconds const defaultAmendmentMajorityTime = weeks{2};
|
||||
constexpr std::chrono::seconds const kDEFAULT_AMENDMENT_MAJORITY_TIME = weeks{2};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
/** Default peer port (IANA registered) */
|
||||
inline std::uint16_t constexpr DEFAULT_PEER_PORT{2459};
|
||||
inline std::uint16_t constexpr kDEFAULT_PEER_PORT{2459};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
|
||||
#include <xrpl/basics/safe_cast.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
@@ -364,37 +366,37 @@ enum TECcodes : TERUnderlyingType {
|
||||
constexpr TERUnderlyingType
|
||||
TERtoInt(TELcodes v)
|
||||
{
|
||||
return safe_cast<TERUnderlyingType>(v);
|
||||
return safeCast<TERUnderlyingType>(v);
|
||||
}
|
||||
|
||||
constexpr TERUnderlyingType
|
||||
TERtoInt(TEMcodes v)
|
||||
{
|
||||
return safe_cast<TERUnderlyingType>(v);
|
||||
return safeCast<TERUnderlyingType>(v);
|
||||
}
|
||||
|
||||
constexpr TERUnderlyingType
|
||||
TERtoInt(TEFcodes v)
|
||||
{
|
||||
return safe_cast<TERUnderlyingType>(v);
|
||||
return safeCast<TERUnderlyingType>(v);
|
||||
}
|
||||
|
||||
constexpr TERUnderlyingType
|
||||
TERtoInt(TERcodes v)
|
||||
{
|
||||
return safe_cast<TERUnderlyingType>(v);
|
||||
return safeCast<TERUnderlyingType>(v);
|
||||
}
|
||||
|
||||
constexpr TERUnderlyingType
|
||||
TERtoInt(TEScodes v)
|
||||
{
|
||||
return safe_cast<TERUnderlyingType>(v);
|
||||
return safeCast<TERUnderlyingType>(v);
|
||||
}
|
||||
|
||||
constexpr TERUnderlyingType
|
||||
TERtoInt(TECcodes v)
|
||||
{
|
||||
return safe_cast<TERUnderlyingType>(v);
|
||||
return safeCast<TERUnderlyingType>(v);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -455,11 +457,11 @@ public:
|
||||
return code_ != tesSUCCESS;
|
||||
}
|
||||
|
||||
// Conversion to Json::Value allows assignment to Json::Objects
|
||||
// Conversion to json::Value allows assignment to json::Objects
|
||||
// without casting.
|
||||
operator Json::Value() const
|
||||
operator json::Value() const
|
||||
{
|
||||
return Json::Value{code_};
|
||||
return json::Value{code_};
|
||||
}
|
||||
|
||||
// Streaming operator.
|
||||
@@ -680,3 +682,5 @@ std::optional<TER>
|
||||
transCode(std::string const& token);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
|
||||
#include <cstdint>
|
||||
@@ -444,3 +446,5 @@ getAsfFlagMap()
|
||||
#pragma pop_macro("ACCOUNTSET_FLAGS")
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
|
||||
@@ -51,16 +51,16 @@ enum TxType : std::uint16_t
|
||||
#pragma pop_macro("TRANSACTION")
|
||||
|
||||
/** This transaction type is deprecated; it is retained for historical purposes. */
|
||||
ttNICKNAME_SET [[deprecated("This transaction type is not supported and should not be used.")]] = 6,
|
||||
TtNicknameSet [[deprecated("This transaction type is not supported and should not be used.")]] = 6,
|
||||
|
||||
/** This transaction type is deprecated; it is retained for historical purposes. */
|
||||
ttCONTRACT [[deprecated("This transaction type is not supported and should not be used.")]] = 9,
|
||||
TtContract [[deprecated("This transaction type is not supported and should not be used.")]] = 9,
|
||||
|
||||
/** This identifier was never used, but the slot is reserved for historical purposes. */
|
||||
ttSPINAL_TAP [[deprecated("This transaction type is not supported and should not be used.")]] = 11,
|
||||
TtSpinalTap [[deprecated("This transaction type is not supported and should not be used.")]] = 11,
|
||||
|
||||
/** This transaction type installs a hook. */
|
||||
ttHOOK_SET [[maybe_unused]] = 22,
|
||||
TtHookSet [[maybe_unused]] = 22,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
[[nodiscard]] boost::container::flat_set<AccountID>
|
||||
getAffectedAccounts() const;
|
||||
|
||||
[[nodiscard]] Json::Value
|
||||
[[nodiscard]] json::Value
|
||||
getJson(JsonOptions p) const
|
||||
{
|
||||
return getAsObject().getJson(p);
|
||||
|
||||
@@ -30,21 +30,21 @@ public:
|
||||
|
||||
/** Directory is an index into the directory of offer books.
|
||||
The last 64 bits of this are the quality. */
|
||||
using Directory = base_uint<256, detail::DirectoryTag>;
|
||||
using Directory = BaseUint<256, detail::DirectoryTag>;
|
||||
|
||||
/** Currency is a hash representing a specific currency. */
|
||||
using Currency = base_uint<160, detail::CurrencyTag>;
|
||||
using Currency = BaseUint<160, detail::CurrencyTag>;
|
||||
|
||||
/** NodeID is a 160-bit hash representing one node. */
|
||||
using NodeID = base_uint<160, detail::NodeIDTag>;
|
||||
using NodeID = BaseUint<160, detail::NodeIDTag>;
|
||||
|
||||
/** MPTID is a 192-bit value representing MPT Issuance ID,
|
||||
* which is a concatenation of a 32-bit sequence (big endian)
|
||||
* and a 160-bit account */
|
||||
using MPTID = base_uint<192>;
|
||||
using MPTID = BaseUint<192>;
|
||||
|
||||
/** Domain is a 256-bit hash representing a specific domain. */
|
||||
using Domain = base_uint<256>;
|
||||
using Domain = BaseUint<256>;
|
||||
|
||||
/** XRP currency. */
|
||||
Currency const&
|
||||
@@ -62,7 +62,7 @@ badCurrency();
|
||||
inline bool
|
||||
isXRP(Currency const& c)
|
||||
{
|
||||
return c == beast::zero;
|
||||
return c == beast::kZERO;
|
||||
}
|
||||
|
||||
/** Returns "", "XRP", or three letter ISO code. */
|
||||
@@ -77,7 +77,7 @@ to_string(Currency const& c);
|
||||
to rewrite some unit test code.
|
||||
*/
|
||||
bool
|
||||
to_currency(Currency&, std::string const&);
|
||||
toCurrency(Currency&, std::string const&);
|
||||
|
||||
/** Tries to convert a string to a Currency, returns noCurrency() on failure.
|
||||
|
||||
@@ -86,7 +86,7 @@ to_currency(Currency&, std::string const&);
|
||||
everywhere and may mean having to rewrite some unit test code.
|
||||
*/
|
||||
Currency
|
||||
to_currency(std::string const&);
|
||||
toCurrency(std::string const&);
|
||||
|
||||
inline std::ostream&
|
||||
operator<<(std::ostream& os, Currency const& x)
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
template <Compatible<ValueUnit> Other>
|
||||
constexpr ValueUnit(ValueUnit<unit_type, Other> const& value)
|
||||
requires SafeToCast<Other, value_type>
|
||||
: ValueUnit(safe_cast<value_type>(value.value()))
|
||||
: ValueUnit(safeCast<value_type>(value.value()))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <Integral transparent = value_type>
|
||||
template <Integral Transparent = value_type>
|
||||
ValueUnit&
|
||||
operator%=(value_type const& rhs)
|
||||
{
|
||||
@@ -291,22 +291,22 @@ public:
|
||||
// known valid type tags can be converted to JSON. At the time
|
||||
// of implementation, that includes all known tags, but more may
|
||||
// be added in the future.
|
||||
[[nodiscard]] Json::Value
|
||||
[[nodiscard]] json::Value
|
||||
jsonClipped() const
|
||||
requires Usable<ValueUnit>
|
||||
{
|
||||
if constexpr (std::is_integral_v<value_type>)
|
||||
{
|
||||
using jsontype =
|
||||
std::conditional_t<std::is_signed_v<value_type>, Json::Int, Json::UInt>;
|
||||
std::conditional_t<std::is_signed_v<value_type>, json::Int, json::UInt>;
|
||||
|
||||
constexpr auto min = std::numeric_limits<jsontype>::min();
|
||||
constexpr auto max = std::numeric_limits<jsontype>::max();
|
||||
constexpr auto kMIN = std::numeric_limits<jsontype>::min();
|
||||
constexpr auto kMAX = std::numeric_limits<jsontype>::max();
|
||||
|
||||
if (value_ < min)
|
||||
return min;
|
||||
if (value_ > max)
|
||||
return max;
|
||||
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 max = 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() > max)
|
||||
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 > max)
|
||||
if (quotient > kMAX)
|
||||
return std::nullopt;
|
||||
|
||||
return Dest{static_cast<desttype>(quotient)};
|
||||
@@ -494,34 +494,34 @@ mulDiv(std::uint64_t value, Source1 mul, Source2 div)
|
||||
|
||||
template <unit::IntegralValue Dest, unit::CastableValue<Dest> Src>
|
||||
constexpr Dest
|
||||
safe_cast(Src s) noexcept
|
||||
safeCast(Src s) noexcept
|
||||
{
|
||||
// Dest may not have an explicit value constructor
|
||||
return Dest{safe_cast<typename Dest::value_type>(s.value())};
|
||||
return Dest{safeCast<typename Dest::value_type>(s.value())};
|
||||
}
|
||||
|
||||
template <unit::IntegralValue Dest, unit::Integral Src>
|
||||
constexpr Dest
|
||||
safe_cast(Src s) noexcept
|
||||
safeCast(Src s) noexcept
|
||||
{
|
||||
// Dest may not have an explicit value constructor
|
||||
return Dest{safe_cast<typename Dest::value_type>(s)};
|
||||
return Dest{safeCast<typename Dest::value_type>(s)};
|
||||
}
|
||||
|
||||
template <unit::IntegralValue Dest, unit::CastableValue<Dest> Src>
|
||||
constexpr Dest
|
||||
unsafe_cast(Src s) noexcept
|
||||
unsafeCast(Src s) noexcept
|
||||
{
|
||||
// Dest may not have an explicit value constructor
|
||||
return Dest{unsafe_cast<typename Dest::value_type>(s.value())};
|
||||
return Dest{unsafeCast<typename Dest::value_type>(s.value())};
|
||||
}
|
||||
|
||||
template <unit::IntegralValue Dest, unit::Integral Src>
|
||||
constexpr Dest
|
||||
unsafe_cast(Src s) noexcept
|
||||
unsafeCast(Src s) noexcept
|
||||
{
|
||||
// Dest may not have an explicit value constructor
|
||||
return Dest{unsafe_cast<typename Dest::value_type>(s)};
|
||||
return Dest{unsafeCast<typename Dest::value_type>(s)};
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -42,13 +42,13 @@ struct AttestationBase
|
||||
bool wasLockingChainSend;
|
||||
|
||||
explicit AttestationBase(
|
||||
AccountID attestationSignerAccount_,
|
||||
PublicKey const& publicKey_,
|
||||
Buffer signature_,
|
||||
AccountID const& sendingAccount_,
|
||||
STAmount sendingAmount_,
|
||||
AccountID const& rewardAccount_,
|
||||
bool wasLockingChainSend_);
|
||||
AccountID attestationSignerAccount,
|
||||
PublicKey const& publicKey,
|
||||
Buffer signature,
|
||||
AccountID const& sendingAccount,
|
||||
STAmount sendingAmount,
|
||||
AccountID const& rewardAccount,
|
||||
bool wasLockingChainSend);
|
||||
|
||||
AttestationBase(AttestationBase const&) = default;
|
||||
|
||||
@@ -63,7 +63,7 @@ struct AttestationBase
|
||||
|
||||
protected:
|
||||
explicit AttestationBase(STObject const& o);
|
||||
explicit AttestationBase(Json::Value const& v);
|
||||
explicit AttestationBase(json::Value const& v);
|
||||
|
||||
[[nodiscard]] static bool
|
||||
equalHelper(AttestationBase const& lhs, AttestationBase const& rhs);
|
||||
@@ -86,30 +86,30 @@ struct AttestationClaim : AttestationBase
|
||||
std::optional<AccountID> dst;
|
||||
|
||||
explicit AttestationClaim(
|
||||
AccountID attestationSignerAccount_,
|
||||
PublicKey const& publicKey_,
|
||||
Buffer signature_,
|
||||
AccountID const& sendingAccount_,
|
||||
STAmount const& sendingAmount_,
|
||||
AccountID const& rewardAccount_,
|
||||
bool wasLockingChainSend_,
|
||||
std::uint64_t claimID_,
|
||||
std::optional<AccountID> const& dst_);
|
||||
AccountID attestationSignerAccount,
|
||||
PublicKey const& publicKey,
|
||||
Buffer signature,
|
||||
AccountID const& sendingAccount,
|
||||
STAmount const& sendingAmount,
|
||||
AccountID const& rewardAccount,
|
||||
bool wasLockingChainSend,
|
||||
std::uint64_t claimId,
|
||||
std::optional<AccountID> const& dst);
|
||||
|
||||
explicit AttestationClaim(
|
||||
STXChainBridge const& bridge,
|
||||
AccountID attestationSignerAccount_,
|
||||
PublicKey const& publicKey_,
|
||||
SecretKey const& secretKey_,
|
||||
AccountID const& sendingAccount_,
|
||||
STAmount const& sendingAmount_,
|
||||
AccountID const& rewardAccount_,
|
||||
bool wasLockingChainSend_,
|
||||
std::uint64_t claimID_,
|
||||
std::optional<AccountID> const& dst_);
|
||||
AccountID attestationSignerAccount,
|
||||
PublicKey const& publicKey,
|
||||
SecretKey const& secretKey,
|
||||
AccountID const& sendingAccount,
|
||||
STAmount const& sendingAmount,
|
||||
AccountID const& rewardAccount,
|
||||
bool wasLockingChainSend,
|
||||
std::uint64_t claimId,
|
||||
std::optional<AccountID> const& dst);
|
||||
|
||||
explicit AttestationClaim(STObject const& o);
|
||||
explicit AttestationClaim(Json::Value const& v);
|
||||
explicit AttestationClaim(json::Value const& v);
|
||||
|
||||
[[nodiscard]] STObject
|
||||
toSTObject() const;
|
||||
@@ -162,32 +162,32 @@ struct AttestationCreateAccount : AttestationBase
|
||||
|
||||
explicit AttestationCreateAccount(STObject const& o);
|
||||
|
||||
explicit AttestationCreateAccount(Json::Value const& v);
|
||||
explicit AttestationCreateAccount(json::Value const& v);
|
||||
|
||||
explicit AttestationCreateAccount(
|
||||
AccountID attestationSignerAccount_,
|
||||
PublicKey const& publicKey_,
|
||||
Buffer signature_,
|
||||
AccountID const& sendingAccount_,
|
||||
STAmount const& sendingAmount_,
|
||||
STAmount rewardAmount_,
|
||||
AccountID const& rewardAccount_,
|
||||
bool wasLockingChainSend_,
|
||||
std::uint64_t createCount_,
|
||||
AccountID const& toCreate_);
|
||||
AccountID attestationSignerAccount,
|
||||
PublicKey const& publicKey,
|
||||
Buffer signature,
|
||||
AccountID const& sendingAccount,
|
||||
STAmount const& sendingAmount,
|
||||
STAmount rewardAmount,
|
||||
AccountID const& rewardAccount,
|
||||
bool wasLockingChainSend,
|
||||
std::uint64_t createCount,
|
||||
AccountID const& toCreate);
|
||||
|
||||
explicit AttestationCreateAccount(
|
||||
STXChainBridge const& bridge,
|
||||
AccountID attestationSignerAccount_,
|
||||
PublicKey const& publicKey_,
|
||||
SecretKey const& secretKey_,
|
||||
AccountID const& sendingAccount_,
|
||||
STAmount const& sendingAmount_,
|
||||
STAmount const& rewardAmount_,
|
||||
AccountID const& rewardAccount_,
|
||||
bool wasLockingChainSend_,
|
||||
std::uint64_t createCount_,
|
||||
AccountID const& toCreate_);
|
||||
AccountID attestationSignerAccount,
|
||||
PublicKey const& publicKey,
|
||||
SecretKey const& secretKey,
|
||||
AccountID const& sendingAccount,
|
||||
STAmount const& sendingAmount,
|
||||
STAmount const& rewardAmount,
|
||||
AccountID const& rewardAccount,
|
||||
bool wasLockingChainSend,
|
||||
std::uint64_t createCount,
|
||||
AccountID const& toCreate);
|
||||
|
||||
[[nodiscard]] STObject
|
||||
toSTObject() const;
|
||||
@@ -232,17 +232,17 @@ struct CmpByCreateCount
|
||||
// Result when checking when two attestation match.
|
||||
enum class AttestationMatch {
|
||||
// One of the fields doesn't match, and it isn't the dst field
|
||||
nonDstMismatch,
|
||||
NonDstMismatch,
|
||||
// all of the fields match, except the dst field
|
||||
matchExceptDst,
|
||||
MatchExceptDst,
|
||||
// all of the fields match
|
||||
match
|
||||
Match
|
||||
};
|
||||
|
||||
struct XChainClaimAttestation
|
||||
{
|
||||
using TSignedAttestation = Attestations::AttestationClaim;
|
||||
static SField const& ArrayFieldName;
|
||||
static SField const& arrayFieldName;
|
||||
|
||||
AccountID keyAccount;
|
||||
PublicKey publicKey;
|
||||
@@ -264,26 +264,26 @@ struct XChainClaimAttestation
|
||||
};
|
||||
|
||||
explicit XChainClaimAttestation(
|
||||
AccountID const& keyAccount_,
|
||||
PublicKey const& publicKey_,
|
||||
STAmount const& amount_,
|
||||
AccountID const& rewardAccount_,
|
||||
bool wasLockingChainSend_,
|
||||
AccountID const& keyAccount,
|
||||
PublicKey const& publicKey,
|
||||
STAmount const& amount,
|
||||
AccountID const& rewardAccount,
|
||||
bool wasLockingChainSend,
|
||||
std::optional<AccountID> const& dst);
|
||||
|
||||
explicit XChainClaimAttestation(
|
||||
STAccount const& keyAccount_,
|
||||
PublicKey const& publicKey_,
|
||||
STAmount const& amount_,
|
||||
STAccount const& rewardAccount_,
|
||||
bool wasLockingChainSend_,
|
||||
STAccount const& keyAccount,
|
||||
PublicKey const& publicKey,
|
||||
STAmount const& amount,
|
||||
STAccount const& rewardAccount,
|
||||
bool wasLockingChainSend,
|
||||
std::optional<STAccount> const& dst);
|
||||
|
||||
explicit XChainClaimAttestation(TSignedAttestation const& claimAtt);
|
||||
|
||||
explicit XChainClaimAttestation(STObject const& o);
|
||||
|
||||
explicit XChainClaimAttestation(Json::Value const& v);
|
||||
explicit XChainClaimAttestation(json::Value const& v);
|
||||
|
||||
[[nodiscard]] AttestationMatch
|
||||
match(MatchFields const& rhs) const;
|
||||
@@ -298,7 +298,7 @@ struct XChainClaimAttestation
|
||||
struct XChainCreateAccountAttestation
|
||||
{
|
||||
using TSignedAttestation = Attestations::AttestationCreateAccount;
|
||||
static SField const& ArrayFieldName;
|
||||
static SField const& arrayFieldName;
|
||||
|
||||
AccountID keyAccount;
|
||||
PublicKey publicKey;
|
||||
@@ -319,19 +319,19 @@ struct XChainCreateAccountAttestation
|
||||
};
|
||||
|
||||
explicit XChainCreateAccountAttestation(
|
||||
AccountID const& keyAccount_,
|
||||
PublicKey const& publicKey_,
|
||||
STAmount const& amount_,
|
||||
STAmount const& rewardAmount_,
|
||||
AccountID const& rewardAccount_,
|
||||
bool wasLockingChainSend_,
|
||||
AccountID const& dst_);
|
||||
AccountID const& keyAccount,
|
||||
PublicKey const& publicKey,
|
||||
STAmount const& amount,
|
||||
STAmount const& rewardAmount,
|
||||
AccountID const& rewardAccount,
|
||||
bool wasLockingChainSend,
|
||||
AccountID const& dst);
|
||||
|
||||
explicit XChainCreateAccountAttestation(TSignedAttestation const& claimAtt);
|
||||
|
||||
explicit XChainCreateAccountAttestation(STObject const& o);
|
||||
|
||||
explicit XChainCreateAccountAttestation(Json::Value const& v);
|
||||
explicit XChainCreateAccountAttestation(json::Value const& v);
|
||||
|
||||
[[nodiscard]] STObject
|
||||
toSTObject() const;
|
||||
@@ -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 maxAttestations = 256;
|
||||
static constexpr std::uint32_t kMAX_ATTESTATIONS = 256;
|
||||
AttCollection attestations_;
|
||||
|
||||
protected:
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
|
||||
explicit XChainAttestationsBase(AttCollection&& sigs);
|
||||
|
||||
explicit XChainAttestationsBase(Json::Value const& v);
|
||||
explicit XChainAttestationsBase(json::Value const& v);
|
||||
|
||||
explicit XChainAttestationsBase(STArray const& arr);
|
||||
|
||||
@@ -393,7 +393,7 @@ public:
|
||||
|
||||
template <class F>
|
||||
std::size_t
|
||||
erase_if(F&& f);
|
||||
eraseIf(F&& f);
|
||||
|
||||
[[nodiscard]] std::size_t
|
||||
size() const;
|
||||
@@ -406,7 +406,7 @@ public:
|
||||
|
||||
template <class T>
|
||||
void
|
||||
emplace_back(T&& att);
|
||||
emplaceBack(T&& att);
|
||||
};
|
||||
|
||||
template <class TAttestation>
|
||||
@@ -428,7 +428,7 @@ XChainAttestationsBase<TAttestation>::attestations() const
|
||||
template <class TAttestation>
|
||||
template <class T>
|
||||
inline void
|
||||
XChainAttestationsBase<TAttestation>::emplace_back(T&& att)
|
||||
XChainAttestationsBase<TAttestation>::emplaceBack(T&& att)
|
||||
{
|
||||
attestations_.emplace_back(std::forward<T>(att));
|
||||
};
|
||||
@@ -436,7 +436,7 @@ XChainAttestationsBase<TAttestation>::emplace_back(T&& att)
|
||||
template <class TAttestation>
|
||||
template <class F>
|
||||
inline std::size_t
|
||||
XChainAttestationsBase<TAttestation>::erase_if(F&& f)
|
||||
XChainAttestationsBase<TAttestation>::eraseIf(F&& f)
|
||||
{
|
||||
return std::erase_if(attestations_, std::forward<F>(f));
|
||||
}
|
||||
|
||||
@@ -195,21 +195,21 @@ public:
|
||||
* in contexts that don't expect the value to ever approach
|
||||
* the 32-bit limits (i.e. fees and reserves).
|
||||
*/
|
||||
[[nodiscard]] Json::Value
|
||||
[[nodiscard]] json::Value
|
||||
jsonClipped() const
|
||||
{
|
||||
static_assert(
|
||||
std::is_signed_v<value_type> && std::is_integral_v<value_type>,
|
||||
"Expected XRPAmount to be a signed integral type");
|
||||
|
||||
constexpr auto min = std::numeric_limits<Json::Int>::min();
|
||||
constexpr auto max = 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_ < min)
|
||||
return min;
|
||||
if (drops_ > max)
|
||||
return max;
|
||||
return static_cast<Json::Int>(drops_);
|
||||
if (drops_ < kMIN)
|
||||
return kMIN;
|
||||
if (drops_ > kMAX)
|
||||
return kMAX;
|
||||
return static_cast<json::Int>(drops_);
|
||||
}
|
||||
|
||||
/** Returns the underlying value. Code SHOULD NOT call this
|
||||
@@ -237,12 +237,12 @@ public:
|
||||
};
|
||||
|
||||
/** Number of drops per 1 XRP */
|
||||
constexpr XRPAmount DROPS_PER_XRP{1'000'000};
|
||||
constexpr XRPAmount kDROPS_PER_XRP{1'000'000};
|
||||
|
||||
constexpr double
|
||||
XRPAmount::decimalXRP() const
|
||||
{
|
||||
return static_cast<double>(drops_) / DROPS_PER_XRP.drops();
|
||||
return static_cast<double>(drops_) / kDROPS_PER_XRP.drops();
|
||||
}
|
||||
|
||||
// Output XRPAmount as just the drops value.
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
|
||||
namespace xrpl::detail {
|
||||
|
||||
struct defaultObject_t
|
||||
struct DefaultObjectT
|
||||
{
|
||||
explicit defaultObject_t() = default;
|
||||
explicit DefaultObjectT() = default;
|
||||
};
|
||||
|
||||
struct nonPresentObject_t
|
||||
struct NonPresentObjectT
|
||||
{
|
||||
explicit nonPresentObject_t() = default;
|
||||
explicit NonPresentObjectT() = default;
|
||||
};
|
||||
|
||||
extern defaultObject_t defaultObject;
|
||||
extern nonPresentObject_t nonPresentObject;
|
||||
extern DefaultObjectT gDefaultObject;
|
||||
extern NonPresentObjectT gNonPresentObject;
|
||||
|
||||
// Concept to constrain STVar constructors, which
|
||||
// instantiate ST* types from SerializedTypeID
|
||||
@@ -35,9 +35,9 @@ class STVar
|
||||
{
|
||||
private:
|
||||
// The largest "small object" we can accommodate
|
||||
static std::size_t constexpr max_size = 72;
|
||||
static std::size_t constexpr kMAX_SIZE = 72;
|
||||
|
||||
std::aligned_storage<max_size>::type d_ = {};
|
||||
std::aligned_storage<kMAX_SIZE>::type d_ = {};
|
||||
STBase* p_ = nullptr;
|
||||
|
||||
public:
|
||||
@@ -51,16 +51,16 @@ public:
|
||||
|
||||
STVar(STBase&& t) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
p_ = t.move(max_size, &d_);
|
||||
p_ = t.move(kMAX_SIZE, &d_);
|
||||
}
|
||||
|
||||
STVar(STBase const& t)
|
||||
{
|
||||
p_ = t.copy(max_size, &d_);
|
||||
p_ = t.copy(kMAX_SIZE, &d_);
|
||||
}
|
||||
|
||||
STVar(defaultObject_t, SField const& name);
|
||||
STVar(nonPresentObject_t, SField const& name);
|
||||
STVar(DefaultObjectT, SField const& name);
|
||||
STVar(NonPresentObjectT, SField const& name);
|
||||
STVar(SerialIter& sit, SField const& name, int depth = 0);
|
||||
|
||||
STBase&
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
|
||||
template <class T, class... Args>
|
||||
friend STVar
|
||||
make_stvar(Args&&... args);
|
||||
makeStvar(Args&&... args);
|
||||
|
||||
private:
|
||||
STVar() = default;
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
void
|
||||
construct(Args&&... args)
|
||||
{
|
||||
if constexpr (sizeof(T) > max_size)
|
||||
if constexpr (sizeof(T) > kMAX_SIZE)
|
||||
{
|
||||
p_ = new T(std::forward<Args>(args)...);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ private:
|
||||
constructST(SerializedTypeID id, int depth, Args&&... arg);
|
||||
|
||||
[[nodiscard]] bool
|
||||
on_heap() const
|
||||
onHeap() const
|
||||
{
|
||||
return static_cast<void const*>(p_) != static_cast<void const*>(&d_);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ private:
|
||||
|
||||
template <class T, class... Args>
|
||||
inline STVar
|
||||
make_stvar(Args&&... args)
|
||||
makeStvar(Args&&... args)
|
||||
{
|
||||
STVar st;
|
||||
st.construct<T>(std::forward<Args>(args)...);
|
||||
|
||||
@@ -22,14 +22,14 @@ namespace b58_fast::detail {
|
||||
|
||||
// This optimizes to what hand written asm would do (single divide)
|
||||
[[nodiscard]] inline std::tuple<std::uint64_t, std::uint64_t>
|
||||
div_rem(std::uint64_t a, std::uint64_t b)
|
||||
divRem(std::uint64_t a, std::uint64_t b)
|
||||
{
|
||||
return {a / b, a % b};
|
||||
}
|
||||
|
||||
// This optimizes to what hand written asm would do (single multiply)
|
||||
[[nodiscard]] inline std::tuple<std::uint64_t, std::uint64_t>
|
||||
carrying_mul(std::uint64_t a, std::uint64_t b, std::uint64_t carry)
|
||||
carryingMul(std::uint64_t a, std::uint64_t b, std::uint64_t carry)
|
||||
{
|
||||
unsigned __int128 const x = a;
|
||||
unsigned __int128 const y = b;
|
||||
@@ -38,7 +38,7 @@ carrying_mul(std::uint64_t a, std::uint64_t b, std::uint64_t carry)
|
||||
}
|
||||
|
||||
[[nodiscard]] inline std::tuple<std::uint64_t, std::uint64_t>
|
||||
carrying_add(std::uint64_t a, std::uint64_t b)
|
||||
carryingAdd(std::uint64_t a, std::uint64_t b)
|
||||
{
|
||||
unsigned __int128 const x = a;
|
||||
unsigned __int128 const y = b;
|
||||
@@ -52,58 +52,58 @@ carrying_add(std::uint64_t a, std::uint64_t b)
|
||||
// panics if overflows (this is a specialized adder for b58 decoding.
|
||||
// it should never overflow).
|
||||
[[nodiscard]] inline TokenCodecErrc
|
||||
inplace_bigint_add(std::span<std::uint64_t> a, std::uint64_t b)
|
||||
inplaceBigintAdd(std::span<std::uint64_t> a, std::uint64_t b)
|
||||
{
|
||||
if (a.size() <= 1)
|
||||
{
|
||||
return TokenCodecErrc::inputTooSmall;
|
||||
return TokenCodecErrc::InputTooSmall;
|
||||
}
|
||||
|
||||
std::uint64_t carry = 0;
|
||||
std::tie(a[0], carry) = carrying_add(a[0], b);
|
||||
std::tie(a[0], carry) = carryingAdd(a[0], b);
|
||||
|
||||
for (auto& v : a.subspan(1))
|
||||
{
|
||||
if (carry == 0u)
|
||||
{
|
||||
return TokenCodecErrc::success;
|
||||
return TokenCodecErrc::Success;
|
||||
}
|
||||
std::tie(v, carry) = carrying_add(v, 1);
|
||||
std::tie(v, carry) = carryingAdd(v, 1);
|
||||
}
|
||||
if (carry != 0u)
|
||||
{
|
||||
return TokenCodecErrc::overflowAdd;
|
||||
return TokenCodecErrc::OverflowAdd;
|
||||
}
|
||||
return TokenCodecErrc::success;
|
||||
return TokenCodecErrc::Success;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline TokenCodecErrc
|
||||
inplace_bigint_mul(std::span<std::uint64_t> a, std::uint64_t b)
|
||||
inplaceBigintMul(std::span<std::uint64_t> a, std::uint64_t b)
|
||||
{
|
||||
if (a.empty())
|
||||
{
|
||||
return TokenCodecErrc::inputTooSmall;
|
||||
return TokenCodecErrc::InputTooSmall;
|
||||
}
|
||||
|
||||
auto const last_index = a.size() - 1;
|
||||
if (a[last_index] != 0)
|
||||
auto const lastIndex = a.size() - 1;
|
||||
if (a[lastIndex] != 0)
|
||||
{
|
||||
return TokenCodecErrc::inputTooLarge;
|
||||
return TokenCodecErrc::InputTooLarge;
|
||||
}
|
||||
|
||||
std::uint64_t carry = 0;
|
||||
for (auto& coeff : a.subspan(0, last_index))
|
||||
for (auto& coeff : a.subspan(0, lastIndex))
|
||||
{
|
||||
std::tie(coeff, carry) = carrying_mul(coeff, b, carry);
|
||||
std::tie(coeff, carry) = carryingMul(coeff, b, carry);
|
||||
}
|
||||
a[last_index] = carry;
|
||||
return TokenCodecErrc::success;
|
||||
a[lastIndex] = carry;
|
||||
return TokenCodecErrc::Success;
|
||||
}
|
||||
|
||||
// divide a "big uint" value inplace and return the mod
|
||||
// numerator is stored so smallest coefficients come first
|
||||
[[nodiscard]] inline std::uint64_t
|
||||
inplace_bigint_div_rem(std::span<uint64_t> numerator, std::uint64_t divisor)
|
||||
inplaceBigintDivRem(std::span<uint64_t> numerator, std::uint64_t divisor)
|
||||
{
|
||||
if (numerator.empty())
|
||||
{
|
||||
@@ -111,60 +111,60 @@ inplace_bigint_div_rem(std::span<uint64_t> numerator, std::uint64_t divisor)
|
||||
// the a null set of numbers to be zero, so the remainder is also zero.
|
||||
// LCOV_EXCL_START
|
||||
UNREACHABLE(
|
||||
"xrpl::b58_fast::detail::inplace_bigint_div_rem : empty "
|
||||
"xrpl::b58_fast::detail::inplaceBigintDivRem : empty "
|
||||
"numerator");
|
||||
return 0;
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
auto to_u128 = [](std::uint64_t high, std::uint64_t low) -> unsigned __int128 {
|
||||
auto toU128 = [](std::uint64_t high, std::uint64_t low) -> unsigned __int128 {
|
||||
unsigned __int128 const high128 = high;
|
||||
unsigned __int128 const low128 = low;
|
||||
return ((high128 << 64) | low128);
|
||||
};
|
||||
auto div_rem_64 = [](unsigned __int128 num,
|
||||
std::uint64_t denom) -> std::tuple<std::uint64_t, std::uint64_t> {
|
||||
auto divRe64 = [](unsigned __int128 num,
|
||||
std::uint64_t denom) -> std::tuple<std::uint64_t, std::uint64_t> {
|
||||
unsigned __int128 const denom128 = denom;
|
||||
unsigned __int128 const d = num / denom128;
|
||||
unsigned __int128 const r = num - (denom128 * d);
|
||||
XRPL_ASSERT(
|
||||
d >> 64 == 0,
|
||||
"xrpl::b58_fast::detail::inplace_bigint_div_rem::div_rem_64 : "
|
||||
"xrpl::b58_fast::detail::inplaceBigintDivRem::divRe64 : "
|
||||
"valid division result");
|
||||
XRPL_ASSERT(
|
||||
r >> 64 == 0,
|
||||
"xrpl::b58_fast::detail::inplace_bigint_div_rem::div_rem_64 : "
|
||||
"xrpl::b58_fast::detail::inplaceBigintDivRem::divRe64 : "
|
||||
"valid remainder");
|
||||
return {static_cast<std::uint64_t>(d), static_cast<std::uint64_t>(r)};
|
||||
};
|
||||
|
||||
std::uint64_t prev_rem = 0;
|
||||
int const last_index = numerator.size() - 1;
|
||||
std::tie(numerator[last_index], prev_rem) = div_rem(numerator[last_index], divisor);
|
||||
for (int i = last_index - 1; i >= 0; --i)
|
||||
std::uint64_t prevRem = 0;
|
||||
int const lastIndex = numerator.size() - 1;
|
||||
std::tie(numerator[lastIndex], prevRem) = divRem(numerator[lastIndex], divisor);
|
||||
for (int i = lastIndex - 1; i >= 0; --i)
|
||||
{
|
||||
unsigned __int128 const cur_num = to_u128(prev_rem, numerator[i]);
|
||||
std::tie(numerator[i], prev_rem) = div_rem_64(cur_num, divisor);
|
||||
unsigned __int128 const curNum = toU128(prevRem, numerator[i]);
|
||||
std::tie(numerator[i], prevRem) = divRe64(curNum, divisor);
|
||||
}
|
||||
return prev_rem;
|
||||
return prevRem;
|
||||
}
|
||||
|
||||
// convert from base 58^10 to base 58
|
||||
// put largest coeffs first
|
||||
// the `_be` suffix stands for "big endian"
|
||||
[[nodiscard]] inline std::array<std::uint8_t, 10>
|
||||
b58_10_to_b58_be(std::uint64_t input)
|
||||
b5810ToB58Be(std::uint64_t input)
|
||||
{
|
||||
[[maybe_unused]] static constexpr std::uint64_t B_58_10 = 430804206899405824; // 58^10;
|
||||
XRPL_ASSERT(input < B_58_10, "xrpl::b58_fast::detail::b58_10_to_b58_be : valid input");
|
||||
constexpr std::size_t resultSize = 10;
|
||||
std::array<std::uint8_t, resultSize> result{};
|
||||
[[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{};
|
||||
int i = 0;
|
||||
while (input > 0)
|
||||
{
|
||||
std::uint64_t rem = 0;
|
||||
std::tie(input, rem) = div_rem(input, 58);
|
||||
result[resultSize - 1 - i] = rem;
|
||||
std::tie(input, rem) = divRem(input, 58);
|
||||
result[kRESULT_SIZE - 1 - i] = rem;
|
||||
i += 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,63 +15,63 @@
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FEATURE(DefragDirectories, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (Cleanup3_2_0, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(MPTokensV2, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (Security3_1_3, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PermissionedDomainInvariant, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (BatchInnerSigs, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(LendingProtocol, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionDelegationV1_1, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (DirectoryLimit, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (IncludeKeyletFields, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DynamicMPT, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (TokenEscrowV1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PriceOracleOrder, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (MPTDeliveredAmount, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMClawbackRounding, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(TokenEscrow, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMv1_3, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Batch, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(SingleAssetVault, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DefragDirectories, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (Cleanup3_2_0, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(MPTokensV2, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (Security3_1_3, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PermissionedDomainInvariant, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (BatchInnerSigs, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(LendingProtocol, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionDelegationV1_1, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (DirectoryLimit, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (IncludeKeyletFields, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DynamicMPT, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (TokenEscrowV1, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PriceOracleOrder, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (MPTDeliveredAmount, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMClawbackRounding, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(TokenEscrow, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMv1_3, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionedDEX, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Batch, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(SingleAssetVault, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PayChanCancelAfter, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
// Check flags in Credential transactions
|
||||
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FrozenLPTokenTransfer, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionedDomains, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DynamicNFT, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Credentials, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(AMMClawback, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMv1_2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
// InvariantsV1_1 will be changed to Supported::yes when all the invariants expected to be included
|
||||
// under it are complete.
|
||||
XRPL_FEATURE(InvariantsV1_1, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (NFTokenPageLinks, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (InnerObjTemplate2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (EnforceNFTokenTrustline, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ReducedOffersV2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(NFTokenMintOffer, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMv1_1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PreviousTxnID, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (XChainRewardRounding, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (EmptyDID, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PriceOracle, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMOverflowOffer, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (InnerObjTemplate, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (NFTokenReserve, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FillOrKill, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DID, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (DisallowIncomingV1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(XChainBridge, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(AMM, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Clawback, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (UniversalNumber, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (InvalidTxFlags, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FrozenLPTokenTransfer, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DeepFreeze, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionedDomains, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DynamicNFT, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Credentials, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(AMMClawback, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMv1_2, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(MPTokensV1, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
// InvariantsV1_1 will be changes to Supported::yes when all the
|
||||
// invariants expected to be included under it are complete.
|
||||
XRPL_FEATURE(InvariantsV1_1, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (NFTokenPageLinks, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (InnerObjTemplate2, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (EnforceNFTokenTrustline, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ReducedOffersV2, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(NFTokenMintOffer, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMv1_1, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PreviousTxnID, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (XChainRewardRounding, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (EmptyDID, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PriceOracle, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMOverflowOffer, Supported::Yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (InnerObjTemplate, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (NFTokenReserve, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FillOrKill, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DID, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (DisallowIncomingV1, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(XChainBridge, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(AMM, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Clawback, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (UniversalNumber, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(XRPFees, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::Yes, VoteBehavior::DefaultYes)
|
||||
|
||||
// The following amendments are obsolete, but must remain supported
|
||||
// because they could potentially get enabled.
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
\sa keylet::nftoffer
|
||||
*/
|
||||
LEDGER_ENTRY(ltNFTOKEN_OFFER, 0x0037, NFTokenOffer, nft_offer, ({
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfNFTokenID, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfNFTokenOfferNode, soeREQUIRED},
|
||||
{sfDestination, soeOPTIONAL},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwner, SoeRequired},
|
||||
{sfNFTokenID, SoeRequired},
|
||||
{sfAmount, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfNFTokenOfferNode, SoeRequired},
|
||||
{sfDestination, SoeOptional},
|
||||
{sfExpiration, SoeOptional},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a check.
|
||||
@@ -40,18 +40,18 @@ LEDGER_ENTRY(ltNFTOKEN_OFFER, 0x0037, NFTokenOffer, nft_offer, ({
|
||||
\sa keylet::check
|
||||
*/
|
||||
LEDGER_ENTRY(ltCHECK, 0x0043, Check, check, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfSendMax, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfDestinationNode, soeREQUIRED},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfInvoiceID, soeOPTIONAL},
|
||||
{sfSourceTag, soeOPTIONAL},
|
||||
{sfDestinationTag, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfDestination, SoeRequired},
|
||||
{sfSendMax, SoeRequired},
|
||||
{sfSequence, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfDestinationNode, SoeRequired},
|
||||
{sfExpiration, SoeOptional},
|
||||
{sfInvoiceID, SoeOptional},
|
||||
{sfSourceTag, SoeOptional},
|
||||
{sfDestinationTag, SoeOptional},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** The ledger object which tracks the DID.
|
||||
@@ -59,13 +59,13 @@ LEDGER_ENTRY(ltCHECK, 0x0043, Check, check, ({
|
||||
\sa keylet::did
|
||||
*/
|
||||
LEDGER_ENTRY(ltDID, 0x0049, DID, did, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfDIDDocument, soeOPTIONAL},
|
||||
{sfURI, soeOPTIONAL},
|
||||
{sfData, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfDIDDocument, SoeOptional},
|
||||
{sfURI, SoeOptional},
|
||||
{sfData, SoeOptional},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** The ledger object which tracks the current negative UNL state.
|
||||
@@ -75,11 +75,11 @@ LEDGER_ENTRY(ltDID, 0x0049, DID, did, ({
|
||||
\sa keylet::negativeUNL
|
||||
*/
|
||||
LEDGER_ENTRY(ltNEGATIVE_UNL, 0x004e, NegativeUNL, nunl, ({
|
||||
{sfDisabledValidators, soeOPTIONAL},
|
||||
{sfValidatorToDisable, soeOPTIONAL},
|
||||
{sfValidatorToReEnable, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfDisabledValidators, SoeOptional},
|
||||
{sfValidatorToDisable, SoeOptional},
|
||||
{sfValidatorToReEnable, SoeOptional},
|
||||
{sfPreviousTxnID, SoeOptional},
|
||||
{sfPreviousTxnLgrSeq, SoeOptional},
|
||||
}))
|
||||
|
||||
/** A ledger object which contains a list of NFTs
|
||||
@@ -87,27 +87,27 @@ LEDGER_ENTRY(ltNEGATIVE_UNL, 0x004e, NegativeUNL, nunl, ({
|
||||
\sa keylet::nftpage_min, keylet::nftpage_max, keylet::nftpage
|
||||
*/
|
||||
LEDGER_ENTRY(ltNFTOKEN_PAGE, 0x0050, NFTokenPage, nft_page, ({
|
||||
{sfPreviousPageMin, soeOPTIONAL},
|
||||
{sfNextPageMin, soeOPTIONAL},
|
||||
{sfNFTokens, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfPreviousPageMin, SoeOptional},
|
||||
{sfNextPageMin, SoeOptional},
|
||||
{sfNFTokens, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which contains a signer list for an account.
|
||||
|
||||
\sa keylet::signers
|
||||
*/
|
||||
// All fields are soeREQUIRED because there is always a SignerEntries.
|
||||
// All fields are SoeRequired because there is always a SignerEntries.
|
||||
// If there are no SignerEntries the node is deleted.
|
||||
LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({
|
||||
{sfOwner, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfSignerQuorum, soeREQUIRED},
|
||||
{sfSignerEntries, soeREQUIRED},
|
||||
{sfSignerListID, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwner, SoeOptional},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfSignerQuorum, SoeRequired},
|
||||
{sfSignerEntries, SoeRequired},
|
||||
{sfSignerListID, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a ticket.
|
||||
@@ -115,11 +115,11 @@ LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({
|
||||
\sa keylet::ticket
|
||||
*/
|
||||
LEDGER_ENTRY(ltTICKET, 0x0054, Ticket, ticket, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfTicketSequence, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfTicketSequence, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes an account.
|
||||
@@ -127,29 +127,29 @@ LEDGER_ENTRY(ltTICKET, 0x0054, Ticket, ticket, ({
|
||||
\sa keylet::account
|
||||
*/
|
||||
LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfBalance, soeREQUIRED},
|
||||
{sfOwnerCount, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccountTxnID, soeOPTIONAL},
|
||||
{sfRegularKey, soeOPTIONAL},
|
||||
{sfEmailHash, soeOPTIONAL},
|
||||
{sfWalletLocator, soeOPTIONAL},
|
||||
{sfWalletSize, soeOPTIONAL},
|
||||
{sfMessageKey, soeOPTIONAL},
|
||||
{sfTransferRate, soeOPTIONAL},
|
||||
{sfDomain, soeOPTIONAL},
|
||||
{sfTickSize, soeOPTIONAL},
|
||||
{sfTicketCount, soeOPTIONAL},
|
||||
{sfNFTokenMinter, soeOPTIONAL},
|
||||
{sfMintedNFTokens, soeDEFAULT},
|
||||
{sfBurnedNFTokens, soeDEFAULT},
|
||||
{sfFirstNFTokenSequence, soeOPTIONAL},
|
||||
{sfAMMID, soeOPTIONAL}, // pseudo-account designator
|
||||
{sfVaultID, soeOPTIONAL}, // pseudo-account designator
|
||||
{sfLoanBrokerID, soeOPTIONAL}, // pseudo-account designator
|
||||
{sfAccount, SoeRequired},
|
||||
{sfSequence, SoeRequired},
|
||||
{sfBalance, SoeRequired},
|
||||
{sfOwnerCount, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfAccountTxnID, SoeOptional},
|
||||
{sfRegularKey, SoeOptional},
|
||||
{sfEmailHash, SoeOptional},
|
||||
{sfWalletLocator, SoeOptional},
|
||||
{sfWalletSize, SoeOptional},
|
||||
{sfMessageKey, SoeOptional},
|
||||
{sfTransferRate, SoeOptional},
|
||||
{sfDomain, SoeOptional},
|
||||
{sfTickSize, SoeOptional},
|
||||
{sfTicketCount, SoeOptional},
|
||||
{sfNFTokenMinter, SoeOptional},
|
||||
{sfMintedNFTokens, SoeDefault},
|
||||
{sfBurnedNFTokens, SoeDefault},
|
||||
{sfFirstNFTokenSequence, SoeOptional},
|
||||
{sfAMMID, SoeOptional}, // pseudo-account designator
|
||||
{sfVaultID, SoeOptional}, // pseudo-account designator
|
||||
{sfLoanBrokerID, SoeOptional}, // pseudo-account designator
|
||||
}))
|
||||
|
||||
/** A ledger object which contains a list of object identifiers.
|
||||
@@ -158,22 +158,22 @@ LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
|
||||
keylet::ownerDir
|
||||
*/
|
||||
LEDGER_ENTRY(ltDIR_NODE, 0x0064, DirectoryNode, directory, ({
|
||||
{sfOwner, soeOPTIONAL}, // for owner directories
|
||||
{sfTakerPaysCurrency, soeOPTIONAL}, // order book directories
|
||||
{sfTakerPaysIssuer, soeOPTIONAL}, // order book directories
|
||||
{sfTakerPaysMPT, soeOPTIONAL}, // order book directories
|
||||
{sfTakerGetsCurrency, soeOPTIONAL}, // order book directories
|
||||
{sfTakerGetsIssuer, soeOPTIONAL}, // order book directories
|
||||
{sfTakerGetsMPT, soeOPTIONAL}, // order book directories
|
||||
{sfExchangeRate, soeOPTIONAL}, // order book directories
|
||||
{sfIndexes, soeREQUIRED},
|
||||
{sfRootIndex, soeREQUIRED},
|
||||
{sfIndexNext, soeOPTIONAL},
|
||||
{sfIndexPrevious, soeOPTIONAL},
|
||||
{sfNFTokenID, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfDomainID, soeOPTIONAL} // order book directories
|
||||
{sfOwner, SoeOptional}, // for owner directories
|
||||
{sfTakerPaysCurrency, SoeOptional}, // order book directories
|
||||
{sfTakerPaysIssuer, SoeOptional}, // order book directories
|
||||
{sfTakerPaysMPT, SoeOptional}, // order book directories
|
||||
{sfTakerGetsCurrency, SoeOptional}, // order book directories
|
||||
{sfTakerGetsIssuer, SoeOptional}, // order book directories
|
||||
{sfTakerGetsMPT, SoeOptional}, // order book directories
|
||||
{sfExchangeRate, SoeOptional}, // order book directories
|
||||
{sfIndexes, SoeRequired},
|
||||
{sfRootIndex, SoeRequired},
|
||||
{sfIndexNext, SoeOptional},
|
||||
{sfIndexPrevious, SoeOptional},
|
||||
{sfNFTokenID, SoeOptional},
|
||||
{sfPreviousTxnID, SoeOptional},
|
||||
{sfPreviousTxnLgrSeq, SoeOptional},
|
||||
{sfDomainID, SoeOptional} // order book directories
|
||||
}))
|
||||
|
||||
/** The ledger object which lists details about amendments on the network.
|
||||
@@ -183,10 +183,10 @@ LEDGER_ENTRY(ltDIR_NODE, 0x0064, DirectoryNode, directory, ({
|
||||
\sa keylet::amendments
|
||||
*/
|
||||
LEDGER_ENTRY(ltAMENDMENTS, 0x0066, Amendments, amendments, ({
|
||||
{sfAmendments, soeOPTIONAL}, // Enabled
|
||||
{sfMajorities, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfAmendments, SoeOptional}, // Enabled
|
||||
{sfMajorities, SoeOptional},
|
||||
{sfPreviousTxnID, SoeOptional},
|
||||
{sfPreviousTxnLgrSeq, SoeOptional},
|
||||
}))
|
||||
|
||||
/** A ledger object that contains a list of ledger hashes.
|
||||
@@ -198,9 +198,9 @@ LEDGER_ENTRY(ltAMENDMENTS, 0x0066, Amendments, amendments, ({
|
||||
\sa keylet::skip
|
||||
*/
|
||||
LEDGER_ENTRY(ltLEDGER_HASHES, 0x0068, LedgerHashes, hashes, ({
|
||||
{sfFirstLedgerSequence, soeOPTIONAL},
|
||||
{sfLastLedgerSequence, soeOPTIONAL},
|
||||
{sfHashes, soeREQUIRED},
|
||||
{sfFirstLedgerSequence, SoeOptional},
|
||||
{sfLastLedgerSequence, SoeOptional},
|
||||
{sfHashes, SoeRequired},
|
||||
}))
|
||||
|
||||
/** The ledger object which lists details about sidechains.
|
||||
@@ -208,16 +208,16 @@ LEDGER_ENTRY(ltLEDGER_HASHES, 0x0068, LedgerHashes, hashes, ({
|
||||
\sa keylet::bridge
|
||||
*/
|
||||
LEDGER_ENTRY(ltBRIDGE, 0x0069, Bridge, bridge, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSignatureReward, soeREQUIRED},
|
||||
{sfMinAccountCreateAmount, soeOPTIONAL},
|
||||
{sfXChainBridge, soeREQUIRED},
|
||||
{sfXChainClaimID, soeREQUIRED},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED},
|
||||
{sfXChainAccountClaimCount, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfSignatureReward, SoeRequired},
|
||||
{sfMinAccountCreateAmount, SoeOptional},
|
||||
{sfXChainBridge, SoeRequired},
|
||||
{sfXChainClaimID, SoeRequired},
|
||||
{sfXChainAccountCreateCount, SoeRequired},
|
||||
{sfXChainAccountClaimCount, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes an offer on the DEX.
|
||||
@@ -225,18 +225,18 @@ LEDGER_ENTRY(ltBRIDGE, 0x0069, Bridge, bridge, ({
|
||||
\sa keylet::offer
|
||||
*/
|
||||
LEDGER_ENTRY(ltOFFER, 0x006f, Offer, offer, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfTakerPays, soeREQUIRED},
|
||||
{sfTakerGets, soeREQUIRED},
|
||||
{sfBookDirectory, soeREQUIRED},
|
||||
{sfBookNode, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfDomainID, soeOPTIONAL},
|
||||
{sfAdditionalBooks, soeOPTIONAL},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfSequence, SoeRequired},
|
||||
{sfTakerPays, SoeRequired},
|
||||
{sfTakerGets, SoeRequired},
|
||||
{sfBookDirectory, SoeRequired},
|
||||
{sfBookNode, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfExpiration, SoeOptional},
|
||||
{sfDomainID, SoeOptional},
|
||||
{sfAdditionalBooks, SoeOptional},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a deposit pre-authorization.
|
||||
@@ -244,12 +244,12 @@ LEDGER_ENTRY(ltOFFER, 0x006f, Offer, offer, ({
|
||||
\sa keylet::depositPreauth
|
||||
*/
|
||||
LEDGER_ENTRY_DUPLICATE(ltDEPOSIT_PREAUTH, 0x0070, DepositPreauth, deposit_preauth, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAuthorize, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAuthorizeCredentials, soeOPTIONAL},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfAuthorize, SoeOptional},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfAuthorizeCredentials, SoeOptional},
|
||||
}))
|
||||
|
||||
/** A claim id for a cross chain transaction.
|
||||
@@ -257,15 +257,15 @@ LEDGER_ENTRY_DUPLICATE(ltDEPOSIT_PREAUTH, 0x0070, DepositPreauth, deposit_preaut
|
||||
\sa keylet::xChainClaimID
|
||||
*/
|
||||
LEDGER_ENTRY(ltXCHAIN_OWNED_CLAIM_ID, 0x0071, XChainOwnedClaimID, xchain_owned_claim_id, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfXChainBridge, soeREQUIRED},
|
||||
{sfXChainClaimID, soeREQUIRED},
|
||||
{sfOtherChainSource, soeREQUIRED},
|
||||
{sfXChainClaimAttestations, soeREQUIRED},
|
||||
{sfSignatureReward, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfXChainBridge, SoeRequired},
|
||||
{sfXChainClaimID, SoeRequired},
|
||||
{sfOtherChainSource, SoeRequired},
|
||||
{sfXChainClaimAttestations, SoeRequired},
|
||||
{sfSignatureReward, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a bidirectional trust line.
|
||||
@@ -275,17 +275,17 @@ LEDGER_ENTRY(ltXCHAIN_OWNED_CLAIM_ID, 0x0071, XChainOwnedClaimID, xchain_owned_c
|
||||
\sa keylet::line
|
||||
*/
|
||||
LEDGER_ENTRY(ltRIPPLE_STATE, 0x0072, RippleState, state, ({
|
||||
{sfBalance, soeREQUIRED},
|
||||
{sfLowLimit, soeREQUIRED},
|
||||
{sfHighLimit, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfLowNode, soeOPTIONAL},
|
||||
{sfLowQualityIn, soeOPTIONAL},
|
||||
{sfLowQualityOut, soeOPTIONAL},
|
||||
{sfHighNode, soeOPTIONAL},
|
||||
{sfHighQualityIn, soeOPTIONAL},
|
||||
{sfHighQualityOut, soeOPTIONAL},
|
||||
{sfBalance, SoeRequired},
|
||||
{sfLowLimit, SoeRequired},
|
||||
{sfHighLimit, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfLowNode, SoeOptional},
|
||||
{sfLowQualityIn, SoeOptional},
|
||||
{sfLowQualityOut, SoeOptional},
|
||||
{sfHighNode, SoeOptional},
|
||||
{sfHighQualityIn, SoeOptional},
|
||||
{sfHighQualityOut, SoeOptional},
|
||||
}))
|
||||
|
||||
/** The ledger object which lists the network's fee settings.
|
||||
@@ -296,16 +296,16 @@ LEDGER_ENTRY(ltRIPPLE_STATE, 0x0072, RippleState, state, ({
|
||||
*/
|
||||
LEDGER_ENTRY(ltFEE_SETTINGS, 0x0073, FeeSettings, fee, ({
|
||||
// Old version uses raw numbers
|
||||
{sfBaseFee, soeOPTIONAL},
|
||||
{sfReferenceFeeUnits, soeOPTIONAL},
|
||||
{sfReserveBase, soeOPTIONAL},
|
||||
{sfReserveIncrement, soeOPTIONAL},
|
||||
{sfBaseFee, SoeOptional},
|
||||
{sfReferenceFeeUnits, SoeOptional},
|
||||
{sfReserveBase, SoeOptional},
|
||||
{sfReserveIncrement, SoeOptional},
|
||||
// New version uses Amounts
|
||||
{sfBaseFeeDrops, soeOPTIONAL},
|
||||
{sfReserveBaseDrops, soeOPTIONAL},
|
||||
{sfReserveIncrementDrops, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfBaseFeeDrops, SoeOptional},
|
||||
{sfReserveBaseDrops, SoeOptional},
|
||||
{sfReserveIncrementDrops, SoeOptional},
|
||||
{sfPreviousTxnID, SoeOptional},
|
||||
{sfPreviousTxnLgrSeq, SoeOptional},
|
||||
}))
|
||||
|
||||
/** A claim id for a cross chain create account transaction.
|
||||
@@ -313,13 +313,13 @@ LEDGER_ENTRY(ltFEE_SETTINGS, 0x0073, FeeSettings, fee, ({
|
||||
\sa keylet::xChainCreateAccountClaimID
|
||||
*/
|
||||
LEDGER_ENTRY(ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID, 0x0074, XChainOwnedCreateAccountClaimID, xchain_owned_create_account_claim_id, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfXChainBridge, soeREQUIRED},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED},
|
||||
{sfXChainCreateAccountAttestations, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfXChainBridge, SoeRequired},
|
||||
{sfXChainAccountCreateCount, SoeRequired},
|
||||
{sfXChainCreateAccountAttestations, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object describing a single escrow.
|
||||
@@ -327,21 +327,21 @@ LEDGER_ENTRY(ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID, 0x0074, XChainOwnedCreateAc
|
||||
\sa keylet::escrow
|
||||
*/
|
||||
LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSequence, soeOPTIONAL},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfCondition, soeOPTIONAL},
|
||||
{sfCancelAfter, soeOPTIONAL},
|
||||
{sfFinishAfter, soeOPTIONAL},
|
||||
{sfSourceTag, soeOPTIONAL},
|
||||
{sfDestinationTag, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfDestinationNode, soeOPTIONAL},
|
||||
{sfTransferRate, soeOPTIONAL},
|
||||
{sfIssuerNode, soeOPTIONAL},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfSequence, SoeOptional},
|
||||
{sfDestination, SoeRequired},
|
||||
{sfAmount, SoeRequired},
|
||||
{sfCondition, SoeOptional},
|
||||
{sfCancelAfter, SoeOptional},
|
||||
{sfFinishAfter, SoeOptional},
|
||||
{sfSourceTag, SoeOptional},
|
||||
{sfDestinationTag, SoeOptional},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfDestinationNode, SoeOptional},
|
||||
{sfTransferRate, SoeOptional},
|
||||
{sfIssuerNode, SoeOptional},
|
||||
}))
|
||||
|
||||
/** A ledger object describing a single unidirectional XRP payment channel.
|
||||
@@ -349,21 +349,21 @@ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
||||
\sa keylet::payChan
|
||||
*/
|
||||
LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfSequence, soeOPTIONAL},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfBalance, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfSettleDelay, soeREQUIRED},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfCancelAfter, soeOPTIONAL},
|
||||
{sfSourceTag, soeOPTIONAL},
|
||||
{sfDestinationTag, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfDestinationNode, soeOPTIONAL},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfDestination, SoeRequired},
|
||||
{sfSequence, SoeOptional},
|
||||
{sfAmount, SoeRequired},
|
||||
{sfBalance, SoeRequired},
|
||||
{sfPublicKey, SoeRequired},
|
||||
{sfSettleDelay, SoeRequired},
|
||||
{sfExpiration, SoeOptional},
|
||||
{sfCancelAfter, SoeOptional},
|
||||
{sfSourceTag, SoeOptional},
|
||||
{sfDestinationTag, SoeOptional},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfDestinationNode, SoeOptional},
|
||||
}))
|
||||
|
||||
/** The ledger object which tracks the AMM.
|
||||
@@ -371,125 +371,125 @@ LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
|
||||
\sa keylet::amm
|
||||
*/
|
||||
LEDGER_ENTRY(ltAMM, 0x0079, AMM, amm, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfTradingFee, soeDEFAULT},
|
||||
{sfVoteSlots, soeOPTIONAL},
|
||||
{sfAuctionSlot, soeOPTIONAL},
|
||||
{sfLPTokenBalance, soeREQUIRED},
|
||||
{sfAsset, soeREQUIRED},
|
||||
{sfAsset2, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfTradingFee, SoeDefault},
|
||||
{sfVoteSlots, SoeOptional},
|
||||
{sfAuctionSlot, SoeOptional},
|
||||
{sfLPTokenBalance, SoeRequired},
|
||||
{sfAsset, SoeRequired},
|
||||
{sfAsset2, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeOptional},
|
||||
{sfPreviousTxnLgrSeq, SoeOptional},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks MPTokenIssuance
|
||||
\sa keylet::mptIssuance
|
||||
*/
|
||||
LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
|
||||
{sfIssuer, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfTransferFee, soeDEFAULT},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfAssetScale, soeDEFAULT},
|
||||
{sfMaximumAmount, soeOPTIONAL},
|
||||
{sfOutstandingAmount, soeREQUIRED},
|
||||
{sfLockedAmount, soeOPTIONAL},
|
||||
{sfMPTokenMetadata, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfDomainID, soeOPTIONAL},
|
||||
{sfMutableFlags, soeDEFAULT},
|
||||
{sfIssuer, SoeRequired},
|
||||
{sfSequence, SoeRequired},
|
||||
{sfTransferFee, SoeDefault},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfAssetScale, SoeDefault},
|
||||
{sfMaximumAmount, SoeOptional},
|
||||
{sfOutstandingAmount, SoeRequired},
|
||||
{sfLockedAmount, SoeOptional},
|
||||
{sfMPTokenMetadata, SoeOptional},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfDomainID, SoeOptional},
|
||||
{sfMutableFlags, SoeDefault},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks MPToken
|
||||
\sa keylet::mptoken
|
||||
*/
|
||||
LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfMPTokenIssuanceID, soeREQUIRED},
|
||||
{sfMPTAmount, soeDEFAULT},
|
||||
{sfLockedAmount, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfMPTokenIssuanceID, SoeRequired},
|
||||
{sfMPTAmount, SoeDefault},
|
||||
{sfLockedAmount, SoeOptional},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks Oracle
|
||||
\sa keylet::oracle
|
||||
*/
|
||||
LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfOracleDocumentID, soeOPTIONAL},
|
||||
{sfProvider, soeREQUIRED},
|
||||
{sfPriceDataSeries, soeREQUIRED},
|
||||
{sfAssetClass, soeREQUIRED},
|
||||
{sfLastUpdateTime, soeREQUIRED},
|
||||
{sfURI, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwner, SoeRequired},
|
||||
{sfOracleDocumentID, SoeOptional},
|
||||
{sfProvider, SoeRequired},
|
||||
{sfPriceDataSeries, SoeRequired},
|
||||
{sfAssetClass, SoeRequired},
|
||||
{sfLastUpdateTime, SoeRequired},
|
||||
{sfURI, SoeOptional},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks Credential
|
||||
\sa keylet::credential
|
||||
*/
|
||||
LEDGER_ENTRY(ltCREDENTIAL, 0x0081, Credential, credential, ({
|
||||
{sfSubject, soeREQUIRED},
|
||||
{sfIssuer, soeREQUIRED},
|
||||
{sfCredentialType, soeREQUIRED},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfURI, soeOPTIONAL},
|
||||
{sfIssuerNode, soeREQUIRED},
|
||||
{sfSubjectNode, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfSubject, SoeRequired},
|
||||
{sfIssuer, SoeRequired},
|
||||
{sfCredentialType, SoeRequired},
|
||||
{sfExpiration, SoeOptional},
|
||||
{sfURI, SoeOptional},
|
||||
{sfIssuerNode, SoeRequired},
|
||||
{sfSubjectNode, SoeOptional},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks PermissionedDomain
|
||||
\sa keylet::permissionedDomain
|
||||
*/
|
||||
LEDGER_ENTRY(ltPERMISSIONED_DOMAIN, 0x0082, PermissionedDomain, permissioned_domain, ({
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfAcceptedCredentials, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwner, SoeRequired},
|
||||
{sfSequence, SoeRequired},
|
||||
{sfAcceptedCredentials, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object representing permissions an account has delegated to another account.
|
||||
\sa keylet::delegate
|
||||
*/
|
||||
LEDGER_ENTRY(ltDELEGATE, 0x0083, Delegate, delegate, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAuthorize, soeREQUIRED},
|
||||
{sfPermissions, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfDestinationNode, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfAuthorize, SoeRequired},
|
||||
{sfPermissions, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfDestinationNode, SoeOptional},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object representing a single asset vault.
|
||||
\sa keylet::vault
|
||||
*/
|
||||
LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfData, soeOPTIONAL},
|
||||
{sfAsset, soeREQUIRED},
|
||||
{sfAssetsTotal, soeDEFAULT},
|
||||
{sfAssetsAvailable, soeDEFAULT},
|
||||
{sfAssetsMaximum, soeDEFAULT},
|
||||
{sfLossUnrealized, soeDEFAULT},
|
||||
{sfShareMPTID, soeREQUIRED},
|
||||
{sfWithdrawalPolicy, soeREQUIRED},
|
||||
{sfScale, soeDEFAULT},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfSequence, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfOwner, SoeRequired},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfData, SoeOptional},
|
||||
{sfAsset, SoeRequired},
|
||||
{sfAssetsTotal, SoeDefault},
|
||||
{sfAssetsAvailable, SoeDefault},
|
||||
{sfAssetsMaximum, SoeDefault},
|
||||
{sfLossUnrealized, SoeDefault},
|
||||
{sfShareMPTID, SoeRequired},
|
||||
{sfWithdrawalPolicy, SoeRequired},
|
||||
{sfScale, SoeDefault},
|
||||
// no SharesTotal ever (use MPTIssuance.sfOutstandingAmount)
|
||||
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
|
||||
}))
|
||||
@@ -501,23 +501,23 @@ LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
|
||||
\sa keylet::loanbroker
|
||||
*/
|
||||
LEDGER_ENTRY(ltLOAN_BROKER, 0x0088, LoanBroker, loan_broker, ({
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfVaultNode, soeREQUIRED},
|
||||
{sfVaultID, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfLoanSequence, soeREQUIRED},
|
||||
{sfData, soeDEFAULT},
|
||||
{sfManagementFeeRate, soeDEFAULT},
|
||||
{sfOwnerCount, soeDEFAULT},
|
||||
{sfDebtTotal, soeDEFAULT},
|
||||
{sfDebtMaximum, soeDEFAULT},
|
||||
{sfCoverAvailable, soeDEFAULT},
|
||||
{sfCoverRateMinimum, soeDEFAULT},
|
||||
{sfCoverRateLiquidation, soeDEFAULT},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfSequence, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfVaultNode, SoeRequired},
|
||||
{sfVaultID, SoeRequired},
|
||||
{sfAccount, SoeRequired},
|
||||
{sfOwner, SoeRequired},
|
||||
{sfLoanSequence, SoeRequired},
|
||||
{sfData, SoeDefault},
|
||||
{sfManagementFeeRate, SoeDefault},
|
||||
{sfOwnerCount, SoeDefault},
|
||||
{sfDebtTotal, SoeDefault},
|
||||
{sfDebtMaximum, SoeDefault},
|
||||
{sfCoverAvailable, SoeDefault},
|
||||
{sfCoverRateMinimum, SoeDefault},
|
||||
{sfCoverRateLiquidation, SoeDefault},
|
||||
}))
|
||||
|
||||
/** A ledger object representing a loan between a Borrower and a Loan Broker
|
||||
@@ -525,27 +525,27 @@ LEDGER_ENTRY(ltLOAN_BROKER, 0x0088, LoanBroker, loan_broker, ({
|
||||
\sa keylet::loan
|
||||
*/
|
||||
LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfLoanBrokerNode, soeREQUIRED},
|
||||
{sfLoanBrokerID, soeREQUIRED},
|
||||
{sfLoanSequence, soeREQUIRED},
|
||||
{sfBorrower, soeREQUIRED},
|
||||
{sfLoanOriginationFee, soeDEFAULT},
|
||||
{sfLoanServiceFee, soeDEFAULT},
|
||||
{sfLatePaymentFee, soeDEFAULT},
|
||||
{sfClosePaymentFee, soeDEFAULT},
|
||||
{sfOverpaymentFee, soeDEFAULT},
|
||||
{sfInterestRate, soeDEFAULT},
|
||||
{sfLateInterestRate, soeDEFAULT},
|
||||
{sfCloseInterestRate, soeDEFAULT},
|
||||
{sfOverpaymentInterestRate, soeDEFAULT},
|
||||
{sfStartDate, soeREQUIRED},
|
||||
{sfPaymentInterval, soeREQUIRED},
|
||||
{sfGracePeriod, soeDEFAULT},
|
||||
{sfPreviousPaymentDueDate, soeDEFAULT},
|
||||
{sfNextPaymentDueDate, soeDEFAULT},
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
{sfLoanBrokerNode, SoeRequired},
|
||||
{sfLoanBrokerID, SoeRequired},
|
||||
{sfLoanSequence, SoeRequired},
|
||||
{sfBorrower, SoeRequired},
|
||||
{sfLoanOriginationFee, SoeDefault},
|
||||
{sfLoanServiceFee, SoeDefault},
|
||||
{sfLatePaymentFee, SoeDefault},
|
||||
{sfClosePaymentFee, SoeDefault},
|
||||
{sfOverpaymentFee, SoeDefault},
|
||||
{sfInterestRate, SoeDefault},
|
||||
{sfLateInterestRate, SoeDefault},
|
||||
{sfCloseInterestRate, SoeDefault},
|
||||
{sfOverpaymentInterestRate, SoeDefault},
|
||||
{sfStartDate, SoeRequired},
|
||||
{sfPaymentInterval, SoeRequired},
|
||||
{sfGracePeriod, SoeDefault},
|
||||
{sfPreviousPaymentDueDate, SoeDefault},
|
||||
{sfNextPaymentDueDate, SoeDefault},
|
||||
// The loan object tracks these values:
|
||||
//
|
||||
// - PaymentRemaining: The number of payments left in the loan. When it
|
||||
@@ -593,17 +593,17 @@ LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({
|
||||
//
|
||||
// Note the the "True" values may differ significantly from the tracked
|
||||
// rounded values.
|
||||
{sfPaymentRemaining, soeDEFAULT},
|
||||
{sfPeriodicPayment, soeREQUIRED},
|
||||
{sfPrincipalOutstanding, soeDEFAULT},
|
||||
{sfTotalValueOutstanding, soeDEFAULT},
|
||||
{sfManagementFeeOutstanding, soeDEFAULT},
|
||||
{sfPaymentRemaining, SoeDefault},
|
||||
{sfPeriodicPayment, SoeRequired},
|
||||
{sfPrincipalOutstanding, SoeDefault},
|
||||
{sfTotalValueOutstanding, SoeDefault},
|
||||
{sfManagementFeeOutstanding, SoeDefault},
|
||||
// Based on the computed total value at creation, used for
|
||||
// rounding calculated values so they are all on a
|
||||
// consistent scale - that is, they all have the same
|
||||
// number of digits after the decimal point (excluding
|
||||
// trailing zeros).
|
||||
{sfLoanScale, soeDEFAULT},
|
||||
{sfLoanScale, SoeDefault},
|
||||
}))
|
||||
|
||||
#undef EXPAND
|
||||
|
||||
@@ -8,20 +8,20 @@ template <class = void>
|
||||
secp256k1_context const*
|
||||
secp256k1Context()
|
||||
{
|
||||
struct holder
|
||||
struct Holder
|
||||
{
|
||||
secp256k1_context* impl;
|
||||
holder() : impl(secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN))
|
||||
Holder() : impl(secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN))
|
||||
{
|
||||
}
|
||||
|
||||
~holder()
|
||||
~Holder()
|
||||
{
|
||||
secp256k1_context_destroy(impl);
|
||||
}
|
||||
};
|
||||
static holder const h;
|
||||
return h.impl;
|
||||
static Holder const kH;
|
||||
return kH.impl;
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -27,7 +27,7 @@ TYPED_SFIELD(sfWasLockingChainSend, UINT8, 19)
|
||||
TYPED_SFIELD(sfWithdrawalPolicy, UINT8, 20)
|
||||
|
||||
// 16-bit integers (common)
|
||||
TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::sMD_Never)
|
||||
TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::SMdNever)
|
||||
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::sMD_DeleteFinal)
|
||||
TYPED_SFIELD(sfPreviousTxnLgrSeq, UINT32, 5, SField::SMdDeleteFinal)
|
||||
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::sMD_BaseTen|SField::sMD_Default)
|
||||
TYPED_SFIELD(sfOutstandingAmount, UINT64, 25, SField::sMD_BaseTen|SField::sMD_Default)
|
||||
TYPED_SFIELD(sfMPTAmount, UINT64, 26, SField::sMD_BaseTen|SField::sMD_Default)
|
||||
TYPED_SFIELD(sfMaximumAmount, UINT64, 24, SField::SMdBaseTen|SField::SMdDefault)
|
||||
TYPED_SFIELD(sfOutstandingAmount, UINT64, 25, SField::SMdBaseTen|SField::SMdDefault)
|
||||
TYPED_SFIELD(sfMPTAmount, UINT64, 26, SField::SMdBaseTen|SField::SMdDefault)
|
||||
TYPED_SFIELD(sfIssuerNode, UINT64, 27)
|
||||
TYPED_SFIELD(sfSubjectNode, UINT64, 28)
|
||||
TYPED_SFIELD(sfLockedAmount, UINT64, 29, SField::sMD_BaseTen|SField::sMD_Default)
|
||||
TYPED_SFIELD(sfLockedAmount, UINT64, 29, SField::SMdBaseTen|SField::SMdDefault)
|
||||
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::sMD_DeleteFinal)
|
||||
TYPED_SFIELD(sfPreviousTxnID, UINT256, 5, SField::SMdDeleteFinal)
|
||||
TYPED_SFIELD(sfLedgerIndex, UINT256, 6)
|
||||
TYPED_SFIELD(sfWalletLocator, UINT256, 7)
|
||||
TYPED_SFIELD(sfRootIndex, UINT256, 8, SField::sMD_Always)
|
||||
TYPED_SFIELD(sfRootIndex, UINT256, 8, SField::SMdAlways)
|
||||
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::sMD_PseudoAccount | SField::sMD_Default)
|
||||
SField::SMdPseudoAccount | SField::SMdDefault)
|
||||
|
||||
// 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::sMD_PseudoAccount | SField::sMD_Default)
|
||||
SField::SMdPseudoAccount | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfParentBatchID, UINT256, 36)
|
||||
TYPED_SFIELD(sfLoanBrokerID, UINT256, 37,
|
||||
SField::sMD_PseudoAccount | SField::sMD_Default)
|
||||
SField::SMdPseudoAccount | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfLoanID, UINT256, 38)
|
||||
|
||||
// number (common)
|
||||
TYPED_SFIELD(sfNumber, NUMBER, 1)
|
||||
TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfDebtTotal, NUMBER, 6, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfDebtMaximum, NUMBER, 7, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfCoverAvailable, NUMBER, 8, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfDebtTotal, NUMBER, 6, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfDebtMaximum, NUMBER, 7, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfCoverAvailable, NUMBER, 8, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
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::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 13, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfPrincipalRequested, NUMBER, 14)
|
||||
TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
TYPED_SFIELD(sfPeriodicPayment, NUMBER, 16)
|
||||
TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::sMD_NeedsAsset | SField::sMD_Default)
|
||||
TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::SMdNeedsAsset | SField::SMdDefault)
|
||||
|
||||
// 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::sMD_Default, SField::notSigning)
|
||||
TYPED_SFIELD(sfTxnSignature, VL, 4, SField::SMdDefault, SField::kNOT_SIGNING)
|
||||
TYPED_SFIELD(sfURI, VL, 5)
|
||||
TYPED_SFIELD(sfSignature, VL, 6, SField::sMD_Default, SField::notSigning)
|
||||
TYPED_SFIELD(sfSignature, VL, 6, SField::SMdDefault, SField::kNOT_SIGNING)
|
||||
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::sMD_Default, SField::notSigning)
|
||||
TYPED_SFIELD(sfMasterSignature, VL, 18, SField::SMdDefault, SField::kNOT_SIGNING)
|
||||
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::sMD_Never)
|
||||
TYPED_SFIELD(sfIndexes, VECTOR256, 1, SField::SMdNever)
|
||||
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::sMD_Default, SField::notSigning)
|
||||
UNTYPED_SFIELD(sfCounterpartySignature, OBJECT, 37, SField::SMdDefault, SField::kNOT_SIGNING)
|
||||
|
||||
// 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::sMD_Default, SField::notSigning)
|
||||
UNTYPED_SFIELD(sfSigners, ARRAY, 3, SField::SMdDefault, SField::kNOT_SIGNING)
|
||||
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::sMD_Default, SField::notSigning)
|
||||
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::SMdDefault, SField::kNOT_SIGNING)
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
|
||||
namespace xrpl {
|
||||
enum class TokenCodecErrc {
|
||||
success = 0,
|
||||
inputTooLarge,
|
||||
inputTooSmall,
|
||||
badB58Character,
|
||||
outputTooSmall,
|
||||
mismatchedTokenType,
|
||||
mismatchedChecksum,
|
||||
invalidEncodingChar,
|
||||
overflowAdd,
|
||||
unknown,
|
||||
Success = 0,
|
||||
InputTooLarge,
|
||||
InputTooSmall,
|
||||
BadB58Character,
|
||||
OutputTooSmall,
|
||||
MismatchedTokenType,
|
||||
MismatchedChecksum,
|
||||
InvalidEncodingChar,
|
||||
OverflowAdd,
|
||||
Unknown,
|
||||
};
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -41,23 +41,23 @@ public:
|
||||
{
|
||||
switch (static_cast<TokenCodecErrc>(c))
|
||||
{
|
||||
case TokenCodecErrc::success:
|
||||
case TokenCodecErrc::Success:
|
||||
return "conversion successful";
|
||||
case TokenCodecErrc::inputTooLarge:
|
||||
case TokenCodecErrc::InputTooLarge:
|
||||
return "input too large";
|
||||
case TokenCodecErrc::inputTooSmall:
|
||||
case TokenCodecErrc::InputTooSmall:
|
||||
return "input too small";
|
||||
case TokenCodecErrc::badB58Character:
|
||||
case TokenCodecErrc::BadB58Character:
|
||||
return "bad base 58 character";
|
||||
case TokenCodecErrc::outputTooSmall:
|
||||
case TokenCodecErrc::OutputTooSmall:
|
||||
return "output too small";
|
||||
case TokenCodecErrc::mismatchedTokenType:
|
||||
case TokenCodecErrc::MismatchedTokenType:
|
||||
return "mismatched token type";
|
||||
case TokenCodecErrc::mismatchedChecksum:
|
||||
case TokenCodecErrc::MismatchedChecksum:
|
||||
return "mismatched checksum";
|
||||
case TokenCodecErrc::invalidEncodingChar:
|
||||
case TokenCodecErrc::InvalidEncodingChar:
|
||||
return "invalid encoding char";
|
||||
case TokenCodecErrc::unknown:
|
||||
case TokenCodecErrc::Unknown:
|
||||
return "unknown";
|
||||
default:
|
||||
return "unknown";
|
||||
@@ -67,15 +67,15 @@ public:
|
||||
} // namespace detail
|
||||
|
||||
inline xrpl::detail::TokenCodecErrcCategory const&
|
||||
TokenCodecErrcCategory()
|
||||
tokenCodecErrcCategory()
|
||||
{
|
||||
static xrpl::detail::TokenCodecErrcCategory const c;
|
||||
return c;
|
||||
static xrpl::detail::TokenCodecErrcCategory const kC;
|
||||
return kC;
|
||||
}
|
||||
|
||||
inline std::error_code
|
||||
make_error_code(xrpl::TokenCodecErrc e)
|
||||
{
|
||||
return {static_cast<int>(e), TokenCodecErrcCategory()};
|
||||
return {static_cast<int>(e), tokenCodecErrcCategory()};
|
||||
}
|
||||
} // namespace xrpl
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,14 +24,14 @@ namespace xrpl {
|
||||
|
||||
@note This uses the OpenSSL implementation
|
||||
*/
|
||||
struct openssl_ripemd160_hasher
|
||||
struct OpensslRipemd160Hasher
|
||||
{
|
||||
public:
|
||||
static constexpr auto const endian = boost::endian::order::native;
|
||||
static constexpr auto const kENDIAN = boost::endian::order::native;
|
||||
|
||||
using result_type = std::array<std::uint8_t, 20>;
|
||||
|
||||
openssl_ripemd160_hasher();
|
||||
OpensslRipemd160Hasher();
|
||||
|
||||
void
|
||||
operator()(void const* data, std::size_t size) noexcept;
|
||||
@@ -47,14 +47,14 @@ private:
|
||||
|
||||
@note This uses the OpenSSL implementation
|
||||
*/
|
||||
struct openssl_sha512_hasher
|
||||
struct OpensslSha512Hasher
|
||||
{
|
||||
public:
|
||||
static constexpr auto const endian = boost::endian::order::native;
|
||||
static constexpr auto const kENDIAN = boost::endian::order::native;
|
||||
|
||||
using result_type = std::array<std::uint8_t, 64>;
|
||||
|
||||
openssl_sha512_hasher();
|
||||
OpensslSha512Hasher();
|
||||
|
||||
void
|
||||
operator()(void const* data, std::size_t size) noexcept;
|
||||
@@ -70,14 +70,14 @@ private:
|
||||
|
||||
@note This uses the OpenSSL implementation
|
||||
*/
|
||||
struct openssl_sha256_hasher
|
||||
struct OpensslSha256Hasher
|
||||
{
|
||||
public:
|
||||
static constexpr auto const endian = boost::endian::order::native;
|
||||
static constexpr auto const kENDIAN = boost::endian::order::native;
|
||||
|
||||
using result_type = std::array<std::uint8_t, 32>;
|
||||
|
||||
openssl_sha256_hasher();
|
||||
OpensslSha256Hasher();
|
||||
|
||||
void
|
||||
operator()(void const* data, std::size_t size) noexcept;
|
||||
@@ -91,9 +91,9 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using ripemd160_hasher = openssl_ripemd160_hasher;
|
||||
using sha256_hasher = openssl_sha256_hasher;
|
||||
using sha512_hasher = openssl_sha512_hasher;
|
||||
using ripemd160_hasher = OpensslRipemd160Hasher;
|
||||
using sha256_hasher = OpensslSha256Hasher;
|
||||
using sha512_hasher = OpensslSha512Hasher;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -112,13 +112,13 @@ using sha512_hasher = openssl_sha512_hasher;
|
||||
|
||||
Meets the requirements of Hasher (in hash_append)
|
||||
*/
|
||||
struct ripesha_hasher
|
||||
struct RipeshaHasher
|
||||
{
|
||||
private:
|
||||
sha256_hasher h_;
|
||||
|
||||
public:
|
||||
static constexpr auto const endian = boost::endian::order::native;
|
||||
static constexpr auto const kENDIAN = boost::endian::order::native;
|
||||
|
||||
using result_type = std::array<std::uint8_t, 20>;
|
||||
|
||||
@@ -148,17 +148,17 @@ namespace detail {
|
||||
SHA-512 digest of the message.
|
||||
*/
|
||||
template <bool Secure>
|
||||
struct basic_sha512_half_hasher
|
||||
struct BasicSha512HalfHasher
|
||||
{
|
||||
private:
|
||||
sha512_hasher h_;
|
||||
|
||||
public:
|
||||
static constexpr auto const endian = boost::endian::order::big;
|
||||
static constexpr auto const kENDIAN = boost::endian::order::big;
|
||||
|
||||
using result_type = uint256;
|
||||
|
||||
~basic_sha512_half_hasher()
|
||||
~BasicSha512HalfHasher()
|
||||
{
|
||||
erase(std::integral_constant<bool, Secure>{});
|
||||
}
|
||||
@@ -185,16 +185,16 @@ private:
|
||||
void
|
||||
erase(std::true_type)
|
||||
{
|
||||
secure_erase(&h_, sizeof(h_));
|
||||
secureErase(&h_, sizeof(h_));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
using sha512_half_hasher = detail::basic_sha512_half_hasher<false>;
|
||||
using sha512_half_hasher = detail::BasicSha512HalfHasher<false>;
|
||||
|
||||
// secure version
|
||||
using sha512_half_hasher_s = detail::basic_sha512_half_hasher<true>;
|
||||
using sha512_half_hasher_s = detail::BasicSha512HalfHasher<true>;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -217,7 +217,7 @@ sha512Half(Args const&... args)
|
||||
*/
|
||||
template <class... Args>
|
||||
sha512_half_hasher_s::result_type
|
||||
sha512Half_s(Args const&... args)
|
||||
sha512HalfS(Args const&... args)
|
||||
{
|
||||
sha512_half_hasher_s h;
|
||||
using beast::hash_append;
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
#include <exception>
|
||||
#include <optional>
|
||||
|
||||
namespace Json {
|
||||
namespace json {
|
||||
struct JsonMissingKeyError : std::exception
|
||||
{
|
||||
char const* const key;
|
||||
mutable std::string msg;
|
||||
JsonMissingKeyError(Json::StaticString const& k) : key{k.c_str()}
|
||||
JsonMissingKeyError(json::StaticString const& k) : key{k.cStr()}
|
||||
{
|
||||
}
|
||||
char const*
|
||||
@@ -34,8 +34,8 @@ struct JsonTypeMismatchError : std::exception
|
||||
char const* const key;
|
||||
std::string const expectedType;
|
||||
mutable std::string msg;
|
||||
JsonTypeMismatchError(Json::StaticString const& k, std::string et)
|
||||
: key{k.c_str()}, expectedType{std::move(et)}
|
||||
JsonTypeMismatchError(json::StaticString const& k, std::string et)
|
||||
: key{k.cStr()}, expectedType{std::move(et)}
|
||||
{
|
||||
}
|
||||
char const*
|
||||
@@ -52,21 +52,21 @@ struct JsonTypeMismatchError : std::exception
|
||||
|
||||
template <class T>
|
||||
T
|
||||
getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
getOrThrow(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
static_assert(sizeof(T) == -1, "This function must be specialized");
|
||||
}
|
||||
|
||||
template <>
|
||||
inline std::string
|
||||
getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
getOrThrow(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
using namespace xrpl;
|
||||
Json::StaticString const& key = field.getJsonName();
|
||||
json::StaticString const& key = field.getJsonName();
|
||||
if (!v.isMember(key))
|
||||
Throw<JsonMissingKeyError>(key);
|
||||
|
||||
Json::Value const& inner = v[key];
|
||||
json::Value const& inner = v[key];
|
||||
if (!inner.isString())
|
||||
Throw<JsonTypeMismatchError>(key, "string");
|
||||
return inner.asString();
|
||||
@@ -75,13 +75,13 @@ getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
// Note, this allows integer numeric fields to act as bools
|
||||
template <>
|
||||
inline bool
|
||||
getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
getOrThrow(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
using namespace xrpl;
|
||||
Json::StaticString const& key = field.getJsonName();
|
||||
json::StaticString const& key = field.getJsonName();
|
||||
if (!v.isMember(key))
|
||||
Throw<JsonMissingKeyError>(key);
|
||||
Json::Value const& inner = v[key];
|
||||
json::Value const& inner = v[key];
|
||||
if (inner.isBool())
|
||||
return inner.asBool();
|
||||
if (!inner.isIntegral())
|
||||
@@ -92,13 +92,13 @@ getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
|
||||
template <>
|
||||
inline std::uint64_t
|
||||
getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
getOrThrow(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
using namespace xrpl;
|
||||
Json::StaticString const& key = field.getJsonName();
|
||||
json::StaticString const& key = field.getJsonName();
|
||||
if (!v.isMember(key))
|
||||
Throw<JsonMissingKeyError>(key);
|
||||
Json::Value const& inner = v[key];
|
||||
json::Value const& inner = v[key];
|
||||
if (inner.isUInt())
|
||||
return inner.asUInt();
|
||||
if (inner.isInt())
|
||||
@@ -125,7 +125,7 @@ getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
|
||||
template <>
|
||||
inline xrpl::Buffer
|
||||
getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
getOrThrow(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
using namespace xrpl;
|
||||
std::string const hex = getOrThrow<std::string>(v, field);
|
||||
@@ -140,7 +140,7 @@ getOrThrow(Json::Value const& v, xrpl::SField const& field)
|
||||
// This function may be used by external projects (like the witness server).
|
||||
template <class T>
|
||||
std::optional<T>
|
||||
getOptional(Json::Value const& v, xrpl::SField const& field)
|
||||
getOptional(json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -152,4 +152,4 @@ getOptional(Json::Value const& v, xrpl::SField const& field)
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace Json
|
||||
} // namespace json
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
|
||||
namespace xrpl::jss {
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
// JSON static strings
|
||||
|
||||
#define JSS(x) constexpr ::Json::StaticString x(#x)
|
||||
#define JSS(x) constexpr ::json::StaticString x(#x)
|
||||
|
||||
/* These "StaticString" field names are used instead of string literals to
|
||||
optimize the performance of accessing properties of Json::Value objects.
|
||||
optimize the performance of accessing properties of json::Value objects.
|
||||
|
||||
Most strings have a trailing comment. Here is the legend:
|
||||
|
||||
in: Read by the given RPC handler from its `Json::Value` parameter.
|
||||
out: Assigned by the given RPC handler in the `Json::Value` it returns.
|
||||
in: Read by the given RPC handler from its `json::Value` parameter.
|
||||
out: Assigned by the given RPC handler in the `json::Value` it returns.
|
||||
field: A field of at least one type of transaction.
|
||||
RPC: Common properties of RPC requests and responses.
|
||||
error: Common properties of RPC error responses.
|
||||
@@ -707,4 +708,6 @@ JSS(write_load); // out: GetCounts
|
||||
|
||||
#undef JSS
|
||||
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
|
||||
} // namespace xrpl::jss
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace xrpl::nft {
|
||||
struct TaxonTag
|
||||
{
|
||||
};
|
||||
using Taxon = tagged_integer<std::uint32_t, TaxonTag>;
|
||||
using Taxon = TaggedInteger<std::uint32_t, TaxonTag>;
|
||||
|
||||
inline Taxon
|
||||
toTaxon(std::uint32_t i)
|
||||
@@ -29,11 +29,11 @@ toUInt32(Taxon t)
|
||||
return static_cast<std::uint32_t>(t);
|
||||
}
|
||||
|
||||
constexpr std::uint16_t const flagBurnable = 0x0001;
|
||||
constexpr std::uint16_t const flagOnlyXRP = 0x0002;
|
||||
constexpr std::uint16_t const flagCreateTrustLines = 0x0004;
|
||||
constexpr std::uint16_t const flagTransferable = 0x0008;
|
||||
constexpr std::uint16_t const flagMutable = 0x0010;
|
||||
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;
|
||||
|
||||
inline std::uint16_t
|
||||
getFlags(uint256 const& id)
|
||||
|
||||
@@ -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 pageMask(
|
||||
uint256 constexpr kPAGE_MASK(
|
||||
std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff"));
|
||||
|
||||
} // namespace xrpl::nft
|
||||
|
||||
@@ -62,7 +62,7 @@ decodeBase58Token(std::string const& s, TokenType type);
|
||||
namespace detail {
|
||||
// Expose detail functions for unit tests only
|
||||
std::string
|
||||
encodeBase58(void const* message, std::size_t size, void* temp, std::size_t temp_size);
|
||||
encodeBase58(void const* message, std::size_t size, void* temp, std::size_t tempSize);
|
||||
|
||||
std::string
|
||||
decodeBase58(std::string const& s);
|
||||
@@ -75,7 +75,7 @@ namespace b58_fast {
|
||||
// particular)
|
||||
[[nodiscard]] B58Result<std::span<std::uint8_t>>
|
||||
encodeBase58Token(
|
||||
TokenType token_type,
|
||||
TokenType tokenType,
|
||||
std::span<std::uint8_t const> input,
|
||||
std::span<std::uint8_t> out);
|
||||
|
||||
@@ -93,10 +93,10 @@ decodeBase58Token(std::string const& s, TokenType type);
|
||||
namespace detail {
|
||||
// Expose detail functions for unit tests only
|
||||
B58Result<std::span<std::uint8_t>>
|
||||
b256_to_b58_be(std::span<std::uint8_t const> input, std::span<std::uint8_t> out);
|
||||
b256ToB58Be(std::span<std::uint8_t const> input, std::span<std::uint8_t> out);
|
||||
|
||||
B58Result<std::span<std::uint8_t>>
|
||||
b58_to_b256_be(std::string_view input, std::span<std::uint8_t> out);
|
||||
b58ToB256Be(std::string_view input, std::span<std::uint8_t> out);
|
||||
} // namespace detail
|
||||
|
||||
} // namespace b58_fast
|
||||
|
||||
Reference in New Issue
Block a user