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

[4.0] if actions.data & actions.hex_data provided, use the hex_data in api call get_transaction_id #1280

Merged
merged 7 commits into from
Jun 15, 2023

Conversation

vladtr
Copy link
Contributor

@vladtr vladtr commented Jun 13, 2023

It appears that logic for handling transaction as part of get_transaction_id request was different in cleos and chain_api_plugin. Resolves #1197

This PR makes a change to a logic of get_transaction_id handler as such:

  • if actions.data & actions.hex_data provided, use the hex_data, test added
  • if actions not present or not an array, will throw "Invalid transaction", test added
  • if transaction is not parse-able, will throw "Invalid transaction"

caveat here that there is a few lines of code duplication between chain_api_plugin and cleos, but this is probably safest way to address initial issue without dangers of changing abi serializer

@vladtr vladtr linked an issue Jun 13, 2023 that may be closed by this pull request
@vladtr vladtr marked this pull request as draft June 13, 2023 18:53
@@ -41,6 +41,45 @@ parse_params<chain_apis::read_only::get_transaction_status_params, http_params_t
}
}

// if actions.data & actions.hex_data provided, use the hex_data since only currently support unexploded data
Copy link
Member

Choose a reason for hiding this comment

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

  • As part of this effort, I think we should support exploded data.
  • As part of this effort, I think we should provide optional support for exploded data in cleos. For cleos, this should be optional as a user may want to prevent cleos from communicating with nodeos. Could support the option of providing abi. See --unpack-action-data option --abi-file.
  • To increase security, if both "data" and "hex_data" are provide then we should verify they are equivalent.
  • Please add some tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a separate issue to include exploded data handling improvements:
#1282

plugins/chain_api_plugin/chain_api_plugin.cpp Outdated Show resolved Hide resolved
@vladtr vladtr marked this pull request as ready for review June 13, 2023 22:53
@heifner heifner requested a review from greg7mdp June 14, 2023 16:10
}

try {
fc::variant trx_var = fc::json::from_string( body );
Copy link
Contributor

@greg7mdp greg7mdp Jun 14, 2023

Choose a reason for hiding this comment

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

Is it an issue that we don't use a yield function to limit the time spent in the deserialization? never mind!

@vladtr vladtr merged commit 88c9d3f into release/4.0 Jun 15, 2023
@vladtr vladtr deleted the GH-1197-get-transaction-id-hex-data branch June 15, 2023 02:17
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.

get_transaction_id not working from curl but working from cleos
3 participants