test_create_tx_balance_only_target()
Documentation for tests/frontier/create/test_create_collision.py::test_create_tx_balance_only_target@ffe48572.
Generate fixtures for these test cases for Bogota with:
fill -v tests/frontier/create/test_create_collision.py::test_create_tx_balance_only_target --fork Bogota
Test that a contract creation transaction succeeds when the target
address has only a balance: an account with zero nonce, no code and
no storage is not a collision (EIP-684).
Source code in tests/frontier/create/test_create_collision.py
| @pytest.mark.with_all_contract_creating_tx_types
def test_create_tx_balance_only_target(
state_test: StateTestFiller,
pre: Alloc,
tx_type: int,
) -> None:
"""
Test that a contract creation transaction succeeds when the target
address has only a balance: an account with zero nonce, no code and
no storage is not a collision (EIP-684).
"""
tx = Transaction(
sender=pre.fund_eoa(),
ty=tx_type,
to=None,
data=CORRECT_INITCODE,
protected=False,
)
created_contract_address = tx.created_contract
pre[created_contract_address] = Account(balance=1)
state_test(
pre=pre,
post={
created_contract_address: Account(
balance=1,
code=CORRECT_INITCODE.deploy_code,
storage={0x00: 0x01},
),
},
tx=tx,
)
|
Parametrized Test Cases
This test generates 3 parametrized test cases across 17 forks.