I’m writing tests for a feature that will integrate with SNSes right now, and would like to build out some integration tests.
Is there a script/command to 1-step deploy a mock SNS to my local dfx environment?
For example, it would be great if dfx came bundled with a dummy SNS, that had completed a mock SNS sale, and had at least one type of SNS canister (root, dapp, archive, etc.).
Then upon calling the nns-sns-wasm canister would return info about that SNS.
It would also set things up identical to production (i.e. controllers are all set up correctly w.r.t. SNS Root, NNS Root, etc.).
This would save developers (and me ) a lot of time when building ecosystem tooling that connects with and supports the SNS ecosystem. Having this in dfx (as opposed to just a PocketIC test runner) is helpful because it makes the frontend QA pieces so much easier.
Bonus points - this would be great if this existed for PocketIC as well!
I learned yesterday about the existence of dfx extension install sns --version 0.4.3. While I ultimately did not use it, I think I spotted various commands, including something like deploying a toy SNS. I did not try it and I’m not sure, but if you’re interested, I thought I’d share.
PS: Maybe important to note, given that I ultimately did not use it, I tried to remove the extension but dfx extension uninstall sns messed up the entire DFX, and I had to force delete its entire cache manually using sudo rm -r .cache to “resolve” the issue.
The dfx sns extension is a tool for (1) working with an existing SNS instance and (2) launching an SNS test flight instance (to mainnet / local replica). (Launching an SNS via proposals is an experimental feature of dfx sns; as of today, projects preparing for an SNS launch should use GitHub - dfinity/sns-testing: Testing SNS in local testing environment)
However, maybe a test flight SNS is what you want if you are developing something that is intended to interact with existing SNSes rather than SNSes during the swap.
Using a Pocket-IC snapshot is another excellent option.
Here is a repo with a state that has NNS using dfx nns install and then a launched SNS using the sns_testing default_scenario.sh. You should be able to get controllers and owners of the SNS via that. It may be a mess to pass procedures as I haven’t investigated the following structure yet, but perhaps you can configure it so that all the 100 or so participants follow a dev neruon? If someone wants figure that out I’ll update the state with the DFX commands:
In the meantime, I fixes some dependency bugs and created a PR for the dfx nns extension to support launching an SNS. This can be used already as follows:
git clone https://github.com/dfinity/dfx-extensions.git && cd dfx-extensions
It would be nice to have a mvd with the minimum number of participants all following a dev neuron to easily test deploying dao dapp canisters and testing generic dao function calls.
Note that not all (valid) SNS init configurations result in swaps that can be completed with exactly the minimum required number of direct participants. So solving this problem in general is a bit fiddly.