Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

This page describes proposed changes that are not yet part of the Cardano mainnet. They are specified as part of Leios (CIP-0164), an extension to the Ouroboros consensus protocol aimed at significantly increasing transaction throughput. Details are subject to change.

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

StateAgency
StIdleInitiator
StBlockResponder
StBlockTxsResponder

State transitions

From stateMessageParametersTo state
StIdleMsgDoneEnd
StIdleMsgLeiosBlockRequestpointStBlock
StBlockMsgLeiosBlockendorser_blockStIdle
StIdleMsgLeiosBlockTxsRequestpoint, bitmapsStBlockTxs
StBlockTxsMsgLeiosBlockTxstx_listStIdle

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_block and bitmaps types remain underspecified pending further protocol design, including whether tx_list is 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 (MsgLeiosBlockRangeRequest and its replies). They were never implemented and are no longer planned, so they are not specified.