Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

$$ \newcommand \PSfunction {\textbf{function }} \newcommand \PSreturn {\textbf{return }} \newcommand \PSendfunction {\textbf{end function}} \newcommand \PSswitch {\textbf{switch }} \newcommand \PScase {\textbf{case }} \newcommand \PSdefault {\textbf{default}} \newcommand \PSendswitch {\textbf{end switch}} \newcommand \PSfor {\textbf{for }} \newcommand \PSendfor {\textbf{end for}} \newcommand \PSwhile {\textbf{while }} \newcommand \PSendwhile {\textbf{end while}} \newcommand \PSdo {\textbf{ do}} \newcommand \PSif {\textbf{if }} \newcommand \PSelseif {\textbf{else if }} \newcommand \PSelse {\textbf{else}} \newcommand \PSthen {\textbf{ then}} \newcommand \PSendif {\textbf{end if}} \newcommand \PSnot {\textbf{not }} \newcommand \PScomment {\qquad \small \textsf} $$

$$ \newcommand \Bundle {\mathrm{Bundle}} \newcommand \HandleBundle {\mathrm{HandleBundle}} \newcommand \VerifyBundle {\mathrm{VerifyBundle}} \newcommand \HandleVote {\mathrm{HandleVote}} \newcommand \SenderPeer {\mathrm{SenderPeer}} \newcommand \DisconnectFromPeer {\mathrm{DisconnectFromPeer}} \newcommand \vt {\mathit{vote}} \newcommand \b {\mathit{bundle}} $$

Bundle Handler

The node runs a bundle handler when receiving a message with a full bundle.

Algorithm


\( \textbf{Algorithm 6} \text{: Handle Bundle} \)

$$ \begin{aligned} &\text{1: } \PSfunction \HandleBundle(\b): \\ &\text{2: } \quad \PSif \PSnot \VerifyBundle(\b) \PSthen \\ &\text{3: } \quad \quad \DisconnectFromPeer(\SenderPeer(\b)) \\ &\text{4: } \quad \quad \PSreturn \\ &\text{5: } \quad \PSendif \\ &\text{6: } \quad \PSif \b_r = r \land \b_p + 1 \ge p \PSthen \\ &\text{7: } \quad \quad \PSfor \vt \in \b \PSdo \\ &\text{8: } \quad \quad \quad \HandleVote(\vt) \\ &\text{9: } \quad \quad \PSendfor \\ &\text{10:} \quad \PSendif \\ &\text{11: } \PSendfunction \end{aligned} $$


⚙️ IMPLEMENTATION

Bundle verification reference implementation.

Bundle handling in general message handler.

The bundle handler is invoked whenever a bundle message is received.

The received bundle is immediately discarded if it is invalid (Line 2). The node may penalize the malicious sending peer (e.g., disconnecting from or “blacklisting” it).

If the received bundle (Line 6):

  • Is for round equal to the node’s current round, and
  • Is for at most one period behind the node’s current period.

Then the bundle is processed, calling the vote handler for each vote in the bundle (Lines 7 and 8).

Note that multiple bundles can be processed concurrently. Therefore, while handling votes from a bundle \( b \) for proposal-value \( v \) separately, if another bundle \( \b\prime = \Bundle(\b_r, \b_p, \b_s, v\prime) \) is formed and observed first (with \( v\prime \) not necessarily equal to \( v \)1), votes in \( \b\prime \) are relayed individually, and any output or state changes caused by observing \( \b\prime \) is produced.

All leftover votes in \( b \) are then processed according to the new node state determined by \( \b\prime \) observation (e.g., votes are discarded if the executing step was certification and a new round has started, and so \( b_r < r \)).

If \( \b \) does not pass the previous check (Line 6), then no output is produced, and the bundle is ignored and discarded.



  1. Consider what would happen if equivocation votes contained in \( b \) cause a bundle for \( v\prime \) to reach the required threshold before the player may finish observing every single vote in \( b \).