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

Extend _txInputFormatter with hex prefix check #3317

Merged
merged 10 commits into from
Jun 4, 2020
Merged

Extend _txInputFormatter with hex prefix check #3317

merged 10 commits into from
Jun 4, 2020

Conversation

nivida
Copy link
Contributor

@nivida nivida commented Jan 20, 2020

Description

_txInputFormatter extended with hex prefix check. I've kept the isHex utility function as it is because it is a part of the public API and would probably introduce a breaking change for some.

Edit:
I've changed the implementation to prepend the 0x prefix if not existing instead of throwing an Error. This will improve the consistency of the sent data property for eth_call and eth_sendTransaction as well just without breaking something. @cgewecke

Fixes #1082

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success and extended the tests if necessary.
  • I ran npm run build-all and tested the resulting file/'s from dist folder in a browser.
  • I have updated the CHANGELOG.md file in the root folder.
  • I have tested my code on the live network.

@nivida nivida added Bug Addressing a bug 1.x 1.0 related issues labels Jan 20, 2020
@nivida nivida requested a review from cgewecke January 20, 2020 12:16
@nivida nivida added the Review Needed Maintainer(s) need to review label Jan 20, 2020
@nivida nivida marked this pull request as ready for review January 20, 2020 12:16
@coveralls
Copy link

coveralls commented Jan 20, 2020

Coverage Status

Coverage decreased (-0.02%) to 89.814% when pulling 5f3e525 on issue/1082 into 9e46628 on 1.x.

@nivida
Copy link
Contributor Author

nivida commented Jan 20, 2020

@cgewecke As our test does bring up would this be a breaking change for Ganache. The more strict validation which does require any hex string to be prefixed with the known hex prefix '0x' does throw an error in many cases. This means we are probably forced to wait with a more strict validation of hex strings until 2.0. WDYT?

@cgewecke
Copy link
Collaborator

@nivida Yes, agree it looks that way to me as well. It's too bad.

Ganache has 7 failing tests. The original comment at the reporting issue says:

Both Geth and TestingRPC implementations are flexible enough to accept that payload as is, even though it doesn't strictly conform to the standard, but when I tested this code against a Parity backend I got a very unhelpful invalid params exception.

which means some people are probably passing the raw solc bytecode output directly to Geth too.

Copy link
Collaborator

@cgewecke cgewecke left a comment

Choose a reason for hiding this comment

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

@nivida It looks like were forced to put the Hold label on this for the time being.

@cgewecke cgewecke added the On Ice Important but no longer pursued for the near future label Jan 21, 2020
@nivida nivida removed the Review Needed Maintainer(s) need to review label Jan 21, 2020
@nivida nivida removed the On Ice Important but no longer pursued for the near future label Jan 27, 2020
@nivida nivida requested a review from cgewecke January 27, 2020 06:50
@nivida nivida mentioned this pull request Jan 27, 2020
7 tasks
@nivida nivida added the Review Needed Maintainer(s) need to review label Feb 28, 2020
@nivida
Copy link
Contributor Author

nivida commented Apr 15, 2020

@ryanio This could get merged because it is backward compatible. web3.js will send anything with a 0x prefix but doesn't have a strict validation of the inputs.

@ryanio
Copy link
Collaborator

ryanio commented Jun 4, 2020

@nivida ah just coming across your comment, sorry I missed it when you first posted it. ok thanks we will include this in the next release.

@ryanio ryanio changed the title _txInputFormatter extended with hex prefix check Extend _txInputFormatter with hex prefix check Jun 4, 2020
Copy link
Collaborator

@ryanio ryanio left a comment

Choose a reason for hiding this comment

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

LGTM!

@ryanio ryanio merged commit 9163bfd into 1.x Jun 4, 2020
@ryanio ryanio mentioned this pull request Jul 9, 2020
14 tasks
@GregTheGreek GregTheGreek deleted the issue/1082 branch July 26, 2020 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Bug Addressing a bug Review Needed Maintainer(s) need to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: ensure '0x' prefixing for all data fields
4 participants