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

Non ABI-standard return value of get_deposit_count of deposit_contract #1341

Closed
daejunpark opened this issue Aug 6, 2019 · 2 comments
Closed

Comments

@daejunpark
Copy link
Contributor

daejunpark commented Aug 6, 2019

What's wrong?

The return value of the get_deposit_count function of deposit_contract does not conform to the ABI encoding, having incorrect zero-padding, due to a Vyper compiler bug.

How to reproduce?

For a quick reproduction of the buggy behavior, just add the following line at the end of test_deposit_tree (inside the for loop):

registration_contract.functions.get_deposit_count().call()

(A more meaningful test would be to check the return value is equal to the loop index i, the number of deposit invocations made.)

Then you will get the following exception:

eth_abi.exceptions.NonEmptyPaddingBytes: Padding bytes were not empty: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 '

which is generated by eth_abi/decoding.py. (Note that the last character is an ascii character of b'\x20.)

How to fix?

Well, wait until the compiler bug is fixed, and update the Vyper compiler version. :)

Also, add some tests for (or have the existing tests to invoke) get_deposit_count, to detect further regressions.

@JustinDrake
Copy link
Collaborator

JustinDrake commented Aug 7, 2019

Congrats on finding that compiler bug! While we're at it, I suggest bundling in #1279 when we do the fix.

@JustinDrake
Copy link
Collaborator

Closing in favour of #1362 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants