Project

Contributing & conventions

The rules that keep circuits, contracts, and the SDK in agreement: English everywhere, a single field/hash scheme, generated verifiers, formatting with Prettier, and CI as the gate on every change.

Because three layers must agree byte-for-byte on the cryptography, shh's conventions are mostly about keeping that agreement honest.

Conventions

  • All code, comments, identifiers, and commits in English.
  • Every circuit change re-runs the setup and re-exports its verifier; verifiers are generated artifacts, never hand-edited.
  • The field/hash scheme is defined once in the privacy design and must match across circuits ⇄ contracts ⇄ SDK.

Before you push

bash
pnpm format        # prettier (+ prettier-plugin-solidity)
pnpm -r test       # run every package's test
pnpm --filter @shh/sdk test
pnpm --filter @shh/circuits test
pnpm contracts:test

CI (.github/workflows/ci.yml) runs the full gate on every push and PR: install circom → compile + trusted setup → sdk/circuits/contracts tests → web build. If your change touches the cryptography, expect the whole chain to be re-verified.

The invariants you must preserve

  1. Poseidon arity and constants identical in circom and the deployed hasher.
  2. LEVELS, ZERO, and node ordering identical in circuit, MerkleTreeWithHistory, and SDK.
  3. Public-signal ordering identical in circuit, exported verifier, and contract call sites.
  4. amount bit-width (248) enforced in the circuit and respected by the SDK.

Workspace scripts

pnpm setup
Compile circuits + trusted setup + build SDK & contracts.
pnpm dev
Turn-key local stack (chain + deploy + artifacts + backend).
pnpm build / pnpm test
Recursive build / test across the workspace.
pnpm copy:artifacts
Stage circuit artifacts + manifests into the app.