Skip to content

feat: Add delegate filter param for account_tx RPC#6126

Open
PeterChen13579 wants to merge 24 commits intoXRPLF:developfrom
PeterChen13579:add_delegate_filter
Open

feat: Add delegate filter param for account_tx RPC#6126
PeterChen13579 wants to merge 24 commits intoXRPLF:developfrom
PeterChen13579:add_delegate_filter

Conversation

@PeterChen13579
Copy link
Copy Markdown
Collaborator

@PeterChen13579 PeterChen13579 commented Dec 8, 2025

High Level Overview of Change

This PR adds the ability to filter account_tx results based on transaction delegation. This is useful for scenarios where one account (the delegatee) signs and submits a transaction on behalf of another account (the delegator).

Context of Change

New Request Parameter:

"delegate": {
"delegate_filter": "actor" or "authorizer",
"counter_party": "account_address"
}

Example: If User A submits a transaction to C on behalf of B:
User B (The account holder) can query with delegate_filter: "actor" to find transactions signed by others (like User A where A acted on behalf of B).
User A (The signer) can query with delegate_filter: "authorizer" to find transactions they signed for others (like User B, since B authorized A to act on their behalf).
The counter_party field can be used in either case to filter by a specific valid address

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)

@PeterChen13579 PeterChen13579 requested a review from a team December 8, 2025 21:11
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 8, 2025

Codecov Report

❌ Patch coverage is 98.24561% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.0%. Comparing base (4dc923d) to head (4d91238).

Files with missing lines Patch % Lines
src/xrpld/rpc/handlers/account/AccountTx.cpp 96.8% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6126     +/-   ##
=========================================
- Coverage     82.0%   82.0%   -0.0%     
=========================================
  Files         1010    1010             
  Lines        76304   76359     +55     
  Branches      7486    7479      -7     
=========================================
+ Hits         62535   62579     +44     
- Misses       13769   13780     +11     
Files with missing lines Coverage Δ
include/xrpl/rdb/RelationalDatabase.h 100.0% <ø> (ø)
src/xrpld/app/misc/NetworkOPs.cpp 69.7% <100.0%> (ø)
src/xrpld/app/rdb/backend/detail/Node.cpp 60.5% <100.0%> (+1.8%) ⬆️
src/xrpld/rpc/handlers/account/AccountTx.cpp 87.9% <96.8%> (+1.3%) ⬆️

... and 4 files 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.

@kuznetsss
Copy link
Copy Markdown
Contributor

A few suggestions to the new API:

  • don't duplicate delegate in filter:
"delegate": {
  "filter": "delegatee" or "delegator",
  "counter_party": "account_address"
}
  • maybe use role instead of filter?

  • I remember we had some other naming ideas for delegator and delegatee, did you decide that these one are the best?

Comment thread src/xrpld/app/rdb/backend/detail/Node.cpp Outdated
Comment thread src/xrpld/rpc/handlers/account/AccountTx.cpp Outdated
@github-actions
Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 2, 2026

All conflicts have been resolved. Assigned reviewers can now start or resume their review.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

This PR has conflicts, please resolve them in order for the PR to be reviewed.

@PeterChen13579 PeterChen13579 changed the title feature: Add delegate filter param for account_tx RPC feat: Add delegate filter param for account_tx RPC Apr 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 6, 2026

All conflicts have been resolved. Assigned reviewers can now start or resume their review.

@github-actions
Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

@github-actions
Copy link
Copy Markdown

All conflicts have been resolved. Assigned reviewers can now start or resume their review.

Comment thread src/xrpld/app/rdb/backend/detail/Node.cpp
Comment thread src/xrpld/rpc/handlers/account/AccountTx.cpp Outdated
Copy link
Copy Markdown
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

Adds a new delegate request parameter to the account_tx RPC to filter results based on delegated transaction signing (delegator vs delegatee scenarios).

Changes:

  • Introduces DelegateFilter/DelegateType and parses the new delegate JSON node in account_tx.
  • Propagates the filter into relational DB paging options and applies filtering while iterating transaction rows.
  • Adds RPC unit tests validating correct filtering and malformed-parameter handling.

Reviewed changes

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

Show a summary per file
File Description
src/xrpld/rpc/handlers/account/AccountTx.cpp Parses the new delegate param and forwards it into DB paging options.
src/xrpld/app/rdb/backend/detail/Node.cpp Applies delegate-based filtering during accountTxPage iteration by comparing tx owner vs signer.
src/xrpld/app/misc/NetworkOPs.cpp Updates AccountTxPageOptions aggregate init to include the new delegate field.
src/test/rpc/AccountTx_test.cpp Adds delegation filtering tests and malformed-input coverage.
src/test/rpc/AccountObjects_test.cpp Minor test adjustment (const + designated initializer) unrelated to account_tx filtering.
include/xrpl/rdb/RelationalDatabase.h Adds delegate filter types and threads delegate through relevant option/result structs.
include/xrpl/protocol/jss.h Adds new JSON keys used by the feature (delegate_filter, counterparty, etc.).
.github/scripts/levelization/results/ordering.txt Updates module dependency ordering for the new xrpl.rdb > xrpl.json relationship.

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

Comment thread include/xrpl/rdb/RelationalDatabase.h Outdated
Comment thread src/xrpld/app/rdb/backend/detail/Node.cpp Outdated
Comment thread src/xrpld/rpc/handlers/account/AccountTx.cpp Outdated
Comment thread src/xrpld/app/rdb/backend/detail/Node.cpp Outdated
Comment thread src/xrpld/app/rdb/backend/detail/Node.cpp Outdated
Comment thread src/xrpld/rpc/handlers/account/AccountTx.cpp Outdated
Comment thread src/xrpld/app/rdb/backend/detail/Node.cpp Outdated
Comment thread src/xrpld/app/rdb/backend/detail/Node.cpp Outdated
@github-actions
Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

@github-actions
Copy link
Copy Markdown

All conflicts have been resolved. Assigned reviewers can now start or resume their review.

Copy link
Copy Markdown
Contributor

@kuznetsss kuznetsss left a comment

Choose a reason for hiding this comment

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

LGTM, one minor comment

Comment thread src/xrpld/app/rdb/backend/detail/Node.cpp
@PeterChen13579 PeterChen13579 added this to the 3.2.0 milestone May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants