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 overly strict function validation requirements for decoding parameters #2106

Merged
merged 3 commits into from
Dec 8, 2018

Conversation

gnidan
Copy link
Contributor

@gnidan gnidan commented Dec 8, 2018

This should fix #1916 and #2065.
Arises from trufflesuite/truffle#1487. Also being tracked on Truffle's end at trufflesuite/truffle#1504.

There is a bit of history here, in that empty bytes arrays have been variously represented as:

  • "0x" (correct value, others malformed)
  • "0X"
  • "0x0"
  • ""
  • who knows what else

Anyway, Ganache was passing "0x0" for awhile, and now that's stopped, exposing this conditional that asserts bytes must contain data. In the case where outputs equals [], an empty value for bytes is really all that makes sense.

This PR thus loosens the conditional a bit, to throw the exception only if bytes is empty and outputs is non-empty.

@nivida
Copy link
Contributor

nivida commented Dec 8, 2018

I reference here the PR #2000 just to be sure this fix will not be overwritten on merging.

@nivida nivida added the Bug Addressing a bug label Dec 8, 2018
@nivida nivida added this to To do in 1.0 via automation Dec 8, 2018
@coveralls
Copy link

coveralls commented Dec 8, 2018

Coverage Status

Coverage remained the same at 83.071% when pulling 617fd0b on trufflesuite:fix-mishandledBytes into 613a222 on ethereum:1.0.

@nivida nivida merged commit 1d9f6c0 into web3:1.0 Dec 8, 2018
1.0 automation moved this from To do to Done Dec 8, 2018
@gnidan gnidan deleted the fix-mishandledBytes branch December 8, 2018 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
No open projects
1.0
  
Done
Development

Successfully merging this pull request may close these issues.

getPastEvents failing to decode empty data
5 participants