{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Ouroboros.Consensus.Tracing.Era.HardFork ()
where
import Cardano.Logging
import Cardano.Slotting.Slot (EpochSize (..))
import Data.Aeson
import Data.Proxy (Proxy (..))
import Data.SOP (All, Compose, K (K))
import Data.SOP.Strict
import Ouroboros.Consensus.Block
( BlockProtocol
, CannotForge
, ForgeStateInfo
, ForgeStateUpdateError
, PerasWeight (..)
)
import Ouroboros.Consensus.BlockchainTime (getSlotLength)
import Ouroboros.Consensus.Cardano.Condense ()
import Ouroboros.Consensus.HardFork.Combinator
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras
( EraMismatch (..)
, OneEraCannotForge (..)
, OneEraEnvelopeErr (..)
, OneEraForgeStateInfo (..)
, OneEraForgeStateUpdateError (..)
, OneEraLedgerError (..)
, OneEraLedgerUpdate (..)
, OneEraLedgerWarning (..)
, OneEraTiebreakerView (..)
, OneEraValidationErr (..)
, mkEraMismatch
)
import Ouroboros.Consensus.HardFork.Combinator.Condense ()
import Ouroboros.Consensus.HardFork.History
( EraParams (eraEpochSize, eraSafeZone, eraSlotLength)
, SafeZone
)
import Ouroboros.Consensus.HardFork.History.EraParams (EraParams (EraParams))
import Ouroboros.Consensus.HeaderValidation (OtherHeaderEnvelopeError)
import Ouroboros.Consensus.Ledger.Abstract (LedgerError)
import Ouroboros.Consensus.Ledger.Inspect (LedgerUpdate, LedgerWarning)
import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr)
import Ouroboros.Consensus.Peras.SelectView
import Ouroboros.Consensus.Protocol.Abstract (TiebreakerView, ValidationErr)
import Ouroboros.Consensus.TypeFamilyWrappers
import Ouroboros.Consensus.Util.Condense (Condense (..))
instance All (LogFormatting `Compose` Header) xs => LogFormatting (Header (HardForkBlock xs)) where
forMachine :: DetailLevel -> Header (HardForkBlock xs) -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (Header (HardForkBlock xs) -> NS (K Object) xs)
-> Header (HardForkBlock xs)
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting Header)
-> (forall a.
Compose LogFormatting Header a =>
Header a -> K Object a)
-> NS Header xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` Header)) (Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (Header a -> Object) -> Header a -> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> Header a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS Header xs -> NS (K Object) xs)
-> (Header (HardForkBlock xs) -> NS Header xs)
-> Header (HardForkBlock xs)
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraHeader xs -> NS Header xs
forall (xs :: [*]). OneEraHeader xs -> NS Header xs
getOneEraHeader
(OneEraHeader xs -> NS Header xs)
-> (Header (HardForkBlock xs) -> OneEraHeader xs)
-> Header (HardForkBlock xs)
-> NS Header xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Header (HardForkBlock xs) -> OneEraHeader xs
forall (xs :: [*]). Header (HardForkBlock xs) -> OneEraHeader xs
getHardForkHeader
instance All (Compose LogFormatting GenTx) xs => LogFormatting (GenTx (HardForkBlock xs)) where
forMachine :: DetailLevel -> GenTx (HardForkBlock xs) -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (GenTx (HardForkBlock xs) -> NS (K Object) xs)
-> GenTx (HardForkBlock xs)
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting GenTx)
-> (forall a.
Compose LogFormatting GenTx a =>
GenTx a -> K Object a)
-> NS GenTx xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` GenTx)) (Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (GenTx a -> Object) -> GenTx a -> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> GenTx a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS GenTx xs -> NS (K Object) xs)
-> (GenTx (HardForkBlock xs) -> NS GenTx xs)
-> GenTx (HardForkBlock xs)
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraGenTx xs -> NS GenTx xs
forall (xs :: [*]). OneEraGenTx xs -> NS GenTx xs
getOneEraGenTx
(OneEraGenTx xs -> NS GenTx xs)
-> (GenTx (HardForkBlock xs) -> OneEraGenTx xs)
-> GenTx (HardForkBlock xs)
-> NS GenTx xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenTx (HardForkBlock xs) -> OneEraGenTx xs
forall (xs :: [*]). GenTx (HardForkBlock xs) -> OneEraGenTx xs
getHardForkGenTx
instance All (LogFormatting `Compose` WrapApplyTxErr) xs => LogFormatting (HardForkApplyTxErr xs) where
forMachine :: DetailLevel -> HardForkApplyTxErr xs -> Object
forMachine DetailLevel
dtal (HardForkApplyTxErrFromEra OneEraApplyTxErr xs
err) = DetailLevel -> OneEraApplyTxErr xs -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal OneEraApplyTxErr xs
err
forMachine DetailLevel
_dtal (HardForkApplyTxErrWrongEra MismatchEraInfo xs
mismatch) =
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkApplyTxErrWrongEra"
, Key
"currentEra" Key -> Text -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
ledgerEraName
, Key
"txEra" Key -> Text -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
otherEraName
]
where
EraMismatch{Text
ledgerEraName :: Text
ledgerEraName :: EraMismatch -> Text
ledgerEraName, Text
otherEraName :: Text
otherEraName :: EraMismatch -> Text
otherEraName} = MismatchEraInfo xs -> EraMismatch
forall (xs :: [*]). SListI xs => MismatchEraInfo xs -> EraMismatch
mkEraMismatch MismatchEraInfo xs
mismatch
instance All (LogFormatting `Compose` WrapApplyTxErr) xs => LogFormatting (OneEraApplyTxErr xs) where
forMachine :: DetailLevel -> OneEraApplyTxErr xs -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraApplyTxErr xs -> NS (K Object) xs)
-> OneEraApplyTxErr xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapApplyTxErr)
-> (forall a.
Compose LogFormatting WrapApplyTxErr a =>
WrapApplyTxErr a -> K Object a)
-> NS WrapApplyTxErr xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapApplyTxErr)) (Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapApplyTxErr a -> Object) -> WrapApplyTxErr a -> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapApplyTxErr a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapApplyTxErr xs -> NS (K Object) xs)
-> (OneEraApplyTxErr xs -> NS WrapApplyTxErr xs)
-> OneEraApplyTxErr xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraApplyTxErr xs -> NS WrapApplyTxErr xs
forall (xs :: [*]). OneEraApplyTxErr xs -> NS WrapApplyTxErr xs
getOneEraApplyTxErr
instance LogFormatting (ApplyTxErr blk) => LogFormatting (WrapApplyTxErr blk) where
forMachine :: DetailLevel -> WrapApplyTxErr blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> ApplyTxErr blk -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (ApplyTxErr blk -> Object)
-> (WrapApplyTxErr blk -> ApplyTxErr blk)
-> WrapApplyTxErr blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapApplyTxErr blk -> ApplyTxErr blk
forall blk. WrapApplyTxErr blk -> ApplyTxErr blk
unwrapApplyTxErr
instance All (LogFormatting `Compose` WrapLedgerErr) xs => LogFormatting (HardForkLedgerError xs) where
forMachine :: DetailLevel -> HardForkLedgerError xs -> Object
forMachine DetailLevel
dtal (HardForkLedgerErrorFromEra OneEraLedgerError xs
err) = DetailLevel -> OneEraLedgerError xs -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal OneEraLedgerError xs
err
forMachine DetailLevel
_dtal (HardForkLedgerErrorWrongEra MismatchEraInfo xs
mismatch) =
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkLedgerErrorWrongEra"
, Key
"currentEra" Key -> Text -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
ledgerEraName
, Key
"blockEra" Key -> Text -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
otherEraName
]
where
EraMismatch{Text
ledgerEraName :: EraMismatch -> Text
ledgerEraName :: Text
ledgerEraName, Text
otherEraName :: EraMismatch -> Text
otherEraName :: Text
otherEraName} = MismatchEraInfo xs -> EraMismatch
forall (xs :: [*]). SListI xs => MismatchEraInfo xs -> EraMismatch
mkEraMismatch MismatchEraInfo xs
mismatch
instance All (LogFormatting `Compose` WrapLedgerErr) xs => LogFormatting (OneEraLedgerError xs) where
forMachine :: DetailLevel -> OneEraLedgerError xs -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraLedgerError xs -> NS (K Object) xs)
-> OneEraLedgerError xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapLedgerErr)
-> (forall a.
Compose LogFormatting WrapLedgerErr a =>
WrapLedgerErr a -> K Object a)
-> NS WrapLedgerErr xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapLedgerErr)) (Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapLedgerErr a -> Object) -> WrapLedgerErr a -> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapLedgerErr a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapLedgerErr xs -> NS (K Object) xs)
-> (OneEraLedgerError xs -> NS WrapLedgerErr xs)
-> OneEraLedgerError xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraLedgerError xs -> NS WrapLedgerErr xs
forall (xs :: [*]). OneEraLedgerError xs -> NS WrapLedgerErr xs
getOneEraLedgerError
instance LogFormatting (LedgerError blk) => LogFormatting (WrapLedgerErr blk) where
forMachine :: DetailLevel -> WrapLedgerErr blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> LedgerError blk -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (LedgerError blk -> Object)
-> (WrapLedgerErr blk -> LedgerError blk)
-> WrapLedgerErr blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerErr blk -> LedgerError blk
forall blk. WrapLedgerErr blk -> LedgerError blk
unwrapLedgerErr
instance
( All (LogFormatting `Compose` WrapLedgerWarning) xs
, All SingleEraBlock xs
) =>
LogFormatting (HardForkLedgerWarning xs)
where
forMachine :: DetailLevel -> HardForkLedgerWarning xs -> Object
forMachine DetailLevel
dtal HardForkLedgerWarning xs
warning = case HardForkLedgerWarning xs
warning of
HardForkWarningInEra OneEraLedgerWarning xs
err -> DetailLevel -> OneEraLedgerWarning xs -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal OneEraLedgerWarning xs
err
HardForkWarningTransitionMismatch EraIndex xs
toEra EraParams
eraParams EpochNo
epoch ->
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkWarningTransitionMismatch"
, Key
"toEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
toEra
, Key
"eraParams" Key -> Object -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= DetailLevel -> EraParams -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal EraParams
eraParams
, Key
"transitionEpoch" Key -> EpochNo -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EpochNo
epoch
]
HardForkWarningTransitionInFinalEra EraIndex xs
fromEra EpochNo
epoch ->
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkWarningTransitionInFinalEra"
, Key
"fromEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
fromEra
, Key
"transitionEpoch" Key -> EpochNo -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EpochNo
epoch
]
HardForkWarningTransitionUnconfirmed EraIndex xs
toEra ->
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkWarningTransitionUnconfirmed"
, Key
"toEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
toEra
]
HardForkWarningTransitionReconfirmed EraIndex xs
fromEra EraIndex xs
toEra EpochNo
prevEpoch EpochNo
newEpoch ->
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkWarningTransitionReconfirmed"
, Key
"fromEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
fromEra
, Key
"toEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
toEra
, Key
"prevTransitionEpoch" Key -> EpochNo -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EpochNo
prevEpoch
, Key
"newTransitionEpoch" Key -> EpochNo -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EpochNo
newEpoch
]
instance All (LogFormatting `Compose` WrapLedgerWarning) xs => LogFormatting (OneEraLedgerWarning xs) where
forMachine :: DetailLevel -> OneEraLedgerWarning xs -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraLedgerWarning xs -> NS (K Object) xs)
-> OneEraLedgerWarning xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapLedgerWarning)
-> (forall a.
Compose LogFormatting WrapLedgerWarning a =>
WrapLedgerWarning a -> K Object a)
-> NS WrapLedgerWarning xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapLedgerWarning)) (Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapLedgerWarning a -> Object)
-> WrapLedgerWarning a
-> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapLedgerWarning a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapLedgerWarning xs -> NS (K Object) xs)
-> (OneEraLedgerWarning xs -> NS WrapLedgerWarning xs)
-> OneEraLedgerWarning xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraLedgerWarning xs -> NS WrapLedgerWarning xs
forall (xs :: [*]).
OneEraLedgerWarning xs -> NS WrapLedgerWarning xs
getOneEraLedgerWarning
instance LogFormatting (LedgerWarning blk) => LogFormatting (WrapLedgerWarning blk) where
forMachine :: DetailLevel -> WrapLedgerWarning blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> LedgerWarning blk -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (LedgerWarning blk -> Object)
-> (WrapLedgerWarning blk -> LedgerWarning blk)
-> WrapLedgerWarning blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerWarning blk -> LedgerWarning blk
forall blk. WrapLedgerWarning blk -> LedgerWarning blk
unwrapLedgerWarning
instance LogFormatting EraParams where
forMachine :: DetailLevel -> EraParams -> Object
forMachine DetailLevel
_dtal EraParams{EpochSize
eraEpochSize :: EraParams -> EpochSize
eraEpochSize :: EpochSize
eraEpochSize, SlotLength
eraSlotLength :: EraParams -> SlotLength
eraSlotLength :: SlotLength
eraSlotLength, SafeZone
eraSafeZone :: EraParams -> SafeZone
eraSafeZone :: SafeZone
eraSafeZone} =
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"epochSize" Key -> Word64 -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EpochSize -> Word64
unEpochSize EpochSize
eraEpochSize
, Key
"slotLength" Key -> NominalDiffTime -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SlotLength -> NominalDiffTime
getSlotLength SlotLength
eraSlotLength
, Key
"safeZone" Key -> SafeZone -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SafeZone
eraSafeZone
]
deriving instance ToJSON SafeZone
instance
( All (LogFormatting `Compose` WrapLedgerUpdate) xs
, All SingleEraBlock xs
) =>
LogFormatting (HardForkLedgerUpdate xs)
where
forMachine :: DetailLevel -> HardForkLedgerUpdate xs -> Object
forMachine DetailLevel
dtal HardForkLedgerUpdate xs
update = case HardForkLedgerUpdate xs
update of
HardForkUpdateInEra OneEraLedgerUpdate xs
err -> DetailLevel -> OneEraLedgerUpdate xs -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal OneEraLedgerUpdate xs
err
HardForkUpdateTransitionConfirmed EraIndex xs
fromEra EraIndex xs
toEra EpochNo
epoch ->
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkUpdateTransitionConfirmed"
, Key
"fromEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
fromEra
, Key
"toEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
toEra
, Key
"transitionEpoch" Key -> EpochNo -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EpochNo
epoch
]
HardForkUpdateTransitionDone EraIndex xs
fromEra EraIndex xs
toEra EpochNo
epoch ->
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkUpdateTransitionDone"
, Key
"fromEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
fromEra
, Key
"toEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
toEra
, Key
"transitionEpoch" Key -> EpochNo -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EpochNo
epoch
]
HardForkUpdateTransitionRolledBack EraIndex xs
fromEra EraIndex xs
toEra ->
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkUpdateTransitionRolledBack"
, Key
"fromEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
fromEra
, Key
"toEra" Key -> String -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= EraIndex xs -> String
forall a. Condense a => a -> String
condense EraIndex xs
toEra
]
instance All (LogFormatting `Compose` WrapLedgerUpdate) xs => LogFormatting (OneEraLedgerUpdate xs) where
forMachine :: DetailLevel -> OneEraLedgerUpdate xs -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraLedgerUpdate xs -> NS (K Object) xs)
-> OneEraLedgerUpdate xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapLedgerUpdate)
-> (forall a.
Compose LogFormatting WrapLedgerUpdate a =>
WrapLedgerUpdate a -> K Object a)
-> NS WrapLedgerUpdate xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapLedgerUpdate)) (Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapLedgerUpdate a -> Object)
-> WrapLedgerUpdate a
-> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapLedgerUpdate a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapLedgerUpdate xs -> NS (K Object) xs)
-> (OneEraLedgerUpdate xs -> NS WrapLedgerUpdate xs)
-> OneEraLedgerUpdate xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraLedgerUpdate xs -> NS WrapLedgerUpdate xs
forall (xs :: [*]). OneEraLedgerUpdate xs -> NS WrapLedgerUpdate xs
getOneEraLedgerUpdate
instance LogFormatting (LedgerUpdate blk) => LogFormatting (WrapLedgerUpdate blk) where
forMachine :: DetailLevel -> WrapLedgerUpdate blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> LedgerUpdate blk -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (LedgerUpdate blk -> Object)
-> (WrapLedgerUpdate blk -> LedgerUpdate blk)
-> WrapLedgerUpdate blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerUpdate blk -> LedgerUpdate blk
forall blk. WrapLedgerUpdate blk -> LedgerUpdate blk
unwrapLedgerUpdate
instance All (LogFormatting `Compose` WrapEnvelopeErr) xs => LogFormatting (HardForkEnvelopeErr xs) where
forMachine :: DetailLevel -> HardForkEnvelopeErr xs -> Object
forMachine DetailLevel
dtal (HardForkEnvelopeErrFromEra OneEraEnvelopeErr xs
err) = DetailLevel -> OneEraEnvelopeErr xs -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal OneEraEnvelopeErr xs
err
forMachine DetailLevel
_dtal (HardForkEnvelopeErrWrongEra MismatchEraInfo xs
mismatch) =
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkEnvelopeErrWrongEra"
, Key
"currentEra" Key -> Text -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
ledgerEraName
, Key
"blockEra" Key -> Text -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
otherEraName
]
where
EraMismatch{Text
ledgerEraName :: EraMismatch -> Text
ledgerEraName :: Text
ledgerEraName, Text
otherEraName :: EraMismatch -> Text
otherEraName :: Text
otherEraName} = MismatchEraInfo xs -> EraMismatch
forall (xs :: [*]). SListI xs => MismatchEraInfo xs -> EraMismatch
mkEraMismatch MismatchEraInfo xs
mismatch
instance All (LogFormatting `Compose` WrapEnvelopeErr) xs => LogFormatting (OneEraEnvelopeErr xs) where
forMachine :: DetailLevel -> OneEraEnvelopeErr xs -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraEnvelopeErr xs -> NS (K Object) xs)
-> OneEraEnvelopeErr xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapEnvelopeErr)
-> (forall a.
Compose LogFormatting WrapEnvelopeErr a =>
WrapEnvelopeErr a -> K Object a)
-> NS WrapEnvelopeErr xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapEnvelopeErr)) (Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapEnvelopeErr a -> Object) -> WrapEnvelopeErr a -> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapEnvelopeErr a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapEnvelopeErr xs -> NS (K Object) xs)
-> (OneEraEnvelopeErr xs -> NS WrapEnvelopeErr xs)
-> OneEraEnvelopeErr xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraEnvelopeErr xs -> NS WrapEnvelopeErr xs
forall (xs :: [*]). OneEraEnvelopeErr xs -> NS WrapEnvelopeErr xs
getOneEraEnvelopeErr
instance LogFormatting (OtherHeaderEnvelopeError blk) => LogFormatting (WrapEnvelopeErr blk) where
forMachine :: DetailLevel -> WrapEnvelopeErr blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> OtherHeaderEnvelopeError blk -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (OtherHeaderEnvelopeError blk -> Object)
-> (WrapEnvelopeErr blk -> OtherHeaderEnvelopeError blk)
-> WrapEnvelopeErr blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapEnvelopeErr blk -> OtherHeaderEnvelopeError blk
forall blk. WrapEnvelopeErr blk -> OtherHeaderEnvelopeError blk
unwrapEnvelopeErr
instance All (LogFormatting `Compose` WrapValidationErr) xs => LogFormatting (HardForkValidationErr xs) where
forMachine :: DetailLevel -> HardForkValidationErr xs -> Object
forMachine DetailLevel
dtal (HardForkValidationErrFromEra OneEraValidationErr xs
err) = DetailLevel -> OneEraValidationErr xs -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal OneEraValidationErr xs
err
forMachine DetailLevel
_dtal (HardForkValidationErrWrongEra MismatchEraInfo xs
mismatch) =
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkValidationErrWrongEra"
, Key
"currentEra" Key -> Text -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
ledgerEraName
, Key
"blockEra" Key -> Text -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
otherEraName
]
where
EraMismatch{Text
ledgerEraName :: EraMismatch -> Text
ledgerEraName :: Text
ledgerEraName, Text
otherEraName :: EraMismatch -> Text
otherEraName :: Text
otherEraName} = MismatchEraInfo xs -> EraMismatch
forall (xs :: [*]). SListI xs => MismatchEraInfo xs -> EraMismatch
mkEraMismatch MismatchEraInfo xs
mismatch
instance All (LogFormatting `Compose` WrapValidationErr) xs => LogFormatting (OneEraValidationErr xs) where
forMachine :: DetailLevel -> OneEraValidationErr xs -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraValidationErr xs -> NS (K Object) xs)
-> OneEraValidationErr xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapValidationErr)
-> (forall a.
Compose LogFormatting WrapValidationErr a =>
WrapValidationErr a -> K Object a)
-> NS WrapValidationErr xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapValidationErr)) (Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapValidationErr a -> Object)
-> WrapValidationErr a
-> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapValidationErr a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapValidationErr xs -> NS (K Object) xs)
-> (OneEraValidationErr xs -> NS WrapValidationErr xs)
-> OneEraValidationErr xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraValidationErr xs -> NS WrapValidationErr xs
forall (xs :: [*]).
OneEraValidationErr xs -> NS WrapValidationErr xs
getOneEraValidationErr
instance LogFormatting (ValidationErr (BlockProtocol blk)) => LogFormatting (WrapValidationErr blk) where
forMachine :: DetailLevel -> WrapValidationErr blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> ValidationErr (BlockProtocol blk) -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (ValidationErr (BlockProtocol blk) -> Object)
-> (WrapValidationErr blk -> ValidationErr (BlockProtocol blk))
-> WrapValidationErr blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapValidationErr blk -> ValidationErr (BlockProtocol blk)
forall blk.
WrapValidationErr blk -> ValidationErr (BlockProtocol blk)
unwrapValidationErr
instance All (LogFormatting `Compose` WrapCannotForge) xs => LogFormatting (OneEraCannotForge xs) where
forMachine :: DetailLevel -> OneEraCannotForge xs -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraCannotForge xs -> NS (K Object) xs)
-> OneEraCannotForge xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapCannotForge)
-> (forall a.
Compose LogFormatting WrapCannotForge a =>
WrapCannotForge a -> K Object a)
-> NS WrapCannotForge xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap
(forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapCannotForge))
(Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapCannotForge a -> Object) -> WrapCannotForge a -> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapCannotForge a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapCannotForge xs -> NS (K Object) xs)
-> (OneEraCannotForge xs -> NS WrapCannotForge xs)
-> OneEraCannotForge xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraCannotForge xs -> NS WrapCannotForge xs
forall (xs :: [*]). OneEraCannotForge xs -> NS WrapCannotForge xs
getOneEraCannotForge
instance LogFormatting (CannotForge blk) => LogFormatting (WrapCannotForge blk) where
forMachine :: DetailLevel -> WrapCannotForge blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> CannotForge blk -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (CannotForge blk -> Object)
-> (WrapCannotForge blk -> CannotForge blk)
-> WrapCannotForge blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapCannotForge blk -> CannotForge blk
forall blk. WrapCannotForge blk -> CannotForge blk
unwrapCannotForge
instance All (LogFormatting `Compose` WrapForgeStateInfo) xs => LogFormatting (OneEraForgeStateInfo xs) where
forMachine :: DetailLevel -> OneEraForgeStateInfo xs -> Object
forMachine DetailLevel
dtal OneEraForgeStateInfo xs
forgeStateInfo =
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkForgeStateInfo"
, Key
"forgeStateInfo" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Object -> Value
forall a. ToJSON a => a -> Value
toJSON Object
forgeStateInfo'
]
where
forgeStateInfo' :: Object
forgeStateInfo' :: Object
forgeStateInfo' =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraForgeStateInfo xs -> NS (K Object) xs)
-> OneEraForgeStateInfo xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapForgeStateInfo)
-> (forall a.
Compose LogFormatting WrapForgeStateInfo a =>
WrapForgeStateInfo a -> K Object a)
-> NS WrapForgeStateInfo xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap
(forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapForgeStateInfo))
(Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapForgeStateInfo a -> Object)
-> WrapForgeStateInfo a
-> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapForgeStateInfo a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapForgeStateInfo xs -> NS (K Object) xs)
-> (OneEraForgeStateInfo xs -> NS WrapForgeStateInfo xs)
-> OneEraForgeStateInfo xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraForgeStateInfo xs -> NS WrapForgeStateInfo xs
forall (xs :: [*]).
OneEraForgeStateInfo xs -> NS WrapForgeStateInfo xs
getOneEraForgeStateInfo
(OneEraForgeStateInfo xs -> Object)
-> OneEraForgeStateInfo xs -> Object
forall a b. (a -> b) -> a -> b
$ OneEraForgeStateInfo xs
forgeStateInfo
instance LogFormatting (ForgeStateInfo blk) => LogFormatting (WrapForgeStateInfo blk) where
forMachine :: DetailLevel -> WrapForgeStateInfo blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> ForgeStateInfo blk -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (ForgeStateInfo blk -> Object)
-> (WrapForgeStateInfo blk -> ForgeStateInfo blk)
-> WrapForgeStateInfo blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapForgeStateInfo blk -> ForgeStateInfo blk
forall blk. WrapForgeStateInfo blk -> ForgeStateInfo blk
unwrapForgeStateInfo
instance
All (LogFormatting `Compose` WrapForgeStateUpdateError) xs =>
LogFormatting (OneEraForgeStateUpdateError xs)
where
forMachine :: DetailLevel -> OneEraForgeStateUpdateError xs -> Object
forMachine DetailLevel
dtal OneEraForgeStateUpdateError xs
forgeStateUpdateError =
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"HardForkForgeStateUpdateError"
, Key
"forgeStateUpdateError" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Object -> Value
forall a. ToJSON a => a -> Value
toJSON Object
forgeStateUpdateError'
]
where
forgeStateUpdateError' :: Object
forgeStateUpdateError' :: Object
forgeStateUpdateError' =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraForgeStateUpdateError xs -> NS (K Object) xs)
-> OneEraForgeStateUpdateError xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapForgeStateUpdateError)
-> (forall a.
Compose LogFormatting WrapForgeStateUpdateError a =>
WrapForgeStateUpdateError a -> K Object a)
-> NS WrapForgeStateUpdateError xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap
(forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapForgeStateUpdateError))
(Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapForgeStateUpdateError a -> Object)
-> WrapForgeStateUpdateError a
-> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapForgeStateUpdateError a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapForgeStateUpdateError xs -> NS (K Object) xs)
-> (OneEraForgeStateUpdateError xs
-> NS WrapForgeStateUpdateError xs)
-> OneEraForgeStateUpdateError xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraForgeStateUpdateError xs -> NS WrapForgeStateUpdateError xs
forall (xs :: [*]).
OneEraForgeStateUpdateError xs -> NS WrapForgeStateUpdateError xs
getOneEraForgeStateUpdateError
(OneEraForgeStateUpdateError xs -> Object)
-> OneEraForgeStateUpdateError xs -> Object
forall a b. (a -> b) -> a -> b
$ OneEraForgeStateUpdateError xs
forgeStateUpdateError
instance LogFormatting (ForgeStateUpdateError blk) => LogFormatting (WrapForgeStateUpdateError blk) where
forMachine :: DetailLevel -> WrapForgeStateUpdateError blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> ForgeStateUpdateError blk -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (ForgeStateUpdateError blk -> Object)
-> (WrapForgeStateUpdateError blk -> ForgeStateUpdateError blk)
-> WrapForgeStateUpdateError blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapForgeStateUpdateError blk -> ForgeStateUpdateError blk
forall blk.
WrapForgeStateUpdateError blk -> ForgeStateUpdateError blk
unwrapForgeStateUpdateError
instance All (LogFormatting `Compose` WrapTiebreakerView) xs => LogFormatting (HardForkTiebreakerView xs) where
forMachine :: DetailLevel -> HardForkTiebreakerView xs -> Object
forMachine DetailLevel
dtal = DetailLevel -> OneEraTiebreakerView xs -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (OneEraTiebreakerView xs -> Object)
-> (HardForkTiebreakerView xs -> OneEraTiebreakerView xs)
-> HardForkTiebreakerView xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HardForkTiebreakerView xs -> OneEraTiebreakerView xs
forall (xs :: [*]).
HardForkTiebreakerView xs -> OneEraTiebreakerView xs
getHardForkTiebreakerView
instance LogFormatting (TiebreakerView protocol) => LogFormatting (WeightedSelectView protocol) where
forMachine :: DetailLevel -> WeightedSelectView protocol -> Object
forMachine DetailLevel
dtal WeightedSelectView protocol
sv =
[Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
[ Key
"blockNo" Key -> BlockNo -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= WeightedSelectView protocol -> BlockNo
forall proto. WeightedSelectView proto -> BlockNo
wsvBlockNo WeightedSelectView protocol
sv
, Key
"weightBoost" Key -> Word64 -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= PerasWeight -> Word64
unPerasWeight (WeightedSelectView protocol -> PerasWeight
forall proto. WeightedSelectView proto -> PerasWeight
wsvWeightBoost WeightedSelectView protocol
sv)
, DetailLevel -> TiebreakerView protocol -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (WeightedSelectView protocol -> TiebreakerView protocol
forall proto. WeightedSelectView proto -> TiebreakerView proto
wsvTiebreaker WeightedSelectView protocol
sv)
]
instance All (LogFormatting `Compose` WrapTiebreakerView) xs => LogFormatting (OneEraTiebreakerView xs) where
forMachine :: DetailLevel -> OneEraTiebreakerView xs -> Object
forMachine DetailLevel
dtal =
NS (K Object) xs -> Object
NS (K Object) xs -> CollapseTo NS Object
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse
(NS (K Object) xs -> Object)
-> (OneEraTiebreakerView xs -> NS (K Object) xs)
-> OneEraTiebreakerView xs
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Compose LogFormatting WrapTiebreakerView)
-> (forall a.
Compose LogFormatting WrapTiebreakerView a =>
WrapTiebreakerView a -> K Object a)
-> NS WrapTiebreakerView xs
-> NS (K Object) xs
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap
(forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(LogFormatting `Compose` WrapTiebreakerView))
(Object -> K Object a
forall k a (b :: k). a -> K a b
K (Object -> K Object a)
-> (WrapTiebreakerView a -> Object)
-> WrapTiebreakerView a
-> K Object a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DetailLevel -> WrapTiebreakerView a -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal)
(NS WrapTiebreakerView xs -> NS (K Object) xs)
-> (OneEraTiebreakerView xs -> NS WrapTiebreakerView xs)
-> OneEraTiebreakerView xs
-> NS (K Object) xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OneEraTiebreakerView xs -> NS WrapTiebreakerView xs
forall (xs :: [*]).
OneEraTiebreakerView xs -> NS WrapTiebreakerView xs
getOneEraTiebreakerView
instance LogFormatting (TiebreakerView (BlockProtocol blk)) => LogFormatting (WrapTiebreakerView blk) where
forMachine :: DetailLevel -> WrapTiebreakerView blk -> Object
forMachine DetailLevel
dtal = DetailLevel -> TiebreakerView (BlockProtocol blk) -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal (TiebreakerView (BlockProtocol blk) -> Object)
-> (WrapTiebreakerView blk -> TiebreakerView (BlockProtocol blk))
-> WrapTiebreakerView blk
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapTiebreakerView blk -> TiebreakerView (BlockProtocol blk)
forall blk.
WrapTiebreakerView blk -> TiebreakerView (BlockProtocol blk)
unwrapTiebreakerView