Repository navigation
Conversation
There was a problem hiding this comment.
This is a careful, mechanical refactor migrating NFTokenOffer SLE pointer usage to the new NFTokenOfferEntryR/NFTokenOfferEntryW wrapper types across NFTokenHelpers, NFTokenAcceptOffer, NFTokenCancelOffer, Transactor's expired-offer cleanup, and AccountDelete's NFT offer deleter. The tricky part — NFTokenAcceptOffer::doApply() needing to read offer fields after deleteTokenOffer() erases the writable entries — is handled correctly by capturing NFTokenOfferEntryR read-only copies (buyOffer/sellOffer) before the erase calls, and the early-return-on-expired path avoids using those copies in a post-erase state. The main thing I'd want confirmed is whether the bridgeOffers() declaration change in NFTokenAcceptOffer.h corresponds to an actual (possibly out-of-scope) implementation update, since no matching .cpp change is visible in this diff.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The deletion API can mutate two different views when its explicit view and wrapper-bound view differ.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Refactors NFT offer handling to use typed read/write ledger-entry wrappers.
Changes:
- Migrates NFT offer creation, lookup, acceptance, cancellation, and cleanup.
- Preserves read-only handles after writable entries are erased.
- Updates helper and transactor interfaces.
| File | Description |
|---|---|
src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp |
Uses writable offer wrappers. |
src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp |
Migrates offer validation and acceptance. |
src/libxrpl/tx/transactors/account/AccountDelete.cpp |
Wraps NFT offers during deletion. |
src/libxrpl/tx/Transactor.cpp |
Wraps expired offers during cleanup. |
src/libxrpl/ledger/helpers/NFTokenHelpers.cpp |
Migrates offer creation and deletion helpers. |
include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h |
Updates private wrapper-based interfaces. |
include/xrpl/ledger/helpers/NFTokenHelpers.h |
Updates the deletion helper API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| bool | ||
| deleteTokenOffer(ApplyView& view, SLE::ref offer) | ||
| deleteTokenOffer(ApplyView& view, NFTokenOfferEntryW& offer) |
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
66c204d to
f48da29
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
There was a problem hiding this comment.
This is a careful, mechanical refactor swapping raw NFTokenOffer SLE pointers for the NFTokenOfferEntryR/W wrapper types across NFTokenHelpers, NFTokenAcceptOffer, NFTokenCancelOffer, Transactor's expired-offer cleanup, and AccountDelete's deleter. The sequencing in NFTokenAcceptOffer::doApply — capturing read-only NFTokenOfferEntryR copies before calling deleteTokenOffer() so the fields can still be read after the writable wrapper erases its SLE — is correct and matches the stated intent. I didn't find behavior-changing bugs in the visible diff; the two items below are lower-confidence observations rather than confirmed defects.
f48da29 to
007d178
Compare
There was a problem hiding this comment.
This is a clean, mechanical refactor replacing raw NFTokenOffer SLE pointers with the new NFTokenOfferEntryR/W wrapper types, consistent with the stated goal of enforcing read/write access at compile time with no behavior change. I traced the one genuinely risky spot in the diff — NFTokenAcceptOffer::doApply() reading buy/sell offer fields after nft::deleteTokenOffer() erases them — and the author correctly snapshots read-only NFTokenOfferEntryR copies (buyOffer/sellOffer) before calling deleteTokenOffer(), so the subsequent bridging/accept logic reads valid data instead of a post-erase wrapper. The early-return on foundExpired also correctly prevents use of an already-erased writable entry. The AccountDelete.cpp deleter and the other call sites (NFTokenHelpers.cpp, Transactor.cpp, NFTokenCancelOffer.cpp) all follow the same safe construct-check-erase pattern. I did not find any lines in the diff that introduce a correctness, security, or resource-leak issue with high confidence.
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
Replace raw NFTokenOffer SLE pointers with NFTokenOfferEntryR and NFTokenOfferEntryW in the NFToken helpers, the NFTokenOffer transactors, the expired-offer cleanup in Transactor, and the AccountDelete deleter. deleteTokenOffer() and NFTokenAcceptOffer::acceptOffer() now take the wrapper instead of an SLE. They stay free/private functions; moving helpers onto the wrapper comes in a later PR. NFTokenAcceptOffer::doApply() reads the offers after it deletes them. Because NFTokenOfferEntryW::erase() drops its SLE, doApply() keeps read-only handles to the same SLEs for those reads. No behavior change.
007d178 to
cbf63b8
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |

High Level Overview of Change
Replace raw NFTokenOffer SLE pointers with
NFTokenOfferEntryR/NFTokenOfferEntryWinNFTokenHelpers.cpp(removeTokenOffersWithLimit,deleteTokenOffer,tokenOfferCreateApply),NFTokenAcceptOffer,NFTokenCancelOffer, the expired-offer cleanup inTransactor.cpp, and the AccountDelete deleterremoveNFTokenOfferFromLedger.nft::deleteTokenOffer()andNFTokenAcceptOffer::acceptOffer()now take the wrapper. No helper moves onto the wrapper in this PR.NFTokenAcceptOffer::doApply()reads the offers after it deletes them.NFTokenOfferEntryW::erase()drops its SLE, sodoApply()keeps read-only handles to the same SLEs for those reads.Context of Change
Part of the Wrapped SLEs migration (design: step 2/3 of #7886). The wrapper types bind each pointer to the NFTokenOffer entry type and make the compiler enforce read-only vs. writable access. 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
Syntax-checked every changed
.cppand every includer ofNFTokenHelpers.h/NFTokenAcceptOffer.h(13 files, includingapplySteps.cppandInvariantCheck.cpp); clang-tidy clean on the changed.cppfiles. No new tests. CI runs the full unit test suite.🤖 Generated with Claude Code