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

Commit 6af2dbe

Browse files
vubvub
authored andcommitted
Few small bug fixes
1 parent f84ec57 commit 6af2dbe

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

ethereum/abi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def encode_single(typ, arg):
295295
i = decint(arg, True)
296296
if not -2**(sub - 1) <= i < 2**(sub - 1):
297297
raise ValueOutOfBounds(repr(arg))
298-
return zpad(encode_int(i % 2**sub), 32)
298+
return zpad(encode_int(i % 2**256), 32)
299299
# Unsigned reals: ureal<high>x<low>
300300
elif base == 'ureal':
301301
high, low = [int(x) for x in sub.split('x')]

ethereum/tester.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44
import time
55
import types
66
import warnings
7+
import copy
78

89
import rlp
910
from rlp.utils import ascii_chr
1011

1112
from ethereum import db, opcodes, processblock, transactions
1213
from ethereum.abi import ContractTranslator
13-
from ethereum.config import Env
14+
from ethereum.config import Env, default_config
15+
konfig = copy.copy(default_config)
16+
konfig['HOMESTEAD_FORK_BLKNUM'] = 0
17+
konfig['ANTI_DOS_FORK_BLKNUM'] = 0
18+
konfig['CLEARING_FORK_BLKNUM'] = 0
1419
from ethereum.slogging import LogRecorder
1520
from ethereum._solidity import get_solidity
1621
from ethereum.utils import to_string, sha3, privtoaddr, int_to_addr, encode_hex
@@ -162,7 +167,7 @@ class state(object):
162167

163168
def __init__(self, num_accounts=len(keys)):
164169
self.temp_data_dir = tempfile.mkdtemp()
165-
self.env = Env()
170+
self.env = Env(config=konfig)
166171
self.last_tx = None
167172
self.log_listeners = []
168173

ethereum/vm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def vm_execute(ext, msg, code):
237237
trace_data['sha3memory'] = \
238238
encode_hex(utils.sha3(b''.join([ascii_chr(x) for
239239
x in compustate.memory])))
240-
if _prevop in ('SSTORE', 'SLOAD') or steps == 0:
240+
if _prevop in ('SSTORE',) or steps == 0:
241241
trace_data['storage'] = ext.log_storage(msg.to)
242242
trace_data['gas'] = to_string(compustate.gas + fee)
243243
trace_data['inst'] = opcode

0 commit comments

Comments
 (0)