* XRPLF/develop: (48 commits) test: Add null check unit test for `Oracle::aggregatePrice` (7306) ci: Patch conan recipe for Nix to be able to use on macOS (7532) ci: Run sanitizers on release builds too (7527) fix: Correct hybrid offer deletion on credential expiry (6843) ci: Make sanitizer flags lists in the profile, not a string (7449) ci: Make configurations launch on certain event types (7447) fix: Add [[maybe_unused]] to fix320Enabled for assert=OFF builds (7446) ci: Add `gh` and `file` to nix packages (7444) fix: Disable transaction invariants (7409) perf: Dispatch "hasInvalidAmount()" on type tag instead of dynamic_cast (7402) refactor: Retire fixUniversalNumber amendment (5962) test: Do not create data directory for memory databases (7323) ci: Launch upload-conan-deps on profile change (7442) fix: Fix Number comparison operator (7406) feat: Use C++ 23 standard (7431) refactor: Introduce XRPL_ASSERT_IF for amendment-gated assertions (7378) refactor: Change config section and key string literals into constants (7095) refactor: Use `std::move` and `std::string_view` where possible (7424) refactor: Use const function arguments where possible (7423) ci: Use XRPLF/actions build-multiarch-image workflow (7428) ...
protocol
Classes and functions for handling data and values associated with the XRP Ledger protocol.
Serialized Objects
Objects transmitted over the network must be serialized into a canonical format. The prefix "ST" refers to classes that deal with the serialized format.
The term "Tx" or "tx" is an abbreviation for "Transaction", a commonly occurring object type.
Optional Fields
Our serialized fields have some "type magic" to make optional fields easier to read:
- The operation
x[sfFoo]means "return the value of 'Foo' if it exists, or the default value if it doesn't." - The operation
x[~sfFoo]means "return the value of 'Foo' if it exists, or nothing if it doesn't." This usage of the tilde/bitwise NOT operator is not standard outside of thexrpldcodebase.- As a consequence of this,
x[~sfFoo] = y[~sfFoo]assigns the value of Foo from y to x, including omitting Foo from x if it doesn't exist in y.
- As a consequence of this,
Typically, for things that are guaranteed to exist, you use
x[sfFoo] and avoid having to deal with a container that may
or may not hold a value. For things not guaranteed to exist,
you use x[~sfFoo] because you want such a container. It
avoids having to look something up twice, once just to see if
it exists and a second time to get/set its value.
(Real example)
The source of this "type magic" is in SField.h.