mirror of
https://github.com/hanzoai/bridge-shim.git
synced 2026-10-30 18:46:32 +00:00
White-label tenant shim for the canonical bridge — bridge.hanzo.network. The shim composes the OSS upstream (ghcr.io/luxfi/bridge:v1.1.39) and ships: - tenant.yaml — Hanzo Bridge declarative config (brand=Hanzo Bridge, IAM=hanzo.id, KMS=kms.hanzo.ai, network=Hanzo Mainnet chainId 36963, pq=strict-pq, chains=eth/btc/sol/ton/xrp/dot/hanzo). - Dockerfile — FROM upstream + COPY tenant.yaml + --tenant-config pin. - contracts/tenant.json + Deploy.sh — wraps @luxfi/standard v1.7.5's DeployTenant.s.sol with the Hanzo manifest. - k8s/ — Deployment, Service, IngressRoute (bridge.hanzo.network), ConfigMap, Namespace, Kustomization. - tenant_test.go — go test imports luxfi/bridge/pkg/tenant.Load and validates tenant.yaml. - .github/workflows/build.yml — semver-tag-gated GHCR push via the hanzoai org's hanzo-build-linux-amd64 ARC pool. Tests: GOWORK=off go test ./... → PASS.
67 lines
2.2 KiB
Go
67 lines
2.2 KiB
Go
// Package hanzobridgeshim tests the Hanzo Bridge tenant configuration
|
|
// against the canonical upstream tenant.Config schema. The shim itself
|
|
// ships no Go binary — the production image overlays this tenant.yaml
|
|
// on top of the upstream OSS bridge container.
|
|
package hanzobridgeshim
|
|
|
|
import (
|
|
"path/filepath"
|
|
"runtime"
|
|
"testing"
|
|
|
|
"github.com/luxfi/bridge/pkg/tenant"
|
|
)
|
|
|
|
// TestTenantConfigValidates is the single guardrail this shim ships.
|
|
// Loads tenant.yaml via the upstream tenant.Load and asserts every
|
|
// required field is set + every constraint is satisfied.
|
|
func TestTenantConfigValidates(t *testing.T) {
|
|
_, thisFile, _, _ := runtime.Caller(0)
|
|
cfgPath := filepath.Join(filepath.Dir(thisFile), "tenant.yaml")
|
|
|
|
cfg, err := tenant.Load(cfgPath)
|
|
if err != nil {
|
|
t.Fatalf("tenant.Load(%s): %v", cfgPath, err)
|
|
}
|
|
|
|
if cfg.Brand.Slug != "hanzo-bridge" {
|
|
t.Errorf("Brand.Slug: got %q, want hanzo-bridge", cfg.Brand.Slug)
|
|
}
|
|
if cfg.Network.ID != 36963 {
|
|
t.Errorf("Network.ID: got %d, want 36963 (Hanzo Mainnet)", cfg.Network.ID)
|
|
}
|
|
if cfg.IAM.Endpoint != "https://hanzo.id" {
|
|
t.Errorf("IAM.Endpoint: got %q, want https://hanzo.id", cfg.IAM.Endpoint)
|
|
}
|
|
if cfg.KMS.Endpoint != "https://kms.hanzo.ai" {
|
|
t.Errorf("KMS.Endpoint: got %q, want https://kms.hanzo.ai", cfg.KMS.Endpoint)
|
|
}
|
|
if cfg.PQProfile != "strict-pq" {
|
|
t.Errorf("PQProfile: got %q, want strict-pq", cfg.PQProfile)
|
|
}
|
|
if cfg.Domain != "bridge.hanzo.network" {
|
|
t.Errorf("Domain: got %q, want bridge.hanzo.network", cfg.Domain)
|
|
}
|
|
}
|
|
|
|
// TestSupportedChainsScopedToHanzo asserts the chain allowlist
|
|
// matches Hanzo's deployment scope.
|
|
func TestSupportedChainsScopedToHanzo(t *testing.T) {
|
|
_, thisFile, _, _ := runtime.Caller(0)
|
|
cfgPath := filepath.Join(filepath.Dir(thisFile), "tenant.yaml")
|
|
cfg, err := tenant.Load(cfgPath)
|
|
if err != nil {
|
|
t.Fatalf("tenant.Load: %v", err)
|
|
}
|
|
for _, c := range []string{"eth", "btc", "sol", "ton", "xrp", "dot", "hanzo"} {
|
|
if !cfg.IsChainSupported(c) {
|
|
t.Errorf("expected chain %q to be supported", c)
|
|
}
|
|
}
|
|
for _, c := range []string{"liquid", "zoo", "pars", "lux"} {
|
|
if cfg.IsChainSupported(c) {
|
|
t.Errorf("chain %q must NOT be supported by Hanzo Bridge", c)
|
|
}
|
|
}
|
|
}
|