Skip to content

Commit

Permalink
fixup! ouroboros-network upgrade: support Ouroboros.Network.Driver.St…
Browse files Browse the repository at this point in the history
…ateful
  • Loading branch information
neilmayhew committed Dec 10, 2024
1 parent 41ca0a3 commit bb533d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
15 changes: 10 additions & 5 deletions cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import qualified Ouroboros.Network.ConnectionManager.Types as ConnMgr
import Ouroboros.Network.DeltaQ (GSV (..), PeerGSV (..))
import qualified Ouroboros.Network.Diffusion as ND
import Ouroboros.Network.Driver.Limits (ProtocolLimitFailure (..))
import qualified Ouroboros.Network.Driver.Stateful as NDS
import qualified Ouroboros.Network.Driver.Stateful as Stateful
import Ouroboros.Network.ExitPolicy (RepromoteDelay (..))
import qualified Ouroboros.Network.InboundGovernor as InboundGovernor
import qualified Ouroboros.Network.InboundGovernor.State as InboundGovernor
Expand Down Expand Up @@ -175,6 +175,11 @@ instance HasSeverityAnnotation (TraceSendRecv a) where
getSeverityAnnotation _ = Debug


instance HasPrivacyAnnotation (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)
instance HasSeverityAnnotation (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f) where
getSeverityAnnotation _ = Debug


instance HasPrivacyAnnotation a => HasPrivacyAnnotation (TraceLabelPeer peer a)
instance HasSeverityAnnotation a => HasSeverityAnnotation (TraceLabelPeer peer a) where
getSeverityAnnotation (TraceLabelPeer _p a) = getSeverityAnnotation a
Expand Down Expand Up @@ -660,11 +665,11 @@ instance (LocalStateQuery.ShowQuery (BlockQuery blk), ToObject localPeer)
trTransformer = trStructured

instance
( HasPrivacyAnnotation (NDS.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)
, HasSeverityAnnotation (NDS.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)
, ToObject (NDS.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)
( HasPrivacyAnnotation (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)
, HasSeverityAnnotation (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)
, ToObject (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)
, ToObject localPeer)
=> Transformable Text IO (TraceLabelPeer localPeer (NDS.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)) where
=> Transformable Text IO (TraceLabelPeer localPeer (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) f)) where
trTransformer = trStructured

instance (ToObject peer, Show (TxId (GenTx blk)), Show (GenTx blk))
Expand Down
12 changes: 8 additions & 4 deletions cardano-node/src/Cardano/Tracing/Tracers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import Ouroboros.Consensus.HeaderValidation (OtherHeaderEnvelopeError)
import Ouroboros.Consensus.Ledger.Abstract (LedgerErr, LedgerState)
import Ouroboros.Consensus.Ledger.Extended (ledgerState)
import Ouroboros.Consensus.Ledger.Inspect (InspectLedger, LedgerEvent)
import Ouroboros.Consensus.Ledger.Query (BlockQuery)
import Ouroboros.Consensus.Ledger.Query (BlockQuery, Query)
import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTx, GenTxId, HasTxs,
LedgerSupportsMempool, ByteSize32 (..))
import Ouroboros.Consensus.Ledger.SupportsProtocol (LedgerSupportsProtocol)
Expand Down Expand Up @@ -98,6 +98,7 @@ import Ouroboros.Network.ConnectionManager.Types (ConnectionManagerCou
import qualified Ouroboros.Network.Diffusion as Diffusion
import qualified Ouroboros.Network.Diffusion.NonP2P as NonP2P
import qualified Ouroboros.Network.Diffusion.P2P as P2P
import qualified Ouroboros.Network.Driver.Stateful as Stateful
import qualified Ouroboros.Network.InboundGovernor as InboundGovernor
import Ouroboros.Network.InboundGovernor.State as InboundGovernor
import Ouroboros.Network.NodeToClient (LocalAddress)
Expand All @@ -106,7 +107,7 @@ import Ouroboros.Network.PeerSelection.Governor (ChurnCounters (..),
PeerSelectionCounters, PeerSelectionView (..))
import qualified Ouroboros.Network.PeerSelection.Governor as Governor
import Ouroboros.Network.Point (fromWithOrigin)
import Ouroboros.Network.Protocol.LocalStateQuery.Type (ShowQuery)
import Ouroboros.Network.Protocol.LocalStateQuery.Type (LocalStateQuery, ShowQuery)
import Ouroboros.Network.TxSubmission.Inbound

import Codec.CBOR.Read (DeserialiseFailure)
Expand Down Expand Up @@ -1385,8 +1386,11 @@ forgeStateInfoTracer p _ts tracer = Tracer $ \ev -> do
--------------------------------------------------------------------------------

nodeToClientTracers'
:: ( ToObject localPeer
, ShowQuery (BlockQuery blk)
:: forall blk localPeer.
( HasPrivacyAnnotation (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) LocalStateQuery.State)
, HasSeverityAnnotation (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) LocalStateQuery.State)
, ToObject (Stateful.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)) LocalStateQuery.State)
, ToObject localPeer
)
=> TraceSelection
-> TracingVerbosity
Expand Down

0 comments on commit bb533d1

Please sign in to comment.