Skip to content

Commit df5d962

Browse files
committed
simulation: network-spec: catchup
1 parent 8edbcbc commit df5d962

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

simulation/docs/network-spec/miniprotocols.tex

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,8 @@ \subsection{State machine}
179179
\StInit & \MsgInit & & \StIdle \\
180180
\StIdle & \MsgRequestIdsB & $\ack{}$,$\req{}$ & \StIdsBlocking \\
181181
\StIdsBlocking & \MsgReplyIds & $\langle (\id{}, \info{}) \rangle$ & \StIdle \\
182-
\StIdsBlocking & \MsgReplyIdsAndAnns & $\langle (\id{}, \info{}) \rangle$,$\langle (\id{}, \ann{}) \rangle$ & \StIdle \\
183182
\StIdle & \MsgRequestIdsNB & $\ack{}$,$\req{}$ & \StIdsNonBlocking \\
184183
\StIdsNonBlocking & \MsgReplyIds & $\langle (\id{}, \info{}) \rangle$ & \StIdle \\
185-
\StIdsNonBlocking & \MsgReplyIdsAndAnns & $\langle (\id{}, \info{}) \rangle$,$\langle (\id{}, \ann{}) \rangle$ & \StIdle \\
186184
\StIdle & \MsgRequestData & $\langle \id{} \rangle$ & \StData \\
187185
\StData & \MsgReplyData & $\langle \datum{} \rangle$ & \StIdle \\
188186
\StIdsBlocking & \MsgDone & & \StDone \\
@@ -304,27 +302,31 @@ \section{\fetch{} mini-protocol}
304302
\newcommand{\point}{\text{point}}
305303
\newcommand{\slot}{\text{slot}}
306304
\newcommand{\body}{\text{body}}
307-
305+
\newcommand{\request}{\text{request}}
306+
\newcommand{\hash}{\text{hash}}
307+
\newcommand{\rbrange}{\text{range}}
308308
\subsection{Description}
309309

310-
The \fetch{} mini protocol enables a node to download block bodies identified by a pair of slot and block id (i.e. hash). It is intended for on-the-fly block diffusion, complementing the \relay{} mini protocol.
311-
312-
It is a minor variation of the Block Fetch mini protocol used for
313-
Praos blocks: IBs and EBs do not have a notion of range, so they are
310+
The \fetch{} mini protocol enables a node to download block bodies.
311+
It is a generalization of the BlockFetch mini protocol used for
312+
base blocks: IBs and EBs do not have a notion of range, so they are
314313
requested by individual identifiers.
314+
\todo{Generalizing from BlockFetch means we deliver bodies in a streaming fashion, is that appropriate for IBs and EBs?}
315315

316316
\paragraph{Parameters} A \fetch{} instance is specified by these parameters
317317
\begin{description}
318-
\item [\id{}] Identifier for a body to fetch.
318+
\item [\request{}] request format for a sequence of blocks.
319319
\item [\body{}] Block body itself.
320320
\end{description}
321321

322-
\paragraph{Instances} \fetch{} instances are listed in Table~{table:fetch-instances}. The \body{} descriptions included here are for illustration, in particular to clarify what we mean by \body{} of an Endorse block.
322+
\paragraph{Instances} \fetch{} instances are listed in Table~{table:fetch-instances}. The \body{} descriptions included here are for illustration, in particular to clarify what we mean by \body{} of an Endorse block. A \point{} is a pair of \slot{} and \hash{}, the \slot{} allows for better indexing. A \rbrange{} is a pair of two of $\point{} \mid \text{origin}$.
323+
The IB-fetch and EB-fetch instances are intended for on-the-fly block diffusion, complementing the corresponding \relay{} mini protocols.
323324
\begin{table}[h!]
324325
\begin{tabular}{l l l l l l l l}
325-
\header{instance} & \header{\id{}} & \header{\body{}} \\\hline
326-
IB-fetch & hash & $[\text{Tx}]$ \\
327-
EB-fetch & hash & $([\text{IBRef}],[\text{EBRef}])$\\
326+
\header{instance} & \header{\request{}} & \header{\body{}} \\\hline
327+
IB-fetch & $[\point{}]$ & $[\text{Tx}]$ \\
328+
EB-fetch & $[\point{}]$ & $([\text{IBRef}],[\text{EBRef}])$\\
329+
BlockFetch & $\rbrange{}$ & $\text{RB body}$\\
328330
\end{tabular}
329331
\caption{\fetch{} mini-protocol instances.}
330332
\label{table:fetch-instances}
@@ -363,16 +365,13 @@ \subsection{State machine}
363365
\end{figure}
364366

365367
\paragraph{Protocol messages}
366-
Let \point be a pair $(\slot{},\id)$.
367368
\begin{description}
368-
\item [\MsgRequestBodies{} {\boldmath $[\point{}]$}]
369+
\item [\MsgRequestBodies{} {\boldmath $\request{}$}]
369370
The consumer requests a sequence of bodies from the producer.
370-
\todo{If we keep the streaming setup, we could abstract from $[\point{}]$ to a \emph{sequence} parameter, allowing the original Block Fetch as an instance.}
371371
\item [\MsgNoBlocks]
372372
The producer tells the consumer that it does not have all of the blocks in the requested sequence.
373373
\item [\MsgStartBatch]
374374
The producer starts body streaming.
375-
\todo{Does a streaming setup still makes sense, or should we drop it in favor of pipelining?}
376375
\item [\MsgBody{} {\boldmath $(\body{})$}]
377376
Stream a single block's body.
378377
\item [\MsgBatchDone]
@@ -388,7 +387,7 @@ \subsection{State machine}
388387
\begin{tabular}{l|l|l|l}
389388
\header{from state} & \header{message} & \header{parameters} & \header{to state} \\\hline
390389
\StIdle & \MsgConsumerDone & & \StDone \\
391-
\StIdle & \MsgRequestBodies & $[\point{}]$ & \StBusy \\
390+
\StIdle & \MsgRequestBodies & $\request{}$ & \StBusy \\
392391
\StBusy & \MsgNoBlocks & & \StIdle \\
393392
\StBusy & \MsgStartBatch & & \StStreaming \\
394393
\StStreaming & \MsgBody & $\body{}$ & \StStreaming \\
@@ -459,20 +458,31 @@ \subsection{Description}
459458

460459
\paragraph{Requests}
461460
\begin{description}
462-
\item[EBs by RB range] given an RB range from its chain, the producer
461+
\item[EBs by RB \rbrange{}] given an RB \rbrange{} from its chain, the producer
463462
should reply with all EBs which are (i) transitively referenced by RBs in that
464463
range, (ii) not referenced by earlier RBs.
465-
\item[Recent certified EBs by slot range] given a slot range, the
464+
\item[Recent certified EBs by \slot{} range] given a slot range, the
466465
producer should reply with all certified EBs which are (i) generated
467466
in the slot range, (ii) not referenced by RBs\footnote{Restriction
468467
(ii) is to avoid overlap with an RB range query, but could be dropped to save on complexity if not worth the saved bandwidth}. The start of the
469468
slot range should be no earlier than the oldest slot an EB could be
470469
generated in and still referenced in a future RB.
471-
\item[IBs by EB \point{} and slot range] given a \point{} for a
470+
\item[IBs by EB \point{}, and \slot{} range] given a \point{} for a
472471
certified EB, the producer should reply with all the IBs which are (i)
473472
generated in the given slot range, (ii) directly referenced by
474473
the EB. The slot range allows for partitioning request about the
475474
same EB across different peers.
476475
\end{description}
477476
\todo{Another option for IBs could be a list of refs and a slot range. The refs come from EB bodies, and the slot range can be calculated from the slot of the EB.}
478-
\todo{The protocol itself could be another variation of \fetch{} where requests are one of the above, and replies contain full blocks rather than just bodies.}
477+
478+
\paragraph{Definition} The \catchup{} protocol is defined as a new instance of the \fetch{} protocol. We give the parameters as a grammar
479+
\[
480+
\begin{array}{l c l l}
481+
\request{}_{\catchup{}} & ::= & \text{ebs-by-rb-range}(\rbrange{})\\
482+
& \mid & \text{ebs-by-slot-range}(\slot{},\slot{})\\
483+
& \mid & \text{ibs-by-eb-and-slot-range}(\point{},(\slot{},\slot{}))\\
484+
\body{}_{\catchup{}} & ::= & \text{ib-block}(\text{ib-header},\text{ib-body}) \\
485+
& \mid & \text{eb-block}(\text{eb-header}, \text{eb-body})\\
486+
\end{array}
487+
\]
488+
alternatively there could be separate protocols for IB and EB \catchup{}, so that there cannot be a format mismatch between requests and replies.

0 commit comments

Comments
 (0)