Files
papers/lux-credit-protocol-spec/sections/03-canonical-bridge-message-schema.tex
zeekay abf99d05fc papers: reorganize into per-paper dirs, add Antje Worring as co-author
Restructured from flat .tex/.pdf files into per-paper subdirectories.
Added Antje Worring as co-author on all papers.
Synced PDFs to pdfs/ for download site.
2026-04-18 21:50:07 -07:00

74 lines
2.9 KiB
TeX

\section{Canonical Bridge Message Schema}
\label{sec:messages}
The message layer is frozen at this specification version. No additional message types may be introduced without a protocol upgrade.
\subsection{Message Types}
\begin{center}
\begin{tabular}{@{}ll@{}}
\toprule
\textbf{Type} & \textbf{Semantics} \\
\midrule
\texttt{DEPOSIT\_V1} & Lock base asset; mint credit on destination \\
\texttt{BURN\_V1} & Burn credit token on source chain \\
\texttt{RELEASE\_V1} & Release base asset on destination chain \\
\texttt{BACKING\_V1} & Backing attestation from vault oracle \\
\bottomrule
\end{tabular}
\end{center}
\subsection{Common Envelope}
Every message \textsc{must} include the following 13 fields:
\begin{center}
\small
\begin{tabular}{@{}lll@{}}
\toprule
\textbf{Field} & \textbf{Type} & \textbf{Description} \\
\midrule
\texttt{version} & \texttt{uint8} & Schema version \\
\texttt{messageType} & \texttt{uint8} & Enum (4 types) \\
\texttt{srcChainId} & \texttt{uint256} & Source chain \\
\texttt{dstChainId} & \texttt{uint256} & Destination chain \\
\texttt{routerAddress} & \texttt{address} & Sending router \\
\texttt{assetId} & \texttt{bytes32} & Canonical asset ID \\
\texttt{nonce} & \texttt{uint256} & Per-router sequence \\
\texttt{amount} & \texttt{uint256} & Transfer amount (wei) \\
\texttt{recipient} & \texttt{bytes32} & Destination address \\
\texttt{expiry} & \texttt{uint256} & Expiration timestamp \\
\texttt{originTxHash} & \texttt{bytes32} & Source event hash \\
\texttt{payloadHash} & \texttt{bytes32} & Typed payload hash \\
\texttt{domainSeparator} & \texttt{bytes32} & Deployment domain \\
\bottomrule
\end{tabular}
\end{center}
The \texttt{domainSeparator} is computed as:
\begin{equation}
\texttt{keccak256}\!\left(\texttt{abi.encode}\!\left(\mathcal{N},\; \mathcal{V},\; c,\; r\right)\right)
\end{equation}
where $\mathcal{N}$ is the protocol name, $\mathcal{V}$ the protocol version, $c$ the chain ID, and $r$ the router address. This closes five replay classes: chain replay, deployment replay, migration replay, same-signature context reuse, and duplicated source event processing.
\subsection{Receive-Path Verification}
\begin{requirement}[Minimum Verification Rules]
\label{req:verify}
Every receive path \textsc{must} verify all of the following before executing any state change:
\begin{enumerate}[nosep]
\item $\texttt{block.timestamp} \leq \texttt{expiry}$
\item $\texttt{dstChainId} = \texttt{block.chainid}$
\item $\texttt{routerAddress} = \texttt{address(this)}$
\item $\texttt{nonce}$ unused for $(\texttt{srcChainId},\, \texttt{routerAddress},\, \texttt{assetId})$
\item $\texttt{amount} > 0$
\item $\texttt{recipient} \neq 0$
\item $\texttt{assetId}$ recognized and enabled
\item Message hash signed by $\geq t$ of $n$ authorized signers
\end{enumerate}
\end{requirement}