Skip to content

Conversation

@mvadari
Copy link
Collaborator

@mvadari mvadari commented Oct 15, 2025

High Level Overview of Change

This PR removes include/xrpl/json/Object.h and all downstream files. There are a number of minor downstream changes as well.

Full list of deleted classes and functions:

  • Json::Collections
  • Json::Object
  • Json::Array
  • Json::WriterObject
  • Json::setArray
  • Json::addObject
  • Json::appendArray
  • Json::appendObject

The last helper function, copyFrom, seemed a bit more complex and was actually used in a few places, so it was moved to LedgerToJson.h instead of deleting it.

Context of Change

Json::Object and related objects are not used at all - probably some piece of legacy code that was forgotten about.

Type of Change

  • Refactor (non-breaking change that only restructures code)

API Impact

N/A - no change in behavior, pure refactor

Test Plan

Json::Object-specific tests were removed, and all other tests pass.

@mvadari mvadari requested a review from a team as a code owner October 15, 2025 17:17
@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 81.81818% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.5%. Comparing base (5e33ca5) to head (81e84d2).

Files with missing lines Patch % Lines
src/xrpld/app/ledger/detail/LedgerToJson.cpp 73.7% 5 Missing ⚠️
src/xrpld/rpc/handlers/LedgerHandler.cpp 73.7% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #5894    +/-   ##
========================================
  Coverage     79.5%   79.5%            
========================================
  Files          817     814     -3     
  Lines        72210   72064   -146     
  Branches      8280    8252    -28     
========================================
- Hits         57398   57302    -96     
+ Misses       14812   14762    -50     
Files with missing lines Coverage Δ
include/xrpl/protocol/ErrorCodes.h 100.0% <ø> (ø)
src/libxrpl/protocol/ErrorCodes.cpp 90.9% <100.0%> (+5.2%) ⬆️
src/libxrpl/protocol/RPCErr.cpp 100.0% <100.0%> (ø)
src/xrpld/app/ledger/LedgerToJson.h 100.0% <ø> (ø)
src/xrpld/rpc/Status.h 100.0% <100.0%> (ø)
src/xrpld/rpc/detail/RPCHelpers.h 100.0% <100.0%> (ø)
src/xrpld/rpc/handlers/Version.h 100.0% <100.0%> (ø)
src/xrpld/app/ledger/detail/LedgerToJson.cpp 76.3% <73.7%> (-1.0%) ⬇️
src/xrpld/rpc/handlers/LedgerHandler.cpp 26.4% <73.7%> (+5.5%) ⬆️

... and 3 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 added the Tech Debt Non-urgent improvements label Oct 15, 2025
Copy link
Collaborator

@godexsoft godexsoft left a comment

Choose a reason for hiding this comment

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

Looks pretty good 👍 Leaving a few nits.

template <class JsonValue>
void
inject_error(error_code_i code, JsonValue& json)
inline void
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: This does not actually have to be in the header anymore. I'd move it to the cpp file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

void
inject_error(error_code_i code, std::string const& message, JsonValue& json)
inline void
inject_error(error_code_i code, std::string const& message, Json::Value& json)
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is probably some reason why this was int. Maybe someone else will be able to remember/explain why

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 assumed it was for Json::Object reasons

// VFALCO NOTE Deprecated function
Json::Value
rpcError(int iError)
rpcError(error_code_i iError)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it even still used? says it's deprecated above so maybe possible to remove entirely. Worth checking

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, still used pretty heavily. I didn't want to refactor it out here because it would have expanded the scope a lot, and this PR is pretty wide as-is.

{
XRPL_ASSERT(
from.isObjectOrNull(), "Json::doCopyFrom : valid input type");
auto members = from.getMemberNames();
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: This and below can be const i think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

to = from;
else
{
XRPL_ASSERT(
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: The function is not called doCopyFrom

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

a1q123456 added a commit that referenced this pull request Oct 23, 2025
a1q123456 added a commit that referenced this pull request Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tech Debt Non-urgent improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants