Hello dear community,
I’m trying to implement SNS and NNS testing. While SNS initialization is relatively straightforward and can differ for different SNS projects, I’m struggling with the NNS setup.
My Approach
I decided to reuse the test setup from the IC repository, specifically using the ic_nns_test_utils
crate to construct initialization arguments. However, I’ve encountered several compilation errors:
-
LMDB Error: Lmdb-sys/lmdb/libraries/liblmdb/lmdb.h does not exist
I followed advice from this forum post. And I also done some other operations, which in complex fixed the error.
-
MOC Not Found: moc --version
output: Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
I tried everything to install moc, but had no success. Had the flow here changed?
-
error: failed to run custom build command for cranelift-codegen v0.117.2
cargo check -p cranelift-codegen --features isle-errors
error: cannot specify features for packages outside of workspace'
-
Error building ISLE files
Questions
-
Is there a simpler way to construct NNS initialization arguments without pulling in so many dependencies? Or probably some instruction on how to setup all those dependencies?
-
What is the moc
tool and how can I install it properly? Is it related to Motoko or MOPS?
-
Has anyone successfully set up NNS testing in a standalone project (not within the IC repo)?
Would appreciate any ideas on this!
1 Like
Hi Victoria,
To get the NNS / SNS testing locally, you need to start with the flag --clean
You can use the following commands
dfx start --clean --background
Then open another tab install the NNS
dfx install nns
After this a local replica of the nns will be installed and will be awaiting for an SNS to launch
Just follow the steps here: GitHub - dfinity/sns-testing: Testing SNS in local testing environment
As an alternative here’s a script with all the steps you need cosmicrafts-dao/init.sh at 38e712c8190421d9476abf90370d7c4ae7cf12b7 · cosmicrafts/cosmicrafts-dao · GitHub
you can just copy paste the script to any good LLM and can make you a step breakdown
hope this helps
1 Like
Thank you for the response!
I’ve forgotten to mention that I’m trying to implement it using PocketIC. I saw this setup in ic repository and was trying to add it as dependency into mine repository, which had resulted in a bunch of errors from the compiler
And the NnsInitPayloadsBuilder looks quite useful for my goal as well as NnsInstaller
Hello dear DFINITY team,
I’ve successfully integrated the DFINITY NNS test payload initializer into our setup and managed to get the full NNS canister suite installed and used for integration tests implemented with PocketIC.
However, one major inconvenience lies in how DFINITY’s test framework handles the canister build process. Specifically, it dynamically builds the canisters at runtime — for example, the lifeline canister build is invoked via a main
function in its own crate. For other canisters, a similar pattern appears here
To work around this, I was able to override the lifeline canister’s build logic with a local patch. That allowed me to get things running, but it’s still not possible to use the NnsInstaller
directly without including all of DFINITY’s build logic in our repo.
Would it be possible to separate the current crate into two:
- One responsible for building the Wasms
- Another that accepts prebuilt Wasms (e.g., downloaded from the release site) and sets up the environment?
I believe this separation would greatly simplify testing and integration for many projects in the ICP ecosystem