test_contract_creating_tx()
Documentation for tests/shanghai/eip3860_initcode/test_initcode.py::test_contract_creating_tx@ffe48572.
Generate fixtures for these test cases for Bogota with:
fill -v tests/shanghai/eip3860_initcode/test_initcode.py::test_contract_creating_tx --fork Bogota
Test creating a contract with initcode that is on/over the allowed limit.
Source code in tests/shanghai/eip3860_initcode/test_initcode.py
| @pytest.mark.inclusion_test
@pytest.mark.bigmem
@pytest.mark.xdist_group(name="bigmem")
@pytest.mark.parametrize(
"initcode_name",
[
pytest.param("max_size_zeros"),
pytest.param("max_size_ones"),
pytest.param("over_limit_zeros", marks=pytest.mark.exception_test),
pytest.param("over_limit_ones", marks=pytest.mark.exception_test),
],
)
@pytest.mark.eels_base_coverage
def test_contract_creating_tx(
state_test: StateTestFiller,
pre: Alloc,
post: Alloc,
sender: EOA,
initcode: Initcode,
fork: Fork,
) -> None:
"""
Test creating a contract with initcode that is on/over the allowed limit.
"""
create_contract_address = compute_create_address(
address=sender,
nonce=0,
)
tx = Transaction(to=None, data=initcode, sender=sender)
if len(initcode) > fork.max_initcode_size():
# Initcode is above the max size, tx inclusion in the block makes
# it invalid.
post[create_contract_address] = Account.NONEXISTENT
tx.error = TransactionException.INITCODE_SIZE_EXCEEDED
else:
# Initcode is at or below the max size, tx inclusion in the block
# is ok and the contract is successfully created.
post[create_contract_address] = Account(code=Op.STOP)
state_test(pre=pre, post=post, tx=tx)
|
Parametrized Test Cases
This test generates 4 parametrized test cases across 6 forks.