From 8853117e024cdc0bea480e525b6176d7b2c2a218 Mon Sep 17 00:00:00 2001 From: Armando Santos Date: Mon, 18 Sep 2023 17:32:21 +0100 Subject: [PATCH 01/10] Accommodate PeerSharing fix changes --- .../Benchmarking/GeneratorTx/NodeToNode.hs | 15 ++++++++++----- .../Cardano/Tracing/OrphanInstances/Network.hs | 11 +++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs index 87e097687b7..29af0567d50 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE GADTs #-} {-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} {-# LANGUAGE PackageImports #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} @@ -20,8 +20,8 @@ import "contra-tracer" Control.Tracer (Tracer (..)) import Codec.Serialise (DeserialiseFailure) import Control.Concurrent.Class.MonadSTM.Strict (newTVarIO) import Control.Monad.Class.MonadTimer (MonadTimer, threadDelay) -import Data.Foldable (fold) import Data.ByteString.Lazy (ByteString) +import Data.Foldable (fold) import qualified Data.Map.Strict as Map import Data.Proxy (Proxy (..)) import Data.Void (Void) @@ -37,18 +37,21 @@ import Ouroboros.Consensus.Node.NetworkProtocolVersion import Ouroboros.Consensus.Node.Run (RunNode) import Ouroboros.Consensus.Shelley.Eras (StandardCrypto) -import Ouroboros.Network.Context import Ouroboros.Network.Channel (Channel (..)) +import Ouroboros.Network.Context import Ouroboros.Network.ControlMessage (continueForever) import Ouroboros.Network.DeltaQ (defaultGSV) import Ouroboros.Network.Driver (runPeer, runPeerWithLimits) import Ouroboros.Network.KeepAlive import Ouroboros.Network.Magic -import Ouroboros.Network.Mux (MiniProtocolCb (..), OuroborosApplication (..), OuroborosBundle, - RunMiniProtocol (..), MuxMode (..)) +import Ouroboros.Network.Mux (MiniProtocolCb (..), MuxMode (..), + OuroborosApplication (..), OuroborosBundle, RunMiniProtocol (..)) import Ouroboros.Network.NodeToClient (IOManager, chainSyncPeerNull) import Ouroboros.Network.NodeToNode (NetworkConnectTracers (..)) import qualified Ouroboros.Network.NodeToNode as NtN +import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..)) +import Ouroboros.Network.PeerSelection.PeerSharing.Codec (decodeRemoteAddress, + encodeRemoteAddress) import Ouroboros.Network.Protocol.BlockFetch.Client (BlockFetchClient (..), blockFetchClientPeer) import Ouroboros.Network.Protocol.Handshake.Version (simpleSingletonVersions) @@ -59,6 +62,8 @@ import Ouroboros.Network.Protocol.TxSubmission2.Client (TxSubmissionCl import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..), encodeRemoteAddress, decodeRemoteAddress) import Ouroboros.Network.Protocol.PeerSharing.Client (PeerSharingClient (..), peerSharingClientPeer) +import Ouroboros.Network.Protocol.TxSubmission2.Client (TxSubmissionClient, + txSubmissionClientPeer) import Ouroboros.Network.Snocket (socketSnocket) diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs index 2efe5e9d5ce..dcaf75bd6fb 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs @@ -116,6 +116,7 @@ import Ouroboros.Network.TxSubmission.Inbound (ProcessedTxCount (..), import Ouroboros.Network.TxSubmission.Outbound (TraceTxSubmissionOutbound (..)) import qualified Ouroboros.Network.Diffusion as ND +import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing) {- HLINT ignore "Use record patterns" -} @@ -2412,3 +2413,13 @@ instance ToJSON addr , "from" .= toJSON (ConnMgr.fromState tr) , "to" .= toJSON (ConnMgr.toState tr) ] + +instance FromJSON PeerSharing where + parseJSON = withText "PeerSharing" $ \t -> + case readMaybe (Text.unpack t) of + Nothing -> fail ("PeerSharing.parseJSON: could not parse value: " + ++ Text.unpack t) + Just ps -> return ps + +instance ToJSON PeerSharing where + toJSON = String . Text.pack . show From 8b13c3aad3f41e5385777622f506e36f8fc5a8c2 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 20 Nov 2023 10:32:18 +0100 Subject: [PATCH 02/10] Integrate ouroboros-network --- bench/locli/locli.cabal | 2 +- .../Benchmarking/GeneratorTx/NodeToNode.hs | 5 +-- cabal.project | 4 +-- cardano-node/cardano-node.cabal | 4 +-- .../Cardano/Node/Configuration/NodeAddress.hs | 2 +- .../src/Cardano/Node/Configuration/POM.hs | 5 +-- .../src/Cardano/Node/Tracing/Consistency.hs | 6 ++-- .../src/Cardano/Node/Tracing/Documentation.hs | 6 ++-- .../src/Cardano/Node/Tracing/Tracers.hs | 14 ++++---- .../Cardano/Node/Tracing/Tracers/Diffusion.hs | 35 ++++++++++++++++++ .../src/Cardano/Node/Tracing/Tracers/P2P.hs | 6 ++-- .../Cardano/Node/Tracing/Tracers/Startup.hs | 1 + .../Tracing/OrphanInstances/Network.hs | 36 ++++++++++++++++--- .../Tracing/OrphanInstances/Shelley.hs | 6 +++- cardano-node/src/Cardano/Tracing/Tracers.hs | 6 ++-- cardano-node/test/Test/Cardano/Node/POM.hs | 6 ++-- cardano-submit-api/cardano-submit-api.cabal | 2 +- cardano-testnet/cardano-testnet.cabal | 3 +- .../src/Testnet/Components/Configuration.hs | 1 + cardano-tracer/cardano-tracer.cabal | 2 +- trace-dispatcher/trace-dispatcher.cabal | 2 +- trace-forward/trace-forward.cabal | 4 +-- 22 files changed, 116 insertions(+), 42 deletions(-) diff --git a/bench/locli/locli.cabal b/bench/locli/locli.cabal index 41078b85409..20e37185c52 100644 --- a/bench/locli/locli.cabal +++ b/bench/locli/locli.cabal @@ -121,7 +121,7 @@ library , optparse-generic , ouroboros-consensus -- for Data.SOP.Strict: - , ouroboros-network ^>= 0.9.1 + , ouroboros-network ^>= 0.10 , ouroboros-network-api , process , quiet diff --git a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs index 29af0567d50..5e50d2e56c5 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs @@ -59,11 +59,8 @@ import Ouroboros.Network.Protocol.KeepAlive.Client hiding (SendMsgDone import Ouroboros.Network.Protocol.KeepAlive.Codec import Ouroboros.Network.Protocol.TxSubmission2.Client (TxSubmissionClient, txSubmissionClientPeer) -import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..), encodeRemoteAddress, decodeRemoteAddress) import Ouroboros.Network.Protocol.PeerSharing.Client (PeerSharingClient (..), peerSharingClientPeer) -import Ouroboros.Network.Protocol.TxSubmission2.Client (TxSubmissionClient, - txSubmissionClientPeer) import Ouroboros.Network.Snocket (socketSnocket) @@ -96,7 +93,7 @@ benchmarkConnectTxSubmit ioManager handshakeTracer submissionTracer codecConfig (addrAddress <$> Nothing) (addrAddress remoteAddr) where - ownPeerSharing = NoPeerSharing + ownPeerSharing = PeerSharingDisabled mkApp :: OuroborosBundle mode initiatorCtx responderCtx bs m a b -> OuroborosApplication mode initiatorCtx responderCtx bs m a b mkApp bundle = diff --git a/cabal.project b/cabal.project index 58f2513f465..69d235a6a7f 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ repository cardano-haskell-packages -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: - , hackage.haskell.org 2023-09-01T22:19:16Z - , cardano-haskell-packages 2023-10-31T17:10:09Z + , hackage.haskell.org 2023-11-09T23:50:15Z + , cardano-haskell-packages 2023-11-17T22:33:04Z packages: cardano-git-rev diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 9ed6baa88a8..8c9cea0753d 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -181,9 +181,9 @@ library , ouroboros-consensus-diffusion ^>= 0.8 , ouroboros-consensus-protocol , ouroboros-network-api - , ouroboros-network ^>= 0.9.1 + , ouroboros-network ^>= 0.10 , ouroboros-network-framework - , ouroboros-network-protocols < 0.5.3.0 + , ouroboros-network-protocols ^>= 0.6 , prettyprinter , prettyprinter-ansi-terminal , psqueues diff --git a/cardano-node/src/Cardano/Node/Configuration/NodeAddress.hs b/cardano-node/src/Cardano/Node/Configuration/NodeAddress.hs index 9ee6fc91063..bf46a81cb6b 100644 --- a/cardano-node/src/Cardano/Node/Configuration/NodeAddress.hs +++ b/cardano-node/src/Cardano/Node/Configuration/NodeAddress.hs @@ -42,7 +42,7 @@ import qualified Network.DNS as DNS (Domain) import Network.Socket (PortNumber, SockAddr (..)) import Text.Read (readMaybe) -import Ouroboros.Network.PeerSelection.RootPeersDNS (DomainAccessPoint (..)) +import Ouroboros.Network.PeerSelection.RelayAccessPoint (DomainAccessPoint (..)) -- | IPv4 or IPv6 address with a port number. diff --git a/cardano-node/src/Cardano/Node/Configuration/POM.hs b/cardano-node/src/Cardano/Node/Configuration/POM.hs index fac39fac8db..72e329f3fc4 100644 --- a/cardano-node/src/Cardano/Node/Configuration/POM.hs +++ b/cardano-node/src/Cardano/Node/Configuration/POM.hs @@ -45,6 +45,7 @@ import Cardano.Node.Handlers.Shutdown import Cardano.Node.Protocol.Types (Protocol (..)) import Cardano.Node.Types import Cardano.Tracing.Config +import Cardano.Tracing.OrphanInstances.Network () import Ouroboros.Consensus.Mempool (MempoolCapacityBytes (..), MempoolCapacityBytesOverride (..)) import qualified Ouroboros.Consensus.Node as Consensus (NetworkP2PMode (..)) @@ -298,7 +299,7 @@ instance FromJSON PartialNodeConfiguration where -- Peer Sharing -- DISABLED BY DEFAULT - pncPeerSharing <- Last <$> v .:? "PeerSharing" .!= Just NoPeerSharing + pncPeerSharing <- Last <$> v .:? "PeerSharing" .!= Just PeerSharingDisabled pure PartialNodeConfiguration { pncProtocolConfig @@ -505,7 +506,7 @@ defaultPartialNodeConfiguration = , pncTargetNumberOfEstablishedBigLedgerPeers = Last (Just 10) , pncTargetNumberOfActiveBigLedgerPeers = Last (Just 5) , pncEnableP2P = Last (Just DisabledP2PMode) - , pncPeerSharing = Last (Just NoPeerSharing) + , pncPeerSharing = Last (Just PeerSharingDisabled) } lastOption :: Parser a -> Parser (Last a) diff --git a/cardano-node/src/Cardano/Node/Tracing/Consistency.hs b/cardano-node/src/Cardano/Node/Tracing/Consistency.hs index 1cf2aa4c7de..9464248465c 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Consistency.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Consistency.hs @@ -74,8 +74,10 @@ import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (. PeerSelectionCounters (..), TracePeerSelection (..)) import Ouroboros.Network.PeerSelection.LedgerPeers (TraceLedgerPeers) import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) -import Ouroboros.Network.PeerSelection.RootPeersDNS (TraceLocalRootPeers (..), - TracePublicRootPeers (..)) +import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers + (TraceLocalRootPeers (..)) +import Ouroboros.Network.PeerSelection.RootPeersDNS.PublicRootPeers + (TracePublicRootPeers (..)) import Ouroboros.Network.Protocol.BlockFetch.Type (BlockFetch) import Ouroboros.Network.Protocol.ChainSync.Type (ChainSync) import Ouroboros.Network.Protocol.Handshake.Unversioned (UnversionedProtocol (..), diff --git a/cardano-node/src/Cardano/Node/Tracing/Documentation.hs b/cardano-node/src/Cardano/Node/Tracing/Documentation.hs index fb2b622ec6d..f15563ffd1d 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Documentation.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Documentation.hs @@ -87,8 +87,10 @@ import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (. PeerSelectionCounters (..), TracePeerSelection (..)) import Ouroboros.Network.PeerSelection.LedgerPeers (TraceLedgerPeers) import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) -import Ouroboros.Network.PeerSelection.RootPeersDNS (TraceLocalRootPeers (..), - TracePublicRootPeers (..)) +import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers + (TraceLocalRootPeers (..)) +import Ouroboros.Network.PeerSelection.RootPeersDNS.PublicRootPeers + (TracePublicRootPeers (..)) import Ouroboros.Network.Protocol.BlockFetch.Type (BlockFetch) import Ouroboros.Network.Protocol.ChainSync.Type (ChainSync) import Ouroboros.Network.Protocol.Handshake.Unversioned (UnversionedProtocol (..), diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers.hs index 24dc5f7d099..e6e708cd3e7 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers.hs @@ -477,11 +477,6 @@ mkDiffusionTracers configReflection trBase trForward mbTrEKG _trDataPoint trConf ["Startup", "DiffusionInit"] configureTracers configReflection trConfig [dtDiffusionInitializationTr] - !dtLedgerPeersTr <- mkCardanoTracer - trBase trForward mbTrEKG - ["Net", "Peers", "Ledger"] - configureTracers configReflection trConfig [dtLedgerPeersTr] - pure $ Diffusion.Tracers { Diffusion.dtMuxTracer = Tracer $ traceWith dtMuxTr @@ -493,8 +488,6 @@ mkDiffusionTracers configReflection trBase trForward mbTrEKG _trDataPoint trConf traceWith dtLocalHandshakeTr , Diffusion.dtDiffusionTracer = Tracer $ traceWith dtDiffusionInitializationTr - , Diffusion.dtLedgerPeersTracer = Tracer $ - traceWith dtLedgerPeersTr } mkDiffusionTracersExtra :: forall p2p. @@ -583,6 +576,11 @@ mkDiffusionTracersExtra configReflection trBase trForward mbTrEKG _trDataPoint t ["Net", "Server", "Local"] configureTracers configReflection trConfig [localServerTr] + !dtLedgerPeersTr <- mkCardanoTracer + trBase trForward mbTrEKG + ["Net", "Peers", "Ledger"] + configureTracers configReflection trConfig [dtLedgerPeersTr] + pure $ Diffusion.P2PTracers P2P.TracersExtra { P2P.dtTraceLocalRootPeersTracer = Tracer $ traceWith localRootPeersTr @@ -614,6 +612,8 @@ mkDiffusionTracersExtra configReflection trBase trForward mbTrEKG _trDataPoint t traceWith localConnectionManagerTr , P2P.dtLocalServerTracer = Tracer $ traceWith localServerTr + , P2P.dtTraceLedgerPeersTracer = Tracer $ + traceWith dtLedgerPeersTr } mkDiffusionTracersExtra configReflection trBase trForward mbTrEKG _trDataPoint trConfig DisabledP2PMode = do diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Diffusion.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Diffusion.hs index d2e2a633bbd..3fda733d8f0 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Diffusion.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Diffusion.hs @@ -835,6 +835,23 @@ instance LogFormatting TraceLedgerPeers where , "target" .= target , "numOfBigLedgerPeers" .= numOfBigLedgerPeers ] + forMachine _dtal (TraceLedgerPeersDomains daps) = + mconcat + [ "kind" .= String "TraceLedgerPeersDomains" + , "domainAccessPoints" .= daps + ] + forMachine _dtal (TraceLedgerPeersResult dap ips) = + mconcat + [ "kind" .= String "TraceLedgerPeersResult" + , "domainAccessPoint" .= show dap + , "ips" .= map show ips + ] + forMachine _dtal (TraceLedgerPeersFailure dap reason) = + mconcat + [ "kind" .= String "TraceLedgerPeersFailure" + , "domainAccessPoint" .= show dap + , "error" .= show reason + ] instance MetaTrace TraceLedgerPeers where namespaceFor PickedLedgerPeer {} = @@ -863,6 +880,12 @@ instance MetaTrace TraceLedgerPeers where Namespace [] ["NotEnoughLedgerPeers"] namespaceFor NotEnoughBigLedgerPeers {} = Namespace [] ["NotEnoughBigLedgerPeers"] + namespaceFor TraceLedgerPeersDomains {} = + Namespace [] ["TraceLedgerPeersDomains"] + namespaceFor TraceLedgerPeersResult {} = + Namespace [] ["TraceLedgerPeersResult"] + namespaceFor TraceLedgerPeersFailure {} = + Namespace [] ["TraceLedgerPeersFailure"] severityFor (Namespace _ ["PickedPeer"]) _ = Just Debug severityFor (Namespace _ ["PickedPeers"]) _ = Just Info @@ -875,6 +898,9 @@ instance MetaTrace TraceLedgerPeers where severityFor (Namespace _ ["FallingBackToPublicRootPeers"]) _ = Just Info severityFor (Namespace _ ["NotEnoughLedgerPeers"]) _ = Just Warning severityFor (Namespace _ ["NotEnoughBigLedgerPeers"]) _ = Just Warning + severityFor (Namespace _ ["TraceLedgerPeersDomains"]) _ = Just Debug + severityFor (Namespace _ ["TraceLedgerPeersResult"]) _ = Just Debug + severityFor (Namespace _ ["TraceLedgerPeersFailure"]) _ = Just Debug severityFor _ _ = Nothing documentFor (Namespace _ ["PickedPeer"]) = Just @@ -897,6 +923,12 @@ instance MetaTrace TraceLedgerPeers where "" documentFor (Namespace _ ["FallingBackToPublicRootPeers"]) = Just "" + documentFor (Namespace _ ["TraceLedgerPeersDomains"]) = Just + "" + documentFor (Namespace _ ["TraceLedgerPeersResult"]) = Just + "" + documentFor (Namespace _ ["TraceLedgerPeersFailure"]) = Just + "" documentFor _ = Nothing allNamespaces = [ @@ -909,4 +941,7 @@ instance MetaTrace TraceLedgerPeers where , Namespace [] ["RequestForPeers"] , Namespace [] ["ReusingLedgerState"] , Namespace [] ["FallingBackToPublicRootPeers"] + , Namespace [] ["TraceLedgerPeersDomains"] + , Namespace [] ["TraceLedgerPeersResult"] + , Namespace [] ["TraceLedgerPeersFailure"] ] diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs index 4b7d7a6af84..68cc822dd30 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs @@ -43,8 +43,10 @@ import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (. TracePeerSelection (..)) import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) import Ouroboros.Network.PeerSelection.RelayAccessPoint (RelayAccessPoint) -import Ouroboros.Network.PeerSelection.RootPeersDNS (TraceLocalRootPeers (..), - TracePublicRootPeers (..)) +import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers + (TraceLocalRootPeers (..)) +import Ouroboros.Network.PeerSelection.RootPeersDNS.PublicRootPeers + (TracePublicRootPeers (..)) import qualified Ouroboros.Network.PeerSelection.State.EstablishedPeers as EstablishedPeers import qualified Ouroboros.Network.PeerSelection.State.KnownPeers as KnownPeers import Ouroboros.Network.PeerSelection.Types () diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs index 6f697cdff69..0c6481ecea9 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs @@ -446,6 +446,7 @@ nodeToNodeVersionToInt = \case NodeToNodeV_10 -> 10 NodeToNodeV_11 -> 11 NodeToNodeV_12 -> 12 + NodeToNodeV_13 -> 13 -- | Pretty print 'StartupInfoTrace' -- diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs index dcaf75bd6fb..3937c252f93 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs @@ -32,6 +32,7 @@ import qualified Data.Set as Set import Data.Text (Text, pack) import qualified Data.Text as Text import qualified Data.Text.Encoding as Text +import qualified Text.Read as Text import Network.TypedProtocol.Codec (AnyMessageAndAgency (..)) import Network.TypedProtocol.Core (PeerHasAgency (..)) @@ -82,8 +83,11 @@ import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (. TracePeerSelection (..)) import Ouroboros.Network.PeerSelection.LedgerPeers import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) -import Ouroboros.Network.PeerSelection.RootPeersDNS (TraceLocalRootPeers (..), - TracePublicRootPeers (..)) +import Ouroboros.Network.PeerSelection.RelayAccessPoint +import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers + (TraceLocalRootPeers (..)) +import Ouroboros.Network.PeerSelection.RootPeersDNS.PublicRootPeers + (TracePublicRootPeers (..)) import qualified Ouroboros.Network.PeerSelection.State.EstablishedPeers as EstablishedPeers import qualified Ouroboros.Network.PeerSelection.State.KnownPeers as KnownPeers import Ouroboros.Network.PeerSelection.State.LocalRootPeers (HotValency (..), @@ -231,6 +235,9 @@ instance HasSeverityAnnotation TraceLedgerPeers where FallingBackToPublicRootPeers {} -> Info NotEnoughLedgerPeers {} -> Warning NotEnoughBigLedgerPeers {} -> Warning + TraceLedgerPeersDomains {} -> Debug + TraceLedgerPeersResult {} -> Debug + TraceLedgerPeersFailure {} -> Debug instance HasPrivacyAnnotation (WithAddr addr ErrorPolicyTrace) @@ -1377,6 +1384,24 @@ instance ToObject TraceLedgerPeers where , "target" .= target , "numOfBigLedgerPeers" .= numOfBigLedgerPeers ] + toObject _verb (TraceLedgerPeersDomains daps) = + mconcat + [ "kind" .= String "TraceLedgerPeersDomains" + , "domainAccessPoints" .= daps + ] + toObject _verb (TraceLedgerPeersResult dap ips) = + mconcat + [ "kind" .= String "TraceLedgerPeersResult" + , "domainAccessPoint" .= show dap + , "ips" .= map show ips + ] + toObject _verb (TraceLedgerPeersFailure dap reason) = + mconcat + [ "kind" .= String "TraceLedgerPeersFailure" + , "domainAccessPoint" .= show dap + , "error" .= show reason + ] + instance Show addr => ToObject (WithAddr addr ErrorPolicyTrace) where @@ -2001,6 +2026,7 @@ instance ToJSON NodeToNodeVersion where toJSON NodeToNodeV_10 = Number 10 toJSON NodeToNodeV_11 = Number 11 toJSON NodeToNodeV_12 = Number 12 + toJSON NodeToNodeV_13 = Number 13 instance FromJSON NodeToNodeVersion where parseJSON (Number 7) = return NodeToNodeV_7 @@ -2008,6 +2034,8 @@ instance FromJSON NodeToNodeVersion where parseJSON (Number 9) = return NodeToNodeV_9 parseJSON (Number 10) = return NodeToNodeV_10 parseJSON (Number 11) = return NodeToNodeV_11 + parseJSON (Number 12) = return NodeToNodeV_12 + parseJSON (Number 13) = return NodeToNodeV_13 parseJSON (Number x) = fail ("FromJSON.NodeToNodeVersion: unsupported node-to-node protocol version " ++ show x) parseJSON x = fail ("FromJSON.NodeToNodeVersion: error parsing NodeToNodeVersion: " ++ show x) @@ -2415,8 +2443,8 @@ instance ToJSON addr ] instance FromJSON PeerSharing where - parseJSON = withText "PeerSharing" $ \t -> - case readMaybe (Text.unpack t) of + parseJSON = Aeson.withText "PeerSharing" $ \t -> + case Text.readMaybe (Text.unpack t) of Nothing -> fail ("PeerSharing.parseJSON: could not parse value: " ++ Text.unpack t) Just ps -> return ps diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs index 8b182a16f91..d359c75ff88 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs @@ -33,7 +33,7 @@ import Cardano.Ledger.Alonzo.Rules (AlonzoBbodyPredFailure (..), Alonz AlonzoUtxosPredFailure, AlonzoUtxowPredFailure (..)) import qualified Cardano.Ledger.Alonzo.Rules as Alonzo import qualified Cardano.Ledger.Alonzo.Tx as Alonzo -import qualified Cardano.Ledger.Alonzo.TxInfo as Alonzo +import qualified Cardano.Ledger.Alonzo.Plutus.TxInfo as Alonzo import qualified Cardano.Ledger.Api as Ledger import Cardano.Ledger.Babbage.Rules (BabbageUtxoPredFailure, BabbageUtxowPredFailure) import qualified Cardano.Ledger.Babbage.Rules as Babbage @@ -380,6 +380,10 @@ instance Ledger.EraPParams era => ToObject (Conway.ConwayGovPredFailure era) whe mconcat [ "kind" .= String "InvalidPrevGovActionIdsInProposals" , "proposals" .= proposals ] + toObject _ (Conway.VotingOnExpiredGovAction actions) = + mconcat [ "kind" .= String "VotingOnExpiredGovAction" + , "action" .= actions + ] instance ( Core.Crypto (Consensus.EraCrypto era) diff --git a/cardano-node/src/Cardano/Tracing/Tracers.hs b/cardano-node/src/Cardano/Tracing/Tracers.hs index f3f348d1b21..d770e668559 100644 --- a/cardano-node/src/Cardano/Tracing/Tracers.hs +++ b/cardano-node/src/Cardano/Tracing/Tracers.hs @@ -364,7 +364,6 @@ mkTracers blockConfig tOpts@(TracingOnLegacy trSel) tr nodeKern ekgDirect enable , Diffusion.dtLocalMuxTracer = localMuxTracer , Diffusion.dtLocalHandshakeTracer = localHandshakeTracer , Diffusion.dtDiffusionTracer = initializationTracer - , Diffusion.dtLedgerPeersTracer = ledgerPeersTracer } diffusionTracersExtra' enP2P = case enP2P of @@ -423,6 +422,9 @@ mkTracers blockConfig tOpts@(TracingOnLegacy trSel) tr nodeKern ekgDirect enable , P2P.dtLocalInboundGovernorTracer = tracerOnOff (traceLocalInboundGovernor trSel) verb "LocalInboundGovernor" tr + , P2P.dtTraceLedgerPeersTracer = + tracerOnOff (traceLedgerPeers trSel) + verb "LedgerPeers" tr } DisabledP2PMode -> Diffusion.NonP2PTracers NonP2P.TracersExtra @@ -449,8 +451,6 @@ mkTracers blockConfig tOpts@(TracingOnLegacy trSel) tr nodeKern ekgDirect enable tracerOnOff (traceLocalHandshake trSel) verb "LocalHandshake" tr handshakeTracer = tracerOnOff (traceHandshake trSel) verb "Handshake" tr - ledgerPeersTracer = - tracerOnOff (traceLedgerPeers trSel) verb "LedgerPeers" tr initializationTracer = tracerOnOff (traceDiffusionInitialization trSel) verb "DiffusionInitializationTracer" tr diff --git a/cardano-node/test/Test/Cardano/Node/POM.hs b/cardano-node/test/Test/Cardano/Node/POM.hs index dd1d92a6c9c..2e9fb03de0e 100644 --- a/cardano-node/test/Test/Cardano/Node/POM.hs +++ b/cardano-node/test/Test/Cardano/Node/POM.hs @@ -140,7 +140,7 @@ testPartialYamlConfig = , pncTargetNumberOfEstablishedBigLedgerPeers = mempty , pncTargetNumberOfActiveBigLedgerPeers = mempty , pncEnableP2P = Last (Just DisabledP2PMode) - , pncPeerSharing = Last (Just NoPeerSharing) + , pncPeerSharing = Last (Just PeerSharingDisabled) } -- | Example partial configuration theoretically created @@ -178,7 +178,7 @@ testPartialCliConfig = , pncTargetNumberOfEstablishedBigLedgerPeers = mempty , pncTargetNumberOfActiveBigLedgerPeers = mempty , pncEnableP2P = Last (Just DisabledP2PMode) - , pncPeerSharing = Last (Just NoPeerSharing) + , pncPeerSharing = Last (Just PeerSharingDisabled) } -- | Expected final NodeConfiguration @@ -222,7 +222,7 @@ eExpectedConfig = do , ncTargetNumberOfEstablishedBigLedgerPeers = 10 , ncTargetNumberOfActiveBigLedgerPeers = 5 , ncEnableP2P = SomeNetworkP2PMode Consensus.DisabledP2PMode - , ncPeerSharing = NoPeerSharing + , ncPeerSharing = PeerSharingDisabled } -- ----------------------------------------------------------------------------- diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index 071f9de240a..b32f53cc5b9 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -51,7 +51,7 @@ library , network , optparse-applicative-fork , ouroboros-consensus-cardano - , ouroboros-network ^>= 0.9.1 + , ouroboros-network ^>= 0.10 , ouroboros-network-protocols , prometheus >= 2.2.4 , servant diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index f2462db9285..94c94040152 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -55,7 +55,8 @@ library , hedgehog-extras ^>= 0.4.7.0 , mtl , optparse-applicative-fork - , ouroboros-network ^>= 0.9.1 + , ouroboros-network ^>= 0.10 + , ouroboros-network-api , process , resourcet , safe-exceptions diff --git a/cardano-testnet/src/Testnet/Components/Configuration.hs b/cardano-testnet/src/Testnet/Components/Configuration.hs index 8dd34a5adfd..89d8827f048 100644 --- a/cardano-testnet/src/Testnet/Components/Configuration.hs +++ b/cardano-testnet/src/Testnet/Components/Configuration.hs @@ -14,6 +14,7 @@ import qualified Cardano.Node.Configuration.Topology as NonP2P import qualified Cardano.Node.Configuration.TopologyP2P as P2P import Cardano.Node.Types import Ouroboros.Network.PeerSelection.LedgerPeers +import Ouroboros.Network.PeerSelection.RelayAccessPoint import Ouroboros.Network.PeerSelection.State.LocalRootPeers import Control.Monad diff --git a/cardano-tracer/cardano-tracer.cabal b/cardano-tracer/cardano-tracer.cabal index 7e75618dc43..81a18d97958 100644 --- a/cardano-tracer/cardano-tracer.cabal +++ b/cardano-tracer/cardano-tracer.cabal @@ -146,7 +146,7 @@ library , filepath , mime-mail , optparse-applicative - , ouroboros-network ^>= 0.9.1 + , ouroboros-network ^>= 0.10 , ouroboros-network-api , ouroboros-network-framework , signal diff --git a/trace-dispatcher/trace-dispatcher.cabal b/trace-dispatcher/trace-dispatcher.cabal index 882e21eedba..9ad79d75a87 100644 --- a/trace-dispatcher/trace-dispatcher.cabal +++ b/trace-dispatcher/trace-dispatcher.cabal @@ -60,7 +60,7 @@ library , hostname , network , optparse-applicative-fork - , ouroboros-network ^>= 0.9.1 + , ouroboros-network ^>= 0.10 , ouroboros-network-api , ouroboros-network-framework , serialise diff --git a/trace-forward/trace-forward.cabal b/trace-forward/trace-forward.cabal index 4a590f193e4..b7ef51915ae 100644 --- a/trace-forward/trace-forward.cabal +++ b/trace-forward/trace-forward.cabal @@ -64,8 +64,8 @@ library , deepseq , extra , io-classes - , ouroboros-network-api ^>= 0.5.1 - , ouroboros-network-framework ^>= 0.9 + , ouroboros-network-api ^>= 0.6 + , ouroboros-network-framework >= 0.9 && < 0.11 , serialise , stm , text From c49a9d90bfc0d5551c5e635645825b4f79f63f27 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 20 Nov 2023 10:35:01 +0100 Subject: [PATCH 03/10] Integrate cardano-api-8.33 --- .../plutus-scripts-bench.cabal | 2 +- .../GeneratorTx/SubmissionClient.hs | 15 +-- .../Cardano/Benchmarking/OuroborosImports.hs | 7 +- .../src/Cardano/Benchmarking/Script/Core.hs | 31 +++-- .../src/Cardano/TxGenerator/Fund.hs | 4 +- .../src/Cardano/TxGenerator/Genesis.hs | 2 +- .../src/Cardano/TxGenerator/PureExample.hs | 2 +- .../src/Cardano/TxGenerator/Types.hs | 21 ++-- .../src/Cardano/TxGenerator/UTxO.hs | 8 +- .../src/Cardano/TxGenerator/Utils.hs | 13 +-- bench/tx-generator/tx-generator.cabal | 3 +- cardano-node-chairman/app/Cardano/Chairman.hs | 109 +++++++----------- .../app/Cardano/Chairman/Commands/Run.hs | 5 +- cardano-node/cardano-node.cabal | 2 +- cardano-node/src/Cardano/Node/Protocol.hs | 7 +- .../src/Cardano/Node/Protocol/Alonzo.hs | 18 +-- .../src/Cardano/Node/Protocol/Byron.hs | 40 +++---- .../src/Cardano/Node/Protocol/Cardano.hs | 24 ++-- .../src/Cardano/Node/Protocol/Conway.hs | 18 +-- .../src/Cardano/Node/Protocol/Shelley.hs | 50 ++++---- cardano-node/src/Cardano/Node/Run.hs | 3 +- .../Tracing/OrphanInstances/Shelley.hs | 2 +- .../test/Test/Cardano/Node/FilePermissions.hs | 3 +- cardano-submit-api/cardano-submit-api.cabal | 2 +- .../src/Cardano/TxSubmit/CLI/Types.hs | 4 +- .../src/Cardano/TxSubmit/Types.hs | 8 +- .../src/Cardano/TxSubmit/Web.hs | 33 +++--- cardano-testnet/cardano-testnet.cabal | 2 +- cardano-testnet/src/Testnet/Defaults.hs | 9 +- cardano-testnet/src/Testnet/Runtime.hs | 3 +- cardano-testnet/src/Testnet/Start/Cardano.hs | 2 +- .../Cardano/Testnet/Test/Golden/Util.hs | 3 +- .../Test/Cli/Babbage/LeadershipSchedule.hs | 3 +- .../Cardano/Testnet/Test/Cli/KesPeriodInfo.hs | 6 +- .../Cardano/Testnet/Test/FoldBlocks.hs | 4 +- .../Cardano/Testnet/Test/Misc.hs | 8 +- .../Cardano/Testnet/Test/Node/Shutdown.hs | 3 +- 37 files changed, 220 insertions(+), 259 deletions(-) diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index 98b8bcda927..3f858c9e0f5 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -72,7 +72,7 @@ library -- IOG dependencies -------------------------- build-depends: - , cardano-api ^>= 8.29 + , cardano-api ^>= 8.33 , plutus-ledger-api >=1.0.0 , plutus-tx >=1.0.0 , plutus-tx-plugin >=1.0.0 diff --git a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs index bc357be6498..9a41476b04d 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs @@ -34,9 +34,6 @@ import qualified Data.List as L import qualified Data.List.Extra as L import qualified Data.List.NonEmpty as NE import qualified Data.Text as T -#if __GLASGOW_HASKELL__ >= 906 -import Data.Type.Equality (type (~)) -#endif import Cardano.Tracing.OrphanInstances.Byron () import Cardano.Tracing.OrphanInstances.Common () @@ -191,12 +188,12 @@ txSubmissionClient tr bmtr initialTxSource endOfProtocolCallback = toGenTx :: tx -> GenTx CardanoBlock toGenTx tx = case shelleyBasedEra @era of - ShelleyBasedEraShelley -> toConsensusGenTx $ TxInMode tx ShelleyEraInCardanoMode - ShelleyBasedEraAllegra -> toConsensusGenTx $ TxInMode tx AllegraEraInCardanoMode - ShelleyBasedEraMary -> toConsensusGenTx $ TxInMode tx MaryEraInCardanoMode - ShelleyBasedEraAlonzo -> toConsensusGenTx $ TxInMode tx AlonzoEraInCardanoMode - ShelleyBasedEraBabbage -> toConsensusGenTx $ TxInMode tx BabbageEraInCardanoMode - ShelleyBasedEraConway -> toConsensusGenTx $ TxInMode tx ConwayEraInCardanoMode + ShelleyBasedEraShelley -> toConsensusGenTx $ TxInMode ShelleyEra tx + ShelleyBasedEraAllegra -> toConsensusGenTx $ TxInMode AllegraEra tx + ShelleyBasedEraMary -> toConsensusGenTx $ TxInMode MaryEra tx + ShelleyBasedEraAlonzo -> toConsensusGenTx $ TxInMode AlonzoEra tx + ShelleyBasedEraBabbage -> toConsensusGenTx $ TxInMode BabbageEra tx + ShelleyBasedEraConway -> toConsensusGenTx $ TxInMode ConwayEra tx fromGenTxId :: GenTxId CardanoBlock -> TxId fromGenTxId (Block.GenTxIdShelley (Mempool.ShelleyTxId i)) = fromShelleyTxId i diff --git a/bench/tx-generator/src/Cardano/Benchmarking/OuroborosImports.hs b/bench/tx-generator/src/Cardano/Benchmarking/OuroborosImports.hs index 46d077d3018..6843b2a3d21 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/OuroborosImports.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/OuroborosImports.hs @@ -35,12 +35,11 @@ import Ouroboros.Network.Protocol.LocalTxSubmission.Type (SubmitResult import Cardano.Node.Configuration.Logging (LoggingLayer) import Cardano.Node.Protocol.Types (SomeConsensusProtocol (..)) -import Cardano.Api.Shelley (CardanoMode) import Cardano.CLI.Types.Common (SigningKeyFile) import Cardano.Api (BlockType (..), ConsensusModeParams (..), EpochSlots (..), LocalNodeConnectInfo (..), NetworkId (..), PaymentKey, SigningKey, SocketPath, - TxInMode, TxValidationErrorInMode, protocolInfo, submitTxToNodeLocal) + TxInMode, TxValidationErrorInCardanoMode, protocolInfo, submitTxToNodeLocal) import Cardano.Ledger.Shelley.Genesis (ShelleyGenesis) type CardanoBlock = Consensus.CardanoBlock StandardCrypto @@ -61,8 +60,8 @@ protocolToNetworkId :: SomeConsensusProtocol -> NetworkId protocolToNetworkId ptcl = Testnet $ getNetworkMagic $ configBlock $ protocolToTopLevelConfig ptcl -makeLocalConnectInfo :: NetworkId -> SocketPath -> LocalNodeConnectInfo CardanoMode +makeLocalConnectInfo :: NetworkId -> SocketPath -> LocalNodeConnectInfo makeLocalConnectInfo networkId socketPath = LocalNodeConnectInfo (CardanoModeParams (EpochSlots 21600)) networkId socketPath -type LocalSubmitTx = (TxInMode CardanoMode -> IO (SubmitResult (TxValidationErrorInMode CardanoMode))) +type LocalSubmitTx = (TxInMode -> IO (SubmitResult TxValidationErrorInCardanoMode)) diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs b/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs index 5e1ea423383..df205949189 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs @@ -111,7 +111,7 @@ addFund era wallet txIn lovelace keyName = do fundKey <- getEnvKeys keyName let mkOutValue :: forall era. IsShelleyBasedEra era => AsType era -> ActionM (InAnyCardanoEra TxOutValue) - mkOutValue _ = return $ InAnyCardanoEra (cardanoEra @era) (lovelaceToTxOutValue (cardanoEra @era) lovelace) + mkOutValue _ = return $ InAnyCardanoEra (cardanoEra @era) (lovelaceToTxOutValue (shelleyBasedEra @era) lovelace) outValue <- withEra era mkOutValue addFundToWallet wallet txIn outValue fundKey @@ -161,14 +161,14 @@ cancelBenchmark n = do liftIO shutdownAction waitBenchmarkCore ctl -getLocalConnectInfo :: ActionM (LocalNodeConnectInfo CardanoMode) +getLocalConnectInfo :: ActionM LocalNodeConnectInfo getLocalConnectInfo = makeLocalConnectInfo <$> getEnvNetworkId <*> getEnvSocketPath queryEra :: ActionM AnyCardanoEra queryEra = do localNodeConnectInfo <- getLocalConnectInfo chainTip <- liftIO $ getLocalChainTip localNodeConnectInfo - ret <- liftIO $ queryNodeLocalState localNodeConnectInfo (Just $ chainTipToChainPoint chainTip) $ QueryCurrentEra CardanoModeIsMultiEra + ret <- liftIO $ queryNodeLocalState localNodeConnectInfo (Just $ chainTipToChainPoint chainTip) QueryCurrentEra case ret of Right era -> return era Left err -> liftTxGenError $ TxGenError $ show err @@ -180,11 +180,10 @@ queryRemoteProtocolParameters = do era <- queryEra let callQuery :: forall era. - EraInMode era CardanoMode - -> QueryInEra era (Ledger.PParams (ShelleyLedgerEra era)) + QueryInEra era (Ledger.PParams (ShelleyLedgerEra era)) -> ActionM ProtocolParameters - callQuery eraInMode query@(QueryInShelleyBasedEra shelleyEra _) = do - res <- liftIO $ queryNodeLocalState localNodeConnectInfo (Just $ chainTipToChainPoint chainTip) (QueryInEra eraInMode query) + callQuery query@(QueryInShelleyBasedEra shelleyEra _) = do + res <- liftIO $ queryNodeLocalState localNodeConnectInfo (Just $ chainTipToChainPoint chainTip) (QueryInEra query) case res of Right (Right pp) -> do let pp' = fromLedgerPParams shelleyEra pp @@ -196,12 +195,12 @@ queryRemoteProtocolParameters = do Left err -> liftTxGenError $ TxGenError $ show err case era of AnyCardanoEra ByronEra -> liftTxGenError $ TxGenError "queryRemoteProtocolParameters Byron not supported" - AnyCardanoEra ShelleyEra -> callQuery ShelleyEraInCardanoMode $ QueryInShelleyBasedEra ShelleyBasedEraShelley QueryProtocolParameters - AnyCardanoEra AllegraEra -> callQuery AllegraEraInCardanoMode $ QueryInShelleyBasedEra ShelleyBasedEraAllegra QueryProtocolParameters - AnyCardanoEra MaryEra -> callQuery MaryEraInCardanoMode $ QueryInShelleyBasedEra ShelleyBasedEraMary QueryProtocolParameters - AnyCardanoEra AlonzoEra -> callQuery AlonzoEraInCardanoMode $ QueryInShelleyBasedEra ShelleyBasedEraAlonzo QueryProtocolParameters - AnyCardanoEra BabbageEra -> callQuery BabbageEraInCardanoMode $ QueryInShelleyBasedEra ShelleyBasedEraBabbage QueryProtocolParameters - AnyCardanoEra ConwayEra -> callQuery ConwayEraInCardanoMode $ QueryInShelleyBasedEra ShelleyBasedEraConway QueryProtocolParameters + AnyCardanoEra ShelleyEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraShelley QueryProtocolParameters + AnyCardanoEra AllegraEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraAllegra QueryProtocolParameters + AnyCardanoEra MaryEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraMary QueryProtocolParameters + AnyCardanoEra AlonzoEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraAlonzo QueryProtocolParameters + AnyCardanoEra BabbageEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraBabbage QueryProtocolParameters + AnyCardanoEra ConwayEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraConway QueryProtocolParameters getProtocolParameters :: ActionM ProtocolParameters getProtocolParameters = do @@ -219,7 +218,7 @@ waitForEra era = do liftIO $ threadDelay 1_000_000 waitForEra era -localSubmitTx :: TxInMode CardanoMode -> ActionM (SubmitResult (TxValidationErrorInMode CardanoMode)) +localSubmitTx :: TxInMode -> ActionM (SubmitResult TxValidationErrorInCardanoMode) localSubmitTx tx = do submit <- getLocalSubmitTx ret <- liftIO $ submit tx @@ -401,10 +400,10 @@ selectCollateralFunds (Just walletName) = do Nothing -> throwE $ WalletError $ "selectCollateralFunds: collateral: era not supported :" ++ show (cardanoEra @era) Just p -> return (TxInsCollateral p $ map getFundTxIn collateralFunds, collateralFunds) -dumpToFile :: FilePath -> TxInMode CardanoMode -> ActionM () +dumpToFile :: FilePath -> TxInMode -> ActionM () dumpToFile filePath tx = liftIO $ dumpToFileIO filePath tx -dumpToFileIO :: FilePath -> TxInMode CardanoMode -> IO () +dumpToFileIO :: FilePath -> TxInMode -> IO () dumpToFileIO filePath tx = appendFile filePath ('\n' : show tx) initWallet :: String -> ActionM () diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Fund.hs b/bench/tx-generator/src/Cardano/TxGenerator/Fund.hs index 8819531e7d6..74131f74984 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Fund.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Fund.hs @@ -69,8 +69,8 @@ getFundKey (Fund (InAnyCardanoEra _ a)) = _fundSigningKey a -- | Converting a `TxOutValue` to `Lovelace` requires case analysis. getFundLovelace :: Fund -> Lovelace getFundLovelace (Fund (InAnyCardanoEra _ a)) = case _fundVal a of - TxOutAdaOnly _era l -> l - TxOutValue _era v -> selectLovelace v + TxOutValueByron l -> l + TxOutValueShelleyBased era v -> selectLovelace $ Api.fromLedgerValue era v -- TODO: facilitate casting KeyWitnesses between eras -- Note [Era transitions] -- | The `Fund` alternative is checked against `cardanoEra`, but diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Genesis.hs b/bench/tx-generator/src/Cardano/TxGenerator/Genesis.hs index a1e0cece136..56eebe5fdda 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Genesis.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Genesis.hs @@ -51,7 +51,7 @@ genesisSecureInitialFund networkId genesis srcKey destKey TxGenTxParams{txParamF Just (_, lovelace) -> let txOutValue :: TxOutValue era - txOutValue = mkTxOutValueAdaOnly $ lovelace - txParamFee + txOutValue = lovelaceToTxOutValue (shelleyBasedEra @era) $ lovelace - txParamFee in genesisExpenditure networkId srcKey destAddr txOutValue txParamFee txParamTTL destKey where destAddr = keyAddress @era networkId destKey diff --git a/bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs b/bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs index 1897f9b62df..8bcbd49ca20 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs @@ -72,7 +72,7 @@ genesisValue :: TxOutValue BabbageEra (genesisTxIn, genesisValue) = ( TxIn "900fc5da77a0747da53f7675cbb7d149d46779346dea2f879ab811ccc72a2162" (TxIx 0) - , lovelaceToTxOutValue BabbageEra $ Lovelace 90000000000000 + , lovelaceToTxOutValue ShelleyBasedEraBabbage $ Lovelace 90000000000000 ) genesisFund :: Fund diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Types.hs b/bench/tx-generator/src/Cardano/TxGenerator/Types.hs index c8d84205bf1..455037fe744 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Types.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Types.hs @@ -3,7 +3,6 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NumericUnderscores #-} -{-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-partial-fields #-} {-| @@ -16,8 +15,10 @@ module Cardano.TxGenerator.Types import GHC.Generics (Generic) import GHC.Natural +import Prettyprinter import Cardano.Api +import Cardano.Api.Pretty import Cardano.Api.Shelley (ProtocolParameters) import Cardano.Ledger.Crypto (StandardCrypto) @@ -130,18 +131,22 @@ data TxGenError where PlutusError :: Show e => !e -> TxGenError TxGenError :: !String -> TxGenError -deriving instance Show TxGenError +instance Show TxGenError where + show (ApiError e) = prettyToString $ "ApiError " <> parens (prettyError e) + show (ProtocolError e) = prettyToString $ "ProtocolError " <> parens (prettyError e) + show (PlutusError e) = prettyToString $ "ProtocolError " <> parens (pshow e) + show (TxGenError e) = prettyToString $ "ApiError " <> parens (pshow e) instance Semigroup TxGenError where TxGenError a <> TxGenError b = TxGenError (a <> b) - TxGenError a <> b = TxGenError (a <> show b) - a <> TxGenError b = TxGenError (show a <> b) - a <> b = TxGenError (show a <> show b) + TxGenError a <> b = TxGenError (a <> prettyToString (pshow b)) + a <> TxGenError b = TxGenError (prettyToString (pshow a) <> b) + a <> b = TxGenError $ prettyToString (pshow a <> pshow b) instance Error TxGenError where - displayError = \case - ApiError e -> displayError e - ProtocolError e -> displayError e + prettyError = \case + ApiError e -> prettyError e + ProtocolError e -> prettyError e _ -> "" {- diff --git a/bench/tx-generator/src/Cardano/TxGenerator/UTxO.hs b/bench/tx-generator/src/Cardano/TxGenerator/UTxO.hs index c51ca998c83..c053dac2844 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/UTxO.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/UTxO.hs @@ -34,13 +34,13 @@ mkUTxOVariant networkId key value , mkNewFund value ) where - mkTxOut v = TxOut (keyAddress @era networkId key) (lovelaceToTxOutValue (cardanoEra @era) v) TxOutDatumNone ReferenceScriptNone + mkTxOut v = TxOut (keyAddress @era networkId key) (lovelaceToTxOutValue (shelleyBasedEra @era) v) TxOutDatumNone ReferenceScriptNone mkNewFund :: Lovelace -> TxIx -> TxId -> Fund mkNewFund val txIx txId = Fund $ InAnyCardanoEra (cardanoEra @era) $ FundInEra { _fundTxIn = TxIn txId txIx , _fundWitness = KeyWitness KeyWitnessForSpending - , _fundVal = lovelaceToTxOutValue (cardanoEra @era ) val + , _fundVal = lovelaceToTxOutValue (shelleyBasedEra @era ) val , _fundSigningKey = Just key } @@ -70,7 +70,7 @@ mkUTxOScript networkId (script, txOutDatum) witness value Nothing -> error "mkUtxOScript: scriptDataSupportedInEra==Nothing" Just tag -> TxOut plutusScriptAddr - (lovelaceToTxOutValue (cardanoEra @era) v) + (lovelaceToTxOutValue (shelleyBasedEra @era) v) (TxOutDatumHash tag $ hashScriptDataBytes $ unsafeHashableScriptData txOutDatum) ReferenceScriptNone @@ -78,6 +78,6 @@ mkUTxOScript networkId (script, txOutDatum) witness value mkNewFund val txIx txId = Fund $ InAnyCardanoEra (cardanoEra @era) $ FundInEra { _fundTxIn = TxIn txId txIx , _fundWitness = witness - , _fundVal = lovelaceToTxOutValue (cardanoEra @era) val + , _fundVal = lovelaceToTxOutValue (shelleyBasedEra @era) val , _fundSigningKey = Nothing } diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Utils.hs b/bench/tx-generator/src/Cardano/TxGenerator/Utils.hs index 1bf6560f114..b45013b8534 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Utils.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Utils.hs @@ -77,16 +77,7 @@ mkTxValidityUpperBound :: forall era. IsShelleyBasedEra era => SlotNo -> TxValid mkTxValidityUpperBound slotNo = TxValidityUpperBound (fromJust $ forEraMaybeEon (cardanoEra @era)) (Just slotNo) --- | `mkTxOutValueAdaOnly` reinterprets the `Either` returned by --- `multiAssetSupportedInEra` with `TxOutValue` constructors. -mkTxOutValueAdaOnly :: forall era . IsShelleyBasedEra era => Lovelace -> TxOutValue era -mkTxOutValueAdaOnly l = caseByronToAllegraOrMaryEraOnwards - (`TxOutAdaOnly` l) - (\p -> TxOutValue p $ lovelaceToValue l) - (cardanoEra @era) - -- | `mkTxInModeCardano` never uses the `TxInByronSpecial` constructor -- because its type enforces it being a Shelley-based era. -mkTxInModeCardano :: forall era . IsShelleyBasedEra era => Tx era -> TxInMode CardanoMode -mkTxInModeCardano tx = - TxInMode tx (fromJust $ toEraInMode (cardanoEra @era) CardanoMode) +mkTxInModeCardano :: forall era . IsCardanoEra era => Tx era -> TxInMode +mkTxInModeCardano = TxInMode cardanoEra diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 6d9980c4541..ed45bcc5fab 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -97,7 +97,7 @@ library , attoparsec , base16-bytestring , bytestring - , cardano-api ^>= 8.29 + , cardano-api ^>= 8.33 , cardano-binary , cardano-cli ^>= 8.13 , cardano-crypto-class @@ -138,6 +138,7 @@ library , streaming , strict-stm , cardano-ledger-shelley + , prettyprinter , stm , text , time diff --git a/cardano-node-chairman/app/Cardano/Chairman.hs b/cardano-node-chairman/app/Cardano/Chairman.hs index 20786c1f2b0..21beeb3b2bc 100644 --- a/cardano-node-chairman/app/Cardano/Chairman.hs +++ b/cardano-node-chairman/app/Cardano/Chairman.hs @@ -5,7 +5,6 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} -{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-} @@ -18,7 +17,6 @@ import Control.Monad.Class.MonadAsync import Control.Monad.Class.MonadThrow import Control.Monad.Class.MonadTimer.SI import Control.Tracer -import Data.Coerce (coerce) import qualified Data.List as List import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map @@ -27,6 +25,7 @@ import Data.Proxy (Proxy (..)) import Data.Word (Word64) import Ouroboros.Consensus.Block.Abstract +import Ouroboros.Consensus.Cardano.Block import Ouroboros.Consensus.Config.SecurityParam import Ouroboros.Network.AnchoredFragment (Anchor, AnchoredFragment) @@ -56,7 +55,7 @@ chairmanTest :: () -> DiffTime -> BlockNo -> [SocketPath] - -> ConsensusModeParams CardanoMode + -> ConsensusModeParams -> SecurityParam -> IO () chairmanTest tracer nw runningTime progressThreshold socketPaths cModeParams secParam = do @@ -65,8 +64,7 @@ chairmanTest tracer nw runningTime progressThreshold socketPaths cModeParams sec -- Run the chairman and get the final snapshot of the chain from each node. chainsSnapshot <- - obtainGetHeader (consensusModeOnly cModeParams) $ - runChairman + runChairman tracer nw runningTime @@ -78,8 +76,7 @@ chairmanTest tracer nw runningTime progressThreshold socketPaths cModeParams sec -- Test if we achieved consensus consensusSuccess <- either throwIO return $ - obtainHasHeader (consensusModeOnly cModeParams) $ - consensusCondition (consensusModeOnly cModeParams) chainsSnapshot secParam + consensusCondition chainsSnapshot secParam traceWith tracer (show consensusSuccess) @@ -109,14 +106,10 @@ instance Exception ConsensusFailure where -- the intersection of each pair is within K blocks of each tip. consensusCondition :: () - => ConsensusBlockForMode CardanoMode ~ blk - => HasHeader (Header blk) - => ConvertRawHash blk - => ConsensusMode CardanoMode - -> Map PeerId (AnchoredFragment (Header blk)) + => Map PeerId (AnchoredFragment (Header (CardanoBlock StandardCrypto))) -> SecurityParam -> Either ConsensusFailure ConsensusSuccess -consensusCondition cMode chains securityParam = +consensusCondition chains securityParam = -- The (forkTooLong . chainForkPoints) predicate is not transitive. -- As a consequence, we need to check it between all the pairs of chains: let forks = @@ -126,14 +119,14 @@ consensusCondition cMode chains securityParam = ] in case List.find (forkTooLong . snd) forks of Just ((peerid1, peerid2), (intersection, tip1, tip2)) ->do - let apiTip1 = fromConsensusTip cMode $ AF.anchorToTip tip1 - apiTip2 = fromConsensusTip cMode $ AF.anchorToTip tip2 + let apiTip1 = AF.anchorToTip tip1 + apiTip2 = AF.anchorToTip tip2 intersectChainPt = fromAnchor intersection Left $ ConsensusFailure - (peerid1, apiTip1) - (peerid2, apiTip2) + (peerid1, fromConsensusTip apiTip1) + (peerid2, fromConsensusTip apiTip2) intersectChainPt securityParam Nothing -> @@ -144,7 +137,7 @@ consensusCondition cMode chains securityParam = $ List.minimumBy (comparing AF.anchorToBlockNo) [ intersection | (_,(intersection,_,_)) <- forks ]) -- all the chain tips: - [ (peerid, fromConsensusTip cMode $ AF.anchorToTip (AF.headAnchor chain)) + [ (peerid, fromConsensusTip $ AF.anchorToTip (AF.headAnchor chain)) | (peerid, chain) <- Map.toList chains ] where chainForkPoints @@ -244,10 +237,8 @@ progressCondition minBlockNo (ConsensusSuccess _ tips) = do getBlockNo (ChainTip _ _ bNum) = bNum getBlockNo ChainTipAtGenesis = 0 -runChairman :: forall blk. () - => ConsensusBlockForMode CardanoMode ~ blk - => GetHeader (ConsensusBlockForMode CardanoMode) - => Tracer IO String +runChairman :: + Tracer IO String -> NetworkId -- ^ Security parameter, if a fork is deeper than it 'runChairman' -- will throw an exception. @@ -255,15 +246,15 @@ runChairman :: forall blk. () -- ^ Run for this much time. -> [SocketPath] -- ^ Local socket directory - -> ConsensusModeParams CardanoMode + -> ConsensusModeParams -> SecurityParam -> IO (Map SocketPath (AF.AnchoredSeq (WithOrigin SlotNo) - (Anchor (Header blk)) - (Header blk))) + (Anchor (Header (CardanoBlock StandardCrypto))) + (Header (CardanoBlock StandardCrypto)))) runChairman tracer networkId runningTime socketPaths cModeParams secParam = do - let initialChains :: Map SocketPath (AF.AnchoredSeq (WithOrigin SlotNo) (Anchor (Header blk)) (Header blk)) + let initialChains :: Map SocketPath (AF.AnchoredSeq (WithOrigin SlotNo) (Anchor (Header (CardanoBlock StandardCrypto))) (Header (CardanoBlock StandardCrypto))) initialChains = Map.fromList [ (socketPath, AF.Empty AF.AnchorGenesis) | socketPath <- socketPaths] @@ -278,7 +269,7 @@ runChairman tracer networkId runningTime socketPaths cModeParams secParam = do , localNodeSocketPath = socketPath } chairmanChainSyncClient = LocalChainSyncClient $ - chainSyncClient (showTracing tracer) socketPath chainsVar cModeParams secParam + chainSyncClient (showTracing tracer) socketPath chainsVar secParam protocolsInMode = LocalNodeClientProtocols { localChainSyncClient = chairmanChainSyncClient , localTxSubmissionClient = Nothing @@ -310,22 +301,19 @@ addBlock sockPath chainsVar blk = -- | Rollback a single block. If the rollback point is not found, we simply -- error. It should never happen if the security parameter is set up correctly. -rollback :: forall blk. () - => ConsensusBlockForMode CardanoMode ~ blk - => HasHeader (Header blk) - => SocketPath - -> StrictTVar IO (Map SocketPath (AnchoredFragment (Header (ConsensusBlockForMode CardanoMode)))) - -> ConsensusMode CardanoMode +rollback :: + SocketPath + -> StrictTVar IO (Map SocketPath (AnchoredFragment (Header (CardanoBlock StandardCrypto)))) -> ChainPoint -> STM IO () -rollback sockPath chainsVar cMode p = +rollback sockPath chainsVar p = modifyTVar chainsVar (Map.adjust fn sockPath) where - p' :: Point (Header (ConsensusBlockForMode CardanoMode)) - p' = coerce $ toConsensusPointInMode cMode p + p' :: Point (Header (CardanoBlock StandardCrypto)) + p' = toConsensusPointHF p - fn :: AnchoredFragment (Header (ConsensusBlockForMode CardanoMode)) - -> AnchoredFragment (Header (ConsensusBlockForMode CardanoMode)) + fn :: AnchoredFragment (Header (CardanoBlock StandardCrypto)) + -> AnchoredFragment (Header (CardanoBlock StandardCrypto)) fn cf = case AF.rollback p' cf of Nothing -> error "rollback error: rollback beyond chain fragment" Just cf' -> cf' @@ -333,76 +321,57 @@ rollback sockPath chainsVar cMode p = -- Chain-Sync client type ChairmanTrace' = ConsensusSuccess -type ChainVar = StrictTVar IO (Map SocketPath (AnchoredFragment (Header (ConsensusBlockForMode CardanoMode)))) +type ChainVar = StrictTVar IO (Map SocketPath (AnchoredFragment (Header (CardanoBlock StandardCrypto)))) -- | 'chainSyncClient which build chain fragment; on every roll forward it will -- check if there is consensus on immutable chain. chainSyncClient - :: GetHeader (ConsensusBlockForMode CardanoMode) - => Tracer IO ChairmanTrace' + :: Tracer IO ChairmanTrace' -> SocketPath -> ChainVar - -> ConsensusModeParams CardanoMode -> SecurityParam - -> ChainSyncClient (BlockInMode CardanoMode) ChainPoint ChainTip IO () -chainSyncClient tracer sockPath chainsVar cModeP secParam = ChainSyncClient $ pure $ + -> ChainSyncClient BlockInMode ChainPoint ChainTip IO () +chainSyncClient tracer sockPath chainsVar secParam = ChainSyncClient $ pure $ -- Notify the core node about the our latest points at which we are -- synchronised. This client is not persistent and thus it just -- synchronises from the genesis block. A real implementation should send -- a list of points up to a point which is k blocks deep. SendMsgFindIntersect - [fromConsensusPointInMode (consensusModeOnly cModeP) Block.genesisPoint] + [ChainPointAtGenesis] ClientStIntersect { recvMsgIntersectFound = \_ _ -> ChainSyncClient $ pure clientStIdle , recvMsgIntersectNotFound = \ _ -> ChainSyncClient $ pure clientStIdle } where - clientStIdle :: ClientStIdle (BlockInMode CardanoMode) ChainPoint ChainTip IO () + clientStIdle :: ClientStIdle BlockInMode ChainPoint ChainTip IO () clientStIdle = SendMsgRequestNext clientStNext (pure clientStNext) - clientStNext :: ClientStNext (BlockInMode CardanoMode) ChainPoint ChainTip IO () + clientStNext :: ClientStNext BlockInMode ChainPoint ChainTip IO () clientStNext = ClientStNext { recvMsgRollForward = \blk _tip -> ChainSyncClient $ do -- add block & check if there is consensus on immutable chain -- trace the decision or error res <- atomically $ do addBlock sockPath chainsVar $ toConsensusBlock blk - obtainHasHeader (consensusModeOnly cModeP) $ checkConsensus (consensusModeOnly cModeP) chainsVar secParam + checkConsensus chainsVar secParam traceWith tracer res pure clientStIdle , recvMsgRollBackward = \point _tip -> ChainSyncClient $ do -- rollback & check res <- atomically $ do - rollback sockPath chainsVar (consensusModeOnly cModeP) point - obtainHasHeader (consensusModeOnly cModeP) $ checkConsensus (consensusModeOnly cModeP) chainsVar secParam + rollback sockPath chainsVar point + checkConsensus chainsVar secParam traceWith tracer res pure clientStIdle } -- Helpers -obtainHasHeader - :: ConsensusBlockForMode CardanoMode ~ blk - => ConsensusMode CardanoMode - -> ((HasHeader (Header blk), ConvertRawHash (ConsensusBlockForMode CardanoMode)) => a) - -> a -obtainHasHeader CardanoMode f = f - -obtainGetHeader - :: ConsensusMode CardanoMode - -> ( (GetHeader (ConsensusBlockForMode CardanoMode) - ) => a) - -> a -obtainGetHeader CardanoMode f = f - -- | Check that all nodes agree with each other, within the security parameter. checkConsensus - :: HasHeader (Header (ConsensusBlockForMode CardanoMode)) - => ConvertRawHash (ConsensusBlockForMode CardanoMode) - => ConsensusMode CardanoMode - -> ChainVar + :: ChainVar -> SecurityParam -> STM IO ConsensusSuccess -checkConsensus cMode chainsVar secParam = do +checkConsensus chainsVar secParam = do chainsSnapshot <- readTVar chainsVar - either throwIO return $ consensusCondition cMode chainsSnapshot secParam + either throwIO return $ consensusCondition chainsSnapshot secParam diff --git a/cardano-node-chairman/app/Cardano/Chairman/Commands/Run.hs b/cardano-node-chairman/app/Cardano/Chairman/Commands/Run.hs index 786276a3796..5209129e618 100644 --- a/cardano-node-chairman/app/Cardano/Chairman/Commands/Run.hs +++ b/cardano-node-chairman/app/Cardano/Chairman/Commands/Run.hs @@ -11,6 +11,7 @@ module Cardano.Chairman.Commands.Run import Cardano.Prelude (ConvertText (..)) import qualified Cardano.Api as Api +import Cardano.Api.Pretty import Control.Monad.Class.MonadTime.SI (DiffTime) import Control.Monad.IO.Class (MonadIO (..)) @@ -116,7 +117,7 @@ run RunOpts p :: SomeConsensusProtocol <- case eitherSomeProtocol of - Left err -> putStrLn (displayError err) >> exitFailure + Left err -> putStrLn (prettyToString $ prettyError err) >> exitFailure Right p -> pure p let (k , nId) = case p of @@ -139,7 +140,7 @@ run RunOpts return () where - getConsensusMode :: SecurityParam -> NodeProtocolConfiguration -> ConsensusModeParams CardanoMode + getConsensusMode :: SecurityParam -> NodeProtocolConfiguration -> ConsensusModeParams getConsensusMode (SecurityParam k) ncProtocolConfig = case ncProtocolConfig of NodeProtocolConfigurationCardano{} -> diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 8c9cea0753d..cdca73c5dda 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -137,7 +137,7 @@ library , async , base16-bytestring , bytestring - , cardano-api ^>= 8.29 + , cardano-api ^>= 8.33 , cardano-crypto-class , cardano-crypto-wrapper , cardano-git-rev diff --git a/cardano-node/src/Cardano/Node/Protocol.hs b/cardano-node/src/Cardano/Node/Protocol.hs index 1a17209a50c..64fdb4a8194 100644 --- a/cardano-node/src/Cardano/Node/Protocol.hs +++ b/cardano-node/src/Cardano/Node/Protocol.hs @@ -55,7 +55,6 @@ data ProtocolInstantiationError = instance Error ProtocolInstantiationError where - displayError (ByronProtocolInstantiationError err) = displayError err - displayError (ShelleyProtocolInstantiationError err) = displayError err - displayError (CardanoProtocolInstantiationError err) = displayError err - + prettyError (ByronProtocolInstantiationError err) = prettyError err + prettyError (ShelleyProtocolInstantiationError err) = prettyError err + prettyError (CardanoProtocolInstantiationError err) = prettyError err diff --git a/cardano-node/src/Cardano/Node/Protocol/Alonzo.hs b/cardano-node/src/Cardano/Node/Protocol/Alonzo.hs index 39f5a779e09..1f834727b6b 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Alonzo.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Alonzo.hs @@ -9,6 +9,7 @@ module Cardano.Node.Protocol.Alonzo ) where import Cardano.Api +import Cardano.Api.Pretty import qualified Cardano.Ledger.Alonzo.Genesis as Alonzo @@ -44,12 +45,11 @@ data AlonzoProtocolInstantiationError deriving Show instance Error AlonzoProtocolInstantiationError where - displayError (InvalidCostModelError fp) = - "Invalid cost model: " <> show fp - displayError (CostModelExtractionError fp) = - "Error extracting the cost model at: " <> show fp - displayError (AlonzoCostModelFileError err) = - displayError err - displayError (AlonzoCostModelDecodeError fp err) = - "Error decoding cost model at: " <> show fp <> " Error: " <> err - + prettyError (InvalidCostModelError fp) = + "Invalid cost model: " <> pshow fp + prettyError (CostModelExtractionError fp) = + "Error extracting the cost model at: " <> pshow fp + prettyError (AlonzoCostModelFileError err) = + prettyError err + prettyError (AlonzoCostModelDecodeError fp err) = + "Error decoding cost model at: " <> pshow fp <> " Error: " <> pshow err diff --git a/cardano-node/src/Cardano/Node/Protocol/Byron.hs b/cardano-node/src/Cardano/Node/Protocol/Byron.hs index 0a3f50998c4..f60997ae4d6 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Byron.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Byron.hs @@ -12,7 +12,7 @@ module Cardano.Node.Protocol.Byron , readLeaderCredentials ) where -import Cardano.Prelude (ConvertText (..), canonicalDecodePretty) +import Cardano.Prelude (canonicalDecodePretty) import Control.Monad.Except (throwError) import Control.Monad.IO.Class (MonadIO (..)) @@ -21,9 +21,9 @@ import Control.Monad.Trans.Except.Extra (bimapExceptT, firstExceptT, h import qualified Data.ByteString.Lazy as LB import Data.Maybe (fromMaybe) import Data.Text (Text) -import qualified Data.Text as Text import Cardano.Api.Byron +import Cardano.Api.Pretty import qualified Cardano.Chain.Genesis as Genesis import qualified Cardano.Chain.Update as Update import qualified Cardano.Chain.UTxO as UTxO @@ -173,26 +173,26 @@ data ByronProtocolInstantiationError = deriving Show instance Error ByronProtocolInstantiationError where - displayError (CanonicalDecodeFailure fp failure) = - "Canonical decode failure in " <> fp - <> " Canonical failure: " <> Text.unpack failure - displayError (GenesisHashMismatch actual expected) = - "Wrong Byron genesis file: the actual hash is " <> show actual + prettyError (CanonicalDecodeFailure fp failure) = + "Canonical decode failure in " <> pshow fp + <> " Canonical failure: " <> pshow failure + prettyError (GenesisHashMismatch actual expected) = + "Wrong Byron genesis file: the actual hash is " <> pshow actual <> ", but the expected Byron genesis hash given in the node configuration " - <> "file is " <> show expected - displayError DelegationCertificateFilepathNotSpecified = + <> "file is " <> pshow expected + prettyError DelegationCertificateFilepathNotSpecified = "Delegation certificate filepath not specified" --TODO: Implement configuration error render function in cardano-ledger - displayError (GenesisConfigurationError fp genesisConfigError) = - "Genesis configuration error in: " <> toS fp - <> " Error: " <> show genesisConfigError - displayError (GenesisReadError fp err) = - "There was an error parsing the genesis file: " <> toS fp - <> " Error: " <> show err + prettyError (GenesisConfigurationError fp genesisConfigError) = + "Genesis configuration error in: " <> pshow fp + <> " Error: " <> pshow genesisConfigError + prettyError (GenesisReadError fp err) = + "There was an error parsing the genesis file: " <> pshow fp + <> " Error: " <> pshow err -- TODO: Implement ByronLeaderCredentialsError render function in ouroboros-network - displayError (CredentialsError byronLeaderCredentialsError) = - "Byron leader credentials error: " <> show byronLeaderCredentialsError - displayError (SigningKeyDeserialiseFailure fp) = - "Signing key deserialisation error in: " <> toS fp - displayError SigningKeyFilepathNotSpecified = + prettyError (CredentialsError byronLeaderCredentialsError) = + "Byron leader credentials error: " <> pshow byronLeaderCredentialsError + prettyError (SigningKeyDeserialiseFailure fp) = + "Signing key deserialisation error in: " <> pshow fp + prettyError SigningKeyFilepathNotSpecified = "Signing key filepath not specified" diff --git a/cardano-node/src/Cardano/Node/Protocol/Cardano.hs b/cardano-node/src/Cardano/Node/Protocol/Cardano.hs index 235dc7d3bad..32a87c1811a 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Cardano.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Cardano.hs @@ -341,15 +341,15 @@ data CardanoProtocolInstantiationError = deriving Show instance Error CardanoProtocolInstantiationError where - displayError (CardanoProtocolInstantiationErrorByron err) = - displayError err - displayError (CardanoProtocolInstantiationShelleyGenesisReadError err) = - "Shelley related: " <> displayError err - displayError (CardanoProtocolInstantiationAlonzoGenesisReadError err) = - "Alonzo related: " <> displayError err - displayError (CardanoProtocolInstantiationConwayGenesisReadError err) = - "Conway related : " <> displayError err - displayError (CardanoProtocolInstantiationPraosLeaderCredentialsError err) = - displayError err - displayError (CardanoProtocolInstantiationErrorAlonzo err) = - displayError err + prettyError (CardanoProtocolInstantiationErrorByron err) = + prettyError err + prettyError (CardanoProtocolInstantiationShelleyGenesisReadError err) = + "Shelley related: " <> prettyError err + prettyError (CardanoProtocolInstantiationAlonzoGenesisReadError err) = + "Alonzo related: " <> prettyError err + prettyError (CardanoProtocolInstantiationConwayGenesisReadError err) = + "Conway related : " <> prettyError err + prettyError (CardanoProtocolInstantiationPraosLeaderCredentialsError err) = + prettyError err + prettyError (CardanoProtocolInstantiationErrorAlonzo err) = + prettyError err diff --git a/cardano-node/src/Cardano/Node/Protocol/Conway.hs b/cardano-node/src/Cardano/Node/Protocol/Conway.hs index ec0d4bd79e6..626fa5e8c3d 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Conway.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Conway.hs @@ -9,6 +9,7 @@ module Cardano.Node.Protocol.Conway ) where import Cardano.Api +import Cardano.Api.Pretty import Ouroboros.Consensus.Shelley.Eras (StandardCrypto) @@ -46,12 +47,11 @@ data ConwayProtocolInstantiationError deriving Show instance Error ConwayProtocolInstantiationError where - displayError (InvalidCostModelError fp) = - "Invalid cost model: " <> show fp - displayError (CostModelExtractionError fp) = - "Error extracting the cost model at: " <> show fp - displayError (ConwayCostModelFileError err) = - displayError err - displayError (ConwayCostModelDecodeError fp err) = - "Error decoding cost model at: " <> show fp <> " Error: " <> err - + prettyError (InvalidCostModelError fp) = + "Invalid cost model: " <> pshow fp + prettyError (CostModelExtractionError fp) = + "Error extracting the cost model at: " <> pshow fp + prettyError (ConwayCostModelFileError err) = + prettyError err + prettyError (ConwayCostModelDecodeError fp err) = + "Error decoding cost model at: " <> pshow fp <> " Error: " <> pshow err diff --git a/cardano-node/src/Cardano/Node/Protocol/Shelley.hs b/cardano-node/src/Cardano/Node/Protocol/Shelley.hs index 2cc1adb3497..7140e3fa90f 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Shelley.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Shelley.hs @@ -21,11 +21,11 @@ module Cardano.Node.Protocol.Shelley , validateGenesis ) where -import Cardano.Prelude (ConvertText (..)) import Control.Exception (IOException) import Control.Monad.Except (ExceptT, MonadError (..)) import qualified Cardano.Api as Api +import Cardano.Api.Pretty import Cardano.Api.Shelley hiding (FileError) import qualified Data.Aeson as Aeson @@ -280,9 +280,9 @@ data ShelleyProtocolInstantiationError = deriving Show instance Error ShelleyProtocolInstantiationError where - displayError (GenesisReadError err) = displayError err - displayError (GenesisValidationError err) = displayError err - displayError (PraosLeaderCredentialsError err) = displayError err + prettyError (GenesisReadError err) = prettyError err + prettyError (GenesisValidationError err) = prettyError err + prettyError (PraosLeaderCredentialsError err) = prettyError err data GenesisReadError = @@ -292,26 +292,26 @@ data GenesisReadError = deriving Show instance Error GenesisReadError where - displayError (GenesisReadFileError fp err) = + prettyError (GenesisReadFileError fp err) = "There was an error reading the genesis file: " - <> toS fp <> " Error: " <> show err + <> pshow fp <> " Error: " <> pshow err - displayError (GenesisHashMismatch actual expected) = - "Wrong genesis file: the actual hash is " <> show actual + prettyError (GenesisHashMismatch actual expected) = + "Wrong genesis file: the actual hash is " <> pshow actual <> ", but the expected genesis hash given in the node " - <> "configuration file is " <> show expected + <> "configuration file is " <> pshow expected - displayError (GenesisDecodeError fp err) = + prettyError (GenesisDecodeError fp err) = "There was an error parsing the genesis file: " - <> toS fp <> " Error: " <> show err + <> pshow fp <> " Error: " <> pshow err newtype GenesisValidationError = GenesisValidationErrors [Shelley.ValidationErr] deriving Show instance Error GenesisValidationError where - displayError (GenesisValidationErrors vErrs) = - T.unpack (T.unlines (map Shelley.describeValidationErr vErrs)) + prettyError (GenesisValidationErrors vErrs) = + pshow (T.unlines (map Shelley.describeValidationErr vErrs)) data PraosLeaderCredentialsError = @@ -331,21 +331,21 @@ data PraosLeaderCredentialsError = deriving Show instance Error PraosLeaderCredentialsError where - displayError (CredentialsReadError fp err) = + prettyError (CredentialsReadError fp err) = "There was an error reading a credentials file: " - <> toS fp <> " Error: " <> show err + <> pshow fp <> " Error: " <> pshow err - displayError (EnvelopeParseError fp err) = + prettyError (EnvelopeParseError fp err) = "There was an error parsing a credentials envelope: " - <> toS fp <> " Error: " <> show err - - displayError (FileError fileErr) = displayError fileErr - displayError (MismatchedKesKey kesFp certFp) = - "The KES key provided at: " <> show kesFp - <> " does not match the KES key specified in the operational certificate at: " <> show certFp - displayError OCertNotSpecified = missingFlagMessage "shelley-operational-certificate" - displayError VRFKeyNotSpecified = missingFlagMessage "shelley-vrf-key" - displayError KESKeyNotSpecified = missingFlagMessage "shelley-kes-key" + <> pshow fp <> " Error: " <> pshow err + + prettyError (FileError fileErr) = prettyError fileErr + prettyError (MismatchedKesKey kesFp certFp) = + "The KES key provided at: " <> pshow kesFp + <> " does not match the KES key specified in the operational certificate at: " <> pshow certFp + prettyError OCertNotSpecified = pshow $ missingFlagMessage "shelley-operational-certificate" + prettyError VRFKeyNotSpecified = pshow $ missingFlagMessage "shelley-vrf-key" + prettyError KESKeyNotSpecified = pshow $ missingFlagMessage "shelley-kes-key" missingFlagMessage :: String -> String missingFlagMessage flag = diff --git a/cardano-node/src/Cardano/Node/Run.hs b/cardano-node/src/Cardano/Node/Run.hs index f71ac5c73d8..aa94cce13a0 100644 --- a/cardano-node/src/Cardano/Node/Run.hs +++ b/cardano-node/src/Cardano/Node/Run.hs @@ -23,6 +23,7 @@ module Cardano.Node.Run import Cardano.Api (File (..), FileDirection (..)) import qualified Cardano.Api as Api +import Cardano.Api.Pretty import Cardano.Prelude (FatalError (..), bool, (:~:) (..)) @@ -160,7 +161,7 @@ runNode cmdPc = do p :: SomeConsensusProtocol <- case eitherSomeProtocol of - Left err -> putStrLn (Api.displayError err) >> exitFailure + Left err -> putStrLn (prettyToString (Api.prettyError err)) >> exitFailure Right p -> pure p let networkMagic :: Api.NetworkMagic = diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs index d359c75ff88..7a2ef35bb68 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs @@ -28,12 +28,12 @@ import qualified Cardano.Crypto.VRF.Class as Crypto import Cardano.Ledger.Allegra.Rules (AllegraUtxoPredFailure) import qualified Cardano.Ledger.Allegra.Rules as Allegra import qualified Cardano.Ledger.Allegra.Scripts as Allegra +import qualified Cardano.Ledger.Alonzo.Plutus.TxInfo as Alonzo import qualified Cardano.Ledger.Alonzo.PlutusScriptApi as Alonzo import Cardano.Ledger.Alonzo.Rules (AlonzoBbodyPredFailure (..), AlonzoUtxoPredFailure, AlonzoUtxosPredFailure, AlonzoUtxowPredFailure (..)) import qualified Cardano.Ledger.Alonzo.Rules as Alonzo import qualified Cardano.Ledger.Alonzo.Tx as Alonzo -import qualified Cardano.Ledger.Alonzo.Plutus.TxInfo as Alonzo import qualified Cardano.Ledger.Api as Ledger import Cardano.Ledger.Babbage.Rules (BabbageUtxoPredFailure, BabbageUtxowPredFailure) import qualified Cardano.Ledger.Babbage.Rules as Babbage diff --git a/cardano-node/test/Test/Cardano/Node/FilePermissions.hs b/cardano-node/test/Test/Cardano/Node/FilePermissions.hs index 8bd6c11b12f..21652222dde 100644 --- a/cardano-node/test/Test/Cardano/Node/FilePermissions.hs +++ b/cardano-node/test/Test/Cardano/Node/FilePermissions.hs @@ -18,6 +18,7 @@ import Data.Foldable import System.Directory (removeFile) import Cardano.Api +import Cardano.Api.Pretty import Cardano.Node.Run (checkVRFFilePermissions) import Control.Exception (bracket) import Control.Monad (Monad (..)) @@ -68,7 +69,7 @@ createFileWithOwnerPermissions :: HasTextEnvelope a => File () Out -> a -> Prope createFileWithOwnerPermissions targetfp value = do result <- liftIO $ writeLazyByteStringFileWithOwnerPermissions targetfp $ textEnvelopeToJSON Nothing value case result of - Left err -> failWith Nothing $ displayError @(FileError ()) err + Left err -> failWith Nothing $ prettyToString $ prettyError @(FileError ()) err Right () -> return () #ifdef UNIX diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index b32f53cc5b9..03e0c0e4304 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -39,7 +39,7 @@ library , aeson , async , bytestring - , cardano-api ^>= 8.29 + , cardano-api ^>= 8.33 , cardano-binary , cardano-cli ^>= 8.13 , cardano-crypto-class ^>= 2.1.2 diff --git a/cardano-submit-api/src/Cardano/TxSubmit/CLI/Types.hs b/cardano-submit-api/src/Cardano/TxSubmit/CLI/Types.hs index cf1f58cec29..c6579a301f8 100644 --- a/cardano-submit-api/src/Cardano/TxSubmit/CLI/Types.hs +++ b/cardano-submit-api/src/Cardano/TxSubmit/CLI/Types.hs @@ -4,13 +4,13 @@ module Cardano.TxSubmit.CLI.Types , TxSubmitNodeParams (..) ) where -import Cardano.Api (AnyConsensusModeParams, NetworkId (..), SocketPath) +import Cardano.Api (ConsensusModeParams, NetworkId (..), SocketPath) import Cardano.TxSubmit.Rest.Types (WebserverConfig) -- | The product type of all command line arguments data TxSubmitNodeParams = TxSubmitNodeParams { tspConfigFile :: !ConfigFile - , tspProtocol :: !AnyConsensusModeParams + , tspProtocol :: !ConsensusModeParams , tspNetworkId :: !NetworkId , tspSocketPath :: !SocketPath , tspWebserverConfig :: !WebserverConfig diff --git a/cardano-submit-api/src/Cardano/TxSubmit/Types.hs b/cardano-submit-api/src/Cardano/TxSubmit/Types.hs index 14f9ed9349f..834de750f48 100644 --- a/cardano-submit-api/src/Cardano/TxSubmit/Types.hs +++ b/cardano-submit-api/src/Cardano/TxSubmit/Types.hs @@ -16,7 +16,8 @@ module Cardano.TxSubmit.Types , renderTxCmdError ) where -import Cardano.Api (AnyCardanoEra, AnyConsensusMode (..), Error (..), TxId, textShow) +import Cardano.Api (Error (..), TxId, textShow) +import Cardano.Api.Pretty import Cardano.Binary (DecoderError) import Data.Aeson (ToJSON (..), Value (..)) import Data.ByteString.Char8 (ByteString) @@ -30,7 +31,6 @@ import Servant (Accept (..), JSON, MimeRender (..), MimeUnrender (..), import Servant.API.Generic (ToServantApi, (:-)) import qualified Data.ByteString.Lazy.Char8 as LBS -import qualified Data.List as L newtype TxSubmitPort = TxSubmitPort Int @@ -40,7 +40,7 @@ newtype RawCborDecodeError = RawCborDecodeError [DecoderError] deriving (Eq, Show) instance Error RawCborDecodeError where - displayError (RawCborDecodeError decodeErrors) = "RawCborDecodeError decode error: \n" <> L.intercalate " \n" (fmap show decodeErrors) + prettyError (RawCborDecodeError decodeErrors) = "RawCborDecodeError decode error: " <> pshow (fmap pshow decodeErrors) -- | An error that can occur in the transaction submission web API. data TxSubmitWebApiError @@ -54,7 +54,6 @@ newtype EnvSocketError = CliEnvVarLookup Text deriving (Eq, Show) data TxCmdError = TxCmdSocketEnvError EnvSocketError - | TxCmdEraConsensusModeMismatch !AnyConsensusMode !AnyCardanoEra | TxCmdTxReadError !RawCborDecodeError | TxCmdTxSubmitError !Text | TxCmdTxSubmitErrorEraMismatch !EraMismatch @@ -67,7 +66,6 @@ convertJson = String . renderTxSubmitWebApiError renderTxCmdError :: TxCmdError -> Text renderTxCmdError (TxCmdSocketEnvError socketError) = "socket env error " <> textShow socketError -renderTxCmdError (TxCmdEraConsensusModeMismatch mode era) = "era consensus mode mismatch" <> textShow mode <> " " <> textShow era renderTxCmdError (TxCmdTxReadError envelopeError) = "transaction read error " <> textShow envelopeError renderTxCmdError (TxCmdTxSubmitError msg) = "transaction submit error " <> msg renderTxCmdError (TxCmdTxSubmitErrorEraMismatch eraMismatch) = "transaction submit era mismatch" <> textShow eraMismatch diff --git a/cardano-submit-api/src/Cardano/TxSubmit/Web.hs b/cardano-submit-api/src/Cardano/TxSubmit/Web.hs index 9b7c2e59797..b4278d322cf 100644 --- a/cardano-submit-api/src/Cardano/TxSubmit/Web.hs +++ b/cardano-submit-api/src/Cardano/TxSubmit/Web.hs @@ -1,6 +1,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_GHC -Wno-unused-imports #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} @@ -10,15 +11,13 @@ module Cardano.TxSubmit.Web ( runTxSubmitServer ) where -import Cardano.Api (AllegraEra, AnyCardanoEra (AnyCardanoEra), - AnyConsensusMode (AnyConsensusMode), AnyConsensusModeParams (..), AsType (..), - CardanoEra (..), Error (..), FromSomeType (..), HasTypeProxy (AsType), - InAnyCardanoEra (..), +import Cardano.Api (AllegraEra, AnyCardanoEra (AnyCardanoEra), AsType (..), + CardanoEra (..), ConsensusModeParams (..), Error (..), FromSomeType (..), + HasTypeProxy (AsType), InAnyCardanoEra (..), IsCardanoEra (..), LocalNodeConnectInfo (LocalNodeConnectInfo, localConsensusModeParams, localNodeNetworkId, localNodeSocketPath), NetworkId, SerialiseAsCBOR (..), ShelleyEra, SocketPath, ToJSON, Tx, TxId (..), - TxInMode (TxInMode), - TxValidationErrorInMode (TxValidationEraMismatch, TxValidationErrorInMode), - consensusModeOnly, getTxBody, getTxId, submitTxToNodeLocal, toEraInMode) + TxInMode (TxInMode), TxValidationErrorInCardanoMode (..), getTxBody, getTxId, + submitTxToNodeLocal) import Cardano.Binary (DecoderError (..)) import Cardano.BM.Trace (Trace, logInfo) @@ -27,7 +26,7 @@ import Cardano.TxSubmit.Metrics (TxSubmitMetrics (..)) import Cardano.TxSubmit.Rest.Types (WebserverConfig (..), toWarpSettings) import qualified Cardano.TxSubmit.Rest.Web as Web import Cardano.TxSubmit.Types (EnvSocketError (..), RawCborDecodeError (..), - TxCmdError (TxCmdEraConsensusModeMismatch, TxCmdTxReadError, TxCmdTxSubmitError, TxCmdTxSubmitErrorEraMismatch), + TxCmdError (TxCmdTxReadError, TxCmdTxSubmitError, TxCmdTxSubmitErrorEraMismatch), TxSubmitApi, TxSubmitApiRecord (..), TxSubmitWebApiError (TxSubmitFail), renderTxCmdError) import Cardano.TxSubmit.Util (logException) @@ -74,7 +73,7 @@ runTxSubmitServer :: Trace IO Text -> TxSubmitMetrics -> WebserverConfig - -> AnyConsensusModeParams + -> ConsensusModeParams -> NetworkId -> SocketPath -> IO () @@ -86,7 +85,7 @@ runTxSubmitServer trace metrics webserverConfig protocol networkId socketPath = txSubmitApp :: Trace IO Text -> TxSubmitMetrics - -> AnyConsensusModeParams + -> ConsensusModeParams -> NetworkId -> SocketPath -> Application @@ -128,21 +127,17 @@ readByteStringTx = firstExceptT TxCmdTxReadError . hoistEither . deserialiseAnyO txSubmitPost :: Trace IO Text -> TxSubmitMetrics - -> AnyConsensusModeParams + -> ConsensusModeParams -> NetworkId -> SocketPath -> ByteString -> Handler TxId -txSubmitPost trace metrics (AnyConsensusModeParams cModeParams) networkId socketPath txBytes = +txSubmitPost trace metrics p@(CardanoModeParams cModeParams) networkId socketPath txBytes = handle $ do InAnyCardanoEra era tx <- readByteStringTx txBytes - let cMode = AnyConsensusMode $ consensusModeOnly cModeParams - eraInMode <- hoistMaybe - (TxCmdEraConsensusModeMismatch cMode (AnyCardanoEra era)) - (toEraInMode era $ consensusModeOnly cModeParams) - let txInMode = TxInMode tx eraInMode + let txInMode = TxInMode era tx localNodeConnInfo = LocalNodeConnectInfo - { localConsensusModeParams = cModeParams + { localConsensusModeParams = p , localNodeNetworkId = networkId , localNodeSocketPath = socketPath } @@ -154,7 +149,7 @@ txSubmitPost trace metrics (AnyConsensusModeParams cModeParams) networkId socket return $ getTxId (getTxBody tx) Net.Tx.SubmitFail reason -> case reason of - TxValidationErrorInMode err _eraInMode -> left . TxCmdTxSubmitError . T.pack $ show err + TxValidationErrorInCardanoMode err -> left . TxCmdTxSubmitError . T.pack $ show err TxValidationEraMismatch mismatchErr -> left $ TxCmdTxSubmitErrorEraMismatch mismatchErr where handle :: ExceptT TxCmdError IO TxId -> Handler TxId diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index 94c94040152..a56eb2b5e29 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -34,8 +34,8 @@ library build-depends: aeson , ansi-terminal , bytestring - , cardano-api ^>= 8.29 , cardano-cli ^>= 8.13 + , cardano-api ^>= 8.33 , cardano-crypto-class , cardano-crypto-wrapper , cardano-ledger-alonzo diff --git a/cardano-testnet/src/Testnet/Defaults.hs b/cardano-testnet/src/Testnet/Defaults.hs index 1720a3a1dd9..aba92ff923e 100644 --- a/cardano-testnet/src/Testnet/Defaults.hs +++ b/cardano-testnet/src/Testnet/Defaults.hs @@ -14,6 +14,7 @@ module Testnet.Defaults ) where import Cardano.Api (AnyCardanoEra (..), CardanoEra (..)) +import Cardano.Api.Pretty import qualified Cardano.Api.Shelley as Api import Cardano.Ledger.Alonzo.Core (CoinPerWord (..)) @@ -47,10 +48,10 @@ import Testnet.Start.Types instance Api.Error AlonzoGenesisError where - displayError (AlonzoGenErrCostModels e) = - "Error in Alonzo genesis cost models: " <> show e - displayError (AlonzoGenErrTooMuchPrecision r) = - "Too much precision for bounded rational in Alonzo genesis: " ++ show r + prettyError (AlonzoGenErrCostModels e) = + "Error in Alonzo genesis cost models: " <> pshow e + prettyError (AlonzoGenErrTooMuchPrecision r) = + "Too much precision for bounded rational in Alonzo genesis: " <> pshow r data AlonzoGenesisError = AlonzoGenErrTooMuchPrecision Rational diff --git a/cardano-testnet/src/Testnet/Runtime.hs b/cardano-testnet/src/Testnet/Runtime.hs index 755fdad5eda..6438473e0fd 100644 --- a/cardano-testnet/src/Testnet/Runtime.hs +++ b/cardano-testnet/src/Testnet/Runtime.hs @@ -30,6 +30,7 @@ module Testnet.Runtime ) where import Cardano.Api +import Cardano.Api.Pretty import qualified Cardano.Chain.Genesis as G import Cardano.Crypto.ProtocolMagic (RequiresNetworkMagic (..)) @@ -156,7 +157,7 @@ getStartTime tempRootPath TestnetRuntime{configurationFile} = withFrozenCallStac partialNodeCfg <- ExceptT $ A.eitherDecodeFileStrict' file fmap ncProtocolConfig . liftEither . makeNodeConfiguration $ defaultPartialNodeConfiguration <> partialNodeCfg decodeGenesisFile :: FilePath -> ExceptT String IO G.Config - decodeGenesisFile fp = withExceptT displayError $ + decodeGenesisFile fp = withExceptT (prettyToString . prettyError) $ Byron.readGenesis (GenesisFile fp) Nothing RequiresNoMagic readNodeLoggingFormat :: String -> Either String NodeLoggingFormat diff --git a/cardano-testnet/src/Testnet/Start/Cardano.hs b/cardano-testnet/src/Testnet/Start/Cardano.hs index 78f6476599d..2d23b4b7e0e 100644 --- a/cardano-testnet/src/Testnet/Start/Cardano.hs +++ b/cardano-testnet/src/Testnet/Start/Cardano.hs @@ -119,7 +119,7 @@ cardanoTestnet testnetOptions Conf {tempAbsPath} = do alonzoConwayTestGenesisJsonTargetFile <- H.noteShow $ tempAbsPath' "genesis.alonzo.spec.json" - gen <- H.evalEither $ first displayError defaultAlonzoGenesis + gen <- H.evalEither $ first prettyError defaultAlonzoGenesis H.evalIO $ LBS.writeFile alonzoConwayTestGenesisJsonTargetFile $ Aeson.encode gen conwayConwayTestGenesisJsonTargetFile <- H.noteShow $ tempAbsPath' "genesis.conway.spec.json" diff --git a/cardano-testnet/test/cardano-testnet-golden/Cardano/Testnet/Test/Golden/Util.hs b/cardano-testnet/test/cardano-testnet-golden/Cardano/Testnet/Test/Golden/Util.hs index c4e365c07c4..a8e781ae78f 100644 --- a/cardano-testnet/test/cardano-testnet-golden/Cardano/Testnet/Test/Golden/Util.hs +++ b/cardano-testnet/test/cardano-testnet-golden/Cardano/Testnet/Test/Golden/Util.hs @@ -11,6 +11,7 @@ module Cardano.Testnet.Test.Golden.Util ) where import Cardano.Api +import Cardano.Api.Pretty import Control.Monad.Catch import Control.Monad.IO.Class (MonadIO (..)) @@ -122,7 +123,7 @@ checkTextEnvelopeFormat tve reference created = GHC.withFrozenCallStack $ do => Either (FileError TextEnvelopeError) TextEnvelope -> m TextEnvelope handleTextEnvelope (Right refTextEnvelope) = return refTextEnvelope - handleTextEnvelope (Left fileErr) = failWithCustom GHC.callStack Nothing . displayError $ fileErr + handleTextEnvelope (Left fileErr) = failWithCustom GHC.callStack Nothing . prettyToString . prettyError $ fileErr typeTitleEquivalence :: (MonadTest m, HasCallStack) => TextEnvelope -> TextEnvelope -> m () typeTitleEquivalence (TextEnvelope refType refTitle _) diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Babbage/LeadershipSchedule.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Babbage/LeadershipSchedule.hs index 7c6f311dac5..e4c8d66a43f 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Babbage/LeadershipSchedule.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Babbage/LeadershipSchedule.hs @@ -83,8 +83,7 @@ hprop_leadershipSchedule = H.integrationRetryWorkspace 2 "babbage-leadership-sch execConfig <- H.headM (poolSprockets tr) >>= H.mkExecConfig tempBaseAbsPath - sbe <- case cardanoEraStyle era of - ShelleyBasedEra era' -> return era' + let sbe = shelleyBasedEra @BabbageEra work <- H.note tempAbsPath' ----------------Need to register an SPO------------------ diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/KesPeriodInfo.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/KesPeriodInfo.hs index 39afde93556..6e082da67c9 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/KesPeriodInfo.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/KesPeriodInfo.hs @@ -58,7 +58,8 @@ hprop_kes_period_info = H.integrationRetryWorkspace 2 "kes-period-info" $ \tempA let tempAbsPath' = unTmpAbsPath tempAbsPath tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath - era = BabbageEra + sbe = ShelleyBasedEraBabbage + era = toCardanoEra sbe cTestnetOptions = cardanoDefaultTestnetOptions { cardanoNodes = cardanoDefaultTestnetNodeOptions , cardanoSlotLength = 0.1 @@ -66,9 +67,6 @@ hprop_kes_period_info = H.integrationRetryWorkspace 2 "kes-period-info" $ \tempA , cardanoNodeEra = AnyCardanoEra era -- TODO: We should only support the latest era and the upcoming era } - sbe <- case cardanoEraStyle era of - ShelleyBasedEra era' -> return era' - runTime@TestnetRuntime { testnetMagic } <- cardanoTestnet cTestnetOptions conf execConfig <- H.headM (poolSprockets runTime) >>= H.mkExecConfig tempBaseAbsPath diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/FoldBlocks.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/FoldBlocks.hs index cf4839bf446..40c508f8e80 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/FoldBlocks.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/FoldBlocks.hs @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TupleSections #-} module Cardano.Testnet.Test.FoldBlocks where @@ -67,7 +68,8 @@ prop_foldBlocks = H.integrationRetryWorkspace 2 "foldblocks" $ \tempAbsBasePath' -- permanent (= older than the k parameter) blocks created. In -- that case we simply restart `foldBlocks` again. forever $ do - let handler _env _ledgerState _ledgerEvents _blockInCardanoMode _ = IO.putMVar lock () + let handler :: Env -> LedgerState -> [LedgerEvent] -> BlockInMode -> () -> IO ((), FoldStatus) + handler _env _ledgerState _ledgerEvents _blockInCardanoMode _ = (, ContinueFold) <$> IO.putMVar lock () e <- runExceptT (C.foldBlocks (File configFile) (C.File socketPathAbs) C.QuickValidation () handler) either (throw . FoldBlocksException) (\_ -> pure ()) e link a -- Throw async thread's exceptions in main thread diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Misc.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Misc.hs index 9b79e8ce89a..356a022e201 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Misc.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Misc.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE OverloadedStrings #-} module Cardano.Testnet.Test.Misc where import Prelude @@ -5,6 +6,7 @@ import Prelude import Data.List (isInfixOf) import qualified GHC.Stack as GHC +import Cardano.Api.Pretty import Cardano.CLI.EraBased.Run.Query (renderOpCertIntervalInformation) import Cardano.CLI.Types.Common import Cardano.CLI.Types.Output @@ -20,15 +22,15 @@ prop_op_cert_valid_kes_period opCertFp output = case qKesOpCertIntervalInformation output of OpCertWithinInterval{} -> success info@OpCertStartingKesPeriodIsInTheFuture{} -> - failMessage GHC.callStack + failMessage GHC.callStack . prettyToString $ "Expected OpCertWithinInterval but got: OpCertStartingKesPeriodIsInTheFuture\n" <> renderOpCertIntervalInformation opCertFp info info@OpCertExpired{} -> - failMessage GHC.callStack + failMessage GHC.callStack . prettyToString $ "Expected OpCertWithinInterval but got: OpCertExpired\n" <> renderOpCertIntervalInformation opCertFp info info@OpCertSomeOtherError{} -> - failMessage GHC.callStack + failMessage GHC.callStack . prettyToString $ "Expected OpCertWithinInterval but got: OpCertSomeOtherError\n" <> renderOpCertIntervalInformation opCertFp info diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Node/Shutdown.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Node/Shutdown.hs index 6af0fe91509..06a3d0e48ba 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Node/Shutdown.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Node/Shutdown.hs @@ -11,6 +11,7 @@ module Cardano.Testnet.Test.Node.Shutdown ) where import Cardano.Api +import Cardano.Api.Pretty import Cardano.Testnet @@ -99,7 +100,7 @@ hprop_shutdown = H.integrationRetryWorkspace 2 "shutdown" $ \tempAbsBasePath' -> -- 2. Create Alonzo genesis alonzoBabbageTestGenesisJsonTargetFile <- H.noteShow $ tempAbsPath' shelleyDir "genesis.alonzo.spec.json" - gen <- H.evalEither $ first displayError defaultAlonzoGenesis + gen <- H.evalEither $ first (prettyToString . prettyError) defaultAlonzoGenesis H.evalIO $ LBS.writeFile alonzoBabbageTestGenesisJsonTargetFile $ encode gen -- 2. Create Conway genesis From 089d740344cca32819bee198e1a72efcf7d2476e Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 20 Nov 2023 10:35:31 +0100 Subject: [PATCH 04/10] Integrate cardano-ledger --- bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs | 2 +- cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs b/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs index 1ced74cbee2..c9a7ccc41cc 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs @@ -23,7 +23,7 @@ import Cardano.CLI.Read (readFileScriptInAnyLang) import Cardano.Api import Cardano.Api.Shelley (PlutusScript (..), ProtocolParameters (..), fromAlonzoExUnits, protocolParamCostModels, toPlutusData) -import Cardano.Ledger.Alonzo.TxInfo (exBudgetToExUnits) +import Cardano.Ledger.Alonzo.Plutus.TxInfo (exBudgetToExUnits) import qualified PlutusLedgerApi.V1 as PlutusV1 import qualified PlutusLedgerApi.V2 as PlutusV2 diff --git a/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs b/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs index 0876fd65df5..2b3638e88c1 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs @@ -1139,6 +1139,10 @@ instance mconcat [ "kind" .= String "InvalidPrevGovActionIdsInProposals" , "proposals" .= proposals ] + forMachine _ (Conway.VotingOnExpiredGovAction actions) = + mconcat [ "kind" .= String "VotingOnExpiredGovAction" + , "action" .= actions + ] instance ( Consensus.ShelleyBasedEra era From a66c1f119dc19f1d414ecd5f5e92cba5224473df Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 20 Nov 2023 10:36:26 +0100 Subject: [PATCH 05/10] Integrate cardano-cli-8.15.0.0 --- bench/locli/src/Cardano/Render.hs | 3 --- bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs | 1 + bench/tx-generator/test/Main.hs | 1 + bench/tx-generator/tx-generator.cabal | 3 ++- cardano-node-chairman/cardano-node-chairman.cabal | 2 +- cardano-submit-api/cardano-submit-api.cabal | 2 +- cardano-testnet/cardano-testnet.cabal | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bench/locli/src/Cardano/Render.hs b/bench/locli/src/Cardano/Render.hs index f437631ffdc..76f48da7da7 100644 --- a/bench/locli/src/Cardano/Render.hs +++ b/bench/locli/src/Cardano/Render.hs @@ -15,9 +15,6 @@ import Data.List (dropWhileEnd) import Data.Map.Strict qualified as Map import Data.Text qualified as T import Data.Text.Lazy qualified as LT -#if __GLASGOW_HASKELL__ >= 906 -import Data.Type.Equality (type (~)) -#endif import Options.Applicative qualified as Opt import Data.CDF diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs b/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs index a9da0f5743c..353c2f5c2c1 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs @@ -17,6 +17,7 @@ import System.Exit import Data.Aeson as Aeson import Data.Aeson.Encode.Pretty +import Data.Aeson.Parser as Aeson (json) import qualified Data.Attoparsec.ByteString as Atto import qualified Data.Yaml as Yaml (encode) diff --git a/bench/tx-generator/test/Main.hs b/bench/tx-generator/test/Main.hs index 25575148f31..2d117778730 100644 --- a/bench/tx-generator/test/Main.hs +++ b/bench/tx-generator/test/Main.hs @@ -1,4 +1,5 @@ {-# LANGUAGE Trustworthy #-} +{-# OPTIONS_GHC -Wno-all-missed-specialisations #-} module Main (main) where diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index ed45bcc5fab..84140f83d68 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -95,11 +95,12 @@ library , aeson-pretty , async , attoparsec + , attoparsec-aeson , base16-bytestring , bytestring , cardano-api ^>= 8.33 , cardano-binary - , cardano-cli ^>= 8.13 + , cardano-cli ^>= 8.15 , cardano-crypto-class , cardano-crypto-wrapper , cardano-data diff --git a/cardano-node-chairman/cardano-node-chairman.cabal b/cardano-node-chairman/cardano-node-chairman.cabal index 3b784154049..3771f4589f5 100644 --- a/cardano-node-chairman/cardano-node-chairman.cabal +++ b/cardano-node-chairman/cardano-node-chairman.cabal @@ -88,5 +88,5 @@ test-suite chairman-tests ghc-options: -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-T build-tool-depends: cardano-node:cardano-node - , cardano-cli:cardano-cli ^>= 8.13 + , cardano-cli:cardano-cli ^>= 8.15 , cardano-node-chairman:cardano-node-chairman diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index 03e0c0e4304..226944efd7d 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -41,7 +41,7 @@ library , bytestring , cardano-api ^>= 8.33 , cardano-binary - , cardano-cli ^>= 8.13 + , cardano-cli ^>= 8.15 , cardano-crypto-class ^>= 2.1.2 , cardano-ledger-byron ^>= 1.0 , formatting diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index a56eb2b5e29..2e8f06086fa 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -34,8 +34,8 @@ library build-depends: aeson , ansi-terminal , bytestring - , cardano-cli ^>= 8.13 , cardano-api ^>= 8.33 + , cardano-cli ^>= 8.15 , cardano-crypto-class , cardano-crypto-wrapper , cardano-ledger-alonzo From 12ac9ec59a8d7ad45490769ba80c76d008776953 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 20 Nov 2023 13:04:01 +0100 Subject: [PATCH 06/10] Integrate ouroboros-consensus --- .../cardano-node-chairman.cabal | 1 + cardano-node/cardano-node.cabal | 4 ++-- .../src/Cardano/Node/Configuration/POM.hs | 22 +++++++++++++++++++ cardano-node/src/Cardano/Node/Parsers.hs | 1 + cardano-node/src/Cardano/Node/Run.hs | 22 ++++++++++++++++--- cardano-node/test/Test/Cardano/Node/POM.hs | 3 +++ 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/cardano-node-chairman/cardano-node-chairman.cabal b/cardano-node-chairman/cardano-node-chairman.cabal index 3771f4589f5..3266bc0b13c 100644 --- a/cardano-node-chairman/cardano-node-chairman.cabal +++ b/cardano-node-chairman/cardano-node-chairman.cabal @@ -51,6 +51,7 @@ executable cardano-node-chairman , io-classes , optparse-applicative-fork , ouroboros-consensus + , ouroboros-consensus-cardano , ouroboros-network-api , ouroboros-network-protocols , strict-stm diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index cdca73c5dda..97474fc5651 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -177,8 +177,8 @@ library , nothunks , optparse-applicative-fork >= 0.18.1 , ouroboros-consensus ^>= 0.13 - , ouroboros-consensus-cardano ^>= 0.11 - , ouroboros-consensus-diffusion ^>= 0.8 + , ouroboros-consensus-cardano ^>= 0.12 + , ouroboros-consensus-diffusion ^>= 0.9 , ouroboros-consensus-protocol , ouroboros-network-api , ouroboros-network ^>= 0.10 diff --git a/cardano-node/src/Cardano/Node/Configuration/POM.hs b/cardano-node/src/Cardano/Node/Configuration/POM.hs index 72e329f3fc4..8fb3a442a63 100644 --- a/cardano-node/src/Cardano/Node/Configuration/POM.hs +++ b/cardano-node/src/Cardano/Node/Configuration/POM.hs @@ -12,6 +12,7 @@ module Cardano.Node.Configuration.POM , NetworkP2PMode (..) , SomeNetworkP2PMode (..) , PartialNodeConfiguration(..) + , TimeoutOverride (..) , defaultPartialNodeConfiguration , lastOption , makeNodeConfiguration @@ -75,6 +76,11 @@ instance Show SomeNetworkP2PMode where show (SomeNetworkP2PMode mode@Consensus.EnabledP2PMode) = show mode show (SomeNetworkP2PMode mode@Consensus.DisabledP2PMode) = show mode +-- | Isomorphic to a `Maybe DiffTime`, but expresses what `Nothing` means, in +-- this case that we want to /NOT/ override the default timeout. +data TimeoutOverride = NoTimeoutOverride | TimeoutOverride DiffTime + deriving (Eq, Show) + data NodeConfiguration = NodeConfiguration { ncSocketConfig :: !SocketConfig @@ -132,6 +138,10 @@ data NodeConfiguration -- , ncTimeWaitTimeout :: DiffTime + -- | Timeout override for ChainSync, see + -- 'Ouroboros.Network.Protocol.ChainSync.Codec.ChainSyncTimeout' + , ncChainSyncIdleTimeout :: TimeoutOverride + -- | Node AcceptedConnectionsLimit , ncAcceptedConnectionsLimit :: !AcceptedConnectionsLimit @@ -192,6 +202,8 @@ data PartialNodeConfiguration , pncProtocolIdleTimeout :: !(Last DiffTime) , pncTimeWaitTimeout :: !(Last DiffTime) + , pncChainSyncIdleTimeout :: !(Last DiffTime) + -- AcceptedConnectionsLimit , pncAcceptedConnectionsLimit :: !(Last AcceptedConnectionsLimit) @@ -289,6 +301,8 @@ instance FromJSON PartialNodeConfiguration where pncTargetNumberOfEstablishedBigLedgerPeers <- Last <$> v .:? "TargetNumberOfEstablishedBigLedgerPeers" pncTargetNumberOfActiveBigLedgerPeers <- Last <$> v .:? "TargetNumberOfActiveBigLedgerPeers" + pncChainSyncIdleTimeout <- Last <$> v .:? "ChainSyncIdleTimeout" + -- Enable P2P switch p2pSwitch <- v .:? "EnableP2P" .!= Just False let pncEnableP2P = @@ -323,6 +337,7 @@ instance FromJSON PartialNodeConfiguration where , pncMaybeMempoolCapacityOverride , pncProtocolIdleTimeout , pncTimeWaitTimeout + , pncChainSyncIdleTimeout , pncAcceptedConnectionsLimit , pncTargetNumberOfRootPeers , pncTargetNumberOfKnownPeers @@ -502,6 +517,7 @@ defaultPartialNodeConfiguration = , pncTargetNumberOfKnownPeers = Last (Just 85) , pncTargetNumberOfEstablishedPeers = Last (Just 40) , pncTargetNumberOfActivePeers = Last (Just 15) + , pncChainSyncIdleTimeout = mempty , pncTargetNumberOfKnownBigLedgerPeers = Last (Just 15) , pncTargetNumberOfEstablishedBigLedgerPeers = Last (Just 10) , pncTargetNumberOfActiveBigLedgerPeers = Last (Just 5) @@ -561,6 +577,11 @@ makeNodeConfiguration pnc = do enableP2P <- lastToEither "Missing EnableP2P" $ pncEnableP2P pnc + ncChainSyncIdleTimeout <- + Right + $ maybe NoTimeoutOverride TimeoutOverride + $ getLast + $ pncChainSyncIdleTimeout pnc ncPeerSharing <- lastToEither "Missing PeerSharing" @@ -599,6 +620,7 @@ makeNodeConfiguration pnc = do , ncMaybeMempoolCapacityOverride = getLast $ pncMaybeMempoolCapacityOverride pnc , ncProtocolIdleTimeout , ncTimeWaitTimeout + , ncChainSyncIdleTimeout , ncAcceptedConnectionsLimit , ncTargetNumberOfRootPeers , ncTargetNumberOfKnownPeers diff --git a/cardano-node/src/Cardano/Node/Parsers.hs b/cardano-node/src/Cardano/Node/Parsers.hs index b4f34ed89c3..9c4f69a73f2 100644 --- a/cardano-node/src/Cardano/Node/Parsers.hs +++ b/cardano-node/src/Cardano/Node/Parsers.hs @@ -114,6 +114,7 @@ nodeRunParser = do , pncMaybeMempoolCapacityOverride = maybeMempoolCapacityOverride , pncProtocolIdleTimeout = mempty , pncTimeWaitTimeout = mempty + , pncChainSyncIdleTimeout = mempty , pncAcceptedConnectionsLimit = mempty , pncTargetNumberOfRootPeers = mempty , pncTargetNumberOfKnownPeers = mempty diff --git a/cardano-node/src/Cardano/Node/Run.hs b/cardano-node/src/Cardano/Node/Run.hs index aa94cce13a0..34bc26be8e6 100644 --- a/cardano-node/src/Cardano/Node/Run.hs +++ b/cardano-node/src/Cardano/Node/Run.hs @@ -42,7 +42,7 @@ import "contra-tracer" Control.Tracer import Data.Either (partitionEithers) import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map -import Data.Maybe (catMaybes, mapMaybe) +import Data.Maybe (catMaybes, mapMaybe, fromMaybe) import Data.Monoid (Last (..)) import Data.Proxy (Proxy (..)) import Data.Text (Text, breakOn, pack) @@ -79,7 +79,8 @@ import Cardano.Node.Configuration.Logging (LoggingLayer (..), createLo import Cardano.Node.Configuration.NodeAddress import Cardano.Node.Configuration.POM (NodeConfiguration (..), PartialNodeConfiguration (..), SomeNetworkP2PMode (..), - defaultPartialNodeConfiguration, makeNodeConfiguration, parseNodeConfigurationFP) + defaultPartialNodeConfiguration, makeNodeConfiguration, parseNodeConfigurationFP, + TimeoutOverride (..)) import Cardano.Node.Startup import Cardano.Node.Tracing.API import Cardano.Node.Tracing.StateRep (NodeState (NodeKernelOnline)) @@ -90,7 +91,7 @@ import Cardano.Tracing.Config (TraceOptions (..), TraceSelection (..)) import qualified Ouroboros.Consensus.Config as Consensus import Ouroboros.Consensus.Config.SupportsNode (ConfigSupportsNode (..)) import Ouroboros.Consensus.Node (NetworkP2PMode (..), RunNodeArgs (..), - StdRunNodeArgs (..)) + StdRunNodeArgs (..), stdChainSyncTimeout) import qualified Ouroboros.Consensus.Node as Node (getChainDB, run) import Ouroboros.Consensus.Node.NetworkProtocolVersion import Ouroboros.Consensus.Node.ProtocolInfo @@ -105,6 +106,7 @@ import Ouroboros.Network.PeerSelection.LedgerPeers (UseLedgerAfter (.. import Ouroboros.Network.PeerSelection.RelayAccessPoint (RelayAccessPoint (..)) import Ouroboros.Network.Subscription (DnsSubscriptionTarget (..), IPSubscriptionTarget (..)) +import Ouroboros.Network.Protocol.ChainSync.Codec import Cardano.Node.Configuration.Socket (SocketOrSocketInfo (..), gatherConfiguredSockets, getSocketOrSocketInfoAddr) @@ -481,6 +483,7 @@ handleSimpleNode blockType runP p2pMode tracers nc onKernel = do , srnEnableInDevelopmentVersions = ncExperimentalProtocolsEnabled nc , srnTraceChainDB = chainDBTracer tracers , srnMaybeMempoolCapacityOverride = ncMaybeMempoolCapacityOverride nc + , srnChainSyncTimeout = customizeChainSyncTimeout } DisabledP2PMode -> do nt <- TopologyNonP2P.readTopologyFileOrError nc @@ -529,9 +532,22 @@ handleSimpleNode blockType runP p2pMode tracers nc onKernel = do , srnDiffusionTracersExtra = diffusionTracersExtra tracers , srnEnableInDevelopmentVersions = ncExperimentalProtocolsEnabled nc , srnTraceChainDB = chainDBTracer tracers + , srnChainSyncTimeout = customizeChainSyncTimeout , srnMaybeMempoolCapacityOverride = ncMaybeMempoolCapacityOverride nc } where + + customizeChainSyncTimeout :: Maybe (IO ChainSyncTimeout) + customizeChainSyncTimeout = case ncChainSyncIdleTimeout nc of + NoTimeoutOverride -> Nothing + TimeoutOverride t -> Just $ do + cst <- stdChainSyncTimeout + pure $ case t of + 0 -> + cst { idleTimeout = Nothing } + _ -> + cst { idleTimeout = Just t } + logStartupWarnings :: IO () logStartupWarnings = do (case p2pMode of diff --git a/cardano-node/test/Test/Cardano/Node/POM.hs b/cardano-node/test/Test/Cardano/Node/POM.hs index 2e9fb03de0e..6a0205355c6 100644 --- a/cardano-node/test/Test/Cardano/Node/POM.hs +++ b/cardano-node/test/Test/Cardano/Node/POM.hs @@ -131,6 +131,7 @@ testPartialYamlConfig = , pncMaybeMempoolCapacityOverride = mempty , pncProtocolIdleTimeout = mempty , pncTimeWaitTimeout = mempty + , pncChainSyncIdleTimeout = mempty , pncAcceptedConnectionsLimit = mempty , pncTargetNumberOfRootPeers = mempty , pncTargetNumberOfKnownPeers = mempty @@ -169,6 +170,7 @@ testPartialCliConfig = , pncMaybeMempoolCapacityOverride = mempty , pncProtocolIdleTimeout = mempty , pncTimeWaitTimeout = mempty + , pncChainSyncIdleTimeout = mempty , pncAcceptedConnectionsLimit = mempty , pncTargetNumberOfRootPeers = mempty , pncTargetNumberOfKnownPeers = mempty @@ -208,6 +210,7 @@ eExpectedConfig = do , ncMaybeMempoolCapacityOverride = Nothing , ncProtocolIdleTimeout = 5 , ncTimeWaitTimeout = 60 + , ncChainSyncIdleTimeout = NoTimeoutOverride , ncAcceptedConnectionsLimit = AcceptedConnectionsLimit { acceptedConnectionsHardLimit = 512 From 077cdb5861d2c671d15145e364782bbff7a8f636 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 20 Nov 2023 13:13:08 +0100 Subject: [PATCH 07/10] Update flakes --- flake.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 5e215b54c1f..c40ad513e7e 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1698772188, - "narHash": "sha256-QiQbb08vemttpardX2nOhC1xVRcatn4Lbg/wWjoHtKg=", + "lastModified": 1700478527, + "narHash": "sha256-SI3YRmzGhQoG6gcF8esEK8fYRRV5hDfMslPVZHyBduY=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "bd71312b6717eec9828614c62df42a19fdb72df7", + "rev": "d3f7b7ba387c14d23b88fea331bb393ea7079b1c", "type": "github" }, "original": { @@ -624,11 +624,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1696465466, - "narHash": "sha256-YlazbA1gGX6DGONHpGsA7vEgS0y43TzmarLkRjL0Nn0=", + "lastModified": 1700439793, + "narHash": "sha256-SjOHopUggIanCVG8DBoNT3Dr5glVpeD/GZppoea6gYc=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "a99556cc8d1b2296eb1cc11c301564e1ee9324d1", + "rev": "672483a2719d8cc24d65fa0ec66e2532aabeee3a", "type": "github" }, "original": { @@ -673,11 +673,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1697415012, - "narHash": "sha256-QYeYRA9KbMuy+N4fYWTSHT571VUGmyN0TzOBYDh0ARo=", + "lastModified": 1700441391, + "narHash": "sha256-oJqP1AUskUvr3GNUH97eKwaIUHdYgENS2kQ7GI9RI+c=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "4589f9d34ee36f3f622177fcd665c2e7084308d1", + "rev": "3b6056f3866f88d1d16eaeb2e810d3ac0df0e7cd", "type": "github" }, "original": { @@ -1739,11 +1739,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1697328588, - "narHash": "sha256-IrRJzGiGRd4lq9U0dANDpoiSeHd4pnTVA76DbMC7fwA=", + "lastModified": 1700438989, + "narHash": "sha256-x+7Qtboko7ds8CU8pq2sIZiD45DauYoX9LxBfwQr/hs=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "b6a72b7b02a9aa017169c639774fda1573fd09c3", + "rev": "9c2015334cc77837b8454b3b10ef4f711a256f6f", "type": "github" }, "original": { From 4a1b0d407382e1adc5ff76f01a24a1bff13e849c Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 20 Nov 2023 13:35:41 +0100 Subject: [PATCH 08/10] Cleanup - Update cabal cache - Cleanup yml files - Update ci to Cabal 3.10.2.0 - Move `Changelog.md` to the appropiate section in cabal files --- .github/workflows/cabal.project.local.ci | 2 ++ .../workflows/cabal.project.local.ci.Darwin | 5 ----- .../workflows/cabal.project.local.ci.Linux | 5 ----- ...bal.project.local.ci.MINGW64_NT-10.0-20348 | 5 ----- .github/workflows/check-cabal-files.yml | 9 ++------ .github/workflows/haskell.yml | 21 ++++--------------- .github/workflows/stylish-haskell.yml | 2 +- cardano-node-capi/cardano-node-capi.cabal | 2 +- cardano-node/cardano-node.cabal | 2 +- cardano-submit-api/cardano-submit-api.cabal | 2 +- cardano-testnet/cardano-testnet.cabal | 2 +- 11 files changed, 13 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/cabal.project.local.ci delete mode 100644 .github/workflows/cabal.project.local.ci.Darwin delete mode 100644 .github/workflows/cabal.project.local.ci.Linux delete mode 100644 .github/workflows/cabal.project.local.ci.MINGW64_NT-10.0-20348 diff --git a/.github/workflows/cabal.project.local.ci b/.github/workflows/cabal.project.local.ci new file mode 100644 index 00000000000..6a1d077fa8e --- /dev/null +++ b/.github/workflows/cabal.project.local.ci @@ -0,0 +1,2 @@ +package HsOpenSSL + flags: +use-pkg-config diff --git a/.github/workflows/cabal.project.local.ci.Darwin b/.github/workflows/cabal.project.local.ci.Darwin deleted file mode 100644 index 415a21c29cb..00000000000 --- a/.github/workflows/cabal.project.local.ci.Darwin +++ /dev/null @@ -1,5 +0,0 @@ -package cardano-crypto-praos - flags: -external-libsodium-vrf - -package HsOpenSSL - flags: +use-pkg-config diff --git a/.github/workflows/cabal.project.local.ci.Linux b/.github/workflows/cabal.project.local.ci.Linux deleted file mode 100644 index 415a21c29cb..00000000000 --- a/.github/workflows/cabal.project.local.ci.Linux +++ /dev/null @@ -1,5 +0,0 @@ -package cardano-crypto-praos - flags: -external-libsodium-vrf - -package HsOpenSSL - flags: +use-pkg-config diff --git a/.github/workflows/cabal.project.local.ci.MINGW64_NT-10.0-20348 b/.github/workflows/cabal.project.local.ci.MINGW64_NT-10.0-20348 deleted file mode 100644 index 415a21c29cb..00000000000 --- a/.github/workflows/cabal.project.local.ci.MINGW64_NT-10.0-20348 +++ /dev/null @@ -1,5 +0,0 @@ -package cardano-crypto-praos - flags: -external-libsodium-vrf - -package HsOpenSSL - flags: +use-pkg-config diff --git a/.github/workflows/check-cabal-files.yml b/.github/workflows/check-cabal-files.yml index 05213bb8a34..f30d2e80f18 100644 --- a/.github/workflows/check-cabal-files.yml +++ b/.github/workflows/check-cabal-files.yml @@ -9,16 +9,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: Workaround runner image issue - if: runner.os == 'Linux' - # https://github.com/actions/runner-images/issues/7061 - run: sudo chown -R $USER /usr/local/.ghcup - - name: Install Haskell - uses: input-output-hk/setup-haskell@v1 + uses: input-output-hk/actions/haskell@latest id: setup-haskell with: - cabal-version: "3.10.1.0" + cabal-version: "3.10.2.0" - uses: actions/checkout@v3 diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 47f0f005987..40220706fe7 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -25,19 +25,13 @@ jobs: strategy: fail-fast: false matrix: - ghc: ["9.2.7", "9.6.2"] - cabal: ["3.10.1.0"] + ghc: ["9.2.8", "9.6.3"] + cabal: ["3.10.2.0"] os: [macos-latest, windows-latest, ubuntu-latest] env: # Modify this value to "invalidate" the cabal cache. - CABAL_CACHE_VERSION: "2023-10-04" - - # Modify this value to "invalidate" the secp cache. - SECP_CACHE_VERSION: "2022-12-30" - - # current ref from: 27.02.2022 - SECP256K1_REF: ac83be33d0956faf6b7f61a60ab524ef7d6a473a + CABAL_CACHE_VERSION: "2023-11-20-3" concurrency: group: > @@ -82,7 +76,7 @@ jobs: - name: Configure build shell: bash run: | - cp ".github/workflows/cabal.project.local.ci.$(uname -s)" cabal.project.local + cp .github/workflows/cabal.project.local.ci cabal.project.local echo "# cabal.project.local" cat cabal.project.local @@ -178,13 +172,6 @@ jobs: fi done - - name: Save Artifact - if: matrix.ghc == '8.10.7' - uses: actions/upload-artifact@v1 - with: - name: artifacts-${{ matrix.os }} - path: ./artifacts - - name: Delete socket files in chairman tests in preparation for uploading artifacts if: ${{ always() }} shell: bash diff --git a/.github/workflows/stylish-haskell.yml b/.github/workflows/stylish-haskell.yml index 594b9f04c17..7f9dc139425 100644 --- a/.github/workflows/stylish-haskell.yml +++ b/.github/workflows/stylish-haskell.yml @@ -27,7 +27,7 @@ jobs: env: # Modify this value to "invalidate" the cabal cache. - CABAL_CACHE_VERSION: "2023-07-28" + CABAL_CACHE_VERSION: "2023-11-20-3" STYLISH_HASKELL_VERSION: "0.14.4.0" diff --git a/cardano-node-capi/cardano-node-capi.cabal b/cardano-node-capi/cardano-node-capi.cabal index aba6efbd4e2..22bd9634411 100644 --- a/cardano-node-capi/cardano-node-capi.cabal +++ b/cardano-node-capi/cardano-node-capi.cabal @@ -12,7 +12,7 @@ maintainer: operations@iohk.io license: Apache-2.0 license-files: LICENSE NOTICE -extra-source-files: CHANGELOG.md +extra-doc-files: CHANGELOG.md common project-config default-language: Haskell2010 diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 97474fc5651..fcb0efd68af 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -13,7 +13,7 @@ license: Apache-2.0 license-files: LICENSE NOTICE build-type: Simple -extra-source-files: ChangeLog.md +extra-doc-files: ChangeLog.md Flag unexpected_thunks Description: Turn on unexpected thunks checks diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index 226944efd7d..467ca2410dd 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -15,7 +15,7 @@ maintainer: operations@iohk.io category: Cardano, Web, build-type: Simple -extra-source-files: CHANGELOG.md +extra-doc-files: CHANGELOG.md common project-config default-language: Haskell2010 diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index 2e8f06086fa..e2c33bf1593 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -13,7 +13,7 @@ license: Apache-2.0 license-files: LICENSE NOTICE build-type: Simple - +extra-doc-files: CHANGELOG.md common project-config default-language: Haskell2010 From fa9554075f69ec943e6b840db267059b0804cdb4 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 20 Nov 2023 14:37:17 +0100 Subject: [PATCH 09/10] Bump versions and changelogs --- bench/locli/locli.cabal | 2 +- bench/plutus-scripts-bench/plutus-scripts-bench.cabal | 2 +- bench/tx-generator/tx-generator.cabal | 2 +- cardano-node-chairman/cardano-node-chairman.cabal | 4 ++-- cardano-node/cardano-node.cabal | 2 +- cardano-submit-api/CHANGELOG.md | 4 ++++ cardano-submit-api/cardano-submit-api.cabal | 2 +- cardano-testnet/CHANGELOG.md | 5 +++++ cardano-testnet/cardano-testnet.cabal | 2 +- cardano-tracer/CHANGELOG.md | 4 ++++ cardano-tracer/cardano-tracer.cabal | 2 +- trace-dispatcher/CHANGELOG.md | 4 ++++ trace-dispatcher/trace-dispatcher.cabal | 2 +- trace-forward/CHANGELOG.md | 4 ++++ trace-forward/trace-forward.cabal | 2 +- 15 files changed, 32 insertions(+), 11 deletions(-) diff --git a/bench/locli/locli.cabal b/bench/locli/locli.cabal index 20e37185c52..90fa99abae1 100644 --- a/bench/locli/locli.cabal +++ b/bench/locli/locli.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: locli -version: 1.33 +version: 1.34 synopsis: Cardano log analysis CLI description: Cardano log analysis CLI. category: Cardano, diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index 3f858c9e0f5..874988ecf7b 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: plutus-scripts-bench -version: 1.0.0.5 +version: 1.0.0.6 synopsis: Plutus scripts used for benchmarking description: Plutus scripts used for benchmarking. category: Cardano, diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 84140f83d68..c020d5fd3dc 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: tx-generator -version: 2.9 +version: 2.10 synopsis: A transaction workload generator for Cardano clusters description: A transaction workload generator for Cardano clusters. category: Cardano, diff --git a/cardano-node-chairman/cardano-node-chairman.cabal b/cardano-node-chairman/cardano-node-chairman.cabal index 3266bc0b13c..3e9305e1bb9 100644 --- a/cardano-node-chairman/cardano-node-chairman.cabal +++ b/cardano-node-chairman/cardano-node-chairman.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-node-chairman -version: 8.6.0 +version: 8.6.1 synopsis: The cardano full node description: The cardano full node. category: Cardano, @@ -44,7 +44,7 @@ executable cardano-node-chairman build-depends: cardano-api , cardano-crypto-class , cardano-git-rev - , cardano-node ^>= 8.6 + , cardano-node ^>= 8.7 , cardano-prelude , containers , contra-tracer diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index fcb0efd68af..9757266d955 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-node -version: 8.6.0 +version: 8.7.0 synopsis: The cardano full node description: The cardano full node. category: Cardano, diff --git a/cardano-submit-api/CHANGELOG.md b/cardano-submit-api/CHANGELOG.md index c8efc4efb73..0a5cfd7f6f3 100644 --- a/cardano-submit-api/CHANGELOG.md +++ b/cardano-submit-api/CHANGELOG.md @@ -2,6 +2,10 @@ ## vNext +## 3.2.0 -- Nov 2023 + +** Using `cardano-api-8.33` and `cardano-cli-8.15` + ## 8.5.0 -- Oct 2023 * Using `cardano-api-8.25` and `cardano-cli-8.11` diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index 467ca2410dd..47b778a93cf 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-submit-api -version: 3.1.8 +version: 3.2.0 synopsis: A web server that allows transactions to be POSTed to the cardano chain description: A web server that allows transactions to be POSTed to the cardano chain. homepage: https://github.com/input-output-hk/cardano-node diff --git a/cardano-testnet/CHANGELOG.md b/cardano-testnet/CHANGELOG.md index 208794249df..d31a6b75232 100644 --- a/cardano-testnet/CHANGELOG.md +++ b/cardano-testnet/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog for cardano-testnet +## 8.7.0 + +* Using `cardano-node-8.7.0`, `cardano-api-8.33` and `cardano-cli-8.15` +* Update `ouroboros-network` dependency. + ## 8.5.0 * Using `cardano-node-8.5.0`, `cardano-api-8.25` and `cardano-cli-8.11` diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index e2c33bf1593..b32cde8e85a 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-testnet -version: 8.6.0 +version: 8.7.0 synopsis: The cardano full node description: The cardano full node. copyright: 2021-2023 Input Output Global Inc (IOG). diff --git a/cardano-tracer/CHANGELOG.md b/cardano-tracer/CHANGELOG.md index b9ab7c86d39..b13b3345767 100644 --- a/cardano-tracer/CHANGELOG.md +++ b/cardano-tracer/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +## 0.2.1 + +* Updated to `ouroboros-network-0.10` + ## 0.2.0 * Updated to `ouroboros-network-0.9.1` diff --git a/cardano-tracer/cardano-tracer.cabal b/cardano-tracer/cardano-tracer.cabal index 81a18d97958..89150322756 100644 --- a/cardano-tracer/cardano-tracer.cabal +++ b/cardano-tracer/cardano-tracer.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-tracer -version: 0.2.0 +version: 0.2.1 synopsis: A service for logging and monitoring over Cardano nodes description: A service for logging and monitoring over Cardano nodes. category: Cardano, diff --git a/trace-dispatcher/CHANGELOG.md b/trace-dispatcher/CHANGELOG.md index f7461f28432..9666d16c64d 100644 --- a/trace-dispatcher/CHANGELOG.md +++ b/trace-dispatcher/CHANGELOG.md @@ -1,5 +1,9 @@ # Revision history for trace-dispatcher +## 2.4.1 -- Nov 2023 + +* Updated to `ouroboros-network-0.10` + ## 2.1.0 -- Sep 2023 * Updated to `ouroboros-network-0.9.1.0` diff --git a/trace-dispatcher/trace-dispatcher.cabal b/trace-dispatcher/trace-dispatcher.cabal index 9ad79d75a87..277d750a35e 100644 --- a/trace-dispatcher/trace-dispatcher.cabal +++ b/trace-dispatcher/trace-dispatcher.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: trace-dispatcher -version: 2.4.0 +version: 2.4.1 synopsis: Tracers for Cardano description: Package for development of simple and efficient tracers based on the arrow based contra-tracer package diff --git a/trace-forward/CHANGELOG.md b/trace-forward/CHANGELOG.md index ee4bb3b9ce9..e28bab4b7ca 100644 --- a/trace-forward/CHANGELOG.md +++ b/trace-forward/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +## 2.2.1 - Oct 2023 + +* Updated to `ouroboros-network-api-0.6` and `ouroboros-network-framework-0.10` + ## 2.1.0 - Sep 18 2023 * Updated to `ouroboros-network-api-0.5.1` and `ouroboros-network-framework-0.9.0`. diff --git a/trace-forward/trace-forward.cabal b/trace-forward/trace-forward.cabal index b7ef51915ae..2d4dd0443f0 100644 --- a/trace-forward/trace-forward.cabal +++ b/trace-forward/trace-forward.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: trace-forward -version: 2.2.0 +version: 2.2.1 synopsis: The forwarding protocols library for cardano node. description: The library providing typed protocols for forwarding different information from the cardano node to an external application. From 8a79c6e6f9d843ca81978ab798c593161af4b23c Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Tue, 21 Nov 2023 10:28:52 +0100 Subject: [PATCH 10/10] locli: avoid CI failure by not parsing empty input --- bench/locli/src/Cardano/Unlog/LogObject.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/bench/locli/src/Cardano/Unlog/LogObject.hs b/bench/locli/src/Cardano/Unlog/LogObject.hs index 28b0f24fb3e..bd9904840c2 100644 --- a/bench/locli/src/Cardano/Unlog/LogObject.hs +++ b/bench/locli/src/Cardano/Unlog/LogObject.hs @@ -163,6 +163,7 @@ readLogObjectStream f okDErr loAnyLimit = . Text.fromText . LText.pack) id) + . filter (not . LBS.null) . LBS.split (fromIntegral $ fromEnum '\n') where isDecodeError x = \case