PR #1126 in gonka-ai/gonka, merged 2026-05-07 by @pixelplex, restructures the devshardd daemon — the process that drives each devshard's coordination work off-chain — into a standalone build with its own Docker image, a cleaner entry point, and a Postgres-backed payload store. The change touches 71 files (+4,079 / -1,776 lines).

A devshard is a lightweight off-chain coordination unit introduced in v0.2.11. Inference requests get routed to a devshard, which handles peer-to-peer transport, threshold signing, and intermediate state — the chain only steps in for session setup and final settlement. devshardd is the daemon that runs one such unit. Until this PR it was bundled inside the larger decentralized-api image and shared its build path.

What changed

  • Standalone build. A new devshard/Dockerfile builds devshardd and devshardctl as their own image, with the musl/CGO setup that the BLS signature library blst requires. The Makefile target devshardd-build now points at this new Dockerfile, and the binary copy path moves from decentralized-api/build/ to devshard/build/. The decentralized-api/Dockerfile and go.mod lose the unused devshardd/devshardctl build steps and the devshard replace directive — see PR #1126 for the diff.

  • Entry-point decomposition. The roughly 350-line main.go is split into app.go (startup wiring with a LIFO closeStack cleanup helper), config.go (env-var loading), and chain_events.go (a thin chainEventBridge glue type wiring the listener, bridge, and phase together). The block and escrow event fan-out moves into a new devshard/cmd/devshardd/events package, replacing a duplicate that previously lived under common/chain/events.

  • Postgres payload store. A new local-test-net/docker-compose.devshard-postgres.yml brings up a postgres:16-alpine instance on the shared chain-public network. The versiond compose file passes PGHOST, PGDATABASE, PGUSER, and PGPASSWORD through to the devshardd child process. The genesis container also exposes gRPC on 0.0.0.0:9090 so devshardd can reach the chain endpoint from its own container.

  • Integration tests. The old DevshardTests suite — which exercised the in-process devshard wiring inside decentralized-api — is removed because that wiring no longer exists. A new end-to-end test, devshardd bridge events and phases settle escrow lifecycle, drives the full escrow path through real chain events rather than direct RPC calls.

Why it matters

Splitting devshardd out of decentralized-api ends a coupling that has been awkward since v0.2.11 shipped: two daemons with different deployment shapes were forced through one Docker build, and changing one binary required rebuilding both. Operators who run devshards now get an image scoped to that workload, with fewer dependencies to track and a faster build path.

The Postgres switch is the larger operational change. The previous payload-store layout did not survive long-running devshard workloads cleanly, and the new design pushes that state into a managed database with its own compose file. For now the wiring is enabled only on the local test-net, and only on the genesis node — join1 and join2 still run without Postgres. Once the new layout stabilises there, the same compose extension becomes the model for production devshards.