File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/pytest_plugins/filler Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 3636CONTRACT_START_ADDRESS_DEFAULT = 0x1000000000000000000000000000000000001000
3737CONTRACT_ADDRESS_INCREMENTS_DEFAULT = 0x100
3838
39+ MAX_BYTECODE_SIZE = 24576
40+
3941
4042def pytest_addoption (parser : pytest .Parser ):
4143 """Add command-line options to pytest."""
@@ -162,12 +164,18 @@ def deploy_contract(
162164 if self ._alloc_mode == AllocMode .STRICT :
163165 assert Number (nonce ) >= 1 , "impossible to deploy contract with nonce lower than one"
164166
167+ code = self .code_pre_processor (code , evm_code_type = evm_code_type )
168+ code_bytes = bytes (code ) if not isinstance (code , (bytes , str )) else code
169+ assert len (code_bytes ) <= MAX_BYTECODE_SIZE , (
170+ f"code too large: { len (code_bytes )} > { MAX_BYTECODE_SIZE } "
171+ )
172+
165173 super ().__setitem__ (
166174 contract_address ,
167175 Account (
168176 nonce = nonce ,
169177 balance = balance ,
170- code = self . code_pre_processor ( code , evm_code_type = evm_code_type ) ,
178+ code = code ,
171179 storage = storage ,
172180 ),
173181 )
You can’t perform that action at this time.
0 commit comments