Files
papers/lux-fhe-runtime/sections/02-fhe-go-reference-runtime.tex
zeekay ced35b03ed papers: Mar-3 freeze deliverables for hybrid PQ consensus stack
Quasar Horizon (consensus composition over Pulsar / ML-DSA / BLS lanes
under Prism + LSS lifecycle), Warp 2.0 (Pulse-backed cross-chain envelope
with forward-only v1->v2 migration and lattigo ReadUint64Slice DoS fix),
benchmark report (microbench, reshare, activation, Warp 2.0 verify, Prism
composition, GPU headroom, cross-WAN latency), and NIST IR 8214C-style
submission package (spec, parameter sets, domain separation, serialization,
reference-impl pointers, evaluation report, security analysis, side-channel
considerations).

All four deliverables compile cleanly via pdflatex+bibtex and reference
the canonical proof bucket files at proofs/{definitions,pulsar,lss,quasar}.
No duplication of proof bodies; cite by file path.
2026-03-03 12:00:00 -08:00

70 lines
2.8 KiB
TeX

\section{Lux FHE-Go: the reference runtime}
\label{sec:fhe-go-reference-runtime}
\texttt{github.com/luxfi/fhe} is the canonical Lux FHE implementation.
Its design priorities, in order, are: \emph{correctness}, \emph{readability},
\emph{protocol parity}, \emph{tests}, and \emph{wallet/daemon integration}.
GPU throughput is explicitly not a goal of the Go runtime; that is the
C++ runtime's job.
\subsection{Surface}
The package \texttt{fhe} exposes the canonical types
$\mathsf{Parameters}$, $\mathsf{SecretKey}$, $\mathsf{PublicKey}$,
$\mathsf{EvaluationKey}$, $\mathsf{Ciphertext}$, $\mathsf{Encryptor}$,
$\mathsf{Decryptor}$, $\mathsf{Evaluator}$, plus the named parameter sets
$\mathsf{PN10QP27}$, $\mathsf{PN11QP54}$, $\mathsf{PN9QP28\_STD128}$.
The companion paper \emph{lux-fhe-api} specifies the developer-facing
API in full; we reference rather than duplicate.
\subsection{Semantics}
A bit $b \in \{0, 1\}$ is encoded as $\pm q_{\mathrm{LWE}}/8$, NTT-applied,
and rlwe-encrypted (lattigo/lattice). Boolean gates are evaluated through
programmable bootstrapping: each non-XOR gate runs one blind-rotation
loop on the bootstrap key. XOR is linear in the LWE secret and noise-additive
without bootstrap. The full per-gate decoding rule is given in
\texttt{lux/fhe/evaluator.go} and matches the standard TFHE
construction (see Chillotti--Gama--Georgieva--Izabach\`ene).
\subsection{KAT generation}
The Go runtime owns KAT generation. Each KAT entry is a JSON record:
\begin{lstlisting}
{
"id": "<test-name>",
"param_set": "PN10QP27",
"seed": "<32 hex bytes>",
"operation": "<gate or higher-level op>",
"inputs": [...plaintext bits...],
"expected_ct": "<base64 ciphertext>",
"expected_decode": [...plaintext bits...]
}
\end{lstlisting}
The regen script (\texttt{lux/fhe/scripts/regen-kats.sh}) emits the
corpus to \texttt{luxcpp/crypto/fhe/test/kat/} and writes a SHA-256
manifest so the C++ side can verify byte-equality on replay. The
manifest format and \texttt{--verify} mode mirror the analogous scripts
in \texttt{lux/pulsar/scripts/}, \texttt{lux/lens/scripts/}, and
\texttt{lux/warp/scripts/}.
\subsection{Chain integration}
The Go runtime owns chain integration:
\begin{itemize}
\item the \texttt{fhed} daemon (HTTP API for encrypt/decrypt/evaluate
operations and threshold mode via mDNS);
\item Solidity contract glue (\texttt{@luxfi/contracts/contracts/fhe/});
\item EVM precompiles (LP-013 \S Encrypted EVM, exposed through the
C-Chain precompile registry);
\item wallet integrations (HD keying for FHE secret-key seeds).
\end{itemize}
The C++ runtime is, by design, headless. It does not expose RPC, does
not own a daemon, does not ship contracts. Its only callers are Go cgo
(via the C ABI in \texttt{c-abi/c\_lux\_fhe.cpp}) and Rust bindings
that need the GPU throughput.