Test Factory¶
Documentation for tests/amsterdam/eip7997_deterministic_factory_predeploy/test_factory.py@5fa5938b.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip7997_deterministic_factory_predeploy/test_factory.py --fork Amsterdam
Tests for EIP-7997: Deterministic Factory Predeploy.
The factory (the Arachnid deterministic deployment proxy) interprets
calldata as salt (32) || initcode and invokes CREATE2 with the call
value forwarded. It returns the created address (20 bytes) on success
and reverts on CREATE2 failure. With calldata shorter than 32 bytes,
the factory's CALLDATASIZE - 32 underflow triggers a copy of nearly
2^256 bytes and reverts via OOG.
Test Functions Overview¶
| Name | Type | Cases (Amsterdam) | Description |
|---|---|---|---|
test_factory_address_collision_reverts |
state_test | 1 | A second deployment to the same CREATE2 target reverts. CREATE2 |
test_factory_block_access_list |
state_test | 1 | EIP-7928: a factory deployment is captured in the block-level |
test_factory_deploys_contract |
state_test | 2 | Calling the factory with salt || initcode deploys a contract at the |
test_factory_deploys_to_pre_funded_address |
state_test | 1 | CREATE2 to an address that has only a balance (no code, no storage, |
test_factory_different_salts_produce_different_addresses |
state_test | 1 | Two calls to the factory with the same initcode but different salts |
test_factory_direct_eoa_call |
state_test | 1 | A transaction sent directly to the factory address (no relay contract) |
test_factory_in_caller_context |
state_test | 2 | Under DELEGATECALL or CALLCODE, the factory's bytecode runs in the |
test_factory_predeploy_account |
state_test | 1 | The factory bytecode is present at the canonical Arachnid factory |
test_factory_receives_balance_via_selfdestruct |
state_test | 1 | SELFDESTRUCT to the factory transfers the originator's balance to |
test_factory_rejects_ef_prefix_deployment |
state_test | 1 | EIP-3541: deploying code that begins with 0xEF is rejected. The |
test_factory_rejects_oversized_initcode |
state_test | 1 | EIP-3860: initcode larger than the fork's max initcode size is |
test_factory_staticcall_reverts |
state_test | 1 | Calling the factory via STATICCALL fails because CREATE2 requires a |
test_factory_via_eip7702_delegation |
state_test | 1 | An EOA delegates its code to the factory via an EIP-7702 |