Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chain-sync documentation #3594

Merged
merged 1 commit into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions docs/network-spec/miniprotocols.tex
Original file line number Diff line number Diff line change
Expand Up @@ -639,13 +639,20 @@ \subsection{State Machine}
\item [\MsgFindIntersect{} {\boldmath $\langle point_{head} \rangle $}]
Ask the producer to try to find an improved intersection point between
the consumer and producer's chains.
The consumer sends a sequence {\boldmath $\langle point \rangle $}
and it is up to the producer
to find the first intersection point on its chain and send it back to the consumer.
The consumer sends a sequence {\boldmath $\langle point \rangle $} which
shall be ordered by perference (e.g. points with highest slot number
first) and it is up to the producer to find the first intersection point
on its chain and send it back to the consumer. If an empty list of
points is send with \MsgFindIntersect{} the server will reply with
\MsgIntersectNotFound{}.
\item [\MsgIntersectFound{} {\boldmath $(point_{intersect} ,tip)$}]
The producer replies with the first point of the request that is on his current chain.
The consumer can decide whether to send more points.
The message also tells the consumer about the $tip$ of the producer.
Whenever the server replies with \MsgIntersectFound{} the client can
expect the next update (i.e. a replay to \MsgRequestNext{}) to be
\MsgRollBackward{} to the specified $point_{intersect}$ (which makes
handling state updates on the client side easier).
\item [\MsgIntersectNotFound{} {\boldmath $(tip)$}]
The reply to the consumer that no intersection was found: none of the
points the consumer supplied are on the producer chain.
Expand Down Expand Up @@ -803,6 +810,10 @@ \subsection{Implementation of the Chain Producer}
Maximum depth of a fork in Ouroboros is bounded and the intersection will always be found with a small number of
iterations of this algorithm.

\subparagraph{Additional remarks}
Note that by sending \MsgFindIntersect{} the server will not modify its
\readpointer{}.

\subsection{Implementation of the Chain Consumer}
In principle, the chain consumer has to guard against a malicious chain producer
as much as the other way around.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ instance Protocol (ChainSync header point tip) where
-- | Ask the producer to try to find an improved intersection point between
-- the consumer and producer's chains. The consumer sends a sequence of
-- points and it is up to the producer to find the first intersection point
-- on its chain and send it back to the consumer.
-- on its chain and send it back to the consumer. The list of points should
-- be ordered by the preference, e.g. highest slot number to lowest.
--
MsgFindIntersect :: [point]
-> Message (ChainSync header point tip)
Expand Down