@@ -106,6 +106,9 @@ logLeiosEvent nodeNames loudness e = case e of
106
106
vtKind = " kind" .= asString " VT"
107
107
rbKind = " kind" .= asString " RB"
108
108
cpuTag = " tag" .= asString " Cpu"
109
+ rbRef h = case h of
110
+ GenesisHash -> " genesis"
111
+ BlockHash x -> show (coerce x :: Int )
109
112
logNode nid (PraosNodeEvent x) = logPraos nid x
110
113
logNode nid (LeiosNodeEventCPU CPUTask {.. }) =
111
114
Just $
@@ -124,9 +127,7 @@ logLeiosEvent nodeNames loudness e = case e of
124
127
[ " slot" .= ib. header. slot
125
128
, " payload_bytes" .= fromBytes ib. body. size
126
129
, " size_bytes" .= fromBytes (messageSizeBytes ib)
127
- , " rb_ref" .= case (ib. header. rankingBlock) of
128
- GenesisHash -> " genesis"
129
- BlockHash x -> show (coerce x :: Int )
130
+ , " rb_ref" .= rbRef (ib. header. rankingBlock)
130
131
]
131
132
EventEB eb ->
132
133
mconcat
@@ -160,6 +161,7 @@ logLeiosEvent nodeNames loudness e = case e of
160
161
, " size_bytes" .= fromBytes (messageSizeBytes h + messageSizeBytes b)
161
162
, node nid
162
163
, " endorsed" .= map fst b. endorseBlocks
164
+ , " parent" .= rbRef (blockPrevHash blk)
163
165
]
164
166
logPraos nid (PraosNodeEventReceived blk) =
165
167
Just $
@@ -254,6 +256,9 @@ sharedEvent nodeNames e = case e of
254
256
, endorsement = Nothing
255
257
, endorsements = Just . map (Shared. Endorsement . Shared. BlockRef . T. pack . mkStringId . fst ) $ blk. blockBody. endorseBlocks
256
258
, payload_bytes = Just . fromIntegral $ blk. blockBody. payload
259
+ , parent = do
260
+ h@ BlockHash {} <- pure $ blockPrevHash blk
261
+ Just $! Shared. BlockRef {id = rbRef h}
257
262
, ..
258
263
}
259
264
PraosNodeEventReceived blk ->
@@ -295,6 +300,9 @@ sharedEvent nodeNames e = case e of
295
300
Shared. RBSent {block_id = Just $ T. pack $ show hash, block_ids = Just [] , .. }
296
301
_ -> Nothing
297
302
303
+ rbRef h = T. pack $ case h of
304
+ GenesisHash -> " genesis"
305
+ BlockHash x -> show (coerce x :: Int )
298
306
sharedGenerated :: T. Text -> String -> Word64 -> LeiosEventBlock -> Shared. Event
299
307
sharedGenerated producer (T. pack -> id ) slot blk =
300
308
case blk of
@@ -303,12 +311,7 @@ sharedEvent nodeNames e = case e of
303
311
{ size_bytes = Just (fromIntegral $ messageSizeBytes ib)
304
312
, payload_bytes = Just (fromIntegral $ ib. body. size)
305
313
, rb_ref =
306
- Just $
307
- T. pack
308
- ( case (ib. header. rankingBlock) of
309
- GenesisHash -> " genesis"
310
- BlockHash x -> show (coerce x :: Int )
311
- )
314
+ Just $ rbRef (ib. header. rankingBlock)
312
315
, ..
313
316
}
314
317
EventEB eb -> Shared. EBGenerated {bytes = fromIntegral (messageSizeBytes eb), input_blocks = map (Shared. BlockRef . T. pack . mkStringId) eb. inputBlocks, .. }
0 commit comments