Skip to content
26F-StudioPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cadence

English | 简体中文

techmino-cadence is the Rust/Axum/Tokio game service for Techmino. Tessera owns accounts, passwords and independent product/device grants; Cadence validates an access credential with the configured Tessera resource credential before admitting a game identity. techminoGalaxy supports trusted product identity, not invented multiplayer modes.

Build and run

The sibling ../Techmino checkout supplies the canonical default netBattle sources. Set TECHMINO_SOURCE_DIR when building from another layout. build.rs embeds only its explicit allowlist and includes its content hash in RULESET_VERSION; a packet cannot choose a Lua module.

cargo build --locked --release --bin techmino-cadence
# With a protected, operator-configured environment:
./target/release/techmino-cadence migrate
./target/release/techmino-cadence serve

Migration uses MIGRATION_DATABASE_URL and requires the pre-created cadence_application NOLOGIN DML group. Serving uses the separate DATABASE_URL runtime login. Runtime refuses administrative privileges and does not run DDL. See sql/grant-application.sql and the Tessera deployment directory for role provisioning.

Required configuration: DATABASE_URL, TESSERA_ORIGIN, TESSERA_RESOURCE_SECRET (or its permission-restricted _FILE), CADENCE_PUBLIC_ORIGIN, CADENCE_ALLOWED_ORIGINS, and CADENCE_REPLAY_DIR. Set CADENCE_BIND explicitly behind the TLS proxy. CADENCE_TRUSTED_PROXIES is an exact peer-CIDR list; only these peers may supply sanitized X-Forwarded-For. CADENCE_GAME_ADMINS contains operator-owned account UUIDs, independent of Tessera account administrators. CADENCE_DEV=true permits loopback plaintext development only; deployed clients still use HTTPS/WSS.

CADENCE_TESSERA_CA_FILE optionally adds one certificate-only PEM root, at most 16 KiB; it never disables TLS or hostname validation. Resource-secret rotation may use TESSERA_PREVIOUS_RESOURCE_SECRET/_FILE plus TESSERA_PREVIOUS_SECRET_UNTIL, with an explicitly bounded overlap of at most five minutes. A compromised secret must instead be replaced without overlap.

Protocol and ownership

  • /health/live and /health/ready return JSON. Readiness includes database ownership, replay storage and certificate-verified Tessera readiness, not a website SPA response.
  • /v1/products/{product}/identity accepts a product access Bearer credential; account cookies are not game authority.
  • Native WSS admission uses a Bearer header at /v1/products/{product}/ws. Browser admission uses a one-use, 30-second ticket from /connections/tickets, bound to the configured allowed Origin. Do not send both ticket and Bearer on one upgrade.
  • One current socket per account/product. Replacement advances the generation; stale input, close and authorization callbacks cannot affect the replacement. Terminal notices are owned by the close decision and precede its close frame; pending application output is discarded on termination.
  • Authorization freshness is at most five seconds, including pause and the ten-second disconnected recovery window. Withdrawal, reset, disable and authorization outage cannot silently extend it.
  • Version-1 JSON envelopes are limited to 16 KiB inbound. TCM1 input has a 32-byte little-endian header and eight bytes per event, at most 64 events/544 bytes. Actor identity comes from the frozen authenticated participant, never from packet fields. Source actions are 1–20.
  • Cosmetic room names may change during play; gameplay settings, player roles, teams and the frozen participant tuning may not. rooms.get returns the published room snapshot; live frame observation uses match snapshots.

The authority track executes complete canonical default netBattle rules in isolated LuaJIT: TRS, source RNG, tuning, hold, gravity, lock/freshness, attack/cancellation, garbage, teams and terminal outcome. It is not a simplified SRS engine. Casual relay uses client simulation and explicitly unverified results. Other authoritative rules are not enabled. Authority input completion does not let a client declare death or victory.

Approved limits

100 logical connections, ten rooms, ten players and twenty simultaneous spectators per room. Authority is 60 Hz with a six-frame input buffer and at most twelve future frames. Room commands and output are bounded; output is at most 128 frames/256 KiB per connection. The transport receive ceiling is 64 KiB, while protocol payload limits remain narrower; hostile frames beyond that ceiling receive best-effort transport closure rather than an unbounded allocation.

Matches last at most 900 seconds. Host-configured pause-on-disconnect/absence supports 5/10/30-second single pauses and a sixty-second total pause allowance. Permanent leave, kick or revocation is terminal; pause never suspends authorization freshness.

Replays are at most 16 MiB each, retained seven days, within a 2 GiB physical-allocation/headroom budget. ACLs persist incrementally in PostgreSQL; cumulative distinct readers have no cap. A late spectator remains provisional until its bounded ACL persistence acknowledgment succeeds. Simultaneous admission limits still apply. Settlement is durable only after PostgreSQL and replay publication acknowledge it; restart exposes interrupted matches, not fabricated continuation.

Cloud saves use owner-only bounded JSON, five immutable versions and revision-conditional writes. Credentials, executable Lua, local replays and uploaded offline rankings are excluded. A conflict requires an explicit user choice.

Verification and deployment boundary

cargo test --locked --release --lib -- --test-threads=4
TECHMINO_LOVE_CORPUS=/path/to/real-love-corpus.json \
  cargo test --locked --release --lib \
    engine::tests::real_love_11_5_rule_and_rng_parity -- --ignored
python tests/system_smoke.py --help

The independent corpus must be generated by actual original/headless LÖVE 11.5 for the current canonical source bytes. Ordinary tests do not substitute for that check. The real-system harness uses actual PostgreSQL, SMTP, issued credentials and certificate-verified WSS; absent operator/device/load prerequisites are SKIP, never PASS.

Observed local evidence includes current-source original-LÖVE parity, a locked release build, actual container startup/readiness, trusted Techmino/Galaxy identity, lifecycle revocation with established WSS, connection replacement, fragmented messages/ping and configured protocol-size rejection. Integrated match/replay, sustained resource, outage/drain/restore and all-platform acceptance remain governed by the root implementation plan; this README does not claim unexercised scenarios passed.

The ninth exclusive mixed-pressure run reached 100 connections in ten rooms (five authority, five relay; 45 players and 55 spectators). During 20.01 active seconds, 300 control samples had p99 42.09 ms; 77 RSS samples at 250 ms intervals peaked at 57.5625 MiB, and physical replay allocation was 385,024 bytes. The container quota was four CPUs / 8 GiB on a 24-logical-CPU host. All selected pressure checks passed; the focused report still has one separate long-round SKIP and 215 unselected cases. A sampled maximum, process-lifetime high-water, 20-second workload and 900-second round are different measurements.

The later frozen-fixture integrated run completed in 1,353.3 seconds: 214 PASS / 0 FAIL / 21 SKIP / 0 UNSET, no phase errors, final zero connections/rooms. The renewed 900-second round, real slow-peer 4008, normal mandatory streams, database uniqueness, cloud API and synchronized fault recovery passed. The SKIPs are the separately enabled resource-overlap (two), temporary-admin (three) and pressure (sixteen) conditions; this report remains PARTIAL, and actual-device/production release gates remain open.

Manual drained backup/isolated restore and fresh/local Compose live in ../Tessera/deploy. Production credentials, DNS, SMTP, signing, device verification, legacy import and production cutover require their own real prerequisites and authorization. No production migration is implied by local fixtures.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages