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

Commit f6cdf2b

Browse files
vubvub
authored andcommitted
Further python3 fixes
1 parent 53209e7 commit f6cdf2b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

ethereum/abi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,9 @@ def decode_single(typ, data):
488488
l = big_endian_to_int(data[0:32])
489489
return data[32:][:l]
490490
elif base == 'uint':
491-
return big_endian_to_int(data)
491+
return big_endian_to_int(data) % 2**int(sub)
492492
elif base == 'int':
493-
o = big_endian_to_int(data)
493+
o = big_endian_to_int(data) % 2**int(sub)
494494
return (o - 2**int(sub)) if o >= 2**(int(sub) - 1) else o
495495
elif base == 'ureal':
496496
high, low = [int(x) for x in sub.split('x')]

ethereum/state.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ def reset_storage(self, addr):
213213
if addr in self.cache:
214214
for k in self.cache[addr]:
215215
if k not in ACCOUNT_SPECIAL_PARAMS:
216-
self.set_storage(addr, k, '')
216+
self.set_storage(addr, k, b'')
217217
t = SecureTrie(Trie(self.trie.db))
218218
acct = self._get_account_unsafe(addr)
219219
t.root_hash = acct.storage
220220
for k in t.to_dict().keys():
221-
self.set_storage(addr, k, '')
221+
self.set_storage(addr, k, b'')
222222

223223
# Commit the cache to the trie
224224
def commit(self, allow_empties=False):
@@ -281,7 +281,7 @@ def del_account(self, address):
281281
self.reset_storage(address)
282282
self.set_balance(address, 0)
283283
self.set_nonce(address, 0)
284-
self.set_code(address, '')
284+
self.set_code(address, b'')
285285
self.set_storage(address, 'deleted', True)
286286

287287
def add_log(self, log):

ethereum/vm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def vm_execute(ext, msg, code):
227227
'EXTCODECOPY'):
228228
if len(compustate.memory) < 1024:
229229
trace_data['memory'] = \
230-
b''.join([encode_hex(ascii_chr(x)) for x
230+
''.join([encode_hex(ascii_chr(x)) for x
231231
in compustate.memory])
232232
else:
233233
trace_data['sha3memory'] = \

0 commit comments

Comments
 (0)