Skip to content

Commit

Permalink
add information on GetMeasures to the network-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
fraser-iohk committed Jan 23, 2025
1 parent 13e39ad commit b893a99
Showing 1 changed file with 49 additions and 31 deletions.
80 changes: 49 additions & 31 deletions docs/network-spec/miniprotocols.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,10 @@ \section{Local Tx-Monitor mini-protocol}
\newcommand{\MsgGetSizes}{\msg{MsgGetSizes}}
\newcommand{\MsgReplyGetSizes}{\msg{MsgReplyGetSizes}}

\newcommand{\GetMeasures}{\state{GetMeasures}}
\newcommand{\MsgGetMeasures}{\msg{MsgGetMeasures}}
\newcommand{\MsgReplyGetMeasures}{\msg{MsgReplyGetMeasures}}

\subsection{Description}

A mini-protocol which allows to monitor transactions in the local mempool. This
Expand All @@ -1822,25 +1826,28 @@ \subsection{State machine}
\begin{figure}[h]
\begin{tikzpicture}[->,shorten >=1pt,auto,node distance=4cm, semithick]
\tikzstyle{every state}=[fill=red,draw=none,text=white]
\node[state, mygreen, initial] (Idle) {\StIdle};
\node[state, myblue, right of=Idle] (Acquiring) {\StAcquiring};
\node[state, mygreen, right of=Acquiring] (Acquired) {\StAcquired};
\node[state, myblue, right of=Acquired] (BusyHasTx) {\StBusy\ \HasTx};
\node[state, myblue, above of=BusyHasTx] (BusyNextTx) {\StBusy\ \NextTx};
\node[state, myblue, below of=BusyHasTx] (BusyGetSizes) {\StBusy\ \GetSizes};
\node[state, below of=Idle] (Done) {\StDone};

\draw (Idle) edge node{\MsgAcquire} (Acquiring);
\draw (Acquiring) edge[bend left=45] node{\MsgAcquired} (Acquired);
\draw (Acquired) edge[bend left=45] node{\MsgAwaitAcquire} (Acquiring);
\draw (Acquired) edge[bend left=45] node{\MsgRelease} (Idle);
\draw (Acquired) edge[bend left=20] node{\MsgNextTx} (BusyNextTx);
\draw (BusyNextTx) edge[bend left=20] node{\MsgReplyNextTx} (Acquired);
\draw (Acquired) edge[bend left=20] node{\MsgHasTx} (BusyHasTx);
\draw (BusyHasTx) edge[bend left=20] node{\MsgReplyHasTx} (Acquired);
\draw (Acquired) edge[bend left=20] node{\MsgGetSizes} (BusyGetSizes);
\draw (BusyGetSizes) edge[bend left=20] node{\MsgReplyGetSizes} (Acquired);
\draw (Idle) edge node{\MsgDone} (Done);
\node[state, mygreen, initial] (Idle) {\StIdle};
\node[state, myblue, right of=Idle] (Acquiring) {\StAcquiring};
\node[state, mygreen, right of=Acquiring] (Acquired) {\StAcquired};
\node[state, myblue, right of=Acquired] (BusyHasTx) {\StBusy\ \HasTx};
\node[state, myblue, above of=BusyHasTx] (BusyNextTx) {\StBusy\ \NextTx};
\node[state, myblue, below of=BusyHasTx] (BusyGetSizes) {\StBusy\ \GetSizes};
\node[state, myblue, below of=BusyHasTx] (BusyGetMeasures) {\StBusy\ \GetMeasures};
\node[state, below of=Idle] (Done) {\StDone};

\draw (Idle) edge node{\MsgAcquire} (Acquiring);
\draw (Acquiring) edge[bend left=45] node{\MsgAcquired} (Acquired);
\draw (Acquired) edge[bend left=45] node{\MsgAwaitAcquire} (Acquiring);
\draw (Acquired) edge[bend left=45] node{\MsgRelease} (Idle);
\draw (Acquired) edge[bend left=20] node{\MsgNextTx} (BusyNextTx);
\draw (BusyNextTx) edge[bend left=20] node{\MsgReplyNextTx} (Acquired);
\draw (Acquired) edge[bend left=20] node{\MsgHasTx} (BusyHasTx);
\draw (BusyHasTx) edge[bend left=20] node{\MsgReplyHasTx} (Acquired);
\draw (Acquired) edge[bend left=20] node{\MsgGetSizes} (BusyGetSizes);
\draw (Acquired) edge[bend left=20] node{\MsgGetMeasures} (BusyGetMeasures);
\draw (BusyGetSizes) edge[bend left=20] node{\MsgReplyGetSizes} (Acquired);
\draw (BusyGetMeasures) edge[bend left=20] node{\MsgReplyGetMeasures} (Acquired);
\draw (Idle) edge node{\MsgDone} (Done);
\end{tikzpicture}
\caption{State machine of the Local Tx-Monitor mini-protocol.}
\end{figure}
Expand Down Expand Up @@ -1890,22 +1897,33 @@ \subsection{State machine}
mempool;
\item[number of transactions] the number of transactions in the mempool.
\end{description}
\item[\MsgGetMeasures{}] The client asks the server for information on the mempool's measures.
\item[\MsgReplyGetMeasures{} (Word32, Map Text (Integer, Integer))] The server responds with
the total number of transactions currently in the mempool, and a map of the measures known to
the mempool. The keys of this map are textual labels of the measure names, which should
typically be considered stable for a given node version, and the values are a pair of integers
representing the current size and maximum capacity respectively for that measure. The maximum
capacity should not be considered fixed and is likely to change due to mempool conditions. The
size should always be less than or equal to the capacity.
\end{description}
\end{description}

\begin{figure}[h]
\begin{tabular}{l|l|l|l}
\header{from state} & \header{message} & \header{parameters} & \header{to state} \\ \hline
\StIdle & \MsgAcquire & & \StAcquiring \\
\StAcquiring & \MsgAcquired & SlotNo & \StAcquired \\
\StAcquired & \MsgAwaitAcquire & & \StAcquiring \\
\StAcquired & \MsgRelease & & \StIdle \\
\StAcquired & \MsgNextTx & & \StBusy\ \NextTx\\
\StBusy\ \NextTx & \MsgReplyNextTx & (\textbf{Nothing} | \textbf{Just} $tx$) & \StAcquired\\
\StAcquired & \MsgHasTx & & \StBusy\ \HasTx\\
\StBusy\ \HasTx & \MsgReplyNextTx & Bool & \StAcquired\\
\StAcquired & \MsgGetSizes & & \StBusy\ \GetSizes\\
\StBusy\ \GetSizes & \MsgReplyGetSizes & Word32,Word32,Word32 & \StAcquired\\
\StIdle & \MsgDone & & \StDone\\
\header{from state} & \header{message} & \header{parameters} & \header{to state} \\ \hline
\StIdle & \MsgAcquire & & \StAcquiring \\
\StAcquiring & \MsgAcquired & SlotNo & \StAcquired \\
\StAcquired & \MsgAwaitAcquire & & \StAcquiring \\
\StAcquired & \MsgRelease & & \StIdle \\
\StAcquired & \MsgNextTx & & \StBusy\ \NextTx\\
\StBusy\ \NextTx & \MsgReplyNextTx & (\textbf{Nothing} | \textbf{Just} $tx$) & \StAcquired\\
\StAcquired & \MsgHasTx & & \StBusy\ \HasTx\\
\StBusy\ \HasTx & \MsgReplyNextTx & Bool & \StAcquired\\
\StAcquired & \MsgGetSizes & & \StBusy\ \GetSizes\\
\StBusy\ \GetSizes & \MsgReplyGetSizes & Word32,Word32,Word32 & \StAcquired\\
\StAcquired & \MsgGetMeasures & & \StBusy\ \GetMeasures\\
\StBusy\ \GetMeasures & \MsgReplyMeasures & Word32,Map Text (Integer,Integer) & \StAcquired\\
\StIdle & \MsgDone & & \StDone\\
\end{tabular}
\caption{Local Transaction Monitor mini-protocol messages.}
\label{fig:ltxm-messages}
Expand Down

0 comments on commit b893a99

Please sign in to comment.