Files
papers/lp-201-zap-universal-wire/sections/risks.tex
zeekay 010d5ad016 papers: LP-201 ZAP as Universal Wire + Tier-1 status reflecting current session
Inventory captures stack-wide ZAP coverage; rows updated to reflect this
session's landings:
  - lux/utxo: linearcodec rip closed (commit luxfi/utxo@559e482) — Tier 5 DONE
  - hanzo/agent: cross-process ZAP wire shipped (commit hanzoai/agent@ecf7ff6) —
    Tier 5 DONE via HANZO_AGENT_WIRE=zap feature flag, default JSON path
    preserved for OpenAI compat
  - hanzo/mcp: MCP<->browser ZAP path shipped (zap-server.ts wired into
    both index.ts and cli.ts) — MCP<->MCP federation client-side is the
    remaining gap

Paper body: threat-equivalent inventory + bench claims (7.50x parse geomean
LP-023 measured, 7.4-8.6x compounded stack-wide, 24x alloc reduction,
14x fewer GC runs) + Tier 1 URGENT list. Risks section flags Tier 4
external-boundary services (binance/coinbase/stripe/plivo/openai/anthropic)
as DO-NOT-MIGRATE.
2026-06-10 22:35:37 -07:00

91 lines
4.0 KiB
TeX

% sections/risks.tex -- risks, rollout phases, and conclusion
\section{Risks}
\label{sec:risks}
\paragraph{Wire compatibility breaks.}
Every Tier-1 migration changes the byte layout of a consensus-critical
or RPC-public surface. The Quasar activation at unix~$1766708400$
(2025-12-25T16:20:00-08:00) is the single coordinated cut-over. Two
mitigations:
\begin{itemize}[leftmargin=*]
\item Pre-activation P/X blocks remain decodable through the
\texttt{v0} legacy decoder in
\texttt{node/vms/platformvm/block/v0/block.go}~--- this is the
\emph{only} retained legacy code path and it is read-only.
\item Post-activation, the canonical
\texttt{luxfi/genesis/configs/\{brand\}-\{net\}/genesis.json}
embeds the ZAP-native chain configuration at block 0 (memory
\texttt{canonical\_genesis\_only}). No RLP imports, no fallback.
\end{itemize}
\paragraph{External boundary regressions.}
Tier-4 surfaces (Stripe, Plivo, OpenAI, Binance) keep their vendor
wire. The risk is over-zealous ZAP-ification of an outbound edge,
breaking a third-party integration. Mitigation: the ZAP boundary
terminates at the last Hanzo-owned hop. Inside the gateway, internal
Hanzo$\to$Hanzo calls are ZAP-tunnelled; outbound to external vendors
keeps the vendor format.
\paragraph{Operational visibility.}
JSON-RPC traffic is grep-able in logs and tcpdump. ZAP frames are
opaque binary. Mitigation: the \texttt{luxfi/zap} package ships a
canonical \texttt{zap dump} decoder; gateway access logs include a
ZAP-frame summary line so on-call retains diagnostic parity. The
schema registry lives in-tree (one struct = one schema = one wire),
so frame interpretation is deterministic without out-of-band
schema fetch.
\paragraph{Tier-3 duplicate code.}
The \texttt{lux/proto/} subtree shadows \texttt{lux/protocol/} for 31
files. Both currently import \texttt{luxfi/codec}. The risk is that
migrating one and not the other leaves a half-migrated workspace.
Mitigation: \texttt{lux/proto/} is deleted as Phase~D, not migrated.
\paragraph{TS encoder version skew.}
\texttt{hanzo/zap-es} is published to npm and used by browser-side
clients (extension, chat UI). Wire schema bumps must update both
\texttt{luxfi/zap} (Go) and \texttt{zap-es} (TS) in lockstep.
Mitigation: \texttt{zap-es} bumps follow patch-only semver
(\texttt{1.x.y} only, per workspace rule); breaking changes require a
coordinated major bump that is currently blocked by the
``forwards-perfection only'' rule.
\section{Phased rollout summary}
\label{sec:rollout}
\begin{center}
\begin{tabular}{lll}
\toprule
\textbf{Phase} & \textbf{Surfaces} & \textbf{Dependency} \\
\midrule
A & utxo + protocol/p + protocol/x + node & none (LP-023 measured) \\
B & agent + mcp + jin tensor wire & none (parallel with A) \\
C & zen/gateway internal tunnels & none (independent) \\
D & delete lux/proto + verify zero codec imports & after A \\
\bottomrule
\end{tabular}
\end{center}
Phases A, B, and C can proceed in parallel; only Phase~D blocks on
Phase~A.
\section{Conclusion}
\label{sec:conclusion}
ZAP is the canonical wire for everything Hanzo, Lux, and Liquidity
\emph{own}. Five tiers classify every observed wire surface; Tier 5
(eighteen services) is already done, Tier 4 (three external boundaries)
is deliberately left alone, and Tier 1 (six urgent services) is the
focus of this paper. Measured ratios on adjacent already-migrated
surfaces project a $7.4$--$8.6\times$ compounded speedup and a
$24\times$ allocation reduction on the AI/ML/blockchain hot path. The
proposal does not introduce backwards-compat shims, does not require
re-architecting any service, and composes orthogonally on top of the
Quasar activation cutover already scheduled for unix~$1766708400$.
One wire format, one composition root per surface, one schema registry,
one canonical reference implementation. ZAP everywhere is not a
performance optimisation; it is a decomposition step that takes wire
heterogeneity off the maintenance budget and pays the cost back as
allocation, GC, and tail-latency reduction at every layer of the stack.