Skip to content

fix: Assorted AI comments#7569

Open
mvadari wants to merge 8 commits into
xrplf/sponsorfrom
mvadari/sponsor/fix-ledger-entry
Open

fix: Assorted AI comments#7569
mvadari wants to merge 8 commits into
xrplf/sponsorfrom
mvadari/sponsor/fix-ledger-entry

Conversation

@mvadari

@mvadari mvadari commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

High Level Overview of Change

This PR:

  • Fixes an issue in invariants (just order of calls so that tests pass)
  • Adds ledger_entry tests
  • Fixes a log line
  • Simplify the TxFlags.h changes (they were a bit overengineered previously, since they don't need to be in server_definitions)

Context of Change

API Impact

N/A

Copilot AI review requested due to automatic review settings June 17, 2026 21:24

static std::expected<uint256, json::Value>
parseTicket(
parseSponsorship(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This diff is hard to read, I just properly alphabetized the location of parseSponsorship

}

if (deltaSponsoredObjectOwnerCount_ != deltaSponsoredOwnerCount_)
if (invalidOwnerCountLessThanSponsoredOwnerCount_ > 0)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This diff is hard to read, I just swapped the two checks

@mvadari mvadari requested review from Kassaking7 and yinyiqian1 June 17, 2026 21:25

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues.

Review by Claude Sonnet 4.6 · Prompt: V15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 aligns the ledger_entry RPC parsing with the correct parameter schemas for Sponsorship/Ticket/Vault entries, adds coverage for Sponsorship ledger_entry requests, and adjusts an invariant check ordering/message path so the associated tests pass consistently.

Changes:

  • Fix ledger_entry parser dispatch by ensuring parseSponsorship, parseTicket, and parseVault each parse the appropriate fields and compute the correct ledger key.
  • Add ledger_entry RPC tests covering Sponsorship lookup by (sponsor, sponsee) and by index, including malformed-field cases.
  • Reorder Sponsorship invariant finalize checks and tweak a runtime error string for clarity.

Reviewed changes

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

Show a summary per file
File Description
src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp Corrects the per-ledger-entry parser functions so Sponsorship/Ticket/Vault requests interpret the right JSON fields and derive the right keylets.
src/test/rpc/LedgerEntry_test.cpp Adds Sponsorship ledger_entry tests and extends field-type mappings used by malformed-input test scaffolding.
src/test/app/Invariants_test.cpp Ensures the Sponsorship invariant test is executed as part of the invariants test suite run.
src/libxrpl/tx/invariants/SponsorshipInvariant.cpp Reorders invariant failure checks to match intended precedence and test expectations.
src/libxrpl/ledger/helpers/NFTokenHelpers.cpp Clarifies an exception message used when repair is impossible due to a link inconsistency.

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

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.2%. Comparing base (d1a77b4) to head (0ba98dd).

Files with missing lines Patch % Lines
src/libxrpl/tx/invariants/SponsorshipInvariant.cpp 66.7% 2 Missing ⚠️
src/libxrpl/ledger/helpers/NFTokenHelpers.cpp 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##           xrplf/sponsor   #7569   +/-   ##
=============================================
  Coverage           82.2%   82.2%           
=============================================
  Files               1016    1016           
  Lines              78401   78401           
  Branches            9012    9002   -10     
=============================================
+ Hits               64440   64454   +14     
+ Misses             13952   13938   -14     
  Partials               9       9           
Files with missing lines Coverage Δ
include/xrpl/protocol/TxFlags.h 100.0% <ø> (ø)
src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp 84.3% <100.0%> (+2.3%) ⬆️
src/libxrpl/ledger/helpers/NFTokenHelpers.cpp 89.3% <0.0%> (ø)
src/libxrpl/tx/invariants/SponsorshipInvariant.cpp 96.4% <66.7%> (+3.6%) ⬆️

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

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues.

Review by Claude Sonnet 4.6 · Prompt: V15

}

if (deltaSponsoredObjectOwnerCount_ != deltaSponsoredOwnerCount_)
if (invalidOwnerCountLessThanSponsoredOwnerCount_ > 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

GetANameThatNotSoLongOrMaybe2Instead

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues.

Review by Claude Sonnet 4.6 · Prompt: V15

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues.

Review by Claude Sonnet 4.6 · Prompt: V15

jvParams[jss::sponsorship][jss::sponsor] = alice.human();
jvParams[jss::sponsorship][jss::sponsee] = bob.human();
jvParams[jss::ledger_hash] = ledgerHash;
json::Value const jrr =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: auto

json::Value jvParams;
jvParams[jss::sponsorship] = sponsorshipIndex;
jvParams[jss::ledger_hash] = ledgerHash;
json::Value const jrr =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: auto

env(sponsor::set(alice, 0), sponsor::SponseeAcc(bob));
env.close();
std::string const ledgerHash{to_string(env.closed()->header().hash)};
std::string sponsorshipIndex;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is cleaner not to carry mutable state (sponsorshipIndex) between blocks.
It is currently being set in block 1, and being reused in block 2.

We can initialize it with the value, something like: auto const sponsorshipIndex = to_string(keylet::sponsor(alice.id(), bob.id()).key);

and verify it in both block 1 and block 2.

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.

4 participants