Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
This is a large, mechanical refactor swapping raw SLE pointers for MPTokenIssuanceEntryR/W wrappers across 28 files. The signature changes and call-site updates are consistent and match up correctly throughout (constructors, operator-> usage, .update()/.erase()/.insert() replacing view calls, and the aliasing-shared_ptr trick in View.cpp's isFrozen are all internally consistent). The one recurring gap I found is that most call sites forward the enclosing function's beast::Journal into the new MPTokenIssuanceEntryW constructor (3-arg form), but three free-function call sites in MPTokenHelpers.cpp (addEmptyHolding, lockEscrowMPT, unlockEscrowMPT) construct the writable entry with the 2-arg form even though a Journal (journal/j) is already in scope and used for JLOG right next to the construction. Given the PR's explicit "no behavior change" bar, this looks like an unintentional omission rather than an intentional design choice, and would silently drop any diagnostic logging the entry wrapper does internally for these three code paths.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The consensus-sensitive migration changes read-only lookup behavior across payment and transaction paths and needs final human review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
This PR advances the wrapped-ledger-entry migration by replacing raw MPTokenIssuance SLE pointers with typed read-only and writable entries across ledger helpers, transaction processing, and payment paths.
Changes:
- Converts issuance lookups, creation, updates, and deletion to typed wrappers.
- Updates helper signatures and their callers.
- Adapts one vault test call to the new signature.
| File | Description |
|---|---|
src/test/app/vault/VaultBugs_test.cpp |
Adapts a vault helper test call. |
src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp |
Wraps vault share issuance reads. |
src/libxrpl/tx/transactors/vault/VaultSet.cpp |
Wraps issuance reads and updates. |
src/libxrpl/tx/transactors/vault/VaultDeposit.cpp |
Wraps vault share issuance reads. |
src/libxrpl/tx/transactors/vault/VaultDelete.cpp |
Wraps share issuance deletion. |
src/libxrpl/tx/transactors/vault/VaultClawback.cpp |
Wraps issuance reads and helper input. |
src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp |
Wraps issuance preclaim read. |
src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp |
Wraps issuance lookup and deletion. |
src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp |
Creates and inserts a wrapped issuance. |
src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp |
Wraps issuance preclaim read. |
src/libxrpl/tx/transactors/token/ConfidentialMPTSend.cpp |
Wraps issuance reads and proof input. |
src/libxrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.cpp |
Wraps issuance reads. |
src/libxrpl/tx/transactors/token/ConfidentialMPTMergeInbox.cpp |
Wraps issuance preclaim read. |
src/libxrpl/tx/transactors/token/ConfidentialMPTConvertBack.cpp |
Wraps issuance reads and update. |
src/libxrpl/tx/transactors/token/ConfidentialMPTConvert.cpp |
Wraps issuance reads and update. |
src/libxrpl/tx/transactors/token/ConfidentialMPTClawback.cpp |
Wraps issuance reads and update. |
src/libxrpl/tx/transactors/token/Clawback.cpp |
Wraps issuance preclaim read. |
src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp |
Wraps issuance preclaim read. |
src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp |
Wraps issuance preclaim read. |
src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp |
Wraps issuance preclaim read. |
src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp |
Wraps issuance preclaim read. |
src/libxrpl/tx/transactors/dex/AMMCreate.cpp |
Wraps issuance clawback-flag read. |
src/libxrpl/tx/transactors/dex/AMMClawback.cpp |
Wraps issuance authorization read. |
src/libxrpl/tx/paths/MPTEndpointStep.cpp |
Wraps payment-path issuance read. |
src/libxrpl/ledger/View.cpp |
Passes typed issuance to freeze helpers. |
src/libxrpl/ledger/helpers/VaultHelpers.cpp |
Accepts typed issuance in vault helpers. |
src/libxrpl/ledger/helpers/TokenHelpers.cpp |
Wraps issuance reads and balance updates. |
src/libxrpl/ledger/helpers/MPTokenHelpers.cpp |
Wraps issuance reads and helper inputs. |
include/xrpl/tx/transactors/vault/VaultClawback.h |
Updates clawback helper signature. |
include/xrpl/ledger/View.h |
Updates freeze helper signature. |
include/xrpl/ledger/helpers/VaultHelpers.h |
Updates vault helper signatures. |
include/xrpl/ledger/helpers/MPTokenHelpers.h |
Updates issuance helper signatures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| { | ||
| if (auto const sle = view.read(keylet::mptokenIssuance(mptIssue.getMptID()))) | ||
| return isGlobalFrozen(*sle); | ||
| if (auto const sle = MPTokenIssuanceEntryR(mptIssue.getMptID(), view)) |
| // if the account is the issuer, and the issuance exists, their limit is | ||
| // the issuance limit minus the outstanding value | ||
| auto const issuance = view.read(keylet::mptokenIssuance(mptIssue.getMptID())); | ||
| MPTokenIssuanceEntryR const issuance(mptIssue.getMptID(), view); |
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
eb0ddd1 to
0687c18
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
0687c18 to
aad945f
Compare
There was a problem hiding this comment.
This is a large, mechanical refactor swapping raw SLE pointers for MPTokenIssuanceEntryR/W wrappers across ~28 files. I traced each changed call site back to its original view.read/view.peek/keylet construction and the new entry-wrapper constructors line up 1:1 in every case I checked (VaultClawback, VaultDelete, VaultSet, VaultWithdraw, VaultDeposit, all the Confidential* transactors, MPTokenAuthorize, MPTokenIssuanceCreate/Destroy/Set, escrow preclaim helpers, AMMClawback/AMMCreate, MPTEndpointStep). Null/existence checks (!sleIssuance, == nullptr) are preserved with equivalent operator!/bool semantics, and .update()/.insert()/.erase() wrapper calls replace the corresponding view.update/insert/erase(sle) calls at the same points in control flow. I did not find a case where the wrong ID/keylet is passed into a wrapper, where a null check was dropped, or where read vs. write access was swapped. The one spot worth a second pair of eyes is the aliasing-shared_ptr construction in MPTokenHelpers.cpp's isFrozen (building a non-owning MPTokenIssuanceEntryR directly from the SLE const& parameter) — it's a well-known, standard-sanctioned idiom and is clearly commented, so I'm not flagging it as a bug, just noting it's the least conventional change in the diff and deserves a close look during review since its correctness depends on the Entry wrapper's constructor not assuming real ownership.
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
Replace raw MPTokenIssuance SLE pointers with MPTokenIssuanceEntryR (read-only) and MPTokenIssuanceEntryW (writable) in the ledger helpers, transactors, and payment paths. view.read()/peek() become entry constructors, and insert/update/erase go through the entry. Helpers that take an issuance SLE now take MPTokenIssuanceEntryR: isGlobalFrozen, assetOfHolding (issuance parameter only), availableMPTAmount, isVaultPseudoAccountFrozen, the vault share conversion helpers, isSoleShareholder, checkVaultDomain, and a few file-local helpers. They stay free functions. maxMPTAmount keeps its SLE parameter because an invariant calls it from visitEntry(), where no view exists to build an entry. Code that branches on MPToken vs. MPTokenIssuance keeps its generic SLE. Pure refactor: no behavior change.
Develop added the ConfidentialMPTHolderKeyUpdate transactor (#8266), which reads the issuance with a raw view.read(). Use MPTokenIssuanceEntryR there too, so that this PR still covers every MPTokenIssuance read.
aad945f to
21d6386
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
…ptokenissuance-entry # Conflicts: # src/libxrpl/ledger/View.cpp
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |


High Level Overview of Change
Replaces raw MPTokenIssuance SLE pointers with
MPTokenIssuanceEntryR/MPTokenIssuanceEntryWin the ledger helpers, transactors, and payment paths (58read/peek/make_sharedsites in 28 source files). Helpers that take an issuance SLE (isGlobalFrozen,assetOfHoldingissuance parameter,availableMPTAmount,isVaultPseudoAccountFrozen,assetsToShares*/sharesToAssets*,isSoleShareholder,checkVaultDomain, and some file-local helpers) now takeMPTokenIssuanceEntryR const&and stay free functions. No helper moves onto the wrapper in this PR.maxMPTAmountkeeps itsSLE const¶meter becauseValidMPTBalanceChanges::visitEntrycalls it and has no view to build an entry. Code that branches on MPToken vs. MPTokenIssuance (isFrozen(view, account, SLE const&, depth),MPTokenIssuanceSet::doApply) keeps the generic SLE. MPToken (holder) pointers are not touched.Context of Change
Part of the Wrapped SLEs migration (design: step 2/3 of #7886). The entry type is now part of the signature, so the compiler rejects passing a different ledger object type, and read-only vs. writable access is enforced at compile time. Pure refactor: no amendment, no behavior change; any observable difference is a bug.
This PR was fully written by AI (Claude Code) under human direction; the human author reviewed the diff.
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)Test Plan
clang++ -fsyntax-onlywith the project flags) every changed.cppand every.cppthat includes a changed header, directly or transitively: 92/92 passed.clang-tidy(incl.misc-include-cleaner) clean on all 28 changed.cppfiles;pre-commitclean.VaultBugs_test.cpphas a one-line edit becauseassetsToSharesWithdrawnow takes an entry.🤖 Generated with Claude Code