Files
dex/cmd
zeekayandGitHub 5cdecbca02 lx/dex: commercial license gate at matching-engine entry points (#2)
Add a canonical license gate that aborts the process unless the operator's
environment carries a Lux commercial license token whose Scope list
includes "dex". Same fail-closed pattern cevm v0.50.0 established at the
GPU state backend factory (~/work/luxcpp/cevm/bin/cevm/state_backend.hpp)
and that strict-PQ already uses for SignedOrder dispatch.

  pkg/lx/license_gate.go
    func EnforceMatchingEngineLicense()
    const LicenseScope = "dex"

  cmd/dex-server/main.go
  cmd/dex-api-server/main.go
    lx.EnforceMatchingEngineLicense() — first statement of main(),
    runs before any matching-engine state is constructed.

The gate consults $LUX_LICENSE, $LUX_LICENSE_FILE, then
$HOME/.lux/license.jwt — same lookup luxfi/license uses everywhere.
On success it is silent so production logs stay quiet. On failure it
prints an actionable FATAL line and exits 1 (luxfi/license's
HasFeatureOrDie does the printing — one place, one message).

Tests (pkg/lx/license_gate_test.go) re-exec the test binary and assert
exit codes / stderr for the three observable states:

  no_license     → exit 1, "no valid license is present"
  wrong_scope    → exit 1, `does not include scope "dex"`
  correct_scope  → exit 0

Fixtures issued by `lux-license issue --dev` (no expiry) and live under
pkg/lx/testdata/license/. Dev-key warning is expected in test output.

go.mod adds github.com/luxfi/license v0.1.0 (the immutable initial tag).
2026-05-16 15:12:56 -07:00
..
2025-12-11 17:50:19 -08:00