Skip to content

Commit f04c00d

Browse files
committed
Bump o-c SRP and update tracers to new error sum type
1 parent 6592572 commit f04c00d

2 files changed

Lines changed: 46 additions & 9 deletions

File tree

cabal.project

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ allow-newer:
8585
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.
8686

8787
-- Points to patch on top of ouroboros-consensus/leios-prototype
88-
-- 80c800f = 50c9711 + reject invalid Leios cert as InvalidBlock (no node crash)
8988
source-repository-package
9089
type: git
9190
location: https://github.com/IntersectMBO/ouroboros-consensus
92-
tag: 80c800fa1d3bb99ea2528e1dc5582aa979663740
93-
--sha256: sha256-6mGDH1DMs1VPujZLgbzusCO+ZdFms8AeoyoKZ/NhYg4=
91+
tag: 3091f0658c8a94c2a6c8ae416ff8e0ff0e9d1f92
92+
--sha256: sha256-AWdFtD3KtJMNPVwS3eFqUDVHPFLvjfB+mzjIAGTw0WM=
9493

9594
-- Points to nfrisby-pr93-lookahead-merge-commit tag
9695
source-repository-package

cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ import Data.Void (absurd)
6767
import Data.Word (Word64)
6868
import Numeric (showFFloat)
6969

70+
import LeiosDemoTypes (LeiosExtValidationError (..))
71+
7072
-- {-# ANN module ("HLint: ignore Redundant bracket" :: Text) #-}
7173

7274
-- A limiter that is not coming from configuration, because it carries a special filter
@@ -2865,18 +2867,54 @@ instance ( LogFormatting (LedgerError blk)
28652867
=> LogFormatting (ExtValidationError blk) where
28662868
forMachine dtal (ExtValidationErrorLedger err) = forMachine dtal err
28672869
forMachine dtal (ExtValidationErrorHeader err) = forMachine dtal err
2868-
forMachine _ (ExtValidationErrorLeios msg) =
2869-
mconcat [ "kind" .= String "ExtValidationErrorLeios"
2870-
, "error" .= String (Text.pack msg)
2871-
]
2870+
forMachine dtal (ExtValidationErrorLeios err) = forMachine dtal err
28722871

28732872
forHuman (ExtValidationErrorLedger err) = forHuman err
28742873
forHuman (ExtValidationErrorHeader err) = forHuman err
2875-
forHuman (ExtValidationErrorLeios msg) = Text.pack msg
2874+
forHuman (ExtValidationErrorLeios err) = forHuman err
28762875

28772876
asMetrics (ExtValidationErrorLedger err) = asMetrics err
28782877
asMetrics (ExtValidationErrorHeader err) = asMetrics err
2879-
asMetrics (ExtValidationErrorLeios _) = []
2878+
asMetrics (ExtValidationErrorLeios err) = asMetrics err
2879+
2880+
instance LogFormatting LeiosExtValidationError where
2881+
forMachine _ (LeiosCertificateWithoutAnnouncement cert) =
2882+
mconcat [ "kind" .= String "LeiosCertificateWithoutAnnouncement"
2883+
, "certificate" .= String (Text.pack (show cert))
2884+
]
2885+
forMachine _ (LeiosMissingCommittee point cert) =
2886+
mconcat [ "kind" .= String "LeiosMissingCommittee"
2887+
, "announcedEb" .= String (Text.pack (show point))
2888+
, "certificate" .= String (Text.pack (show cert))
2889+
]
2890+
forMachine _ (LeiosCertificateAfterGenesis cert point) =
2891+
mconcat [ "kind" .= String "LeiosCertificateAfterGenesis"
2892+
, "certificate" .= String (Text.pack (show cert))
2893+
, "announcedEb" .= String (Text.pack (show point))
2894+
]
2895+
forMachine _ (LeiosInvalidCertificate cert point rbHash verErr) =
2896+
mconcat [ "kind" .= String "LeiosInvalidCertificate"
2897+
, "certificate" .= String (Text.pack (show cert))
2898+
, "announcedEb" .= String (Text.pack (show point))
2899+
, "announcingRb" .= String (Text.pack (show rbHash))
2900+
, "verificationError" .= String (Text.pack (show verErr))
2901+
]
2902+
2903+
forHuman (LeiosCertificateWithoutAnnouncement cert) =
2904+
"CertRB carries a Leios certificate but its predecessor announced no EB: "
2905+
<> Text.pack (show cert)
2906+
forHuman (LeiosMissingCommittee point cert) =
2907+
"CertRB for " <> Text.pack (show point)
2908+
<> " but there is no Leios committee to verify its certificate: " <> Text.pack (show cert)
2909+
forHuman (LeiosCertificateAfterGenesis cert point) =
2910+
"CertRB for " <> Text.pack (show point)
2911+
<> " has no announcing ranking block (would certify at genesis): " <> Text.pack (show cert)
2912+
forHuman (LeiosInvalidCertificate cert point rbHash verErr) =
2913+
"Invalid Leios certificate for " <> Text.pack (show point)
2914+
<> " announced by ranking block " <> Text.pack (show rbHash) <> ": " <> Text.pack (show verErr)
2915+
<> " (" <> Text.pack (show cert) <> ")"
2916+
2917+
asMetrics _ = []
28802918

28812919
instance (Show (PBFT.PBftVerKeyHash c))
28822920
=> LogFormatting (PBFT.PBftValidationErr c) where

0 commit comments

Comments
 (0)