unlock icon indicating copy to clipboard operation
unlock copied to clipboard

Run mainnet fork test in CI

Open julien51 opened this issue 2 years ago • 4 comments

Multiple of our tests for smart contracts require the RUN_FORK to be set. I suspect these do not run in CI... but I think it is important that we also run them there...

What do you think @clemsos ?

julien51 avatar Apr 28 '23 21:04 julien51

It will be good to have some tests running on mainnet forks but there are limitations to it

  • not very good to test against an unknown state
  • having tests relying on a remote host to get the initial state can lead to failures on CI (if archive node is down etc)
  • the state of the chain is changing constantly so the tests have to be written to support this changes (e.g. contract balances, uniswap pools liquidity, etc). To mitigate this, the fork has to be on specific block height - which kind of defeats the purpose of having "real life" tests

Overall maybe a better approach will be to have a small "mainnet test suites" with a defined scope. It could also run against other forks (Polygon, etc), not only mainnet

clemsos avatar May 10 '23 12:05 clemsos

We added support for tenderly forks in #13220 for governance scripts that could be used as well. Most of the require test on mainnet forks are in the governance folder, except some Uniswap development that lives in smart-contracts folder.

clemsos avatar Feb 02 '24 14:02 clemsos

Tenderly has a new feature for running dedicated testnets that could be used to run tests

https://docs.tenderly.co/virtual-testnets

clemsos avatar May 15 '24 14:05 clemsos