Test Factory¶
Documentation for tests/amsterdam/eip7997_deterministic_factory_contract/test_factory.py@02aafd78.
Generate fixtures for these test cases for Bogota with:
fill -v tests/amsterdam/eip7997_deterministic_factory_contract/test_factory.py --fork Bogota
Verify EIP-7997: Deterministic Factory Contract.
https://eips.ethereum.org/EIPS/eip-7997
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 with empty return data on CREATE2 failure. With calldata
shorter than 32 bytes, the factory's CALLDATASIZE - 32 underflow makes
CALLDATACOPY request close to 2^256 bytes and the frame halts out of
gas.
Test Functions Overview¶
| Name | Type | Cases (Bogota) | Description |
|---|---|---|---|
test_delegated_sender_forwards_value |
state_test | 1 | Forward a delegated EOA's call value through the canonical factory. |
test_factory_address_collision_reverts |
state_test | 2 | Reject reuse of a CREATE2 address within the same transaction. |
test_factory_block_access_list |
state_test | 2 | Record factory and created-account nonce and code writes in the BAL. |
test_factory_block_access_list_address_collision |
state_test | 1 | Keep a reverted CREATE2 address collision out of the BAL. |
test_factory_calldata_layouts |
state_test | 4 | Use the complete salt and remaining initcode, including empty code. |
test_factory_called_from_initcode |
state_test | 3 | Call the factory from transaction, CREATE and factory CREATE2 initcode. |
test_factory_contract_account |
state_test | 1 | Verify the canonical code, initial nonce and balance through the EVM. |
test_factory_creation_failure_returns_empty_data |
state_test | 6 | Discard failed initcode return data and restore the caller's value. |
test_factory_deploys_contract |
state_test | 2 | Verify deployment, unpadded return data and value forwarding. |
test_factory_deploys_to_pre_funded_address |
state_test | 1 | Preserve the funded address balance during CREATE2. |
test_factory_different_salts_produce_different_addresses |
state_test | 1 | Deploy identical initcode at distinct salt-derived addresses. |
test_factory_direct_eoa_call |
state_test | 1 | Deploy through a transaction addressed directly to the factory. |
test_factory_in_caller_context |
state_test | 2 | Use the caller as the CREATE2 deployer for DELEGATECALL and CALLCODE. |
test_factory_initcode_size_boundary |
state_test | 2 | Deploy maximum-sized initcode and reject one additional byte. |
test_factory_receives_balance_via_selfdestruct |
state_test | 1 | Transfer a SELFDESTRUCT balance to the factory and then deploy through it. |
test_factory_rejects_ef_prefix_deployment |
state_test | 1 | Reject deployed code starting with 0xEF under EIP-3541. |
test_factory_short_calldata_out_of_gas |
state_test | 3 | Exhaust the forwarded gas when calldata lacks a complete salt. |
test_factory_staticcall_reverts |
state_test | 2 | Reject CREATE2 in both direct and inherited static contexts. |
test_factory_trailing_calldata_is_initcode |
state_test | 1 | Include trailing bytes in the CREATE2 initcode hash. |
test_factory_via_eip7702_delegation |
state_test | 2 | Execute delegated factory code with the authorized EOA as deployer. |