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 ABI encoding of arrays of strings and bytes #473

Merged
merged 3 commits into from
Nov 28, 2017

Conversation

carver
Copy link
Collaborator

@carver carver commented Nov 28, 2017

What was wrong?

Only in v4: contract.encodeABI fails to encode a byte-array with:

TypeError: expected an int in first arg, or keyword of hexstr or text

It was trying to convert an array of hex strings into bytes all at once.

This conversion to bytes only happens in contract ABI encoding, because encode_abi expects byte arguments, and the other places that do this encoding (like middleware before sending to a client) expect hex-encoded arguments.

How was it fixed?

Check that conversion from hex to bytes only happens at the basic type level, not the array level.

Cute Animal Picture

Cute animal picture

@carver carver changed the title Carver/byte array encoding Fix ABI encoding of arrays of strings and bytes Nov 28, 2017
@carver
Copy link
Collaborator Author

carver commented Nov 28, 2017

pytest 3.3.0 was breaking our tests, due to pytest-dev/pytest#2957

@carver carver merged commit 98bcc03 into master Nov 28, 2017
@carver carver deleted the carver/byte-array-encoding branch November 28, 2017 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants