Files
papers/lp-200-zap-stack/sections/03-decomplected-concerns.tex
zeekay 663cc83ca3 docs(papers): ZAP stack + cert profile modes + pitch decks (LP-186..300)
Companion LaTeX papers to luxfi/LPs:
- lp-200-zap-stack: full ZAP-as-substrate paper (10-layer model, deco-
  mplected concerns, performance).
- lp-200-lux-vs-avalanche-diff: code-translation appendix.
- lp-203-gpu-native-verify, lp-205-pipelined-quasar, lp-208-dag-mempool,
  lp-209-mysticeti-ordering, lp-210-block-stm, lp-211-cross-shard-atomic,
  lp-217-cert-profile-modes, lp-218-zap-p3q-pq-rollup,
  lp-220-p3q-corona-magnetar, lp-221-stark-fri-verifier,
  lp-300-schema-registry.

Pitch / outreach decks (luxcover.sty templated):
- blackrock-nahmii-pitch, corporate-dao-stack-analysis,
  nahmii-patent-acquisition, pq-patent-family-future-infringers,
  lux-substrate-platform-pitch, w3a-foundation-membership,
  multi-validator-scale, vfs-archive-cost-study.

Edits aligning to LP-217 / LP-200:
- lp-020-quasar-consensus 02-system-model + 08-performance.
- lp-073-pulsar 11-quasar.
- lp-103-omnichain-explorer 03-chain-support.
- lp-104-graph-engine.
- lp-201-zap-universal-wire/wire-inventory.csv.
- lp-306-lx-social-dex sections/02.
- lux-adoption-roadmap, lux-chain-architecture,
  lux-consensus-engines/08-composition, lux-crypto-agility,
  lux-evm-precompile-engineering/02, lux-fhe-smart-contracts/05,
  lux-quasar-composition/04+06+10, lux-reproducible-builds.
- INDEX.md cross-links the new papers.
2026-06-10 22:35:37 -07:00

86 lines
3.6 KiB
TeX

\section{Ten Decomplected Concerns}
Ten things that the legacy stack braided, unbraided here. Each is one
layer's job. Each layer reads bytes and writes bytes; nothing reaches
across.
\subsection{Wire $\leftrightarrow$ in-memory $\leftrightarrow$ on-disk}
Legacy: three Go structures -- wire DTO, runtime struct, storage row.
Every read parsed twice; every write encoded twice.
ZAP Stack: one buffer. Accessors are offset reads. \texttt{Bytes()}
returns the buffer. ZapDB stores the buffer as-is.
\subsection{Signature payload $\leftrightarrow$ transcript $\leftrightarrow$ wire}
Legacy: three marshal passes -- one for the signature payload, one
for the consensus transcript, one for the gossip envelope.
ZAP Stack: one byte stream feeds three orthogonal operations --
\texttt{sha256} for identity, \texttt{TupleHash256} over typed offsets
for the transcript, and \texttt{ecdsa(sha256(unsigned))} for the
signature.
\subsection{Tx envelope $\leftrightarrow$ kind dispatch $\leftrightarrow$ executor visitor}
Legacy: \texttt{tx.Visit(v UnsignedTxVisitor)} -- type-switch on Go
interface assertions in generated code.
ZAP Stack: \texttt{TxKind} is the first byte; executor is a
\texttt{map[TxKind]Handler}. Value-based dispatch on a buffer byte.
\subsection{Block $\leftrightarrow$ proposervm wrapper $\leftrightarrow$ chain-VM block bytes}
Legacy: proposervm wrapped every chain-VM block in its own envelope
with its own signature.
ZAP Stack: the proposer's signature is a leg of the QuasarCert, not a
separate envelope.
\subsection{Mempool $\leftrightarrow$ chain $\leftrightarrow$ network gossip}
Legacy: gossip wire, mempool struct, chain bytes -- three
representations.
ZAP Stack: the same buffer that arrives over the wire goes into the
mempool by reference, lands in a block by reference, and persists to
ZapDB by reference.
\subsection{Validator $\leftrightarrow$ delegator $\leftrightarrow$ L1-staker}
Legacy: three state tables with three marshalled structures and
three executor paths.
ZAP Stack: one ZAP wire format with a \texttt{StakerKind}
discriminator. One table. One executor path.
\subsection{P-chain $\leftrightarrow$ X-chain $\leftrightarrow$ EVM $\leftrightarrow$ chains-VM primitives}
Legacy: each VM had its own copy of \texttt{UTXO},
\texttt{OutputOwners}, \texttt{Credential}, \texttt{BaseTx}.
ZAP Stack: \texttt{luxfi/utxo/wire/} is the single source of truth.
P-chain (LP-023), X-chain (LP-184), EVM internal (LP-185), and the
chains-VM family (LP-186) all consume the same nine migrated fxs:
\texttt{secp256k1fx}, \texttt{nftfx}, \texttt{propertyfx},
\texttt{ed25519fx}, \texttt{mldsafx}, \texttt{slhdsafx},
\texttt{secp256r1fx}, \texttt{pqfx}, \texttt{vrffx}.
\subsection{Consensus transcript $\leftrightarrow$ wire envelope}
Legacy: separately marshalled transcript re-derived at every hop.
ZAP Stack: the transcript function reads typed fields directly from
the ZAP buffer.
\subsection{Codec.Manager $\leftrightarrow$ Sign $\leftrightarrow$ Verify}
Legacy: \texttt{codec.Manager} was a runtime registry of versioned
type-codec pairs; every Sign and Verify call paid a registry lookup
and a reflective marshal.
ZAP Stack: compile-time schemas declared in
\texttt{pkg/wire/zap/schemas.go}. Sign and Verify read offsets
directly. No runtime registry. No reflection. Versioning lives in the
schema kind byte.
\subsection{Genesis $\leftrightarrow$ block $\leftrightarrow$ state $\leftrightarrow$ gossip}
Legacy: four distinct codecs kept in sync by hand.
ZAP Stack: one wire codec across all of them. A genesis is a ZAP
buffer; a block is a ZAP buffer; a state row is a ZAP buffer; a
gossip message is a ZAP buffer. Same parser, same writer, same
identity function.