A comprehensive toolkit for building and managing WASM-based governance proposals for the Namada blockchain. This repository provides templates, build tools, and examples for creating governance proposals that can be executed through Namada's on-chain governance system.
Contains historical mainnet upgrade phases that have been deployed:
phase2/- Phase 2 mainnet upgrade proposalphase3/- Phase 3 mainnet upgrade proposalphase4/- Phase 4 mainnet upgrade proposalphase5a/- Phase 5a mainnet upgrade proposalphase5b/- Phase 5b mainnet upgrade proposal
These serve as real-world examples and reference implementations for complex governance proposals.
Template code for common governance proposal patterns:
update-wasm/- Template for updating WASM code via governanceupdate-params/- Template for updating chain parameterswhitelist-token/- Template for whitelisting new tokens
Use these as starting points for new proposals.
Use these folders for development or to hold actual mainnet and testnet proposals
For quick local development and testing:
# Build a specific proposal locally
cargo build --package $PROPOSAL_NAME --release --target wasm32-unknown-unknown
# Example: Build the update-wasm proposal
cargo build --package update-wasm --release --target wasm32-unknown-unknown
# The compiled WASM will be in target/wasm32-unknown-unknown/release/Prerequisites:
- Rust toolchain (see
rust-toolchain.tomlfor version) wasm32-unknown-unknowntarget installed:rustup target add wasm32-unknown-unknown
For optimized, production-ready builds use Earthly (recommended for final proposals):
# Build a specific proposal
python3 builder/build_proposals.py --directory proposals/template/update-wasm
# Enable debug output for troubleshooting
python3 builder/build_proposals.py --directory proposals/template/update-wasm --debug# Build with specific rust version and package name
earthly --build-arg=RUST_VERSION=1.85.1 --build-arg=PACKAGE=update-wasm +buildPrerequisites:
- Earthly installed
- Docker installed and running
The Earthly build process:
- Sets up the Rust environment with the specified version
- Installs required dependencies (protobuf, clang, etc.)
- Runs cargo clippy for linting
- Builds the WASM with release optimizations
- Applies
wasm-optfor size optimization - Outputs optimized WASM files to
artifacts/wasms/ - Generates proposal JSON files in
artifacts/
# Create directory structure
cargo new --lib proposals/tobenamed/my-new-proposal- Write code into
proposals/my-new-proposal/src/lib.rs - Edit
proposals/my-new-proposal/Cargo.tomlappropriately
- Create
proposals/mainnet/my-new-proposal/data.json - An example is here
You have several options here, which include building the wasm alone locally with cargo,
building the wasm and proposal locally with Earthly, or opening a PR and having the CI build the wasm and proposal with Earthly.
To build your proposal in GitHub Actions, add it to .github/workflows/build.yml:
jobs:
build:
strategy:
matrix:
proposal:
# ... existing proposals ...
- path: proposals/mainnet/my-new-proposal
id: my-new-proposalEach proposal contains:
Cargo.toml- Rust package configurationdata.json- Proposal metadata and governance parameterssrc/lib.rs- The actual proposal implementation in Rust- Generated artifacts:
artifacts/wasms/*.wasm- Optimized WASM bytecodeartifacts/*.json- Complete proposal JSON with embedded WASM data
- "earthly command not found": Install Earthly
- Rust version conflicts: Check
rust-toolchain.tomland ensure correct version - WASM target missing: Run
rustup target add wasm32-unknown-unknown - Build failures: Use
--debugflag with build_proposals.py for verbose output