Sponsored Content
Skip to content

refactor: signature autofilling for Simulate RPC - #5852

Merged
bthomee merged 1 commit into
XRPLF:developfrom
tequdev:refactor-simulate-autofill
Oct 16, 2025
Merged

refactor: signature autofilling for Simulate RPC#5852
bthomee merged 1 commit into
XRPLF:developfrom
tequdev:refactor-simulate-autofill

Conversation

@tequdev

@tequdev tequdev commented Oct 4, 2025

Copy link
Copy Markdown
Member

High Level Overview of Change

Refactor to enable autofilling of signature-related fields in the Simulate RPC for use in the Signature field (like for Lending, Sponsor feature) as well

Type of Change

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

@tequdev
tequdev requested a review from a team October 4, 2025 05:40
@codecov

codecov Bot commented Oct 4, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.5%. Comparing base (e80642f) to head (e4ae71b).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #5852     +/-   ##
=========================================
- Coverage     79.5%   79.5%   -0.0%     
=========================================
  Files          816     816             
  Lines        72180   72184      +4     
  Branches      8278    8276      -2     
=========================================
- Hits         57362   57358      -4     
- Misses       14818   14826      +8     
Files with missing lines Coverage Δ
src/xrpld/rpc/handlers/Simulate.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.

@mvadari mvadari added the Trivial Simple change with minimal effect, or already tested. Only needs one approval. label Oct 9, 2025
@mvadari

mvadari commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

@tequdev is this PR ready to merge?

@tequdev

tequdev commented Oct 10, 2025

Copy link
Copy Markdown
Member Author

@tequdev is this PR ready to merge?

yes👍

@mvadari mvadari 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 Oct 10, 2025
if (sigObject.isMember(jss::Signers))
{
if (!tx_json[jss::Signers].isArray())
if (!sigObject[jss::Signers].isArray())

@pratikmankawde pratikmankawde Oct 10, 2025

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.

Question/Suggestion: Shouldn't this check !sigObject[jss::Signers].isArray() happen even before this function is called?

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.

@tequdev do you have a response?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@pratikmankawde What's the reason for that?

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 name of the function suggests that it fills signatures into objects. But this function is also checking if the json object passed-in has the sub-objects created with correct data types. I think this function should only be called if the object types are correct(Json is valid). Hence the check should happen before.

There should be a separate function to check the validity of the json. Separation of concerns and responsibilities.

Right now we return an error if the json object is malformed. At some point we may want to recreate the sub-objects of proper types.

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.

That feels unnecessary - why look at the jss:Signers field twice in two different places? Makes way more sense to me to just check before you're going to need to work with it.

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.

My suggestion was to still do it once, just outside this function and before calling this. We then don't call this function if the field data types are not what we expect. Unless there's a case where sigObject[jss::Signers] is expected to be a scalar.

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.

Instead of adding a precondition to this function that you have to remember to check before you call it, it feels more robust to check it inside the function. That's also generally the pattern in this repo.

@bthomee bthomee added Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. and removed Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. labels Oct 14, 2025
This change enables autofilling of signature-related fields in the Simulate RPC.
@bthomee
bthomee force-pushed the refactor-simulate-autofill branch from a6b0eff to e4ae71b Compare October 16, 2025 15:34
@bthomee
bthomee enabled auto-merge October 16, 2025 15:34
@bthomee
bthomee added this pull request to the merge queue Oct 16, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2025
@bthomee
bthomee added this pull request to the merge queue Oct 16, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2025
@bthomee
bthomee added this pull request to the merge queue Oct 16, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2025
@bthomee
bthomee added this pull request to the merge queue Oct 16, 2025
Merged via the queue into XRPLF:develop with commit b4c894c Oct 16, 2025
3 checks passed
@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
This change enables autofilling of signature-related fields in the Simulate RPC.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants