Skip to content

Conversation

@mvadari
Copy link
Collaborator

@mvadari mvadari commented Nov 17, 2025

High Level Overview of Change

This PR fixes some casting issues that resulted in some bad errors in the RPC CLIs, namely:

  • account_tx
  • book_offers
  • can_delete
  • connect
  • get_counts
  • tx_history

This PR also removes the proof parameter from book_offers, which isn't documented anywhere and also doesn't do anything (there will be no change in behavior except in the CLI, since rippled just ignores other parameters).

This also results in some serious simplification opportunities in the RPCCall_test tests.

Context of Change

Downstream of #6043

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)

API Impact

Some bugs were fixed in the CLI API. The proof parameter was also removed, which decreases the number of CLI params in book_offers.

There are no changes to HTTPS and WS API users.

Test Plan

CI passes. Tests were adjusted.

@mvadari mvadari requested a review from vvysokikh1 November 17, 2025 12:45
@mvadari mvadari requested a review from a team as a code owner November 17, 2025 12:45
@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 89.79592% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.6%. Comparing base (a3d4be4) to head (df52266).

Files with missing lines Patch % Lines
src/xrpld/rpc/detail/RPCCall.cpp 89.8% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #6044   +/-   ##
=======================================
  Coverage     78.6%   78.6%           
=======================================
  Files          818     818           
  Lines        68989   69012   +23     
  Branches      8248    8244    -4     
=======================================
+ Hits         54199   54226   +27     
+ Misses       14790   14786    -4     
Files with missing lines Coverage Δ
src/xrpld/app/misc/NetworkOPs.cpp 69.8% <ø> (ø)
src/xrpld/app/misc/NetworkOPs.h 100.0% <ø> (ø)
src/xrpld/rpc/handlers/BookOffers.cpp 98.9% <ø> (-<0.1%) ⬇️
src/xrpld/rpc/handlers/Subscribe.cpp 91.6% <ø> (ø)
src/xrpld/rpc/detail/RPCCall.cpp 93.9% <89.8%> (+0.2%) ⬆️

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

@mvadari mvadari changed the title fix casting issues in RPC CLIs fix casting issues in RPC CLIs, remove proof from book_offers Nov 17, 2025
@bthomee bthomee requested a review from Tapanito November 19, 2025 22:27

while (!bDone && iParams >= 2)
{
// VFALCO Why is Json::StaticString appearing on the right side?
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a flyby, does this comment still make sense? It's seems a little pointless

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is still factually correct (jss is Json::StaticString). Not sure why it's a problem though.

std::int64_t uLedgerMin = jvParams[1u].asInt();
std::int64_t uLedgerMax = jvParams[2u].asInt();
std::int32_t ledgerMin, ledgerMax;
if (auto ledgerMinOpt = jvParseInt(jvParams[1u]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be const

Suggested change
if (auto ledgerMinOpt = jvParseInt(jvParams[1u]))
if (auto const ledgerMinOpt = jvParseInt(jvParams[1u]))

Copy link
Collaborator

Choose a reason for hiding this comment

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

Here too, shouldn't we parse the ledgerMin as uint?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, -1 is a valid value. https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_tx

A value of -1 instructs the server to use the most recent validated ledger version available.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it, thanks! Might be worth adding a blurb in the comments though, explaining that.

std::int64_t uLedgerMin = jvParams[1u].asInt();
std::int64_t uLedgerMax = jvParams[2u].asInt();
std::int32_t ledgerMin, ledgerMax;
if (auto ledgerMinOpt = jvParseInt(jvParams[1u]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here too, shouldn't we parse the ledgerMin as uint?


#include <array>
#include <iostream>
#include <type_traits>
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: (driveby) This include isn't used.

@mvadari mvadari requested a review from Tapanito November 20, 2025 10:11
if (jvParams.size())
jvRequest[jss::min_count] = jvParams[0u].asUInt();
{
if (auto minCount = jvParseUInt(jvParams[0u]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

My bad, I missed this:

Suggested change
if (auto minCount = jvParseUInt(jvParams[0u]))
if (auto const minCount = jvParseUInt(jvParams[0u]))

{
jvRequest[jss::ip] = ip;
jvRequest[jss::port] = jvParams[1u].asUInt();
if (auto port = jvParseUInt(jvParams[1u]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I missed this too:

Suggested change
if (auto port = jvParseUInt(jvParams[1u]))
if (auto const port = jvParseUInt(jvParams[1u]))

if (input.find_first_not_of("0123456789") == std::string::npos)
jvRequest["can_delete"] = jvParams[0u].asUInt();
{
if (auto seq = jvParseUInt(jvParams[0u]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

And I missed this too:

Suggested change
if (auto seq = jvParseUInt(jvParams[0u]))
if (auto const seq = jvParseUInt(jvParams[0u]))

@mvadari mvadari requested a review from Tapanito November 20, 2025 12:20
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