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

Upgrade abi coder to fix solc 0.4.x edge case #3724

Closed
ryanio opened this issue Sep 22, 2020 · 7 comments · Fixed by #3744
Closed

Upgrade abi coder to fix solc 0.4.x edge case #3724

ryanio opened this issue Sep 22, 2020 · 7 comments · Fixed by #3744
Assignees
Labels
1.x 1.0 related issues Good First Issue Great to learn the internals of web3.js

Comments

@ryanio
Copy link
Collaborator

ryanio commented Sep 22, 2020

In ethers-io/ethers.js#891 (comment), @ricmoo notes that he released a new version of the ethersproject abi coder that contains a "loose" reader for decoding logs for certain contracts built with solc 0.4.x.

This is a tracking issue to upgrade the dependency in web3-eth-abi here so users can read these contracts (some used actively on mainnet) without future issue.

@ryanio ryanio added dependencies 1.x 1.0 related issues Good First Issue Great to learn the internals of web3.js labels Sep 22, 2020
@spacesailor24 spacesailor24 self-assigned this Oct 7, 2020
@spacesailor24
Copy link
Contributor

Hopefully I'm just doing something incorrect here, but upgrading @ethersproject/abi to 5.0.4 (as mentioned here) doesn't actually solve the issue mentioned when testing using this test repo.

To make sure my testing steps are valid, here is what I did:

  1. Update @ethersproject/abi version to 5.0.4 here
  2. rm -rf node_modules && npm i
  3. Then just to make sure, I also ran Step 2 in the web3.js root dir
  4. npm run build in web3.js root dir
  5. cd into above mentioned test repo
  6. yarn which installs version ^1.2.8 of web3
  7. npx truffle test receive following output:
...
1 passing (2s)
  1 failing

  1) Contract: Simple
       fires external event:
     Error: data out-of-bounds (length=36, offset=64, code=BUFFER_OVERRUN, version=abi/5.0.0-beta.153)
...
  1. Update web3 dependency from ^1.2.8 to /local/path-to/web3 in package.json
  2. rm -rf node_modules && npm i
  3. npx truffle test receive following output:
...
  1 passing (1s)
  1 failing

  1) Contract: Simple
       fires external event:
     Error: data out-of-bounds (length=36, offset=64, code=BUFFER_OVERRUN, version=abi/5.0.4)
...

And to solidify that the updated @ethersproject/abi was used, you can see in the last line of the provided outputs, at the very end:

Using web3.js version ^1.2.8: ...version=abi/5.0.0-beta.153)

Using updated local web3.js: ...version=abi/5.0.4)

@spacesailor24
Copy link
Contributor

Also #3738 seems to be related?

@Patil2099
Copy link

Can I work on this issue? I would love to work on this issue.

@GregTheGreek
Copy link
Contributor

@Patil2099 what kind of timeline do you think this would take you?

@remon-nashid
Copy link

remon-nashid commented Oct 14, 2020

I confirm @spacesailor24's finding that upgrading abi coder to 5.0.4, or even the latest release, does not fix the decoding issue.

@ricmoo
Copy link
Contributor

ricmoo commented Oct 14, 2020

Are you making sure to pass true in for the optional allowLoose parameter in the .decode method? Keep in mind you should only allow this for events as it could expose exploits if loose parsing is allowed on function data...

@ricmoo
Copy link
Contributor

ricmoo commented Oct 14, 2020

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 Good First Issue Great to learn the internals of web3.js
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants
@ryanio @ricmoo @remon-nashid @GregTheGreek @spacesailor24 @Patil2099 and others