Skip to content

feat: Export ledger name spaces via server_definitions#7823

Closed
dangell7 wants to merge 1 commit into
developfrom
dangell7/export-ledger-name-spaces
Closed

feat: Export ledger name spaces via server_definitions#7823
dangell7 wants to merge 1 commit into
developfrom
dangell7/export-ledger-name-spaces

Conversation

@dangell7

Copy link
Copy Markdown
Contributor

High Level Overview of Change

Adds a LEDGER_NAME_SPACES section to the server_definitions RPC response. It exports the name → value map of the LedgerNameSpace tagged-hash prefixes so clients can compute keylets offline instead of hard-coding the ASCII prefixes or round-tripping to a server.

Context of Change

Clients that want to derive ledger object indexes (keylets) locally need the type-specific prefixes used in the tagged hashing. Today those only exist as a private enum in Indexes.cpp, so every client library carries its own copy and has to chase new amendments by hand. server_definitions already exports fields, ledger entry types, transaction types, etc. for exactly this reason — this just extends it to name spaces.

The enum moves from Indexes.cpp into Indexes.h and is generated from a single X-macro list (detail/ledger_name_spaces.macro). The same list co-generates ledgerNameSpaceMap(), so the enum and the exported map cannot drift — adding a name space in one place updates both. Deprecated name spaces (Contract, Generator, Nickname) stay in the list to reserve their values but are intentionally NOT exported, since keylets should never be computed for retired spaces.

The alternative was exporting a hand-written map next to the enum, but that's two lists to keep in sync and the whole point is to stop copies drifting.

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)

@dangell7 dangell7 changed the title feat: export ledger name spaces via server_definitions feat: Export ledger name spaces via server_definitions Jul 17, 2026

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues.

Review by Claude Sonnet 4.6 · Prompt: V15

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.5%. Comparing base (5ce0b1c) to head (c7bfd6a).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #7823   +/-   ##
=======================================
  Coverage     82.5%   82.5%           
=======================================
  Files         1039    1040    +1     
  Lines        80446   80487   +41     
  Branches      9080    9080           
=======================================
+ Hits         66332   66369   +37     
- Misses       14105   14109    +4     
  Partials         9       9           
Files with missing lines Coverage Δ
include/xrpl/protocol/Indexes.h 100.0% <ø> (ø)
...lude/xrpl/protocol/detail/ledger_name_spaces.macro 100.0% <100.0%> (ø)
src/libxrpl/protocol/Indexes.cpp 96.1% <100.0%> (+0.1%) ⬆️
...pld/rpc/handlers/server_info/ServerDefinitions.cpp 98.0% <100.0%> (+<0.1%) ⬆️

... and 1 file with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dangell7
dangell7 force-pushed the dangell7/export-ledger-name-spaces branch from 429bf64 to c7bfd6a Compare July 17, 2026 01:11

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found. Code looks good!

Review by Claude Sonnet 4.6 · Prompt: V15

@dangell7 dangell7 closed this Jul 17, 2026
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.

1 participant