Testing with forked state from live network

Hi @obernardovieira. Great overview article (Test smart contracts like a rockstar), thank you very much for it.

Do you have any experience with using the ganache --fork and --db options, in order to fork state from actual live networks (contract addresses, contract state). We really need something like that in our test suite because we integrate with dapps, and it seems like a daunting task to deploy all of these dapps onto ganache and set them all up (basically like a full emulation) ourselves during testing. However, I have not found a good post/article that goes through some examples of how to make use of ganache --fork option.

Maybe that’s something you already have experience with or know a good resource on it?

2 Likes

Hi @gitpusha,

Appreciate.

I do have experience with --db. Culd be interesting to write about it, thanks.
I’ve never used --fork neither I’ve worked in a project with that requirements, but it’s a subject that I’m curious about. I think the fork option is more related to the EIPs implemented, but I’m not totally sure. If someone has any knowledge, please answer, I will appreciate. If not, I’ll be happy doing some research as well.

2 Likes

Hi @obernardovieira. I will (have to) dig into this topic anyway. I ll report back to you with my findings.

2 Likes

Hi @gitpusha and @obernardovieira,

The following article from earlier this year covers forking from a public network for testing:

2 Likes

Thanks @abcoathup. It’s amazing how much relevance is concentrated inside the OZ articles and forum posts. It seems like for every issue I encounter, there is almost always already an article, forum post, or issue in the OZ ecosystem.

1 Like

Hi @gitpusha,

Thanks to everyone in the community, and all of the contributors to OpenZeppelin.

Keep asking (and answering) questions and it will help grow the knowledge base in the forum for the entire community, now and in the future.

1 Like