Contributing
Mirrored from
CONTRIBUTING.mdin the repository — edit that file, not this page.
Contributions are welcome; the bar is that every change keeps the full verification battery green and does not weaken a security property. Read SECURITY.md first: never open a public issue for a vulnerability.
Setup
- Foundry — CI pins
v1.7.1; use the same locally (foundryup --install v1.7.1) so the gas snapshot check is exact. Contracts need the submodules:git submodule update --init --recursive. - Node 20 (CI) —
npm ciin each ofoffchain/,packages/sdk/,packages/mcp/,subgraph/,dapp/. Buildpackages/sdkbeforepackages/mcp; the MCP server imports the SDK'sdist/. - Python 3.12 (CI; 3.9 is the floor) —
cd packages/python-sdk && python -m venv .venv && .venv/bin/pip install -e . - mdBook 0.4.40 for the docs (
mdbook buildat the repo root; needs Node onPATHfor the link preprocessor).scripts/devstack.sh upstarts the local development network in one command.
The repo layout is in README.md; the design is in ARCHITECTURE.md.
Before you push: the battery
Run everything that your change can affect. All of it runs in CI on every push and pull request (eight jobs: contracts, offchain, packages, subgraph, verify-deploy gate, dapp, python-sdk, docs).
| Surface | Command | Expect |
|---|---|---|
| Contracts | forge test | 226/226 across 11 suites |
| Gas regression | forge snapshot --check | no diffs against .gas-snapshot |
| Offchain types | cd offchain && npx tsc --noEmit | clean |
| Offchain suites | npm run test:boundary, test:adapters, test:results, test:ha, test:billing, test:templates | 11, 19, 8+9, 7, 7, 6 |
| TS SDK | cd packages/sdk && npm run build && npm test | artifact + results-core drift checks OK, 19/19 |
| MCP | cd packages/mcp && npm run build && npm test | compiles, 5/5 |
| Python SDK | .venv/bin/python -m unittest discover -s tests | 7/7 |
| Subgraph | cd subgraph && npm run codegen && npm run build | Build completed |
| dApp | cd dapp && npm run build | green |
| Docs | mdbook build | builds; no dead links (see below) |
The live scenarios (paid x402 loop, relay, HA failover, billing, Python interop) are scripted in docs/testing-guide.md; run the one your change touches.
Conventions that bite if skipped
- After any contract change run
cd offchain && npm run gen-abis. It regeneratesoffchain/src/sdk/artifacts.ts(ABIs + bytecode the deploy script uses) and the SDK's copy;packages/sdk'scheck:artifactsfails the build if they drift. Forgetting this deploys stale bytecode on your local development network and produces confusing reverts. - Gas snapshot — regenerate with
forge snapshotat the repo root only, in the same commit as the contract change. Do not commit a snapshot anywhere else. - Pinned Merkle vectors — the evidence-format vectors are shared by three implementations
(
offchainethers,packages/sdkviem,packages/python-sdk). Never change them without a format version bump; a drift in any implementation fails its suite by design. - Real-chain safety — nothing may fall back to the public Anvil mnemonic once
REAL_CHAINis set;verify-deploymust keep rejecting a local-development deployment (that is the CI gate's negative test). Keep it that way. - Docs — chapters live under
docs/and are listed indocs/SUMMARY.md. Root documents (ARCHITECTURE, SECURITY, NEXT-STEPS, this file, the CHANGELOG, package READMEs) are mirrored into the book byscripts/mdbook-repo-links.mjs; link to them with normal relative Markdown links and the preprocessor resolves them. Update the numbers you touch (test counts, defaults) — the book is meant to be exact. - Secrets and state —
.env,node_modules,out/,book-out/,.devstack/andCHECKPOINT-*.mdare gitignored on purpose. The local development network uses the public Anvil accounts; never commit a real key.
Commits and pull requests
- One logical change per commit, imperative subject line, body says why and what was verified
(
forge 226/226,demo conservation exact, and so on). - Note user-visible changes in CHANGELOG.md under Unreleased.
- A pull request should say which battery rows you ran. CI must be green; the gas snapshot job is exact, so include the regenerated snapshot when gas legitimately moves.
- Security-relevant changes (payments, staking, disputes, arbitration, account abstraction,
deploy scripts) get a second reader and, where the change is economic, a note in the relevant
design record under
docs/design/.