Skip to content

Commit

Permalink
Explicit conensus traces
Browse files Browse the repository at this point in the history
This adds block fetch tracers to `NodeParams`.  This gives the power to
the user to instantiate the traces.  This is useful for debuging block
fetch logic.
  • Loading branch information
coot committed Jul 11, 2019
1 parent adc7ea8 commit fa3b5eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ouroboros-consensus/src/Ouroboros/Consensus/Node.hs
Expand Up @@ -117,6 +117,8 @@ data NodeCallbacks m blk = NodeCallbacks {
data NodeParams m peer blk = NodeParams {
tracer :: Tracer m String
, mempoolTracer :: Tracer m (TraceEventMempool blk)
, decisionTracer :: Tracer m [TraceLabelPeer peer (FetchDecision [Point (Header blk)])]
, fetchClientTracer :: Tracer m (TraceLabelPeer peer (TraceFetchClientState (Header blk)))
, threadRegistry :: ThreadRegistry m
, maxClockSkew :: ClockSkew
, cfg :: NodeConfig (BlockProtocol blk)
Expand All @@ -140,7 +142,7 @@ nodeKernel
)
=> NodeParams m peer blk
-> m (NodeKernel m peer blk)
nodeKernel params@NodeParams { threadRegistry, cfg } = do
nodeKernel params@NodeParams { threadRegistry, cfg, decisionTracer, fetchClientTracer } = do
st <- initInternalState params

forkBlockProduction st
Expand All @@ -151,8 +153,8 @@ nodeKernel params@NodeParams { threadRegistry, cfg } = do
-- Run the block fetch logic in the background. This will call
-- 'addFetchedBlock' whenever a new block is downloaded.
void $ forkLinked threadRegistry $ blockFetchLogic
nullTracer -- fetch decision tracer
nullTracer -- fetch client state tracer
decisionTracer
fetchClientTracer
blockFetchInterface
fetchClientRegistry

Expand Down
2 changes: 2 additions & 0 deletions ouroboros-consensus/test-consensus/Test/Dynamic/Network.hs
Expand Up @@ -230,6 +230,8 @@ broadcastNetwork registry btime numCoreNodes pInfo initRNG numSlots = do
let nodeParams = NodeParams
{ tracer = nullTracer
, mempoolTracer = nullTracer
, decisionTracer = nullTracer
, fetchClientTracer = nullTracer
, threadRegistry = registry
, maxClockSkew = ClockSkew 1
, cfg = pInfoConfig
Expand Down

0 comments on commit fa3b5eb

Please sign in to comment.