relayer/docs/DEVELOPMENT.md
This document covers building, testing, linting, and running the relayer locally. It is intended for people who hack on the relayer code. For operator-facing self-hosting instructions, see SELF_HOSTING.md.
For contribution guidelines, see CONTRIBUTING.md.
make setup # Start Postgres, run migrations, copy config templates
This single command handles everything needed for local development:
config/local.yaml.example to config/local.yaml if it does not already exist.Run make help for the full list of available targets.
make test-unit # Fast unit tests (no Postgres required)
make test-all-no-long-running # Full suite (requires Postgres)
This mode runs the entire Zama protocol locally using fhevm-cli from the fhevm repository.
git clone [email protected]:zama-ai/fhevm.git
cd fhevm/test-suite/fhevm
./fhevm-cli deploy
This requires at least 12 GB of Docker memory.
Build local images with registry-prefixed names, which is what the fhevm-cli Docker Compose stack expects:
LOCAL_RELAYER_TAG=local-relayer-$(date +%Y%m%d%H%M%S)
make docker-release TAG=${LOCAL_RELAYER_TAG}
Then upgrade the relayer in the fhevm stack:
# From fhevm/test-suite/fhevm
RELAYER_VERSION=${LOCAL_RELAYER_TAG} \
RELAYER_MIGRATE_VERSION=${LOCAL_RELAYER_TAG} \
./fhevm-cli upgrade relayer
docker inspect fhevm-relayer --format '{{.Config.Image}}'
docker inspect relayer-db-migration --format '{{.Config.Image}}'
./fhevm-cli test input-proof
./fhevm-cli clean
make check # fmt + clippy (quick pre-push gate)
make fix # Auto-fix fmt + clippy issues
make clippy # Clippy only
make fmt # Format check only
make check is the recommended pre-push gate. It runs both fmt --check and clippy but does not start Postgres or run tests.
make db-start # Start local Postgres (port 5433) and wait for ready
make db-stop # Stop Postgres (preserves data)
make db-destroy # Stop Postgres and wipe all data
make db-reset # Wipe and re-run migrations from scratch
make db-status # Show container status + connection test
make db-shell # Open psql shell
These require sqlx-cli:
cargo install sqlx-cli --no-default-features --features postgres,rustls
Then:
make sqlx-migrate # Run migrations via sqlx-cli
make sqlx-prepare # Regenerate offline metadata for CI/Docker builds
The Docker build relies on pre-computed query metadata in .sqlx/. After adding or modifying SQL queries, run make sqlx-prepare before building Docker images.
make docker-build # Build relayer image
make docker-build-migrate # Build relayer-migrate image
make docker-build-all # Both of the above
make docker-release TAG=v0.9.0-rc.1 # Build with registry prefix
The relayer Dockerfile requires a real .git/ directory (not a worktree) for build-time version embedding.
In a Git worktree, .git is a file rather than a directory, which causes the mount to fail. Build from a primary clone instead.
See the Troubleshooting section in the main README.