Conflict resolution: - sfields.macro: both sides claimed INT32 code 2. sfRemainingOwnerCountDelta is already in develop, so it keeps code 2 and sfVMReturnCode moves to 3. This changes the Smart Escrow serialization, which is safe while the amendment is unactivated, but is a deliberate renumber rather than a mechanical merge. - EscrowFinish.cpp: took the SeqProxy form of the keylet::escrow call and kept this branch's comment. Follow-on fixes the merge required: - Adapted two keylet::escrow calls in EscrowSmart_test.cpp to SeqProxy; they are only on this branch, so the earlier pass over the wasm code did not cover them. - Updated two gas expectations that the trace host function refactor and the regenerated fixtures invalidated: the codecov allowance in Wasm_test.cpp is now 264'467 and sfGasUsed in EscrowSmart_test.cpp is now 48'433. Both are measured, not estimated. - Disabled testKeyletHostFunctions. kAllKeyletsWasmHex was built against the old trace ABI and is rejected with temINVALID_BYTECODE. Regenerating it needs the all_keylets source ported to the current stdlib first, along with float_tests and float_0, which are stale for the same reason. See the TODO on the test.
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.