Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

encode_abi failed in python3 due to non-bytestrings, sha3 also required ... - #254

Open
0xc1c4da wants to merge 3 commits into
ethereum:developfrom
status-im:develop
Open

encode_abi failed in python3 due to non-bytestrings, sha3 also required ...#254
0xc1c4da wants to merge 3 commits into
ethereum:developfrom
status-im:develop

Conversation

@0xc1c4da

Copy link
Copy Markdown
Contributor

...utf-8 string to be encoded before hashing

Unsure about the unicode encoding line, everything I've been doing supports unicode, but I can see why it might be favourable to force 'murica-text for method calls.

…ed utf-8 string to be encoded before hashing
@0xc1c4da

Copy link
Copy Markdown
Contributor Author

just to be clear, the contract compiles with abi_contract, but failed on encode_abi when a method in a contract was called.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 79.54% when pulling 18e7d3a on BlockchainSociety:develop into b7a551c on ethereum:develop.

Comment thread ethereum/abi.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to not introduce unicode in the first place, this should better be:
sig = name + b'(' + b','.join(encode_types) + b')'

@0xc1c4da

Copy link
Copy Markdown
Contributor Author

okay, well, i did that, now a tonne of strings are considered bytes,
but theres an issue at, where the byte string of the function name can't be added to the contract as a function

for f in self._translator.function_data:
vars(self)[f] = kall_factory(f)
becomes
vars(self)[f.decode('utf-8')] = kall_factory(f)

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.03%) to 79.51% when pulling 4d0e73d on BlockchainSociety:develop into b7a551c on ethereum:develop.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants