Skip to content

Commit 4b515b8

Browse files
feat(tests): default (init)code size limit to first limit set
1 parent 4ac1b68 commit 4b515b8

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/ethereum_test_forks/base_fork.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,13 @@ def evm_code_types(cls, block_number: int = 0, timestamp: int = 0) -> List[EVMCo
473473

474474
@classmethod
475475
@abstractmethod
476-
def max_code_size(cls) -> int | None:
476+
def max_code_size(cls) -> int:
477477
"""Return the maximum code size allowed to be deployed in a contract creation."""
478478
pass
479479

480480
@classmethod
481481
@abstractmethod
482-
def max_initcode_size(cls) -> int | None:
482+
def max_initcode_size(cls) -> int:
483483
"""Return the maximum initcode size allowed to be used in a contract creation."""
484484
pass
485485

src/ethereum_test_forks/forks/forks.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,16 @@ def evm_code_types(cls, block_number: int = 0, timestamp: int = 0) -> List[EVMCo
370370
return [EVMCodeType.LEGACY]
371371

372372
@classmethod
373-
def max_code_size(cls) -> int | None:
373+
def max_code_size(cls) -> int:
374374
"""At genesis, there is no upper bound for code size (bounded by block gas limit)."""
375-
return None
375+
"""However, the default is set to the limit of EIP-170 (Spurious Dragon)"""
376+
return 0x6000
376377

377378
@classmethod
378-
def max_initcode_size(cls) -> int | None:
379-
"""At genesis, there is no upper bound for initcode size (bounded by block gas limit)."""
380-
return None
379+
def max_initcode_size(cls) -> int:
380+
"""At genesis, there is no upper bound for initcode size."""
381+
"""However, the default is set to the limit of EIP-3860 (Shanghai)"""
382+
return 0xC000
381383

382384
@classmethod
383385
def call_opcodes(
@@ -645,7 +647,7 @@ def precompiles(cls, block_number: int = 0, timestamp: int = 0) -> List[Address]
645647
)
646648

647649
@classmethod
648-
def max_code_size(cls) -> int | None:
650+
def max_code_size(cls) -> int:
649651
# NOTE: Move this to Spurious Dragon once this fork is introduced. See EIP-170.
650652
"""At Spurious Dragon, an upper bound was introduced for max contract code size."""
651653
return 0x6000
@@ -877,9 +879,9 @@ def engine_new_payload_version(
877879
return 2
878880

879881
@classmethod
880-
def max_initcode_size(cls) -> int | None:
882+
def max_initcode_size(cls) -> int:
881883
"""From Shanghai, the initcode size is now limited. See EIP-3860."""
882-
return int(0xC000)
884+
return 0xC000
883885

884886
@classmethod
885887
def valid_opcodes(
@@ -1339,13 +1341,13 @@ def engine_get_blobs_version(cls, block_number: int = 0, timestamp: int = 0) ->
13391341
return 2
13401342

13411343
@classmethod
1342-
def max_code_size(cls) -> int | None:
1344+
def max_code_size(cls) -> int:
13431345
"""From Osaka, the max code size is lifted. See EIP-7907."""
13441346
return int(0x40000)
13451347

13461348
@classmethod
1347-
def max_initcode_size(cls) -> int | None:
1348-
"""At genesis, there is no upper bound for initcode size (bounded by block gas limit)."""
1349+
def max_initcode_size(cls) -> int:
1350+
"""From Osaka, the max initcode size is lifted. See EIP-7907."""
13491351
return int(0x80000)
13501352

13511353
@classmethod

0 commit comments

Comments
 (0)