Skip to content

Commit

Permalink
Merge pull request #5089 from IntersectMBO/coot/cddl-list-and-maps
Browse files Browse the repository at this point in the history
CDDL: comment on definite and indefinite lists/maps
  • Loading branch information
dermetfan authored Mar 6, 2025
2 parents 0fdac49 + 4a125d6 commit 1b8c348
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions ouroboros-network-protocols/cddl/specs/common.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ block = any
header = any
tip = any
point = any
; The codec only accepts definite-length list.
points = [ *point ]
txId = any
tx = any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ msgRefuse = [2, refuseReason]
msgQueryReply = [3, versionTable]

; Entries must be sorted by version number. For testing, this is handled in `handshakeFix`.
; The codec only accepts definite-length maps.
versionTable = { * versionNumber => nodeToClientVersionData }


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ msgAcceptVersion = [1, versionNumber, nodeToNodeVersionData]
msgRefuse = [2, refuseReason]
msgQueryReply = [3, versionTable]

; The codec only accepts definite-length maps.
versionTable = { * versionNumber => nodeToNodeVersionData }

versionNumber = 14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ msgAcceptVersion = [1, versionNumber, nodeToNodeVersionData]
msgRefuse = [2, refuseReason]
msgQueryReply = [3, versionTable]

; The codec only accepts definite-length maps.
versionTable = { * versionNumber => nodeToNodeVersionData }

versionNumber = 11 / 12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ msgProposeVersions = [0, versionTable]
msgAcceptVersion = [1, versionNumber, nodeToNodeVersionData]
msgRefuse = [2, refuseReason]

; The codec only accepts definite-length maps.
versionTable = { * versionNumber => nodeToNodeVersionData }

versionNumber = 7 / 8 / 9 / 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ msgShareRequest = [0, byte]
msgSharePeers = [1, peerAddresses]
msgDone = [2]

peerAddresses = [* peerAddress]
; The codec accepts both indefinite-length and definite-length lists.
peerAddresses = [ *peerAddress ]

byte = 0..255

Expand Down
6 changes: 4 additions & 2 deletions ouroboros-network-protocols/cddl/specs/tx-submission2.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ txSubmission2Message

msgInit = [6]
msgRequestTxIds = [0, tsBlocking, txCount, txCount]
msgReplyTxIds = [1, [ *txIdAndSize] ]
msgReplyTxIds = [1, txIdsAndSizes ]
msgRequestTxs = [2, txIdList ]
msgReplyTxs = [3, txList ]
tsMsgDone = [4]

tsBlocking = false / true
txCount = word16
; The codec only accepts infinite-length list encoding for txIdList !
; The codec only accepts indefinite-length lists.
txIdList = [ *txId ]
txList = [ *tx ]
txIdAndSize = [txId, txSizeInBytes]
; The codec only accepts definite-length lists.
txIdsAndSizes = [ *txIdAndSize ]
txSizeInBytes = word32

0 comments on commit 1b8c348

Please sign in to comment.