Skip to content

fix: Return objectNotFound for a non-existent book_offers domain - #7963

Draft
SoubeDev wants to merge 2 commits into
XRPLF:developfrom
SoubeDev:fix-6589-book-offers-domain-not-found
Draft

fix: Return objectNotFound for a non-existent book_offers domain#7963
SoubeDev wants to merge 2 commits into
XRPLF:developfrom
SoubeDev:fix-6589-book-offers-domain-not-found

Conversation

@SoubeDev

@SoubeDev SoubeDev commented Aug 6, 2026

Copy link
Copy Markdown

The book_offers RPC validated the domain parameter for hex format but never checked that the PermissionedDomain existed in the ledger. The domain is folded into the order-book directory index by getBookBase(), so a typo'd or deleted domain ID hashed to a directory that was not there and the caller received an empty offers array, indistinguishable from a real domain with no offers.

Look the domain up in the ledger and return objectNotFound when it is absent, consistent with amm_info (actNotFound), ledger_entry (entryNotFound), and nft_buy_offers/nft_sell_offers, which already return objectNotFound for a missing directory.

Use read() rather than exists(): the caller supplies the raw ledger key, and Ledger::exists(Keylet) does not check the entry type, so the index of any unrelated object would otherwise pass and still yield an empty result. Reject the all-zero key up front, since Ledger::read treats a zero key as UNREACHABLE.

Fixes #6589

High Level Overview of Change

Context of Change

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

SoubeDev and others added 2 commits August 6, 2026 10:33
The book_offers RPC validated the domain parameter for hex format but
never checked that the PermissionedDomain existed in the ledger. The
domain is folded into the order-book directory index by getBookBase(),
so a typo'd or deleted domain ID hashed to a directory that was not
there and the caller received an empty offers array, indistinguishable
from a real domain with no offers.

Look the domain up in the ledger and return objectNotFound when it is
absent, consistent with amm_info (actNotFound), ledger_entry
(entryNotFound), and nft_buy_offers/nft_sell_offers, which already
return objectNotFound for a missing directory.

Use read() rather than exists(): the caller supplies the raw ledger key,
and Ledger::exists(Keylet) does not check the entry type, so the index
of any unrelated object would otherwise pass and still yield an empty
result. Reject the all-zero key up front, since Ledger::read treats a
zero key as UNREACHABLE.

Fixes XRPLF#6589
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

book_offers RPC does not validate domain existence

1 participant