Sponsored Content
Skip to content

fix: Remove superfluous view update from credentials - #6545

Merged
bthomee merged 3 commits into
XRPLF:developfrom
oleks-rip:rm_upd
Mar 23, 2026
Merged

fix: Remove superfluous view update from credentials#6545
bthomee merged 3 commits into
XRPLF:developfrom
oleks-rip:rm_upd

Conversation

@oleks-rip

Copy link
Copy Markdown
Contributor

High Level Overview of Change

Subject account doesn't change when credentials where created by issuer, therefore its update is not necessary.

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

@oleks-rip oleks-rip changed the title Remove superfluous view update from credentials fix: remove superfluous view update from credentials Mar 12, 2026
@oleks-rip
oleks-rip requested a review from vvysokikh1 March 12, 2026 20:04
@oleks-rip oleks-rip changed the title fix: remove superfluous view update from credentials fix: Remove superfluous view update from credentials Mar 12, 2026
@oleks-rip oleks-rip added the Trivial Simple change with minimal effect, or already tested. Only needs one approval. label Mar 12, 2026
@codecov

codecov Bot commented Mar 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.4%. Comparing base (6efd312) to head (0f22e5d).
⚠️ Report is 12 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6545     +/-   ##
=========================================
- Coverage     81.5%   81.4%   -0.0%     
=========================================
  Files          988     988             
  Lines        74411   74410      -1     
  Branches      7559    7556      -3     
=========================================
- Hits         60609   60606      -3     
- Misses       13802   13804      +2     
Files with missing lines Coverage Δ
...pl/tx/transactors/credentials/CredentialCreate.cpp 100.0% <100.0%> (ø)

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

if (!page)
return tecDIR_FULL;
sleCred->setFieldU64(sfSubjectNode, *page);
view().update(view().peek(keylet::account(subject)));

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.

In what way is this superfluous?

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.

The subject's account keylet is never modified. The SLE is never even checked out.
See the metadata in this transaction for an example: https://xrpscan.com/tx/991F8E93B4CF0B2D0A9479E76A5BEF3B62B755F075F249EC142A9B942B7E9E5E

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.

The subject's account keylet is never modified. The SLE is never even checked out. See the metadata in this transaction for an example: xrpscan.com/tx/991F8E93B4CF0B2D0A9479E76A5BEF3B62B755F075F249EC142A9B942B7E9E5E

That may be intentional. By marking the account as modified, it shows up in the metadata. It also gets threaded, and is included in the account_tx RPC lookup. Since the object is added to the subject's directory, it makes sense to me to include the subject's account.

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.

For example, I'll bet TrustSet does the same thing, though maybe through a different mechanism for the other side when creating a new trust line.

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.

It doesn't show up in the metadata, though

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.

It will not show in metadata if curNode == origNode, as it seems to be the case here

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.

I'm looking at the block above and I see that the issuer has the same logic, but increments counter when we add an object to the account. Should this actually be the same here for subject?

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.

The counter shouldn't be incremented because it's not the subject that's bearing the reserve cost for the credential upon creation (otherwise you could spam someone with credentials and use up all their XRP in reserves).

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.

I don't see any problem with this change then.

I will leave it for @ximinez to decide since he raised this question

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ximinez told me that it is ok to remove the update call if it has no effect. I think we can continue here.

@oleks-rip oleks-rip added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label Mar 19, 2026
@bthomee

bthomee commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator

/ai-review

@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 Opus 4.6 · Prompt: V12

@bthomee
bthomee added this pull request to the merge queue Mar 23, 2026
Merged via the queue into XRPLF:develop with commit dcfcdab Mar 23, 2026
3 checks passed
@mvadari mvadari added the AI Triage Bugs and fixes that have been triaged via AI initiatives label Mar 24, 2026
@mvadari mvadari added this to the 3.2.0 milestone May 20, 2026
beartec-jpg pushed a commit to beartec-jpg/FalconLedger that referenced this pull request Jun 1, 2026
@oleks-rip
oleks-rip deleted the rm_upd branch June 6, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Triage Bugs and fixes that have been triaged via AI initiatives Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. Trivial Simple change with minimal effect, or already tested. Only needs one approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants