{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Ouroboros.Consensus.HardFork.Combinator.Ledger (
HardForkLedgerError(..)
, HardForkLedgerWarning(..)
, HardForkLedgerUpdate(..)
, HardForkEnvelopeErr(..)
, Ticked(..)
, AnnForecast(..)
, mkHardForkForecast
) where
import Control.Monad.Except
import Data.Functor.Product
import Data.Proxy
import Data.SOP.Strict hiding (shape)
import GHC.Generics (Generic)
import NoThunks.Class (NoThunks (..))
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Config
import Ouroboros.Consensus.Forecast
import Ouroboros.Consensus.HardFork.Abstract
import Ouroboros.Consensus.HardFork.History (Bound (..), EraParams)
import qualified Ouroboros.Consensus.HardFork.History as History
import Ouroboros.Consensus.HeaderValidation
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.Inspect
import Ouroboros.Consensus.Ledger.SupportsProtocol
import Ouroboros.Consensus.TypeFamilyWrappers
import Ouroboros.Consensus.Util.Condense
import Ouroboros.Consensus.Util.Counting (getExactly)
import Ouroboros.Consensus.HardFork.Combinator.Abstract
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras
import Ouroboros.Consensus.HardFork.Combinator.Basics
import Ouroboros.Consensus.HardFork.Combinator.Block
import Ouroboros.Consensus.HardFork.Combinator.Info
import Ouroboros.Consensus.HardFork.Combinator.PartialConfig
import Ouroboros.Consensus.HardFork.Combinator.Protocol ()
import Ouroboros.Consensus.HardFork.Combinator.Protocol.LedgerView
import qualified Ouroboros.Consensus.HardFork.Combinator.State as State
import Ouroboros.Consensus.HardFork.Combinator.State.Types
import Ouroboros.Consensus.HardFork.Combinator.Translation
import Ouroboros.Consensus.HardFork.Combinator.Util.InPairs
(InPairs (..))
import qualified Ouroboros.Consensus.HardFork.Combinator.Util.InPairs as InPairs
import qualified Ouroboros.Consensus.HardFork.Combinator.Util.Match as Match
import Ouroboros.Consensus.HardFork.Combinator.Util.Telescope
(Telescope (..))
import qualified Ouroboros.Consensus.HardFork.Combinator.Util.Telescope as Telescope
data HardForkLedgerError xs =
HardForkLedgerErrorFromEra (OneEraLedgerError xs)
| HardForkLedgerErrorWrongEra (MismatchEraInfo xs)
deriving ((forall x.
HardForkLedgerError xs -> Rep (HardForkLedgerError xs) x)
-> (forall x.
Rep (HardForkLedgerError xs) x -> HardForkLedgerError xs)
-> Generic (HardForkLedgerError xs)
forall (xs :: [*]) x.
Rep (HardForkLedgerError xs) x -> HardForkLedgerError xs
forall (xs :: [*]) x.
HardForkLedgerError xs -> Rep (HardForkLedgerError xs) x
forall x. Rep (HardForkLedgerError xs) x -> HardForkLedgerError xs
forall x. HardForkLedgerError xs -> Rep (HardForkLedgerError xs) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall (xs :: [*]) x.
Rep (HardForkLedgerError xs) x -> HardForkLedgerError xs
$cfrom :: forall (xs :: [*]) x.
HardForkLedgerError xs -> Rep (HardForkLedgerError xs) x
Generic, Int -> HardForkLedgerError xs -> ShowS
[HardForkLedgerError xs] -> ShowS
HardForkLedgerError xs -> String
(Int -> HardForkLedgerError xs -> ShowS)
-> (HardForkLedgerError xs -> String)
-> ([HardForkLedgerError xs] -> ShowS)
-> Show (HardForkLedgerError xs)
forall (xs :: [*]).
CanHardFork xs =>
Int -> HardForkLedgerError xs -> ShowS
forall (xs :: [*]).
CanHardFork xs =>
[HardForkLedgerError xs] -> ShowS
forall (xs :: [*]).
CanHardFork xs =>
HardForkLedgerError xs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HardForkLedgerError xs] -> ShowS
$cshowList :: forall (xs :: [*]).
CanHardFork xs =>
[HardForkLedgerError xs] -> ShowS
show :: HardForkLedgerError xs -> String
$cshow :: forall (xs :: [*]).
CanHardFork xs =>
HardForkLedgerError xs -> String
showsPrec :: Int -> HardForkLedgerError xs -> ShowS
$cshowsPrec :: forall (xs :: [*]).
CanHardFork xs =>
Int -> HardForkLedgerError xs -> ShowS
Show, HardForkLedgerError xs -> HardForkLedgerError xs -> Bool
(HardForkLedgerError xs -> HardForkLedgerError xs -> Bool)
-> (HardForkLedgerError xs -> HardForkLedgerError xs -> Bool)
-> Eq (HardForkLedgerError xs)
forall (xs :: [*]).
CanHardFork xs =>
HardForkLedgerError xs -> HardForkLedgerError xs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HardForkLedgerError xs -> HardForkLedgerError xs -> Bool
$c/= :: forall (xs :: [*]).
CanHardFork xs =>
HardForkLedgerError xs -> HardForkLedgerError xs -> Bool
== :: HardForkLedgerError xs -> HardForkLedgerError xs -> Bool
$c== :: forall (xs :: [*]).
CanHardFork xs =>
HardForkLedgerError xs -> HardForkLedgerError xs -> Bool
Eq, Context -> HardForkLedgerError xs -> IO (Maybe ThunkInfo)
Proxy (HardForkLedgerError xs) -> String
(Context -> HardForkLedgerError xs -> IO (Maybe ThunkInfo))
-> (Context -> HardForkLedgerError xs -> IO (Maybe ThunkInfo))
-> (Proxy (HardForkLedgerError xs) -> String)
-> NoThunks (HardForkLedgerError xs)
forall (xs :: [*]).
CanHardFork xs =>
Context -> HardForkLedgerError xs -> IO (Maybe ThunkInfo)
forall (xs :: [*]).
CanHardFork xs =>
Proxy (HardForkLedgerError xs) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (HardForkLedgerError xs) -> String
$cshowTypeOf :: forall (xs :: [*]).
CanHardFork xs =>
Proxy (HardForkLedgerError xs) -> String
wNoThunks :: Context -> HardForkLedgerError xs -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall (xs :: [*]).
CanHardFork xs =>
Context -> HardForkLedgerError xs -> IO (Maybe ThunkInfo)
noThunks :: Context -> HardForkLedgerError xs -> IO (Maybe ThunkInfo)
$cnoThunks :: forall (xs :: [*]).
CanHardFork xs =>
Context -> HardForkLedgerError xs -> IO (Maybe ThunkInfo)
NoThunks)
instance CanHardFork xs => GetTip (LedgerState (HardForkBlock xs)) where
getTip :: LedgerState (HardForkBlock xs)
-> Point (LedgerState (HardForkBlock xs))
getTip = Point (HardForkBlock xs) -> Point (LedgerState (HardForkBlock xs))
forall b b'.
Coercible (HeaderHash b) (HeaderHash b') =>
Point b -> Point b'
castPoint
(Point (HardForkBlock xs)
-> Point (LedgerState (HardForkBlock xs)))
-> (LedgerState (HardForkBlock xs) -> Point (HardForkBlock xs))
-> LedgerState (HardForkBlock xs)
-> Point (LedgerState (HardForkBlock xs))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall blk. SingleEraBlock blk => LedgerState blk -> Point blk)
-> HardForkState LedgerState xs -> Point (HardForkBlock xs)
forall (f :: * -> *) (xs :: [*]).
CanHardFork xs =>
(forall blk. SingleEraBlock blk => f blk -> Point blk)
-> HardForkState f xs -> Point (HardForkBlock xs)
State.getTip (Point (LedgerState blk) -> Point blk
forall b b'.
Coercible (HeaderHash b) (HeaderHash b') =>
Point b -> Point b'
castPoint (Point (LedgerState blk) -> Point blk)
-> (LedgerState blk -> Point (LedgerState blk))
-> LedgerState blk
-> Point blk
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState blk -> Point (LedgerState blk)
forall l. GetTip l => l -> Point l
getTip)
(HardForkState LedgerState xs -> Point (HardForkBlock xs))
-> (LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs)
-> LedgerState (HardForkBlock xs)
-> Point (HardForkBlock xs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs
forall (xs :: [*]).
LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs
hardForkLedgerStatePerEra
instance CanHardFork xs => GetTip (Ticked (LedgerState (HardForkBlock xs))) where
getTip :: Ticked (LedgerState (HardForkBlock xs))
-> Point (Ticked (LedgerState (HardForkBlock xs)))
getTip = Point (HardForkBlock xs)
-> Point (Ticked (LedgerState (HardForkBlock xs)))
forall b b'.
Coercible (HeaderHash b) (HeaderHash b') =>
Point b -> Point b'
castPoint
(Point (HardForkBlock xs)
-> Point (Ticked (LedgerState (HardForkBlock xs))))
-> (Ticked (LedgerState (HardForkBlock xs))
-> Point (HardForkBlock xs))
-> Ticked (LedgerState (HardForkBlock xs))
-> Point (Ticked (LedgerState (HardForkBlock xs)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall blk.
SingleEraBlock blk =>
(:.:) Ticked LedgerState blk -> Point blk)
-> HardForkState (Ticked :.: LedgerState) xs
-> Point (HardForkBlock xs)
forall (f :: * -> *) (xs :: [*]).
CanHardFork xs =>
(forall blk. SingleEraBlock blk => f blk -> Point blk)
-> HardForkState f xs -> Point (HardForkBlock xs)
State.getTip (Point (Ticked (LedgerState blk)) -> Point blk
forall b b'.
Coercible (HeaderHash b) (HeaderHash b') =>
Point b -> Point b'
castPoint (Point (Ticked (LedgerState blk)) -> Point blk)
-> ((:.:) Ticked LedgerState blk
-> Point (Ticked (LedgerState blk)))
-> (:.:) Ticked LedgerState blk
-> Point blk
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ticked (LedgerState blk) -> Point (Ticked (LedgerState blk))
forall l. GetTip l => l -> Point l
getTip (Ticked (LedgerState blk) -> Point (Ticked (LedgerState blk)))
-> ((:.:) Ticked LedgerState blk -> Ticked (LedgerState blk))
-> (:.:) Ticked LedgerState blk
-> Point (Ticked (LedgerState blk))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:) Ticked LedgerState blk -> Ticked (LedgerState blk)
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp)
(HardForkState (Ticked :.: LedgerState) xs
-> Point (HardForkBlock xs))
-> (Ticked (LedgerState (HardForkBlock xs))
-> HardForkState (Ticked :.: LedgerState) xs)
-> Ticked (LedgerState (HardForkBlock xs))
-> Point (HardForkBlock xs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ticked (LedgerState (HardForkBlock xs))
-> HardForkState (Ticked :.: LedgerState) xs
forall (xs :: [*]).
Ticked (LedgerState (HardForkBlock xs))
-> HardForkState (Ticked :.: LedgerState) xs
tickedHardForkLedgerStatePerEra
data instance Ticked (LedgerState (HardForkBlock xs)) =
TickedHardForkLedgerState {
Ticked (LedgerState (HardForkBlock xs)) -> TransitionInfo
tickedHardForkLedgerStateTransition :: !TransitionInfo
, Ticked (LedgerState (HardForkBlock xs))
-> HardForkState (Ticked :.: LedgerState) xs
tickedHardForkLedgerStatePerEra ::
!(HardForkState (Ticked :.: LedgerState) xs)
}
deriving ((forall x.
Ticked (LedgerState (HardForkBlock xs))
-> Rep (Ticked (LedgerState (HardForkBlock xs))) x)
-> (forall x.
Rep (Ticked (LedgerState (HardForkBlock xs))) x
-> Ticked (LedgerState (HardForkBlock xs)))
-> Generic (Ticked (LedgerState (HardForkBlock xs)))
forall (xs :: [*]) x.
Rep (Ticked (LedgerState (HardForkBlock xs))) x
-> Ticked (LedgerState (HardForkBlock xs))
forall (xs :: [*]) x.
Ticked (LedgerState (HardForkBlock xs))
-> Rep (Ticked (LedgerState (HardForkBlock xs))) x
forall x.
Rep (Ticked (LedgerState (HardForkBlock xs))) x
-> Ticked (LedgerState (HardForkBlock xs))
forall x.
Ticked (LedgerState (HardForkBlock xs))
-> Rep (Ticked (LedgerState (HardForkBlock xs))) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall (xs :: [*]) x.
Rep (Ticked (LedgerState (HardForkBlock xs))) x
-> Ticked (LedgerState (HardForkBlock xs))
$cfrom :: forall (xs :: [*]) x.
Ticked (LedgerState (HardForkBlock xs))
-> Rep (Ticked (LedgerState (HardForkBlock xs))) x
Generic)
deriving anyclass instance
CanHardFork xs
=> NoThunks (Ticked (LedgerState (HardForkBlock xs)))
instance CanHardFork xs => IsLedger (LedgerState (HardForkBlock xs)) where
type LedgerErr (LedgerState (HardForkBlock xs)) = HardForkLedgerError xs
applyChainTick :: LedgerCfg (LedgerState (HardForkBlock xs))
-> SlotNo
-> LedgerState (HardForkBlock xs)
-> Ticked (LedgerState (HardForkBlock xs))
applyChainTick cfg :: LedgerCfg (LedgerState (HardForkBlock xs))
cfg@HardForkLedgerConfig{..} SlotNo
slot (HardForkLedgerState st) =
TickedHardForkLedgerState :: forall (xs :: [*]).
TransitionInfo
-> HardForkState (Ticked :.: LedgerState) xs
-> Ticked (LedgerState (HardForkBlock xs))
TickedHardForkLedgerState {
tickedHardForkLedgerStateTransition :: TransitionInfo
tickedHardForkLedgerStateTransition =
HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> TransitionInfo
forall (xs :: [*]).
All SingleEraBlock xs =>
HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> TransitionInfo
State.mostRecentTransitionInfo LedgerCfg (LedgerState (HardForkBlock xs))
HardForkLedgerConfig xs
cfg HardForkState LedgerState xs
extended
, tickedHardForkLedgerStatePerEra :: HardForkState (Ticked :.: LedgerState) xs
tickedHardForkLedgerStatePerEra =
Proxy SingleEraBlock
-> (forall a.
SingleEraBlock a =>
WrapPartialLedgerConfig a
-> LedgerState a -> (:.:) Ticked LedgerState a)
-> Prod HardForkState WrapPartialLedgerConfig xs
-> HardForkState LedgerState xs
-> HardForkState (Ticked :.: LedgerState) xs
forall k l (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a)
-> Prod h f xs
-> h f' xs
-> h f'' xs
hczipWith Proxy SingleEraBlock
proxySingle (EpochInfo Identity
-> SlotNo
-> WrapPartialLedgerConfig a
-> LedgerState a
-> (:.:) Ticked LedgerState a
forall blk.
SingleEraBlock blk =>
EpochInfo Identity
-> SlotNo
-> WrapPartialLedgerConfig blk
-> LedgerState blk
-> (:.:) Ticked LedgerState blk
tickOne EpochInfo Identity
ei SlotNo
slot) Prod HardForkState WrapPartialLedgerConfig xs
NP WrapPartialLedgerConfig xs
cfgs HardForkState LedgerState xs
extended
}
where
cfgs :: NP WrapPartialLedgerConfig xs
cfgs = PerEraLedgerConfig xs -> NP WrapPartialLedgerConfig xs
forall (xs :: [*]).
PerEraLedgerConfig xs -> NP WrapPartialLedgerConfig xs
getPerEraLedgerConfig PerEraLedgerConfig xs
hardForkLedgerConfigPerEra
ei :: EpochInfo Identity
ei = HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> EpochInfo Identity
forall (xs :: [*]).
All SingleEraBlock xs =>
HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> EpochInfo Identity
State.epochInfoLedger LedgerCfg (LedgerState (HardForkBlock xs))
HardForkLedgerConfig xs
cfg HardForkState LedgerState xs
st
extended :: HardForkState LedgerState xs
extended :: HardForkState LedgerState xs
extended = HardForkLedgerConfig xs
-> SlotNo
-> HardForkState LedgerState xs
-> HardForkState LedgerState xs
forall (xs :: [*]).
CanHardFork xs =>
HardForkLedgerConfig xs
-> SlotNo
-> HardForkState LedgerState xs
-> HardForkState LedgerState xs
State.extendToSlot LedgerCfg (LedgerState (HardForkBlock xs))
HardForkLedgerConfig xs
cfg SlotNo
slot HardForkState LedgerState xs
st
tickOne :: forall blk. SingleEraBlock blk
=> EpochInfo Identity
-> SlotNo
-> WrapPartialLedgerConfig blk
-> LedgerState blk
-> (Ticked :.: LedgerState) blk
tickOne :: EpochInfo Identity
-> SlotNo
-> WrapPartialLedgerConfig blk
-> LedgerState blk
-> (:.:) Ticked LedgerState blk
tickOne EpochInfo Identity
ei SlotNo
slot WrapPartialLedgerConfig blk
pcfg LedgerState blk
st = Ticked (LedgerState blk) -> (:.:) Ticked LedgerState blk
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp (Ticked (LedgerState blk) -> (:.:) Ticked LedgerState blk)
-> Ticked (LedgerState blk) -> (:.:) Ticked LedgerState blk
forall a b. (a -> b) -> a -> b
$
LedgerCfg (LedgerState blk)
-> SlotNo -> LedgerState blk -> Ticked (LedgerState blk)
forall l. IsLedger l => LedgerCfg l -> SlotNo -> l -> Ticked l
applyChainTick (EpochInfo Identity
-> WrapPartialLedgerConfig blk -> LedgerCfg (LedgerState blk)
forall blk.
HasPartialLedgerConfig blk =>
EpochInfo Identity
-> WrapPartialLedgerConfig blk -> LedgerConfig blk
completeLedgerConfig' EpochInfo Identity
ei WrapPartialLedgerConfig blk
pcfg) SlotNo
slot LedgerState blk
st
instance CanHardFork xs
=> ApplyBlock (LedgerState (HardForkBlock xs)) (HardForkBlock xs) where
applyLedgerBlock :: LedgerCfg (LedgerState (HardForkBlock xs))
-> HardForkBlock xs
-> Ticked (LedgerState (HardForkBlock xs))
-> Except
(LedgerErr (LedgerState (HardForkBlock xs)))
(LedgerState (HardForkBlock xs))
applyLedgerBlock LedgerCfg (LedgerState (HardForkBlock xs))
cfg
(HardForkBlock (OneEraBlock NS I xs
block))
(TickedHardForkLedgerState transition st) =
case NS I xs
-> HardForkState (Ticked :.: LedgerState) xs
-> Either
(Mismatch I (Current (Ticked :.: LedgerState)) xs)
(HardForkState (Product I (Ticked :.: LedgerState)) xs)
forall (xs :: [*]) (h :: * -> *) (f :: * -> *).
SListI xs =>
NS h xs
-> HardForkState f xs
-> Either
(Mismatch h (Current f) xs) (HardForkState (Product h f) xs)
State.match NS I xs
block HardForkState (Ticked :.: LedgerState) xs
st of
Left Mismatch I (Current (Ticked :.: LedgerState)) xs
mismatch ->
HardForkLedgerError xs
-> ExceptT
(HardForkLedgerError xs) Identity (LedgerState (HardForkBlock xs))
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (HardForkLedgerError xs
-> ExceptT
(HardForkLedgerError xs) Identity (LedgerState (HardForkBlock xs)))
-> HardForkLedgerError xs
-> ExceptT
(HardForkLedgerError xs) Identity (LedgerState (HardForkBlock xs))
forall a b. (a -> b) -> a -> b
$ MismatchEraInfo xs -> HardForkLedgerError xs
forall (xs :: [*]). MismatchEraInfo xs -> HardForkLedgerError xs
HardForkLedgerErrorWrongEra (MismatchEraInfo xs -> HardForkLedgerError xs)
-> (Mismatch SingleEraInfo LedgerEraInfo xs -> MismatchEraInfo xs)
-> Mismatch SingleEraInfo LedgerEraInfo xs
-> HardForkLedgerError xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mismatch SingleEraInfo LedgerEraInfo xs -> MismatchEraInfo xs
forall (xs :: [*]).
Mismatch SingleEraInfo LedgerEraInfo xs -> MismatchEraInfo xs
MismatchEraInfo (Mismatch SingleEraInfo LedgerEraInfo xs -> HardForkLedgerError xs)
-> Mismatch SingleEraInfo LedgerEraInfo xs
-> HardForkLedgerError xs
forall a b. (a -> b) -> a -> b
$
Proxy SingleEraBlock
-> (forall x. SingleEraBlock x => I x -> SingleEraInfo x)
-> (forall x.
SingleEraBlock x =>
Current (Ticked :.: LedgerState) x -> LedgerEraInfo x)
-> Mismatch I (Current (Ticked :.: LedgerState)) xs
-> Mismatch SingleEraInfo LedgerEraInfo xs
forall k (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (f' :: k -> *)
(g :: k -> *) (g' :: k -> *).
All c xs =>
proxy c
-> (forall (x :: k). c x => f x -> f' x)
-> (forall (x :: k). c x => g x -> g' x)
-> Mismatch f g xs
-> Mismatch f' g' xs
Match.bihcmap Proxy SingleEraBlock
proxySingle forall x. SingleEraBlock x => I x -> SingleEraInfo x
forall blk (proxy :: * -> *).
SingleEraBlock blk =>
proxy blk -> SingleEraInfo blk
singleEraInfo forall x.
SingleEraBlock x =>
Current (Ticked :.: LedgerState) x -> LedgerEraInfo x
ledgerInfo Mismatch I (Current (Ticked :.: LedgerState)) xs
mismatch
Right HardForkState (Product I (Ticked :.: LedgerState)) xs
matched ->
(HardForkState LedgerState xs -> LedgerState (HardForkBlock xs))
-> ExceptT
(HardForkLedgerError xs) Identity (HardForkState LedgerState xs)
-> ExceptT
(HardForkLedgerError xs) Identity (LedgerState (HardForkBlock xs))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HardForkState LedgerState xs -> LedgerState (HardForkBlock xs)
forall (xs :: [*]).
HardForkState LedgerState xs -> LedgerState (HardForkBlock xs)
HardForkLedgerState (ExceptT
(HardForkLedgerError xs) Identity (HardForkState LedgerState xs)
-> ExceptT
(HardForkLedgerError xs) Identity (LedgerState (HardForkBlock xs)))
-> ExceptT
(HardForkLedgerError xs) Identity (HardForkState LedgerState xs)
-> ExceptT
(HardForkLedgerError xs) Identity (LedgerState (HardForkBlock xs))
forall a b. (a -> b) -> a -> b
$ HardForkState
(ExceptT (HardForkLedgerError xs) Identity :.: LedgerState) xs
-> ExceptT
(HardForkLedgerError xs) Identity (HardForkState LedgerState xs)
forall k l (h :: (k -> *) -> l -> *) (xs :: l) (f :: * -> *)
(g :: k -> *).
(HSequence h, SListIN h xs, Applicative f) =>
h (f :.: g) xs -> f (h g xs)
hsequence' (HardForkState
(ExceptT (HardForkLedgerError xs) Identity :.: LedgerState) xs
-> ExceptT
(HardForkLedgerError xs) Identity (HardForkState LedgerState xs))
-> HardForkState
(ExceptT (HardForkLedgerError xs) Identity :.: LedgerState) xs
-> ExceptT
(HardForkLedgerError xs) Identity (HardForkState LedgerState xs)
forall a b. (a -> b) -> a -> b
$
Proxy SingleEraBlock
-> (forall a.
SingleEraBlock a =>
WrapLedgerConfig a
-> Injection WrapLedgerErr xs a
-> Product I (Ticked :.: LedgerState) a
-> (:.:) (ExceptT (HardForkLedgerError xs) Identity) LedgerState a)
-> Prod HardForkState WrapLedgerConfig xs
-> Prod HardForkState (Injection WrapLedgerErr xs) xs
-> HardForkState (Product I (Ticked :.: LedgerState)) xs
-> HardForkState
(ExceptT (HardForkLedgerError xs) Identity :.: LedgerState) xs
forall k l (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs
-> Prod h f' xs
-> h f'' xs
-> h f''' xs
hczipWith3 Proxy SingleEraBlock
proxySingle forall a.
SingleEraBlock a =>
WrapLedgerConfig a
-> Injection WrapLedgerErr xs a
-> Product I (Ticked :.: LedgerState) a
-> (:.:) (ExceptT (HardForkLedgerError xs) Identity) LedgerState a
forall blk (xs :: [*]).
SingleEraBlock blk =>
WrapLedgerConfig blk
-> Injection WrapLedgerErr xs blk
-> Product I (Ticked :.: LedgerState) blk
-> (:.:) (Except (HardForkLedgerError xs)) LedgerState blk
apply Prod HardForkState WrapLedgerConfig xs
NP WrapLedgerConfig xs
cfgs Prod HardForkState (Injection WrapLedgerErr xs) xs
NP (Injection WrapLedgerErr xs) xs
errInjections HardForkState (Product I (Ticked :.: LedgerState)) xs
matched
where
cfgs :: NP WrapLedgerConfig xs
cfgs = EpochInfo Identity
-> LedgerCfg (LedgerState (HardForkBlock xs))
-> NP WrapLedgerConfig xs
forall (xs :: [*]).
CanHardFork xs =>
EpochInfo Identity
-> LedgerConfig (HardForkBlock xs) -> NP WrapLedgerConfig xs
distribLedgerConfig EpochInfo Identity
ei LedgerCfg (LedgerState (HardForkBlock xs))
cfg
ei :: EpochInfo Identity
ei = Shape xs
-> TransitionInfo
-> HardForkState (Ticked :.: LedgerState) xs
-> EpochInfo Identity
forall (xs :: [*]) (f :: * -> *).
Shape xs
-> TransitionInfo -> HardForkState f xs -> EpochInfo Identity
State.epochInfoPrecomputedTransitionInfo
(HardForkLedgerConfig xs -> Shape xs
forall (xs :: [*]). HardForkLedgerConfig xs -> Shape xs
hardForkLedgerConfigShape LedgerCfg (LedgerState (HardForkBlock xs))
HardForkLedgerConfig xs
cfg)
TransitionInfo
transition
HardForkState (Ticked :.: LedgerState) xs
st
errInjections :: NP (Injection WrapLedgerErr xs) xs
errInjections :: NP (Injection WrapLedgerErr xs) xs
errInjections = NP (Injection WrapLedgerErr xs) xs
forall k (xs :: [k]) (f :: k -> *).
SListI xs =>
NP (Injection f xs) xs
injections
reapplyLedgerBlock :: LedgerCfg (LedgerState (HardForkBlock xs))
-> HardForkBlock xs
-> Ticked (LedgerState (HardForkBlock xs))
-> LedgerState (HardForkBlock xs)
reapplyLedgerBlock LedgerCfg (LedgerState (HardForkBlock xs))
cfg
(HardForkBlock (OneEraBlock NS I xs
block))
(TickedHardForkLedgerState transition st) =
case NS I xs
-> HardForkState (Ticked :.: LedgerState) xs
-> Either
(Mismatch I (Current (Ticked :.: LedgerState)) xs)
(HardForkState (Product I (Ticked :.: LedgerState)) xs)
forall (xs :: [*]) (h :: * -> *) (f :: * -> *).
SListI xs =>
NS h xs
-> HardForkState f xs
-> Either
(Mismatch h (Current f) xs) (HardForkState (Product h f) xs)
State.match NS I xs
block HardForkState (Ticked :.: LedgerState) xs
st of
Left Mismatch I (Current (Ticked :.: LedgerState)) xs
_mismatch ->
String -> LedgerState (HardForkBlock xs)
forall a. HasCallStack => String -> a
error String
"reapplyLedgerBlock: can't be from other era"
Right HardForkState (Product I (Ticked :.: LedgerState)) xs
matched ->
HardForkState LedgerState xs -> LedgerState (HardForkBlock xs)
forall (xs :: [*]).
HardForkState LedgerState xs -> LedgerState (HardForkBlock xs)
HardForkLedgerState (HardForkState LedgerState xs -> LedgerState (HardForkBlock xs))
-> HardForkState LedgerState xs -> LedgerState (HardForkBlock xs)
forall a b. (a -> b) -> a -> b
$
Proxy SingleEraBlock
-> (forall a.
SingleEraBlock a =>
WrapLedgerConfig a
-> Product I (Ticked :.: LedgerState) a -> LedgerState a)
-> Prod HardForkState WrapLedgerConfig xs
-> HardForkState (Product I (Ticked :.: LedgerState)) xs
-> HardForkState LedgerState xs
forall k l (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a)
-> Prod h f xs
-> h f' xs
-> h f'' xs
hczipWith Proxy SingleEraBlock
proxySingle forall a.
SingleEraBlock a =>
WrapLedgerConfig a
-> Product I (Ticked :.: LedgerState) a -> LedgerState a
reapply Prod HardForkState WrapLedgerConfig xs
NP WrapLedgerConfig xs
cfgs HardForkState (Product I (Ticked :.: LedgerState)) xs
matched
where
cfgs :: NP WrapLedgerConfig xs
cfgs = EpochInfo Identity
-> LedgerCfg (LedgerState (HardForkBlock xs))
-> NP WrapLedgerConfig xs
forall (xs :: [*]).
CanHardFork xs =>
EpochInfo Identity
-> LedgerConfig (HardForkBlock xs) -> NP WrapLedgerConfig xs
distribLedgerConfig EpochInfo Identity
ei LedgerCfg (LedgerState (HardForkBlock xs))
cfg
ei :: EpochInfo Identity
ei = Shape xs
-> TransitionInfo
-> HardForkState (Ticked :.: LedgerState) xs
-> EpochInfo Identity
forall (xs :: [*]) (f :: * -> *).
Shape xs
-> TransitionInfo -> HardForkState f xs -> EpochInfo Identity
State.epochInfoPrecomputedTransitionInfo
(HardForkLedgerConfig xs -> Shape xs
forall (xs :: [*]). HardForkLedgerConfig xs -> Shape xs
hardForkLedgerConfigShape LedgerCfg (LedgerState (HardForkBlock xs))
HardForkLedgerConfig xs
cfg)
TransitionInfo
transition
HardForkState (Ticked :.: LedgerState) xs
st
apply :: SingleEraBlock blk
=> WrapLedgerConfig blk
-> Injection WrapLedgerErr xs blk
-> Product I (Ticked :.: LedgerState) blk
-> (Except (HardForkLedgerError xs) :.: LedgerState) blk
apply :: WrapLedgerConfig blk
-> Injection WrapLedgerErr xs blk
-> Product I (Ticked :.: LedgerState) blk
-> (:.:) (Except (HardForkLedgerError xs)) LedgerState blk
apply (WrapLedgerConfig LedgerConfig blk
cfg) Injection WrapLedgerErr xs blk
injectErr (Pair (I blk
block) (Comp Ticked (LedgerState blk)
st)) = ExceptT (HardForkLedgerError xs) Identity (LedgerState blk)
-> (:.:) (Except (HardForkLedgerError xs)) LedgerState blk
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp (ExceptT (HardForkLedgerError xs) Identity (LedgerState blk)
-> (:.:) (Except (HardForkLedgerError xs)) LedgerState blk)
-> ExceptT (HardForkLedgerError xs) Identity (LedgerState blk)
-> (:.:) (Except (HardForkLedgerError xs)) LedgerState blk
forall a b. (a -> b) -> a -> b
$
(LedgerErr (LedgerState blk) -> HardForkLedgerError xs)
-> Except (LedgerErr (LedgerState blk)) (LedgerState blk)
-> ExceptT (HardForkLedgerError xs) Identity (LedgerState blk)
forall e e' a. (e -> e') -> Except e a -> Except e' a
withExcept (Injection WrapLedgerErr xs blk
-> LedgerErr (LedgerState blk) -> HardForkLedgerError xs
forall (xs :: [*]) blk.
Injection WrapLedgerErr xs blk
-> LedgerError blk -> HardForkLedgerError xs
injectLedgerError Injection WrapLedgerErr xs blk
injectErr) (Except (LedgerErr (LedgerState blk)) (LedgerState blk)
-> ExceptT (HardForkLedgerError xs) Identity (LedgerState blk))
-> Except (LedgerErr (LedgerState blk)) (LedgerState blk)
-> ExceptT (HardForkLedgerError xs) Identity (LedgerState blk)
forall a b. (a -> b) -> a -> b
$
LedgerConfig blk
-> blk
-> Ticked (LedgerState blk)
-> Except (LedgerErr (LedgerState blk)) (LedgerState blk)
forall l blk.
(ApplyBlock l blk, HasCallStack) =>
LedgerCfg l -> blk -> Ticked l -> Except (LedgerErr l) l
applyLedgerBlock LedgerConfig blk
cfg blk
block Ticked (LedgerState blk)
st
reapply :: SingleEraBlock blk
=> WrapLedgerConfig blk
-> Product I (Ticked :.: LedgerState) blk
-> LedgerState blk
reapply :: WrapLedgerConfig blk
-> Product I (Ticked :.: LedgerState) blk -> LedgerState blk
reapply (WrapLedgerConfig LedgerConfig blk
cfg) (Pair (I blk
block) (Comp Ticked (LedgerState blk)
st)) =
LedgerConfig blk
-> blk -> Ticked (LedgerState blk) -> LedgerState blk
forall l blk.
(ApplyBlock l blk, HasCallStack) =>
LedgerCfg l -> blk -> Ticked l -> l
reapplyLedgerBlock LedgerConfig blk
cfg blk
block Ticked (LedgerState blk)
st
instance CanHardFork xs => UpdateLedger (HardForkBlock xs)
instance All SingleEraBlock xs => HasHardForkHistory (HardForkBlock xs) where
type HardForkIndices (HardForkBlock xs) = xs
hardForkSummary :: LedgerConfig (HardForkBlock xs)
-> LedgerState (HardForkBlock xs)
-> Summary (HardForkIndices (HardForkBlock xs))
hardForkSummary LedgerConfig (HardForkBlock xs)
cfg = HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> Summary xs
forall (xs :: [*]).
All SingleEraBlock xs =>
HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> Summary xs
State.reconstructSummaryLedger LedgerConfig (HardForkBlock xs)
HardForkLedgerConfig xs
cfg
(HardForkState LedgerState xs -> Summary xs)
-> (LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs)
-> LedgerState (HardForkBlock xs)
-> Summary xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs
forall (xs :: [*]).
LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs
hardForkLedgerStatePerEra
data HardForkEnvelopeErr xs =
HardForkEnvelopeErrFromEra (OneEraEnvelopeErr xs)
| HardForkEnvelopeErrWrongEra (MismatchEraInfo xs)
deriving (HardForkEnvelopeErr xs -> HardForkEnvelopeErr xs -> Bool
(HardForkEnvelopeErr xs -> HardForkEnvelopeErr xs -> Bool)
-> (HardForkEnvelopeErr xs -> HardForkEnvelopeErr xs -> Bool)
-> Eq (HardForkEnvelopeErr xs)
forall (xs :: [*]).
CanHardFork xs =>
HardForkEnvelopeErr xs -> HardForkEnvelopeErr xs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HardForkEnvelopeErr xs -> HardForkEnvelopeErr xs -> Bool
$c/= :: forall (xs :: [*]).
CanHardFork xs =>
HardForkEnvelopeErr xs -> HardForkEnvelopeErr xs -> Bool
== :: HardForkEnvelopeErr xs -> HardForkEnvelopeErr xs -> Bool
$c== :: forall (xs :: [*]).
CanHardFork xs =>
HardForkEnvelopeErr xs -> HardForkEnvelopeErr xs -> Bool
Eq, Int -> HardForkEnvelopeErr xs -> ShowS
[HardForkEnvelopeErr xs] -> ShowS
HardForkEnvelopeErr xs -> String
(Int -> HardForkEnvelopeErr xs -> ShowS)
-> (HardForkEnvelopeErr xs -> String)
-> ([HardForkEnvelopeErr xs] -> ShowS)
-> Show (HardForkEnvelopeErr xs)
forall (xs :: [*]).
CanHardFork xs =>
Int -> HardForkEnvelopeErr xs -> ShowS
forall (xs :: [*]).
CanHardFork xs =>
[HardForkEnvelopeErr xs] -> ShowS
forall (xs :: [*]).
CanHardFork xs =>
HardForkEnvelopeErr xs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HardForkEnvelopeErr xs] -> ShowS
$cshowList :: forall (xs :: [*]).
CanHardFork xs =>
[HardForkEnvelopeErr xs] -> ShowS
show :: HardForkEnvelopeErr xs -> String
$cshow :: forall (xs :: [*]).
CanHardFork xs =>
HardForkEnvelopeErr xs -> String
showsPrec :: Int -> HardForkEnvelopeErr xs -> ShowS
$cshowsPrec :: forall (xs :: [*]).
CanHardFork xs =>
Int -> HardForkEnvelopeErr xs -> ShowS
Show, (forall x.
HardForkEnvelopeErr xs -> Rep (HardForkEnvelopeErr xs) x)
-> (forall x.
Rep (HardForkEnvelopeErr xs) x -> HardForkEnvelopeErr xs)
-> Generic (HardForkEnvelopeErr xs)
forall (xs :: [*]) x.
Rep (HardForkEnvelopeErr xs) x -> HardForkEnvelopeErr xs
forall (xs :: [*]) x.
HardForkEnvelopeErr xs -> Rep (HardForkEnvelopeErr xs) x
forall x. Rep (HardForkEnvelopeErr xs) x -> HardForkEnvelopeErr xs
forall x. HardForkEnvelopeErr xs -> Rep (HardForkEnvelopeErr xs) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall (xs :: [*]) x.
Rep (HardForkEnvelopeErr xs) x -> HardForkEnvelopeErr xs
$cfrom :: forall (xs :: [*]) x.
HardForkEnvelopeErr xs -> Rep (HardForkEnvelopeErr xs) x
Generic, Context -> HardForkEnvelopeErr xs -> IO (Maybe ThunkInfo)
Proxy (HardForkEnvelopeErr xs) -> String
(Context -> HardForkEnvelopeErr xs -> IO (Maybe ThunkInfo))
-> (Context -> HardForkEnvelopeErr xs -> IO (Maybe ThunkInfo))
-> (Proxy (HardForkEnvelopeErr xs) -> String)
-> NoThunks (HardForkEnvelopeErr xs)
forall (xs :: [*]).
CanHardFork xs =>
Context -> HardForkEnvelopeErr xs -> IO (Maybe ThunkInfo)
forall (xs :: [*]).
CanHardFork xs =>
Proxy (HardForkEnvelopeErr xs) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (HardForkEnvelopeErr xs) -> String
$cshowTypeOf :: forall (xs :: [*]).
CanHardFork xs =>
Proxy (HardForkEnvelopeErr xs) -> String
wNoThunks :: Context -> HardForkEnvelopeErr xs -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall (xs :: [*]).
CanHardFork xs =>
Context -> HardForkEnvelopeErr xs -> IO (Maybe ThunkInfo)
noThunks :: Context -> HardForkEnvelopeErr xs -> IO (Maybe ThunkInfo)
$cnoThunks :: forall (xs :: [*]).
CanHardFork xs =>
Context -> HardForkEnvelopeErr xs -> IO (Maybe ThunkInfo)
NoThunks)
instance CanHardFork xs => ValidateEnvelope (HardForkBlock xs) where
type (HardForkBlock xs) = HardForkEnvelopeErr xs
additionalEnvelopeChecks :: TopLevelConfig (HardForkBlock xs)
-> Ticked (LedgerView (BlockProtocol (HardForkBlock xs)))
-> Header (HardForkBlock xs)
-> Except (OtherHeaderEnvelopeError (HardForkBlock xs)) ()
additionalEnvelopeChecks TopLevelConfig (HardForkBlock xs)
tlc
(TickedHardForkLedgerView transition hardForkView) =
\(HardForkHeader (OneEraHeader hdr)) ->
case NS Header xs
-> NS (Ticked :.: WrapLedgerView) xs
-> Either
(Mismatch Header (Ticked :.: WrapLedgerView) xs)
(NS (Product Header (Ticked :.: WrapLedgerView)) xs)
forall k (f :: k -> *) (xs :: [k]) (g :: k -> *).
NS f xs
-> NS g xs -> Either (Mismatch f g xs) (NS (Product f g) xs)
Match.matchNS NS Header xs
hdr (HardForkState (Ticked :.: WrapLedgerView) xs
-> NS (Ticked :.: WrapLedgerView) xs
forall (xs :: [*]) (f :: * -> *).
SListI xs =>
HardForkState f xs -> NS f xs
State.tip HardForkState (Ticked :.: WrapLedgerView) xs
hardForkView) of
Left Mismatch Header (Ticked :.: WrapLedgerView) xs
mismatch ->
HardForkEnvelopeErr xs
-> ExceptT (HardForkEnvelopeErr xs) Identity ()
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (HardForkEnvelopeErr xs
-> ExceptT (HardForkEnvelopeErr xs) Identity ())
-> HardForkEnvelopeErr xs
-> ExceptT (HardForkEnvelopeErr xs) Identity ()
forall a b. (a -> b) -> a -> b
$
MismatchEraInfo xs -> HardForkEnvelopeErr xs
forall (xs :: [*]). MismatchEraInfo xs -> HardForkEnvelopeErr xs
HardForkEnvelopeErrWrongEra (MismatchEraInfo xs -> HardForkEnvelopeErr xs)
-> (Mismatch SingleEraInfo LedgerEraInfo xs -> MismatchEraInfo xs)
-> Mismatch SingleEraInfo LedgerEraInfo xs
-> HardForkEnvelopeErr xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mismatch SingleEraInfo LedgerEraInfo xs -> MismatchEraInfo xs
forall (xs :: [*]).
Mismatch SingleEraInfo LedgerEraInfo xs -> MismatchEraInfo xs
MismatchEraInfo (Mismatch SingleEraInfo LedgerEraInfo xs -> HardForkEnvelopeErr xs)
-> Mismatch SingleEraInfo LedgerEraInfo xs
-> HardForkEnvelopeErr xs
forall a b. (a -> b) -> a -> b
$
Proxy SingleEraBlock
-> (forall x. SingleEraBlock x => Header x -> SingleEraInfo x)
-> (forall x.
SingleEraBlock x =>
(:.:) Ticked WrapLedgerView x -> LedgerEraInfo x)
-> Mismatch Header (Ticked :.: WrapLedgerView) xs
-> Mismatch SingleEraInfo LedgerEraInfo xs
forall k (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (f' :: k -> *)
(g :: k -> *) (g' :: k -> *).
All c xs =>
proxy c
-> (forall (x :: k). c x => f x -> f' x)
-> (forall (x :: k). c x => g x -> g' x)
-> Mismatch f g xs
-> Mismatch f' g' xs
Match.bihcmap Proxy SingleEraBlock
proxySingle forall x. SingleEraBlock x => Header x -> SingleEraInfo x
forall blk (proxy :: * -> *).
SingleEraBlock blk =>
proxy blk -> SingleEraInfo blk
singleEraInfo forall x.
SingleEraBlock x =>
(:.:) Ticked WrapLedgerView x -> LedgerEraInfo x
forall blk (f :: * -> *).
SingleEraBlock blk =>
(:.:) Ticked f blk -> LedgerEraInfo blk
ledgerViewInfo Mismatch Header (Ticked :.: WrapLedgerView) xs
mismatch
Right NS (Product Header (Ticked :.: WrapLedgerView)) xs
matched ->
NS (K (ExceptT (HardForkEnvelopeErr xs) Identity ())) xs
-> CollapseTo NS (ExceptT (HardForkEnvelopeErr xs) Identity ())
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse (NS (K (ExceptT (HardForkEnvelopeErr xs) Identity ())) xs
-> CollapseTo NS (ExceptT (HardForkEnvelopeErr xs) Identity ()))
-> NS (K (ExceptT (HardForkEnvelopeErr xs) Identity ())) xs
-> CollapseTo NS (ExceptT (HardForkEnvelopeErr xs) Identity ())
forall a b. (a -> b) -> a -> b
$ Proxy SingleEraBlock
-> (forall a.
SingleEraBlock a =>
TopLevelConfig a
-> Injection WrapEnvelopeErr xs a
-> Product Header (Ticked :.: WrapLedgerView) a
-> K (ExceptT (HardForkEnvelopeErr xs) Identity ()) a)
-> Prod NS TopLevelConfig xs
-> Prod NS (Injection WrapEnvelopeErr xs) xs
-> NS (Product Header (Ticked :.: WrapLedgerView)) xs
-> NS (K (ExceptT (HardForkEnvelopeErr xs) Identity ())) xs
forall k l (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs
-> Prod h f' xs
-> h f'' xs
-> h f''' xs
hczipWith3 Proxy SingleEraBlock
proxySingle forall a.
SingleEraBlock a =>
TopLevelConfig a
-> Injection WrapEnvelopeErr xs a
-> Product Header (Ticked :.: WrapLedgerView) a
-> K (ExceptT (HardForkEnvelopeErr xs) Identity ()) a
aux Prod NS TopLevelConfig xs
NP TopLevelConfig xs
cfgs Prod NS (Injection WrapEnvelopeErr xs) xs
NP (Injection WrapEnvelopeErr xs) xs
errInjections NS (Product Header (Ticked :.: WrapLedgerView)) xs
matched
where
ei :: EpochInfo Identity
ei :: EpochInfo Identity
ei = Shape xs
-> TransitionInfo
-> HardForkState (Ticked :.: WrapLedgerView) xs
-> EpochInfo Identity
forall (xs :: [*]) (f :: * -> *).
Shape xs
-> TransitionInfo -> HardForkState f xs -> EpochInfo Identity
State.epochInfoPrecomputedTransitionInfo
(HardForkLedgerConfig xs -> Shape xs
forall (xs :: [*]). HardForkLedgerConfig xs -> Shape xs
hardForkLedgerConfigShape (HardForkLedgerConfig xs -> Shape xs)
-> HardForkLedgerConfig xs -> Shape xs
forall a b. (a -> b) -> a -> b
$ TopLevelConfig (HardForkBlock xs)
-> LedgerConfig (HardForkBlock xs)
forall blk. TopLevelConfig blk -> LedgerConfig blk
configLedger TopLevelConfig (HardForkBlock xs)
tlc)
TransitionInfo
transition
HardForkState (Ticked :.: WrapLedgerView) xs
hardForkView
cfgs :: NP TopLevelConfig xs
cfgs :: NP TopLevelConfig xs
cfgs = EpochInfo Identity
-> TopLevelConfig (HardForkBlock xs) -> NP TopLevelConfig xs
forall (xs :: [*]).
All SingleEraBlock xs =>
EpochInfo Identity
-> TopLevelConfig (HardForkBlock xs) -> NP TopLevelConfig xs
distribTopLevelConfig EpochInfo Identity
ei TopLevelConfig (HardForkBlock xs)
tlc
errInjections :: NP (Injection WrapEnvelopeErr xs) xs
errInjections :: NP (Injection WrapEnvelopeErr xs) xs
errInjections = NP (Injection WrapEnvelopeErr xs) xs
forall k (xs :: [k]) (f :: k -> *).
SListI xs =>
NP (Injection f xs) xs
injections
aux :: forall blk. SingleEraBlock blk
=> TopLevelConfig blk
-> Injection WrapEnvelopeErr xs blk
-> Product Header (Ticked :.: WrapLedgerView) blk
-> K (Except (HardForkEnvelopeErr xs) ()) blk
aux :: TopLevelConfig blk
-> Injection WrapEnvelopeErr xs blk
-> Product Header (Ticked :.: WrapLedgerView) blk
-> K (ExceptT (HardForkEnvelopeErr xs) Identity ()) blk
aux TopLevelConfig blk
cfg Injection WrapEnvelopeErr xs blk
injErr (Pair Header blk
hdr (Comp Ticked (WrapLedgerView blk)
view)) = ExceptT (HardForkEnvelopeErr xs) Identity ()
-> K (ExceptT (HardForkEnvelopeErr xs) Identity ()) blk
forall k a (b :: k). a -> K a b
K (ExceptT (HardForkEnvelopeErr xs) Identity ()
-> K (ExceptT (HardForkEnvelopeErr xs) Identity ()) blk)
-> ExceptT (HardForkEnvelopeErr xs) Identity ()
-> K (ExceptT (HardForkEnvelopeErr xs) Identity ()) blk
forall a b. (a -> b) -> a -> b
$
(OtherHeaderEnvelopeError blk -> HardForkEnvelopeErr xs)
-> Except (OtherHeaderEnvelopeError blk) ()
-> ExceptT (HardForkEnvelopeErr xs) Identity ()
forall e e' a. (e -> e') -> Except e a -> Except e' a
withExcept OtherHeaderEnvelopeError blk -> HardForkEnvelopeErr xs
injErr' (Except (OtherHeaderEnvelopeError blk) ()
-> ExceptT (HardForkEnvelopeErr xs) Identity ())
-> Except (OtherHeaderEnvelopeError blk) ()
-> ExceptT (HardForkEnvelopeErr xs) Identity ()
forall a b. (a -> b) -> a -> b
$
TopLevelConfig blk
-> Ticked (LedgerView (BlockProtocol blk))
-> Header blk
-> Except (OtherHeaderEnvelopeError blk) ()
forall blk.
ValidateEnvelope blk =>
TopLevelConfig blk
-> Ticked (LedgerView (BlockProtocol blk))
-> Header blk
-> Except (OtherHeaderEnvelopeError blk) ()
additionalEnvelopeChecks
TopLevelConfig blk
cfg
(Ticked (WrapLedgerView blk)
-> Ticked (LedgerView (BlockProtocol blk))
forall blk.
Ticked (WrapLedgerView blk)
-> Ticked (LedgerView (BlockProtocol blk))
unwrapTickedLedgerView Ticked (WrapLedgerView blk)
view)
Header blk
hdr
where
injErr' :: OtherHeaderEnvelopeError blk -> HardForkEnvelopeErr xs
injErr' :: OtherHeaderEnvelopeError blk -> HardForkEnvelopeErr xs
injErr' = OneEraEnvelopeErr xs -> HardForkEnvelopeErr xs
forall (xs :: [*]). OneEraEnvelopeErr xs -> HardForkEnvelopeErr xs
HardForkEnvelopeErrFromEra
(OneEraEnvelopeErr xs -> HardForkEnvelopeErr xs)
-> (OtherHeaderEnvelopeError blk -> OneEraEnvelopeErr xs)
-> OtherHeaderEnvelopeError blk
-> HardForkEnvelopeErr xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NS WrapEnvelopeErr xs -> OneEraEnvelopeErr xs
forall (xs :: [*]). NS WrapEnvelopeErr xs -> OneEraEnvelopeErr xs
OneEraEnvelopeErr
(NS WrapEnvelopeErr xs -> OneEraEnvelopeErr xs)
-> (OtherHeaderEnvelopeError blk -> NS WrapEnvelopeErr xs)
-> OtherHeaderEnvelopeError blk
-> OneEraEnvelopeErr xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. K (NS WrapEnvelopeErr xs) blk -> NS WrapEnvelopeErr xs
forall k a (b :: k). K a b -> a
unK (K (NS WrapEnvelopeErr xs) blk -> NS WrapEnvelopeErr xs)
-> (OtherHeaderEnvelopeError blk -> K (NS WrapEnvelopeErr xs) blk)
-> OtherHeaderEnvelopeError blk
-> NS WrapEnvelopeErr xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Injection WrapEnvelopeErr xs blk
-> WrapEnvelopeErr blk -> K (NS WrapEnvelopeErr xs) blk
forall k (f :: k -> *) (g :: k -> *) (a :: k).
(-.->) f g a -> f a -> g a
apFn Injection WrapEnvelopeErr xs blk
injErr
(WrapEnvelopeErr blk -> K (NS WrapEnvelopeErr xs) blk)
-> (OtherHeaderEnvelopeError blk -> WrapEnvelopeErr blk)
-> OtherHeaderEnvelopeError blk
-> K (NS WrapEnvelopeErr xs) blk
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OtherHeaderEnvelopeError blk -> WrapEnvelopeErr blk
forall blk. OtherHeaderEnvelopeError blk -> WrapEnvelopeErr blk
WrapEnvelopeErr
instance CanHardFork xs => LedgerSupportsProtocol (HardForkBlock xs) where
protocolLedgerView :: LedgerConfig (HardForkBlock xs)
-> Ticked (LedgerState (HardForkBlock xs))
-> Ticked (LedgerView (BlockProtocol (HardForkBlock xs)))
protocolLedgerView HardForkLedgerConfig{..}
(TickedHardForkLedgerState transition ticked) =
TickedHardForkLedgerView :: forall (f :: * -> *) (xs :: [*]).
TransitionInfo
-> HardForkState (Ticked :.: f) xs
-> Ticked (HardForkLedgerView_ f xs)
TickedHardForkLedgerView {
tickedHardForkLedgerViewTransition :: TransitionInfo
tickedHardForkLedgerViewTransition = TransitionInfo
transition
, tickedHardForkLedgerViewPerEra :: HardForkState (Ticked :.: WrapLedgerView) xs
tickedHardForkLedgerViewPerEra =
Proxy SingleEraBlock
-> (forall a.
SingleEraBlock a =>
WrapPartialLedgerConfig a
-> (:.:) Ticked LedgerState a -> (:.:) Ticked WrapLedgerView a)
-> Prod HardForkState WrapPartialLedgerConfig xs
-> HardForkState (Ticked :.: LedgerState) xs
-> HardForkState (Ticked :.: WrapLedgerView) xs
forall k l (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a)
-> Prod h f xs
-> h f' xs
-> h f'' xs
hczipWith Proxy SingleEraBlock
proxySingle forall a.
SingleEraBlock a =>
WrapPartialLedgerConfig a
-> (:.:) Ticked LedgerState a -> (:.:) Ticked WrapLedgerView a
tickedViewOne Prod HardForkState WrapPartialLedgerConfig xs
NP WrapPartialLedgerConfig xs
cfgs HardForkState (Ticked :.: LedgerState) xs
ticked
}
where
cfgs :: NP WrapPartialLedgerConfig xs
cfgs = PerEraLedgerConfig xs -> NP WrapPartialLedgerConfig xs
forall (xs :: [*]).
PerEraLedgerConfig xs -> NP WrapPartialLedgerConfig xs
getPerEraLedgerConfig PerEraLedgerConfig xs
hardForkLedgerConfigPerEra
ei :: EpochInfo Identity
ei = Shape xs
-> TransitionInfo
-> HardForkState (Ticked :.: LedgerState) xs
-> EpochInfo Identity
forall (xs :: [*]) (f :: * -> *).
Shape xs
-> TransitionInfo -> HardForkState f xs -> EpochInfo Identity
State.epochInfoPrecomputedTransitionInfo
Shape xs
hardForkLedgerConfigShape
TransitionInfo
transition
HardForkState (Ticked :.: LedgerState) xs
ticked
tickedViewOne :: SingleEraBlock blk
=> WrapPartialLedgerConfig blk
-> (Ticked :.: LedgerState) blk
-> (Ticked :.: WrapLedgerView) blk
tickedViewOne :: WrapPartialLedgerConfig blk
-> (:.:) Ticked LedgerState blk -> (:.:) Ticked WrapLedgerView blk
tickedViewOne WrapPartialLedgerConfig blk
cfg (Comp Ticked (LedgerState blk)
st) = Ticked (WrapLedgerView blk) -> (:.:) Ticked WrapLedgerView blk
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp (Ticked (WrapLedgerView blk) -> (:.:) Ticked WrapLedgerView blk)
-> Ticked (WrapLedgerView blk) -> (:.:) Ticked WrapLedgerView blk
forall a b. (a -> b) -> a -> b
$
Ticked (LedgerView (BlockProtocol blk))
-> Ticked (WrapLedgerView blk)
forall blk.
Ticked (LedgerView (BlockProtocol blk))
-> Ticked (WrapLedgerView blk)
WrapTickedLedgerView (Ticked (LedgerView (BlockProtocol blk))
-> Ticked (WrapLedgerView blk))
-> Ticked (LedgerView (BlockProtocol blk))
-> Ticked (WrapLedgerView blk)
forall a b. (a -> b) -> a -> b
$
LedgerConfig blk
-> Ticked (LedgerState blk)
-> Ticked (LedgerView (BlockProtocol blk))
forall blk.
LedgerSupportsProtocol blk =>
LedgerConfig blk
-> Ticked (LedgerState blk)
-> Ticked (LedgerView (BlockProtocol blk))
protocolLedgerView (EpochInfo Identity
-> WrapPartialLedgerConfig blk -> LedgerConfig blk
forall blk.
HasPartialLedgerConfig blk =>
EpochInfo Identity
-> WrapPartialLedgerConfig blk -> LedgerConfig blk
completeLedgerConfig' EpochInfo Identity
ei WrapPartialLedgerConfig blk
cfg) Ticked (LedgerState blk)
st
ledgerViewForecastAt :: LedgerConfig (HardForkBlock xs)
-> LedgerState (HardForkBlock xs)
-> Forecast (LedgerView (BlockProtocol (HardForkBlock xs)))
ledgerViewForecastAt ledgerCfg :: LedgerConfig (HardForkBlock xs)
ledgerCfg@HardForkLedgerConfig{..}
(HardForkLedgerState ledgerSt) =
InPairs (TranslateForecast LedgerState WrapLedgerView) xs
-> HardForkState (AnnForecast LedgerState WrapLedgerView) xs
-> Forecast (HardForkLedgerView_ WrapLedgerView xs)
forall (state :: * -> *) (view :: * -> *) (xs :: [*]).
SListI xs =>
InPairs (TranslateForecast state view) xs
-> HardForkState (AnnForecast state view) xs
-> Forecast (HardForkLedgerView_ view xs)
mkHardForkForecast
(NP WrapLedgerConfig xs
-> InPairs
(RequiringBoth
WrapLedgerConfig (TranslateForecast LedgerState WrapLedgerView))
xs
-> InPairs (TranslateForecast LedgerState WrapLedgerView) xs
forall k (h :: k -> *) (xs :: [k]) (f :: k -> k -> *).
NP h xs -> InPairs (RequiringBoth h f) xs -> InPairs f xs
InPairs.requiringBoth NP WrapLedgerConfig xs
cfgs (InPairs
(RequiringBoth
WrapLedgerConfig (TranslateForecast LedgerState WrapLedgerView))
xs
-> InPairs (TranslateForecast LedgerState WrapLedgerView) xs)
-> InPairs
(RequiringBoth
WrapLedgerConfig (TranslateForecast LedgerState WrapLedgerView))
xs
-> InPairs (TranslateForecast LedgerState WrapLedgerView) xs
forall a b. (a -> b) -> a -> b
$ EraTranslation xs
-> InPairs
(RequiringBoth
WrapLedgerConfig (TranslateForecast LedgerState WrapLedgerView))
xs
forall (xs :: [*]).
EraTranslation xs
-> InPairs
(RequiringBoth
WrapLedgerConfig (TranslateForecast LedgerState WrapLedgerView))
xs
translateLedgerView EraTranslation xs
forall (xs :: [*]). CanHardFork xs => EraTranslation xs
hardForkEraTranslation)
HardForkState (AnnForecast LedgerState WrapLedgerView) xs
annForecast
where
ei :: EpochInfo Identity
ei = HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> EpochInfo Identity
forall (xs :: [*]).
All SingleEraBlock xs =>
HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> EpochInfo Identity
State.epochInfoLedger LedgerConfig (HardForkBlock xs)
HardForkLedgerConfig xs
ledgerCfg HardForkState LedgerState xs
ledgerSt
pcfgs :: NP WrapPartialLedgerConfig xs
pcfgs = PerEraLedgerConfig xs -> NP WrapPartialLedgerConfig xs
forall (xs :: [*]).
PerEraLedgerConfig xs -> NP WrapPartialLedgerConfig xs
getPerEraLedgerConfig PerEraLedgerConfig xs
hardForkLedgerConfigPerEra
cfgs :: NP WrapLedgerConfig xs
cfgs = Proxy SingleEraBlock
-> (forall a.
SingleEraBlock a =>
WrapPartialLedgerConfig a -> WrapLedgerConfig a)
-> NP WrapPartialLedgerConfig xs
-> NP WrapLedgerConfig 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 Proxy SingleEraBlock
proxySingle (EpochInfo Identity
-> WrapPartialLedgerConfig a -> WrapLedgerConfig a
forall blk.
HasPartialLedgerConfig blk =>
EpochInfo Identity
-> WrapPartialLedgerConfig blk -> WrapLedgerConfig blk
completeLedgerConfig'' EpochInfo Identity
ei) NP WrapPartialLedgerConfig xs
pcfgs
annForecast :: HardForkState (AnnForecast LedgerState WrapLedgerView) xs
annForecast :: HardForkState (AnnForecast LedgerState WrapLedgerView) xs
annForecast = Telescope
(K Past) (Current (AnnForecast LedgerState WrapLedgerView)) xs
-> HardForkState (AnnForecast LedgerState WrapLedgerView) xs
forall (f :: * -> *) (xs :: [*]).
Telescope (K Past) (Current f) xs -> HardForkState f xs
HardForkState (Telescope
(K Past) (Current (AnnForecast LedgerState WrapLedgerView)) xs
-> HardForkState (AnnForecast LedgerState WrapLedgerView) xs)
-> Telescope
(K Past) (Current (AnnForecast LedgerState WrapLedgerView)) xs
-> HardForkState (AnnForecast LedgerState WrapLedgerView) xs
forall a b. (a -> b) -> a -> b
$
Proxy SingleEraBlock
-> (forall a.
SingleEraBlock a =>
WrapPartialLedgerConfig a
-> K EraParams a
-> Current LedgerState a
-> Current (AnnForecast LedgerState WrapLedgerView) a)
-> Prod (Telescope (K Past)) WrapPartialLedgerConfig xs
-> Prod (Telescope (K Past)) (K EraParams) xs
-> Telescope (K Past) (Current LedgerState) xs
-> Telescope
(K Past) (Current (AnnForecast LedgerState WrapLedgerView)) xs
forall k l (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs
-> Prod h f' xs
-> h f'' xs
-> h f''' xs
hczipWith3
Proxy SingleEraBlock
proxySingle
forall a.
SingleEraBlock a =>
WrapPartialLedgerConfig a
-> K EraParams a
-> Current LedgerState a
-> Current (AnnForecast LedgerState WrapLedgerView) a
forecastOne
Prod (Telescope (K Past)) WrapPartialLedgerConfig xs
NP WrapPartialLedgerConfig xs
pcfgs
(Exactly xs EraParams -> NP (K EraParams) xs
forall (xs :: [*]) a. Exactly xs a -> NP (K a) xs
getExactly (Shape xs -> Exactly xs EraParams
forall (xs :: [*]). Shape xs -> Exactly xs EraParams
History.getShape Shape xs
hardForkLedgerConfigShape))
(HardForkState LedgerState xs
-> Telescope (K Past) (Current LedgerState) xs
forall (f :: * -> *) (xs :: [*]).
HardForkState f xs -> Telescope (K Past) (Current f) xs
getHardForkState HardForkState LedgerState xs
ledgerSt)
forecastOne ::
forall blk. SingleEraBlock blk
=> WrapPartialLedgerConfig blk
-> K EraParams blk
-> Current LedgerState blk
-> Current (AnnForecast LedgerState WrapLedgerView) blk
forecastOne :: WrapPartialLedgerConfig blk
-> K EraParams blk
-> Current LedgerState blk
-> Current (AnnForecast LedgerState WrapLedgerView) blk
forecastOne WrapPartialLedgerConfig blk
cfg (K EraParams
params) (Current Bound
start LedgerState blk
st) = Current :: forall (f :: * -> *) blk. Bound -> f blk -> Current f blk
Current {
currentStart :: Bound
currentStart = Bound
start
, currentState :: AnnForecast LedgerState WrapLedgerView blk
currentState = AnnForecast :: forall (state :: * -> *) (view :: * -> *) blk.
Forecast (view blk)
-> state blk
-> WithOrigin SlotNo
-> Maybe Bound
-> AnnForecast state view blk
AnnForecast {
annForecast :: Forecast (WrapLedgerView blk)
annForecast = (Ticked (LedgerView (BlockProtocol blk))
-> Ticked (WrapLedgerView blk))
-> Forecast (LedgerView (BlockProtocol blk))
-> Forecast (WrapLedgerView blk)
forall a b. (Ticked a -> Ticked b) -> Forecast a -> Forecast b
mapForecast Ticked (LedgerView (BlockProtocol blk))
-> Ticked (WrapLedgerView blk)
forall blk.
Ticked (LedgerView (BlockProtocol blk))
-> Ticked (WrapLedgerView blk)
WrapTickedLedgerView (Forecast (LedgerView (BlockProtocol blk))
-> Forecast (WrapLedgerView blk))
-> Forecast (LedgerView (BlockProtocol blk))
-> Forecast (WrapLedgerView blk)
forall a b. (a -> b) -> a -> b
$
LedgerConfig blk
-> LedgerState blk -> Forecast (LedgerView (BlockProtocol blk))
forall blk.
(LedgerSupportsProtocol blk, HasCallStack) =>
LedgerConfig blk
-> LedgerState blk -> Forecast (LedgerView (BlockProtocol blk))
ledgerViewForecastAt LedgerConfig blk
cfg' LedgerState blk
st
, annForecastState :: LedgerState blk
annForecastState = LedgerState blk
st
, annForecastTip :: WithOrigin SlotNo
annForecastTip = LedgerState blk -> WithOrigin SlotNo
forall blk.
UpdateLedger blk =>
LedgerState blk -> WithOrigin SlotNo
ledgerTipSlot LedgerState blk
st
, annForecastEnd :: Maybe Bound
annForecastEnd = HasCallStack => EraParams -> Bound -> EpochNo -> Bound
EraParams -> Bound -> EpochNo -> Bound
History.mkUpperBound EraParams
params Bound
start (EpochNo -> Bound) -> Maybe EpochNo -> Maybe Bound
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
WrapPartialLedgerConfig blk
-> EraParams -> Bound -> LedgerState blk -> Maybe EpochNo
forall blk.
SingleEraBlock blk =>
WrapPartialLedgerConfig blk
-> EraParams -> Bound -> LedgerState blk -> Maybe EpochNo
singleEraTransition' WrapPartialLedgerConfig blk
cfg EraParams
params Bound
start LedgerState blk
st
}
}
where
cfg' :: LedgerConfig blk
cfg' :: LedgerConfig blk
cfg' = EpochInfo Identity
-> WrapPartialLedgerConfig blk -> LedgerConfig blk
forall blk.
HasPartialLedgerConfig blk =>
EpochInfo Identity
-> WrapPartialLedgerConfig blk -> LedgerConfig blk
completeLedgerConfig' EpochInfo Identity
ei WrapPartialLedgerConfig blk
cfg
data AnnForecast state view blk = AnnForecast {
AnnForecast state view blk -> Forecast (view blk)
annForecast :: Forecast (view blk)
, AnnForecast state view blk -> state blk
annForecastState :: state blk
, AnnForecast state view blk -> WithOrigin SlotNo
annForecastTip :: WithOrigin SlotNo
, AnnForecast state view blk -> Maybe Bound
annForecastEnd :: Maybe Bound
}
mkHardForkForecast ::
forall state view xs.
SListI xs
=> InPairs (TranslateForecast state view) xs
-> HardForkState (AnnForecast state view) xs
-> Forecast (HardForkLedgerView_ view xs)
mkHardForkForecast :: InPairs (TranslateForecast state view) xs
-> HardForkState (AnnForecast state view) xs
-> Forecast (HardForkLedgerView_ view xs)
mkHardForkForecast InPairs (TranslateForecast state view) xs
translations HardForkState (AnnForecast state view) xs
st = Forecast :: forall a.
WithOrigin SlotNo
-> (SlotNo -> Except OutsideForecastRange (Ticked a)) -> Forecast a
Forecast {
forecastAt :: WithOrigin SlotNo
forecastAt = HardForkState (K (WithOrigin SlotNo)) xs
-> CollapseTo HardForkState (WithOrigin SlotNo)
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse ((forall a. AnnForecast state view a -> K (WithOrigin SlotNo) a)
-> HardForkState (AnnForecast state view) xs
-> HardForkState (K (WithOrigin SlotNo)) xs
forall k l (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *).
(SListIN (Prod h) xs, HAp h) =>
(forall (a :: k). f a -> f' a) -> h f xs -> h f' xs
hmap (WithOrigin SlotNo -> K (WithOrigin SlotNo) a
forall k a (b :: k). a -> K a b
K (WithOrigin SlotNo -> K (WithOrigin SlotNo) a)
-> (AnnForecast state view a -> WithOrigin SlotNo)
-> AnnForecast state view a
-> K (WithOrigin SlotNo) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Forecast (view a) -> WithOrigin SlotNo
forall a. Forecast a -> WithOrigin SlotNo
forecastAt (Forecast (view a) -> WithOrigin SlotNo)
-> (AnnForecast state view a -> Forecast (view a))
-> AnnForecast state view a
-> WithOrigin SlotNo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AnnForecast state view a -> Forecast (view a)
forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> Forecast (view blk)
annForecast) HardForkState (AnnForecast state view) xs
st)
, forecastFor :: SlotNo
-> Except
OutsideForecastRange (Ticked (HardForkLedgerView_ view xs))
forecastFor = \SlotNo
sno -> SlotNo
-> InPairs (TranslateForecast state view) xs
-> Telescope (K Past) (Current (AnnForecast state view)) xs
-> Except
OutsideForecastRange (Ticked (HardForkLedgerView_ view xs))
forall (xs' :: [*]).
SlotNo
-> InPairs (TranslateForecast state view) xs'
-> Telescope (K Past) (Current (AnnForecast state view)) xs'
-> Except
OutsideForecastRange (Ticked (HardForkLedgerView_ view xs'))
go SlotNo
sno InPairs (TranslateForecast state view) xs
translations (HardForkState (AnnForecast state view) xs
-> Telescope (K Past) (Current (AnnForecast state view)) xs
forall (f :: * -> *) (xs :: [*]).
HardForkState f xs -> Telescope (K Past) (Current f) xs
getHardForkState HardForkState (AnnForecast state view) xs
st)
}
where
go :: SlotNo
-> InPairs (TranslateForecast state view) xs'
-> Telescope (K Past) (Current (AnnForecast state view)) xs'
-> Except OutsideForecastRange (Ticked (HardForkLedgerView_ view xs'))
go :: SlotNo
-> InPairs (TranslateForecast state view) xs'
-> Telescope (K Past) (Current (AnnForecast state view)) xs'
-> Except
OutsideForecastRange (Ticked (HardForkLedgerView_ view xs'))
go SlotNo
sno InPairs (TranslateForecast state view) xs'
PNil (TZ Current (AnnForecast state view) x
cur) = SlotNo
-> Current (AnnForecast state view) x
-> Except
OutsideForecastRange (Ticked (HardForkLedgerView_ view '[x]))
forall (state :: * -> *) (view :: * -> *) blk (blks :: [*]).
SlotNo
-> Current (AnnForecast state view) blk
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (blk : blks)))
forecastFinalEra SlotNo
sno Current (AnnForecast state view) x
cur
go SlotNo
sno (PCons TranslateForecast state view x y
t InPairs (TranslateForecast state view) (y : zs)
_) (TZ Current (AnnForecast state view) x
cur) = SlotNo
-> TranslateForecast state view x y
-> Current (AnnForecast state view) x
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (x : y : zs)))
forall (state :: * -> *) (view :: * -> *) blk blk' (blks :: [*]).
SlotNo
-> TranslateForecast state view blk blk'
-> Current (AnnForecast state view) blk
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
forecastNotFinal SlotNo
sno TranslateForecast state view x y
t Current (AnnForecast state view) x
Current (AnnForecast state view) x
cur
go SlotNo
sno (PCons TranslateForecast state view x y
_ InPairs (TranslateForecast state view) (y : zs)
ts) (TS K Past x
past Telescope (K Past) (Current (AnnForecast state view)) xs
rest) = K Past x
-> Ticked (HardForkLedgerView_ view (y : zs))
-> Ticked (HardForkLedgerView_ view (x : y : zs))
forall blk (f :: * -> *) (blks :: [*]).
K Past blk
-> Ticked (HardForkLedgerView_ f blks)
-> Ticked (HardForkLedgerView_ f (blk : blks))
shiftView K Past x
past (Ticked (HardForkLedgerView_ view (y : zs))
-> Ticked (HardForkLedgerView_ view (x : y : zs)))
-> ExceptT
OutsideForecastRange
Identity
(Ticked (HardForkLedgerView_ view (y : zs)))
-> ExceptT
OutsideForecastRange
Identity
(Ticked (HardForkLedgerView_ view (x : y : zs)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> SlotNo
-> InPairs (TranslateForecast state view) (y : zs)
-> Telescope (K Past) (Current (AnnForecast state view)) (y : zs)
-> ExceptT
OutsideForecastRange
Identity
(Ticked (HardForkLedgerView_ view (y : zs)))
forall (xs' :: [*]).
SlotNo
-> InPairs (TranslateForecast state view) xs'
-> Telescope (K Past) (Current (AnnForecast state view)) xs'
-> Except
OutsideForecastRange (Ticked (HardForkLedgerView_ view xs'))
go SlotNo
sno InPairs (TranslateForecast state view) (y : zs)
ts Telescope (K Past) (Current (AnnForecast state view)) xs
Telescope (K Past) (Current (AnnForecast state view)) (y : zs)
rest
forecastFinalEra ::
forall state view blk blks.
SlotNo
-> Current (AnnForecast state view) blk
-> Except OutsideForecastRange (Ticked (HardForkLedgerView_ view (blk : blks)))
forecastFinalEra :: SlotNo
-> Current (AnnForecast state view) blk
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (blk : blks)))
forecastFinalEra SlotNo
sno (Current Bound
start AnnForecast{state blk
Maybe Bound
WithOrigin SlotNo
Forecast (view blk)
annForecastEnd :: Maybe Bound
annForecastTip :: WithOrigin SlotNo
annForecastState :: state blk
annForecast :: Forecast (view blk)
annForecastEnd :: forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> Maybe Bound
annForecastTip :: forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> WithOrigin SlotNo
annForecastState :: forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> state blk
annForecast :: forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> Forecast (view blk)
..}) =
Ticked (view blk) -> Ticked (HardForkLedgerView_ view (blk : blks))
aux (Ticked (view blk)
-> Ticked (HardForkLedgerView_ view (blk : blks)))
-> ExceptT OutsideForecastRange Identity (Ticked (view blk))
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (blk : blks)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Forecast (view blk)
-> SlotNo
-> ExceptT OutsideForecastRange Identity (Ticked (view blk))
forall a.
Forecast a -> SlotNo -> Except OutsideForecastRange (Ticked a)
forecastFor Forecast (view blk)
annForecast SlotNo
sno
where
aux :: Ticked (view blk)
-> Ticked (HardForkLedgerView_ view (blk : blks))
aux :: Ticked (view blk) -> Ticked (HardForkLedgerView_ view (blk : blks))
aux Ticked (view blk)
view = TickedHardForkLedgerView :: forall (f :: * -> *) (xs :: [*]).
TransitionInfo
-> HardForkState (Ticked :.: f) xs
-> Ticked (HardForkLedgerView_ f xs)
TickedHardForkLedgerView {
tickedHardForkLedgerViewTransition :: TransitionInfo
tickedHardForkLedgerViewTransition =
TransitionInfo
TransitionImpossible
, tickedHardForkLedgerViewPerEra :: HardForkState (Ticked :.: view) (blk : blks)
tickedHardForkLedgerViewPerEra = Telescope (K Past) (Current (Ticked :.: view)) (blk : blks)
-> HardForkState (Ticked :.: view) (blk : blks)
forall (f :: * -> *) (xs :: [*]).
Telescope (K Past) (Current f) xs -> HardForkState f xs
HardForkState (Telescope (K Past) (Current (Ticked :.: view)) (blk : blks)
-> HardForkState (Ticked :.: view) (blk : blks))
-> Telescope (K Past) (Current (Ticked :.: view)) (blk : blks)
-> HardForkState (Ticked :.: view) (blk : blks)
forall a b. (a -> b) -> a -> b
$
Current (Ticked :.: view) blk
-> Telescope (K Past) (Current (Ticked :.: view)) (blk : blks)
forall a (f :: a -> *) (x :: a) (g :: a -> *) (xs :: [a]).
f x -> Telescope g f (x : xs)
TZ (Bound -> (:.:) Ticked view blk -> Current (Ticked :.: view) blk
forall (f :: * -> *) blk. Bound -> f blk -> Current f blk
Current Bound
start (Ticked (view blk) -> (:.:) Ticked view blk
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp Ticked (view blk)
view))
}
forecastNotFinal ::
forall state view blk blk' blks.
SlotNo
-> TranslateForecast state view blk blk'
-> Current (AnnForecast state view) blk
-> Except OutsideForecastRange (Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
forecastNotFinal :: SlotNo
-> TranslateForecast state view blk blk'
-> Current (AnnForecast state view) blk
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
forecastNotFinal SlotNo
sno TranslateForecast state view blk blk'
translate (Current Bound
start AnnForecast{state blk
Maybe Bound
WithOrigin SlotNo
Forecast (view blk)
annForecastEnd :: Maybe Bound
annForecastTip :: WithOrigin SlotNo
annForecastState :: state blk
annForecast :: Forecast (view blk)
annForecastEnd :: forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> Maybe Bound
annForecastTip :: forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> WithOrigin SlotNo
annForecastState :: forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> state blk
annForecast :: forall (state :: * -> *) (view :: * -> *) blk.
AnnForecast state view blk -> Forecast (view blk)
..})
| Maybe Bound
Nothing <- Maybe Bound
annForecastEnd =
Ticked (view blk)
-> Ticked (HardForkLedgerView_ view (blk : blk' : blks))
forall (f :: * -> *).
Ticked (f blk)
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
endUnknown (Ticked (view blk)
-> Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
-> ExceptT OutsideForecastRange Identity (Ticked (view blk))
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
Forecast (view blk)
-> SlotNo
-> ExceptT OutsideForecastRange Identity (Ticked (view blk))
forall a.
Forecast a -> SlotNo -> Except OutsideForecastRange (Ticked a)
forecastFor Forecast (view blk)
annForecast SlotNo
sno
| Just Bound
end <- Maybe Bound
annForecastEnd, SlotNo
sno SlotNo -> SlotNo -> Bool
forall a. Ord a => a -> a -> Bool
< Bound -> SlotNo
boundSlot Bound
end =
Bound
-> Ticked (view blk)
-> Ticked (HardForkLedgerView_ view (blk : blk' : blks))
forall (f :: * -> *).
Bound
-> Ticked (f blk)
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
beforeKnownEnd Bound
end (Ticked (view blk)
-> Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
-> ExceptT OutsideForecastRange Identity (Ticked (view blk))
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
Forecast (view blk)
-> SlotNo
-> ExceptT OutsideForecastRange Identity (Ticked (view blk))
forall a.
Forecast a -> SlotNo -> Except OutsideForecastRange (Ticked a)
forecastFor Forecast (view blk)
annForecast SlotNo
sno
| Just Bound
end <- Maybe Bound
annForecastEnd, Bool
otherwise =
Bound
-> Ticked (view blk')
-> Ticked (HardForkLedgerView_ view (blk : blk' : blks))
forall (f :: * -> *).
Bound
-> Ticked (f blk')
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
afterKnownEnd Bound
end (Ticked (view blk')
-> Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
-> ExceptT OutsideForecastRange Identity (Ticked (view blk'))
-> Except
OutsideForecastRange
(Ticked (HardForkLedgerView_ view (blk : blk' : blks)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
TranslateForecast state view blk blk'
-> Bound
-> SlotNo
-> state blk
-> ExceptT OutsideForecastRange Identity (Ticked (view blk'))
forall (f :: * -> *) (g :: * -> *) x y.
TranslateForecast f g x y
-> Bound
-> SlotNo
-> f x
-> Except OutsideForecastRange (Ticked (g y))
translateForecastWith TranslateForecast state view blk blk'
translate Bound
end SlotNo
sno state blk
annForecastState
where
endUnknown ::
Ticked (f blk)
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
endUnknown :: Ticked (f blk)
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
endUnknown Ticked (f blk)
view = TickedHardForkLedgerView :: forall (f :: * -> *) (xs :: [*]).
TransitionInfo
-> HardForkState (Ticked :.: f) xs
-> Ticked (HardForkLedgerView_ f xs)
TickedHardForkLedgerView {
tickedHardForkLedgerViewTransition :: TransitionInfo
tickedHardForkLedgerViewTransition =
WithOrigin SlotNo -> TransitionInfo
TransitionUnknown WithOrigin SlotNo
annForecastTip
, tickedHardForkLedgerViewPerEra :: HardForkState (Ticked :.: f) (blk : blk' : blks)
tickedHardForkLedgerViewPerEra = Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks)
forall (f :: * -> *) (xs :: [*]).
Telescope (K Past) (Current f) xs -> HardForkState f xs
HardForkState (Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks))
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks)
forall a b. (a -> b) -> a -> b
$
Current (Ticked :.: f) blk
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
forall a (f :: a -> *) (x :: a) (g :: a -> *) (xs :: [a]).
f x -> Telescope g f (x : xs)
TZ (Bound -> (:.:) Ticked f blk -> Current (Ticked :.: f) blk
forall (f :: * -> *) blk. Bound -> f blk -> Current f blk
Current Bound
start (Ticked (f blk) -> (:.:) Ticked f blk
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp Ticked (f blk)
view))
}
beforeKnownEnd ::
Bound
-> Ticked (f blk)
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
beforeKnownEnd :: Bound
-> Ticked (f blk)
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
beforeKnownEnd Bound
end Ticked (f blk)
view = TickedHardForkLedgerView :: forall (f :: * -> *) (xs :: [*]).
TransitionInfo
-> HardForkState (Ticked :.: f) xs
-> Ticked (HardForkLedgerView_ f xs)
TickedHardForkLedgerView {
tickedHardForkLedgerViewTransition :: TransitionInfo
tickedHardForkLedgerViewTransition =
EpochNo -> TransitionInfo
TransitionKnown (Bound -> EpochNo
boundEpoch Bound
end)
, tickedHardForkLedgerViewPerEra :: HardForkState (Ticked :.: f) (blk : blk' : blks)
tickedHardForkLedgerViewPerEra = Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks)
forall (f :: * -> *) (xs :: [*]).
Telescope (K Past) (Current f) xs -> HardForkState f xs
HardForkState (Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks))
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks)
forall a b. (a -> b) -> a -> b
$
Current (Ticked :.: f) blk
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
forall a (f :: a -> *) (x :: a) (g :: a -> *) (xs :: [a]).
f x -> Telescope g f (x : xs)
TZ (Bound -> (:.:) Ticked f blk -> Current (Ticked :.: f) blk
forall (f :: * -> *) blk. Bound -> f blk -> Current f blk
Current Bound
start (Ticked (f blk) -> (:.:) Ticked f blk
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp Ticked (f blk)
view))
}
afterKnownEnd ::
Bound
-> Ticked (f blk')
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
afterKnownEnd :: Bound
-> Ticked (f blk')
-> Ticked (HardForkLedgerView_ f (blk : blk' : blks))
afterKnownEnd Bound
end Ticked (f blk')
view = TickedHardForkLedgerView :: forall (f :: * -> *) (xs :: [*]).
TransitionInfo
-> HardForkState (Ticked :.: f) xs
-> Ticked (HardForkLedgerView_ f xs)
TickedHardForkLedgerView {
tickedHardForkLedgerViewTransition :: TransitionInfo
tickedHardForkLedgerViewTransition =
TransitionInfo
TransitionImpossible
, tickedHardForkLedgerViewPerEra :: HardForkState (Ticked :.: f) (blk : blk' : blks)
tickedHardForkLedgerViewPerEra = Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks)
forall (f :: * -> *) (xs :: [*]).
Telescope (K Past) (Current f) xs -> HardForkState f xs
HardForkState (Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks))
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
-> HardForkState (Ticked :.: f) (blk : blk' : blks)
forall a b. (a -> b) -> a -> b
$
K Past blk
-> Telescope (K Past) (Current (Ticked :.: f)) (blk' : blks)
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
forall a (g :: a -> *) (x :: a) (f :: a -> *) (xs :: [a]).
g x -> Telescope g f xs -> Telescope g f (x : xs)
TS (Past -> K Past blk
forall k a (b :: k). a -> K a b
K (Bound -> Bound -> Past
Past Bound
start Bound
end)) (Telescope (K Past) (Current (Ticked :.: f)) (blk' : blks)
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks))
-> Telescope (K Past) (Current (Ticked :.: f)) (blk' : blks)
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blk' : blks)
forall a b. (a -> b) -> a -> b
$
Current (Ticked :.: f) blk'
-> Telescope (K Past) (Current (Ticked :.: f)) (blk' : blks)
forall a (f :: a -> *) (x :: a) (g :: a -> *) (xs :: [a]).
f x -> Telescope g f (x : xs)
TZ (Bound -> (:.:) Ticked f blk' -> Current (Ticked :.: f) blk'
forall (f :: * -> *) blk. Bound -> f blk -> Current f blk
Current Bound
end (Ticked (f blk') -> (:.:) Ticked f blk'
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp Ticked (f blk')
view))
}
shiftView :: K Past blk
-> Ticked (HardForkLedgerView_ f blks)
-> Ticked (HardForkLedgerView_ f (blk : blks))
shiftView :: K Past blk
-> Ticked (HardForkLedgerView_ f blks)
-> Ticked (HardForkLedgerView_ f (blk : blks))
shiftView K Past blk
past TickedHardForkLedgerView{..} = TickedHardForkLedgerView :: forall (f :: * -> *) (xs :: [*]).
TransitionInfo
-> HardForkState (Ticked :.: f) xs
-> Ticked (HardForkLedgerView_ f xs)
TickedHardForkLedgerView {
tickedHardForkLedgerViewTransition :: TransitionInfo
tickedHardForkLedgerViewTransition = TransitionInfo
tickedHardForkLedgerViewTransition
, tickedHardForkLedgerViewPerEra :: HardForkState (Ticked :.: f) (blk : blks)
tickedHardForkLedgerViewPerEra =
Telescope (K Past) (Current (Ticked :.: f)) (blk : blks)
-> HardForkState (Ticked :.: f) (blk : blks)
forall (f :: * -> *) (xs :: [*]).
Telescope (K Past) (Current f) xs -> HardForkState f xs
HardForkState
(Telescope (K Past) (Current (Ticked :.: f)) (blk : blks)
-> HardForkState (Ticked :.: f) (blk : blks))
-> (HardForkState (Ticked :.: f) blks
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blks))
-> HardForkState (Ticked :.: f) blks
-> HardForkState (Ticked :.: f) (blk : blks)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. K Past blk
-> Telescope (K Past) (Current (Ticked :.: f)) blks
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blks)
forall a (g :: a -> *) (x :: a) (f :: a -> *) (xs :: [a]).
g x -> Telescope g f xs -> Telescope g f (x : xs)
TS K Past blk
past
(Telescope (K Past) (Current (Ticked :.: f)) blks
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blks))
-> (HardForkState (Ticked :.: f) blks
-> Telescope (K Past) (Current (Ticked :.: f)) blks)
-> HardForkState (Ticked :.: f) blks
-> Telescope (K Past) (Current (Ticked :.: f)) (blk : blks)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HardForkState (Ticked :.: f) blks
-> Telescope (K Past) (Current (Ticked :.: f)) blks
forall (f :: * -> *) (xs :: [*]).
HardForkState f xs -> Telescope (K Past) (Current f) xs
getHardForkState
(HardForkState (Ticked :.: f) blks
-> HardForkState (Ticked :.: f) (blk : blks))
-> HardForkState (Ticked :.: f) blks
-> HardForkState (Ticked :.: f) (blk : blks)
forall a b. (a -> b) -> a -> b
$ HardForkState (Ticked :.: f) blks
tickedHardForkLedgerViewPerEra
}
data HardForkLedgerWarning xs =
HardForkWarningInEra (OneEraLedgerWarning xs)
| HardForkWarningTransitionMismatch (EraIndex xs) EraParams EpochNo
| HardForkWarningTransitionInFinalEra (EraIndex xs) EpochNo
| HardForkWarningTransitionUnconfirmed (EraIndex xs)
| HardForkWarningTransitionReconfirmed (EraIndex xs) (EraIndex xs) EpochNo EpochNo
data HardForkLedgerUpdate xs =
HardForkUpdateInEra (OneEraLedgerUpdate xs)
| HardForkUpdateTransitionConfirmed (EraIndex xs) (EraIndex xs) EpochNo
| HardForkUpdateTransitionDone (EraIndex xs) (EraIndex xs) EpochNo
| HardForkUpdateTransitionRolledBack (EraIndex xs) (EraIndex xs)
deriving instance CanHardFork xs => Show (HardForkLedgerWarning xs)
deriving instance CanHardFork xs => Eq (HardForkLedgerWarning xs)
deriving instance CanHardFork xs => Show (HardForkLedgerUpdate xs)
deriving instance CanHardFork xs => Eq (HardForkLedgerUpdate xs)
instance CanHardFork xs => Condense (HardForkLedgerUpdate xs) where
condense :: HardForkLedgerUpdate xs -> String
condense (HardForkUpdateInEra (OneEraLedgerUpdate NS WrapLedgerUpdate xs
update)) =
NS (K String) xs -> CollapseTo NS String
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse (NS (K String) xs -> CollapseTo NS String)
-> NS (K String) xs -> CollapseTo NS String
forall a b. (a -> b) -> a -> b
$ Proxy SingleEraBlock
-> (forall a. SingleEraBlock a => WrapLedgerUpdate a -> K String a)
-> NS WrapLedgerUpdate xs
-> NS (K String) 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 Proxy SingleEraBlock
proxySingle (String -> K String a
forall k a (b :: k). a -> K a b
K (String -> K String a)
-> (WrapLedgerUpdate a -> String)
-> WrapLedgerUpdate a
-> K String a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerUpdate a -> String
forall a. Condense a => a -> String
condense (LedgerUpdate a -> String)
-> (WrapLedgerUpdate a -> LedgerUpdate a)
-> WrapLedgerUpdate a
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerUpdate a -> LedgerUpdate a
forall blk. WrapLedgerUpdate blk -> LedgerUpdate blk
unwrapLedgerUpdate) NS WrapLedgerUpdate xs
update
condense (HardForkUpdateTransitionConfirmed EraIndex xs
ix EraIndex xs
ix' EpochNo
t) =
String
"confirmed " String -> ShowS
forall a. [a] -> [a] -> [a]
++ (EraIndex xs, EraIndex xs, EpochNo) -> String
forall a. Condense a => a -> String
condense (EraIndex xs
ix, EraIndex xs
ix', EpochNo
t)
condense (HardForkUpdateTransitionDone EraIndex xs
ix EraIndex xs
ix' EpochNo
e) =
String
"done " String -> ShowS
forall a. [a] -> [a] -> [a]
++ (EraIndex xs, EraIndex xs, EpochNo) -> String
forall a. Condense a => a -> String
condense (EraIndex xs
ix, EraIndex xs
ix', EpochNo
e)
condense (HardForkUpdateTransitionRolledBack EraIndex xs
ix EraIndex xs
ix') =
String
"rolled back " String -> ShowS
forall a. [a] -> [a] -> [a]
++ (EraIndex xs, EraIndex xs) -> String
forall a. Condense a => a -> String
condense (EraIndex xs
ix, EraIndex xs
ix')
instance CanHardFork xs => InspectLedger (HardForkBlock xs) where
type LedgerWarning (HardForkBlock xs) = HardForkLedgerWarning xs
type LedgerUpdate (HardForkBlock xs) = HardForkLedgerUpdate xs
inspectLedger :: TopLevelConfig (HardForkBlock xs)
-> LedgerState (HardForkBlock xs)
-> LedgerState (HardForkBlock xs)
-> [LedgerEvent (HardForkBlock xs)]
inspectLedger TopLevelConfig (HardForkBlock xs)
cfg
(HardForkLedgerState before)
(HardForkLedgerState after) =
NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
forall (xs :: [*]).
CanHardFork xs =>
NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
inspectHardForkLedger
NP WrapPartialLedgerConfig xs
pcfgs
(Exactly xs EraParams -> NP (K EraParams) xs
forall (xs :: [*]) a. Exactly xs a -> NP (K a) xs
getExactly Exactly xs EraParams
shape)
NP TopLevelConfig xs
cfgs
(Telescope (K Past) (Current LedgerState) xs
-> NS (Current LedgerState) xs
forall k (g :: k -> *) (f :: k -> *) (xs :: [k]).
Telescope g f xs -> NS f xs
Telescope.tip (HardForkState LedgerState xs
-> Telescope (K Past) (Current LedgerState) xs
forall (f :: * -> *) (xs :: [*]).
HardForkState f xs -> Telescope (K Past) (Current f) xs
getHardForkState HardForkState LedgerState xs
before))
(Telescope (K Past) (Current LedgerState) xs
-> NS (Current LedgerState) xs
forall k (g :: k -> *) (f :: k -> *) (xs :: [k]).
Telescope g f xs -> NS f xs
Telescope.tip (HardForkState LedgerState xs
-> Telescope (K Past) (Current LedgerState) xs
forall (f :: * -> *) (xs :: [*]).
HardForkState f xs -> Telescope (K Past) (Current f) xs
getHardForkState HardForkState LedgerState xs
after))
where
HardForkLedgerConfig{Shape xs
PerEraLedgerConfig xs
hardForkLedgerConfigPerEra :: PerEraLedgerConfig xs
hardForkLedgerConfigShape :: Shape xs
hardForkLedgerConfigPerEra :: forall (xs :: [*]).
HardForkLedgerConfig xs -> PerEraLedgerConfig xs
hardForkLedgerConfigShape :: forall (xs :: [*]). HardForkLedgerConfig xs -> Shape xs
..} = TopLevelConfig (HardForkBlock xs)
-> LedgerConfig (HardForkBlock xs)
forall blk. TopLevelConfig blk -> LedgerConfig blk
configLedger TopLevelConfig (HardForkBlock xs)
cfg
pcfgs :: NP WrapPartialLedgerConfig xs
pcfgs = PerEraLedgerConfig xs -> NP WrapPartialLedgerConfig xs
forall (xs :: [*]).
PerEraLedgerConfig xs -> NP WrapPartialLedgerConfig xs
getPerEraLedgerConfig PerEraLedgerConfig xs
hardForkLedgerConfigPerEra
shape :: Exactly xs EraParams
shape = Shape xs -> Exactly xs EraParams
forall (xs :: [*]). Shape xs -> Exactly xs EraParams
History.getShape Shape xs
hardForkLedgerConfigShape
cfgs :: NP TopLevelConfig xs
cfgs = EpochInfo Identity
-> TopLevelConfig (HardForkBlock xs) -> NP TopLevelConfig xs
forall (xs :: [*]).
All SingleEraBlock xs =>
EpochInfo Identity
-> TopLevelConfig (HardForkBlock xs) -> NP TopLevelConfig xs
distribTopLevelConfig EpochInfo Identity
ei TopLevelConfig (HardForkBlock xs)
cfg
ei :: EpochInfo Identity
ei = HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> EpochInfo Identity
forall (xs :: [*]).
All SingleEraBlock xs =>
HardForkLedgerConfig xs
-> HardForkState LedgerState xs -> EpochInfo Identity
State.epochInfoLedger (TopLevelConfig (HardForkBlock xs)
-> LedgerConfig (HardForkBlock xs)
forall blk. TopLevelConfig blk -> LedgerConfig blk
configLedger TopLevelConfig (HardForkBlock xs)
cfg) HardForkState LedgerState xs
after
inspectHardForkLedger ::
CanHardFork xs
=> NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
inspectHardForkLedger :: NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
inspectHardForkLedger = NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
forall (xs :: [*]).
All SingleEraBlock xs =>
NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
go
where
go :: All SingleEraBlock xs
=> NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
go :: NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
go (WrapPartialLedgerConfig x
pc :* NP WrapPartialLedgerConfig xs
_) (K EraParams
ps :* NP (K EraParams) xs
pss) (TopLevelConfig x
c :* NP TopLevelConfig xs
_) (Z Current LedgerState x
before) (Z Current LedgerState x
after) = [[LedgerEvent (HardForkBlock (x : xs))]]
-> [LedgerEvent (HardForkBlock (x : xs))]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [
(LedgerEvent x -> LedgerEvent (HardForkBlock (x : xs)))
-> [LedgerEvent x] -> [LedgerEvent (HardForkBlock (x : xs))]
forall a b. (a -> b) -> [a] -> [b]
map LedgerEvent x -> LedgerEvent (HardForkBlock (x : xs))
forall x (xs :: [*]).
LedgerEvent x -> LedgerEvent (HardForkBlock (x : xs))
liftEvent ([LedgerEvent x] -> [LedgerEvent (HardForkBlock (x : xs))])
-> [LedgerEvent x] -> [LedgerEvent (HardForkBlock (x : xs))]
forall a b. (a -> b) -> a -> b
$
TopLevelConfig x
-> LedgerState x -> LedgerState x -> [LedgerEvent x]
forall blk.
InspectLedger blk =>
TopLevelConfig blk
-> LedgerState blk -> LedgerState blk -> [LedgerEvent blk]
inspectLedger TopLevelConfig x
c (Current LedgerState x -> LedgerState x
forall (f :: * -> *) blk. Current f blk -> f blk
currentState Current LedgerState x
before) (Current LedgerState x -> LedgerState x
forall (f :: * -> *) blk. Current f blk -> f blk
currentState Current LedgerState x
after)
, case (NP (K EraParams) xs
pss, Maybe EpochNo
confirmedBefore, Maybe EpochNo
confirmedAfter) of
(NP (K EraParams) xs
_, Maybe EpochNo
Nothing, Maybe EpochNo
Nothing) ->
[]
(NP (K EraParams) xs
_, Just EpochNo
_, Maybe EpochNo
Nothing) ->
[]
(NP (K EraParams) xs
Nil, Maybe EpochNo
Nothing, Just EpochNo
transition) ->
LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))]
forall (m :: * -> *) a. Monad m => a -> m a
return (LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))])
-> LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))]
forall a b. (a -> b) -> a -> b
$ LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerWarning blk -> LedgerEvent blk
LedgerWarning (LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$
EraIndex '[x] -> EpochNo -> HardForkLedgerWarning '[x]
forall (xs :: [*]).
EraIndex xs -> EpochNo -> HardForkLedgerWarning xs
HardForkWarningTransitionInFinalEra EraIndex '[x]
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero EpochNo
transition
(NP (K EraParams) xs
Nil, Just EpochNo
transition, Just EpochNo
transition') -> do
Bool -> [()]
forall (f :: * -> *). Alternative f => Bool -> f ()
guard (EpochNo
transition EpochNo -> EpochNo -> Bool
forall a. Eq a => a -> a -> Bool
/= EpochNo
transition')
LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))]
forall (m :: * -> *) a. Monad m => a -> m a
return (LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))])
-> LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))]
forall a b. (a -> b) -> a -> b
$ LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerWarning blk -> LedgerEvent blk
LedgerWarning (LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$
EraIndex '[x] -> EpochNo -> HardForkLedgerWarning '[x]
forall (xs :: [*]).
EraIndex xs -> EpochNo -> HardForkLedgerWarning xs
HardForkWarningTransitionInFinalEra EraIndex '[x]
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero EpochNo
transition
((:*){}, Maybe EpochNo
Nothing, Just EpochNo
transition) ->
LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))]
forall (m :: * -> *) a. Monad m => a -> m a
return (LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))])
-> LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))]
forall a b. (a -> b) -> a -> b
$
if Maybe SafeBeforeEpoch -> EpochNo -> Bool
validLowerBound (SafeZone -> Maybe SafeBeforeEpoch
History.safeBeforeEpoch SafeZone
safeZone) EpochNo
transition
then LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerUpdate blk -> LedgerEvent blk
LedgerUpdate (LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$
EraIndex (x : x : xs)
-> EraIndex (x : x : xs)
-> EpochNo
-> HardForkLedgerUpdate (x : x : xs)
forall (xs :: [*]).
EraIndex xs -> EraIndex xs -> EpochNo -> HardForkLedgerUpdate xs
HardForkUpdateTransitionConfirmed
EraIndex (x : x : xs)
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero
(EraIndex (x : xs) -> EraIndex (x : x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex (x : xs)
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero)
EpochNo
transition
else LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerWarning blk -> LedgerEvent blk
LedgerWarning (LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$
EraIndex (x : x : xs)
-> EraParams -> EpochNo -> HardForkLedgerWarning (x : x : xs)
forall (xs :: [*]).
EraIndex xs -> EraParams -> EpochNo -> HardForkLedgerWarning xs
HardForkWarningTransitionMismatch
EraIndex (x : x : xs)
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero
EraParams
ps
EpochNo
transition
((:*){}, Just EpochNo
transition, Just EpochNo
transition') -> do
Bool -> [()]
forall (f :: * -> *). Alternative f => Bool -> f ()
guard (EpochNo
transition EpochNo -> EpochNo -> Bool
forall a. Eq a => a -> a -> Bool
/= EpochNo
transition')
LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))]
forall (m :: * -> *) a. Monad m => a -> m a
return (LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))])
-> LedgerEvent (HardForkBlock (x : xs))
-> [LedgerEvent (HardForkBlock (x : xs))]
forall a b. (a -> b) -> a -> b
$ LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerWarning blk -> LedgerEvent blk
LedgerWarning (LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$
EraIndex (x : x : xs)
-> EraIndex (x : x : xs)
-> EpochNo
-> EpochNo
-> HardForkLedgerWarning (x : x : xs)
forall (xs :: [*]).
EraIndex xs
-> EraIndex xs -> EpochNo -> EpochNo -> HardForkLedgerWarning xs
HardForkWarningTransitionReconfirmed
EraIndex (x : x : xs)
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero
(EraIndex (x : xs) -> EraIndex (x : x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex (x : xs)
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero)
EpochNo
transition
EpochNo
transition'
]
where
safeZone :: History.SafeZone
safeZone :: SafeZone
safeZone = EraParams -> SafeZone
History.eraSafeZone EraParams
ps
confirmedBefore, confirmedAfter :: Maybe EpochNo
confirmedBefore :: Maybe EpochNo
confirmedBefore = PartialLedgerConfig x
-> EraParams -> Bound -> LedgerState x -> Maybe EpochNo
forall blk.
SingleEraBlock blk =>
PartialLedgerConfig blk
-> EraParams -> Bound -> LedgerState blk -> Maybe EpochNo
singleEraTransition
(WrapPartialLedgerConfig x -> PartialLedgerConfig x
forall blk. WrapPartialLedgerConfig blk -> PartialLedgerConfig blk
unwrapPartialLedgerConfig WrapPartialLedgerConfig x
pc)
EraParams
ps
(Current LedgerState x -> Bound
forall (f :: * -> *) blk. Current f blk -> Bound
currentStart Current LedgerState x
before)
(Current LedgerState x -> LedgerState x
forall (f :: * -> *) blk. Current f blk -> f blk
currentState Current LedgerState x
before)
confirmedAfter :: Maybe EpochNo
confirmedAfter = PartialLedgerConfig x
-> EraParams -> Bound -> LedgerState x -> Maybe EpochNo
forall blk.
SingleEraBlock blk =>
PartialLedgerConfig blk
-> EraParams -> Bound -> LedgerState blk -> Maybe EpochNo
singleEraTransition
(WrapPartialLedgerConfig x -> PartialLedgerConfig x
forall blk. WrapPartialLedgerConfig blk -> PartialLedgerConfig blk
unwrapPartialLedgerConfig WrapPartialLedgerConfig x
pc)
EraParams
ps
(Current LedgerState x -> Bound
forall (f :: * -> *) blk. Current f blk -> Bound
currentStart Current LedgerState x
after)
(Current LedgerState x -> LedgerState x
forall (f :: * -> *) blk. Current f blk -> f blk
currentState Current LedgerState x
after)
go NP WrapPartialLedgerConfig xs
Nil NP (K EraParams) xs
_ NP TopLevelConfig xs
_ NS (Current LedgerState) xs
before NS (Current LedgerState) xs
_ =
case NS (Current LedgerState) xs
before of {}
go (WrapPartialLedgerConfig x
_ :* NP WrapPartialLedgerConfig xs
pcs) (K EraParams x
_ :* NP (K EraParams) xs
pss) (TopLevelConfig x
_ :* NP TopLevelConfig xs
cs) (S NS (Current LedgerState) xs
before) (S NS (Current LedgerState) xs
after) =
(LedgerEvent (HardForkBlock xs)
-> LedgerEvent (HardForkBlock (x : xs)))
-> [LedgerEvent (HardForkBlock xs)]
-> [LedgerEvent (HardForkBlock (x : xs))]
forall a b. (a -> b) -> [a] -> [b]
map LedgerEvent (HardForkBlock xs)
-> LedgerEvent (HardForkBlock (x : xs))
forall (xs :: [*]) x.
LedgerEvent (HardForkBlock xs)
-> LedgerEvent (HardForkBlock (x : xs))
shiftEvent ([LedgerEvent (HardForkBlock xs)]
-> [LedgerEvent (HardForkBlock (x : xs))])
-> [LedgerEvent (HardForkBlock xs)]
-> [LedgerEvent (HardForkBlock (x : xs))]
forall a b. (a -> b) -> a -> b
$ NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
forall (xs :: [*]).
All SingleEraBlock xs =>
NP WrapPartialLedgerConfig xs
-> NP (K EraParams) xs
-> NP TopLevelConfig xs
-> NS (Current LedgerState) xs
-> NS (Current LedgerState) xs
-> [LedgerEvent (HardForkBlock xs)]
go NP WrapPartialLedgerConfig xs
pcs NP (K EraParams) xs
NP (K EraParams) xs
pss NP TopLevelConfig xs
NP TopLevelConfig xs
cs NS (Current LedgerState) xs
NS (Current LedgerState) xs
before NS (Current LedgerState) xs
NS (Current LedgerState) xs
after
go NP WrapPartialLedgerConfig xs
_ NP (K EraParams) xs
_ NP TopLevelConfig xs
_ (Z Current LedgerState x
_) (S NS (Current LedgerState) xs
after) =
LedgerEvent (HardForkBlock xs) -> [LedgerEvent (HardForkBlock xs)]
forall (m :: * -> *) a. Monad m => a -> m a
return (LedgerEvent (HardForkBlock xs)
-> [LedgerEvent (HardForkBlock xs)])
-> LedgerEvent (HardForkBlock xs)
-> [LedgerEvent (HardForkBlock xs)]
forall a b. (a -> b) -> a -> b
$
LedgerUpdate (HardForkBlock xs) -> LedgerEvent (HardForkBlock xs)
forall blk. LedgerUpdate blk -> LedgerEvent blk
LedgerUpdate (LedgerUpdate (HardForkBlock xs) -> LedgerEvent (HardForkBlock xs))
-> LedgerUpdate (HardForkBlock xs)
-> LedgerEvent (HardForkBlock xs)
forall a b. (a -> b) -> a -> b
$
EraIndex (x : xs)
-> EraIndex (x : xs) -> EpochNo -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]).
EraIndex xs -> EraIndex xs -> EpochNo -> HardForkLedgerUpdate xs
HardForkUpdateTransitionDone
EraIndex (x : xs)
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc (EraIndex xs -> EraIndex (x : xs))
-> EraIndex xs -> EraIndex (x : xs)
forall a b. (a -> b) -> a -> b
$ NS (Current LedgerState) xs -> EraIndex xs
forall (xs :: [*]) (f :: * -> *).
SListI xs =>
NS f xs -> EraIndex xs
eraIndexFromNS NS (Current LedgerState) xs
after)
(NS (K EpochNo) xs -> CollapseTo NS EpochNo
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse (NS (K EpochNo) xs -> CollapseTo NS EpochNo)
-> NS (K EpochNo) xs -> CollapseTo NS EpochNo
forall a b. (a -> b) -> a -> b
$ (forall a. Current LedgerState a -> K EpochNo a)
-> NS (Current LedgerState) xs -> NS (K EpochNo) xs
forall k l (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *).
(SListIN (Prod h) xs, HAp h) =>
(forall (a :: k). f a -> f' a) -> h f xs -> h f' xs
hmap (EpochNo -> K EpochNo a
forall k a (b :: k). a -> K a b
K (EpochNo -> K EpochNo a)
-> (Current LedgerState a -> EpochNo)
-> Current LedgerState a
-> K EpochNo a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bound -> EpochNo
boundEpoch (Bound -> EpochNo)
-> (Current LedgerState a -> Bound)
-> Current LedgerState a
-> EpochNo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Current LedgerState a -> Bound
forall (f :: * -> *) blk. Current f blk -> Bound
currentStart) NS (Current LedgerState) xs
after)
go NP WrapPartialLedgerConfig xs
_ NP (K EraParams) xs
_ NP TopLevelConfig xs
_ (S NS (Current LedgerState) xs
before) (Z Current LedgerState x
_) =
LedgerEvent (HardForkBlock xs) -> [LedgerEvent (HardForkBlock xs)]
forall (m :: * -> *) a. Monad m => a -> m a
return (LedgerEvent (HardForkBlock xs)
-> [LedgerEvent (HardForkBlock xs)])
-> LedgerEvent (HardForkBlock xs)
-> [LedgerEvent (HardForkBlock xs)]
forall a b. (a -> b) -> a -> b
$
LedgerUpdate (HardForkBlock xs) -> LedgerEvent (HardForkBlock xs)
forall blk. LedgerUpdate blk -> LedgerEvent blk
LedgerUpdate (LedgerUpdate (HardForkBlock xs) -> LedgerEvent (HardForkBlock xs))
-> LedgerUpdate (HardForkBlock xs)
-> LedgerEvent (HardForkBlock xs)
forall a b. (a -> b) -> a -> b
$
EraIndex (x : xs)
-> EraIndex (x : xs) -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]).
EraIndex xs -> EraIndex xs -> HardForkLedgerUpdate xs
HardForkUpdateTransitionRolledBack
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc (EraIndex xs -> EraIndex (x : xs))
-> EraIndex xs -> EraIndex (x : xs)
forall a b. (a -> b) -> a -> b
$ NS (Current LedgerState) xs -> EraIndex xs
forall (xs :: [*]) (f :: * -> *).
SListI xs =>
NS f xs -> EraIndex xs
eraIndexFromNS NS (Current LedgerState) xs
before)
EraIndex (x : xs)
forall x (xs :: [*]). EraIndex (x : xs)
eraIndexZero
validLowerBound :: Maybe History.SafeBeforeEpoch -> EpochNo -> Bool
validLowerBound :: Maybe SafeBeforeEpoch -> EpochNo -> Bool
validLowerBound Maybe SafeBeforeEpoch
Nothing EpochNo
_ = Bool
False
validLowerBound (Just SafeBeforeEpoch
History.NoLowerBound ) EpochNo
_ = Bool
True
validLowerBound (Just (History.LowerBound EpochNo
e)) EpochNo
e' = EpochNo
e' EpochNo -> EpochNo -> Bool
forall a. Ord a => a -> a -> Bool
>= EpochNo
e
liftEvent :: LedgerEvent x
-> LedgerEvent (HardForkBlock (x ': xs))
liftEvent :: LedgerEvent x -> LedgerEvent (HardForkBlock (x : xs))
liftEvent (LedgerWarning LedgerWarning x
warning) = LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerWarning blk -> LedgerEvent blk
LedgerWarning (LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$ LedgerWarning x -> HardForkLedgerWarning (x : xs)
forall x (xs :: [*]).
LedgerWarning x -> HardForkLedgerWarning (x : xs)
liftWarning LedgerWarning x
warning
liftEvent (LedgerUpdate LedgerUpdate x
update) = LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerUpdate blk -> LedgerEvent blk
LedgerUpdate (LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$ LedgerUpdate x -> HardForkLedgerUpdate (x : xs)
forall x (xs :: [*]).
LedgerUpdate x -> HardForkLedgerUpdate (x : xs)
liftUpdate LedgerUpdate x
update
liftWarning :: LedgerWarning x -> HardForkLedgerWarning (x ': xs)
liftWarning :: LedgerWarning x -> HardForkLedgerWarning (x : xs)
liftWarning =
OneEraLedgerWarning (x : xs) -> HardForkLedgerWarning (x : xs)
forall (xs :: [*]).
OneEraLedgerWarning xs -> HardForkLedgerWarning xs
HardForkWarningInEra
(OneEraLedgerWarning (x : xs) -> HardForkLedgerWarning (x : xs))
-> (LedgerWarning x -> OneEraLedgerWarning (x : xs))
-> LedgerWarning x
-> HardForkLedgerWarning (x : xs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NS WrapLedgerWarning (x : xs) -> OneEraLedgerWarning (x : xs)
forall (xs :: [*]).
NS WrapLedgerWarning xs -> OneEraLedgerWarning xs
OneEraLedgerWarning
(NS WrapLedgerWarning (x : xs) -> OneEraLedgerWarning (x : xs))
-> (LedgerWarning x -> NS WrapLedgerWarning (x : xs))
-> LedgerWarning x
-> OneEraLedgerWarning (x : xs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerWarning x -> NS WrapLedgerWarning (x : xs)
forall a (f :: a -> *) (x :: a) (xs :: [a]). f x -> NS f (x : xs)
Z
(WrapLedgerWarning x -> NS WrapLedgerWarning (x : xs))
-> (LedgerWarning x -> WrapLedgerWarning x)
-> LedgerWarning x
-> NS WrapLedgerWarning (x : xs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerWarning x -> WrapLedgerWarning x
forall blk. LedgerWarning blk -> WrapLedgerWarning blk
WrapLedgerWarning
liftUpdate :: LedgerUpdate x -> HardForkLedgerUpdate (x ': xs)
liftUpdate :: LedgerUpdate x -> HardForkLedgerUpdate (x : xs)
liftUpdate =
OneEraLedgerUpdate (x : xs) -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]).
OneEraLedgerUpdate xs -> HardForkLedgerUpdate xs
HardForkUpdateInEra
(OneEraLedgerUpdate (x : xs) -> HardForkLedgerUpdate (x : xs))
-> (LedgerUpdate x -> OneEraLedgerUpdate (x : xs))
-> LedgerUpdate x
-> HardForkLedgerUpdate (x : xs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NS WrapLedgerUpdate (x : xs) -> OneEraLedgerUpdate (x : xs)
forall (xs :: [*]). NS WrapLedgerUpdate xs -> OneEraLedgerUpdate xs
OneEraLedgerUpdate
(NS WrapLedgerUpdate (x : xs) -> OneEraLedgerUpdate (x : xs))
-> (LedgerUpdate x -> NS WrapLedgerUpdate (x : xs))
-> LedgerUpdate x
-> OneEraLedgerUpdate (x : xs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerUpdate x -> NS WrapLedgerUpdate (x : xs)
forall a (f :: a -> *) (x :: a) (xs :: [a]). f x -> NS f (x : xs)
Z
(WrapLedgerUpdate x -> NS WrapLedgerUpdate (x : xs))
-> (LedgerUpdate x -> WrapLedgerUpdate x)
-> LedgerUpdate x
-> NS WrapLedgerUpdate (x : xs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerUpdate x -> WrapLedgerUpdate x
forall blk. LedgerUpdate blk -> WrapLedgerUpdate blk
WrapLedgerUpdate
shiftEvent :: LedgerEvent (HardForkBlock xs)
-> LedgerEvent (HardForkBlock (x ': xs))
shiftEvent :: LedgerEvent (HardForkBlock xs)
-> LedgerEvent (HardForkBlock (x : xs))
shiftEvent (LedgerWarning LedgerWarning (HardForkBlock xs)
warning) = LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerWarning blk -> LedgerEvent blk
LedgerWarning (LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerWarning (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$ HardForkLedgerWarning xs -> HardForkLedgerWarning (x : xs)
forall (xs :: [*]) x.
HardForkLedgerWarning xs -> HardForkLedgerWarning (x : xs)
shiftWarning LedgerWarning (HardForkBlock xs)
HardForkLedgerWarning xs
warning
shiftEvent (LedgerUpdate LedgerUpdate (HardForkBlock xs)
update) = LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall blk. LedgerUpdate blk -> LedgerEvent blk
LedgerUpdate (LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs)))
-> LedgerUpdate (HardForkBlock (x : xs))
-> LedgerEvent (HardForkBlock (x : xs))
forall a b. (a -> b) -> a -> b
$ HardForkLedgerUpdate xs -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]) x.
HardForkLedgerUpdate xs -> HardForkLedgerUpdate (x : xs)
shiftUpdate LedgerUpdate (HardForkBlock xs)
HardForkLedgerUpdate xs
update
shiftWarning :: HardForkLedgerWarning xs -> HardForkLedgerWarning (x ': xs)
shiftWarning :: HardForkLedgerWarning xs -> HardForkLedgerWarning (x : xs)
shiftWarning = HardForkLedgerWarning xs -> HardForkLedgerWarning (x : xs)
forall (xs :: [*]) x.
HardForkLedgerWarning xs -> HardForkLedgerWarning (x : xs)
go
where
go :: HardForkLedgerWarning xs -> HardForkLedgerWarning (x : xs)
go (HardForkWarningInEra (OneEraLedgerWarning NS WrapLedgerWarning xs
warning)) =
OneEraLedgerWarning (x : xs) -> HardForkLedgerWarning (x : xs)
forall (xs :: [*]).
OneEraLedgerWarning xs -> HardForkLedgerWarning xs
HardForkWarningInEra
(NS WrapLedgerWarning (x : xs) -> OneEraLedgerWarning (x : xs)
forall (xs :: [*]).
NS WrapLedgerWarning xs -> OneEraLedgerWarning xs
OneEraLedgerWarning (NS WrapLedgerWarning xs -> NS WrapLedgerWarning (x : xs)
forall a (f :: a -> *) (xs :: [a]) (x :: a).
NS f xs -> NS f (x : xs)
S NS WrapLedgerWarning xs
warning))
go (HardForkWarningTransitionMismatch EraIndex xs
ix EraParams
ps EpochNo
t) =
EraIndex (x : xs)
-> EraParams -> EpochNo -> HardForkLedgerWarning (x : xs)
forall (xs :: [*]).
EraIndex xs -> EraParams -> EpochNo -> HardForkLedgerWarning xs
HardForkWarningTransitionMismatch
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix)
EraParams
ps
EpochNo
t
go (HardForkWarningTransitionInFinalEra EraIndex xs
ix EpochNo
t) =
EraIndex (x : xs) -> EpochNo -> HardForkLedgerWarning (x : xs)
forall (xs :: [*]).
EraIndex xs -> EpochNo -> HardForkLedgerWarning xs
HardForkWarningTransitionInFinalEra
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix)
EpochNo
t
go (HardForkWarningTransitionUnconfirmed EraIndex xs
ix) =
EraIndex (x : xs) -> HardForkLedgerWarning (x : xs)
forall (xs :: [*]). EraIndex xs -> HardForkLedgerWarning xs
HardForkWarningTransitionUnconfirmed
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix)
go (HardForkWarningTransitionReconfirmed EraIndex xs
ix EraIndex xs
ix' EpochNo
t EpochNo
t') =
EraIndex (x : xs)
-> EraIndex (x : xs)
-> EpochNo
-> EpochNo
-> HardForkLedgerWarning (x : xs)
forall (xs :: [*]).
EraIndex xs
-> EraIndex xs -> EpochNo -> EpochNo -> HardForkLedgerWarning xs
HardForkWarningTransitionReconfirmed
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix)
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix')
EpochNo
t
EpochNo
t'
shiftUpdate :: HardForkLedgerUpdate xs -> HardForkLedgerUpdate (x ': xs)
shiftUpdate :: HardForkLedgerUpdate xs -> HardForkLedgerUpdate (x : xs)
shiftUpdate = HardForkLedgerUpdate xs -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]) x.
HardForkLedgerUpdate xs -> HardForkLedgerUpdate (x : xs)
go
where
go :: HardForkLedgerUpdate xs -> HardForkLedgerUpdate (x ': xs)
go :: HardForkLedgerUpdate xs -> HardForkLedgerUpdate (x : xs)
go (HardForkUpdateInEra (OneEraLedgerUpdate NS WrapLedgerUpdate xs
update)) =
OneEraLedgerUpdate (x : xs) -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]).
OneEraLedgerUpdate xs -> HardForkLedgerUpdate xs
HardForkUpdateInEra
(NS WrapLedgerUpdate (x : xs) -> OneEraLedgerUpdate (x : xs)
forall (xs :: [*]). NS WrapLedgerUpdate xs -> OneEraLedgerUpdate xs
OneEraLedgerUpdate (NS WrapLedgerUpdate xs -> NS WrapLedgerUpdate (x : xs)
forall a (f :: a -> *) (xs :: [a]) (x :: a).
NS f xs -> NS f (x : xs)
S NS WrapLedgerUpdate xs
update))
go (HardForkUpdateTransitionConfirmed EraIndex xs
ix EraIndex xs
ix' EpochNo
t) =
EraIndex (x : xs)
-> EraIndex (x : xs) -> EpochNo -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]).
EraIndex xs -> EraIndex xs -> EpochNo -> HardForkLedgerUpdate xs
HardForkUpdateTransitionConfirmed
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix)
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix')
EpochNo
t
go (HardForkUpdateTransitionDone EraIndex xs
ix EraIndex xs
ix' EpochNo
e) =
EraIndex (x : xs)
-> EraIndex (x : xs) -> EpochNo -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]).
EraIndex xs -> EraIndex xs -> EpochNo -> HardForkLedgerUpdate xs
HardForkUpdateTransitionDone
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix)
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix')
EpochNo
e
go (HardForkUpdateTransitionRolledBack EraIndex xs
ix EraIndex xs
ix') =
EraIndex (x : xs)
-> EraIndex (x : xs) -> HardForkLedgerUpdate (x : xs)
forall (xs :: [*]).
EraIndex xs -> EraIndex xs -> HardForkLedgerUpdate xs
HardForkUpdateTransitionRolledBack
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix)
(EraIndex xs -> EraIndex (x : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex xs
ix')
ledgerInfo :: forall blk. SingleEraBlock blk
=> Current (Ticked :.: LedgerState) blk -> LedgerEraInfo blk
ledgerInfo :: Current (Ticked :.: LedgerState) blk -> LedgerEraInfo blk
ledgerInfo Current (Ticked :.: LedgerState) blk
_ = SingleEraInfo blk -> LedgerEraInfo blk
forall blk. SingleEraInfo blk -> LedgerEraInfo blk
LedgerEraInfo (SingleEraInfo blk -> LedgerEraInfo blk)
-> SingleEraInfo blk -> LedgerEraInfo blk
forall a b. (a -> b) -> a -> b
$ Proxy blk -> SingleEraInfo blk
forall blk (proxy :: * -> *).
SingleEraBlock blk =>
proxy blk -> SingleEraInfo blk
singleEraInfo (Proxy blk
forall k (t :: k). Proxy t
Proxy @blk)
ledgerViewInfo :: forall blk f. SingleEraBlock blk
=> (Ticked :.: f) blk -> LedgerEraInfo blk
ledgerViewInfo :: (:.:) Ticked f blk -> LedgerEraInfo blk
ledgerViewInfo (:.:) Ticked f blk
_ = SingleEraInfo blk -> LedgerEraInfo blk
forall blk. SingleEraInfo blk -> LedgerEraInfo blk
LedgerEraInfo (SingleEraInfo blk -> LedgerEraInfo blk)
-> SingleEraInfo blk -> LedgerEraInfo blk
forall a b. (a -> b) -> a -> b
$ Proxy blk -> SingleEraInfo blk
forall blk (proxy :: * -> *).
SingleEraBlock blk =>
proxy blk -> SingleEraInfo blk
singleEraInfo (Proxy blk
forall k (t :: k). Proxy t
Proxy @blk)
injectLedgerError :: Injection WrapLedgerErr xs blk
-> LedgerError blk
-> HardForkLedgerError xs
injectLedgerError :: Injection WrapLedgerErr xs blk
-> LedgerError blk -> HardForkLedgerError xs
injectLedgerError Injection WrapLedgerErr xs blk
inj =
OneEraLedgerError xs -> HardForkLedgerError xs
forall (xs :: [*]). OneEraLedgerError xs -> HardForkLedgerError xs
HardForkLedgerErrorFromEra
(OneEraLedgerError xs -> HardForkLedgerError xs)
-> (LedgerError blk -> OneEraLedgerError xs)
-> LedgerError blk
-> HardForkLedgerError xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NS WrapLedgerErr xs -> OneEraLedgerError xs
forall (xs :: [*]). NS WrapLedgerErr xs -> OneEraLedgerError xs
OneEraLedgerError
(NS WrapLedgerErr xs -> OneEraLedgerError xs)
-> (LedgerError blk -> NS WrapLedgerErr xs)
-> LedgerError blk
-> OneEraLedgerError xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. K (NS WrapLedgerErr xs) blk -> NS WrapLedgerErr xs
forall k a (b :: k). K a b -> a
unK
(K (NS WrapLedgerErr xs) blk -> NS WrapLedgerErr xs)
-> (LedgerError blk -> K (NS WrapLedgerErr xs) blk)
-> LedgerError blk
-> NS WrapLedgerErr xs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Injection WrapLedgerErr xs blk
-> WrapLedgerErr blk -> K (NS WrapLedgerErr xs) blk
forall k (f :: k -> *) (g :: k -> *) (a :: k).
(-.->) f g a -> f a -> g a
apFn Injection WrapLedgerErr xs blk
inj
(WrapLedgerErr blk -> K (NS WrapLedgerErr xs) blk)
-> (LedgerError blk -> WrapLedgerErr blk)
-> LedgerError blk
-> K (NS WrapLedgerErr xs) blk
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerError blk -> WrapLedgerErr blk
forall blk. LedgerError blk -> WrapLedgerErr blk
WrapLedgerErr