Quick commands
The toolchain trap
The program requires modern Agave platform-tools (v1.54 / rustc 1.89, installed by Agave CLI 4.1.1 fromrelease.anza.xyz/stable/install). The historical anchor build
failure (edition2024 parse errors) was caused entirely by old platform-tools v1.43.
Two rules:
- Build with
cargo build-sbffrom the program directory, notanchor build. - Any
anchorCLI invocation (includinganchor idl build) may silently re-install Solana 2.1.0 and repointactive_releaseback to the old tools. After anyanchorcommand, repoint:
anchor idl build chokes on the two ostatus PDAs whose seed is a
function call on an instruction argument. Workaround: temporarily swap those seeds for a
plain argument field to emit the IDL, then restore. The runtime .so keeps the real
hash-based seeds.
Backend environment
Go DB tests needDATABASE_URL (auto-read from the repo-root .env, gitignored — copy
.env.example). Each test run creates a scratch database and drops it afterwards.
They’re slow against Neon (~300 ms per statement) and occasionally network-flaky —
a package failing with dial error / no such host is the network, not the code;
re-run it. Scope test runs while iterating: go test ./internal/matching/ is instant,
./internal/api/ takes ~3 minutes.
pgx runs in the simple query protocol (Neon’s pooler breaks prepared statements),
which imposes three conventions: explicit ::bigint casts in SQL arithmetic on
parameters, JSONB parameters passed as Go string (never []byte), and uint64 salts
scanned via int64.
Running the server
backend/.env.example for the full environment surface.
Public devnet RPC rate-limits aggressive status polls — the crank and harness poll
gently (1.5–2.5 s); a transaction that “times out” usually landed (check
solana confirm).