je rajoute un mecanisme de detection d'equivocation

This commit is contained in:
Amaury JOLY
2026-02-23 15:01:43 +01:00
parent cc22c9d7f3
commit 8f51a7eed6
2 changed files with 32 additions and 18 deletions

View File

@@ -181,9 +181,11 @@ Each process $p_i$ maintains the following local variables:
$\received \gets \emptyset$\; $\received \gets \emptyset$\;
$\delivered \gets \emptyset$\; $\delivered \gets \emptyset$\;
$\prop[r][j] \gets \bot, \forall r, j$\; $\prop[r][j] \gets \bot, \forall r, j$\;
$W[r] \gets \bot, \forall r$\; $W[r] \gets \bot, \forall r$; this is the set of the winners for the round $r$\\
$B[r] \gets \bot, \forall r$; this is the set of processes who have bahaved maliciously for round $r$\\
$\resolved[r] \gets \bot, \forall r$\; $\resolved[r] \gets \bot, \forall r$\;
$Y[j]$ a Set of $n$ $\BFTDL$\; $Y$ a $\BFTDL$ such that the value space is $\mathcal{R} \times \Pi$\;
$V$ a $\BFTDL$ such that the value space is $(\mathcal{R} \times \mathcal{M} \times \Pi)$\;
\end{algorithm} \end{algorithm}
\LinesNumbered \LinesNumbered
@@ -203,59 +205,71 @@ Each process $p_i$ maintains the following local variables:
% \Statex \textbf{Proposer Job} % \Statex \textbf{Proposer Job}
\Fn{Propose($\bot$)}{ \Fn{Propose($\bot$)}{
$r \gets \texttt{last\_commited}$\; $r \gets \texttt{last\_commited}$\;
\While{$S \neq \emptyset$ with $S \gets \received \setminus (\delivered \cup (\bigcup_{r' < r} \bigcup_{j \in W[r']} \prop[r'][j]))$}{ \While{$S \neq \emptyset$ with $S \gets \received \setminus (\delivered \cup (\bigcup_{r' < r} \bigcup_{\substack{(j,S')\in W[r']\\ j\notin B[r']\\ S' \in \prop[r'][j]}} S'))$}{
% \Comment{PROP PHASE}\; % \Comment{PROP PHASE}\;
\tcc*[f]{PROP PHASE}\\ \tcc*[f]{PROP PHASE}\\
$\RBcast(i, \texttt{PROP}, S, \current)$\; $V.\BFTPROVE((r, S, i))$\;
\textbf{wait} until $|\{j: |\{k: (k, \PROVEtrace(r)) \in Y[j].\BFTREAD()\}| \geq t+1\}| \geq n - f$\; $\RBcast(i, \texttt{PROP}, S, r)$\;
\textbf{wait} until $|\{j: \exists S, |\{k: (k,(r, S, j)) \in V.\BFTREAD()\}| \geq t+1\}| \geq n - t$\;
% \Comment{COMMIT PHASE} % \Comment{COMMIT PHASE}
\tcc*[f]{COMMIT PHASE}\\ \tcc*[f]{COMMIT PHASE}\\
\textbf{for each} $j \in \Pi$ \textbf{do} $Y[j].\BFTAPPEND(r)$ \For{\textbf{each} $j \in \Pi$}{
% $Y[j].\BFTAPPEND(r)$\;
$V.\BFTAPPEND((r, S, j))$\;
$Y.\BFTAPPEND((r, j))$\;
}
$\RBcast(i, \texttt{COMMIT}, r)$\; $\RBcast(i, \texttt{COMMIT}, r)$\;
\textbf{wait} until $|\resolved[r]| \geq n - f$\; \textbf{wait} until $|\resolved[r]| \geq n - t$\;
% \Comment*{X PHASE} % \Comment*{X PHASE}
\tcc*[f]{X PHASE}\\ % \tcc*[f]{X PHASE}\\
$W[r] \gets \{j: |\{k: (k, \PROVEtrace(r)) \in Y[j].\BFTREAD()\}| \geq t+1\}$\; \BlankLine
$W[r] \gets \{(j, S): |\{k: (k, (r, S, j)) \in V.\BFTREAD()\}| \geq t+1\}$\;
$B[r] \gets \{j: |\{k: (k, (r, j)) \in Y.\BFTREAD()\}| \geq t+1\}$\;
$r \gets r + 1$\; $r \gets r + 1$\;
} }
$\texttt{last\_commited} \gets r$\; $\texttt{last\_commited} \gets r$\;
} }
\end{algorithm} \end{algorithm}
% \renewcommand{\algletter}{C}
\begin{algorithm}[H] \begin{algorithm}[H]
\caption{$\ABdeliver()$ at process $p_i$}\label{alg:deliver-bft} \caption{$\ABdeliver()$ at process $p_i$}\label{alg:deliver-bft}
\SetAlgoLined \SetAlgoLined
\Fn{ADeliver($\bot$)}{ \Fn{ADeliver($\bot$)}{
$r \gets \texttt{last\_delivered}$\; $r \gets \texttt{last\_delivered}$\;
\If{$|\resolved[r]| < n - f$}{ \If{$|\resolved[r]| < n - t$}{
\Return{$\bot$} \Return{$\bot$}
} }
$W[r] \gets \{j: |\{k: (k, \PROVEtrace(r)) \in Y[j].\BFTREAD()\}| \geq t+1\}$\; $W \gets \{(j, S): |\{k: (k, (r, S, j)) \in V.\BFTREAD()\}| \geq t+1\}$\;
\If{$\exists j \in W[r],\ \prop[r][j] = \bot$}{ $B \gets \{j: |\{k: (k, (r, j)) \in Y.\BFTREAD()\}| \geq t+1\}$\;
\If{$\exists (j, S) \in W, j \notin B, S \notin \prop[r][j]$}{
\Return{$\bot$} \Return{$\bot$}
} }
$M \gets \bigcup_{j \in W[r]} \prop[r][j]$\;\nllabel{code:Mcompute} \BlankLine
$M \gets \bigcup_{\substack{(j,S)\in W\\ j\notin B\\ S \in prop[r][j]}} S$\;\nllabel{code:Mcompute}
$m \gets \ordered(M \setminus \delivered)[0]$\; $m \gets \ordered(M \setminus \delivered)[0]$\;
% \Comment*{Set $m$ as the smaller message not already delivered} % \Comment*{Set $m$ as the smaller message not already delivered}
$\delivered \leftarrow \delivered \cup \{m\}$\; $\delivered \leftarrow \delivered \cup \{m\}$\;
\If{$M \setminus \delivered = \emptyset$}{ \If{$M \setminus \delivered = \emptyset$}{
$\texttt{last\_delivered} \gets \texttt{last\_delivered} + 1$\; $\texttt{last\_delivered} \gets \texttt{last\_delivered} + 1$\;
} }
% \Comment*{Check if all messages from round $r$ have been delivered} % \Comment*{Check if all messages from round $r$ have been delivered}
\Return{$m$} \Return{$m$}
} }
\end{algorithm} \end{algorithm}
% \renewcommand{\algletter}{D}
\begin{algorithm}[H] \begin{algorithm}[H]
\caption{RB handler at process $p_i$}\label{alg:rb-handler-bft} \caption{RB handler at process $p_i$}\label{alg:rb-handler-bft}
\SetAlgoLined \SetAlgoLined
\Upon{$Rdeliver(j, \texttt{PROP}, S, r)$}{ \Upon{$Rdeliver(j, \texttt{PROP}, S, r)$}{
$\received \gets \received \cup \{S\}$\; $\received \gets \received \cup \{S\}$\;
$\prop[r][j] \gets S$\; \uIf{$\prop[r][j] = \bot \vee (\{S' : (j, (r, S', j)) \in V.\BFTREAD()\} = \{S\})$}{
$Y[j].\BFTPROVE(r)$\; $V.\BFTPROVE((r, S, j))$\;
}
\Else{
$Y.\BFTPROVE((r, j))$\;
}
$\prop[r][j] \gets \prop[r][j] \cup S$\;
Propose()\; Propose()\;
} }

Binary file not shown.