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

Commit 9fd142b

Browse files
vubvub
authored andcommitted
Minor stylistic changes
1 parent e4fbff0 commit 9fd142b

File tree

8 files changed

+25
-18
lines changed

8 files changed

+25
-18
lines changed

ethereum/chain.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def head(self):
8585
return None
8686

8787
def mk_poststate_of_blockhash(self, blockhash):
88-
print 'Making poststate from blockhash'
8988
if blockhash not in self.db:
9089
raise Exception("Block hash %s not found" % encode_hex(blockhash))
9190
if self.db.get(blockhash) == 'GENESIS':

ethereum/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
CHILD_DAO_LIST = map(utils.normalize_address, child_dao_list),
6363
DAO_WITHDRAWER = utils.normalize_address('0xbf4ed7b27f1d666546e30d74d50d173d20bca754'),
6464
# Anti-DoS fork
65-
ANTI_DOS_FORK_BLKNUM = 9999999,
65+
ANTI_DOS_FORK_BLKNUM = 2457000,
6666
# Default consensus strategy: ethash, poa, casper, pbft
6767
CONSENSUS_STRATEGY = 'ethash',
6868
# Serenity fork

ethereum/state_transition.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ def validate_transactions(state, block):
136136
def verify_execution_results(state, block):
137137
if not SKIP_RECEIPT_ROOT_VALIDATION:
138138
if block.header.receipts_root != mk_receipt_sha(state.receipts):
139-
raise ValueError("Receipt root mismatch: header %s computed %s, %d receipts" %
140-
(encode_hex(block.header.receipts_root), encode_hex(mk_receipt_sha(state.receipts)), len(state.receipts)))
139+
raise ValueError("Receipt root mismatch: header %s computed %s, gas used header %d computed %d, %d receipts" %
140+
(encode_hex(block.header.receipts_root), encode_hex(mk_receipt_sha(state.receipts)),
141+
block.header.gas_used, state.gas_used, len(state.receipts)))
141142
if block.header.state_root != state.trie.root_hash:
142143
raise ValueError("State root mismatch: header %s computed %s" %
143144
(encode_hex(block.header.state_root), encode_hex(state.trie.root_hash)))

ethereum/tester.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def call(*args, **kwargs): # pylint: disable=unused-argument,no-method-argument
276276
)
277277

278278
def _send(self, sender, to, value, evmdata='', funid=None, abi=None, # pylint: disable=too-many-arguments
279-
profiling=0):
279+
profiling=0, gas=None):
280280
# pylint: disable=too-many-locals
281281

282282
if funid is not None or abi is not None:
@@ -286,9 +286,10 @@ def _send(self, sender, to, value, evmdata='', funid=None, abi=None, # pylint:
286286

287287
start_time = time.time()
288288
gas_used = self.state.gas_used
289+
_gas_limit = gas_limit if gas is None else gas
289290

290291
sendnonce = self.state.get_nonce(privtoaddr(sender))
291-
transaction = transactions.Transaction(sendnonce, gas_price, gas_limit, to, value, evmdata)
292+
transaction = transactions.Transaction(sendnonce, gas_price, _gas_limit, to, value, evmdata)
292293
self.last_tx = transaction
293294
transaction.sign(sender)
294295
recorder = None

ethereum/tests/test_blocks.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,15 @@ def get_config_overrides(filename):
9696
o['HOMESTEAD_FORK_BLKNUM'] = 0
9797
if 'TestNetwork' in filename:
9898
o['HOMESTEAD_FORK_BLKNUM'] = 5
99+
if 'EIP150' in filename:
100+
o['DAO_FORK_BLKNUM'] = 8
101+
o['ANTI_DOS_FORK_BLKNUM'] = 10
102+
elif 'EIP150' in filename:
103+
o['HOMESTEAD_FORK_BLKNUM'] = 0
104+
o['DAO_FORK_BLKNUM'] = 2**99
105+
o['ANTI_DOS_FORK_BLKNUM'] = 0
99106
if 'bcTheDaoTest' in filename:
100107
o['DAO_FORK_BLKNUM'] = 8
101-
if 'EIP150' in filename:
102-
o['HOMESTEAD_FORK_BLKNUM'] = 5
103-
o['DAO_FORK_BLKNUM'] = 8
104-
o['ANTI_DOS_FORK_BLKNUM'] = 10
105108
return o
106109

107110

ethereum/testutils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
"previousHash": b"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
3535
}
3636

37-
from ethereum.slogging import LogRecorder, configure_logging, set_level
38-
config_string = ':info,eth.vm.log:trace,eth.vm.op:trace,eth.vm.stack:trace,eth.vm.exit:trace,eth.pb.msg:trace,eth.pb.tx:debug'
39-
configure_logging(config_string=config_string)
37+
# from ethereum.slogging import LogRecorder, configure_logging, set_level
38+
# config_string = ':info,eth.vm.log:trace,eth.vm.op:trace,eth.vm.stack:trace,eth.vm.exit:trace,eth.pb.msg:trace,eth.pb.tx:debug'
39+
# configure_logging(config_string=config_string)
4040

4141
FILL = 1
4242
VERIFY = 2

ethereum/vm.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
TT256M1 = 2 ** 256 - 1
2626
TT255 = 2 ** 255
2727

28+
MAX_DEPTH = 1024
29+
2830

2931
class CallData(object):
3032

@@ -137,7 +139,8 @@ def data_copy(compustate, size):
137139

138140
def eat_gas(compustate, amount):
139141
if compustate.gas < amount:
140-
return vm_exception("OUT OF GAS")
142+
compustate.gas = 0
143+
return False
141144
else:
142145
compustate.gas -= amount
143146
return True
@@ -551,7 +554,7 @@ def vm_execute(ext, msg, code):
551554
value, mstart, msz = stk.pop(), stk.pop(), stk.pop()
552555
if not mem_extend(mem, compustate, op, mstart, msz):
553556
return vm_exception('OOG EXTENDING MEMORY')
554-
if ext.get_balance(msg.to) >= value and msg.depth < 1024:
557+
if ext.get_balance(msg.to) >= value and msg.depth < MAX_DEPTH:
555558
cd = CallData(mem, mstart, msz)
556559
ingas = compustate.gas
557560
if ext.post_anti_dos_hardfork():
@@ -586,7 +589,7 @@ def vm_execute(ext, msg, code):
586589
if compustate.gas < gas + extra_gas:
587590
return vm_exception('OUT OF GAS', needed=gas+extra_gas)
588591
submsg_gas = gas + opcodes.GSTIPEND * (value > 0)
589-
if ext.get_balance(msg.to) >= value and msg.depth < 1024:
592+
if ext.get_balance(msg.to) >= value and msg.depth < MAX_DEPTH:
590593
compustate.gas -= (gas + extra_gas)
591594
assert compustate.gas >= 0
592595
cd = CallData(mem, meminstart, meminsz)
@@ -624,7 +627,7 @@ def vm_execute(ext, msg, code):
624627
if compustate.gas < gas + extra_gas:
625628
return vm_exception('OUT OF GAS', needed=gas+extra_gas)
626629
submsg_gas = gas + opcodes.GSTIPEND * (value > 0)
627-
if ext.get_balance(msg.to) >= value and msg.depth < 1024:
630+
if ext.get_balance(msg.to) >= value and msg.depth < MAX_DEPTH:
628631
compustate.gas -= (gas + extra_gas)
629632
assert compustate.gas >= 0
630633
to = utils.encode_int(to)

fixtures

Submodule fixtures updated 39 files

0 commit comments

Comments
 (0)