This guide provides solutions for common issues encountered when using Moonwall in development and testing environments.
When integrating Moonwall into your project, you might encounter issues with development workflows, especially when trying to make changes to Moonwall itself while using it in your project.
The standard approach of using pnpm link for local package development doesn't always work well with Moonwall.
Solution: Local Package Referencing
Instead of using pnpm link, reference the local Moonwall package directory directly in your project's package.json:
{
"dependencies": {
"moonwall": "file:/path/to/moonwall"
}
}Then run pnpm install to create the symlinks.
For a more robust development workflow:
-
Fork and Clone the Moonwall Repository
git clone https://github.com/your-username/moonwall.git cd moonwall -
Install Dependencies and Build
pnpm i pnpm build
-
Add Your Repository as a Test Project
Create a directory for your test project inside the Moonwall repository, then set up your project there.
-
Use Moonwall Package Version Overrides
If you need to use your project's existing repository with local Moonwall development, use pnpm's overrides feature in your project's
package.json:{ "pnpm": { "overrides": { "moonwall": "file:/path/to/moonwall" } } }
When debugging issues between your project and Moonwall:
-
Enable Debug Logs
DEBUG=moonwall* pnpm moonwall test <ENV_NAME>
-
Use Source Maps for Better Stack Traces
Add a
.npmrcfile to your project with:node-option=--enable-source-maps -
Create Minimal Reproduction Case
When reporting issues, create a minimal reproduction in a separate project using the Moonwall test directory structure.
If you encounter network connection issues:
-
Check Node Binary Availability
Ensure the binary paths in your
moonwall.config.jsonare correct:# Verify binary existence and permissions ls -la /path/to/your/binary # Check if it's executable chmod +x /path/to/your/binary
-
Verify Port Availability
# Check if the port is already in use lsof -i :<port_number> # Kill the process if needed kill -9 <PID>
-
Docker Issues
For Zombienet foundation:
# Check Docker container status docker ps -a # Remove stuck containers docker rm -f <container_id>
When tests fail to execute:
-
Run Tests with Verbose Output
pnpm moonwall test <ENV_NAME> --verbose
-
Check Vitest Configuration
Ensure your test files match the patterns specified in your
moonwall.config.json. -
Verify Test Suite Dependencies
Check that all dependencies required by your tests are correctly installed.
For architecture-specific issues (e.g., ARM64 vs x86_64):
-
Build from Source
On Apple Silicon or other non-x86_64 platforms:
# Clone the repository for your chain git clone https://github.com/your-chain/node-repo.git # Build the binary following chain-specific instructions cd node-repo cargo build --release # Copy the binary to your Moonwall project cp target/release/your-node /path/to/moonwall/project/binaries/
-
Use Compatible Docker Images
If available, use multi-architecture Docker images in your Zombienet configuration.
If your configuration file has validation errors:
-
Check JSON Schema
Moonwall validates configuration against a schema. Check the error message for specifics.
-
Common Configuration Mistakes
- Missing required fields for specific foundation types
- Incorrect file paths
- Invalid connection parameters
-
Reference Valid Examples
Check the example configurations in the Moonwall repository.
Issues with specific environment configurations:
-
Chopsticks Foundation
- Ensure you have a valid endpoint for forking
- Verify the block number for state snapshots exists
- Check that the account keys have sufficient balance
-
Zombienet Foundation
- Verify Docker is running with sufficient permissions
- Check network configurations for correct relay/parachain setup
- Ensure WASM validation works in your environment
-
Dev Foundation
- Verify binary paths and options
- Check for port conflicts
- Ensure sufficient system resources
Transaction nonce issues include:
NONCE_EXPIREDNonce too lowNonce has already been used
Solutions:
-
Manual Nonce Management
When testing with multiple transactions:
// Get the current nonce const nonce = await ethers.provider.getTransactionCount(wallet.address); // Use it for your transactions with explicit incrementation const tx1 = await wallet.sendTransaction({ to: recipient, value: amount1, nonce: nonce }); const tx2 = await wallet.sendTransaction({ to: recipient, value: amount2, nonce: nonce + 1 });
-
Reset Dev Chain State
For persistent nonce issues, restart your dev chain to reset the state.
For Zombienet foundation using Docker:
-
Permission Denied
# Add your user to the docker group sudo usermod -aG docker $USER # Then log out and back in, or run newgrp docker
-
Resource Limitations
Increase Docker resource limits in Docker Desktop settings.
-
Network Conflicts
Remove existing Docker networks that might conflict:
docker network prune
Common Polkadot.js connection issues:
-
API Connection Failures
- Check WebSocket endpoint availability
- Verify API types match your chain's runtime
-
Missing Types
Register custom types if your chain has specific types:
const api = await ApiPromise.create({ provider: wsProvider, types: { YourCustomType: 'u32', AnotherType: { field1: 'u32', field2: 'Vec<u8>' } } });
-
Event Subscription Issues
Handle unsubscription properly:
const unsub = await api.query.system.events((events) => { // Handle events }); // Later, unsubscribe await unsub();
If you encounter issues not covered by this guide, please open an issue with details about your problem, including relevant configuration files and error messages.