Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor mpt_issuance_id into SLE::getJson #42

Merged

Conversation

shawnxie999
Copy link

@shawnxie999 shawnxie999 commented Oct 16, 2024

High Level Overview of Change

Missing mpt_issuance_id in ledger_entry response if the object type is MPTokenIssuance. Although not necessary (since the user probably already knows the mpt id in their request), we still should make things consistent by injecting the id into the response if it's a MPTokenIssuance object.

Context of Change

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

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@shawnxie999 shawnxie999 changed the title add mpt id add mpt id in ledger_entry Oct 16, 2024
@@ -774,7 +774,12 @@ doLedgerEntry(RPC::JsonContext& context)
}
else
{
jvResult[jss::node] = sleNode->getJson(JsonOptions::none);
auto sleJson = sleNode->getJson(JsonOptions::none);
Copy link
Owner

Choose a reason for hiding this comment

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

Somehow this doesn't feel right. We did specialized parsing above and now we do it again.

Copy link
Author

Choose a reason for hiding this comment

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

The specialized parsing above is only to find which object index given the request params. Here we are injecting the synthetic field after we've retrieved the object from DB. So I do believe this is the right place.

Copy link
Author

Choose a reason for hiding this comment

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

But, I think we can refactor this. I think i can move this code to STLedgerEntry, let me refactor it

Copy link
Owner

Choose a reason for hiding this comment

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

Sure. But we have already parsed all ledger entries and we are of doing it again. What if more ledger entries require this special processing then we pretty much have to repeat specialized type parsing again. Maybe we could have a global json variable, which is set during the ledger entry parsing and then the values from this variable are copied into sleJson?

@shawnxie999 shawnxie999 changed the title add mpt id in ledger_entry add mpt id into SLE::getJson Oct 16, 2024
@shawnxie999 shawnxie999 changed the title add mpt id into SLE::getJson refactor mpt_issuance_id into SLE::getJson Oct 16, 2024
@gregtatcam gregtatcam merged commit 924dd9c into gregtatcam:feature/mpt-v1-var-issues Oct 16, 2024
3 of 8 checks passed
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.

2 participants