Replies: 1 comment 6 replies
-
This is sort of how |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I love the speed of forge and its use of solidity for testing.
One thing I see missing with that though is the ability to test actual deployment setup.
In hardhat world, you can setup your deployment procedure, including the various dependencies among the smart contract as well as the arguments that depends on off-chain computation (merkle root configuration for example) that you will actually execute against a real network.
And more importantly, you do it only once and can then re-use these exact deployment procedures in your tests. (and with forking, you even run such test on the "real" network). This allow you to test the real thing and ensure the params used in your deployment make sense.
This allow your test to focus on the actual behaviour without having to instantiate each smart contract again and duplicating the deployment procedure. (doing that introduce the risk of forgetting to update them).
In hardhat world, this is achieved via js deploy script using hardhat-deploy test fixture that will automatically deploy the contract under test and ensure all deployment dependencies are also executed. It also benefit from snapshotting the deployment (using evm_snapshot) so the next test do not need to redeploy the whole thing and still be deterministic.
How do you imagine this in the foundry world ?
Maybe there could be a way for deploying the contract before running the test and using snapshot to revert to that blockhain state before each test.
Like you basically execute whatever request / tx and then record the blockHash, execute test 1, revert to blockHash, execute test 2, etc....
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions