Open shahankhatch opened 3 years ago
Unfortunately this is not looking anywhere as easy I'd hoped.
Snapshot has a local test harness (no Docker container) that connects to a live network (e.g. main net) to run against contract's there.
End to end testing is going to be ...interesting 🤔
@shahankhatch do you want the testing framework code in this BitDAO repo or under the WindRanger repo?
Current thoughts being create the e2e code in the WindRanger then port over the test code to verify the deployed BitDAO contract.
Your suggestion for having e2e in Windranger and porting BitDAO-specific tests sounds like a good suggestion @CjHare 👍
The test repo up and running against the latest Governance contracts with a open vote and role vote strategies available.
https://github.com/windranger-io/windranger-governance-snapshot-strategies-it
The npm test
run an mocha test of the two strategies against an in-memory HardHat network. The tests have equivalent logic to the snapshot-strategies
but use dynamic input data (a static example.json
is used in the Snapshot tests)
Evaluate whether this testing framework can be offered as a template
The setup of the in-memory HardHat node and contract is generic, and would be the same for any test framework (providing the data to test against) ...but, the actual tests themselves (logic) is Snapshot specific and there are additional hooks (node_modules
patch) to tweak Snapshot to use the dynamic data from the tests.
To apply to a different Governance framework, interfaces can be added to abstract the details of which contract to deploy and how to initialise them, which would create a further separation between the init and test logic.
The one hiccup is needing to know the multicall contract (common for all snapshot testing) before it is deployed. Not difficult as HardHat uses generated addresses based on order of contract creation, so is consistent across runs, but when updating dependencies is going to be a gotcha)
@shahankhatch This one I think can be closed too as we have sufficient integration test for current contracts and snapshot in strategies-it repo and full flow tests for on-chain Governance in the current repo.
Evaluate how to integrate other off-chain governance frameworks into this testing framework, e.g., Zodiac
@shahankhatch this last point is likely to need a PoC (experimenting on Rinkeby with Gnosis Safe+Zodiac), as it's not entirely clear to me from the Zodiac docs how the various plugins work together 🤔
Using Zodiac with on-chain governance is mentioned, but only in passing, without example ...many open questions.
Future work: