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

Commit e921e68

Browse files
committed
Fixed some more block test bugs
1 parent 658118b commit e921e68

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

ethereum/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def validate_header(state, header):
8181
if not check_gaslimit(parent, header.gas_limit, config=state.config):
8282
raise ValueError("Block's gaslimit is inconsistent with its parent's gaslimit")
8383
if header.difficulty != calc_difficulty(parent, header.timestamp, config=state.config):
84-
raise ValueError("Block's difficulty is inconsistent with its parent's difficulty: parent %d expected %d actual %d" %
85-
(parent.difficulty, calc_difficulty(parent, header.timestamp, config=state.config), header.difficulty))
84+
raise ValueError("Block's difficulty is inconsistent with its parent's difficulty: parent %d expected %d actual %d. Time diff %d" %
85+
(parent.difficulty, calc_difficulty(parent, header.timestamp, config=state.config), header.difficulty, header.timestamp - parent.timestamp))
8686
if header.gas_used > header.gas_limit:
8787
raise ValueError("Gas used exceeds gas limit")
8888
if len(header.extra_data) > 32 and not state.is_SERENITY():

ethereum/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
METROPOLIS_DIFF_ADJUSTMENT_CUTOFF=9,
6262
# DAO fork
6363
DAO_FORK_BLKNUM = 1920000,
64-
CHILD_DAO_LIST = map(utils.normalize_address, child_dao_list),
64+
CHILD_DAO_LIST = list(map(utils.normalize_address, child_dao_list)),
6565
DAO_WITHDRAWER = utils.normalize_address('0xbf4ed7b27f1d666546e30d74d50d173d20bca754'),
6666
# Anti-DoS fork
6767
ANTI_DOS_FORK_BLKNUM = 2463000,

ethereum/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ def bloom(self):
105105
return bloom.bloom_from_list(utils.flatten(bloomables))
106106

107107
def mk_receipt(state, logs):
108-
if state.is_METROPOLIS() or SKIP_RECEIPT_ROOT_VALIDATION:
109-
return Receipt('\x00' * 32, state.gas_used, logs)
108+
# if state.is_METROPOLIS() or SKIP_RECEIPT_ROOT_VALIDATION:
109+
# return MetropolisReceipt(state.gas_used, logs)
110110
return Receipt(state.trie.root_hash, state.gas_used, logs)
111111

112112
def config_fork_specific_validation(config, blknum, tx):

ethereum/pow/consensus.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def validate_uncles(state, block):
8686
raise VerificationFailed("Timestamp mismatch")
8787
if uncle.hash in ineligible:
8888
raise VerificationFailed("Duplicate uncle")
89+
if uncle.gas_used > uncle.gas_limit:
90+
raise VerificationFailed("Uncle used too much gas")
8991
if not check_pow(state, uncle):
9092
raise VerificationFailed('uncle pow mismatch')
9193
ineligible.append(uncle.hash)

ethereum/tests/test_blocks.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,18 @@ def run_block_test(params, config_overrides=None):
102102

103103
def get_config_overrides(filename, testname):
104104
o = {}
105-
if 'Homestead' in testname:
106-
o['HOMESTEAD_FORK_BLKNUM'] = 0
107105
if 'TestNetwork' in filename:
108106
o['HOMESTEAD_FORK_BLKNUM'] = 5
109-
if 'EIP150' in filename:
110-
o['DAO_FORK_BLKNUM'] = 8
111-
o['ANTI_DOS_FORK_BLKNUM'] = 10
112-
elif 'EIP150' in testname:
107+
# o['DAO_FORK_BLKNUM'] = 8
108+
o['ANTI_DOS_FORK_BLKNUM'] = 10
109+
o['CLEARING_FORK_BLKNUM'] = 14
110+
o['METROPOLIS_FORK_BLKNUM'] = 16
111+
elif 'EIP150' in filename or 'EIP150' in testname:
113112
o['HOMESTEAD_FORK_BLKNUM'] = 0
114113
o['DAO_FORK_BLKNUM'] = 2**99
115114
o['ANTI_DOS_FORK_BLKNUM'] = 0
115+
elif 'Homestead' in filename or 'Homestead' in testname:
116+
o['HOMESTEAD_FORK_BLKNUM'] = 0
116117
elif 'EIP158' in testname:
117118
o['HOMESTEAD_FORK_BLKNUM'] = 0
118119
o['DAO_FORK_BLKNUM'] = 2**99

0 commit comments

Comments
 (0)