Skip to content
This repository has been 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
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

0xc1c4da
Copy link
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
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

Coverage Status

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

@@ -32,6 +32,7 @@ def __init__(self, full_signature):
" name. Use %s to call %s with types %r"
% (name, sig_item['name'], encode_types))
sig = name + '(' + ','.join(encode_types) + ')'
sig = sig.encode('utf-8')
Copy link
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
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

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.

None yet

3 participants