Skip to content
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e736965
first stab
mvadari Jun 8, 2025
c91afc0
move server_definitions to new file
mvadari Aug 16, 2025
491c6ec
move AccountSet to app
mvadari Aug 16, 2025
acac1c9
[WIP] flags
mvadari Aug 16, 2025
97a2912
finish flags
mvadari Aug 17, 2025
945c5fd
clean up
mvadari Aug 17, 2025
7c4d63b
add universal flags
mvadari Aug 17, 2025
34fdea9
split out common fields
mvadari Aug 17, 2025
a8b0043
Merge remote-tracking branch 'upstream/develop' into server_definitions2
mvadari Aug 18, 2025
cbecdb2
fix flags
mvadari Aug 19, 2025
38a29ab
fix flags
mvadari Aug 19, 2025
034198e
Merge branch 'develop' into server_definitions2
mvadari Aug 19, 2025
fa0d5a6
Merge remote-tracking branch 'upstream/develop' into server_definitions2
mvadari Aug 22, 2025
09ec4ef
Merge branch 'develop' into server_definitions2
mvadari Aug 22, 2025
85b015b
Merge branch 'develop' into server_definitions2
mvadari Aug 25, 2025
b84a348
Merge branch 'develop' into server_definitions2
mvadari Oct 13, 2025
edb04af
add lsf flags
mvadari Oct 20, 2025
7a4d423
Merge branch 'develop' into server_definitions2
mvadari Oct 21, 2025
3e1661b
Merge branch 'develop' into server_definitions2
mvadari Nov 3, 2025
b51292b
Merge branch 'develop' into server_definitions2
mvadari Nov 5, 2025
e5d6f02
Merge branch 'develop' into server_definitions2
mvadari Nov 18, 2025
de9777d
match spec
mvadari Nov 21, 2025
cf9b68c
Merge branch 'develop' into server_definitions2
mvadari Dec 2, 2025
7753f93
fix build issue
mvadari Dec 2, 2025
7e7f497
Merge branch 'develop' into server_definitions2
mvadari Dec 11, 2025
571950d
Merge branch 'develop' into server_definitions2
mvadari Jan 7, 2026
a2c0fdc
Merge branch 'develop' into server_definitions2
mvadari Jan 7, 2026
1e4596d
Merge branch 'develop' into server_definitions2
mvadari Jan 26, 2026
70ff709
Merge commit '92046785d1fea5f9efe5a770d636792ea6cab78b' into server_d…
mvadari Jan 28, 2026
498d533
Merge branch 'develop' into server_definitions2
mvadari Jan 28, 2026
0d57f57
Merge branch 'develop' into server_definitions2
godexsoft Feb 3, 2026
b86181c
chore: Add .zed editor config directory to .gitignore (#6317)
Tapanito Feb 3, 2026
ce82d2f
fix: Deletes expired NFToken offers from ledger (#5707)
Copilot Feb 3, 2026
745774e
refactor: Add ServiceRegistry to help modularization (#6222)
a1q123456 Feb 3, 2026
6615ba6
chore: Remove unity builds (#6300)
bthomee Feb 3, 2026
e5b6680
refactor: Replace include guards by '#pragma once' (#6322)
bthomee Feb 4, 2026
60c40c0
chore: Remove unnecessary script (#6326)
bthomee Feb 4, 2026
2319139
chore: Update secp256k1 and openssl (#6327)
mathbunnyru Feb 4, 2026
f10c050
Merge remote-tracking branch 'upstream/develop' into server_definitions2
mvadari Feb 4, 2026
48c71ed
Merge remote-tracking branch 'upstream/develop' into server_definitions2
mvadari Feb 6, 2026
76a487f
Merge remote-tracking branch 'upstream/develop' into server_definitions2
mvadari Feb 10, 2026
bdc17db
Merge remote-tracking branch 'upstream/develop' into server_definitions2
mvadari Feb 12, 2026
6c8a48c
Merge remote-tracking branch 'upstream/develop' into server_definitions2
mvadari Feb 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 159 additions & 91 deletions include/xrpl/protocol/LedgerFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <xrpl/protocol/KnownFormats.h>

#include <map>

namespace ripple {

/** Identifiers for on-ledger objects.
Expand Down Expand Up @@ -98,101 +100,163 @@ enum LedgerEntryType : std::uint16_t
};
// clang-format off

/**
/** Ledger object flags.

These flags are specified in ledger objects and modify their behavior.

@warning Ledger object flags form part of the protocol. **Changing them
should be avoided because without special handling, this will
result in a hard fork.**

@ingroup protocol
*/
enum LedgerSpecificFlags {
// ltACCOUNT_ROOT
lsfPasswordSpent = 0x00010000, // True, if password set fee is spent.
lsfRequireDestTag =
0x00020000, // True, to require a DestinationTag for payments.
lsfRequireAuth =
0x00040000, // True, to require a authorization to hold IOUs.
lsfDisallowXRP = 0x00080000, // True, to disallow sending XRP.
lsfDisableMaster = 0x00100000, // True, force regular key
lsfNoFreeze = 0x00200000, // True, cannot freeze ripple states
lsfGlobalFreeze = 0x00400000, // True, all assets frozen
lsfDefaultRipple =
0x00800000, // True, incoming trust lines allow rippling by default
lsfDepositAuth = 0x01000000, // True, all deposits require authorization
/* // reserved for Hooks amendment
lsfTshCollect = 0x02000000, // True, allow TSH collect-calls to acc hooks
*/
lsfDisallowIncomingNFTokenOffer =
0x04000000, // True, reject new incoming NFT offers
lsfDisallowIncomingCheck =
0x08000000, // True, reject new checks
lsfDisallowIncomingPayChan =
0x10000000, // True, reject new paychans
lsfDisallowIncomingTrustline =
0x20000000, // True, reject new trustlines (only if no issued assets)
lsfAllowTrustLineLocking =
0x40000000, // True, enable trustline locking
lsfAllowTrustLineClawback =
0x80000000, // True, enable clawback

// ltOFFER
lsfPassive = 0x00010000,
lsfSell = 0x00020000, // True, offer was placed as a sell.
lsfHybrid = 0x00040000, // True, offer is hybrid.

// ltRIPPLE_STATE
lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
lsfHighReserve = 0x00020000,
lsfLowAuth = 0x00040000,
lsfHighAuth = 0x00080000,
lsfLowNoRipple = 0x00100000,
lsfHighNoRipple = 0x00200000,
lsfLowFreeze = 0x00400000, // True, low side has set freeze flag
lsfHighFreeze = 0x00800000, // True, high side has set freeze flag
lsfLowDeepFreeze = 0x02000000, // True, low side has set deep freeze flag
lsfHighDeepFreeze = 0x04000000, // True, high side has set deep freeze flag
lsfAMMNode = 0x01000000, // True, trust line to AMM. Used by client
// apps to identify payments via AMM.

// ltSIGNER_LIST
lsfOneOwnerCount = 0x00010000, // True, uses only one OwnerCount

// ltDIR_NODE
lsfNFTokenBuyOffers = 0x00000001,
lsfNFTokenSellOffers = 0x00000002,

// ltNFTOKEN_OFFER
lsfSellNFToken = 0x00000001,

// ltMPTOKEN_ISSUANCE
lsfMPTLocked = 0x00000001, // Also used in ltMPTOKEN
lsfMPTCanLock = 0x00000002,
lsfMPTRequireAuth = 0x00000004,
lsfMPTCanEscrow = 0x00000008,
lsfMPTCanTrade = 0x00000010,
lsfMPTCanTransfer = 0x00000020,
lsfMPTCanClawback = 0x00000040,

lsmfMPTCanMutateCanLock = 0x00000002,
lsmfMPTCanMutateRequireAuth = 0x00000004,
lsmfMPTCanMutateCanEscrow = 0x00000008,
lsmfMPTCanMutateCanTrade = 0x00000010,
lsmfMPTCanMutateCanTransfer = 0x00000020,
lsmfMPTCanMutateCanClawback = 0x00000040,
lsmfMPTCanMutateMetadata = 0x00010000,
lsmfMPTCanMutateTransferFee = 0x00020000,

// ltMPTOKEN
lsfMPTAuthorized = 0x00000002,

// ltCREDENTIAL
lsfAccepted = 0x00010000,

// ltVAULT
lsfVaultPrivate = 0x00010000,

// ltLOAN
lsfLoanDefault = 0x00010000,
lsfLoanImpaired = 0x00020000,
lsfLoanOverpayment = 0x00040000, // True, loan allows overpayments

#pragma push_macro("XMACRO")
#pragma push_macro("TO_VALUE")
#pragma push_macro("VALUE_TO_MAP")
#pragma push_macro("NULL_NAME")
#pragma push_macro("TO_MAP")
#pragma push_macro("ALL_LEDGER_FLAGS")

#undef XMACRO
#undef TO_VALUE
#undef VALUE_TO_MAP
#undef NULL_NAME
#undef TO_MAP

// clang-format off
#undef ALL_LEDGER_FLAGS

#define XMACRO(LEDGER_OBJECT, LSF_FLAG, LSF_FLAG2) \
LEDGER_OBJECT(AccountRoot, \
LSF_FLAG(lsfPasswordSpent, 0x00010000) \
LSF_FLAG(lsfRequireDestTag, 0x00020000) \
LSF_FLAG(lsfRequireAuth, 0x00040000) \
LSF_FLAG(lsfDisallowXRP, 0x00080000) \
LSF_FLAG(lsfDisableMaster, 0x00100000) \
LSF_FLAG(lsfNoFreeze, 0x00200000) \
LSF_FLAG(lsfGlobalFreeze, 0x00400000) \
LSF_FLAG(lsfDefaultRipple, 0x00800000) \
LSF_FLAG(lsfDepositAuth, 0x01000000) \
LSF_FLAG(lsfDisallowIncomingNFTokenOffer, 0x04000000) \
LSF_FLAG(lsfDisallowIncomingCheck, 0x08000000) \
LSF_FLAG(lsfDisallowIncomingPayChan, 0x10000000) \
LSF_FLAG(lsfDisallowIncomingTrustline, 0x20000000) \
LSF_FLAG(lsfAllowTrustLineLocking, 0x40000000) \
LSF_FLAG(lsfAllowTrustLineClawback, 0x80000000)) \
\
LEDGER_OBJECT(Offer, \
LSF_FLAG(lsfPassive, 0x00010000) \
LSF_FLAG(lsfSell, 0x00020000) \
LSF_FLAG(lsfHybrid, 0x00040000)) \
\
LEDGER_OBJECT(RippleState, \
LSF_FLAG(lsfLowReserve, 0x00010000) \
LSF_FLAG(lsfHighReserve, 0x00020000) \
LSF_FLAG(lsfLowAuth, 0x00040000) \
LSF_FLAG(lsfHighAuth, 0x00080000) \
LSF_FLAG(lsfLowNoRipple, 0x00100000) \
LSF_FLAG(lsfHighNoRipple, 0x00200000) \
LSF_FLAG(lsfLowFreeze, 0x00400000) \
LSF_FLAG(lsfHighFreeze, 0x00800000) \
LSF_FLAG(lsfAMMNode, 0x01000000) \
LSF_FLAG(lsfLowDeepFreeze, 0x02000000) \
LSF_FLAG(lsfHighDeepFreeze, 0x04000000)) \
\
LEDGER_OBJECT(SignerList, \
LSF_FLAG(lsfOneOwnerCount, 0x00010000)) \
\
LEDGER_OBJECT(DirNode, \
LSF_FLAG(lsfNFTokenBuyOffers, 0x00000001) \
LSF_FLAG(lsfNFTokenSellOffers, 0x00000002)) \
\
LEDGER_OBJECT(NFTokenOffer, \
LSF_FLAG(lsfSellNFToken, 0x00000001)) \
\
LEDGER_OBJECT(MPTokenIssuance, \
LSF_FLAG(lsfMPTLocked, 0x00000001) \
LSF_FLAG(lsfMPTCanLock, 0x00000002) \
LSF_FLAG(lsfMPTRequireAuth, 0x00000004) \
LSF_FLAG(lsfMPTCanEscrow, 0x00000008) \
LSF_FLAG(lsfMPTCanTrade, 0x00000010) \
LSF_FLAG(lsfMPTCanTransfer, 0x00000020) \
LSF_FLAG(lsfMPTCanClawback, 0x00000040)) \
\
LEDGER_OBJECT(MPTokenIssuanceMutable, \
LSF_FLAG(lsmfMPTCanMutateCanLock, 0x00000002) \
LSF_FLAG(lsmfMPTCanMutateRequireAuth, 0x00000004) \
LSF_FLAG(lsmfMPTCanMutateCanEscrow, 0x00000008) \
LSF_FLAG(lsmfMPTCanMutateCanTrade, 0x00000010) \
LSF_FLAG(lsmfMPTCanMutateCanTransfer, 0x00000020) \
LSF_FLAG(lsmfMPTCanMutateCanClawback, 0x00000040) \
LSF_FLAG(lsmfMPTCanMutateMetadata, 0x00010000) \
LSF_FLAG(lsmfMPTCanMutateTransferFee, 0x00020000)) \
\
LEDGER_OBJECT(MPToken, \
LSF_FLAG2(lsfMPTLocked, 0x00000001) \
LSF_FLAG(lsfMPTAuthorized, 0x00000002)) \
\
LEDGER_OBJECT(Credential, \
LSF_FLAG(lsfAccepted, 0x00010000)) \
\
LEDGER_OBJECT(Vault, \
LSF_FLAG(lsfVaultPrivate, 0x00010000)) \
\
LEDGER_OBJECT(Loan, \
LSF_FLAG(lsfLoanDefault, 0x00010000) \
LSF_FLAG(lsfLoanImpaired, 0x00020000) \
LSF_FLAG(lsfLoanOverpayment, 0x00040000))

// clang-format on

// Create all the flag values as an enum.
// example:
// enum LedgerSpecificFlags {
// lsfPasswordSpent = 0x00010000,
// lsfRequireDestTag = 0x00020000,
// ...
// };
#define TO_VALUE(name, value) name = value,
#define NULL_NAME(name, values) values
#define NULL_OUTPUT(name, value)
enum LedgerSpecificFlags : std::uint32_t {
XMACRO(NULL_NAME, TO_VALUE, NULL_OUTPUT)
};

// Create maps for each set of flags.
// This is used below in `ALL_LEDGER_FLAGS` to generate the server_definitions
// RPC output. example: std::map<std::string, std::uint32_t> const
// AccountRootFlags =
// {{"lsfPasswordSpent", 0x00010000}, {"lsfRequireDestTag", 0x00020000}, ...};
using LedgerFlagMap = std::map<std::string, std::uint32_t>;
#define VALUE_TO_MAP(name, value) {#name, value},
#define TO_MAP(name, values) LedgerFlagMap const name##Flags = {values};
XMACRO(TO_MAP, VALUE_TO_MAP, VALUE_TO_MAP)

// Create a list of all ledger flag maps.
// This is used to generate the server_definitions RPC output.
// example:
// std::vector<std::pair<std::string, LedgerFlagMap>> const allLedgerFlags = {
// {"AccountRoot", AccountRootFlags},
#define ALL_LEDGER_FLAGS(name, values) {#name, name##Flags},
std::vector<std::pair<std::string, LedgerFlagMap>> const allLedgerFlags = {
XMACRO(ALL_LEDGER_FLAGS, NULL_OUTPUT, NULL_OUTPUT)};

#undef XMACRO
#undef TO_VALUE
#undef VALUE_TO_MAP
#undef NULL_NAME
#undef NULL_OUTPUT
#undef TO_MAP
#undef ALL_LEDGER_FLAGS

#pragma pop_macro("XMACRO")
#pragma pop_macro("TO_VALUE")
#pragma pop_macro("VALUE_TO_MAP")
#pragma pop_macro("NULL_NAME")
#pragma pop_macro("TO_MAP")
#pragma pop_macro("ALL_LEDGER_FLAGS")

//------------------------------------------------------------------------------

/** Holds the list of known ledger entry formats.
Expand All @@ -208,6 +272,10 @@ class LedgerFormats : public KnownFormats<LedgerEntryType, LedgerFormats>
public:
static LedgerFormats const&
getInstance();

// Fields shared by all txFormats:
static std::initializer_list<SOElement> const&
getCommonFields();
};

} // namespace ripple
Expand Down
Loading
Loading