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

Commit 6f55775

Browse files
author
Jan Xie
committed
EIP 170 contract code size limit
1 parent 42ce71d commit 6f55775

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ethereum/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
# Anti-DoS fork
6565
ANTI_DOS_FORK_BLKNUM = 2463000,
6666
SPURIOUS_DRAGON_FORK_BLKNUM = 2675000,
67+
CONTRACT_CODE_SIZE_LIMIT = 0x6000,
6768
# Default consensus strategy: ethash, poa, casper, pbft
6869
CONSENSUS_STRATEGY = 'ethash',
6970
# Serenity fork

ethereum/processblock.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ def create_contract(ext, msg):
151151
if res:
152152
if not len(dat):
153153
return 1, gas, msg.to
154-
gcost = len(dat) * opcodes.GCONTRACTBYTE
154+
155+
if ext.post_spurious_dragon_hardfork():
156+
gcost = 2**256 - 1 if len(dat) > config.default_config['CONTRACT_CODE_SIZE_LIMIT'] else len(dat) * opcodes.GCONTRACTBYTE
157+
else:
158+
gcost = len(dat) * opcodes.GCONTRACTBYTE
159+
155160
if gas >= gcost:
156161
gas -= gcost
157162
else:

0 commit comments

Comments
 (0)