Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.09 KB

forking-mode.md

File metadata and controls

28 lines (20 loc) · 1.09 KB

Forking mode

Forge supports testing in a forked environment.

To run tests in a forked environment - such as a forked Ethereum mainnet - pass a RPC URL via the --fork-url flag:

forge test --fork-url <your_rpc_url>

The following values are changed to reflect those of the chain at the moment of forking:

It is possible to specify a block from which to fork with --fork-block-number:

forge test --fork-url <your_rpc_url> --fork-block-number 1

Forking is especially useful when you need to interact with existing contracts, and you may choose to do integration testing this way - as if you were on an actual network.