Files
papers/lp-201-zap-universal-wire/sections/inventory.tex

113 lines
4.9 KiB
TeX

% sections/inventory.tex -- Current state of ZAP coverage across the stack
\section{Wire-format inventory across the stack}
\label{sec:inventory}
We grep'd every Go, Rust, and TypeScript source root under
\texttt{\~{}/work/lux}, \texttt{\~{}/work/hanzo}, and
\texttt{\~{}/work/securities-l1} for three signals:
\begin{itemize}[leftmargin=*]
\item \texttt{luxfi/zap}~--- canonical ZAP imports (target)
\item \texttt{luxfi/codec}, \texttt{linearcodec}~--- legacy Lux wire (source)
\item \texttt{proto.Marshal}, \texttt{json.Marshal}, \texttt{msgpack},
\texttt{cbor}, \texttt{net/rpc}, \texttt{grpc.Dial}, \texttt{jsonrpc}
--- other wire formats still in use
\end{itemize}
\subsection{Methodology}
Probes ran via the agent harness Grep tool (ripgrep) over the working tree
excluding vendor directories and \texttt{*\_test.go}. Hit counts are
\emph{file counts}, not symbol counts; a file may contain many symbol
sites. Where a file appears under both source and target, it is classified
\emph{partial} and migration is in flight.
\subsection{Lux stack (15 hits)}
\begin{itemize}[leftmargin=*]
\item \textbf{ZAP-native and DONE} (Tier~5):
\texttt{lux/zap} (canonical reference), \texttt{lux/zapdb},
\texttt{lux/zap/conn\_pq.go} (ZAP-PQ-v1 handshake per
\texttt{docs/SPEC-ZAP-PQ-v1.md}~\cite{zappqspec}),
\texttt{lux/node/vms/evm/wire/results.go} \&
\texttt{results\_builder.go},
\texttt{lux/node/vms/proposervm/wire/*} (5 files),
\texttt{lux/node/vms/platformvm/warp/wire/*} (11 files),
\texttt{lux/utxo/wire/pq\_*} (3 PQ-output files),
\texttt{lux/chains/\{relay,quantum,oracle,key,identity,graph\}vm/wire/*}.
\item \textbf{Tier~1 hot-path, not yet ZAP-native:}
\texttt{lux/protocol/p}, \texttt{lux/protocol/x},
\texttt{lux/utxo} (non-PQ output families),
\texttt{lux/node/service/info},
\texttt{lux/node/vms/platformvm/txs/codec.go} (the
\texttt{codec.Manager} composition root, blocked on
\texttt{utxo} migration per
\texttt{node/FINAL\_CODEC\_RIP.md}~\cite{finalcodecrip}).
\item \textbf{Tier~3 legacy duplicates:} \texttt{lux/proto/p/*} and
\texttt{lux/proto/x/*}~--- 31 files mirroring \texttt{protocol/}.
These appear to be a stale snapshot and should be deleted, not
migrated.
\end{itemize}
\subsection{Hanzo stack}
\begin{itemize}[leftmargin=*]
\item \textbf{ZAP-native and DONE} (Tier~5):
\texttt{hanzo/datastore/cmd/zap-bridge} (MsgType~$302$,
HMAC-SHA256 framing),
\texttt{hanzo/kms} (9 files), \texttt{hanzo/gateway} (6 files),
\texttt{hanzo/iam/cmd/iam-v2} (5 files),
\texttt{hanzo/base/network/transport\_zap.go} +
\texttt{base/internal/zap/server.go} +
\texttt{base/plugins/zap/*}, and the TS encoder
\texttt{hanzo/zap-es} (npm-published).
\item \textbf{Tier~1 hot-path, ZERO ZAP coverage today:}
\texttt{hanzo/agent} (no \texttt{luxfi/zap} imports; $\sim$50
\texttt{net/rpc}, \texttt{jsonrpc}, \texttt{http.NewRequest},
\texttt{grpc.Dial} hits in \texttt{control-plane/internal});
\texttt{hanzo/mcp} (15 \texttt{jsonrpc} hits, no ZAP); and
\texttt{hanzo/jin} (tensor I/O via JSON / pickle / pt).
\item \textbf{Tier~4 boundary kept external:}
\texttt{hanzo/zen/gateway} outbound to OpenAI~/ Anthropic~/
Together~--- format owned by external vendors; internal
Hanzo$\to$Hanzo calls inside the gateway can still ZAP-tunnel.
\end{itemize}
\subsection{a regulated securities L1 stack (25 hits)}
\begin{itemize}[leftmargin=*]
\item \textbf{ZAP-native and DONE} (Tier~5):
\texttt{liquidity/ats} (writer\_zap.go, writer\_zapserver.go,
zap\_writer\_server.go, bd\_zap\_reader.go,
pkg/kmsclient/zap.go), \texttt{liquidity/bd},
\texttt{liquidity/operator/src/zapclient.rs} (Rust port, header
annotation ``Wire format (verbatim with luxfi/zap)''),
\texttt{liquidity/operator/src/kms\_controller.rs +
crd.rs}, and the link-level go.mod citations across
\texttt{evm}, \texttt{fhe}, \texttt{dex}, \texttt{aml},
\texttt{price}, \texttt{cli}, \texttt{pkg}.
\item \textbf{Tier~4 boundary kept external:} market-data feeds,
Alpaca OmniSub, Stripe, Plivo, Twilio.
\end{itemize}
\subsection{Headline numbers}
\begin{center}
\begin{tabular}{lr}
\toprule
\textbf{Classification} & \textbf{Distinct services} \\
\midrule
Tier 5 (DONE: ZAP-native today) & 18 \\
Tier 1 (URGENT: hot-path, non-ZAP) & 6 \\
Tier 2 (SCHEDULED: warm-path) & 4 \\
Tier 3 (OPPORTUNISTIC: cold-path or duplicate) & 3 \\
Tier 4 (DON'T migrate: external owns format) & 3 \\
\bottomrule
\end{tabular}
\end{center}
The full per-service inventory is in
\texttt{wire-inventory.csv}~\cite{wireinv}; \S\ref{sec:proposal}
maps each Tier~1 row to a migration plan and \S\ref{sec:bench}
projects the resulting bench delta.