Skip to content

Conversation

@pratikmankawde
Copy link
Collaborator

Context of Change

Complete details of the context of the change and the change itself is shared in the ticket associated with this.

I am not duplicating the details here to avoid redundancy and confusion.
I will add details of the test and impact in the ticket itself.

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

@pratikmankawde pratikmankawde changed the title Charge higher fees for and reject heavy tm get object by hash queries Charge higher fees for and reject heavy TMGetObjectByHashLimit queries Dec 8, 2025
@pratikmankawde pratikmankawde marked this pull request as ready for review December 8, 2025 13:45
@pratikmankawde pratikmankawde requested a review from a team as a code owner December 8, 2025 13:45
@bthomee bthomee requested a review from vlntb December 8, 2025 13:48
@ximinez
Copy link
Collaborator

ximinez commented Dec 8, 2025

Sharing this feedback from Slack:

I am looking at the code in PeerImp, and I misremembered a lot of the flow. getNodeFat is only used for a TMGetLedger request. TMGetObjectByHash is a completely different workflow.

However, I think TMGetLedger has at least part of the solution for this problem.

if (ledgerData.nodes_size() >=
    Tuning::hardMaxReplyNodes)
    break;

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.1%. Comparing base (41c1be2) to head (58b6258).

Files with missing lines Patch % Lines
src/xrpld/overlay/detail/PeerImp.cpp 0.0% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6110     +/-   ##
=========================================
- Coverage     79.1%   79.1%   -0.0%     
=========================================
  Files          836     836             
  Lines        71245   71247      +2     
  Branches      8321    8324      +3     
=========================================
- Hits         56353   56351      -2     
- Misses       14892   14896      +4     
Files with missing lines Coverage Δ
src/xrpld/overlay/detail/PeerImp.cpp 3.8% <0.0%> (-<0.1%) ⬇️

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

Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>

// Check if by adding this object, reply has reached its
// limit
if (reply.objects_size() == Tuning::hardMaxReplyNodes)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am putting this check here instead of limiting the for-loop itself because after we query a node by hash, we check for its validity, meaning, there might be invalid/unregistered hashes in the request. So, we shouldn't count them towards reply size.

Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

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

I love how much smaller and simpler this is than the original change! Nice work!

pratikmankawde and others added 3 commits December 12, 2025 11:07
update comparison operator.

Co-authored-by: Ed Hennis <ed@ripple.com>
combine strings

Co-authored-by: Ed Hennis <ed@ripple.com>
@pratikmankawde pratikmankawde changed the title Charge higher fees for and reject heavy TMGetObjectByHashLimit queries Limit reply size on TMGetObjectByHash queries Dec 12, 2025
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.

3 participants