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

Incorrect encoding of BigNumber for uint256[] #3592

Closed
k1rill-fedoseev opened this issue Jun 19, 2020 · 1 comment · Fixed by #3593
Closed

Incorrect encoding of BigNumber for uint256[] #3592

k1rill-fedoseev opened this issue Jun 19, 2020 · 1 comment · Fixed by #3593
Labels
1.x 1.0 related issues Bug Addressing a bug

Comments

@k1rill-fedoseev
Copy link

Expected behavior

abi.encodeParameter should process BigNumbers in the same way for uint256 and uint256[]

Actual behavior

ABI coder encodes arrays of BigNumbers incorrectly

Steps to reproduce the behavior

const Web3 = require('web3')
const web3 = new Web3()

web3.eth.abi.encodeParameter('uint256', '123') // 0x00...007b
web3.eth.abi.encodeParameter('uint256', web3.utils.toBN('123')) // same as above

web3.eth.abi.encodeParameter('uint256[]', ['123']) // 0x00..007b
web3.eth.abi.encodeParameter('uint256[]', [web3.utils.toBN('123')]) // should be the same as above, gives 0x00..0000 instead

Environment

  • web3@1.2.9
@cgewecke cgewecke added 1.x 1.0 related issues Bug Addressing a bug labels Jun 19, 2020
@cgewecke
Copy link
Collaborator

Thanks for catching this @k1rill-fedoseev!

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants