{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}

{-# OPTIONS_GHC -Wno-orphans  #-}

module Cardano.Tracing.OrphanInstances.Byron () where

import           Cardano.Prelude

import           Data.Aeson (Value (..))
import qualified Data.Set as Set
import qualified Data.Text as Text

import           Cardano.Tracing.OrphanInstances.Common
import           Cardano.Tracing.OrphanInstances.Consensus ()
import           Cardano.Tracing.Render (renderTxId)

import           Ouroboros.Consensus.Block (Header)
import           Ouroboros.Network.Block (blockHash, blockNo, blockSlot)

import           Ouroboros.Consensus.Byron.Ledger (ByronBlock (..),
                   ByronOtherHeaderEnvelopeError (..), TxId (..), byronHeaderRaw)
import           Ouroboros.Consensus.Byron.Ledger.Inspect (ByronLedgerUpdate (..),
                   ProtocolUpdate (..), UpdateState (..))
import           Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, txId)
import           Ouroboros.Consensus.Util.Condense (condense)

import           Cardano.Chain.Block (ABlockOrBoundaryHdr (..), AHeader (..),
                   ChainValidationError (..), delegationCertificate)
import           Cardano.Chain.Byron.API (ApplyMempoolPayloadErr (..))
import           Cardano.Chain.Delegation (delegateVK)
import           Cardano.Crypto.Signing (VerificationKey)

{- HLINT ignore "Use :" -}

--
-- | instances of @ToObject@
--
-- NOTE: this list is sorted by the unqualified name of the outermost type.

instance ToObject ApplyMempoolPayloadErr where
  toObject :: TracingVerbosity -> ApplyMempoolPayloadErr -> Object
toObject TracingVerbosity
_verb (MempoolTxErr UTxOValidationError
utxoValidationErr) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MempoolTxErr"
      , Key
"error" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (UTxOValidationError -> Text
forall a b. (Show a, ConvertText String b) => a -> b
show UTxOValidationError
utxoValidationErr)
      ]
  toObject TracingVerbosity
_verb (MempoolDlgErr Error
delegScheduleError) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MempoolDlgErr"
      , Key
"error" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Error -> Text
forall a b. (Show a, ConvertText String b) => a -> b
show Error
delegScheduleError)
      ]
  toObject TracingVerbosity
_verb (MempoolUpdateProposalErr Error
iFaceErr) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MempoolUpdateProposalErr"
      , Key
"error" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Error -> Text
forall a b. (Show a, ConvertText String b) => a -> b
show Error
iFaceErr)
      ]
  toObject TracingVerbosity
_verb (MempoolUpdateVoteErr Error
iFaceErrr) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MempoolUpdateVoteErr"
      , Key
"error" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Error -> Text
forall a b. (Show a, ConvertText String b) => a -> b
show Error
iFaceErrr)
      ]

instance ToObject ByronLedgerUpdate where
  toObject :: TracingVerbosity -> ByronLedgerUpdate -> Object
toObject TracingVerbosity
verb (ByronUpdatedProtocolUpdates [ProtocolUpdate]
protocolUpdates) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind"            Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ByronUpdatedProtocolUpdates"
      , Key
"protocolUpdates" Key -> [Object] -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (ProtocolUpdate -> Object) -> [ProtocolUpdate] -> [Object]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
map (TracingVerbosity -> ProtocolUpdate -> Object
forall a. ToObject a => TracingVerbosity -> a -> Object
toObject TracingVerbosity
verb) [ProtocolUpdate]
protocolUpdates
      ]

instance ToObject ProtocolUpdate where
  toObject :: TracingVerbosity -> ProtocolUpdate -> Object
toObject TracingVerbosity
verb (ProtocolUpdate ProtocolVersion
updateVersion UpdateState
updateState) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind"                  Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ProtocolUpdate"
      , Key
"protocolUpdateVersion" Key -> ProtocolVersion -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= ProtocolVersion
updateVersion
      , Key
"protocolUpdateState"   Key -> Object -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= TracingVerbosity -> UpdateState -> Object
forall a. ToObject a => TracingVerbosity -> a -> Object
toObject TracingVerbosity
verb UpdateState
updateState
      ]

instance ToObject UpdateState where
  toObject :: TracingVerbosity -> UpdateState -> Object
toObject TracingVerbosity
_verb UpdateState
updateState = case UpdateState
updateState of
      UpdateRegistered SlotNo
slot ->
        [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
          [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UpdateRegistered"
          , Key
"slot" Key -> SlotNo -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= SlotNo
slot
          ]
      UpdateActive Set KeyHash
votes ->
        [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
          [ Key
"kind"  Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UpdateActive"
          , Key
"votes" Key -> [Text] -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (KeyHash -> Text) -> [KeyHash] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
map (String -> Text
Text.pack (String -> Text) -> (KeyHash -> String) -> KeyHash -> Text
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. KeyHash -> String
forall a b. (Show a, ConvertText String b) => a -> b
show) (Set KeyHash -> [KeyHash]
forall a. Set a -> [a]
Set.toList Set KeyHash
votes)
          ]
      UpdateConfirmed SlotNo
slot ->
        [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
          [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UpdateConfirmed"
          , Key
"slot" Key -> SlotNo -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= SlotNo
slot
          ]
      UpdateStablyConfirmed Set KeyHash
endorsements ->
        [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
          [ Key
"kind"         Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UpdateStablyConfirmed"
          , Key
"endorsements" Key -> [Text] -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (KeyHash -> Text) -> [KeyHash] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
map (String -> Text
Text.pack (String -> Text) -> (KeyHash -> String) -> KeyHash -> Text
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. KeyHash -> String
forall a b. (Show a, ConvertText String b) => a -> b
show) (Set KeyHash -> [KeyHash]
forall a. Set a -> [a]
Set.toList Set KeyHash
endorsements)
          ]
      UpdateCandidate SlotNo
slot EpochNo
epoch ->
        [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
          [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UpdateCandidate"
          , Key
"slot" Key -> SlotNo -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= SlotNo
slot
          , Key
"epoch" Key -> EpochNo -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= EpochNo
epoch
          ]
      UpdateStableCandidate EpochNo
transitionEpoch ->
        [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
          [ Key
"kind"            Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UpdateStableCandidate"
          , Key
"transitionEpoch" Key -> EpochNo -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= EpochNo
transitionEpoch
          ]

instance ToObject (GenTx ByronBlock) where
  toObject :: TracingVerbosity -> GenTx ByronBlock -> Object
toObject TracingVerbosity
_ GenTx ByronBlock
tx = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"txid" Key -> Text -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Int -> Text -> Text
Text.take Int
8 (TxId (GenTx ByronBlock) -> Text
forall blk. ConvertTxId blk => TxId (GenTx blk) -> Text
renderTxId (GenTx ByronBlock -> TxId (GenTx ByronBlock)
forall tx. HasTxId tx => tx -> TxId tx
txId GenTx ByronBlock
tx)) ]


instance ToJSON (TxId (GenTx ByronBlock)) where
  toJSON :: TxId (GenTx ByronBlock) -> Value
toJSON = Text -> Value
String (Text -> Value)
-> (TxId (GenTx ByronBlock) -> Text)
-> TxId (GenTx ByronBlock)
-> Value
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Int -> Text -> Text
Text.take Int
8 (Text -> Text)
-> (TxId (GenTx ByronBlock) -> Text)
-> TxId (GenTx ByronBlock)
-> Text
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. TxId (GenTx ByronBlock) -> Text
forall blk. ConvertTxId blk => TxId (GenTx blk) -> Text
renderTxId


instance ToObject ChainValidationError where
  toObject :: TracingVerbosity -> ChainValidationError -> Object
toObject TracingVerbosity
_verb ChainValidationError
ChainValidationBoundaryTooLarge =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationBoundaryTooLarge" ]
  toObject TracingVerbosity
_verb ChainValidationError
ChainValidationBlockAttributesTooLarge =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationBlockAttributesTooLarge" ]
  toObject TracingVerbosity
_verb (ChainValidationBlockTooLarge Natural
_ Natural
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationBlockTooLarge" ]
  toObject TracingVerbosity
_verb ChainValidationError
ChainValidationHeaderAttributesTooLarge =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationHeaderAttributesTooLarge" ]
  toObject TracingVerbosity
_verb (ChainValidationHeaderTooLarge Natural
_ Natural
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationHeaderTooLarge" ]
  toObject TracingVerbosity
_verb (ChainValidationDelegationPayloadError Text
err) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
err ]
  toObject TracingVerbosity
_verb (ChainValidationInvalidDelegation VerificationKey
_ VerificationKey
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationInvalidDelegation" ]
  toObject TracingVerbosity
_verb (ChainValidationGenesisHashMismatch GenesisHash
_ GenesisHash
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationGenesisHashMismatch" ]
  toObject TracingVerbosity
_verb (ChainValidationExpectedGenesisHash GenesisHash
_ HeaderHash
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationExpectedGenesisHash" ]
  toObject TracingVerbosity
_verb (ChainValidationExpectedHeaderHash HeaderHash
_ GenesisHash
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationExpectedHeaderHash" ]
  toObject TracingVerbosity
_verb (ChainValidationInvalidHash HeaderHash
_ HeaderHash
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationInvalidHash" ]
  toObject TracingVerbosity
_verb (ChainValidationMissingHash HeaderHash
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationMissingHash" ]
  toObject TracingVerbosity
_verb (ChainValidationUnexpectedGenesisHash HeaderHash
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationUnexpectedGenesisHash" ]
  toObject TracingVerbosity
_verb (ChainValidationInvalidSignature BlockSignature
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationInvalidSignature" ]
  toObject TracingVerbosity
_verb (ChainValidationDelegationSchedulingError Error
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationDelegationSchedulingError" ]
  toObject TracingVerbosity
_verb (ChainValidationProtocolMagicMismatch ProtocolMagicId
_ ProtocolMagicId
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationProtocolMagicMismatch" ]
  toObject TracingVerbosity
_verb ChainValidationError
ChainValidationSignatureLight =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationSignatureLight" ]
  toObject TracingVerbosity
_verb (ChainValidationTooManyDelegations VerificationKey
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationTooManyDelegations" ]
  toObject TracingVerbosity
_verb (ChainValidationUpdateError SlotNumber
_ Error
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationUpdateError" ]
  toObject TracingVerbosity
_verb (ChainValidationUTxOValidationError UTxOValidationError
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationUTxOValidationError" ]
  toObject TracingVerbosity
_verb (ChainValidationProofValidationError ProofValidationError
_) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ChainValidationProofValidationError" ]


instance ToObject (Header ByronBlock) where
  toObject :: TracingVerbosity -> Header ByronBlock -> Object
toObject TracingVerbosity
_verb Header ByronBlock
b =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat ([Object] -> Object) -> [Object] -> Object
forall a b. (a -> b) -> a -> b
$
        [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"ByronBlock"
        , Key
"hash" Key -> String -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= ByronHash -> String
forall a. Condense a => a -> String
condense (Header ByronBlock -> HeaderHash (Header ByronBlock)
forall b. HasHeader b => b -> HeaderHash b
blockHash Header ByronBlock
b)
        , Key
"slotNo" Key -> String -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= SlotNo -> String
forall a. Condense a => a -> String
condense (Header ByronBlock -> SlotNo
forall b. HasHeader b => b -> SlotNo
blockSlot Header ByronBlock
b)
        , Key
"blockNo" Key -> String -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= BlockNo -> String
forall a. Condense a => a -> String
condense (Header ByronBlock -> BlockNo
forall b. HasHeader b => b -> BlockNo
blockNo Header ByronBlock
b)
        ] [Object] -> [Object] -> [Object]
forall a. Semigroup a => a -> a -> a
<>
        case Header ByronBlock -> ABlockOrBoundaryHdr ByteString
byronHeaderRaw Header ByronBlock
b of
          ABOBBoundaryHdr{} -> []
          ABOBBlockHdr AHeader ByteString
h ->
            [ Key
"delegate" Key -> String -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= VerificationKey -> String
forall a. Condense a => a -> String
condense (AHeader ByteString -> VerificationKey
headerSignerVk AHeader ByteString
h) ]
   where
     headerSignerVk :: AHeader ByteString -> VerificationKey
     headerSignerVk :: AHeader ByteString -> VerificationKey
headerSignerVk =
       ACertificate ByteString -> VerificationKey
forall a. ACertificate a -> VerificationKey
delegateVK (ACertificate ByteString -> VerificationKey)
-> (AHeader ByteString -> ACertificate ByteString)
-> AHeader ByteString
-> VerificationKey
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ABlockSignature ByteString -> ACertificate ByteString
forall a. ABlockSignature a -> ACertificate a
delegationCertificate (ABlockSignature ByteString -> ACertificate ByteString)
-> (AHeader ByteString -> ABlockSignature ByteString)
-> AHeader ByteString
-> ACertificate ByteString
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. AHeader ByteString -> ABlockSignature ByteString
forall a. AHeader a -> ABlockSignature a
headerSignature


instance ToObject ByronOtherHeaderEnvelopeError where
  toObject :: TracingVerbosity -> ByronOtherHeaderEnvelopeError -> Object
toObject TracingVerbosity
_verb (UnexpectedEBBInSlot SlotNo
slot) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UnexpectedEBBInSlot"
      , Key
"slot" Key -> SlotNo -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= SlotNo
slot
      ]