{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Ouroboros.Consensus.Byron.Ledger.NetworkProtocolVersion (
ByronNodeToClientVersion (..)
, ByronNodeToNodeVersion (..)
) where
import qualified Data.Map.Strict as Map
import Ouroboros.Consensus.Node.NetworkProtocolVersion
import Ouroboros.Consensus.Byron.Ledger.Block
data ByronNodeToNodeVersion =
ByronNodeToNodeVersion1
| ByronNodeToNodeVersion2
deriving (Int -> ByronNodeToNodeVersion -> ShowS
[ByronNodeToNodeVersion] -> ShowS
ByronNodeToNodeVersion -> String
(Int -> ByronNodeToNodeVersion -> ShowS)
-> (ByronNodeToNodeVersion -> String)
-> ([ByronNodeToNodeVersion] -> ShowS)
-> Show ByronNodeToNodeVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ByronNodeToNodeVersion] -> ShowS
$cshowList :: [ByronNodeToNodeVersion] -> ShowS
show :: ByronNodeToNodeVersion -> String
$cshow :: ByronNodeToNodeVersion -> String
showsPrec :: Int -> ByronNodeToNodeVersion -> ShowS
$cshowsPrec :: Int -> ByronNodeToNodeVersion -> ShowS
Show, ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
(ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool)
-> (ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool)
-> Eq ByronNodeToNodeVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
$c/= :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
== :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
$c== :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
Eq, Eq ByronNodeToNodeVersion
Eq ByronNodeToNodeVersion
-> (ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Ordering)
-> (ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool)
-> (ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool)
-> (ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool)
-> (ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool)
-> (ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> ByronNodeToNodeVersion)
-> (ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> ByronNodeToNodeVersion)
-> Ord ByronNodeToNodeVersion
ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Ordering
ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> ByronNodeToNodeVersion
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> ByronNodeToNodeVersion
$cmin :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> ByronNodeToNodeVersion
max :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> ByronNodeToNodeVersion
$cmax :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> ByronNodeToNodeVersion
>= :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
$c>= :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
> :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
$c> :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
<= :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
$c<= :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
< :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
$c< :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Bool
compare :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Ordering
$ccompare :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion -> Ordering
$cp1Ord :: Eq ByronNodeToNodeVersion
Ord, Int -> ByronNodeToNodeVersion
ByronNodeToNodeVersion -> Int
ByronNodeToNodeVersion -> [ByronNodeToNodeVersion]
ByronNodeToNodeVersion -> ByronNodeToNodeVersion
ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> [ByronNodeToNodeVersion]
ByronNodeToNodeVersion
-> ByronNodeToNodeVersion
-> ByronNodeToNodeVersion
-> [ByronNodeToNodeVersion]
(ByronNodeToNodeVersion -> ByronNodeToNodeVersion)
-> (ByronNodeToNodeVersion -> ByronNodeToNodeVersion)
-> (Int -> ByronNodeToNodeVersion)
-> (ByronNodeToNodeVersion -> Int)
-> (ByronNodeToNodeVersion -> [ByronNodeToNodeVersion])
-> (ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> [ByronNodeToNodeVersion])
-> (ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> [ByronNodeToNodeVersion])
-> (ByronNodeToNodeVersion
-> ByronNodeToNodeVersion
-> ByronNodeToNodeVersion
-> [ByronNodeToNodeVersion])
-> Enum ByronNodeToNodeVersion
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion
-> ByronNodeToNodeVersion
-> [ByronNodeToNodeVersion]
$cenumFromThenTo :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion
-> ByronNodeToNodeVersion
-> [ByronNodeToNodeVersion]
enumFromTo :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> [ByronNodeToNodeVersion]
$cenumFromTo :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> [ByronNodeToNodeVersion]
enumFromThen :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> [ByronNodeToNodeVersion]
$cenumFromThen :: ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> [ByronNodeToNodeVersion]
enumFrom :: ByronNodeToNodeVersion -> [ByronNodeToNodeVersion]
$cenumFrom :: ByronNodeToNodeVersion -> [ByronNodeToNodeVersion]
fromEnum :: ByronNodeToNodeVersion -> Int
$cfromEnum :: ByronNodeToNodeVersion -> Int
toEnum :: Int -> ByronNodeToNodeVersion
$ctoEnum :: Int -> ByronNodeToNodeVersion
pred :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion
$cpred :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion
succ :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion
$csucc :: ByronNodeToNodeVersion -> ByronNodeToNodeVersion
Enum, ByronNodeToNodeVersion
ByronNodeToNodeVersion
-> ByronNodeToNodeVersion -> Bounded ByronNodeToNodeVersion
forall a. a -> a -> Bounded a
maxBound :: ByronNodeToNodeVersion
$cmaxBound :: ByronNodeToNodeVersion
minBound :: ByronNodeToNodeVersion
$cminBound :: ByronNodeToNodeVersion
Bounded)
data ByronNodeToClientVersion =
ByronNodeToClientVersion1
deriving (Int -> ByronNodeToClientVersion -> ShowS
[ByronNodeToClientVersion] -> ShowS
ByronNodeToClientVersion -> String
(Int -> ByronNodeToClientVersion -> ShowS)
-> (ByronNodeToClientVersion -> String)
-> ([ByronNodeToClientVersion] -> ShowS)
-> Show ByronNodeToClientVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ByronNodeToClientVersion] -> ShowS
$cshowList :: [ByronNodeToClientVersion] -> ShowS
show :: ByronNodeToClientVersion -> String
$cshow :: ByronNodeToClientVersion -> String
showsPrec :: Int -> ByronNodeToClientVersion -> ShowS
$cshowsPrec :: Int -> ByronNodeToClientVersion -> ShowS
Show, ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
(ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool)
-> (ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool)
-> Eq ByronNodeToClientVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
$c/= :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
== :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
$c== :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
Eq, Eq ByronNodeToClientVersion
Eq ByronNodeToClientVersion
-> (ByronNodeToClientVersion
-> ByronNodeToClientVersion -> Ordering)
-> (ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool)
-> (ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool)
-> (ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool)
-> (ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool)
-> (ByronNodeToClientVersion
-> ByronNodeToClientVersion -> ByronNodeToClientVersion)
-> (ByronNodeToClientVersion
-> ByronNodeToClientVersion -> ByronNodeToClientVersion)
-> Ord ByronNodeToClientVersion
ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
ByronNodeToClientVersion -> ByronNodeToClientVersion -> Ordering
ByronNodeToClientVersion
-> ByronNodeToClientVersion -> ByronNodeToClientVersion
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ByronNodeToClientVersion
-> ByronNodeToClientVersion -> ByronNodeToClientVersion
$cmin :: ByronNodeToClientVersion
-> ByronNodeToClientVersion -> ByronNodeToClientVersion
max :: ByronNodeToClientVersion
-> ByronNodeToClientVersion -> ByronNodeToClientVersion
$cmax :: ByronNodeToClientVersion
-> ByronNodeToClientVersion -> ByronNodeToClientVersion
>= :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
$c>= :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
> :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
$c> :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
<= :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
$c<= :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
< :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
$c< :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Bool
compare :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Ordering
$ccompare :: ByronNodeToClientVersion -> ByronNodeToClientVersion -> Ordering
$cp1Ord :: Eq ByronNodeToClientVersion
Ord, Int -> ByronNodeToClientVersion
ByronNodeToClientVersion -> Int
ByronNodeToClientVersion -> [ByronNodeToClientVersion]
ByronNodeToClientVersion -> ByronNodeToClientVersion
ByronNodeToClientVersion
-> ByronNodeToClientVersion -> [ByronNodeToClientVersion]
ByronNodeToClientVersion
-> ByronNodeToClientVersion
-> ByronNodeToClientVersion
-> [ByronNodeToClientVersion]
(ByronNodeToClientVersion -> ByronNodeToClientVersion)
-> (ByronNodeToClientVersion -> ByronNodeToClientVersion)
-> (Int -> ByronNodeToClientVersion)
-> (ByronNodeToClientVersion -> Int)
-> (ByronNodeToClientVersion -> [ByronNodeToClientVersion])
-> (ByronNodeToClientVersion
-> ByronNodeToClientVersion -> [ByronNodeToClientVersion])
-> (ByronNodeToClientVersion
-> ByronNodeToClientVersion -> [ByronNodeToClientVersion])
-> (ByronNodeToClientVersion
-> ByronNodeToClientVersion
-> ByronNodeToClientVersion
-> [ByronNodeToClientVersion])
-> Enum ByronNodeToClientVersion
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ByronNodeToClientVersion
-> ByronNodeToClientVersion
-> ByronNodeToClientVersion
-> [ByronNodeToClientVersion]
$cenumFromThenTo :: ByronNodeToClientVersion
-> ByronNodeToClientVersion
-> ByronNodeToClientVersion
-> [ByronNodeToClientVersion]
enumFromTo :: ByronNodeToClientVersion
-> ByronNodeToClientVersion -> [ByronNodeToClientVersion]
$cenumFromTo :: ByronNodeToClientVersion
-> ByronNodeToClientVersion -> [ByronNodeToClientVersion]
enumFromThen :: ByronNodeToClientVersion
-> ByronNodeToClientVersion -> [ByronNodeToClientVersion]
$cenumFromThen :: ByronNodeToClientVersion
-> ByronNodeToClientVersion -> [ByronNodeToClientVersion]
enumFrom :: ByronNodeToClientVersion -> [ByronNodeToClientVersion]
$cenumFrom :: ByronNodeToClientVersion -> [ByronNodeToClientVersion]
fromEnum :: ByronNodeToClientVersion -> Int
$cfromEnum :: ByronNodeToClientVersion -> Int
toEnum :: Int -> ByronNodeToClientVersion
$ctoEnum :: Int -> ByronNodeToClientVersion
pred :: ByronNodeToClientVersion -> ByronNodeToClientVersion
$cpred :: ByronNodeToClientVersion -> ByronNodeToClientVersion
succ :: ByronNodeToClientVersion -> ByronNodeToClientVersion
$csucc :: ByronNodeToClientVersion -> ByronNodeToClientVersion
Enum, ByronNodeToClientVersion
ByronNodeToClientVersion
-> ByronNodeToClientVersion -> Bounded ByronNodeToClientVersion
forall a. a -> a -> Bounded a
maxBound :: ByronNodeToClientVersion
$cmaxBound :: ByronNodeToClientVersion
minBound :: ByronNodeToClientVersion
$cminBound :: ByronNodeToClientVersion
Bounded)
instance HasNetworkProtocolVersion ByronBlock where
type BlockNodeToNodeVersion ByronBlock = ByronNodeToNodeVersion
type BlockNodeToClientVersion ByronBlock = ByronNodeToClientVersion
instance SupportedNetworkProtocolVersion ByronBlock where
supportedNodeToNodeVersions :: Proxy ByronBlock
-> Map NodeToNodeVersion (BlockNodeToNodeVersion ByronBlock)
supportedNodeToNodeVersions Proxy ByronBlock
_ = [(NodeToNodeVersion, ByronNodeToNodeVersion)]
-> Map NodeToNodeVersion ByronNodeToNodeVersion
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [
(NodeToNodeVersion
NodeToNodeV_7, ByronNodeToNodeVersion
ByronNodeToNodeVersion1)
, (NodeToNodeVersion
NodeToNodeV_8, ByronNodeToNodeVersion
ByronNodeToNodeVersion1)
]
supportedNodeToClientVersions :: Proxy ByronBlock
-> Map NodeToClientVersion (BlockNodeToClientVersion ByronBlock)
supportedNodeToClientVersions Proxy ByronBlock
_ = [(NodeToClientVersion, ByronNodeToClientVersion)]
-> Map NodeToClientVersion ByronNodeToClientVersion
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [
(NodeToClientVersion
NodeToClientV_9, ByronNodeToClientVersion
ByronNodeToClientVersion1)
, (NodeToClientVersion
NodeToClientV_10, ByronNodeToClientVersion
ByronNodeToClientVersion1)
, (NodeToClientVersion
NodeToClientV_11, ByronNodeToClientVersion
ByronNodeToClientVersion1)
, (NodeToClientVersion
NodeToClientV_12, ByronNodeToClientVersion
ByronNodeToClientVersion1)
]
latestReleasedNodeVersion :: Proxy ByronBlock
-> (Maybe NodeToNodeVersion, Maybe NodeToClientVersion)
latestReleasedNodeVersion = Proxy ByronBlock
-> (Maybe NodeToNodeVersion, Maybe NodeToClientVersion)
forall blk.
SupportedNetworkProtocolVersion blk =>
Proxy blk -> (Maybe NodeToNodeVersion, Maybe NodeToClientVersion)
latestReleasedNodeVersionDefault