mirror of
https://github.com/lux-apps/papers.git
synced 2026-10-30 18:15:21 +00:00
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.
52 lines
2.1 KiB
TeX
52 lines
2.1 KiB
TeX
\section{Protocol Overview}
|
|
\label{sec:overview}
|
|
|
|
\subsection{Phases}
|
|
|
|
State sync proceeds in four phases:
|
|
|
|
\begin{enumerate}
|
|
\item \textbf{Checkpoint selection}: The syncing node identifies a recent finalized block whose state root will be the sync target.
|
|
\item \textbf{Chunk discovery}: The node requests the trie's top-level structure to plan parallel downloads.
|
|
\item \textbf{Chunk download}: State chunks are downloaded from multiple peers in parallel, each verified independently.
|
|
\item \textbf{Completion}: The node verifies that all chunks assemble into the target state root and begins processing new blocks.
|
|
\end{enumerate}
|
|
|
|
\begin{algorithm}[H]
|
|
\caption{State Sync Main Loop}
|
|
\label{alg:main}
|
|
\begin{algorithmic}[1]
|
|
\Require Target state root $R$ from finalized block $B$
|
|
\State $\mathcal{C} \gets \mathsf{PlanChunks}(R)$ \Comment{Identify chunks}
|
|
\State $\mathsf{pending} \gets \mathcal{C}$; $\mathsf{completed} \gets \emptyset$
|
|
\While{$\mathsf{pending} \neq \emptyset$}
|
|
\For{each available peer $p$ \textbf{in parallel}}
|
|
\State $c \gets \mathsf{pending}.\mathsf{pop}()$
|
|
\State $(data, \pi) \gets \mathsf{RequestChunk}(p, c)$
|
|
\If{$\mathsf{VerifyChunk}(data, \pi, R)$}
|
|
\State $\mathsf{completed} \gets \mathsf{completed} \cup \{c\}$
|
|
\State Write $data$ to local database
|
|
\Else
|
|
\State $\mathsf{pending}.\mathsf{push}(c)$ \Comment{Retry from different peer}
|
|
\State Ban peer $p$
|
|
\EndIf
|
|
\EndFor
|
|
\EndWhile
|
|
\State Verify $\mathsf{ReconstructRoot}(\mathsf{completed}) = R$
|
|
\end{algorithmic}
|
|
\end{algorithm}
|
|
|
|
\subsection{Checkpoint Selection}
|
|
|
|
\begin{definition}[Sync Checkpoint]
|
|
A sync checkpoint is a block $B$ satisfying:
|
|
\begin{enumerate}
|
|
\item $B$ is finalized (accepted by consensus with $\geq 2/3$ stake).
|
|
\item $B$'s height is $\leq H_{\text{current}} - \Delta_{\text{safe}}$ where $\Delta_{\text{safe}} = 1000$ blocks.
|
|
\item $B$ is an epoch boundary block (height divisible by epoch length).
|
|
\end{enumerate}
|
|
\end{definition}
|
|
|
|
The safety margin $\Delta_{\text{safe}}$ ensures the state root is deeply finalized and unlikely to be reorganized.
|
|
|