Skip to content
Open
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
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ index-state:
, hackage.haskell.org 2025-08-05T15:28:56Z

-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2025-03-18T17:41:11Z
, cardano-haskell-packages 2025-09-11T16:20:37Z

packages: ./cardano-ping
./monoidal-synchronisation
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Breaking

- Added `NodeToNodeV_16`.

### Non-Breaking

- Added `isPerasEnabled` predicate.
1 change: 1 addition & 0 deletions ouroboros-network-api/ouroboros-network-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ library
base >=4.14 && <4.22,
base16-bytestring,
bytestring >=0.10 && <0.13,
cardano-base,
cardano-binary,
cardano-slotting,
cardano-strict-containers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ module Ouroboros.Network.NodeToNode.Version
, ConnectionMode (..)
, nodeToNodeVersionCodec
, nodeToNodeCodecCBORTerm
-- * Feature predicates
, isPerasEnabled
) where

import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text (Text)
import Data.Text qualified as T

import Codec.CBOR.Term qualified as CBOR

import Cardano.Base.FeatureFlags
import Control.DeepSeq
import GHC.Generics
import NoThunks.Class (NoThunks)
Expand Down Expand Up @@ -71,16 +76,22 @@ data NodeToNodeVersion =
-- ^ Plomin HF, mandatory on mainnet as of 2025.01.29
| NodeToNodeV_15
-- ^ SRV support
| NodeToNodeV_16
-- ^ Experimental.
--
-- Adds Peras mini-protocols (if 'PerasFlag' is set).
deriving (Eq, Ord, Enum, Bounded, Show, Generic, NFData, NoThunks)

nodeToNodeVersionCodec :: CodecCBORTerm (Text, Maybe Int) NodeToNodeVersion
nodeToNodeVersionCodec = CodecCBORTerm { encodeTerm, decodeTerm }
where
encodeTerm NodeToNodeV_14 = CBOR.TInt 14
encodeTerm NodeToNodeV_15 = CBOR.TInt 15
encodeTerm NodeToNodeV_16 = CBOR.TInt 16

decodeTerm (CBOR.TInt 14) = Right NodeToNodeV_14
decodeTerm (CBOR.TInt 15) = Right NodeToNodeV_15
decodeTerm (CBOR.TInt 16) = Right NodeToNodeV_16
decodeTerm (CBOR.TInt n) = Left ( T.pack "decode NodeToNodeVersion: unknown tag: "
<> T.pack (show n)
, Just n
Expand Down Expand Up @@ -148,6 +159,7 @@ nodeToNodeCodecCBORTerm =
\case
NodeToNodeV_14 -> codec
NodeToNodeV_15 -> codec
NodeToNodeV_16 -> codec
where
codec = CodecCBORTerm { encodeTerm = encodeTerm, decodeTerm = decodeTerm }

Expand Down Expand Up @@ -190,3 +202,8 @@ nodeToNodeCodecCBORTerm =


data ConnectionMode = UnidirectionalMode | DuplexMode

isPerasEnabled :: Set CardanoFeatureFlag -> NodeToNodeVersion -> Bool
isPerasEnabled featureFlags v =
Set.member PerasFlag featureFlags
&& v >= NodeToNodeV_16
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ msgQueryReply = [3, versionTable]
; The codec only accepts definite-length maps.
versionTable = { * versionNumber_v14 => v14.nodeToNodeVersionData }

versionNumber_v14 = 14 / 15
versionNumber_v14 = 14 / 15 / 16

; All version numbers
versionNumbers = versionNumber_v14
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Non-Breaking

- Added ObjectDiffusion mini-protocol for Ouroboros Peras.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ library
Ouroboros.Network.Protocol.LocalTxSubmission.Codec
Ouroboros.Network.Protocol.LocalTxSubmission.Server
Ouroboros.Network.Protocol.LocalTxSubmission.Type
Ouroboros.Network.Protocol.ObjectDiffusion.Codec
Ouroboros.Network.Protocol.ObjectDiffusion.Inbound
Ouroboros.Network.Protocol.ObjectDiffusion.Outbound
Ouroboros.Network.Protocol.ObjectDiffusion.Type
Ouroboros.Network.Protocol.PeerSharing.Client
Ouroboros.Network.Protocol.PeerSharing.Codec
Ouroboros.Network.Protocol.PeerSharing.Server
Expand Down Expand Up @@ -161,6 +165,7 @@ library testlib
Ouroboros.Network.Protocol.LocalTxSubmission.Direct
Ouroboros.Network.Protocol.LocalTxSubmission.Examples
Ouroboros.Network.Protocol.LocalTxSubmission.Test
Ouroboros.Network.Protocol.ObjectDiffusion.Test
Ouroboros.Network.Protocol.PeerSharing.Codec.CDDL
Ouroboros.Network.Protocol.PeerSharing.Direct
Ouroboros.Network.Protocol.PeerSharing.Examples
Expand Down
Loading
Loading