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

Fix 2.0 regression in tx method with binary output #4812

Merged
merged 7 commits into from
Nov 16, 2023

Conversation

Bronek
Copy link
Collaborator

@Bronek Bronek commented Nov 13, 2023

High Level Overview of Change

Fixes regression caused by #4775
This PR resolves #4811

Context of Change

The STTx::getJson was changed in API version 2 to allow for returning binary output as a single hex-encoded JSON string (not a JSON object). This caused regression inside Transaction::getJson which will attempt to append fields to that not-an-object, resulting in failed JSON operation. This change is fixing this regression and adds a relevant test.

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)
  • 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

@Bronek Bronek marked this pull request as ready for review November 13, 2023 14:13
Copy link
Collaborator

@seelabs seelabs left a comment

Choose a reason for hiding this comment

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

👍

@Bronek Bronek mentioned this pull request Nov 13, 2023
Copy link
Collaborator

@arihantkothari arihantkothari left a comment

Choose a reason for hiding this comment

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

Lgtm 👍 Thanks for the changes.

src/test/rpc/Transaction_test.cpp Outdated Show resolved Hide resolved
src/test/rpc/Transaction_test.cpp Outdated Show resolved Hide resolved
src/test/rpc/Transaction_test.cpp Outdated Show resolved Hide resolved
@Bronek Bronek requested a review from ximinez November 15, 2023 17:12
Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

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

This is good to go as-is, but I left a suggestion to improve readability.

@@ -791,13 +791,13 @@ class Transaction_test : public beast::unit_test::suite
auto const USD{gw["USD"]};

env.fund(XRP(1000000), alice, gw);
std::shared_ptr<STTx const> txn = env.tx();
std::shared_ptr<STTx const> const txn = env.tx();
Copy link
Collaborator

Choose a reason for hiding this comment

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

On second thought, you're calling getTransactionID four times. Why not store it here, and use it at all of the calls?

        uint256 const txID = txn->getTransactionID();

(You'll have to change the lambda capture to get &txID instead of txn.)

@intelliot intelliot added this to the 2.0.0 milestone Nov 16, 2023
@manojsdoshi manojsdoshi merged commit d593972 into XRPLF:develop Nov 16, 2023
16 checks passed
manojsdoshi added a commit that referenced this pull request Nov 20, 2023
* Support for the mold linker (#4807)

* Promote API version 2 to supported (#4803)

* Promote API version 2 to be supported

* Switch the command line to API version 1

* Fix LedgerRequestRPC test

* Remove obsolete tx_account method

This method is not implemented, the only parts which are removed are related to command-line parsing

* Fix RPCCall test

* Reduce diff size, small test improvements

* Minor fixes

* Support for the mold linker

* Fix TransactionEntry_test

* Fix AccountTx_test

---------

Co-authored-by: seelabs <[email protected]>

* Update Linux smoketest distros (#4813)

* Fix 2.0 regression in tx method with binary output (#4812)

* Fix binary output from tx method

* Formatting fix

* Minor test improvement

* Minor test improvements

* Optimize calculation of close time to avoid impasse and minimize gratuitous proposal changes (#4760)

* Optimize the calculation of close time to avoid
impasse and minimize gratuitous proposal changes.

* git apply clang-format.patch

* Scott S review fixes. Also clang-format.

* Set version to 2.0.0-rc2

---------

Co-authored-by: manoj <[email protected]>
Co-authored-by: Scott Determan <[email protected]>
Co-authored-by: Bronek Kozicki <[email protected]>
Co-authored-by: Michael Legleux <[email protected]>
Co-authored-by: Mark Travis <[email protected]>
ximinez pushed a commit to ximinez/rippled that referenced this pull request Nov 21, 2023
* Fix binary output from tx method

* Formatting fix

* Minor test improvement

* Minor test improvements
manojsdoshi pushed a commit to manojsdoshi/rippled that referenced this pull request Nov 21, 2023
* Fix binary output from tx method

* Formatting fix

* Minor test improvement

* Minor test improvements
sophiax851 pushed a commit to sophiax851/rippled that referenced this pull request Jun 12, 2024
* Fix binary output from tx method

* Formatting fix

* Minor test improvement

* Minor test improvements
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.

Regression: crash when rendering JSON binary transaction with API v.2 enabled
6 participants