How well does Ganache-cli emulate the actual blockchain?

I’ve been wondering, when you develop a smart contract and put together all the unit tests, coverage, etc… How sure can you be that it will behave exactly the same (without considering edge cases like interactions with other contracts, etc…) in an actual network ?

I know, for example, that ganache has some non-standard RPC methods (like evm_increaseTime) and that you won’t be able to replicate that behavior on a GETH node for example.

But, if let’s say you did your job, you have all your unit tests, 100% coverage and all the good stuff.
Should a developer expect that everything is going to behave exactly the same? Or there anything else to consider? I think this question is particulary interesting now that ganache allows you to target a fork.

Looking forward for some thoughts !

1 Like

Hi @Madness,

It depends on what your solution does and what it interacts with.

Unit tests, (with high coverage), integration tests on public testnets and test forks of mainnet, end user testing on public testnets (including Ropsten), audits, limited private and public betas on mainnet are all worth considering as part of testing your solution.

Beyond that, block times, network congestion, high/fluctuating gas prices and chain reorgs are all things that should be considered how they may impact your solution and how you might test for them.

1 Like