L2 — Game Architecture
Runtime view of the game vertical: frontend, game-api, grok-agent, the on-chain program, Firestore collections, and the Google Workflows that handle all deferred work (no in-process timers — a workflow survives deploys and restarts).
Reading notes
Section titled “Reading notes”- game-api is a Cloud Run Service; grok-agent is a min-0 Cloud Run Job — one execution per game, launched when the AI-fallback workflow decides a starving queue needs an AI opponent. Idle cost is zero.
- All deferred work is Google Workflows, never
tokio::spawntimers: AI-fallback, session abandonment, and match timeouts each run as durable workflow executions calling back into/internal/*handlers. The/internal/*surface is closed at the platform boundary (internal load-balancer ingress + Cloud Armor), not by shared credentials. - The matchmaker keypair (held in Secret Manager) co-signs
create_gameso players cannot forge a matchup commitment; players and agents sign their own transactions locally. - The same backend also drives the EVM legs (Base, Ethereum) through the chain-core seam; per-chain addresses and stakes live in the chain registry, never in code. See EVM & Cross-Chain.