Skip to content

feat: add more fields to server_definitions#5702

Closed
mvadari wants to merge 43 commits intoXRPLF:developfrom
mvadari:server_definitions2
Closed

feat: add more fields to server_definitions#5702
mvadari wants to merge 43 commits intoXRPLF:developfrom
mvadari:server_definitions2

Conversation

@mvadari
Copy link
Collaborator

@mvadari mvadari commented Aug 18, 2025

High Level Overview of Change

This PR greatly expands what is included in the server_definitions RPC. The following are now added:

  • Transaction formats
  • Ledger entry formats
  • Transaction flags
  • AccountSet flags (asf flags)
  • Ledger entry flags

Context of Change

Alternative to #5616
Closes #5151

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

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)

Test Plan

TODO, waiting for feedback on the format before putting in that effort

@mvadari mvadari added the DraftRunCI Normally CI does not run on draft PRs. This opts in. label Aug 18, 2025
@mvadari mvadari force-pushed the server_definitions2 branch from 0e8fb16 to fa0d5a6 Compare August 22, 2025 17:37
@codecov
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.9%. Comparing base (ac0ad36) to head (6c8a48c).
⚠️ Report is 19 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #5702   +/-   ##
=======================================
  Coverage     79.9%   79.9%           
=======================================
  Files          842     842           
  Lines        65538   65597   +59     
  Branches      7253    7250    -3     
=======================================
+ Hits         52380   52443   +63     
+ Misses       13158   13154    -4     
Files with missing lines Coverage Δ
src/libxrpl/protocol/LedgerFormats.cpp 100.0% <100.0%> (ø)
src/libxrpl/protocol/TxFormats.cpp 100.0% <100.0%> (ø)
src/xrpld/app/tx/detail/AMMDeposit.cpp 96.6% <100.0%> (ø)
src/xrpld/app/tx/detail/AMMWithdraw.cpp 95.9% <100.0%> (ø)
src/xrpld/app/tx/detail/Change.cpp 85.3% <100.0%> (ø)
src/xrpld/app/tx/detail/Clawback.cpp 98.9% <100.0%> (ø)
src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp 100.0% <100.0%> (ø)
src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp 100.0% <100.0%> (ø)
src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp 94.6% <100.0%> (ø)
src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp 100.0% <100.0%> (ø)
... and 4 more

... 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.

@mvadari mvadari removed the DraftRunCI Normally CI does not run on draft PRs. This opts in. label Nov 18, 2025
@mvadari mvadari marked this pull request as ready for review November 18, 2025 16:03
@mvadari mvadari requested a review from a team November 18, 2025 16:03
@bthomee bthomee marked this pull request as draft November 21, 2025 16:11
@bthomee bthomee added the DraftRunCI Normally CI does not run on draft PRs. This opts in. label Nov 21, 2025
Copilot AI review requested due to automatic review settings December 2, 2025 22:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR significantly expands the server_definitions RPC endpoint to provide comprehensive protocol definition information. The main change is adding transaction formats, ledger entry formats, transaction flags, ledger entry flags, and AccountSet flags to the RPC response. To support this, the code refactors flag definitions using X-macros for better maintainability and to enable programmatic generation of flag maps for the RPC output.

Key changes:

  • Adds new fields to server_definitions RPC: TRANSACTION_FORMATS, LEDGER_ENTRY_FORMATS, TRANSACTION_FLAGS, LEDGER_ENTRY_FLAGS, and ACCOUNT_SET_FLAGS
  • Refactors TxFlags.h and LedgerFormats.h to use X-macros for defining flags, generating masks, and creating flag maps
  • Updates flag mask names across transaction handlers for consistency (e.g., tfDepositMasktfAMMDepositMask, tfBridgeModifyMasktfXChainModifyBridgeMask)

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/xrpld/rpc/handlers/ServerDefinitions.cpp Populates new RPC fields with transaction formats, ledger entry formats, and flag definitions
include/xrpl/protocol/TxFlags.h Major refactoring to use X-macros for flag definitions, mask generation, and flag map creation
include/xrpl/protocol/LedgerFormats.h Refactors ledger flags using X-macros and adds getCommonFields() method
include/xrpl/protocol/TxFormats.h Adds getCommonFields() method declaration
src/libxrpl/protocol/TxFormats.cpp Extracts common transaction fields into getCommonFields() method
src/libxrpl/protocol/LedgerFormats.cpp Extracts common ledger entry fields into getCommonFields() method
include/xrpl/protocol/jss.h Adds JSON field name constants for new RPC response fields
src/xrpld/app/tx/detail/*.cpp Updates flag mask references to use new standardized names
src/test/rpc/ServerDefinitions_test.cpp Contains debug output that should be removed
src/test/app/AccountSet_test.cpp Fixes test suite category from rpc to app

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
Env env(*this);
auto const result = env.rpc("server_definitions");
std::cout << result.toStyledString() << std::endl;
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Debug output statement (std::cout) should be removed before merging. This appears to be leftover from development/testing.

Suggested change
std::cout << result.toStyledString() << std::endl;

Copilot uses AI. Check for mistakes.
Comment on lines +159 to +163
TRANSACTION(Batch, \
TF_FLAG(tfAllOrNothing, 0x00010000) \
TF_FLAG(tfOnlyOne, 0x00020000) \
TF_FLAG(tfUntilFailure, 0x00040000) \
TF_FLAG(tfIndependent, 0x00080000)) \
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The old tfBatchMask definition included special handling: ~(tfUniversal | ...) | tfInnerBatchTxn which added back the tfInnerBatchTxn flag to make it explicitly allowed. The macro-generated version will produce ~(tfUniversal | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent) which inherently disallows tfInnerBatchTxn since tfInnerBatchTxn is part of tfUniversal. This changes the behavior - the old code explicitly allowed tfInnerBatchTxn for Batch transactions, but the new macro-generated mask will disallow it. The original code had a comment indicating this was intentional to prevent nested Batch transactions. Please verify this behavior change is intended.

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +157
TF_FLAG(tfVaultPrivate, lsfVaultPrivate) \
TF_FLAG(tfVaultShareNonTransferable, 0x00020000)) \
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The old code included static_assert(tfVaultPrivate == lsfVaultPrivate); to ensure these flags maintain the same value. This compile-time check has been removed in the new macro-based implementation. While tfVaultPrivate is defined as lsfVaultPrivate (line 156), removing the static assertion means there's no compile-time verification if lsfVaultPrivate changes. Consider adding this assertion back after the macro expansions to maintain this safety check.

Copilot uses AI. Check for mistakes.
@mvadari mvadari force-pushed the server_definitions2 branch from 390185c to 571950d Compare January 7, 2026 18:18
@mvadari mvadari added the Blocked: Needs Draft XLS The corresponding draft XLS must have been merged before this PR is merged. label Jan 28, 2026
Tapanito and others added 12 commits February 4, 2026 16:29
This change adds the project configuration directory to `.gitignore` for the `zed` editor. 

As per the [documentation](https://zed.dev/docs/remote-development?highlight=.zed#zed-settings), the project configuration files are stored in the `.zed` directory at the project root dir.
This change introduces the `fixExpiredNFTokenOfferRemoval` amendment that allows expired offers to pass through `preclaim()` and be deleted in `doApply()`, following the same pattern used for expired credentials.
Currently we're passing the `Application` object around, whereby the `Application` class acts more like a service registry that gives other classes access to other services. In order to allow modularization, we should replace `Application` with a service registry class so that modules depending on `Application` for other services can be moved easily. This change adds the `ServiceRegistry` class.
Unity builds were intended to speed up builds, by bundling multiple files into compilation units. However, now that ccache is available on all platforms, there is no need for unity builds anymore, as ccache stores compiled individual build objects for reuse. This change therefore removes the ability to make unity builds.
This change replaces all include guards in the `src/` and `include/` directories by `#pragma once`.
@mvadari
Copy link
Collaborator Author

mvadari commented Feb 24, 2026

Closing in favor of #6321

@mvadari mvadari closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocked: Needs Draft XLS The corresponding draft XLS must have been merged before this PR is merged. DraftRunCI Normally CI does not run on draft PRs. This opts in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add transaction and ledger entry formats to server_definitions

8 participants