Is There a Framework for Forking the Mainnet and Testing Canisters in ICP?

I’m currently working on developing canisters and I’m familiar with the development frameworks available for Solidity smart contracts, such as Hardhat and Foundry, which allow us to fork the mainnet and test smart contracts in a simulated environment.

I’m wondering if there is a similar framework or tool available in the Internet Computer Protocol (ICP) ecosystem that allows us to fork the mainnet and test canisters in a development environment.

Any guidance or pointers to relevant resources would be greatly appreciated!

You can use PocketC for testing canisters.

I think what you are wanting is to mirror mainnet locally with a forked state. This is possible for your own canisters if you built some back up methods to pull down state. For other peoples canisters you need them to have a backup method or you anre out of luck.

I want to fork the mainnet because in my project we are integrating with all ICP dexes. And for testing I need to fork the mainnet for testing the swap.

Published on the mainnet then, its fast and cheap!
request some faucet token here.

Regarding forking mainnet, do you essentially get a copy of the Ethereum state? All 250 GB? For mainnet ICP, the total canister state is 4.34 TB and the rate of change is higher. Or do you mean that you get something that looks like mainnet, with say copy on write canisters/contracts so that you only download the canisters you interact with?

There’s a feature called dfx pull that will allow you to easily set up canisters and any canisters they depend upon, if the canisters have configured their metadata for it!