{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
-- TODO: Ledger has a few deprecations that we are ignoring for now
{-# OPTIONS_GHC -Wno-deprecations #-}
{-# OPTIONS_GHC -Wno-orphans -Wno-x-ord-preserving-coercions #-}
#if __GLASGOW_HASKELL__ < 908
{-# OPTIONS_GHC -Wno-unrecognised-warning-flags #-}
#endif

module Ouroboros.Consensus.Cardano.CanHardFork
  ( CardanoHardForkConstraints
  , TriggerHardFork (..)

    -- * Re-exports of Shelley code
  , ShelleyPartialLedgerConfig (..)
  , crossEraForecastAcrossShelley
  , translateChainDepStateAcrossShelley

    -- * Exposed for testing
  , getConwayTranslationContext
  , getDijkstraTranslationContext
  ) where

import Cardano.Ledger.Allegra.Translation
  ( shelleyToAllegraAVVMsToDelete
  )
import qualified Cardano.Ledger.BaseTypes as SL
import qualified Cardano.Ledger.Core as SL
import qualified Cardano.Ledger.Genesis as SL
import qualified Cardano.Ledger.Shelley.API as SL
import Cardano.Ledger.Shelley.Translation
  ( toFromByronTranslationContext
  )
import qualified Cardano.Protocol.TPraos.API as SL
import qualified Cardano.Protocol.TPraos.Rules.Prtcl as SL
import qualified Cardano.Protocol.TPraos.Rules.Tickn as SL
import Control.Monad.Except (throwError)
import Data.Coerce (coerce)
import qualified Data.Map.Strict as Map
import Data.Proxy
import Data.SOP.BasicFunctors
import Data.SOP.Functors (Flip (..))
import Data.SOP.InPairs (RequiringBoth (..), ignoringBoth)
import qualified Data.SOP.Strict as SOP
import Data.SOP.Tails (Tails (..))
import qualified Data.SOP.Tails as Tails
import Data.Void
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Byron.ByronHFC ()
import Ouroboros.Consensus.Byron.Ledger
import Ouroboros.Consensus.Byron.Node ()
import Ouroboros.Consensus.Cardano.Block
import Ouroboros.Consensus.Cardano.CanHardFork.OptimizedTxIdComparison
  ( compareCardanoGenTxId
  )
import Ouroboros.Consensus.Forecast
import Ouroboros.Consensus.HardFork.Combinator
import Ouroboros.Consensus.HardFork.Combinator.State.Types
import Ouroboros.Consensus.HardFork.History
  ( Bound (boundSlot)
  , addSlots
  )
import Ouroboros.Consensus.HardFork.Simple
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.SupportsMempool
  ( ByteSize32
  , IgnoringOverflow
  , TrivialTxMeasurePhase2 (..)
  , TxMeasurePhase1
  , TxMeasurePhase2
  )
import Ouroboros.Consensus.Ledger.SupportsProtocol
  ( LedgerSupportsProtocol
  )
import qualified Ouroboros.Consensus.Ledger.Tables.Diff as Diff
import Ouroboros.Consensus.Ledger.Tables.Utils
import Ouroboros.Consensus.Protocol.Abstract hiding
  ( translateChainDepState
  )
import Ouroboros.Consensus.Protocol.PBFT.State (PBftState)
import qualified Ouroboros.Consensus.Protocol.PBFT.State as PBftState
import Ouroboros.Consensus.Protocol.Praos (Praos)
import qualified Ouroboros.Consensus.Protocol.Praos as Praos
import Ouroboros.Consensus.Protocol.Praos.Common (PraosTiebreakerView)
import Ouroboros.Consensus.Protocol.TPraos
import qualified Ouroboros.Consensus.Protocol.TPraos as TPraos
import Ouroboros.Consensus.Shelley.HFEras ()
import Ouroboros.Consensus.Shelley.Ledger
import Ouroboros.Consensus.Shelley.Node ()
import Ouroboros.Consensus.Shelley.Protocol.Praos ()
import Ouroboros.Consensus.Shelley.ShelleyHFC
import Ouroboros.Consensus.TypeFamilyWrappers
import Ouroboros.Consensus.Util (coerceMapKeys)

{-------------------------------------------------------------------------------
  CanHardFork
-------------------------------------------------------------------------------}

type CardanoHardForkConstraints c =
  ( TPraos.PraosCrypto c
  , Praos.PraosCrypto c
  , LedgerSupportsProtocol (ShelleyBlock (TPraos c) ShelleyEra)
  , LedgerSupportsProtocol (ShelleyBlock (TPraos c) AllegraEra)
  , LedgerSupportsProtocol (ShelleyBlock (TPraos c) MaryEra)
  , LedgerSupportsProtocol (ShelleyBlock (TPraos c) AlonzoEra)
  , LedgerSupportsProtocol (ShelleyBlock (Praos c) BabbageEra)
  , LedgerSupportsProtocol (ShelleyBlock (Praos c) ConwayEra)
  , LedgerSupportsProtocol (ShelleyBlock (Praos c) DijkstraEra)
  )

-- | When performing era translations, two eras have special behaviours on the
-- ledger tables:
--
-- * Byron to Shelley: as Byron has no tables, the whole UTxO set is computed as
--     insertions, note that it uses 'valuesAsDiffs'
--
-- * Shelley to Allegra: some special addresses (the so called /AVVM/
--     addresses), were deleted in this transition, which influenced things like
--     the calculation of later rewards. In this transition, we consume the
--     'shelleyToAllegraAVVMsToDelete' as deletions in the ledger tables.
instance CardanoHardForkConstraints c => CanHardFork (CardanoEras c) where
  type HardForkTxMeasurePhase1 (CardanoEras c) = AlonzoMeasure
  type HardForkTxMeasurePhase2 (CardanoEras c) = RefScriptSize

  hardForkEraTranslation :: EraTranslation (CardanoEras c)
hardForkEraTranslation =
    EraTranslation
      { translateLedgerState :: InPairs
  (RequiringBoth WrapLedgerConfig TranslateLedgerState)
  (CardanoEras c)
translateLedgerState =
          RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     (CardanoEras c)
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
forall c.
ShelleyCompatible (TPraos c) ShelleyEra =>
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
translateLedgerStateByronToShelleyWrapper (InPairs
   (RequiringBoth WrapLedgerConfig TranslateLedgerState)
   '[ShelleyBlock (TPraos c) ShelleyEra,
     ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapLedgerConfig TranslateLedgerState)
      (CardanoEras c))
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     (CardanoEras c)
forall a b. (a -> b) -> a -> b
$
            RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
translateLedgerStateShelleyToAllegraWrapper (InPairs
   (RequiringBoth WrapLedgerConfig TranslateLedgerState)
   '[ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapLedgerConfig TranslateLedgerState)
      '[ShelleyBlock (TPraos c) ShelleyEra,
        ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
              RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
translateLedgerStateAllegraToMaryWrapper (InPairs
   (RequiringBoth WrapLedgerConfig TranslateLedgerState)
   '[ShelleyBlock (TPraos c) MaryEra,
     ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapLedgerConfig TranslateLedgerState)
      '[ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
translateLedgerStateMaryToAlonzoWrapper (InPairs
   (RequiringBoth WrapLedgerConfig TranslateLedgerState)
   '[ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapLedgerConfig TranslateLedgerState)
      '[ShelleyBlock (TPraos c) MaryEra,
        ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                  RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
translateLedgerStateAlonzoToBabbageWrapper (InPairs
   (RequiringBoth WrapLedgerConfig TranslateLedgerState)
   '[ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapLedgerConfig TranslateLedgerState)
      '[ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                    RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
translateLedgerStateBabbageToConwayWrapper (InPairs
   (RequiringBoth WrapLedgerConfig TranslateLedgerState)
   '[ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapLedgerConfig TranslateLedgerState)
      '[ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                      RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
translateLedgerStateConwayToDijkstraWrapper (InPairs
   (RequiringBoth WrapLedgerConfig TranslateLedgerState)
   '[ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapLedgerConfig TranslateLedgerState)
      '[ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                        InPairs
  (RequiringBoth WrapLedgerConfig TranslateLedgerState)
  '[ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
      , translateLedgerTables :: InPairs TranslateLedgerTables (CardanoEras c)
translateLedgerTables =
          TranslateLedgerTables
  ByronBlock (ShelleyBlock (TPraos c) ShelleyEra)
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs TranslateLedgerTables (CardanoEras c)
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons TranslateLedgerTables
  ByronBlock (ShelleyBlock (TPraos c) ShelleyEra)
forall c.
TranslateLedgerTables
  ByronBlock (ShelleyBlock (TPraos c) ShelleyEra)
translateLedgerTablesByronToShelleyWrapper (InPairs
   TranslateLedgerTables
   '[ShelleyBlock (TPraos c) ShelleyEra,
     ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs TranslateLedgerTables (CardanoEras c))
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs TranslateLedgerTables (CardanoEras c)
forall a b. (a -> b) -> a -> b
$
            TranslateLedgerTables
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons TranslateLedgerTables
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
forall c.
TranslateLedgerTables
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
translateLedgerTablesShelleyToAllegraWrapper (InPairs
   TranslateLedgerTables
   '[ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      TranslateLedgerTables
      '[ShelleyBlock (TPraos c) ShelleyEra,
        ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
              TranslateLedgerTables
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons TranslateLedgerTables
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
forall c.
TranslateLedgerTables
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
translateLedgerTablesAllegraToMaryWrapper (InPairs
   TranslateLedgerTables
   '[ShelleyBlock (TPraos c) MaryEra,
     ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      TranslateLedgerTables
      '[ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                TranslateLedgerTables
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons TranslateLedgerTables
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
forall c.
TranslateLedgerTables
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
translateLedgerTablesMaryToAlonzoWrapper (InPairs
   TranslateLedgerTables
   '[ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      TranslateLedgerTables
      '[ShelleyBlock (TPraos c) MaryEra,
        ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                  TranslateLedgerTables
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons TranslateLedgerTables
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
forall c.
TranslateLedgerTables
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
translateLedgerTablesAlonzoToBabbageWrapper (InPairs
   TranslateLedgerTables
   '[ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      TranslateLedgerTables
      '[ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                    TranslateLedgerTables
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons TranslateLedgerTables
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
forall c.
TranslateLedgerTables
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
translateLedgerTablesBabbageToConwayWrapper (InPairs
   TranslateLedgerTables
   '[ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      TranslateLedgerTables
      '[ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                      TranslateLedgerTables
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
-> InPairs
     TranslateLedgerTables '[ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons TranslateLedgerTables
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
forall c.
TranslateLedgerTables
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
translateLedgerTablesConwayToDijkstraWrapper (InPairs
   TranslateLedgerTables '[ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      TranslateLedgerTables
      '[ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     TranslateLedgerTables '[ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     TranslateLedgerTables
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                        InPairs TranslateLedgerTables '[ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
      , translateChainDepState :: InPairs
  (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
  (CardanoEras c)
translateChainDepState =
          RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     (CardanoEras c)
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
forall c.
RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
translateChainDepStateByronToShelleyWrapper (InPairs
   (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
   '[ShelleyBlock (TPraos c) ShelleyEra,
     ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
      (CardanoEras c))
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     (CardanoEras c)
forall a b. (a -> b) -> a -> b
$
            RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
forall eraFrom eraTo protoFrom protoTo.
TranslateProto protoFrom protoTo =>
RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
translateChainDepStateAcrossShelley (InPairs
   (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
   '[ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
      '[ShelleyBlock (TPraos c) ShelleyEra,
        ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
              RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
forall eraFrom eraTo protoFrom protoTo.
TranslateProto protoFrom protoTo =>
RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
translateChainDepStateAcrossShelley (InPairs
   (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
   '[ShelleyBlock (TPraos c) MaryEra,
     ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
      '[ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
forall eraFrom eraTo protoFrom protoTo.
TranslateProto protoFrom protoTo =>
RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
translateChainDepStateAcrossShelley (InPairs
   (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
   '[ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
      '[ShelleyBlock (TPraos c) MaryEra,
        ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                  RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
forall eraFrom eraTo protoFrom protoTo.
TranslateProto protoFrom protoTo =>
RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
translateChainDepStateAcrossShelley (InPairs
   (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
   '[ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
      '[ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                    RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
forall eraFrom eraTo protoFrom protoTo.
TranslateProto protoFrom protoTo =>
RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
translateChainDepStateAcrossShelley (InPairs
   (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
   '[ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
      '[ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                      RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
forall eraFrom eraTo protoFrom protoTo.
TranslateProto protoFrom protoTo =>
RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
translateChainDepStateAcrossShelley (InPairs
   (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
   '[ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
      '[ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                        InPairs
  (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
  '[ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
      , crossEraForecast :: InPairs
  (RequiringBoth
     WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
  (CardanoEras c)
crossEraForecast =
          RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     (CardanoEras c)
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
forall c.
RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
crossEraForecastByronToShelleyWrapper (InPairs
   (RequiringBoth
      WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
   '[ShelleyBlock (TPraos c) ShelleyEra,
     ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth
         WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
      (CardanoEras c))
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     (CardanoEras c)
forall a b. (a -> b) -> a -> b
$
            RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
forall eraFrom eraTo protoFrom protoTo.
(TranslateProto protoFrom protoTo,
 LedgerSupportsProtocol (ShelleyBlock protoFrom eraFrom)) =>
RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
crossEraForecastAcrossShelley (InPairs
   (RequiringBoth
      WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
   '[ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth
         WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
      '[ShelleyBlock (TPraos c) ShelleyEra,
        ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
              RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
forall eraFrom eraTo protoFrom protoTo.
(TranslateProto protoFrom protoTo,
 LedgerSupportsProtocol (ShelleyBlock protoFrom eraFrom)) =>
RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
crossEraForecastAcrossShelley (InPairs
   (RequiringBoth
      WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
   '[ShelleyBlock (TPraos c) MaryEra,
     ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth
         WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
      '[ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
forall eraFrom eraTo protoFrom protoTo.
(TranslateProto protoFrom protoTo,
 LedgerSupportsProtocol (ShelleyBlock protoFrom eraFrom)) =>
RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
crossEraForecastAcrossShelley (InPairs
   (RequiringBoth
      WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
   '[ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth
         WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
      '[ShelleyBlock (TPraos c) MaryEra,
        ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                  RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
forall eraFrom eraTo protoFrom protoTo.
(TranslateProto protoFrom protoTo,
 LedgerSupportsProtocol (ShelleyBlock protoFrom eraFrom)) =>
RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
crossEraForecastAcrossShelley (InPairs
   (RequiringBoth
      WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
   '[ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth
         WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
      '[ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                    RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
forall eraFrom eraTo protoFrom protoTo.
(TranslateProto protoFrom protoTo,
 LedgerSupportsProtocol (ShelleyBlock protoFrom eraFrom)) =>
RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
crossEraForecastAcrossShelley (InPairs
   (RequiringBoth
      WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
   '[ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth
         WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
      '[ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                      RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (zs :: [k]).
f x y -> InPairs f (y : zs) -> InPairs f (x : y : zs)
PCons RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
forall eraFrom eraTo protoFrom protoTo.
(TranslateProto protoFrom protoTo,
 LedgerSupportsProtocol (ShelleyBlock protoFrom eraFrom)) =>
RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock protoFrom eraFrom)
  (ShelleyBlock protoTo eraTo)
crossEraForecastAcrossShelley (InPairs
   (RequiringBoth
      WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
   '[ShelleyBlock (Praos c) DijkstraEra]
 -> InPairs
      (RequiringBoth
         WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
      '[ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra])
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) DijkstraEra]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall a b. (a -> b) -> a -> b
$
                        InPairs
  (RequiringBoth
     WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
  '[ShelleyBlock (Praos c) DijkstraEra]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
      }
  hardForkChainSel :: Tails AcrossEraTiebreaker (CardanoEras c)
hardForkChainSel =
    -- Byron <-> Shelley, ...
    NP
  (AcrossEraTiebreaker ByronBlock)
  '[ShelleyBlock (TPraos c) ShelleyEra,
    ShelleyBlock (TPraos c) AllegraEra,
    ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
    ShelleyBlock (Praos c) BabbageEra,
    ShelleyBlock (Praos c) ConwayEra,
    ShelleyBlock (Praos c) DijkstraEra]
-> Tails
     AcrossEraTiebreaker
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> Tails AcrossEraTiebreaker (CardanoEras c)
forall {k} (f :: k -> k -> *) (x :: k) (xs1 :: [k]).
NP (f x) xs1 -> Tails f xs1 -> Tails f (x : xs1)
TCons ((forall a. AcrossEraTiebreaker ByronBlock a)
-> NP
     (AcrossEraTiebreaker ByronBlock)
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall (xs :: [*]) (f :: * -> *).
SListIN NP xs =>
(forall a. f a) -> NP f xs
forall k l (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *).
(HPure h, SListIN h xs) =>
(forall (a :: k). f a) -> h f xs
SOP.hpure AcrossEraTiebreaker ByronBlock a
forall a. AcrossEraTiebreaker ByronBlock a
forall a b. AcrossEraTiebreaker a b
NoTiebreakerAcrossEras)
    -- Inter-Shelley-based
    (Tails
   AcrossEraTiebreaker
   '[ShelleyBlock (TPraos c) ShelleyEra,
     ShelleyBlock (TPraos c) AllegraEra,
     ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
     ShelleyBlock (Praos c) BabbageEra,
     ShelleyBlock (Praos c) ConwayEra,
     ShelleyBlock (Praos c) DijkstraEra]
 -> Tails AcrossEraTiebreaker (CardanoEras c))
-> Tails
     AcrossEraTiebreaker
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> Tails AcrossEraTiebreaker (CardanoEras c)
forall a b. (a -> b) -> a -> b
$
      Proxy (HasPraosTiebreakerView c)
-> (forall x y.
    (HasPraosTiebreakerView c x, HasPraosTiebreakerView c y) =>
    AcrossEraTiebreaker x y)
-> Tails
     AcrossEraTiebreaker
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
forall {k} (proxy :: (k -> Constraint) -> *) (f :: k -> k -> *)
       (c :: k -> Constraint) (xs :: [k]).
All c xs =>
proxy c
-> (forall (x :: k) (y :: k). (c x, c y) => f x y) -> Tails f xs
Tails.hcpure (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @(HasPraosTiebreakerView c)) AcrossEraTiebreaker x y
forall a b.
(TiebreakerView (BlockProtocol a)
 ~ TiebreakerView (BlockProtocol b)) =>
AcrossEraTiebreaker a b
forall x y.
(HasPraosTiebreakerView c x, HasPraosTiebreakerView c y) =>
AcrossEraTiebreaker x y
SameTiebreakerAcrossEras

  hardForkInjTxMeasurePhase1 :: NS WrapTxMeasurePhase1 (CardanoEras c)
-> HardForkTxMeasurePhase1 (CardanoEras c)
hardForkInjTxMeasurePhase1 =
    IgnoringOverflow ByteSize32 -> AlonzoMeasure
TxMeasurePhase1 ByronBlock -> AlonzoMeasure
fromByteSize
      (TxMeasurePhase1 ByronBlock -> AlonzoMeasure)
-> (NS
      WrapTxMeasurePhase1
      '[ShelleyBlock (TPraos c) ShelleyEra,
        ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> AlonzoMeasure)
-> NS WrapTxMeasurePhase1 (CardanoEras c)
-> AlonzoMeasure
forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
`o` IgnoringOverflow ByteSize32 -> AlonzoMeasure
TxMeasurePhase1 (ShelleyBlock (TPraos c) ShelleyEra)
-> AlonzoMeasure
fromByteSize
      (TxMeasurePhase1 (ShelleyBlock (TPraos c) ShelleyEra)
 -> AlonzoMeasure)
-> (NS
      WrapTxMeasurePhase1
      '[ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> AlonzoMeasure)
-> NS
     WrapTxMeasurePhase1
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> AlonzoMeasure
forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
`o` IgnoringOverflow ByteSize32 -> AlonzoMeasure
TxMeasurePhase1 (ShelleyBlock (TPraos c) AllegraEra)
-> AlonzoMeasure
fromByteSize
      (TxMeasurePhase1 (ShelleyBlock (TPraos c) AllegraEra)
 -> AlonzoMeasure)
-> (NS
      WrapTxMeasurePhase1
      '[ShelleyBlock (TPraos c) MaryEra,
        ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> AlonzoMeasure)
-> NS
     WrapTxMeasurePhase1
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> AlonzoMeasure
forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
`o` IgnoringOverflow ByteSize32 -> AlonzoMeasure
TxMeasurePhase1 (ShelleyBlock (TPraos c) MaryEra) -> AlonzoMeasure
fromByteSize
      (TxMeasurePhase1 (ShelleyBlock (TPraos c) MaryEra)
 -> AlonzoMeasure)
-> (NS
      WrapTxMeasurePhase1
      '[ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> AlonzoMeasure)
-> NS
     WrapTxMeasurePhase1
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> AlonzoMeasure
forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
`o` TxMeasurePhase1 (ShelleyBlock (TPraos c) AlonzoEra)
-> AlonzoMeasure
AlonzoMeasure -> AlonzoMeasure
forall a. a -> a
id
      (TxMeasurePhase1 (ShelleyBlock (TPraos c) AlonzoEra)
 -> AlonzoMeasure)
-> (NS
      WrapTxMeasurePhase1
      '[ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> AlonzoMeasure)
-> NS
     WrapTxMeasurePhase1
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> AlonzoMeasure
forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
`o` TxMeasurePhase1 (ShelleyBlock (Praos c) BabbageEra)
-> AlonzoMeasure
AlonzoMeasure -> AlonzoMeasure
forall a. a -> a
id
      (TxMeasurePhase1 (ShelleyBlock (Praos c) BabbageEra)
 -> AlonzoMeasure)
-> (NS
      WrapTxMeasurePhase1
      '[ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> AlonzoMeasure)
-> NS
     WrapTxMeasurePhase1
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> AlonzoMeasure
forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
`o` TxMeasurePhase1 (ShelleyBlock (Praos c) ConwayEra) -> AlonzoMeasure
AlonzoMeasure -> AlonzoMeasure
forall a. a -> a
id
      (TxMeasurePhase1 (ShelleyBlock (Praos c) ConwayEra)
 -> AlonzoMeasure)
-> (NS WrapTxMeasurePhase1 '[ShelleyBlock (Praos c) DijkstraEra]
    -> AlonzoMeasure)
-> NS
     WrapTxMeasurePhase1
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> AlonzoMeasure
forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
`o` TxMeasurePhase1 (ShelleyBlock (Praos c) DijkstraEra)
-> AlonzoMeasure
AlonzoMeasure -> AlonzoMeasure
forall a. a -> a
id
      (TxMeasurePhase1 (ShelleyBlock (Praos c) DijkstraEra)
 -> AlonzoMeasure)
-> (NS WrapTxMeasurePhase1 '[] -> AlonzoMeasure)
-> NS WrapTxMeasurePhase1 '[ShelleyBlock (Praos c) DijkstraEra]
-> AlonzoMeasure
forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
`o` NS WrapTxMeasurePhase1 '[] -> AlonzoMeasure
forall (f :: * -> *) a. NS f '[] -> a
nil
   where
    nil :: SOP.NS f '[] -> a
    nil :: forall (f :: * -> *) a. NS f '[] -> a
nil = \case {}

    infixr 9 `o`
    o ::
      (TxMeasurePhase1 x -> a) ->
      (SOP.NS WrapTxMeasurePhase1 xs -> a) ->
      SOP.NS WrapTxMeasurePhase1 (x : xs) ->
      a
    o :: forall x a (xs :: [*]).
(TxMeasurePhase1 x -> a)
-> (NS WrapTxMeasurePhase1 xs -> a)
-> NS WrapTxMeasurePhase1 (x : xs)
-> a
o TxMeasurePhase1 x -> a
f NS WrapTxMeasurePhase1 xs -> a
g = \case
      SOP.Z (WrapTxMeasurePhase1 TxMeasurePhase1 x
x) -> TxMeasurePhase1 x -> a
f TxMeasurePhase1 x
TxMeasurePhase1 x
x
      SOP.S NS WrapTxMeasurePhase1 xs1
y -> NS WrapTxMeasurePhase1 xs -> a
g NS WrapTxMeasurePhase1 xs
NS WrapTxMeasurePhase1 xs1
y

    fromByteSize :: IgnoringOverflow ByteSize32 -> AlonzoMeasure
    fromByteSize :: IgnoringOverflow ByteSize32 -> AlonzoMeasure
fromByteSize IgnoringOverflow ByteSize32
x = IgnoringOverflow ByteSize32 -> ExUnits' Nat -> AlonzoMeasure
AlonzoMeasure IgnoringOverflow ByteSize32
x ExUnits' Nat
forall a. Monoid a => a
mempty

  hardForkInjTxMeasurePhase2 :: NS WrapTxMeasurePhase2 (CardanoEras c)
-> HardForkTxMeasurePhase2 (CardanoEras c)
hardForkInjTxMeasurePhase2 =
    TrivialTxMeasurePhase2 -> RefScriptSize
TxMeasurePhase2 ByronBlock -> RefScriptSize
fromTrivial
      (TxMeasurePhase2 ByronBlock -> RefScriptSize)
-> (NS
      WrapTxMeasurePhase2
      '[ShelleyBlock (TPraos c) ShelleyEra,
        ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> RefScriptSize)
-> NS WrapTxMeasurePhase2 (CardanoEras c)
-> RefScriptSize
forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
`o` TrivialTxMeasurePhase2 -> RefScriptSize
TxMeasurePhase2 (ShelleyBlock (TPraos c) ShelleyEra)
-> RefScriptSize
fromTrivial
      (TxMeasurePhase2 (ShelleyBlock (TPraos c) ShelleyEra)
 -> RefScriptSize)
-> (NS
      WrapTxMeasurePhase2
      '[ShelleyBlock (TPraos c) AllegraEra,
        ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> RefScriptSize)
-> NS
     WrapTxMeasurePhase2
     '[ShelleyBlock (TPraos c) ShelleyEra,
       ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> RefScriptSize
forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
`o` TrivialTxMeasurePhase2 -> RefScriptSize
TxMeasurePhase2 (ShelleyBlock (TPraos c) AllegraEra)
-> RefScriptSize
fromTrivial
      (TxMeasurePhase2 (ShelleyBlock (TPraos c) AllegraEra)
 -> RefScriptSize)
-> (NS
      WrapTxMeasurePhase2
      '[ShelleyBlock (TPraos c) MaryEra,
        ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> RefScriptSize)
-> NS
     WrapTxMeasurePhase2
     '[ShelleyBlock (TPraos c) AllegraEra,
       ShelleyBlock (TPraos c) MaryEra, ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> RefScriptSize
forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
`o` TrivialTxMeasurePhase2 -> RefScriptSize
TxMeasurePhase2 (ShelleyBlock (TPraos c) MaryEra) -> RefScriptSize
fromTrivial
      (TxMeasurePhase2 (ShelleyBlock (TPraos c) MaryEra)
 -> RefScriptSize)
-> (NS
      WrapTxMeasurePhase2
      '[ShelleyBlock (TPraos c) AlonzoEra,
        ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> RefScriptSize)
-> NS
     WrapTxMeasurePhase2
     '[ShelleyBlock (TPraos c) MaryEra,
       ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> RefScriptSize
forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
`o` TrivialTxMeasurePhase2 -> RefScriptSize
TxMeasurePhase2 (ShelleyBlock (TPraos c) AlonzoEra)
-> RefScriptSize
fromTrivial
      (TxMeasurePhase2 (ShelleyBlock (TPraos c) AlonzoEra)
 -> RefScriptSize)
-> (NS
      WrapTxMeasurePhase2
      '[ShelleyBlock (Praos c) BabbageEra,
        ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> RefScriptSize)
-> NS
     WrapTxMeasurePhase2
     '[ShelleyBlock (TPraos c) AlonzoEra,
       ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> RefScriptSize
forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
`o` TrivialTxMeasurePhase2 -> RefScriptSize
TxMeasurePhase2 (ShelleyBlock (Praos c) BabbageEra)
-> RefScriptSize
fromTrivial
      (TxMeasurePhase2 (ShelleyBlock (Praos c) BabbageEra)
 -> RefScriptSize)
-> (NS
      WrapTxMeasurePhase2
      '[ShelleyBlock (Praos c) ConwayEra,
        ShelleyBlock (Praos c) DijkstraEra]
    -> RefScriptSize)
-> NS
     WrapTxMeasurePhase2
     '[ShelleyBlock (Praos c) BabbageEra,
       ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> RefScriptSize
forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
`o` TxMeasurePhase2 (ShelleyBlock (Praos c) ConwayEra) -> RefScriptSize
RefScriptSize -> RefScriptSize
forall a. a -> a
id
      (TxMeasurePhase2 (ShelleyBlock (Praos c) ConwayEra)
 -> RefScriptSize)
-> (NS WrapTxMeasurePhase2 '[ShelleyBlock (Praos c) DijkstraEra]
    -> RefScriptSize)
-> NS
     WrapTxMeasurePhase2
     '[ShelleyBlock (Praos c) ConwayEra,
       ShelleyBlock (Praos c) DijkstraEra]
-> RefScriptSize
forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
`o` TxMeasurePhase2 (ShelleyBlock (Praos c) DijkstraEra)
-> RefScriptSize
RefScriptSize -> RefScriptSize
forall a. a -> a
id
      (TxMeasurePhase2 (ShelleyBlock (Praos c) DijkstraEra)
 -> RefScriptSize)
-> (NS WrapTxMeasurePhase2 '[] -> RefScriptSize)
-> NS WrapTxMeasurePhase2 '[ShelleyBlock (Praos c) DijkstraEra]
-> RefScriptSize
forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
`o` NS WrapTxMeasurePhase2 '[] -> RefScriptSize
forall (f :: * -> *) a. NS f '[] -> a
nil
   where
    nil :: SOP.NS f '[] -> a
    nil :: forall (f :: * -> *) a. NS f '[] -> a
nil = \case {}

    infixr 9 `o`
    o ::
      (TxMeasurePhase2 x -> a) ->
      (SOP.NS WrapTxMeasurePhase2 xs -> a) ->
      SOP.NS WrapTxMeasurePhase2 (x : xs) ->
      a
    o :: forall x a (xs :: [*]).
(TxMeasurePhase2 x -> a)
-> (NS WrapTxMeasurePhase2 xs -> a)
-> NS WrapTxMeasurePhase2 (x : xs)
-> a
o TxMeasurePhase2 x -> a
f NS WrapTxMeasurePhase2 xs -> a
g = \case
      SOP.Z (WrapTxMeasurePhase2 TxMeasurePhase2 x
x) -> TxMeasurePhase2 x -> a
f TxMeasurePhase2 x
TxMeasurePhase2 x
x
      SOP.S NS WrapTxMeasurePhase2 xs1
y -> NS WrapTxMeasurePhase2 xs -> a
g NS WrapTxMeasurePhase2 xs
NS WrapTxMeasurePhase2 xs1
y

    fromTrivial :: TrivialTxMeasurePhase2 -> RefScriptSize
    fromTrivial :: TrivialTxMeasurePhase2 -> RefScriptSize
fromTrivial TrivialTxMeasurePhase2
TrivialTxMeasurePhase2 = RefScriptSize
forall a. Monoid a => a
mempty

  -- Both ids are ordered by their txid hash, ignoring the era. Equality reuses
  -- 'compare' rather than a separate path: 'hardForkEqGenTxId' is
  -- 'compareCardanoGenTxId' returning 'EQ'. This allocates no heap: all three
  -- 'Ordering' constructors take zero arguments, so they are never allocated on
  -- the dynamic heap; every 'Ordering' pointer is to one of three statically
  -- allocated addresses. 'compareCardanoGenTxId' keeps the comparison itself
  -- allocation-free.
  hardForkCompareGenTxId :: NS WrapGenTxId (CardanoEras c)
-> NS WrapGenTxId (CardanoEras c) -> Ordering
hardForkCompareGenTxId = NS WrapGenTxId (CardanoEras c)
-> NS WrapGenTxId (CardanoEras c) -> Ordering
forall (xs :: [*]).
All ToTxIdWords xs =>
NS WrapGenTxId xs -> NS WrapGenTxId xs -> Ordering
compareCardanoGenTxId
  hardForkEqGenTxId :: NS WrapGenTxId (CardanoEras c)
-> NS WrapGenTxId (CardanoEras c) -> Bool
hardForkEqGenTxId NS WrapGenTxId (CardanoEras c)
l NS WrapGenTxId (CardanoEras c)
r = NS WrapGenTxId (CardanoEras c)
-> NS WrapGenTxId (CardanoEras c) -> Ordering
forall (xs :: [*]).
All ToTxIdWords xs =>
NS WrapGenTxId xs -> NS WrapGenTxId xs -> Ordering
compareCardanoGenTxId NS WrapGenTxId (CardanoEras c)
l NS WrapGenTxId (CardanoEras c)
r Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
EQ

class TiebreakerView (BlockProtocol blk) ~ PraosTiebreakerView c => HasPraosTiebreakerView c blk
instance TiebreakerView (BlockProtocol blk) ~ PraosTiebreakerView c => HasPraosTiebreakerView c blk

{-------------------------------------------------------------------------------
  Translation from Byron to Shelley
-------------------------------------------------------------------------------}

translateHeaderHashByronToShelley ::
  forall c.
  ShelleyCompatible (TPraos c) ShelleyEra =>
  Proxy c ->
  HeaderHash ByronBlock ->
  HeaderHash (ShelleyBlock (TPraos c) ShelleyEra)
translateHeaderHashByronToShelley :: forall c.
ShelleyCompatible (TPraos c) ShelleyEra =>
Proxy c
-> HeaderHash ByronBlock
-> HeaderHash (ShelleyBlock (TPraos c) ShelleyEra)
translateHeaderHashByronToShelley Proxy c
_ HeaderHash ByronBlock
h =
  case HashSize ByronBlock
:~: HashSize (ShelleyBlock (TPraos c) ShelleyEra)
sameSizeSafety of
    HashSize ByronBlock
:~: HashSize (ShelleyBlock (TPraos c) ShelleyEra)
Refl ->
      Proxy (ShelleyBlock (TPraos c) ShelleyEra)
-> ShortByteString
-> HeaderHash (ShelleyBlock (TPraos c) ShelleyEra)
forall blk (proxy :: * -> *).
ConvertRawHash blk =>
proxy blk -> ShortByteString -> HeaderHash blk
forall (proxy :: * -> *).
proxy (ShelleyBlock (TPraos c) ShelleyEra)
-> ShortByteString
-> HeaderHash (ShelleyBlock (TPraos c) ShelleyEra)
unsafeFromShortRawHash (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @(ShelleyBlock (TPraos c) ShelleyEra)) (ShortByteString
 -> HeaderHash (ShelleyBlock (TPraos c) ShelleyEra))
-> ShortByteString
-> HeaderHash (ShelleyBlock (TPraos c) ShelleyEra)
forall a b. (a -> b) -> a -> b
$
        Proxy ByronBlock -> HeaderHash ByronBlock -> ShortByteString
forall blk (proxy :: * -> *).
ConvertRawHash blk =>
proxy blk -> HeaderHash blk -> ShortByteString
forall (proxy :: * -> *).
proxy ByronBlock -> HeaderHash ByronBlock -> ShortByteString
toShortRawHash (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @ByronBlock) HeaderHash ByronBlock
h
 where
  -- Calling 'unsafeFromShortRawHash' is only valid if the raw bytes of a Byron
  -- header hash are also a valid Shelley header hash, i.e. both hashes have the
  -- same size. This holds because both are 32-byte Blake2b_256 digests; we
  -- assert it here so that any future divergence is caught at compile time.
  sameSizeSafety :: HashSize ByronBlock :~: HashSize (ShelleyBlock (TPraos c) ShelleyEra)
  sameSizeSafety :: HashSize ByronBlock
:~: HashSize (ShelleyBlock (TPraos c) ShelleyEra)
sameSizeSafety = 32 :~: 32
HashSize ByronBlock
:~: HashSize (ShelleyBlock (TPraos c) ShelleyEra)
forall {k} (a :: k). a :~: a
Refl

translatePointByronToShelley ::
  forall c.
  ShelleyCompatible (TPraos c) ShelleyEra =>
  Point ByronBlock ->
  WithOrigin BlockNo ->
  WithOrigin (ShelleyTip (TPraos c) ShelleyEra)
translatePointByronToShelley :: forall c.
ShelleyCompatible (TPraos c) ShelleyEra =>
Point ByronBlock
-> WithOrigin BlockNo
-> WithOrigin (ShelleyTip (TPraos c) ShelleyEra)
translatePointByronToShelley Point ByronBlock
point WithOrigin BlockNo
bNo =
  case (Point ByronBlock
point, WithOrigin BlockNo
bNo) of
    (Point ByronBlock
GenesisPoint, WithOrigin BlockNo
Origin) ->
      WithOrigin (ShelleyTip (TPraos c) ShelleyEra)
forall t. WithOrigin t
Origin
    (BlockPoint SlotNo
s HeaderHash ByronBlock
h, NotOrigin BlockNo
n) ->
      ShelleyTip (TPraos c) ShelleyEra
-> WithOrigin (ShelleyTip (TPraos c) ShelleyEra)
forall t. t -> WithOrigin t
NotOrigin
        ShelleyTip
          { shelleyTipSlotNo :: SlotNo
shelleyTipSlotNo = SlotNo
s
          , shelleyTipBlockNo :: BlockNo
shelleyTipBlockNo = BlockNo
n
          , shelleyTipHash :: HeaderHash (ShelleyBlock (TPraos c) ShelleyEra)
shelleyTipHash = Proxy c
-> HeaderHash ByronBlock
-> HeaderHash (ShelleyBlock (TPraos c) ShelleyEra)
forall c.
ShelleyCompatible (TPraos c) ShelleyEra =>
Proxy c
-> HeaderHash ByronBlock
-> HeaderHash (ShelleyBlock (TPraos c) ShelleyEra)
translateHeaderHashByronToShelley (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @c) HeaderHash ByronBlock
h
          }
    (Point ByronBlock, WithOrigin BlockNo)
_otherwise ->
      [Char] -> WithOrigin (ShelleyTip (TPraos c) ShelleyEra)
forall a. HasCallStack => [Char] -> a
error [Char]
"translatePointByronToShelley: invalid Byron state"

translateLedgerStateByronToShelleyWrapper ::
  ShelleyCompatible (TPraos c) ShelleyEra =>
  RequiringBoth
    WrapLedgerConfig
    TranslateLedgerState
    ByronBlock
    (ShelleyBlock (TPraos c) ShelleyEra)
translateLedgerStateByronToShelleyWrapper :: forall c.
ShelleyCompatible (TPraos c) ShelleyEra =>
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
translateLedgerStateByronToShelleyWrapper =
  (WrapLedgerConfig ByronBlock
 -> WrapLedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
 -> TranslateLedgerState
      ByronBlock (ShelleyBlock (TPraos c) ShelleyEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     ByronBlock
     (ShelleyBlock (TPraos c) ShelleyEra)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
RequireBoth ((WrapLedgerConfig ByronBlock
  -> WrapLedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
  -> TranslateLedgerState
       ByronBlock (ShelleyBlock (TPraos c) ShelleyEra))
 -> RequiringBoth
      WrapLedgerConfig
      TranslateLedgerState
      ByronBlock
      (ShelleyBlock (TPraos c) ShelleyEra))
-> (WrapLedgerConfig ByronBlock
    -> WrapLedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
    -> TranslateLedgerState
         ByronBlock (ShelleyBlock (TPraos c) ShelleyEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     ByronBlock
     (ShelleyBlock (TPraos c) ShelleyEra)
forall a b. (a -> b) -> a -> b
$
    \WrapLedgerConfig ByronBlock
_ (WrapLedgerConfig LedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
cfgShelley) ->
      TranslateLedgerState
        { translateLedgerStateWith :: EpochNo
-> LedgerState ByronBlock EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) DiffMK
translateLedgerStateWith = \EpochNo
epochNo LedgerState ByronBlock EmptyMK
ledgerByron ->
            LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) DiffMK
forall (l :: StateKind) blk.
HasLedgerTables l blk =>
l blk ValuesMK -> l blk DiffMK
valuesAsDiffs
              (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
 -> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) DiffMK)
-> (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
    -> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK)
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) DiffMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
forall (l :: LedgerStateKind).
CanStowLedgerTables l =>
l EmptyMK -> l ValuesMK
unstowLedgerTables
              (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
 -> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) DiffMK)
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) DiffMK
forall a b. (a -> b) -> a -> b
$ ShelleyLedgerState
                { shelleyLedgerTip :: WithOrigin (ShelleyTip (TPraos c) ShelleyEra)
shelleyLedgerTip =
                    Point ByronBlock
-> WithOrigin BlockNo
-> WithOrigin (ShelleyTip (TPraos c) ShelleyEra)
forall c.
ShelleyCompatible (TPraos c) ShelleyEra =>
Point ByronBlock
-> WithOrigin BlockNo
-> WithOrigin (ShelleyTip (TPraos c) ShelleyEra)
translatePointByronToShelley
                      (LedgerState ByronBlock EmptyMK -> Point ByronBlock
forall blk (mk :: MapKind).
UpdateLedger blk =>
LedgerState blk mk -> Point blk
ledgerTipPoint LedgerState ByronBlock EmptyMK
ledgerByron)
                      (LedgerState ByronBlock EmptyMK -> WithOrigin BlockNo
forall (mk :: MapKind).
LedgerState ByronBlock mk -> WithOrigin BlockNo
byronLedgerTipBlockNo LedgerState ByronBlock EmptyMK
ledgerByron)
                , shelleyLedgerState :: NewEpochState ShelleyEra
shelleyLedgerState =
                    FromByronTranslationContext
-> EpochNo -> ChainValidationState -> NewEpochState ShelleyEra
SL.translateToShelleyLedgerState
                      (ShelleyGenesis -> FromByronTranslationContext
toFromByronTranslationContext (ShelleyLedgerConfig ShelleyEra -> ShelleyGenesis
forall era. ShelleyLedgerConfig era -> ShelleyGenesis
shelleyLedgerGenesis LedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
ShelleyLedgerConfig ShelleyEra
cfgShelley))
                      EpochNo
epochNo
                      (LedgerState ByronBlock EmptyMK -> ChainValidationState
forall (mk :: MapKind).
LedgerState ByronBlock mk -> ChainValidationState
byronLedgerState LedgerState ByronBlock EmptyMK
ledgerByron)
                , shelleyLedgerTransition :: ShelleyTransition
shelleyLedgerTransition =
                    ShelleyTransitionInfo{shelleyAfterVoting :: Word32
shelleyAfterVoting = Word32
0}
                , shelleyLedgerTables :: LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
shelleyLedgerTables = LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
forall (mk :: MapKind) blk.
(ZeroableMK mk, LedgerTableConstraints blk) =>
LedgerTables blk mk
emptyLedgerTables
                }
        }

translateLedgerTablesByronToShelleyWrapper ::
  TranslateLedgerTables ByronBlock (ShelleyBlock (TPraos c) ShelleyEra)
translateLedgerTablesByronToShelleyWrapper :: forall c.
TranslateLedgerTables
  ByronBlock (ShelleyBlock (TPraos c) ShelleyEra)
translateLedgerTablesByronToShelleyWrapper =
  TranslateLedgerTables
    { translateTxInWith :: TxIn ByronBlock -> TxIn (ShelleyBlock (TPraos c) ShelleyEra)
translateTxInWith = Void -> BigEndianTxIn
TxIn ByronBlock -> TxIn (ShelleyBlock (TPraos c) ShelleyEra)
forall a. Void -> a
absurd
    , translateTxOutWith :: TxOut ByronBlock -> TxOut (ShelleyBlock (TPraos c) ShelleyEra)
translateTxOutWith = Void -> ShelleyTxOut ShelleyEra
TxOut ByronBlock -> TxOut (ShelleyBlock (TPraos c) ShelleyEra)
forall a. Void -> a
absurd
    }

translateChainDepStateByronToShelleyWrapper ::
  RequiringBoth
    WrapConsensusConfig
    (Translate WrapChainDepState)
    ByronBlock
    (ShelleyBlock (TPraos c) ShelleyEra)
translateChainDepStateByronToShelleyWrapper :: forall c.
RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
translateChainDepStateByronToShelleyWrapper =
  (WrapConsensusConfig ByronBlock
 -> WrapConsensusConfig (ShelleyBlock (TPraos c) ShelleyEra)
 -> Translate
      WrapChainDepState ByronBlock (ShelleyBlock (TPraos c) ShelleyEra))
-> RequiringBoth
     WrapConsensusConfig
     (Translate WrapChainDepState)
     ByronBlock
     (ShelleyBlock (TPraos c) ShelleyEra)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
RequireBoth ((WrapConsensusConfig ByronBlock
  -> WrapConsensusConfig (ShelleyBlock (TPraos c) ShelleyEra)
  -> Translate
       WrapChainDepState ByronBlock (ShelleyBlock (TPraos c) ShelleyEra))
 -> RequiringBoth
      WrapConsensusConfig
      (Translate WrapChainDepState)
      ByronBlock
      (ShelleyBlock (TPraos c) ShelleyEra))
-> (WrapConsensusConfig ByronBlock
    -> WrapConsensusConfig (ShelleyBlock (TPraos c) ShelleyEra)
    -> Translate
         WrapChainDepState ByronBlock (ShelleyBlock (TPraos c) ShelleyEra))
-> RequiringBoth
     WrapConsensusConfig
     (Translate WrapChainDepState)
     ByronBlock
     (ShelleyBlock (TPraos c) ShelleyEra)
forall a b. (a -> b) -> a -> b
$ \WrapConsensusConfig ByronBlock
_ (WrapConsensusConfig ConsensusConfig
  (BlockProtocol (ShelleyBlock (TPraos c) ShelleyEra))
cfgShelley) ->
    (EpochNo
 -> WrapChainDepState ByronBlock
 -> WrapChainDepState (ShelleyBlock (TPraos c) ShelleyEra))
-> Translate
     WrapChainDepState ByronBlock (ShelleyBlock (TPraos c) ShelleyEra)
forall (f :: * -> *) x y.
(EpochNo -> f x -> f y) -> Translate f x y
Translate ((EpochNo
  -> WrapChainDepState ByronBlock
  -> WrapChainDepState (ShelleyBlock (TPraos c) ShelleyEra))
 -> Translate
      WrapChainDepState ByronBlock (ShelleyBlock (TPraos c) ShelleyEra))
-> (EpochNo
    -> WrapChainDepState ByronBlock
    -> WrapChainDepState (ShelleyBlock (TPraos c) ShelleyEra))
-> Translate
     WrapChainDepState ByronBlock (ShelleyBlock (TPraos c) ShelleyEra)
forall a b. (a -> b) -> a -> b
$ \EpochNo
_ (WrapChainDepState ChainDepState (BlockProtocol ByronBlock)
pbftState) ->
      ChainDepState (BlockProtocol (ShelleyBlock (TPraos c) ShelleyEra))
-> WrapChainDepState (ShelleyBlock (TPraos c) ShelleyEra)
forall blk.
ChainDepState (BlockProtocol blk) -> WrapChainDepState blk
WrapChainDepState (ChainDepState (BlockProtocol (ShelleyBlock (TPraos c) ShelleyEra))
 -> WrapChainDepState (ShelleyBlock (TPraos c) ShelleyEra))
-> ChainDepState
     (BlockProtocol (ShelleyBlock (TPraos c) ShelleyEra))
-> WrapChainDepState (ShelleyBlock (TPraos c) ShelleyEra)
forall a b. (a -> b) -> a -> b
$
        ConsensusConfig (TPraos c)
-> PBftState PBftByronCrypto -> TPraosState
forall bc c.
ConsensusConfig (TPraos c) -> PBftState bc -> TPraosState
translateChainDepStateByronToShelley ConsensusConfig
  (BlockProtocol (ShelleyBlock (TPraos c) ShelleyEra))
ConsensusConfig (TPraos c)
cfgShelley ChainDepState (BlockProtocol ByronBlock)
PBftState PBftByronCrypto
pbftState

translateChainDepStateByronToShelley ::
  forall bc c.
  ConsensusConfig (TPraos c) ->
  PBftState bc ->
  TPraosState
translateChainDepStateByronToShelley :: forall bc c.
ConsensusConfig (TPraos c) -> PBftState bc -> TPraosState
translateChainDepStateByronToShelley TPraosConfig{TPraosParams
tpraosParams :: TPraosParams
tpraosParams :: forall c. ConsensusConfig (TPraos c) -> TPraosParams
tpraosParams} PBftState bc
pbftState =
  -- Note that the 'PBftState' doesn't know about EBBs. So if the last slot of
  -- the Byron era were occupied by an EBB (and no regular block in that same
  -- slot), we would pick the wrong slot here, i.e., the slot of the regular
  -- block before the EBB.
  --
  -- Fortunately, this is impossible for two reasons:
  --
  -- 1. On mainnet we stopped producing EBBs a while before the transition.
  -- 2. The transition happens at the start of an epoch, so if the last slot
  --    were occupied by an EBB, it must have been the EBB at the start of the
  --    previous epoch. This means the previous epoch must have been empty,
  --    which is a violation of the "@k@ blocks per @2k@ slots" property.
  WithOrigin SlotNo -> ChainDepState -> TPraosState
TPraosState (PBftState bc -> WithOrigin SlotNo
forall c. PBftState c -> WithOrigin SlotNo
PBftState.lastSignedSlot PBftState bc
pbftState) (ChainDepState -> TPraosState) -> ChainDepState -> TPraosState
forall a b. (a -> b) -> a -> b
$
    SL.ChainDepState
      { csProtocol :: PrtclState
SL.csProtocol = Map (KeyHash BlockIssuer) Word64 -> Nonce -> Nonce -> PrtclState
SL.PrtclState Map (KeyHash BlockIssuer) Word64
forall k a. Map k a
Map.empty Nonce
nonce Nonce
nonce
      , csTickn :: TicknState
SL.csTickn =
          SL.TicknState
            { ticknStateEpochNonce :: Nonce
SL.ticknStateEpochNonce = Nonce
nonce
            , ticknStatePrevHashNonce :: Nonce
SL.ticknStatePrevHashNonce = Nonce
SL.NeutralNonce
            }
      , -- Overridden before used
        csLabNonce :: Nonce
SL.csLabNonce = Nonce
SL.NeutralNonce
      }
 where
  nonce :: Nonce
nonce = TPraosParams -> Nonce
tpraosInitialNonce TPraosParams
tpraosParams

crossEraForecastByronToShelleyWrapper ::
  forall c.
  RequiringBoth
    WrapLedgerConfig
    (CrossEraForecaster LedgerState WrapLedgerView)
    ByronBlock
    (ShelleyBlock (TPraos c) ShelleyEra)
crossEraForecastByronToShelleyWrapper :: forall c.
RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  ByronBlock
  (ShelleyBlock (TPraos c) ShelleyEra)
crossEraForecastByronToShelleyWrapper =
  (WrapLedgerConfig ByronBlock
 -> WrapLedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
 -> CrossEraForecaster
      LedgerState
      WrapLedgerView
      ByronBlock
      (ShelleyBlock (TPraos c) ShelleyEra))
-> RequiringBoth
     WrapLedgerConfig
     (CrossEraForecaster LedgerState WrapLedgerView)
     ByronBlock
     (ShelleyBlock (TPraos c) ShelleyEra)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
RequireBoth ((WrapLedgerConfig ByronBlock
  -> WrapLedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
  -> CrossEraForecaster
       LedgerState
       WrapLedgerView
       ByronBlock
       (ShelleyBlock (TPraos c) ShelleyEra))
 -> RequiringBoth
      WrapLedgerConfig
      (CrossEraForecaster LedgerState WrapLedgerView)
      ByronBlock
      (ShelleyBlock (TPraos c) ShelleyEra))
-> (WrapLedgerConfig ByronBlock
    -> WrapLedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
    -> CrossEraForecaster
         LedgerState
         WrapLedgerView
         ByronBlock
         (ShelleyBlock (TPraos c) ShelleyEra))
-> RequiringBoth
     WrapLedgerConfig
     (CrossEraForecaster LedgerState WrapLedgerView)
     ByronBlock
     (ShelleyBlock (TPraos c) ShelleyEra)
forall a b. (a -> b) -> a -> b
$ \WrapLedgerConfig ByronBlock
_ (WrapLedgerConfig LedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
cfgShelley) ->
    (Bound
 -> SlotNo
 -> LedgerState ByronBlock EmptyMK
 -> Except
      OutsideForecastRange
      (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra)))
-> CrossEraForecaster
     LedgerState
     WrapLedgerView
     ByronBlock
     (ShelleyBlock (TPraos c) ShelleyEra)
forall (state :: StateKind) (view :: * -> *) x y.
(Bound
 -> SlotNo
 -> state x EmptyMK
 -> Except OutsideForecastRange (view y))
-> CrossEraForecaster state view x y
CrossEraForecaster (ShelleyLedgerConfig ShelleyEra
-> Bound
-> SlotNo
-> LedgerState ByronBlock EmptyMK
-> Except
     OutsideForecastRange
     (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
forall (mk :: MapKind).
ShelleyLedgerConfig ShelleyEra
-> Bound
-> SlotNo
-> LedgerState ByronBlock mk
-> Except
     OutsideForecastRange
     (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
forecast LedgerConfig (ShelleyBlock (TPraos c) ShelleyEra)
ShelleyLedgerConfig ShelleyEra
cfgShelley)
 where
  -- We ignore the Byron ledger view and create a new Shelley.
  --
  -- The full Shelley forecast range (stability window) starts from the first
  -- slot of the Shelley era, no matter how many slots there are between the
  -- Byron ledger and the first Shelley slot. Note that this number of slots
  -- is still guaranteed to be less than the forecast range of the HFC in the
  -- Byron era.
  forecast ::
    ShelleyLedgerConfig ShelleyEra ->
    Bound ->
    SlotNo ->
    LedgerState ByronBlock mk ->
    Except
      OutsideForecastRange
      (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
  forecast :: forall (mk :: MapKind).
ShelleyLedgerConfig ShelleyEra
-> Bound
-> SlotNo
-> LedgerState ByronBlock mk
-> Except
     OutsideForecastRange
     (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
forecast ShelleyLedgerConfig ShelleyEra
cfgShelley Bound
bound SlotNo
forecastFor LedgerState ByronBlock mk
currentByronState
    | SlotNo
forecastFor SlotNo -> SlotNo -> Bool
forall a. Ord a => a -> a -> Bool
< SlotNo
maxFor =
        WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra)
-> Except
     OutsideForecastRange
     (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
forall a. a -> ExceptT OutsideForecastRange Identity a
forall (m :: * -> *) a. Monad m => a -> m a
return (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra)
 -> Except
      OutsideForecastRange
      (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra)))
-> WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra)
-> Except
     OutsideForecastRange
     (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
forall a b. (a -> b) -> a -> b
$
          LedgerView (BlockProtocol (ShelleyBlock (TPraos c) ShelleyEra))
-> WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra)
forall blk. LedgerView (BlockProtocol blk) -> WrapLedgerView blk
WrapLedgerView (LedgerView (BlockProtocol (ShelleyBlock (TPraos c) ShelleyEra))
 -> WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
-> LedgerView (BlockProtocol (ShelleyBlock (TPraos c) ShelleyEra))
-> WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra)
forall a b. (a -> b) -> a -> b
$
            Forecast Current ShelleyEra -> TPraosLedgerView
forall (t :: Timeline) era.
ShelleyEraForecast era =>
Forecast t era -> TPraosLedgerView
SL.forecastToTPraosLedgerView (Forecast Current ShelleyEra -> TPraosLedgerView)
-> Forecast Current ShelleyEra -> TPraosLedgerView
forall a b. (a -> b) -> a -> b
$
              FromByronTranslationContext -> ShelleyForecast Current ShelleyEra
SL.mkInitialShelleyForecast
                (ShelleyGenesis -> FromByronTranslationContext
toFromByronTranslationContext (ShelleyLedgerConfig ShelleyEra -> ShelleyGenesis
forall era. ShelleyLedgerConfig era -> ShelleyGenesis
shelleyLedgerGenesis ShelleyLedgerConfig ShelleyEra
cfgShelley))
    | Bool
otherwise =
        OutsideForecastRange
-> Except
     OutsideForecastRange
     (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
forall a.
OutsideForecastRange -> ExceptT OutsideForecastRange Identity a
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (OutsideForecastRange
 -> Except
      OutsideForecastRange
      (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra)))
-> OutsideForecastRange
-> Except
     OutsideForecastRange
     (WrapLedgerView (ShelleyBlock (TPraos c) ShelleyEra))
forall a b. (a -> b) -> a -> b
$
          OutsideForecastRange
            { outsideForecastAt :: WithOrigin SlotNo
outsideForecastAt = LedgerState ByronBlock mk -> WithOrigin SlotNo
forall blk (mk :: MapKind).
UpdateLedger blk =>
LedgerState blk mk -> WithOrigin SlotNo
ledgerTipSlot LedgerState ByronBlock mk
currentByronState
            , outsideForecastMaxFor :: SlotNo
outsideForecastMaxFor = SlotNo
maxFor
            , outsideForecastFor :: SlotNo
outsideForecastFor = SlotNo
forecastFor
            }
   where
    globals :: Globals
globals = ShelleyLedgerConfig ShelleyEra -> Globals
forall era. ShelleyLedgerConfig era -> Globals
shelleyLedgerGlobals ShelleyLedgerConfig ShelleyEra
cfgShelley
    swindow :: Word64
swindow = Globals -> Word64
SL.stabilityWindow Globals
globals

    -- This is the exclusive upper bound of the forecast range
    --
    -- If Shelley's stability window is 0, it means we can't forecast /at
    -- all/ in the Shelley era. Not even to the first slot in the Shelley
    -- era! Remember that forecasting to slot @S@ means forecasting the
    -- ledger view obtained from the ledger state /after/ applying the block
    -- with slot @S@. If the stability window is 0, we can't even forecast
    -- after the very first "virtual" Shelley block, meaning we can't
    -- forecast into the Shelley era when still in the Byron era.
    maxFor :: SlotNo
    maxFor :: SlotNo
maxFor = Word64 -> SlotNo -> SlotNo
addSlots Word64
swindow (Bound -> SlotNo
boundSlot Bound
bound)

{-------------------------------------------------------------------------------
  Translation from Shelley to Allegra
-------------------------------------------------------------------------------}

translateLedgerStateShelleyToAllegraWrapper ::
  RequiringBoth
    WrapLedgerConfig
    TranslateLedgerState
    (ShelleyBlock (TPraos c) ShelleyEra)
    (ShelleyBlock (TPraos c) AllegraEra)
translateLedgerStateShelleyToAllegraWrapper :: forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
translateLedgerStateShelleyToAllegraWrapper =
  TranslateLedgerState
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (TPraos c) ShelleyEra)
     (ShelleyBlock (TPraos c) AllegraEra)
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (h :: k -> *).
f x y -> RequiringBoth h f x y
ignoringBoth (TranslateLedgerState
   (ShelleyBlock (TPraos c) ShelleyEra)
   (ShelleyBlock (TPraos c) AllegraEra)
 -> RequiringBoth
      WrapLedgerConfig
      TranslateLedgerState
      (ShelleyBlock (TPraos c) ShelleyEra)
      (ShelleyBlock (TPraos c) AllegraEra))
-> TranslateLedgerState
     (ShelleyBlock (TPraos c) ShelleyEra)
     (ShelleyBlock (TPraos c) AllegraEra)
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (TPraos c) ShelleyEra)
     (ShelleyBlock (TPraos c) AllegraEra)
forall a b. (a -> b) -> a -> b
$
    TranslateLedgerState
      { translateLedgerStateWith :: EpochNo
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) DiffMK
translateLedgerStateWith = \EpochNo
_epochNo LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
ls ->
          -- In the Shelley to Allegra transition, the AVVM addresses have
          -- to be deleted, and their balance has to be moved to the
          -- reserves. For this matter, the Ledger keeps track of these
          -- small set of entries since the Byron to Shelley transition and
          -- provides them to us through 'shelleyToAllegraAVVMsToDelete'.
          --
          -- In the long run, the ledger will already use ledger states
          -- parametrized by the map kind and therefore will already provide
          -- the differences in this translation.
          let avvms :: Map TxIn (TxOut ShelleyEra)
avvms =
                UTxO ShelleyEra -> Map TxIn (TxOut ShelleyEra)
forall era. UTxO era -> Map TxIn (TxOut era)
SL.unUTxO (UTxO ShelleyEra -> Map TxIn (TxOut ShelleyEra))
-> UTxO ShelleyEra -> Map TxIn (TxOut ShelleyEra)
forall a b. (a -> b) -> a -> b
$
                  NewEpochState ShelleyEra -> UTxO ShelleyEra
shelleyToAllegraAVVMsToDelete (NewEpochState ShelleyEra -> UTxO ShelleyEra)
-> NewEpochState ShelleyEra -> UTxO ShelleyEra
forall a b. (a -> b) -> a -> b
$
                    LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> NewEpochState ShelleyEra
forall proto era (mk :: MapKind).
LedgerState (ShelleyBlock proto era) mk -> NewEpochState era
shelleyLedgerState LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
ls

              -- While techically we can diff the LedgerTables, it becomes
              -- complex doing so, as we cannot perform operations with
              -- 'LedgerTables l1 mk' and 'LedgerTables l2 mk'. Because of
              -- this, for now we choose to generate the differences out of
              -- thin air as we know that in this era translation these are
              -- the only differences produced.
              --
              -- When adding more tables, this decision might need to be
              -- revisited, as there might be other diffs produced in the
              -- translation.
              avvmsAsDeletions :: LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK
avvmsAsDeletions =
                DiffMK
  (TxIn (ShelleyBlock (TPraos c) AllegraEra))
  (TxOut (ShelleyBlock (TPraos c) AllegraEra))
-> LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK
DiffMK BigEndianTxIn (ShelleyTxOut AllegraEra)
-> LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK
forall blk (mk :: MapKind).
mk (TxIn blk) (TxOut blk) -> LedgerTables blk mk
LedgerTables
                  (DiffMK BigEndianTxIn (ShelleyTxOut AllegraEra)
 -> LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK)
-> (Map TxIn (TxOut ShelleyEra)
    -> DiffMK BigEndianTxIn (ShelleyTxOut AllegraEra))
-> Map TxIn (TxOut ShelleyEra)
-> LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Diff BigEndianTxIn (ShelleyTxOut AllegraEra)
-> DiffMK BigEndianTxIn (ShelleyTxOut AllegraEra)
forall k v. Diff k v -> DiffMK k v
DiffMK
                  (Diff BigEndianTxIn (ShelleyTxOut AllegraEra)
 -> DiffMK BigEndianTxIn (ShelleyTxOut AllegraEra))
-> (Map TxIn (ShelleyTxOut ShelleyEra)
    -> Diff BigEndianTxIn (ShelleyTxOut AllegraEra))
-> Map TxIn (ShelleyTxOut ShelleyEra)
-> DiffMK BigEndianTxIn (ShelleyTxOut AllegraEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map BigEndianTxIn (ShelleyTxOut AllegraEra)
-> Diff BigEndianTxIn (ShelleyTxOut AllegraEra)
forall k v. Map k v -> Diff k v
Diff.fromMapDeletes
                  (Map BigEndianTxIn (ShelleyTxOut AllegraEra)
 -> Diff BigEndianTxIn (ShelleyTxOut AllegraEra))
-> (Map TxIn (ShelleyTxOut ShelleyEra)
    -> Map BigEndianTxIn (ShelleyTxOut AllegraEra))
-> Map TxIn (ShelleyTxOut ShelleyEra)
-> Diff BigEndianTxIn (ShelleyTxOut AllegraEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map TxIn (ShelleyTxOut AllegraEra)
-> Map BigEndianTxIn (ShelleyTxOut AllegraEra)
forall k1 k2 v. Coercible k1 k2 => Map k1 v -> Map k2 v
coerceMapKeys
                  (Map TxIn (ShelleyTxOut AllegraEra)
 -> Map BigEndianTxIn (ShelleyTxOut AllegraEra))
-> (Map TxIn (ShelleyTxOut ShelleyEra)
    -> Map TxIn (ShelleyTxOut AllegraEra))
-> Map TxIn (ShelleyTxOut ShelleyEra)
-> Map BigEndianTxIn (ShelleyTxOut AllegraEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ShelleyTxOut ShelleyEra -> ShelleyTxOut AllegraEra)
-> Map TxIn (ShelleyTxOut ShelleyEra)
-> Map TxIn (ShelleyTxOut AllegraEra)
forall a b k. (a -> b) -> Map k a -> Map k b
Map.map TxOut (PreviousEra AllegraEra) -> TxOut AllegraEra
ShelleyTxOut ShelleyEra -> ShelleyTxOut AllegraEra
forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
SL.upgradeTxOut
                  (Map TxIn (TxOut ShelleyEra)
 -> LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK)
-> Map TxIn (TxOut ShelleyEra)
-> LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK
forall a b. (a -> b) -> a -> b
$ Map TxIn (TxOut ShelleyEra)
avvms

              -- This 'stowLedgerTables' + 'withLedgerTables' injects the
              -- values provided by the Ledger so that the translation
              -- operation finds those entries in the UTxO and destroys
              -- them, modifying the reserves accordingly.
              stowedState :: LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
stowedState =
                LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
forall (l :: LedgerStateKind).
CanStowLedgerTables l =>
l ValuesMK -> l EmptyMK
stowLedgerTables
                  (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
 -> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK)
-> (Map TxIn (TxOut ShelleyEra)
    -> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK)
-> Map TxIn (TxOut ShelleyEra)
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
forall (mk :: MapKind) (any :: MapKind).
(CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) =>
LedgerState (ShelleyBlock (TPraos c) ShelleyEra) any
-> LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) mk
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) mk
forall (l :: StateKind) blk (mk :: MapKind) (any :: MapKind).
(HasLedgerTables l blk, CanMapMK mk, CanMapKeysMK mk,
 ZeroableMK mk) =>
l blk any -> LedgerTables blk mk -> l blk mk
withLedgerTables LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
ls
                  (LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
 -> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK)
-> (Map TxIn (ShelleyTxOut ShelleyEra)
    -> LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK)
-> Map TxIn (ShelleyTxOut ShelleyEra)
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ValuesMK
  (TxIn (ShelleyBlock (TPraos c) ShelleyEra))
  (TxOut (ShelleyBlock (TPraos c) ShelleyEra))
-> LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
ValuesMK BigEndianTxIn (ShelleyTxOut ShelleyEra)
-> LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
forall blk (mk :: MapKind).
mk (TxIn blk) (TxOut blk) -> LedgerTables blk mk
LedgerTables
                  (ValuesMK BigEndianTxIn (ShelleyTxOut ShelleyEra)
 -> LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK)
-> (Map TxIn (ShelleyTxOut ShelleyEra)
    -> ValuesMK BigEndianTxIn (ShelleyTxOut ShelleyEra))
-> Map TxIn (ShelleyTxOut ShelleyEra)
-> LedgerTables (ShelleyBlock (TPraos c) ShelleyEra) ValuesMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map BigEndianTxIn (ShelleyTxOut ShelleyEra)
-> ValuesMK BigEndianTxIn (ShelleyTxOut ShelleyEra)
forall k v. Map k v -> ValuesMK k v
ValuesMK
                  (Map BigEndianTxIn (ShelleyTxOut ShelleyEra)
 -> ValuesMK BigEndianTxIn (ShelleyTxOut ShelleyEra))
-> (Map TxIn (ShelleyTxOut ShelleyEra)
    -> Map BigEndianTxIn (ShelleyTxOut ShelleyEra))
-> Map TxIn (ShelleyTxOut ShelleyEra)
-> ValuesMK BigEndianTxIn (ShelleyTxOut ShelleyEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map TxIn (ShelleyTxOut ShelleyEra)
-> Map BigEndianTxIn (ShelleyTxOut ShelleyEra)
forall k1 k2 v. Coercible k1 k2 => Map k1 v -> Map k2 v
coerceMapKeys
                  (Map TxIn (TxOut ShelleyEra)
 -> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK)
-> Map TxIn (TxOut ShelleyEra)
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
forall a b. (a -> b) -> a -> b
$ Map TxIn (TxOut ShelleyEra)
avvms

              resultingState :: LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
resultingState =
                Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra)
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip
                  (Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra)
 -> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK)
-> (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra))
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:)
  (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
                  ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra
 -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra))
-> (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra)
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext AllegraEra
-> (:.:)
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos c))
     (PreviousEra AllegraEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra
forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
SL.translateEra' TranslationContext AllegraEra
NoGenesis AllegraEra
forall era. NoGenesis era
SL.NoGenesis
                  ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) ShelleyEra
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra)
-> (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) ShelleyEra)
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) ShelleyEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) ShelleyEra
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp
                  (Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) ShelleyEra)
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) ShelleyEra)
-> (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) ShelleyEra))
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) ShelleyEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) ShelleyEra)
forall x y (f :: x -> y -> *) (x1 :: y) (y1 :: x).
f y1 x1 -> Flip f x1 y1
Flip
                  (LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
 -> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK)
-> LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
forall a b. (a -> b) -> a -> b
$ LedgerState (ShelleyBlock (TPraos c) ShelleyEra) EmptyMK
stowedState
           in LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
resultingState LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
-> LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) DiffMK
forall (mk :: MapKind) (any :: MapKind).
(CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) =>
LedgerState (ShelleyBlock (TPraos c) AllegraEra) any
-> LedgerTables (ShelleyBlock (TPraos c) AllegraEra) mk
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) mk
forall (l :: StateKind) blk (mk :: MapKind) (any :: MapKind).
(HasLedgerTables l blk, CanMapMK mk, CanMapKeysMK mk,
 ZeroableMK mk) =>
l blk any -> LedgerTables blk mk -> l blk mk
`withLedgerTables` LedgerTables (ShelleyBlock (TPraos c) AllegraEra) DiffMK
avvmsAsDeletions
      }

translateLedgerTablesShelleyToAllegraWrapper ::
  TranslateLedgerTables
    (ShelleyBlock (TPraos c) ShelleyEra)
    (ShelleyBlock (TPraos c) AllegraEra)
translateLedgerTablesShelleyToAllegraWrapper :: forall c.
TranslateLedgerTables
  (ShelleyBlock (TPraos c) ShelleyEra)
  (ShelleyBlock (TPraos c) AllegraEra)
translateLedgerTablesShelleyToAllegraWrapper =
  TranslateLedgerTables
    { translateTxInWith :: TxIn (ShelleyBlock (TPraos c) ShelleyEra)
-> TxIn (ShelleyBlock (TPraos c) AllegraEra)
translateTxInWith = TxIn (ShelleyBlock (TPraos c) ShelleyEra)
-> TxIn (ShelleyBlock (TPraos c) AllegraEra)
BigEndianTxIn -> BigEndianTxIn
forall a b. Coercible a b => a -> b
coerce
    , translateTxOutWith :: TxOut (ShelleyBlock (TPraos c) ShelleyEra)
-> TxOut (ShelleyBlock (TPraos c) AllegraEra)
translateTxOutWith = TxOut (PreviousEra AllegraEra) -> TxOut AllegraEra
TxOut (ShelleyBlock (TPraos c) ShelleyEra)
-> TxOut (ShelleyBlock (TPraos c) AllegraEra)
forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
SL.upgradeTxOut
    }

{-------------------------------------------------------------------------------
  Translation from Allegra to Mary
-------------------------------------------------------------------------------}

translateLedgerStateAllegraToMaryWrapper ::
  RequiringBoth
    WrapLedgerConfig
    TranslateLedgerState
    (ShelleyBlock (TPraos c) AllegraEra)
    (ShelleyBlock (TPraos c) MaryEra)
translateLedgerStateAllegraToMaryWrapper :: forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
translateLedgerStateAllegraToMaryWrapper =
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (TPraos c) AllegraEra)
     (ShelleyBlock (TPraos c) MaryEra)
forall {k} (f :: k -> k -> *) (x :: k) (y :: k) (h :: k -> *).
f x y -> RequiringBoth h f x y
ignoringBoth (TranslateLedgerState
   (ShelleyBlock (TPraos c) AllegraEra)
   (ShelleyBlock (TPraos c) MaryEra)
 -> RequiringBoth
      WrapLedgerConfig
      TranslateLedgerState
      (ShelleyBlock (TPraos c) AllegraEra)
      (ShelleyBlock (TPraos c) MaryEra))
-> TranslateLedgerState
     (ShelleyBlock (TPraos c) AllegraEra)
     (ShelleyBlock (TPraos c) MaryEra)
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (TPraos c) AllegraEra)
     (ShelleyBlock (TPraos c) MaryEra)
forall a b. (a -> b) -> a -> b
$
    TranslateLedgerState
      { translateLedgerStateWith :: EpochNo
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) DiffMK
translateLedgerStateWith = \EpochNo
_epochNo ->
          LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) DiffMK
forall (l :: StateKind) blk (any :: MapKind).
HasLedgerTables l blk =>
l blk any -> l blk DiffMK
noNewTickingDiffs
            (LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
 -> LedgerState (ShelleyBlock (TPraos c) MaryEra) DiffMK)
-> (LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
    -> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK)
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) DiffMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra)
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip
            (Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra)
 -> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK)
-> (LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra))
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
            ((:.:) (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra
 -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra))
-> (LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra)
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext MaryEra
-> (:.:)
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos c))
     (PreviousEra MaryEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra
forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
SL.translateEra' TranslationContext MaryEra
NoGenesis MaryEra
forall era. NoGenesis era
SL.NoGenesis
            ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra)
-> (LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra)
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp
            (Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra)
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra)
-> (LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra))
-> LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AllegraEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (TPraos c) AllegraEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AllegraEra)
forall x y (f :: x -> y -> *) (x1 :: y) (y1 :: x).
f y1 x1 -> Flip f x1 y1
Flip
      }

translateLedgerTablesAllegraToMaryWrapper ::
  TranslateLedgerTables
    (ShelleyBlock (TPraos c) AllegraEra)
    (ShelleyBlock (TPraos c) MaryEra)
translateLedgerTablesAllegraToMaryWrapper :: forall c.
TranslateLedgerTables
  (ShelleyBlock (TPraos c) AllegraEra)
  (ShelleyBlock (TPraos c) MaryEra)
translateLedgerTablesAllegraToMaryWrapper =
  TranslateLedgerTables
    { translateTxInWith :: TxIn (ShelleyBlock (TPraos c) AllegraEra)
-> TxIn (ShelleyBlock (TPraos c) MaryEra)
translateTxInWith = TxIn (ShelleyBlock (TPraos c) AllegraEra)
-> TxIn (ShelleyBlock (TPraos c) MaryEra)
BigEndianTxIn -> BigEndianTxIn
forall a b. Coercible a b => a -> b
coerce
    , translateTxOutWith :: TxOut (ShelleyBlock (TPraos c) AllegraEra)
-> TxOut (ShelleyBlock (TPraos c) MaryEra)
translateTxOutWith = TxOut (PreviousEra MaryEra) -> TxOut MaryEra
TxOut (ShelleyBlock (TPraos c) AllegraEra)
-> TxOut (ShelleyBlock (TPraos c) MaryEra)
forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
SL.upgradeTxOut
    }

{-------------------------------------------------------------------------------
  Translation from Mary to Alonzo
-------------------------------------------------------------------------------}

translateLedgerStateMaryToAlonzoWrapper ::
  RequiringBoth
    WrapLedgerConfig
    TranslateLedgerState
    (ShelleyBlock (TPraos c) MaryEra)
    (ShelleyBlock (TPraos c) AlonzoEra)
translateLedgerStateMaryToAlonzoWrapper :: forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
translateLedgerStateMaryToAlonzoWrapper =
  (WrapLedgerConfig (ShelleyBlock (TPraos c) MaryEra)
 -> WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
 -> TranslateLedgerState
      (ShelleyBlock (TPraos c) MaryEra)
      (ShelleyBlock (TPraos c) AlonzoEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (TPraos c) MaryEra)
     (ShelleyBlock (TPraos c) AlonzoEra)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
RequireBoth ((WrapLedgerConfig (ShelleyBlock (TPraos c) MaryEra)
  -> WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
  -> TranslateLedgerState
       (ShelleyBlock (TPraos c) MaryEra)
       (ShelleyBlock (TPraos c) AlonzoEra))
 -> RequiringBoth
      WrapLedgerConfig
      TranslateLedgerState
      (ShelleyBlock (TPraos c) MaryEra)
      (ShelleyBlock (TPraos c) AlonzoEra))
-> (WrapLedgerConfig (ShelleyBlock (TPraos c) MaryEra)
    -> WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
    -> TranslateLedgerState
         (ShelleyBlock (TPraos c) MaryEra)
         (ShelleyBlock (TPraos c) AlonzoEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (TPraos c) MaryEra)
     (ShelleyBlock (TPraos c) AlonzoEra)
forall a b. (a -> b) -> a -> b
$ \WrapLedgerConfig (ShelleyBlock (TPraos c) MaryEra)
_cfgMary WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
cfgAlonzo ->
    TranslateLedgerState
      { translateLedgerStateWith :: EpochNo
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) DiffMK
translateLedgerStateWith = \EpochNo
_epochNo ->
          LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) DiffMK
forall (l :: StateKind) blk (any :: MapKind).
HasLedgerTables l blk =>
l blk any -> l blk DiffMK
noNewTickingDiffs
            (LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
 -> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) DiffMK)
-> (LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
    -> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK)
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) DiffMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AlonzoEra)
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip
            (Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AlonzoEra)
 -> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK)
-> (LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AlonzoEra))
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:)
  (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AlonzoEra
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AlonzoEra)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
            ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AlonzoEra
 -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AlonzoEra))
-> (LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AlonzoEra)
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) AlonzoEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext AlonzoEra
-> (:.:)
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos c))
     (PreviousEra AlonzoEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AlonzoEra
forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
SL.translateEra' (WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
-> TranslationContext AlonzoEra
forall c.
WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
-> TranslationContext AlonzoEra
getAlonzoTranslationContext WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
cfgAlonzo)
            ((:.:) (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AlonzoEra)
-> (LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra)
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) AlonzoEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp
            (Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra)
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra)
-> (LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra))
-> LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (TPraos c)) MaryEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (TPraos c) MaryEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (TPraos c) MaryEra)
forall x y (f :: x -> y -> *) (x1 :: y) (y1 :: x).
f y1 x1 -> Flip f x1 y1
Flip
      }

translateLedgerTablesMaryToAlonzoWrapper ::
  TranslateLedgerTables
    (ShelleyBlock (TPraos c) MaryEra)
    (ShelleyBlock (TPraos c) AlonzoEra)
translateLedgerTablesMaryToAlonzoWrapper :: forall c.
TranslateLedgerTables
  (ShelleyBlock (TPraos c) MaryEra)
  (ShelleyBlock (TPraos c) AlonzoEra)
translateLedgerTablesMaryToAlonzoWrapper =
  TranslateLedgerTables
    { translateTxInWith :: TxIn (ShelleyBlock (TPraos c) MaryEra)
-> TxIn (ShelleyBlock (TPraos c) AlonzoEra)
translateTxInWith = TxIn (ShelleyBlock (TPraos c) MaryEra)
-> TxIn (ShelleyBlock (TPraos c) AlonzoEra)
BigEndianTxIn -> BigEndianTxIn
forall a b. Coercible a b => a -> b
coerce
    , translateTxOutWith :: TxOut (ShelleyBlock (TPraos c) MaryEra)
-> TxOut (ShelleyBlock (TPraos c) AlonzoEra)
translateTxOutWith = TxOut (PreviousEra AlonzoEra) -> TxOut AlonzoEra
TxOut (ShelleyBlock (TPraos c) MaryEra)
-> TxOut (ShelleyBlock (TPraos c) AlonzoEra)
forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
SL.upgradeTxOut
    }

getAlonzoTranslationContext ::
  WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra) ->
  SL.TranslationContext AlonzoEra
getAlonzoTranslationContext :: forall c.
WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
-> TranslationContext AlonzoEra
getAlonzoTranslationContext =
  ShelleyLedgerConfig AlonzoEra -> TranslationContext AlonzoEra
ShelleyLedgerConfig AlonzoEra -> AlonzoGenesis
forall era. ShelleyLedgerConfig era -> TranslationContext era
shelleyLedgerTranslationContext (ShelleyLedgerConfig AlonzoEra -> AlonzoGenesis)
-> (WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
    -> ShelleyLedgerConfig AlonzoEra)
-> WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
-> AlonzoGenesis
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
-> LedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
-> ShelleyLedgerConfig AlonzoEra
forall blk. WrapLedgerConfig blk -> LedgerConfig blk
unwrapLedgerConfig

{-------------------------------------------------------------------------------
  Translation from Alonzo to Babbage
-------------------------------------------------------------------------------}

translateLedgerStateAlonzoToBabbageWrapper ::
  RequiringBoth
    WrapLedgerConfig
    TranslateLedgerState
    (ShelleyBlock (TPraos c) AlonzoEra)
    (ShelleyBlock (Praos c) BabbageEra)
translateLedgerStateAlonzoToBabbageWrapper :: forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
translateLedgerStateAlonzoToBabbageWrapper =
  (WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
 -> WrapLedgerConfig (ShelleyBlock (Praos c) BabbageEra)
 -> TranslateLedgerState
      (ShelleyBlock (TPraos c) AlonzoEra)
      (ShelleyBlock (Praos c) BabbageEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (TPraos c) AlonzoEra)
     (ShelleyBlock (Praos c) BabbageEra)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
RequireBoth ((WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
  -> WrapLedgerConfig (ShelleyBlock (Praos c) BabbageEra)
  -> TranslateLedgerState
       (ShelleyBlock (TPraos c) AlonzoEra)
       (ShelleyBlock (Praos c) BabbageEra))
 -> RequiringBoth
      WrapLedgerConfig
      TranslateLedgerState
      (ShelleyBlock (TPraos c) AlonzoEra)
      (ShelleyBlock (Praos c) BabbageEra))
-> (WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
    -> WrapLedgerConfig (ShelleyBlock (Praos c) BabbageEra)
    -> TranslateLedgerState
         (ShelleyBlock (TPraos c) AlonzoEra)
         (ShelleyBlock (Praos c) BabbageEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (TPraos c) AlonzoEra)
     (ShelleyBlock (Praos c) BabbageEra)
forall a b. (a -> b) -> a -> b
$ \WrapLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra)
_cfgAlonzo WrapLedgerConfig (ShelleyBlock (Praos c) BabbageEra)
_cfgBabbage ->
    TranslateLedgerState
      { translateLedgerStateWith :: EpochNo
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) DiffMK
translateLedgerStateWith = \EpochNo
_epochNo ->
          LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) DiffMK
forall (l :: StateKind) blk (any :: MapKind).
HasLedgerTables l blk =>
l blk any -> l blk DiffMK
noNewTickingDiffs
            (LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
 -> LedgerState (ShelleyBlock (Praos c) BabbageEra) DiffMK)
-> (LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
    -> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK)
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) DiffMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra)
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip
            (Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra)
 -> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK)
-> (LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra))
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:)
  (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
            ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra
 -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra))
-> (LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra)
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext BabbageEra
-> (:.:)
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (Praos c))
     (PreviousEra BabbageEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra
forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
SL.translateEra' TranslationContext BabbageEra
NoGenesis BabbageEra
forall era. NoGenesis era
SL.NoGenesis
            ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) AlonzoEra
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra)
-> (LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) AlonzoEra)
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (Praos c) AlonzoEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) AlonzoEra
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp
            (Flip LedgerState EmptyMK (ShelleyBlock (Praos c) AlonzoEra)
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) AlonzoEra)
-> (LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) AlonzoEra))
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) AlonzoEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (Praos c) AlonzoEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) AlonzoEra)
forall x y (f :: x -> y -> *) (x1 :: y) (y1 :: x).
f y1 x1 -> Flip f x1 y1
Flip
            (LedgerState (ShelleyBlock (Praos c) AlonzoEra) EmptyMK
 -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) AlonzoEra))
-> (LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
    -> LedgerState (ShelleyBlock (Praos c) AlonzoEra) EmptyMK)
-> LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) AlonzoEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (TPraos c) AlonzoEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) AlonzoEra) EmptyMK
forall c (mk :: MapKind).
LedgerState (ShelleyBlock (TPraos c) AlonzoEra) mk
-> LedgerState (ShelleyBlock (Praos c) AlonzoEra) mk
transPraosLS
      }
 where
  transPraosLS ::
    LedgerState (ShelleyBlock (TPraos c) AlonzoEra) mk ->
    LedgerState (ShelleyBlock (Praos c) AlonzoEra) mk
  transPraosLS :: forall c (mk :: MapKind).
LedgerState (ShelleyBlock (TPraos c) AlonzoEra) mk
-> LedgerState (ShelleyBlock (Praos c) AlonzoEra) mk
transPraosLS (ShelleyLedgerState WithOrigin (ShelleyTip (TPraos c) AlonzoEra)
wo NewEpochState AlonzoEra
nes ShelleyTransition
st LedgerTables (ShelleyBlock (TPraos c) AlonzoEra) mk
tb) =
    ShelleyLedgerState
      { shelleyLedgerTip :: WithOrigin (ShelleyTip (Praos c) AlonzoEra)
shelleyLedgerTip = (ShelleyTip (TPraos c) AlonzoEra -> ShelleyTip (Praos c) AlonzoEra)
-> WithOrigin (ShelleyTip (TPraos c) AlonzoEra)
-> WithOrigin (ShelleyTip (Praos c) AlonzoEra)
forall a b. (a -> b) -> WithOrigin a -> WithOrigin b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ShelleyTip (TPraos c) AlonzoEra -> ShelleyTip (Praos c) AlonzoEra
forall proto era proto' era'.
ShelleyTip proto era -> ShelleyTip proto' era'
castShelleyTip WithOrigin (ShelleyTip (TPraos c) AlonzoEra)
wo
      , shelleyLedgerState :: NewEpochState AlonzoEra
shelleyLedgerState = NewEpochState AlonzoEra
nes
      , shelleyLedgerTransition :: ShelleyTransition
shelleyLedgerTransition = ShelleyTransition
st
      , shelleyLedgerTables :: LedgerTables (ShelleyBlock (Praos c) AlonzoEra) mk
shelleyLedgerTables = LedgerTables (ShelleyBlock (TPraos c) AlonzoEra) mk
-> LedgerTables (ShelleyBlock (Praos c) AlonzoEra) mk
forall a b. Coercible a b => a -> b
coerce LedgerTables (ShelleyBlock (TPraos c) AlonzoEra) mk
tb
      }

translateLedgerTablesAlonzoToBabbageWrapper ::
  TranslateLedgerTables
    (ShelleyBlock (TPraos c) AlonzoEra)
    (ShelleyBlock (Praos c) BabbageEra)
translateLedgerTablesAlonzoToBabbageWrapper :: forall c.
TranslateLedgerTables
  (ShelleyBlock (TPraos c) AlonzoEra)
  (ShelleyBlock (Praos c) BabbageEra)
translateLedgerTablesAlonzoToBabbageWrapper =
  TranslateLedgerTables
    { translateTxInWith :: TxIn (ShelleyBlock (TPraos c) AlonzoEra)
-> TxIn (ShelleyBlock (Praos c) BabbageEra)
translateTxInWith = TxIn (ShelleyBlock (TPraos c) AlonzoEra)
-> TxIn (ShelleyBlock (Praos c) BabbageEra)
BigEndianTxIn -> BigEndianTxIn
forall a b. Coercible a b => a -> b
coerce
    , translateTxOutWith :: TxOut (ShelleyBlock (TPraos c) AlonzoEra)
-> TxOut (ShelleyBlock (Praos c) BabbageEra)
translateTxOutWith = TxOut (PreviousEra BabbageEra) -> TxOut BabbageEra
TxOut (ShelleyBlock (TPraos c) AlonzoEra)
-> TxOut (ShelleyBlock (Praos c) BabbageEra)
forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
SL.upgradeTxOut
    }

{-------------------------------------------------------------------------------
  Translation from Babbage to Conway
-------------------------------------------------------------------------------}

translateLedgerStateBabbageToConwayWrapper ::
  RequiringBoth
    WrapLedgerConfig
    TranslateLedgerState
    (ShelleyBlock (Praos c) BabbageEra)
    (ShelleyBlock (Praos c) ConwayEra)
translateLedgerStateBabbageToConwayWrapper :: forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
translateLedgerStateBabbageToConwayWrapper =
  (WrapLedgerConfig (ShelleyBlock (Praos c) BabbageEra)
 -> WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
 -> TranslateLedgerState
      (ShelleyBlock (Praos c) BabbageEra)
      (ShelleyBlock (Praos c) ConwayEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (Praos c) BabbageEra)
     (ShelleyBlock (Praos c) ConwayEra)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
RequireBoth ((WrapLedgerConfig (ShelleyBlock (Praos c) BabbageEra)
  -> WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
  -> TranslateLedgerState
       (ShelleyBlock (Praos c) BabbageEra)
       (ShelleyBlock (Praos c) ConwayEra))
 -> RequiringBoth
      WrapLedgerConfig
      TranslateLedgerState
      (ShelleyBlock (Praos c) BabbageEra)
      (ShelleyBlock (Praos c) ConwayEra))
-> (WrapLedgerConfig (ShelleyBlock (Praos c) BabbageEra)
    -> WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
    -> TranslateLedgerState
         (ShelleyBlock (Praos c) BabbageEra)
         (ShelleyBlock (Praos c) ConwayEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (Praos c) BabbageEra)
     (ShelleyBlock (Praos c) ConwayEra)
forall a b. (a -> b) -> a -> b
$ \WrapLedgerConfig (ShelleyBlock (Praos c) BabbageEra)
_cfgBabbage WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
cfgConway ->
    TranslateLedgerState
      { translateLedgerStateWith :: EpochNo
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) DiffMK
translateLedgerStateWith = \EpochNo
_epochNo ->
          LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) DiffMK
forall (l :: StateKind) blk (any :: MapKind).
HasLedgerTables l blk =>
l blk any -> l blk DiffMK
noNewTickingDiffs
            (LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
 -> LedgerState (ShelleyBlock (Praos c) ConwayEra) DiffMK)
-> (LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
    -> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK)
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) DiffMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra)
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip
            (Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra)
 -> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK)
-> (LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra))
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
            ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra
 -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra))
-> (LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra)
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext ConwayEra
-> (:.:)
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (Praos c))
     (PreviousEra ConwayEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra
forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
SL.translateEra' (WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
-> TranslationContext ConwayEra
forall c.
WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
-> TranslationContext ConwayEra
getConwayTranslationContext WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
cfgConway)
            ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra)
-> (LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra)
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp
            (Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra)
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra)
-> (LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra))
-> LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) BabbageEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (Praos c) BabbageEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) BabbageEra)
forall x y (f :: x -> y -> *) (x1 :: y) (y1 :: x).
f y1 x1 -> Flip f x1 y1
Flip
      }

translateLedgerTablesBabbageToConwayWrapper ::
  TranslateLedgerTables
    (ShelleyBlock (Praos c) BabbageEra)
    (ShelleyBlock (Praos c) ConwayEra)
translateLedgerTablesBabbageToConwayWrapper :: forall c.
TranslateLedgerTables
  (ShelleyBlock (Praos c) BabbageEra)
  (ShelleyBlock (Praos c) ConwayEra)
translateLedgerTablesBabbageToConwayWrapper =
  TranslateLedgerTables
    { translateTxInWith :: TxIn (ShelleyBlock (Praos c) BabbageEra)
-> TxIn (ShelleyBlock (Praos c) ConwayEra)
translateTxInWith = TxIn (ShelleyBlock (Praos c) BabbageEra)
-> TxIn (ShelleyBlock (Praos c) ConwayEra)
BigEndianTxIn -> BigEndianTxIn
forall a b. Coercible a b => a -> b
coerce
    , translateTxOutWith :: TxOut (ShelleyBlock (Praos c) BabbageEra)
-> TxOut (ShelleyBlock (Praos c) ConwayEra)
translateTxOutWith = TxOut (PreviousEra ConwayEra) -> TxOut ConwayEra
TxOut (ShelleyBlock (Praos c) BabbageEra)
-> TxOut (ShelleyBlock (Praos c) ConwayEra)
forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
SL.upgradeTxOut
    }

getConwayTranslationContext ::
  WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra) ->
  SL.TranslationContext ConwayEra
getConwayTranslationContext :: forall c.
WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
-> TranslationContext ConwayEra
getConwayTranslationContext =
  ShelleyLedgerConfig ConwayEra -> TranslationContext ConwayEra
ShelleyLedgerConfig ConwayEra -> ConwayGenesis
forall era. ShelleyLedgerConfig era -> TranslationContext era
shelleyLedgerTranslationContext (ShelleyLedgerConfig ConwayEra -> ConwayGenesis)
-> (WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
    -> ShelleyLedgerConfig ConwayEra)
-> WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
-> ConwayGenesis
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
-> LedgerConfig (ShelleyBlock (Praos c) ConwayEra)
WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
-> ShelleyLedgerConfig ConwayEra
forall blk. WrapLedgerConfig blk -> LedgerConfig blk
unwrapLedgerConfig

{-------------------------------------------------------------------------------
  Translation from Conway to Dijkstra
-------------------------------------------------------------------------------}

translateLedgerStateConwayToDijkstraWrapper ::
  RequiringBoth
    WrapLedgerConfig
    TranslateLedgerState
    (ShelleyBlock (Praos c) ConwayEra)
    (ShelleyBlock (Praos c) DijkstraEra)
translateLedgerStateConwayToDijkstraWrapper :: forall c.
RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
translateLedgerStateConwayToDijkstraWrapper =
  (WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
 -> WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
 -> TranslateLedgerState
      (ShelleyBlock (Praos c) ConwayEra)
      (ShelleyBlock (Praos c) DijkstraEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (Praos c) ConwayEra)
     (ShelleyBlock (Praos c) DijkstraEra)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
RequireBoth ((WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
  -> WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
  -> TranslateLedgerState
       (ShelleyBlock (Praos c) ConwayEra)
       (ShelleyBlock (Praos c) DijkstraEra))
 -> RequiringBoth
      WrapLedgerConfig
      TranslateLedgerState
      (ShelleyBlock (Praos c) ConwayEra)
      (ShelleyBlock (Praos c) DijkstraEra))
-> (WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
    -> WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
    -> TranslateLedgerState
         (ShelleyBlock (Praos c) ConwayEra)
         (ShelleyBlock (Praos c) DijkstraEra))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock (Praos c) ConwayEra)
     (ShelleyBlock (Praos c) DijkstraEra)
forall a b. (a -> b) -> a -> b
$ \WrapLedgerConfig (ShelleyBlock (Praos c) ConwayEra)
_cfgConway WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
cfgDijkstra ->
    TranslateLedgerState
      { translateLedgerStateWith :: EpochNo
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) DijkstraEra) DiffMK
translateLedgerStateWith = \EpochNo
_epochNo ->
          LedgerState (ShelleyBlock (Praos c) DijkstraEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) DijkstraEra) DiffMK
forall (l :: StateKind) blk (any :: MapKind).
HasLedgerTables l blk =>
l blk any -> l blk DiffMK
noNewTickingDiffs
            (LedgerState (ShelleyBlock (Praos c) DijkstraEra) EmptyMK
 -> LedgerState (ShelleyBlock (Praos c) DijkstraEra) DiffMK)
-> (LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
    -> LedgerState (ShelleyBlock (Praos c) DijkstraEra) EmptyMK)
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) DijkstraEra) DiffMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (Praos c) DijkstraEra)
-> LedgerState (ShelleyBlock (Praos c) DijkstraEra) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip
            (Flip LedgerState EmptyMK (ShelleyBlock (Praos c) DijkstraEra)
 -> LedgerState (ShelleyBlock (Praos c) DijkstraEra) EmptyMK)
-> (LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) DijkstraEra))
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
-> LedgerState (ShelleyBlock (Praos c) DijkstraEra) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:)
  (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) DijkstraEra
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) DijkstraEra)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
            ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) DijkstraEra
 -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) DijkstraEra))
-> (LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) DijkstraEra)
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) DijkstraEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext DijkstraEra
-> (:.:)
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (Praos c))
     (PreviousEra DijkstraEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) DijkstraEra
forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
SL.translateEra' (WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
-> TranslationContext DijkstraEra
forall c.
WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
-> TranslationContext DijkstraEra
getDijkstraTranslationContext WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
cfgDijkstra)
            ((:.:)
   (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) DijkstraEra)
-> (LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
    -> (:.:)
         (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra)
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) DijkstraEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra)
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp
            (Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra)
 -> (:.:)
      (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra)
-> (LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra))
-> LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock (Praos c)) ConwayEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock (Praos c) ConwayEra) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock (Praos c) ConwayEra)
forall x y (f :: x -> y -> *) (x1 :: y) (y1 :: x).
f y1 x1 -> Flip f x1 y1
Flip
      }

translateLedgerTablesConwayToDijkstraWrapper ::
  TranslateLedgerTables
    (ShelleyBlock (Praos c) ConwayEra)
    (ShelleyBlock (Praos c) DijkstraEra)
translateLedgerTablesConwayToDijkstraWrapper :: forall c.
TranslateLedgerTables
  (ShelleyBlock (Praos c) ConwayEra)
  (ShelleyBlock (Praos c) DijkstraEra)
translateLedgerTablesConwayToDijkstraWrapper =
  TranslateLedgerTables
    { translateTxInWith :: TxIn (ShelleyBlock (Praos c) ConwayEra)
-> TxIn (ShelleyBlock (Praos c) DijkstraEra)
translateTxInWith = TxIn (ShelleyBlock (Praos c) ConwayEra)
-> TxIn (ShelleyBlock (Praos c) DijkstraEra)
BigEndianTxIn -> BigEndianTxIn
forall a b. Coercible a b => a -> b
coerce
    , translateTxOutWith :: TxOut (ShelleyBlock (Praos c) ConwayEra)
-> TxOut (ShelleyBlock (Praos c) DijkstraEra)
translateTxOutWith = TxOut (PreviousEra DijkstraEra) -> TxOut DijkstraEra
TxOut (ShelleyBlock (Praos c) ConwayEra)
-> TxOut (ShelleyBlock (Praos c) DijkstraEra)
forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
SL.upgradeTxOut
    }

getDijkstraTranslationContext ::
  WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra) ->
  SL.TranslationContext DijkstraEra
getDijkstraTranslationContext :: forall c.
WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
-> TranslationContext DijkstraEra
getDijkstraTranslationContext =
  ShelleyLedgerConfig DijkstraEra -> TranslationContext DijkstraEra
ShelleyLedgerConfig DijkstraEra -> DijkstraGenesis
forall era. ShelleyLedgerConfig era -> TranslationContext era
shelleyLedgerTranslationContext (ShelleyLedgerConfig DijkstraEra -> DijkstraGenesis)
-> (WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
    -> ShelleyLedgerConfig DijkstraEra)
-> WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
-> DijkstraGenesis
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
-> LedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
WrapLedgerConfig (ShelleyBlock (Praos c) DijkstraEra)
-> ShelleyLedgerConfig DijkstraEra
forall blk. WrapLedgerConfig blk -> LedgerConfig blk
unwrapLedgerConfig