diff --git a/cabal.project b/cabal.project index 30bffd7256..6f3845d8ae 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2024-10-10T08:11:33Z - , cardano-haskell-packages 2024-10-14T23:19:53Z + , cardano-haskell-packages 2024-10-21T06:28:35Z packages: cardano-api @@ -52,3 +52,13 @@ write-ghc-environment-files: always constraints: Cabal < 3.14, cardano-ledger-shelley ^>= 1.14.1 + +-- coot/typed-protocols-new-api +source-repository-package + type: git + location: https://github.com/IntersectMBO/ouroboros-consensus + tag: 254aa51558cc71baa5d23faa4bdb5b3ae1e7ba70 + --sha256: sha256-Drnc35CQFB5QrYgHFYaqwn7Tnc8p11KJq3vp9DvpKoE= + subdir: ouroboros-consensus + ouroboros-consensus-cardano + ouroboros-consensus-diffusion diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index c2a1899aea..9c365ea6e0 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -203,7 +203,7 @@ library internal ouroboros-consensus-diffusion ^>=0.18, ouroboros-consensus-protocol ^>=0.9.0.2, ouroboros-network, - ouroboros-network-api ^>=0.10, + ouroboros-network-api ^>=0.11, ouroboros-network-framework, ouroboros-network-protocols, parsec, @@ -222,7 +222,7 @@ library internal time, transformers, transformers-except ^>=0.1.3, - typed-protocols ^>=0.1.1, + typed-protocols ^>=0.3, vector, yaml, @@ -257,7 +257,7 @@ library memory, nothunks, ouroboros-network-protocols, - typed-protocols ^>=0.1.1, + typed-protocols, library gen import: project-config diff --git a/cardano-api/internal/Cardano/Api/IPC.hs b/cardano-api/internal/Cardano/Api/IPC.hs index c277fc35a5..f99dc11765 100644 --- a/cardano-api/internal/Cardano/Api/IPC.hs +++ b/cardano-api/internal/Cardano/Api/IPC.hs @@ -122,6 +122,7 @@ import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx import Control.Concurrent.STM (TMVar, atomically, newEmptyTMVarIO, putTMVar, takeTMVar, tryPutTMVar) +import Control.Exception (SomeException, throwIO) import Control.Monad (void) import Control.Monad.IO.Class import Control.Tracer (nullTracer) @@ -202,8 +203,8 @@ connectToLocalNodeWithVersion , localConsensusModeParams } clients = - liftIO $ Net.withIOManager $ \iomgr -> - Net.connectTo + liftIO $ Net.withIOManager $ \iomgr -> do + r <- Net.connectTo (Net.localSnocket iomgr) Net.NetworkConnectTracers { Net.nctMuxTracer = nullTracer @@ -211,6 +212,9 @@ connectToLocalNodeWithVersion } versionedProtocls (unFile localNodeSocketPath) + case r of + Left e -> throwIO e + Right _ -> pure () where versionedProtocls = -- First convert from the mode-parametrised view of things to the @@ -302,10 +306,11 @@ mkVersionedProtocols networkid ptcl unversionedClients = ) , localStateQueryProtocol = Net.InitiatorProtocolOnly $ - Net.mkMiniProtocolCbFromPeer $ + Net.mkMiniProtocolCbFromPeerSt $ const ( nullTracer , cStateQueryCodec + , Net.Query.StateIdle , maybe Net.localStateQueryPeerNull Net.Query.localStateQueryClientPeer diff --git a/cardano-api/internal/Cardano/Api/LedgerState.hs b/cardano-api/internal/Cardano/Api/LedgerState.hs index a960aaaf72..468242a2c7 100644 --- a/cardano-api/internal/Cardano/Api/LedgerState.hs +++ b/cardano-api/internal/Cardano/Api/LedgerState.hs @@ -220,7 +220,7 @@ import qualified Data.Yaml as Yaml import Formatting.Buildable (build) import GHC.Exts (IsList (..)) import Lens.Micro -import Network.TypedProtocol.Pipelined (Nat (..)) +import Network.TypedProtocol.Core (Nat (..)) import System.FilePath data InitialLedgerStateError @@ -1097,45 +1097,45 @@ instance FromJSON NodeConfig where <*> parseBabbageHardForkEpoch o <*> parseConwayHardForkEpoch o - parseShelleyHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseShelleyHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseShelleyHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestShelleyHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 2 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestShelleyHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseAllegraHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseAllegraHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseAllegraHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestAllegraHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 3 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestAllegraHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseMaryHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseMaryHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseMaryHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestMaryHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 4 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestMaryHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseAlonzoHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseAlonzoHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseAlonzoHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestAlonzoHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 5 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestAlonzoHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseBabbageHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseBabbageHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseBabbageHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestBabbageHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 7 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestBabbageHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseConwayHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseConwayHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseConwayHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestConwayHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 9 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestConwayHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] ---------------------------------------------------------------------- diff --git a/cardano-api/src/Cardano/Api/ChainSync/ClientPipelined.hs b/cardano-api/src/Cardano/Api/ChainSync/ClientPipelined.hs index 0ff1ba8e89..e794708a29 100644 --- a/cardano-api/src/Cardano/Api/ChainSync/ClientPipelined.hs +++ b/cardano-api/src/Cardano/Api/ChainSync/ClientPipelined.hs @@ -34,4 +34,4 @@ where import Ouroboros.Network.Protocol.ChainSync.ClientPipelined import Ouroboros.Network.Protocol.ChainSync.PipelineDecision -import Network.TypedProtocol.Pipelined (N (..), Nat (..), natToInt) +import Network.TypedProtocol.Core (N (..), Nat (..), natToInt) diff --git a/flake.lock b/flake.lock index 785b5bc9f9..b086cee87d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1728953092, - "narHash": "sha256-DBqT9uexf/yoZjtEP3263ltnhP/o7iBl8IZdJRfPjJs=", + "lastModified": 1729560667, + "narHash": "sha256-tHDAxN8erb23MIy7zH6VV6mCspKBstj2R1LkeBgZt28=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "fd5e5cf056090977ecbd661ad07f602eb7e2614d", + "rev": "7f24768c3a2f42a15fef889d5b415100d8082c16", "type": "github" }, "original": {