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

Commit 8d69d80

Browse files
author
Jan Xie
committed
refactor, add MAX_GAS_LIMIT config
1 parent 5812f75 commit 8d69d80

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

ethereum/blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def __init__(self, header, transaction_list=[], uncles=[], env=None,
446446
if self.timestamp >= 2 ** 256:
447447
raise ValueError("Timestamp waaaaaaaaaaayy too large")
448448

449-
if self.gas_limit > 2 ** 63 - 1:
449+
if self.gas_limit > self.config['MAX_GAS_LIMIT']:
450450
raise ValueError("Block's gaslimit went too high!")
451451

452452
for uncle in uncles:

ethereum/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
GENESIS_INITIAL_ALLOC={},
2121
# Minimum gas limit
2222
MIN_GAS_LIMIT=5000,
23+
MAX_GAS_LIMIT=2 ** 63 - 1,
2324
# Gas limit adjustment algo:
2425
# block.gas_limit=block.parent.gas_limit * 1023/1024 +
2526
# (block.gas_used * 6 / 5) / 1024

ethereum/testutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def run_state_test(params, mode):
294294
difficulty=parse_int_or_hex(env['currentDifficulty']),
295295
timestamp=parse_int_or_hex(env['currentTimestamp']),
296296
# work around https://github.com/ethereum/pyethereum/issues/390 [1]:
297-
gas_limit=min(2 ** 63 - 1, parse_int_or_hex(env['currentGasLimit'])))
297+
gas_limit=min(db_env.config['MAX_GAS_LIMIT'], parse_int_or_hex(env['currentGasLimit'])))
298298
blk = blocks.Block(header, env=db_env)
299299

300300
# work around https://github.com/ethereum/pyethereum/issues/390 [2]:

0 commit comments

Comments
 (0)