* upstream/develop: (30 commits) chore: Enable clang-tidy include cleaner (6947) fix: Change AMMClawback return code to tecNO_PERMISSION (6946) ci: [DEPENDABOT] bump actions/upload-pages-artifact from 4.0.0 to 5.0.0 (6927) ci: [DEPENDABOT] bump actions/upload-artifact from 7.0.0 to 7.0.1 (6928) chore: Enable clang-tidy readability checks (6930) fix: Fix unity build for book step (6942) chore: Move codegen venv setup into build stage (6617) chore: Enable most clang-tidy bugprone checks (6929) refactor: Improve exception handling (6540) (6735) refactor: Remove unused notTooManyOffers function from NFTokenUtils (6737) fix: Change `Tuning::bookOffers` minimum limit to 1 (6812) chore: Make pre-commit line ending conversions work on Windows (6832) (6833) fix: Add description for `terLOCKED` error (6811) fix: Address AI reviewer comments for Permission Delegation (6675) refactor: Combine `AMMHelpers` and `AMMUtils` (6733) feat: Add MPT support to DEX (5285) fix: Handle WSClient write failure when server closes WebSocket (6671) ci: Change conditions for uploading artifacts in public/private/org repos (6734) refactor: Rename non-functional uses of `ripple(d)` to `xrpl(d)` (6676) refactor: Move more helper files into `libxrpl/ledger/helpers` (6731) ...
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.