Test helper API

Reusable helpers for writing fast, reliable Anvil mainnet-fork tests. These live under eth_defi.testing rather than tests so they can be imported from test suites in this repository and in downstream projects.

The canonical, authoritative description of the shared-fork pattern — fixed fork block, shared Anvil process, warm RPC cache — is the module docstring of eth_defi.testing.anvil_fork_pool. eth_defi/testing/README.md in the source tree has the step-by-step how-to, and docs/README-test-suite-performance.md the background and measurements.

Three caching layers cooperate to keep fork tests off the upstream archive node:

Fixed fork blocks shared by the characterisation tests are defined in eth_defi.testing.fork_blocks, and per-test EVM state isolation is provided by eth_defi.testing.evm_snapshot_fixture.

eth_defi.testing.anvil_fork_pool

Session-scoped Anvil fork pool for reusing forks across test modules.

eth_defi.testing.fork_blocks

Canonical per-chain fork blocks for shared-fork characterisation tests.

eth_defi.testing.rpc_cache

Seed the Foundry (Anvil) fork RPC cache from repository-supplied defaults.

eth_defi.testing.token_cache

Ship a prebuilt ERC-20 / vault token cache so tests do not refetch it over RPC.

eth_defi.testing.evm_snapshot_fixture

EVM snapshot/revert helper for per-test isolation on module-scope Anvil forks.