@@ -28,7 +28,8 @@ import Ouroboros.Consensus.Ledger.Abstract (LedgerError)
28
28
import Ouroboros.Consensus.Ledger.Extended (ExtValidationError (.. ))
29
29
import Ouroboros.Consensus.Ledger.Inspect (InspectLedger , LedgerEvent (.. ))
30
30
import Ouroboros.Consensus.Ledger.SupportsProtocol (LedgerSupportsProtocol )
31
- import Ouroboros.Consensus.Protocol.Abstract (SelectView , ValidationErr )
31
+ import Ouroboros.Consensus.Peras.SelectView
32
+ import Ouroboros.Consensus.Protocol.Abstract (ValidationErr )
32
33
import qualified Ouroboros.Consensus.Protocol.PBFT as PBFT
33
34
import qualified Ouroboros.Consensus.Storage.ChainDB as ChainDB
34
35
import qualified Ouroboros.Consensus.Storage.ImmutableDB as ImmDB
@@ -79,7 +80,7 @@ withAddedToCurrentChainEmptyLimited tr = do
79
80
instance ( LogFormatting (Header blk )
80
81
, LogFormatting (LedgerEvent blk )
81
82
, LogFormatting (RealPoint blk )
82
- , LogFormatting (SelectView (BlockProtocol blk ))
83
+ , LogFormatting (WeightedSelectView (BlockProtocol blk ))
83
84
, ConvertRawHash blk
84
85
, ConvertRawHash (Header blk )
85
86
, LedgerSupportsProtocol blk
@@ -103,6 +104,7 @@ instance ( LogFormatting (Header blk)
103
104
" Chain Selection was starved."
104
105
ChainDB. ChainSelStarvation (FallingEdgeWith pt) ->
105
106
" Chain Selection was unstarved by " <> renderRealPoint pt
107
+ forHuman _ = " TODO"
106
108
107
109
forMachine _ ChainDB. TraceLastShutdownUnclean =
108
110
mconcat [ " kind" .= String " LastShutdownUnclean" ]
@@ -132,6 +134,10 @@ instance ( LogFormatting (Header blk)
132
134
forMachine details v
133
135
forMachine details (ChainDB. TraceVolatileDBEvent v) =
134
136
forMachine details v
137
+ forMachine _details (ChainDB. TracePerasCertDbEvent _v) =
138
+ mempty -- TODO fill in
139
+ forMachine _details (ChainDB. TraceAddPerasCertEvent _v) =
140
+ mempty -- TODO fill in
135
141
136
142
asMetrics ChainDB. TraceLastShutdownUnclean = []
137
143
asMetrics (ChainDB. TraceChainSelStarvationEvent _) = []
@@ -145,6 +151,9 @@ instance ( LogFormatting (Header blk)
145
151
asMetrics (ChainDB. TraceLedgerDBEvent v) = asMetrics v
146
152
asMetrics (ChainDB. TraceImmutableDBEvent v) = asMetrics v
147
153
asMetrics (ChainDB. TraceVolatileDBEvent v) = asMetrics v
154
+ -- TODO defer to v
155
+ asMetrics (ChainDB. TracePerasCertDbEvent _v) = []
156
+ asMetrics (ChainDB. TraceAddPerasCertEvent _v) = []
148
157
149
158
150
159
instance MetaTrace (ChainDB. TraceEvent blk ) where
@@ -172,6 +181,9 @@ instance MetaTrace (ChainDB.TraceEvent blk) where
172
181
nsPrependInner " ImmDbEvent" (namespaceFor ev)
173
182
namespaceFor (ChainDB. TraceVolatileDBEvent ev) =
174
183
nsPrependInner " VolatileDbEvent" (namespaceFor ev)
184
+ -- TODO defer to ev
185
+ namespaceFor (ChainDB. TracePerasCertDbEvent _ev) = Namespace [] [" PerasCertDbEvent" ]
186
+ namespaceFor (ChainDB. TraceAddPerasCertEvent _ev) = Namespace [] [" AddPerasCertEvent" ]
175
187
176
188
severityFor (Namespace _ [" LastShutdownUnclean" ]) _ = Just Info
177
189
severityFor (Namespace _ [" ChainSelStarvationEvent" ]) _ = Just Debug
@@ -392,7 +404,7 @@ instance MetaTrace (ChainDB.TraceEvent blk) where
392
404
instance ( LogFormatting (Header blk )
393
405
, LogFormatting (LedgerEvent blk )
394
406
, LogFormatting (RealPoint blk )
395
- , LogFormatting (SelectView (BlockProtocol blk ))
407
+ , LogFormatting (WeightedSelectView (BlockProtocol blk ))
396
408
, ConvertRawHash blk
397
409
, ConvertRawHash (Header blk )
398
410
, LedgerSupportsProtocol blk
@@ -486,10 +498,10 @@ instance ( LogFormatting (Header blk)
486
498
in mconcat $
487
499
[ " kind" .= String " AddedToCurrentChain"
488
500
, " newtip" .= renderPointForDetails DDetailed (AF. headPoint extended)
489
- , " newTipSelectView " .= forMachine DDetailed (ChainDB. newTipSelectView selChangedInfo)
501
+ , " newSuffixSelectView " .= forMachine DDetailed (ChainDB. newSuffixSelectView selChangedInfo)
490
502
]
491
- ++ [ " oldTipSelectView " .= forMachine DDetailed oldTipSelectView
492
- | Just oldTipSelectView <- [ChainDB. oldTipSelectView selChangedInfo]
503
+ ++ [ " oldSuffixSelectView " .= forMachine DDetailed oldSuffixSelectView
504
+ | Just oldSuffixSelectView <- [ChainDB. oldSuffixSelectView selChangedInfo]
493
505
]
494
506
++ [ " headers" .= toJSON (forMachine DDetailed `map` addedHdrsNewChain base extended)
495
507
]
@@ -502,10 +514,10 @@ instance ( LogFormatting (Header blk)
502
514
mconcat $
503
515
[ " kind" .= String " AddedToCurrentChain"
504
516
, " newtip" .= renderPointForDetails dtal (AF. headPoint extended)
505
- , " newTipSelectView " .= forMachine dtal (ChainDB. newTipSelectView selChangedInfo)
517
+ , " newSuffixSelectView " .= forMachine dtal (ChainDB. newSuffixSelectView selChangedInfo)
506
518
]
507
- ++ [ " oldTipSelectView " .= forMachine dtal oldTipSelectView
508
- | Just oldTipSelectView <- [ChainDB. oldTipSelectView selChangedInfo]
519
+ ++ [ " oldSuffixSelectView " .= forMachine dtal oldSuffixSelectView
520
+ | Just oldSuffixSelectView <- [ChainDB. oldSuffixSelectView selChangedInfo]
509
521
]
510
522
++ [ " events" .= toJSON (map (forMachine dtal) events)
511
523
| not (null events) ]
@@ -521,10 +533,10 @@ instance ( LogFormatting (Header blk)
521
533
in mconcat $
522
534
[ " kind" .= String " TraceAddBlockEvent.SwitchedToAFork"
523
535
, " newtip" .= renderPointForDetails DDetailed (AF. headPoint new)
524
- , " newTipSelectView " .= forMachine DDetailed (ChainDB. newTipSelectView selChangedInfo)
536
+ , " newSuffixSelectView " .= forMachine DDetailed (ChainDB. newSuffixSelectView selChangedInfo)
525
537
]
526
- ++ [ " oldTipSelectView " .= forMachine DDetailed oldTipSelectView
527
- | Just oldTipSelectView <- [ChainDB. oldTipSelectView selChangedInfo]
538
+ ++ [ " oldSuffixSelectView " .= forMachine DDetailed oldSuffixSelectView
539
+ | Just oldSuffixSelectView <- [ChainDB. oldSuffixSelectView selChangedInfo]
528
540
]
529
541
++ [ " headers" .= toJSON (forMachine DDetailed `map` addedHdrsNewChain old new)
530
542
]
@@ -537,10 +549,10 @@ instance ( LogFormatting (Header blk)
537
549
mconcat $
538
550
[ " kind" .= String " TraceAddBlockEvent.SwitchedToAFork"
539
551
, " newtip" .= renderPointForDetails dtal (AF. headPoint new)
540
- , " newTipSelectView " .= forMachine dtal (ChainDB. newTipSelectView selChangedInfo)
552
+ , " newSuffixSelectView " .= forMachine dtal (ChainDB. newSuffixSelectView selChangedInfo)
541
553
]
542
- ++ [ " oldTipSelectView " .= forMachine dtal oldTipSelectView
543
- | Just oldTipSelectView <- [ChainDB. oldTipSelectView selChangedInfo]
554
+ ++ [ " oldSuffixSelectView " .= forMachine dtal oldSuffixSelectView
555
+ | Just oldSuffixSelectView <- [ChainDB. oldSuffixSelectView selChangedInfo]
544
556
]
545
557
++ [ " events" .= toJSON (map (forMachine dtal) events)
546
558
| not (null events) ]
0 commit comments