Compare commits

..

4 Commits

Author SHA1 Message Date
Mayukha Vadari
7de9560048 Update src/libxrpl/protocol/InnerObjectFormats.cpp
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-04-27 09:33:25 -04:00
Mayukha Vadari
568623f699 fix clang-tidy issues 2026-04-27 09:30:42 -04:00
Mayukha Vadari
cf33298abd add tests, fix issues 2026-04-27 08:52:52 -04:00
Mayukha Vadari
b46ca16f7d feature: Add invariant checks to ensure only fields that are expected to be modified are modified 2026-04-25 19:59:47 -04:00
16 changed files with 751 additions and 544 deletions

View File

@@ -51,21 +51,20 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
# Only generate a subset of configurations in PRs.
if not all:
# Debian:
# - Bookworm using GCC 13: Debug on linux/amd64, set the reference
# fee to 500 and enable code coverage (which will be done below).
# - Bookworm using GCC 15: Debug on linux/amd64, enable Address and
# UB sanitizers (which will be done below).
# - Bookworm using GCC 13: Release on linux/amd64, set the reference
# fee to 500.
# - Bookworm using GCC 15: Debug on linux/amd64, enable code
# coverage (which will be done below).
# - Bookworm using Clang 16: Debug on linux/amd64, enable voidstar.
# - Bookworm using Clang 17: Release on linux/amd64, set the
# reference fee to 1000.
# - Bookworm using Clang 20: Debug on linux/amd64, enable Address
# and UB sanitizers (which will be done below).
# - Bookworm using Clang 20: Debug on linux/amd64.
if os["distro_name"] == "debian":
skip = True
if os["distro_version"] == "bookworm":
if (
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-13"
and build_type == "Debug"
and build_type == "Release"
and architecture["platform"] == "linux/amd64"
):
cmake_args = f"-DUNIT_TEST_REFERENCE_FEE=500 {cmake_args}"
@@ -194,11 +193,11 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
):
continue
# Enable code coverage for Debian Bookworm using GCC 13 in Debug on
# linux/amd64.
# Enable code coverage for Debian Bookworm using GCC 15 in Debug on
# linux/amd64
if (
f"{os['distro_name']}-{os['distro_version']}" == "debian-bookworm"
and f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-13"
and f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15"
and build_type == "Debug"
and architecture["platform"] == "linux/amd64"
):
@@ -235,39 +234,23 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
# Add the configuration to the list, with the most unique fields first,
# so that they are easier to identify in the GitHub Actions UI, as long
# names get truncated.
# Add Address and UB sanitizers as separate configurations for specific
# bookworm distros. Thread sanitizer is currently disabled (see below).
# Add Address and Thread (both coupled with UB) sanitizers for specific bookworm distros.
# GCC-Asan xrpld-embedded tests are failing because of https://github.com/google/sanitizers/issues/856
if os[
"distro_version"
] == "bookworm" and f"{os['compiler_name']}-{os['compiler_version']}" in [
"gcc-15",
"clang-20",
]:
# Add ASAN configuration.
if (
os["distro_version"] == "bookworm"
and f"{os['compiler_name']}-{os['compiler_version']}" == "clang-20"
):
# Add ASAN + UBSAN configuration.
configurations.append(
{
"config_name": config_name + "-asan",
"config_name": config_name + "-asan-ubsan",
"cmake_args": cmake_args,
"cmake_target": cmake_target,
"build_only": build_only,
"build_type": build_type,
"os": os,
"architecture": architecture,
"sanitizers": "address",
}
)
# Add UBSAN configuration.
configurations.append(
{
"config_name": config_name + "-ubsan",
"cmake_args": cmake_args,
"cmake_target": cmake_target,
"build_only": build_only,
"build_type": build_type,
"os": os,
"architecture": architecture,
"sanitizers": "undefinedbehavior",
"sanitizers": "address,undefinedbehavior",
}
)
# TSAN is deactivated due to seg faults with latest compilers.

View File

@@ -67,10 +67,8 @@ private:
}
else
{
for (; elapsed > 0; --elapsed)
{
while ((elapsed--) != 0u)
m_value -= (m_value + Window - 1) / Window;
}
}
}

View File

@@ -43,10 +43,8 @@ public:
: work_(boost::asio::make_work_guard(ios_))
{
threads_.reserve(concurrency);
for (std::size_t i = 0; i < concurrency; ++i)
{
while ((concurrency--) != 0u)
threads_.emplace_back([&] { ios_.run(); });
}
}
~enable_yield_to()

View File

@@ -54,9 +54,8 @@ read_varint(void const* buf, std::size_t buflen, std::size_t& t)
return 1;
}
auto const used = n;
while (n > 0)
while (n--)
{
--n;
auto const d = p[n];
auto const t0 = t;
t *= 127;

View File

@@ -23,6 +23,12 @@ enum SOEStyle {
/** Amount fields that can support MPT */
enum SOETxMPTIssue { soeMPTNone, soeMPTSupported, soeMPTNotSupported };
enum SOEConstant {
soeCONSTANTINVALID = 0,
soeCONSTANT = 1,
soeNOTCONSTANT = 2,
};
//------------------------------------------------------------------------------
/** An element in a SOTemplate. */
@@ -31,6 +37,7 @@ class SOElement
// Use std::reference_wrapper so SOElement can be stored in a std::vector.
std::reference_wrapper<SField const> sField_;
SOEStyle style_;
SOEConstant constant_ = soeCONSTANTINVALID;
SOETxMPTIssue supportMpt_ = soeMPTNone;
private:
@@ -52,6 +59,12 @@ public:
init(fieldName);
}
SOElement(SField const& fieldName, SOEStyle style, SOEConstant constant)
: sField_(fieldName), style_(style), constant_(constant)
{
init(fieldName);
}
template <typename T>
requires(std::is_same_v<T, STAmount> || std::is_same_v<T, STIssue>)
SOElement(
@@ -63,6 +76,18 @@ public:
init(fieldName);
}
template <typename T>
requires(std::is_same_v<T, STAmount> || std::is_same_v<T, STIssue>)
SOElement(
TypedField<T> const& fieldName,
SOEStyle style,
SOEConstant constant,
SOETxMPTIssue supportMpt = soeMPTNotSupported)
: sField_(fieldName), style_(style), constant_(constant), supportMpt_(supportMpt)
{
init(fieldName);
}
[[nodiscard]] SField const&
sField() const
{
@@ -75,6 +100,12 @@ public:
return style_;
}
[[nodiscard]] SOEConstant
constant() const
{
return constant_;
}
[[nodiscard]] SOETxMPTIssue
supportMPT() const
{

View File

@@ -36,7 +36,6 @@ XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultN
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)

View File

@@ -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, soeCONSTANT},
{sfNFTokenID, soeREQUIRED, soeCONSTANT},
{sfAmount, soeREQUIRED, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfNFTokenOfferNode, soeREQUIRED, soeCONSTANT},
{sfDestination, soeOPTIONAL, soeCONSTANT},
{sfExpiration, soeOPTIONAL, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfDestination, soeREQUIRED, soeCONSTANT},
{sfSendMax, soeREQUIRED, soeCONSTANT},
{sfSequence, soeREQUIRED, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfDestinationNode, soeREQUIRED, soeCONSTANT},
{sfExpiration, soeOPTIONAL, soeCONSTANT},
{sfInvoiceID, soeOPTIONAL, soeCONSTANT},
{sfSourceTag, soeOPTIONAL, soeCONSTANT},
{sfDestinationTag, soeOPTIONAL, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfDIDDocument, soeOPTIONAL, soeNOTCONSTANT},
{sfURI, soeOPTIONAL, soeNOTCONSTANT},
{sfData, soeOPTIONAL, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeNOTCONSTANT},
{sfValidatorToDisable, soeOPTIONAL, soeNOTCONSTANT},
{sfValidatorToReEnable, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
}))
/** A ledger object which contains a list of NFTs
@@ -87,11 +87,11 @@ 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, soeNOTCONSTANT},
{sfNextPageMin, soeOPTIONAL, soeNOTCONSTANT},
{sfNFTokens, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** A ledger object which contains a signer list for an account.
@@ -101,13 +101,13 @@ LEDGER_ENTRY(ltNFTOKEN_PAGE, 0x0050, NFTokenPage, nft_page, ({
// 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, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfSignerQuorum, soeREQUIRED, soeNOTCONSTANT},
{sfSignerEntries, soeREQUIRED, soeNOTCONSTANT},
{sfSignerListID, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfTicketSequence, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfSequence, soeREQUIRED, soeNOTCONSTANT},
{sfBalance, soeREQUIRED, soeNOTCONSTANT},
{sfOwnerCount, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfAccountTxnID, soeOPTIONAL, soeNOTCONSTANT},
{sfRegularKey, soeOPTIONAL, soeNOTCONSTANT},
{sfEmailHash, soeOPTIONAL, soeNOTCONSTANT},
{sfWalletLocator, soeOPTIONAL, soeNOTCONSTANT},
{sfWalletSize, soeOPTIONAL, soeNOTCONSTANT},
{sfMessageKey, soeOPTIONAL, soeNOTCONSTANT},
{sfTransferRate, soeOPTIONAL, soeNOTCONSTANT},
{sfDomain, soeOPTIONAL, soeNOTCONSTANT},
{sfTickSize, soeOPTIONAL, soeNOTCONSTANT},
{sfTicketCount, soeOPTIONAL, soeNOTCONSTANT},
{sfNFTokenMinter, soeOPTIONAL, soeNOTCONSTANT},
{sfMintedNFTokens, soeDEFAULT, soeNOTCONSTANT},
{sfBurnedNFTokens, soeDEFAULT, soeNOTCONSTANT},
{sfFirstNFTokenSequence, soeOPTIONAL, soeCONSTANT},
{sfAMMID, soeOPTIONAL, soeCONSTANT}, // pseudo-account designator
{sfVaultID, soeOPTIONAL, soeCONSTANT}, // pseudo-account designator
{sfLoanBrokerID, soeOPTIONAL, soeCONSTANT}, // 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, soeCONSTANT}, // for owner directories
{sfTakerPaysCurrency, soeOPTIONAL, soeCONSTANT}, // order book directories
{sfTakerPaysIssuer, soeOPTIONAL, soeCONSTANT}, // order book directories
{sfTakerPaysMPT, soeOPTIONAL, soeCONSTANT}, // order book directories
{sfTakerGetsCurrency, soeOPTIONAL, soeCONSTANT}, // order book directories
{sfTakerGetsIssuer, soeOPTIONAL, soeCONSTANT}, // order book directories
{sfTakerGetsMPT, soeOPTIONAL, soeCONSTANT}, // order book directories
{sfExchangeRate, soeOPTIONAL, soeCONSTANT}, // order book directories
{sfIndexes, soeREQUIRED, soeNOTCONSTANT},
{sfRootIndex, soeREQUIRED, soeCONSTANT},
{sfIndexNext, soeOPTIONAL, soeNOTCONSTANT},
{sfIndexPrevious, soeOPTIONAL, soeNOTCONSTANT},
{sfNFTokenID, soeOPTIONAL, soeCONSTANT},
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
{sfDomainID, soeOPTIONAL, soeCONSTANT}, // 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, soeNOTCONSTANT}, // Enabled
{sfMajorities, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfLastLedgerSequence, soeOPTIONAL, soeNOTCONSTANT},
{sfHashes, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfSignatureReward, soeREQUIRED, soeNOTCONSTANT},
{sfMinAccountCreateAmount, soeOPTIONAL, soeNOTCONSTANT},
{sfXChainBridge, soeREQUIRED, soeCONSTANT},
{sfXChainClaimID, soeREQUIRED, soeNOTCONSTANT},
{sfXChainAccountCreateCount, soeREQUIRED, soeNOTCONSTANT},
{sfXChainAccountClaimCount, soeREQUIRED, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfSequence, soeREQUIRED, soeCONSTANT},
{sfTakerPays, soeREQUIRED, soeNOTCONSTANT},
{sfTakerGets, soeREQUIRED, soeNOTCONSTANT},
{sfBookDirectory, soeREQUIRED, soeCONSTANT},
{sfBookNode, soeREQUIRED, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfExpiration, soeOPTIONAL, soeCONSTANT},
{sfDomainID, soeOPTIONAL, soeCONSTANT},
{sfAdditionalBooks, soeOPTIONAL, soeCONSTANT},
}))
/** 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, soeCONSTANT},
{sfAuthorize, soeOPTIONAL, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfAuthorizeCredentials, soeOPTIONAL, soeCONSTANT},
}))
/** 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, soeCONSTANT},
{sfXChainBridge, soeREQUIRED, soeCONSTANT},
{sfXChainClaimID, soeREQUIRED, soeCONSTANT},
{sfOtherChainSource, soeREQUIRED, soeCONSTANT},
{sfXChainClaimAttestations, soeREQUIRED, soeNOTCONSTANT},
{sfSignatureReward, soeREQUIRED, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeNOTCONSTANT},
{sfLowLimit, soeREQUIRED, soeNOTCONSTANT},
{sfHighLimit, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfLowNode, soeOPTIONAL, soeNOTCONSTANT},
{sfLowQualityIn, soeOPTIONAL, soeNOTCONSTANT},
{sfLowQualityOut, soeOPTIONAL, soeNOTCONSTANT},
{sfHighNode, soeOPTIONAL, soeNOTCONSTANT},
{sfHighQualityIn, soeOPTIONAL, soeNOTCONSTANT},
{sfHighQualityOut, soeOPTIONAL, soeNOTCONSTANT},
}))
/** 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, soeNOTCONSTANT},
{sfReferenceFeeUnits, soeOPTIONAL, soeNOTCONSTANT},
{sfReserveBase, soeOPTIONAL, soeNOTCONSTANT},
{sfReserveIncrement, soeOPTIONAL, soeNOTCONSTANT},
// New version uses Amounts
{sfBaseFeeDrops, soeOPTIONAL},
{sfReserveBaseDrops, soeOPTIONAL},
{sfReserveIncrementDrops, soeOPTIONAL},
{sfPreviousTxnID, soeOPTIONAL},
{sfPreviousTxnLgrSeq, soeOPTIONAL},
{sfBaseFeeDrops, soeOPTIONAL, soeNOTCONSTANT},
{sfReserveBaseDrops, soeOPTIONAL, soeNOTCONSTANT},
{sfReserveIncrementDrops, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfXChainBridge, soeREQUIRED, soeCONSTANT},
{sfXChainAccountCreateCount, soeREQUIRED, soeCONSTANT},
{sfXChainCreateAccountAttestations, soeREQUIRED, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfSequence, soeOPTIONAL, soeCONSTANT},
{sfDestination, soeREQUIRED, soeCONSTANT},
{sfAmount, soeREQUIRED, soeCONSTANT},
{sfCondition, soeOPTIONAL, soeCONSTANT},
{sfCancelAfter, soeOPTIONAL, soeCONSTANT},
{sfFinishAfter, soeOPTIONAL, soeCONSTANT},
{sfSourceTag, soeOPTIONAL, soeCONSTANT},
{sfDestinationTag, soeOPTIONAL, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfDestinationNode, soeOPTIONAL, soeCONSTANT},
{sfTransferRate, soeOPTIONAL, soeCONSTANT},
{sfIssuerNode, soeOPTIONAL, soeCONSTANT},
}))
/** 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, soeCONSTANT},
{sfDestination, soeREQUIRED, soeCONSTANT},
{sfSequence, soeOPTIONAL, soeCONSTANT},
{sfAmount, soeREQUIRED, soeNOTCONSTANT},
{sfBalance, soeREQUIRED, soeNOTCONSTANT},
{sfPublicKey, soeREQUIRED, soeCONSTANT},
{sfSettleDelay, soeREQUIRED, soeCONSTANT},
{sfExpiration, soeOPTIONAL, soeNOTCONSTANT},
{sfCancelAfter, soeOPTIONAL, soeCONSTANT},
{sfSourceTag, soeOPTIONAL, soeCONSTANT},
{sfDestinationTag, soeOPTIONAL, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfDestinationNode, soeOPTIONAL, soeCONSTANT},
}))
/** The ledger object which tracks the AMM.
@@ -371,124 +371,124 @@ 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, soeCONSTANT},
{sfTradingFee, soeDEFAULT, soeNOTCONSTANT},
{sfVoteSlots, soeOPTIONAL, soeNOTCONSTANT},
{sfAuctionSlot, soeOPTIONAL, soeNOTCONSTANT},
{sfLPTokenBalance, soeREQUIRED, soeNOTCONSTANT},
{sfAsset, soeREQUIRED, soeCONSTANT},
{sfAsset2, soeREQUIRED, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfSequence, soeREQUIRED, soeCONSTANT},
{sfTransferFee, soeDEFAULT, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfAssetScale, soeDEFAULT, soeNOTCONSTANT},
{sfMaximumAmount, soeOPTIONAL, soeCONSTANT},
{sfOutstandingAmount, soeREQUIRED, soeNOTCONSTANT},
{sfLockedAmount, soeOPTIONAL, soeNOTCONSTANT},
{sfMPTokenMetadata, soeOPTIONAL, soeNOTCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfDomainID, soeOPTIONAL, soeNOTCONSTANT},
{sfMutableFlags, soeDEFAULT, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfMPTokenIssuanceID, soeREQUIRED, soeCONSTANT},
{sfMPTAmount, soeDEFAULT, soeNOTCONSTANT},
{sfLockedAmount, soeOPTIONAL, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfOracleDocumentID, soeOPTIONAL, soeCONSTANT},
{sfProvider, soeREQUIRED, soeCONSTANT},
{sfPriceDataSeries, soeREQUIRED, soeNOTCONSTANT},
{sfAssetClass, soeREQUIRED, soeNOTCONSTANT},
{sfLastUpdateTime, soeREQUIRED, soeNOTCONSTANT},
{sfURI, soeOPTIONAL, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfIssuer, soeREQUIRED, soeCONSTANT},
{sfCredentialType, soeREQUIRED, soeCONSTANT},
{sfExpiration, soeOPTIONAL, soeCONSTANT},
{sfURI, soeOPTIONAL, soeCONSTANT},
{sfIssuerNode, soeREQUIRED, soeCONSTANT},
{sfSubjectNode, soeOPTIONAL, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeCONSTANT},
{sfSequence, soeREQUIRED, soeCONSTANT},
{sfAcceptedCredentials, soeREQUIRED, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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},
{sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED},
{sfAccount, soeREQUIRED, soeCONSTANT},
{sfAuthorize, soeREQUIRED, soeCONSTANT},
{sfPermissions, soeREQUIRED, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
}))
/** 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, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfSequence, soeREQUIRED, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfOwner, soeREQUIRED, soeCONSTANT},
{sfAccount, soeREQUIRED, soeCONSTANT},
{sfData, soeOPTIONAL, soeNOTCONSTANT},
{sfAsset, soeREQUIRED, soeCONSTANT},
{sfAssetsTotal, soeDEFAULT, soeNOTCONSTANT},
{sfAssetsAvailable, soeDEFAULT, soeNOTCONSTANT},
{sfAssetsMaximum, soeDEFAULT, soeNOTCONSTANT},
{sfLossUnrealized, soeDEFAULT, soeNOTCONSTANT},
{sfShareMPTID, soeREQUIRED, soeCONSTANT},
{sfWithdrawalPolicy, soeREQUIRED, soeCONSTANT},
{sfScale, soeDEFAULT, soeCONSTANT},
// no SharesTotal ever (use MPTIssuance.sfOutstandingAmount)
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
}))
@@ -500,23 +500,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, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfSequence, soeREQUIRED, soeCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfVaultNode, soeREQUIRED, soeCONSTANT},
{sfVaultID, soeREQUIRED, soeCONSTANT},
{sfAccount, soeREQUIRED, soeCONSTANT},
{sfOwner, soeREQUIRED, soeCONSTANT},
{sfLoanSequence, soeREQUIRED, soeNOTCONSTANT},
{sfData, soeDEFAULT, soeNOTCONSTANT},
{sfManagementFeeRate, soeDEFAULT, soeCONSTANT},
{sfOwnerCount, soeDEFAULT, soeNOTCONSTANT},
{sfDebtTotal, soeDEFAULT, soeNOTCONSTANT},
{sfDebtMaximum, soeDEFAULT, soeNOTCONSTANT},
{sfCoverAvailable, soeDEFAULT, soeNOTCONSTANT},
{sfCoverRateMinimum, soeDEFAULT, soeCONSTANT},
{sfCoverRateLiquidation, soeDEFAULT, soeCONSTANT},
}))
/** A ledger object representing a loan between a Borrower and a Loan Broker
@@ -524,27 +524,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, soeNOTCONSTANT},
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
{sfLoanBrokerNode, soeREQUIRED, soeCONSTANT},
{sfLoanBrokerID, soeREQUIRED, soeCONSTANT},
{sfLoanSequence, soeREQUIRED, soeCONSTANT},
{sfBorrower, soeREQUIRED, soeCONSTANT},
{sfLoanOriginationFee, soeDEFAULT, soeCONSTANT},
{sfLoanServiceFee, soeDEFAULT, soeCONSTANT},
{sfLatePaymentFee, soeDEFAULT, soeCONSTANT},
{sfClosePaymentFee, soeDEFAULT, soeCONSTANT},
{sfOverpaymentFee, soeDEFAULT, soeCONSTANT},
{sfInterestRate, soeDEFAULT, soeCONSTANT},
{sfLateInterestRate, soeDEFAULT, soeCONSTANT},
{sfCloseInterestRate, soeDEFAULT, soeCONSTANT},
{sfOverpaymentInterestRate, soeDEFAULT, soeCONSTANT},
{sfStartDate, soeREQUIRED, soeCONSTANT},
{sfPaymentInterval, soeREQUIRED, soeCONSTANT},
{sfGracePeriod, soeDEFAULT, soeCONSTANT},
{sfPreviousPaymentDueDate, soeDEFAULT, soeNOTCONSTANT},
{sfNextPaymentDueDate, soeDEFAULT, soeNOTCONSTANT},
// The loan object tracks these values:
//
// - PaymentRemaining: The number of payments left in the loan. When it
@@ -592,17 +592,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, soeNOTCONSTANT},
{sfPeriodicPayment, soeREQUIRED, soeNOTCONSTANT},
{sfPrincipalOutstanding, soeDEFAULT, soeNOTCONSTANT},
{sfTotalValueOutstanding, soeDEFAULT, soeNOTCONSTANT},
{sfManagementFeeOutstanding, soeDEFAULT, soeNOTCONSTANT},
// 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, soeCONSTANT},
}))
#undef EXPAND

View File

@@ -11,6 +11,7 @@ float-cast-overflow:external
float-divide-by-zero:external
function:external
implicit-integer-sign-change:external
implicit-signed-integer-truncation::external
implicit-signed-integer-truncation:external
implicit-unsigned-integer-truncation:external
integer-divide-by-zero:external
@@ -70,15 +71,145 @@ vla-bound:boost
vptr_check:boost
vptr:boost
# Google protobuf - intentional overflows in hash functions
# Google protobuf
undefined:protobuf
# Suppress UBSan errors in xrpld code by source file path
undefined:src/libxrpl/basics/base64.cpp
undefined:src/libxrpl/basics/Number.cpp
undefined:src/libxrpl/beast/utility/beast_Journal.cpp
undefined:src/libxrpl/crypto/RFC1751.cpp
undefined:src/libxrpl/ledger/ApplyView.cpp
undefined:src/libxrpl/ledger/View.cpp
undefined:src/libxrpl/protocol/Permissions.cpp
undefined:src/libxrpl/protocol/STAmount.cpp
undefined:src/libxrpl/protocol/STPathSet.cpp
undefined:src/libxrpl/protocol/tokens.cpp
undefined:src/libxrpl/shamap/SHAMap.cpp
undefined:src/test/app/Batch_test.cpp
undefined:src/test/app/Invariants_test.cpp
undefined:src/test/app/NFToken_test.cpp
undefined:src/test/app/Offer_test.cpp
undefined:src/test/app/Path_test.cpp
undefined:src/test/basics/XRPAmount_test.cpp
undefined:src/test/beast/LexicalCast_test.cpp
undefined:src/test/jtx/impl/acctdelete.cpp
undefined:src/test/ledger/SkipList_test.cpp
undefined:src/test/rpc/Subscribe_test.cpp
undefined:src/tests/libxrpl/basics/RangeSet.cpp
undefined:src/xrpld/app/main/BasicApp.cpp
undefined:src/xrpld/app/main/BasicApp.cpp
undefined:src/xrpld/app/misc/detail/AmendmentTable.cpp
undefined:src/xrpld/app/misc/NetworkOPs.cpp
undefined:src/libxrpl/json/json_value.cpp
undefined:src/xrpld/app/paths/detail/StrandFlow.h
undefined:src/xrpld/app/tx/detail/NFTokenMint.cpp
undefined:src/xrpld/app/tx/detail/OracleSet.cpp
undefined:src/xrpld/core/detail/JobQueue.cpp
undefined:src/xrpld/core/detail/Workers.cpp
undefined:src/xrpld/rpc/detail/Role.cpp
undefined:src/xrpld/rpc/handlers/GetAggregatePrice.cpp
undefined:xrpl/basics/base_uint.h
undefined:xrpl/basics/DecayingSample.h
undefined:xrpl/beast/test/yield_to.h
undefined:xrpl/beast/xor_shift_engine.h
undefined:xrpl/nodestore/detail/varint.h
undefined:xrpl/peerfinder/detail/Counts.h
undefined:xrpl/protocol/nft.h
# basic_string.h:483:51: runtime error: unsigned integer overflow
unsigned-integer-overflow:basic_string.h
unsigned-integer-overflow:bits/chrono.h
unsigned-integer-overflow:bits/random.h
unsigned-integer-overflow:bits/random.tcc
unsigned-integer-overflow:bits/stl_algobase.h
unsigned-integer-overflow:bits/uniform_int_dist.h
unsigned-integer-overflow:string_view
# runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'std::size_t' (aka 'unsigned long')
unsigned-integer-overflow:src/libxrpl/basics/base64.cpp
unsigned-integer-overflow:src/libxrpl/basics/Number.cpp
unsigned-integer-overflow:src/libxrpl/crypto/RFC1751.cpp
unsigned-integer-overflow:rc/libxrpl/json/json_value.cpp
unsigned-integer-overflow:src/libxrpl/ledger/ApplyView.cpp
unsigned-integer-overflow:src/libxrpl/ledger/View.cpp
unsigned-integer-overflow:src/libxrpl/protocol/Permissions.cpp
unsigned-integer-overflow:src/libxrpl/protocol/STAmount.cpp
unsigned-integer-overflow:src/libxrpl/protocol/STPathSet.cpp
unsigned-integer-overflow:src/libxrpl/protocol/tokens.cpp
unsigned-integer-overflow:src/libxrpl/shamap/SHAMap.cpp
unsigned-integer-overflow:src/test/app/Batch_test.cpp
unsigned-integer-overflow:src/test/app/Invariants_test.cpp
unsigned-integer-overflow:src/test/app/NFToken_test.cpp
unsigned-integer-overflow:src/test/app/Offer_test.cpp
unsigned-integer-overflow:src/test/app/Path_test.cpp
unsigned-integer-overflow:src/test/basics/XRPAmount_test.cpp
unsigned-integer-overflow:src/test/beast/LexicalCast_test.cpp
unsigned-integer-overflow:src/test/jtx/impl/acctdelete.cpp
unsigned-integer-overflow:src/test/ledger/SkipList_test.cpp
unsigned-integer-overflow:src/test/rpc/Subscribe_test.cpp
unsigned-integer-overflow:src/tests/libxrpl/basics/RangeSet.cpp
unsigned-integer-overflow:src/xrpld/app/main/BasicApp.cpp
unsigned-integer-overflow:src/xrpld/app/misc/detail/AmendmentTable.cpp
unsigned-integer-overflow:src/xrpld/app/misc/NetworkOPs.cpp
unsigned-integer-overflow:src/xrpld/app/paths/detail/StrandFlow.h
unsigned-integer-overflow:src/xrpld/app/tx/detail/NFTokenMint.cpp
unsigned-integer-overflow:src/xrpld/app/tx/detail/OracleSet.cpp
unsigned-integer-overflow:src/xrpld/rpc/detail/Role.cpp
unsigned-integer-overflow:src/xrpld/rpc/handlers/GetAggregatePrice.cpp
unsigned-integer-overflow:xrpl/basics/base_uint.h
unsigned-integer-overflow:xrpl/basics/DecayingSample.h
unsigned-integer-overflow:xrpl/beast/test/yield_to.h
unsigned-integer-overflow:xrpl/beast/xor_shift_engine.h
unsigned-integer-overflow:xrpl/nodestore/detail/varint.h
unsigned-integer-overflow:xrpl/peerfinder/detail/Counts.h
unsigned-integer-overflow:xrpl/protocol/nft.h
# Xrpld intentional overflows and operations
# STAmount uses intentional negation of INT64_MIN and overflow in arithmetic
signed-integer-overflow:src/libxrpl/protocol/STAmount.cpp
unsigned-integer-overflow:src/libxrpl/protocol/STAmount.cpp
# XRPAmount test intentional overflows
signed-integer-overflow:src/test/basics/XRPAmount_test.cpp
# Peerfinder intentional overflow in counter arithmetic
unsigned-integer-overflow:src/xrpld/peerfinder/detail/Counts.h
# Signed integer overflow suppressions
signed-integer-overflow:src/test/beast/LexicalCast_test.cpp
# External library suppressions
unsigned-integer-overflow:nudb/detail/xxhash.hpp
# Loan_test.cpp intentional underflow in test arithmetic
unsigned-integer-overflow:src/test/app/Loan_test.cpp
undefined:src/test/app/Loan_test.cpp
# Source tree restructured paths (libxrpl/tx/transactors/)
# These duplicate the xrpld/app/tx/detail entries above for the new layout
unsigned-integer-overflow:src/libxrpl/tx/transactors/oracle/OracleSet.cpp
undefined:src/libxrpl/tx/transactors/oracle/OracleSet.cpp
unsigned-integer-overflow:src/libxrpl/tx/transactors/nft/NFTokenMint.cpp
undefined:src/libxrpl/tx/transactors/nft/NFTokenMint.cpp
# Protobuf intentional overflows in hash functions
# Protobuf uses intentional unsigned overflow for hash computation (stringpiece.h:393)
unsigned-integer-overflow:google/protobuf/stubs/stringpiece.h
# gRPC intentional overflows in timer calculations
# gRPC intentional overflows
# gRPC uses intentional overflow in timer calculations
unsigned-integer-overflow:grpc
unsigned-integer-overflow:timer_manager.cc
# RocksDB intentional unsigned integer overflows in hash functions and CRC calculations
# Standard library intentional overflows
# These are intentional overflows in random number generation and character conversion
unsigned-integer-overflow:__random/seed_seq.h
unsigned-integer-overflow:__charconv/traits.h
# Suppress errors in RocksDB
# RocksDB uses intentional unsigned integer overflows in hash functions and CRC calculations
unsigned-integer-overflow:rocks*/*/util/xxhash.h
unsigned-integer-overflow:rocks*/*/util/xxph3.h
unsigned-integer-overflow:rocks*/*/util/hash.cc
@@ -90,14 +221,13 @@ unsigned-integer-overflow:rocks*/*/table/format.cc
unsigned-integer-overflow:rocks*/*/table/block_based/block_based_table_builder.cc
unsigned-integer-overflow:rocks*/*/table/block_based/reader_common.cc
unsigned-integer-overflow:rocks*/*/db/version_set.cc
# RocksDB misaligned loads (intentional for performance on ARM64)
alignment:rocks*/*/util/crc32c_arm64.cc
undefined:rocks*/*/util/crc32c_arm64.cc
undefined:rocks*/*/util/xxhash.h
# nudb intentional overflows in hash functions
unsigned-integer-overflow:nudb/detail/xxhash.hpp
alignment:nudb/detail/xxhash.hpp
undefined:nudb
# Snappy compression library intentional overflows
unsigned-integer-overflow:snappy.cc
@@ -109,40 +239,10 @@ unsigned-integer-overflow:absl/base/internal/low_level_alloc.cc
unsigned-integer-overflow:absl/hash/internal/hash.h
unsigned-integer-overflow:absl/container/internal/raw_hash_set.h
# Standard library intentional overflows
unsigned-integer-overflow:basic_string.h
unsigned-integer-overflow:bits/chrono.h
unsigned-integer-overflow:bits/random.h
unsigned-integer-overflow:bits/random.tcc
unsigned-integer-overflow:bits/stl_algobase.h
unsigned-integer-overflow:bits/uniform_int_dist.h
unsigned-integer-overflow:string_view
unsigned-integer-overflow:__random/seed_seq.h
unsigned-integer-overflow:__charconv/traits.h
# Standard library intentional overflows in chrono duration arithmetic
unsigned-integer-overflow:__chrono/duration.h
# =============================================================================
# Rippled code suppressions
# =============================================================================
# Signed integer negation (-value) in amount types.
# INT64_MIN cannot occur in practice due to domain invariants (mantissa ranges
# are well within int64_t bounds), but UBSan flags the pattern as potential
# signed overflow. Narrowed to operator- to avoid suppressing unrelated
# overflows anywhere in a stack trace containing these type names.
signed-integer-overflow:operator-*IOUAmount*
signed-integer-overflow:operator-*XRPAmount*
signed-integer-overflow:operator-*MPTAmount*
signed-integer-overflow:operator-*STAmount*
# STAmount::operator+ signed addition — operands are bounded by total supply
# (~10^17 for XRP, ~10^18 for MPT) so overflow cannot occur in practice.
signed-integer-overflow:operator+*STAmount*
# STAmount::getRate uses unsigned shift and addition
unsigned-integer-overflow:*STAmount*getRate*
# STAmount::serialize uses unsigned bitwise operations
unsigned-integer-overflow:*STAmount*serialize*
# nft::cipheredTaxon uses intentional uint32 wraparound (LCG permutation)
unsigned-integer-overflow:cipheredTaxon
# Suppress undefined errors in RocksDB and nudb
undefined:rocks.*/*/util/crc32c_arm64.cc
undefined:rocks.*/*/util/xxhash.h
undefined:nudb

View File

@@ -107,7 +107,7 @@ encode(void* dest, void const* src, std::size_t len)
char const* in = static_cast<char const*>(src);
auto const tab = base64::get_alphabet();
for (auto n = len / 3; n > 0; --n)
for (auto n = len / 3; n != 0u; --n)
{
*out++ = tab[(in[0] & 0xfc) >> 2];
*out++ = tab[((in[0] & 0x03) << 4) + ((in[1] & 0xf0) >> 4)];

View File

@@ -13,152 +13,154 @@ InnerObjectFormats::InnerObjectFormats()
add(sfSignerEntry.jsonName,
sfSignerEntry.getCode(),
{
{sfAccount, soeREQUIRED},
{sfSignerWeight, soeREQUIRED},
{sfWalletLocator, soeOPTIONAL},
{sfAccount, soeREQUIRED, soeCONSTANT},
{sfSignerWeight, soeREQUIRED, soeNOTCONSTANT},
{sfWalletLocator, soeOPTIONAL, soeNOTCONSTANT},
});
add(sfSigner.jsonName,
sfSigner.getCode(),
{
{sfAccount, soeREQUIRED},
{sfSigningPubKey, soeREQUIRED},
{sfTxnSignature, soeREQUIRED},
{sfAccount, soeREQUIRED, soeCONSTANT},
{sfSigningPubKey, soeREQUIRED, soeCONSTANT},
{sfTxnSignature, soeREQUIRED, soeCONSTANT},
});
add(sfMajority.jsonName,
sfMajority.getCode(),
{
{sfAmendment, soeREQUIRED},
{sfCloseTime, soeREQUIRED},
{sfAmendment, soeREQUIRED, soeCONSTANT},
{sfCloseTime, soeREQUIRED, soeCONSTANT},
});
add(sfDisabledValidator.jsonName,
sfDisabledValidator.getCode(),
{
{sfPublicKey, soeREQUIRED},
{sfFirstLedgerSequence, soeREQUIRED},
{sfPublicKey, soeREQUIRED, soeCONSTANT},
{sfFirstLedgerSequence, soeREQUIRED, soeCONSTANT},
});
add(sfNFToken.jsonName,
sfNFToken.getCode(),
{
{sfNFTokenID, soeREQUIRED},
{sfURI, soeOPTIONAL},
{sfNFTokenID, soeREQUIRED, soeCONSTANT},
{sfURI, soeOPTIONAL, soeNOTCONSTANT},
});
add(sfVoteEntry.jsonName,
sfVoteEntry.getCode(),
{
{sfAccount, soeREQUIRED},
{sfTradingFee, soeDEFAULT},
{sfVoteWeight, soeREQUIRED},
{sfAccount, soeREQUIRED, soeCONSTANT},
{sfTradingFee, soeDEFAULT, soeNOTCONSTANT},
{sfVoteWeight, soeREQUIRED, soeNOTCONSTANT},
});
add(sfAuctionSlot.jsonName,
sfAuctionSlot.getCode(),
{{sfAccount, soeREQUIRED},
{sfExpiration, soeREQUIRED},
{sfDiscountedFee, soeDEFAULT},
{sfPrice, soeREQUIRED},
{sfAuthAccounts, soeOPTIONAL}});
{{sfAccount, soeREQUIRED, soeCONSTANT},
{sfExpiration, soeREQUIRED, soeCONSTANT},
{sfDiscountedFee, soeDEFAULT, soeCONSTANT},
{sfPrice, soeREQUIRED, soeCONSTANT},
{sfAuthAccounts, soeOPTIONAL, soeCONSTANT}});
add(sfXChainClaimAttestationCollectionElement.jsonName,
sfXChainClaimAttestationCollectionElement.getCode(),
{
{sfAttestationSignerAccount, soeREQUIRED},
{sfPublicKey, soeREQUIRED},
{sfSignature, soeREQUIRED},
{sfAmount, soeREQUIRED},
{sfAccount, soeREQUIRED},
{sfAttestationRewardAccount, soeREQUIRED},
{sfWasLockingChainSend, soeREQUIRED},
{sfXChainClaimID, soeREQUIRED},
{sfDestination, soeOPTIONAL},
{sfAttestationSignerAccount, soeREQUIRED, soeCONSTANT},
{sfPublicKey, soeREQUIRED, soeCONSTANT},
{sfSignature, soeREQUIRED, soeCONSTANT},
{sfAmount, soeREQUIRED, soeCONSTANT},
{sfAccount, soeREQUIRED, soeCONSTANT},
{sfAttestationRewardAccount, soeREQUIRED, soeCONSTANT},
{sfWasLockingChainSend, soeREQUIRED, soeCONSTANT},
{sfXChainClaimID, soeREQUIRED, soeCONSTANT},
{sfDestination, soeOPTIONAL, soeCONSTANT},
});
add(sfXChainCreateAccountAttestationCollectionElement.jsonName,
sfXChainCreateAccountAttestationCollectionElement.getCode(),
{
{sfAttestationSignerAccount, soeREQUIRED},
{sfPublicKey, soeREQUIRED},
{sfSignature, soeREQUIRED},
{sfAmount, soeREQUIRED},
{sfAccount, soeREQUIRED},
{sfAttestationRewardAccount, soeREQUIRED},
{sfWasLockingChainSend, soeREQUIRED},
{sfXChainAccountCreateCount, soeREQUIRED},
{sfDestination, soeREQUIRED},
{sfSignatureReward, soeREQUIRED},
{sfAttestationSignerAccount, soeREQUIRED, soeCONSTANT},
{sfPublicKey, soeREQUIRED, soeCONSTANT},
{sfSignature, soeREQUIRED, soeCONSTANT},
{sfAmount, soeREQUIRED, soeCONSTANT},
{sfAccount, soeREQUIRED, soeCONSTANT},
{sfAttestationRewardAccount, soeREQUIRED, soeCONSTANT},
{sfWasLockingChainSend, soeREQUIRED, soeCONSTANT},
{sfXChainAccountCreateCount, soeREQUIRED, soeCONSTANT},
{sfDestination, soeREQUIRED, soeCONSTANT},
{sfSignatureReward, soeREQUIRED, soeCONSTANT},
});
add(sfXChainClaimProofSig.jsonName,
sfXChainClaimProofSig.getCode(),
{
{sfAttestationSignerAccount, soeREQUIRED},
{sfPublicKey, soeREQUIRED},
{sfAmount, soeREQUIRED},
{sfAttestationRewardAccount, soeREQUIRED},
{sfWasLockingChainSend, soeREQUIRED},
{sfDestination, soeOPTIONAL},
{sfAttestationSignerAccount, soeREQUIRED, soeCONSTANT},
{sfPublicKey, soeREQUIRED, soeCONSTANT},
{sfAmount, soeREQUIRED, soeCONSTANT},
{sfAttestationRewardAccount, soeREQUIRED, soeCONSTANT},
{sfWasLockingChainSend, soeREQUIRED, soeCONSTANT},
{sfDestination, soeOPTIONAL, soeCONSTANT},
});
add(sfXChainCreateAccountProofSig.jsonName,
sfXChainCreateAccountProofSig.getCode(),
{
{sfAttestationSignerAccount, soeREQUIRED},
{sfPublicKey, soeREQUIRED},
{sfAmount, soeREQUIRED},
{sfSignatureReward, soeREQUIRED},
{sfAttestationRewardAccount, soeREQUIRED},
{sfWasLockingChainSend, soeREQUIRED},
{sfDestination, soeREQUIRED},
{sfAttestationSignerAccount, soeREQUIRED, soeCONSTANT},
{sfPublicKey, soeREQUIRED, soeCONSTANT},
{sfAmount, soeREQUIRED, soeCONSTANT},
{sfSignatureReward, soeREQUIRED, soeCONSTANT},
{sfAttestationRewardAccount, soeREQUIRED, soeCONSTANT},
{sfWasLockingChainSend, soeREQUIRED, soeCONSTANT},
{sfDestination, soeREQUIRED, soeCONSTANT},
});
add(sfAuthAccount.jsonName,
sfAuthAccount.getCode(),
{
{sfAccount, soeREQUIRED},
{sfAccount, soeREQUIRED, soeCONSTANT},
});
add(sfPriceData.jsonName,
sfPriceData.getCode(),
{
{sfBaseAsset, soeREQUIRED},
{sfQuoteAsset, soeREQUIRED},
{sfAssetPrice, soeOPTIONAL},
{sfScale, soeDEFAULT},
{sfBaseAsset, soeREQUIRED, soeCONSTANT},
{sfQuoteAsset, soeREQUIRED, soeCONSTANT},
{sfAssetPrice, soeOPTIONAL, soeCONSTANT},
{sfScale, soeDEFAULT, soeCONSTANT},
});
add(sfCredential.jsonName,
sfCredential.getCode(),
{
{sfIssuer, soeREQUIRED},
{sfCredentialType, soeREQUIRED},
{sfIssuer, soeREQUIRED, soeCONSTANT},
{sfCredentialType, soeREQUIRED, soeCONSTANT},
});
add(sfPermission.jsonName.c_str(), sfPermission.getCode(), {{sfPermissionValue, soeREQUIRED}});
add(sfPermission.jsonName.c_str(),
sfPermission.getCode(),
{{sfPermissionValue, soeREQUIRED, soeCONSTANT}});
add(sfBatchSigner.jsonName.c_str(),
sfBatchSigner.getCode(),
{{sfAccount, soeREQUIRED},
{sfSigningPubKey, soeOPTIONAL},
{sfTxnSignature, soeOPTIONAL},
{sfSigners, soeOPTIONAL}});
{{sfAccount, soeREQUIRED, soeCONSTANT},
{sfSigningPubKey, soeOPTIONAL, soeCONSTANT},
{sfTxnSignature, soeOPTIONAL, soeCONSTANT},
{sfSigners, soeOPTIONAL, soeCONSTANT}});
add(sfBook.jsonName,
sfBook.getCode(),
{
{sfBookDirectory, soeREQUIRED},
{sfBookNode, soeREQUIRED},
{sfBookDirectory, soeREQUIRED, soeCONSTANT},
{sfBookNode, soeREQUIRED, soeCONSTANT},
});
add(sfCounterpartySignature.jsonName,
sfCounterpartySignature.getCode(),
{
{sfSigningPubKey, soeOPTIONAL},
{sfTxnSignature, soeOPTIONAL},
{sfSigners, soeOPTIONAL},
{sfSigningPubKey, soeOPTIONAL, soeCONSTANT},
{sfTxnSignature, soeOPTIONAL, soeCONSTANT},
{sfSigners, soeOPTIONAL, soeCONSTANT},
});
}

View File

@@ -12,9 +12,9 @@ std::vector<SOElement> const&
LedgerFormats::getCommonFields()
{
static auto const commonFields = std::vector<SOElement>{
{sfLedgerIndex, soeOPTIONAL},
{sfLedgerEntryType, soeREQUIRED},
{sfFlags, soeREQUIRED},
{sfLedgerIndex, soeOPTIONAL, soeCONSTANT},
{sfLedgerEntryType, soeREQUIRED, soeCONSTANT},
{sfFlags, soeREQUIRED, soeNOTCONSTANT},
};
return commonFields;
}

View File

@@ -17,6 +17,7 @@
#include <xrpl/protocol/MPTIssue.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/SOTemplate.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/STNumber.h> // IWYU pragma: keep
@@ -945,6 +946,49 @@ NoModifiedUnmodifiableFields::visitEntry(
changedEntries_.emplace(before, after);
}
// Check whether any constant (or unannotated) fields in the given template
// have been modified between before and after. Recurses into STObject and
// STArray fields using InnerObjectFormats.
static bool
hasConstantFieldChanged(STObject const& before, STObject const& after, SOTemplate const& tmpl)
{
for (auto const& elem : tmpl)
{
auto const& sf = elem.sField();
auto const constant = elem.constant();
auto const* bField = before.peekAtPField(sf);
auto const* aField = after.peekAtPField(sf);
bool const bPresent = (bField != nullptr) && bField->getSType() != STI_NOTPRESENT;
bool const aPresent = (aField != nullptr) && aField->getSType() != STI_NOTPRESENT;
XRPL_ASSERT(
constant != soeCONSTANTINVALID, "xrpl::hasConstantFieldChanged : constant is invalid");
if (constant == soeCONSTANT)
{
if (elem.style() == soeOPTIONAL)
{
// Optional constant fields may be added or removed,
// but their value must not change once present.
if (bPresent && aPresent && *bField != *aField)
return true;
}
else
{
// Required and default constant fields must not
// change at all — including transitions between
// default (not-present) and explicit values.
if (bPresent != aPresent || (bPresent && aPresent && *bField != *aField))
return true;
}
}
// soeNOTCONSTANT fields may change freely — no recursion
// into inner objects/arrays is needed because the parent
// field explicitly allows changes to its entire contents.
}
return false;
}
bool
NoModifiedUnmodifiableFields::finalize(
STTx const& tx,
@@ -958,23 +1002,37 @@ NoModifiedUnmodifiableFields::finalize(
bool const afterField = after->isFieldPresent(field);
return beforeField != afterField || (afterField && before->at(field) != after->at(field));
};
bool const useTemplate = view.rules().enabled(featureInvariantsV1_1);
for (auto const& slePair : changedEntries_)
{
auto const& before = slePair.first;
auto const& after = slePair.second;
auto const type = after->getType();
// New template-based check
bool bad = false;
[[maybe_unused]] bool enforce = false;
{
auto const* format = LedgerFormats::getInstance().findByType(type);
if (format != nullptr)
bad = hasConstantFieldChanged(*before, *after, format->getSOTemplate());
// sfLedgerIndex is a non-serialized (discardable) field
// that is not reliably present via peekAtPField, so we
// check it explicitly.
if (!bad)
bad = fieldChanged(before, after, sfLedgerIndex);
}
// Old hardcoded check
bool badOld = false;
[[maybe_unused]] bool enforceOld = false;
switch (type)
{
case ltLOAN_BROKER:
/*
* We check this invariant regardless of lending protocol
* amendment status, allowing for detection and logging of
* potential issues even when the amendment is disabled.
*/
enforce = view.rules().enabled(featureLendingProtocol);
bad = fieldChanged(before, after, sfLedgerEntryType) ||
enforceOld = view.rules().enabled(featureLendingProtocol);
badOld = fieldChanged(before, after, sfLedgerEntryType) ||
fieldChanged(before, after, sfLedgerIndex) ||
fieldChanged(before, after, sfSequence) ||
fieldChanged(before, after, sfOwnerNode) ||
@@ -987,13 +1045,8 @@ NoModifiedUnmodifiableFields::finalize(
fieldChanged(before, after, sfCoverRateLiquidation);
break;
case ltLOAN:
/*
* We check this invariant regardless of lending protocol
* amendment status, allowing for detection and logging of
* potential issues even when the amendment is disabled.
*/
enforce = view.rules().enabled(featureLendingProtocol);
bad = fieldChanged(before, after, sfLedgerEntryType) ||
enforceOld = view.rules().enabled(featureLendingProtocol);
badOld = fieldChanged(before, after, sfLedgerEntryType) ||
fieldChanged(before, after, sfLedgerIndex) ||
fieldChanged(before, after, sfSequence) ||
fieldChanged(before, after, sfOwnerNode) ||
@@ -1015,28 +1068,28 @@ NoModifiedUnmodifiableFields::finalize(
fieldChanged(before, after, sfLoanScale);
break;
default:
/*
* We check this invariant regardless of lending protocol
* amendment status, allowing for detection and logging of
* potential issues even when the amendment is disabled.
*
* We use the lending protocol as a gate, even though
* all transactions are affected because that's when it
* was added.
*/
enforce = view.rules().enabled(featureLendingProtocol);
bad = fieldChanged(before, after, sfLedgerEntryType) ||
enforceOld = view.rules().enabled(featureLendingProtocol);
badOld = fieldChanged(before, after, sfLedgerEntryType) ||
fieldChanged(before, after, sfLedgerIndex);
}
XRPL_ASSERT(
!bad || enforce,
"xrpl::NoModifiedUnmodifiableFields::finalize : no bad "
"changes or enforce invariant");
if (bad)
{
JLOG(j.fatal()) << "Invariant failed: changed an unchangeable field for "
<< tx.getTransactionID();
if (enforce)
if (useTemplate)
return false;
}
XRPL_ASSERT(
!badOld || enforceOld,
"xrpl::NoModifiedUnmodifiableFields::finalize : no bad "
"changes or enforce invariant");
if (badOld)
{
JLOG(j.fatal()) << "Invariant failed: changed an unchangeable field for "
<< tx.getTransactionID();
if (!useTemplate && enforceOld)
return false;
}
}

View File

@@ -2108,10 +2108,12 @@ class Invariants_test : public beast::unit_test::suite
// TODO: Loan Object
// Template-based checks: common constant fields on AccountRoot
{
auto const mods = std::to_array<std::function<void(SLE::pointer&)>>({
[](SLE::pointer& sle) { sle->at(sfLedgerEntryType) += 1; },
[](SLE::pointer& sle) { sle->at(sfLedgerIndex) = uint256(1u); },
[](SLE::pointer& sle) { sle->at(sfAccount) = Account("other").id(); },
});
for (auto const& mod : mods)
@@ -2128,6 +2130,69 @@ class Invariants_test : public beast::unit_test::suite
});
}
}
// Template-based checks: soeNOTCONSTANT field
// (sfPreviousTxnID) on AccountRoot should NOT fail when
// modified — no invariant checks this field.
{
doInvariantCheck(
{},
[&](Account const& A1, Account const&, ApplyContext& ac) {
auto sle = ac.view().peek(keylet::account(A1.id()));
if (!sle)
return false;
sle->at(sfPreviousTxnID) = uint256(42u);
ac.view().update(sle);
return true;
},
XRPAmount{},
STTx{ttACCOUNT_SET, [](STObject&) {}},
{tesSUCCESS, tesSUCCESS});
}
// Without featureInvariantsV1_1, old hardcoded path should
// still catch sfLedgerEntryType/sfLedgerIndex changes
{
auto const mods = std::to_array<std::function<void(SLE::pointer&)>>({
[](SLE::pointer& sle) { sle->at(sfLedgerEntryType) += 1; },
[](SLE::pointer& sle) { sle->at(sfLedgerIndex) = uint256(1u); },
});
for (auto const& mod : mods)
{
doInvariantCheck(
Env(*this, defaultAmendments() - featureInvariantsV1_1),
{{"changed an unchangeable field"}},
[&](Account const& A1, Account const&, ApplyContext& ac) {
auto sle = ac.view().peek(keylet::account(A1.id()));
if (!sle)
return false;
mod(sle);
ac.view().update(sle);
return true;
});
}
}
// Without featureInvariantsV1_1, modifying a soeCONSTANT field
// that is NOT sfLedgerEntryType/sfLedgerIndex on a non-loan
// type should NOT fail (old code doesn't check it)
{
doInvariantCheck(
Env(*this, defaultAmendments() - featureInvariantsV1_1),
{},
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
auto sle = ac.view().peek(keylet::account(A1.id()));
if (!sle)
return false;
sle->at(sfAccount) = A2.id();
ac.view().update(sle);
return true;
},
XRPAmount{},
STTx{ttACCOUNT_SET, [](STObject&) {}},
{tesSUCCESS, tesSUCCESS});
}
}
void
@@ -2924,7 +2989,7 @@ class Invariants_test : public beast::unit_test::suite
TxAccount::A2);
doInvariantCheck(
{"violation of vault immutable data"},
{"violation of vault immutable data", "changed an unchangeable field"},
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
auto const keylet = keylet::vault(A1.id(), ac.view().seq());
auto sleVault = ac.view().peek(keylet);
@@ -2936,11 +3001,11 @@ class Invariants_test : public beast::unit_test::suite
},
XRPAmount{},
STTx{ttVAULT_SET, [](STObject& tx) {}},
{tecINVARIANT_FAILED, tecINVARIANT_FAILED},
{tecINVARIANT_FAILED, tefINVARIANT_FAILED},
precloseXrp);
doInvariantCheck(
{"violation of vault immutable data"},
{"violation of vault immutable data", "changed an unchangeable field"},
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
auto const keylet = keylet::vault(A1.id(), ac.view().seq());
auto sleVault = ac.view().peek(keylet);
@@ -2952,11 +3017,11 @@ class Invariants_test : public beast::unit_test::suite
},
XRPAmount{},
STTx{ttVAULT_SET, [](STObject& tx) {}},
{tecINVARIANT_FAILED, tecINVARIANT_FAILED},
{tecINVARIANT_FAILED, tefINVARIANT_FAILED},
precloseXrp);
doInvariantCheck(
{"violation of vault immutable data"},
{"violation of vault immutable data", "changed an unchangeable field"},
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
auto const keylet = keylet::vault(A1.id(), ac.view().seq());
auto sleVault = ac.view().peek(keylet);
@@ -2968,7 +3033,7 @@ class Invariants_test : public beast::unit_test::suite
},
XRPAmount{},
STTx{ttVAULT_SET, [](STObject& tx) {}},
{tecINVARIANT_FAILED, tecINVARIANT_FAILED},
{tecINVARIANT_FAILED, tefINVARIANT_FAILED},
precloseXrp);
doInvariantCheck(
@@ -3233,7 +3298,8 @@ class Invariants_test : public beast::unit_test::suite
{"create operation must not have updated a vault",
"shares issuer and vault pseudo-account must be the same",
"shares issuer must be a pseudo-account",
"shares issuer pseudo-account must point back to the vault"},
"shares issuer pseudo-account must point back to the vault",
"changed an unchangeable field"},
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
auto const keylet = keylet::vault(A1.id(), ac.view().seq());
auto sleVault = ac.view().peek(keylet);
@@ -3249,7 +3315,7 @@ class Invariants_test : public beast::unit_test::suite
},
XRPAmount{},
STTx{ttVAULT_CREATE, [](STObject&) {}},
{tecINVARIANT_FAILED, tecINVARIANT_FAILED},
{tecINVARIANT_FAILED, tefINVARIANT_FAILED},
[&](Account const& A1, Account const& A2, Env& env) {
Vault const vault{env};
auto [tx, keylet] = vault.create({.owner = A1, .asset = xrpIssue()});

View File

@@ -24,7 +24,7 @@ public:
testInteger(IntType in)
{
std::string s;
IntType out = static_cast<IntType>(~in); // Ensure out != in
IntType out(in + 1);
expect(lexicalCastChecked(s, in));
expect(lexicalCastChecked(out, s));

View File

@@ -12,10 +12,10 @@ BasicApp::BasicApp(std::size_t numberOfThreads)
work_.emplace(boost::asio::make_work_guard(io_context_));
threads_.reserve(numberOfThreads);
for (std::size_t i = 0; i < numberOfThreads; ++i)
while ((numberOfThreads--) != 0u)
{
threads_.emplace_back([this, i]() {
beast::setCurrentThreadName("io svc #" + std::to_string(i));
threads_.emplace_back([this, numberOfThreads]() {
beast::setCurrentThreadName("io svc #" + std::to_string(numberOfThreads));
this->io_context_.run();
});
}

View File

@@ -8,9 +8,6 @@
namespace xrpl::PeerFinder {
/** Direction of a slot count adjustment. */
enum class CountAdjustment : int { Decrement = -1, Increment = 1 };
/** Manages the count of available connections for the various slots. */
class Counts
{
@@ -19,14 +16,14 @@ public:
void
add(Slot const& s)
{
adjust(s, CountAdjustment::Increment);
adjust(s, 1);
}
/** Removes the slot state and properties from the slot counts. */
void
remove(Slot const& s)
{
adjust(s, CountAdjustment::Decrement);
adjust(s, -1);
}
/** Returns `true` if the slot can become active. */
@@ -210,40 +207,21 @@ public:
//--------------------------------------------------------------------------
private:
/** Increments or decrements a counter based on the adjustment direction. */
template <typename T>
static void
adjustCounter(T& counter, CountAdjustment dir)
{
switch (dir)
{
case CountAdjustment::Increment:
++counter;
break;
case CountAdjustment::Decrement:
--counter;
break;
}
}
// Adjusts counts based on the specified slot, in the direction indicated.
// Using ++/-- instead of += on std::size_t counters avoids UBSan
// unsigned-integer-overflow from implicit conversion of -1 to SIZE_MAX.
// A decrement on a zero counter is a real bug that UBSan should catch.
void
adjust(Slot const& s, CountAdjustment const dir)
adjust(Slot const& s, int const n)
{
if (s.fixed())
adjustCounter(m_fixed, dir);
m_fixed += n;
if (s.reserved())
adjustCounter(m_reserved, dir);
m_reserved += n;
switch (s.state())
{
case Slot::accept:
XRPL_ASSERT(s.inbound(), "xrpl::PeerFinder::Counts::adjust : input is inbound");
adjustCounter(m_acceptCount, dir);
m_acceptCount += n;
break;
case Slot::connect:
@@ -252,28 +230,28 @@ private:
!s.inbound(),
"xrpl::PeerFinder::Counts::adjust : input is not "
"inbound");
adjustCounter(m_attempts, dir);
m_attempts += n;
break;
case Slot::active:
if (s.fixed())
adjustCounter(m_fixed_active, dir);
m_fixed_active += n;
if (!s.fixed() && !s.reserved())
{
if (s.inbound())
{
adjustCounter(m_in_active, dir);
m_in_active += n;
}
else
{
adjustCounter(m_out_active, dir);
m_out_active += n;
}
}
adjustCounter(m_active, dir);
m_active += n;
break;
case Slot::closing:
adjustCounter(m_closingCount, dir);
m_closingCount += n;
break;
// LCOV_EXCL_START