mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
- Add high-level cosmic terminology: Nova (linear), Nebula (DAG), Quasar (P-Chain) - Implement internal optics engines: Ray (linear consensus), Field (DAG consensus) - Add Horizon ordering for Quasar event horizon finality - Integrate Corona + BLS fusion for post-quantum P-Chain security - Update Prism Cut interface with proper lux (lx) luminance measurements - Create comprehensive LaTeX white paper with BibTeX citations - Add missing mock packages for node compatibility - Maintain physics metaphors: photons, waves, cut, luminance, event horizons - Support modular consensus transitions: Nova→Nebula, classical→quantum
127 lines
7.3 KiB
TeX
127 lines
7.3 KiB
TeX
\section{Mathematical Analysis and Security Guarantees}
|
|
|
|
In this section, we analyze the security and performance of the Lux protocol, focusing on its probabilistic guarantees. We build on existing analyses of metastable consensus while highlighting the differences introduced by Lux's design.
|
|
|
|
\subsection{Safety Probability and Metastability}
|
|
|
|
We model each conflict set's consensus as a discrete-time stochastic process. Consider a binary conflict for simplicity (extension to multi-choice reduces to pairwise comparisons). Let the two values be $R$ (red) and $B$ (blue). Define $p_t$ as the fraction of honest nodes preferring blue at the start of round $t$.
|
|
|
|
During round $t$, each honest node samples $k$ peers. We assume $N$ is large and $k \ll N$ such that sampling is approximately independent across nodes. The adversary can coordinate to skew responses (worst case: all Byzantine nodes always vote for red).
|
|
|
|
We want to understand how $p_t$ evolves. Avalanche's analysis uses a mean-field approximation: if $p_t > 0.5$ (more honest nodes prefer blue), then with high probability $p_{t+1}$ will increase beyond $p_t$ (blue gains support). If $p_t < 0.5$, it will likely decrease. If $p_t = 0.5$, it's a critical point where only random fluctuations push it one way or the other.
|
|
|
|
This dynamic resembles a biased random walk with absorbing states at $p=0$ and $p=1$ (all nodes agree red or all agree blue). The protocol is designed such that these states are absorbing and stable.
|
|
|
|
\begin{theorem}[Safety Bound]
|
|
Given adversary fraction $f/N < 0.5$ and parameters $(k,\alpha,\beta)$, the probability of safety failure (two honest nodes deciding conflicting values) is bounded by:
|
|
$$\Pr[\text{safety failure}] \leq \epsilon$$
|
|
where $\epsilon$ can be made arbitrarily small by appropriate choice of $\beta$ and initial bias.
|
|
\end{theorem}
|
|
|
|
Specifically, if initially more than a fraction $\delta$ of nodes are honest and prefer blue (where $\delta$ relates to adversary fraction), then the probability the network ever decides red is approximately $\exp(-c \delta N)$ or $\exp(-c' \beta)$ for constants $c, c'$ depending on $k, \alpha$.
|
|
|
|
\subsection{Formal Safety Analysis}
|
|
|
|
Let $X_t$ be the number of honest nodes preferring blue at time $t$. The evolution of $X_t$ depends on the sampling outcomes. For large $N$, we can approximate the discrete process with a continuous one.
|
|
|
|
Define the \emph{bias} $b_t = (X_t - (N-f)/2)/((N-f)/2)$ as the normalized preference bias among honest nodes. The safety condition requires that once $|b_t|$ exceeds some threshold, the probability of sign change becomes negligible.
|
|
|
|
\begin{lemma}[Metastable Convergence]
|
|
If at some time $t^*$, the bias $|b_{t^*}| > \delta$ for some $\delta > 0$, then for all $t > t^*$:
|
|
$$\Pr[sign(b_t) \neq sign(b_{t^*})] \leq \exp(-c\delta^2 k (t-t^*))$$
|
|
for some constant $c > 0$ depending on $\alpha/k$.
|
|
\end{lemma}
|
|
|
|
This shows exponential decay in the probability of bias reversal, which is the core of metastability.
|
|
|
|
\subsection{Liveness and Termination}
|
|
|
|
Lux ensures liveness as long as the adversary fraction is bounded and the network eventually delivers messages.
|
|
|
|
\begin{theorem}[Probabilistic Liveness]
|
|
Under partial synchrony with $f < f_{max}$ Byzantine nodes, there exists a constant $c > 0$ such that:
|
|
$$\Pr[\text{decision within } T \text{ rounds}] \geq 1 - e^{-cT}$$
|
|
\end{theorem}
|
|
|
|
The intuition is that each round has some probability $\nu$ of breaking symmetry or confirming bias. The probability of not deciding after $T$ rounds drops as $(1-\nu)^T$.
|
|
|
|
For specific parameters, Avalanche showed that with $f < 0.5$, the system terminates with probability 1 and provides bounds on expected rounds $\sim O(\log N)$.
|
|
|
|
\subsection{Communication Complexity}
|
|
|
|
Each round, each node sends $k$ queries and receives $k$ responses. With $N$ nodes, total messages per round is $O(Nk) = O(N)$ since $k$ is constant with respect to $N$.
|
|
|
|
The number of rounds required is typically $O(\beta)$ where $\beta$ is the confidence threshold, though empirically convergence often happens faster.
|
|
|
|
\textbf{Total message complexity}: $O(N \cdot k \cdot \beta)$
|
|
|
|
For practical parameters ($N=1000$, $k=20$, $\beta=150$), this yields approximately 3 million message events, which is manageable with modern networks since each message is small (few bytes).
|
|
|
|
\subsection{Throughput Analysis}
|
|
|
|
\textbf{Nova throughput}: Limited by block production rate using the Ray engine. If we target 1 block per second with block size 2MB, this yields approximately 1000-2000 TPS depending on transaction size.
|
|
|
|
\textbf{Nebula throughput}: Not limited by sequential block production using the Field engine. Multiple transactions can be decided concurrently. The upper bound is typically network bandwidth and cryptographic verification. Avalanche tests achieved ~4500 TPS with 2000 nodes using DAG consensus.
|
|
|
|
\subsection{Security Against Specific Attacks}
|
|
|
|
\subsubsection{Byzantine Resilience}
|
|
|
|
Lux can tolerate up to approximately 50\% Byzantine nodes before safety guarantees degrade significantly. This graceful degradation is a key advantage over classical BFT protocols that fail abruptly at 33\% Byzantine nodes.
|
|
|
|
\begin{figure}[h]
|
|
\centering
|
|
\begin{tabular}{|c|c|c|}
|
|
\hline
|
|
Byzantine Fraction & Classical BFT & Lux Consensus \\
|
|
\hline
|
|
$< 0.33$ & Safe & Safe \\
|
|
$0.33 - 0.45$ & Unsafe & Degraded but functional \\
|
|
$> 0.45$ & Unsafe & Unsafe \\
|
|
\hline
|
|
\end{tabular}
|
|
\caption{Byzantine resilience comparison}
|
|
\end{figure}
|
|
|
|
\subsubsection{Network Partitions}
|
|
|
|
During network partitions, Lux may continue in each partition but could lead to divergent decisions. The Quasar checkpoint mechanism provides a recovery path: if a checkpoint was signed by nodes from both partitions before the split, neither side can finalize beyond that point without the unified signature.
|
|
|
|
\subsubsection{Quantum Attacks}
|
|
|
|
Without Quasar: A quantum attacker could break signatures and create confusion by impersonating nodes or faking votes.
|
|
|
|
With Quasar: Post-quantum signatures ensure that even with cryptographically relevant quantum computers, the consensus maintains integrity. Quasar checkpoints provide long-term finality that cannot be retroactively altered even if future majority shifts occur.
|
|
|
|
\subsection{Parameter Selection Guidelines}
|
|
|
|
Based on theoretical analysis and empirical testing, we recommend:
|
|
|
|
\begin{itemize}
|
|
\item \textbf{Sample size}: $k = 10-20$ for most deployments
|
|
\item \textbf{Threshold}: $\alpha = 0.8k$ (80\% supermajority)
|
|
\item \textbf{Confidence}: $\beta = 100-300$ depending on desired safety level
|
|
\item \textbf{Network assumption}: $f < 0.2N$ for optimal performance
|
|
\end{itemize}
|
|
|
|
These parameters provide safety failure probability $< 10^{-9}$ with sub-second average finality in benign conditions.
|
|
|
|
\subsection{Comparison with Existing Protocols}
|
|
|
|
\begin{table}[h]
|
|
\centering
|
|
\begin{tabular}{|l|c|c|c|c|}
|
|
\hline
|
|
Protocol & Communication & Finality & Byzantine Limit & Scalability \\
|
|
\hline
|
|
PBFT & $O(N^2)$ & Deterministic & $f < N/3$ & Poor \\
|
|
Tendermint & $O(N^2)$ & Deterministic & $f < N/3$ & Poor \\
|
|
Bitcoin & $O(N)$ & Probabilistic & $f < N/2$ & Moderate \\
|
|
Avalanche & $O(N \log N)$ & Probabilistic & $f < N/2$ & Good \\
|
|
Lux & $O(N \log N)$ & Probabilistic & $f < N/2$ & Good \\
|
|
\hline
|
|
\end{tabular}
|
|
\caption{Consensus protocol comparison}
|
|
\end{table}
|
|
|
|
Lux achieves similar complexity and security guarantees as Avalanche while providing enhanced modularity and post-quantum readiness through Quasar. |