Restores a runtime interface (renamed InvariantCheck -> TxInvariantCheck
per review feedback) that Transactor now inherits from, rather than the
free checkInvariants runner depending on Transactor directly. Transactor
implements visitEntry/finalize as private final overrides forwarding to
its own protected visitInvariantEntry/finalizeInvariants, so the two-phase
hooks stay unreachable through a bare Transactor&, only through the
TxInvariantCheck& the runner holds. Adds a test exercising the runner's
exception path via a throwing TxInvariantCheck, and fixes two inaccurate
doc comments (checkInvariants' stale escalation description, and
getInvariantChecks() construction moved back inside the try block).
Address open PR #7404 review feedback:
- Rename CheckInvariants.h/.cpp to InvariantRunner.h/.cpp; the old name
read as invariants for the Checks (ttCHECK*) feature.
- Remove the InvariantCheck interface and Transactor::InvariantCheckAdapter
wrapper. The free checkInvariants runner now takes an optional
Transactor& directly and calls visitInvariantEntry/finalizeInvariants on
it, since the adapter only existed to bridge to a single concrete type.
- Document that `after` is never null in InvariantCheck::visitEntry
- Clarify tec/tef escalation in checkInvariants doc: both protocol and
transaction faults return tecINVARIANT_FAILED on the first pass;
tefINVARIANT_FAILED only occurs when the incoming result is already
tecINVARIANT_FAILED (i.e. the fee-claim reset path checks again)
- Rename SkipTxInvariants -> CheckTxInvariants with Yes/No semantics
to eliminate the double-negative at call sites
Move the invariant-check orchestration out of ApplyContext and Transactor
into a free function xrpl::checkInvariants(ApplyContext&, TER, XRPAmount,
optional<reference_wrapper<InvariantCheck>>).
The two previously separate traversals (one in ApplyContext driving the
protocol tuple fold, one in Transactor driving the tx-specific check) are
merged into a single ctx.visit walk. Per-layer try/catch inside the
lambda isolates collection faults: a throw in one layer stops only that
layer from visiting further entries while the other continues. A layer
whose collection faulted skips its finalize phase.
ApplyContext loses checkInvariants/checkInvariantsHelper/failInvariantCheck.
Transactor delegates to the free runner via a private InvariantCheckAdapter
that bridges visitInvariantEntry+finalizeInvariants into the InvariantCheck
interface. A SkipTxInvariants::Yes/No enum makes the fee-claim-reset call
site explicit about omitting the tx-specific check.
Protocol checks remain duck-typed in the InvariantChecks tuple (static
dispatch, no vtable on the hot path). InvariantCheck is the runtime
interface used only by InvariantCheckAdapter.
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This change replaces all instances of `<variable> != tesSUCCESS` with `!isTesSuccess(<variable>)` and `<variable> == tesSUCCESS` with `isTesSuccess(<variable>)`.
This change:
* Introduces a new helper function on `STTx`, `getFeePayer`.
* Removes the usage of `mSourceBalance` and replaces it with SLE balance lookups.
* Renames `mPriorBalance` to `preFeeBalance_`
This simplifies some of the code in the transactors and makes it a lot more readable.
This change reorganizes the `tx/transactors` directory for consistency and discoverability. There are no behavioral changes, this is a pure refactor. Underscores were chosen as the way to separate multi-words as this is the more popular option in C++ projects.
Specific changes:
- Rename all subdirectories to lowercase/snake_case (`AMM` → `amm`, `Check` → `check`, `NFT` → `nft`, `PermissionedDomain` → `permissioned_domain`, etc.)
- Merge `AMM/` and `Offer/` into `dex/`, including `PermissionedDEXHelpers`
- Rename `MPT/` → `token/`, absorbing `SetTrust` and `Clawback`
- Move top-level transactors into named groups: `account/`, `bridge/`, `credentials/`, `did/`, `escrow/`, `oracle/`, `payment/`, `payment_channel/`, `system/`
- Update all include paths across the codebase and `transactions.macro`