LeiosNotify
Mini-protocol number: 18
LeiosNotify is the mini-protocol responsible for announcing Endorser Blocks
(EBs) and offering EB bodies and their associated transaction closures to peers.
It is a pull-based protocol: the client drives progress by requesting the next
notification, and the server replies with whatever is available.
Leios introduces Endorser Blocks as a mechanism to endorse and achieve consensus
on transaction inclusion independently and overlayed on the Praos block chain.
LeiosNotify is the dissemination layer that lets peers discover new EBs before
fetching them via LeiosFetch. The protocol is
intended to run in a pipelined fashion where the client issues multiple
MsgRequestNext even before receiving a notification, so that the server can
push announcements to downstream peers with minimal latency.
Warning
TODO: Add more detail about admitted pipeline depth and other punishable requirements
State machine
graph LR classDef client color:black,fill:PaleGreen,stroke:DarkGreen; classDef server color:black,fill:PowderBlue,stroke:DarkBlue; linkStyle default stroke:gray StDone(((StDone))) i(( )) --> StIdle StIdle --MsgQuit--> StQuit StQuit --MsgDone--> StDone StIdle --MsgLeiosNotificationRequestNext--> StBusy StBusy --MsgLeiosBlockAnnouncement--> StIdle StBusy --MsgLeiosBlockOffer--> StIdle StBusy --MsgLeiosBlockTxsOffer--> StIdle StBusy --MsgLeiosVotes--> StIdle StBusy --MsgCanceled--> StIdle class StIdle client class StBusy server class StQuit server
Terminating
The client cannot simply stop. It only has agency in StIdle, and a request
leaves it in StBusy awaiting a reply the server may have no reason to send:
under light load there may be nothing to announce for a long while. A node
being demoted from hot to warm has a bounded time to shut the protocol down
cleanly, and losing that race costs the whole connection rather than just this
mini-protocol.
Two messages resolve that. MsgCanceled lets the server answer “nothing for
you” and hand agency back, so the client is never stranded in StBusy. And
MsgQuit lets the client declare it is leaving without first draining the
replies it has outstanding – it may be pipelining many requests, and waiting
for each in turn would make shutdown latency a function of pipeline depth. The
server closes with MsgDone, so termination is a two-step handshake rather
than a unilateral act by either side.
State agencies
| State | Agency |
|---|---|
| StIdle | Initiator |
| StBusy | Responder |
| StQuit | Responder |
State transitions
| From state | Message | Parameters | To state |
|---|---|---|---|
| StIdle | MsgQuit | StQuit | |
| StQuit | MsgDone | End | |
| StIdle | MsgLeiosNotificationRequestNext | StBusy | |
| StBusy | MsgLeiosBlockAnnouncement | announcement | StIdle |
| StBusy | MsgLeiosBlockOffer | point, eb_size | StIdle |
| StBusy | MsgLeiosBlockTxsOffer | point | StIdle |
| StBusy | MsgLeiosVotes | [1* vote] | StIdle |
| StBusy | MsgCanceled | StIdle |
Codecs
The messages depicted in the state machine follow this CDDL specification:
;; messages.cddl
; The messages of the LeiosNotify mini-protocol
;
; TODO Upstream this from ouroboros-consensus into cardano-blueprint and not
; only sync it using a GHA workflow
leiosNotifyMessage
= msgDone
/ msgQuit
/ msgCanceled
/ msgLeiosNotificationRequestNext
/ msgLeiosBlockAnnouncement
/ msgLeiosBlockOffer
/ msgLeiosBlockTxsOffer
/ msgLeiosVotes
msgDone = [0]
msgQuit = [1]
msgCanceled = [2]
msgLeiosNotificationRequestNext = [3]
msgLeiosBlockAnnouncement = [4, announcement]
msgLeiosBlockOffer = [5, point, eb_size]
msgLeiosBlockTxsOffer = [6, point]
msgLeiosVotes = [7, [1*16 vote]]
; the announcing ranking block's header, as ChainSync sends it
announcement = header.header
point = [slot, eb_hash]
slot = uint .size 8
eb_hash = bytes .size 32
eb_size = uint .size 4
vote =
[ announcing_rb_hash : bytes .size 32
, voter_id : uint .size 2
, vote_signature : bytes .size 48
]
;# import header as header
Note
See CIP-0164 for the rationale behind these messages.