Skip to content

refactor: Move decreaseOwnerCount onto AccountRootEntry - #8427

Open
mvadari wants to merge 4 commits into
mvadari/rearch/accountroot-increaseOwnerCountfrom
mvadari/rearch/accountroot-decreaseOwnerCount
Open

mvadari wants to merge 4 commits into
mvadari/rearch/accountroot-increaseOwnerCountfrom
mvadari/rearch/accountroot-decreaseOwnerCount

Conversation

@mvadari

@mvadari mvadari commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

Replaces the entry-taking decreaseOwnerCount(view, accountSle, sponsorSle, count, j) free function with the writable member AccountRootEntry::decreaseOwnerCount(sponsorSle, count), and removes the temporary friend declaration added in #8423. The member uses the entry's view and journal, so call sites pass their journal to the entry constructor. The AccountID-based overload stays as a shim. decreaseOwnerCountForObject stays a free function (a later pass moves it) and now calls the member.

Context of Change

Part of the Wrapped SLEs migration (design: step 2/3 of #7886). Owner-count updates now need a writable AccountRootEntryW, so the compiler rejects them on a read-only entry. Pure refactor: no amendment, no behavior change; any observable difference is a bug.

Stacked on #8423; review only the last commit.

This PR was fully written by AI (Claude Code) under human direction; the human author reviewed the diff.

API Impact

  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)

Test Plan

Syntax-checked (clang++ -fsyntax-only with project flags) every changed .cpp and every .cpp that includes AccountRootEntry.h or AccountRootHelpers.h (98/98 passed). clang-tidy clean on all changed files and headers; pre-commit clean. No new tests. CI runs the full unit test suite.

🤖 Generated with Claude Code

@ripple-ai-reviewer ripple-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.

Clean mechanical refactor moving decreaseOwnerCount to a writable member of AccountRootEntry, mirroring the increaseOwnerCount pattern already established. Call sites were updated consistently across RippleStateHelpers.cpp, TokenHelpers.cpp, OracleSet.cpp, and TrustSet.cpp — entry constructors now pass the journal so the member can drop the separate view/journal parameters, and the AccountID-shim overload and decreaseOwnerCountForObject were updated to delegate to the new member. No behavioral divergence from the prior free function is apparent; the assertion, bounds check, and delegation to adjustOwnerCountSigned are preserved verbatim. No correctness, security, or consistency issues found in the changed lines.

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mvadari
mvadari force-pushed the mvadari/rearch/accountroot-decreaseOwnerCount branch from f221d6c to 504da68 Compare September 30, 2026 14:29

@ripple-ai-reviewer ripple-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.

Clean, mechanical refactor that moves decreaseOwnerCount onto AccountRootEntry as a writable member, mirroring the existing increaseOwnerCount pattern, and removes the now-unnecessary friend declaration. Traced every call site (RippleStateHelpers, TokenHelpers, OracleSet, TrustSet, AccountRootHelpers) and the journal passed to each entry constructor matches the journal previously passed explicitly to the free function, so there's no behavioral drift. The AccountID-based overload shim and decreaseOwnerCountForObject correctly delegate to the new member. No correctness, security, or consistency issues found in the changed lines.

@mvadari
mvadari force-pushed the mvadari/rearch/accountroot-decreaseOwnerCount branch from 504da68 to 398fd76 Compare September 30, 2026 17:58
@mvadari
mvadari added this pull request to stack #8448 September 30, 2026 17:59
@mvadari
mvadari force-pushed the mvadari/rearch/accountroot-decreaseOwnerCount branch from 398fd76 to 789145a Compare October 5, 2026 13:58
Replace the entry-taking decreaseOwnerCount free function with a
writable member of AccountRootEntry, and drop the temporary friend
declaration from the previous change. The member uses the entry's view
and journal, so call sites pass their journal to the entry constructor.
The AccountID-based overload stays as a shim.
@mvadari
mvadari force-pushed the mvadari/rearch/accountroot-decreaseOwnerCount branch from 789145a to 16389dc Compare October 5, 2026 14:52

@ripple-ai-reviewer ripple-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.

This is a clean, mechanical refactor that moves decreaseOwnerCount from a free function onto AccountRootEntry as a writable member, removing the temporary friend declaration from #8423. I traced each call site to confirm the journal value now passed into the AccountRootEntryW/AccountRootEntry constructor matches the journal that was previously passed directly to the free function call (RippleStateHelpers.cpp, TokenHelpers.cpp, AccountRootHelpers.h shim, deleteAMMTrustLine's ternary-selected entry), and the moved implementation in AccountRootEntry.cpp is a faithful copy of the original logic (same assert, same bounds check, same delegation to adjustOwnerCountSigned). No behavior changes were introduced on any added/changed line.

…dari/rearch/accountroot-decreaseOwnerCount

# Conflicts:
#	src/libxrpl/ledger/helpers/AccountRootHelpers.cpp
@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.

@ripple-ai-reviewer ripple-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 found.

This branch has not been deployed

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

1 participant