LeiosFetch
Mini-protocol number: 19
LeiosFetch is the mini-protocol responsible for fetching Endorser Blocks (EBs)
and their transaction payloads from peers. It is a pull-based protocol: the
client explicitly requests either a full EB or a subset of its transactions
(identified by a bitmap), and the server streams the response.
EBs are discovered via LeiosNotify; once a node
decides it wants a block or its transactions, it uses LeiosFetch to retrieve
the data.
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 --MsgDone--> StDone StIdle --MsgLeiosBlockRequest--> StBlock StBlock --MsgLeiosBlock--> StIdle StIdle --MsgLeiosBlockTxsRequest--> StBlockTxs StBlockTxs --MsgLeiosBlockTxs--> StIdle class StIdle client class StBlock,StBlockTxs server
State agencies
| State | Agency |
|---|---|
| StIdle | Initiator |
| StBlock | Responder |
| StBlockTxs | Responder |
State transitions
| From state | Message | Parameters | To state |
|---|---|---|---|
| StIdle | MsgDone | End | |
| StIdle | MsgLeiosBlockRequest | point | StBlock |
| StBlock | MsgLeiosBlock | endorser_block | StIdle |
| StIdle | MsgLeiosBlockTxsRequest | point, bitmaps | StBlockTxs |
| StBlockTxs | MsgLeiosBlockTxs | tx_list | StIdle |
Codecs
The messages depicted in the state machine follow this CDDL specification:
;; messages.cddl
; The messages of the LeiosFetch mini-protocol
;
; TODO Upstream this from ouroboros-consensus into cardano-blueprint and not
; only sync it using a GHA workflow
leiosFetchMessage
= msgDone
/ msgLeiosBlockRequest
/ msgLeiosBlock
/ msgLeiosBlockTxsRequest
/ msgLeiosBlockTxs
msgDone = [0]
msgLeiosBlockRequest = [1, point]
msgLeiosBlock = [2, endorser_block]
msgLeiosBlockTxsRequest = [3, point, bitmaps]
msgLeiosBlockTxs = [4, tx_list]
point = [base.slotno, eb_hash]
eb_hash = base.hash
; The endorser block as CBOR-in-CBOR to indicate what bytes are hashed and that
; servers may serve them without decoding. Was introduced with Dijkstra era and
; currently only one format exists. When the structure changes, fetch clients
; and other consensus components will know which era this is from; endorser
; blocks are not allowed to be used across era boundaries.
endorser_block = #6.24(bytes .cbor dijkstra.eb_references)
; Inspired by roaring bitmaps: 64-tx window index to 64-bit presence bitmaps
bitmaps = { * uint .size 2 => uint .size 8 }
tx_list = [ *tx ]
; Endorsed transactions as CBOR-in-CBOR to indicate that neither fetch clients
; nor servers will decode this. However, consensus components like leios voting
; logic or block adoption will need to decode these using the appropriate era.
; Currently only Dijkstra is supported.
tx = #6.24(bytes .cbor dijkstra.block_transaction)
;# include dijkstra as dijkstra
;# import base as base
Note
The
endorser_blockandbitmapstypes remain underspecified pending further protocol design, including whethertx_listis length-definite, and the bitmap-based transaction request (MsgLeiosBlockTxsRequest) may yet change as the roaring bitmap encoding is still under discussion.Catch-up oriented batch requests were once expected here (
MsgLeiosBlockRangeRequestand its replies). They were never implemented and are no longer planned, so they are not specified.