{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}

{-# OPTIONS_GHC -Wno-orphans #-}

-- | Test infrastructure to test hard-forking from one Shelley-based era to
-- another, e.g., Shelley to Allegra.
module Test.ThreadNet.Infra.ShelleyBasedHardFork (
    -- * Blocks
    ShelleyBasedHardForkBlock
  , ShelleyBasedHardForkEras
    -- * Transactions
  , pattern GenTxShelley1
  , pattern GenTxShelley2
    -- * Node
  , ShelleyBasedHardForkConstraints
  , protocolInfoShelleyBasedHardFork
  ) where

import qualified Cardano.Ledger.Api.Transition as L
import           Cardano.Ledger.Binary.Decoding (decShareCBOR, decodeMap,
                     decodeMemPack, internsFromMap)
import           Cardano.Ledger.Binary.Encoding (encodeMap, encodeMemPack,
                     toPlainEncoding)
import qualified Cardano.Ledger.Core as SL
import qualified Cardano.Ledger.Shelley.API as SL
import qualified Cardano.Ledger.Shelley.LedgerState as SL
import qualified Cardano.Ledger.UMap as SL
import           Codec.CBOR.Decoding
import           Codec.CBOR.Encoding
import           Control.Monad.Except (runExcept)
import           Data.Coerce
import qualified Data.Map.Strict as Map
import           Data.MemPack
import           Data.Proxy
import           Data.SOP.BasicFunctors
import           Data.SOP.Functors (Flip (..))
import           Data.SOP.Index (Index (..), hcimap)
import qualified Data.SOP.InPairs as InPairs
import           Data.SOP.Strict
import qualified Data.SOP.Tails as Tails
import qualified Data.SOP.Telescope as Telescope
import           Data.Void (Void)
import           Lens.Micro ((^.))
import           NoThunks.Class (NoThunks)
import           Ouroboros.Consensus.Block.Abstract (BlockProtocol)
import           Ouroboros.Consensus.Block.Forging (BlockForging)
import           Ouroboros.Consensus.Cardano.CanHardFork
                     (crossEraForecastAcrossShelley,
                     translateChainDepStateAcrossShelley)
import           Ouroboros.Consensus.Cardano.Node (TriggerHardFork (..))
import           Ouroboros.Consensus.HardFork.Combinator
import           Ouroboros.Consensus.HardFork.Combinator.Embed.Binary
import           Ouroboros.Consensus.HardFork.Combinator.Serialisation
import           Ouroboros.Consensus.HardFork.Combinator.State.Types as HFC
import qualified Ouroboros.Consensus.HardFork.History as History
import           Ouroboros.Consensus.Ledger.Abstract
import           Ouroboros.Consensus.Ledger.Extended
import           Ouroboros.Consensus.Ledger.SupportsMempool
import           Ouroboros.Consensus.Ledger.SupportsProtocol
                     (LedgerSupportsProtocol)
import           Ouroboros.Consensus.Ledger.Tables.Utils
import           Ouroboros.Consensus.Node
import           Ouroboros.Consensus.Node.NetworkProtocolVersion
import           Ouroboros.Consensus.Protocol.TPraos
import           Ouroboros.Consensus.Shelley.Eras
import           Ouroboros.Consensus.Shelley.Ledger
import           Ouroboros.Consensus.Shelley.Node
import           Ouroboros.Consensus.Shelley.Protocol.Abstract (ProtoCrypto)
import           Ouroboros.Consensus.Storage.LedgerDB
import           Ouroboros.Consensus.TypeFamilyWrappers
import           Ouroboros.Consensus.Util (eitherToMaybe)
import           Ouroboros.Consensus.Util.IndexedMemPack
import           Ouroboros.Consensus.Util.IOLike (IOLike)
import           Test.ThreadNet.TxGen
import           Test.ThreadNet.TxGen.Shelley ()

{-------------------------------------------------------------------------------
  Block type
-------------------------------------------------------------------------------}

-- | Two eras, both Shelley-based.
type ShelleyBasedHardForkEras proto1 era1 proto2 era2 =
    '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]

type ShelleyBasedHardForkBlock proto1 era1 proto2 era2 =
  HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)

{-------------------------------------------------------------------------------
  Pattern synonyms, for encapsulation and legibility
-------------------------------------------------------------------------------}

type ShelleyBasedHardForkGenTx proto1 era1 proto2 era2 =
  GenTx (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)

pattern GenTxShelley1 ::
     GenTx (ShelleyBlock proto1 era1)
  -> ShelleyBasedHardForkGenTx proto1 era1 proto2 era2
pattern $mGenTxShelley1 :: forall {r} {proto1} {era1} {proto2} {era2}.
ShelleyBasedHardForkGenTx proto1 era1 proto2 era2
-> (GenTx (ShelleyBlock proto1 era1) -> r) -> ((# #) -> r) -> r
$bGenTxShelley1 :: forall proto1 era1 proto2 era2.
GenTx (ShelleyBlock proto1 era1)
-> ShelleyBasedHardForkGenTx proto1 era1 proto2 era2
GenTxShelley1 tx = HardForkGenTx (OneEraGenTx (Z tx))

pattern GenTxShelley2 ::
     GenTx (ShelleyBlock proto2 era2)
  -> ShelleyBasedHardForkGenTx proto1 era1 proto2 era2
pattern $mGenTxShelley2 :: forall {r} {proto2} {era2} {proto1} {era1}.
ShelleyBasedHardForkGenTx proto1 era1 proto2 era2
-> (GenTx (ShelleyBlock proto2 era2) -> r) -> ((# #) -> r) -> r
$bGenTxShelley2 :: forall proto2 era2 proto1 era1.
GenTx (ShelleyBlock proto2 era2)
-> ShelleyBasedHardForkGenTx proto1 era1 proto2 era2
GenTxShelley2 tx = HardForkGenTx (OneEraGenTx (S (Z tx)))

{-# COMPLETE GenTxShelley1, GenTxShelley2 #-}

pattern ShelleyBasedHardForkNodeToNodeVersionMax ::
     BlockNodeToNodeVersion (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
pattern $mShelleyBasedHardForkNodeToNodeVersionMax :: forall {r} {proto1} {era1} {proto2} {era2}.
BlockNodeToNodeVersion
  (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> ((# #) -> r) -> ((# #) -> r) -> r
$bShelleyBasedHardForkNodeToNodeVersionMax :: forall proto1 era1 proto2 era2.
BlockNodeToNodeVersion
  (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
ShelleyBasedHardForkNodeToNodeVersionMax =
    HardForkNodeToNodeEnabled
      HardForkSpecificNodeToNodeVersionMax
      (  WrapNodeToNodeVersion ShelleyNodeToNodeVersionMax
      :* WrapNodeToNodeVersion ShelleyNodeToNodeVersionMax
      :* Nil
      )

pattern HardForkSpecificNodeToNodeVersionMax :: HardForkSpecificNodeToNodeVersion
pattern $mHardForkSpecificNodeToNodeVersionMax :: forall {r}.
HardForkSpecificNodeToNodeVersion
-> ((# #) -> r) -> ((# #) -> r) -> r
$bHardForkSpecificNodeToNodeVersionMax :: HardForkSpecificNodeToNodeVersion
HardForkSpecificNodeToNodeVersionMax <- ((== maxBound) -> True)
  where
    HardForkSpecificNodeToNodeVersionMax = HardForkSpecificNodeToNodeVersion
forall a. Bounded a => a
maxBound

pattern ShelleyNodeToNodeVersionMax :: ShelleyNodeToNodeVersion
pattern $mShelleyNodeToNodeVersionMax :: forall {r}.
ShelleyNodeToNodeVersion -> ((# #) -> r) -> ((# #) -> r) -> r
$bShelleyNodeToNodeVersionMax :: ShelleyNodeToNodeVersion
ShelleyNodeToNodeVersionMax <- ((== maxBound) -> True)
  where
    ShelleyNodeToNodeVersionMax = ShelleyNodeToNodeVersion
forall a. Bounded a => a
maxBound

pattern ShelleyBasedHardForkNodeToClientVersionMax ::
     BlockNodeToClientVersion (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
pattern $mShelleyBasedHardForkNodeToClientVersionMax :: forall {r} {proto1} {era1} {proto2} {era2}.
BlockNodeToClientVersion
  (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> ((# #) -> r) -> ((# #) -> r) -> r
$bShelleyBasedHardForkNodeToClientVersionMax :: forall proto1 era1 proto2 era2.
BlockNodeToClientVersion
  (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
ShelleyBasedHardForkNodeToClientVersionMax =
    HardForkNodeToClientEnabled
      HardForkSpecificNodeToClientVersionMax
      (  EraNodeToClientEnabled ShelleyNodeToClientVersionMax
      :* EraNodeToClientEnabled ShelleyNodeToClientVersionMax
      :* Nil
      )

pattern HardForkSpecificNodeToClientVersionMax :: HardForkSpecificNodeToClientVersion
pattern $mHardForkSpecificNodeToClientVersionMax :: forall {r}.
HardForkSpecificNodeToClientVersion
-> ((# #) -> r) -> ((# #) -> r) -> r
$bHardForkSpecificNodeToClientVersionMax :: HardForkSpecificNodeToClientVersion
HardForkSpecificNodeToClientVersionMax <- ((== maxBound) -> True)
  where
    HardForkSpecificNodeToClientVersionMax = HardForkSpecificNodeToClientVersion
forall a. Bounded a => a
maxBound

pattern ShelleyNodeToClientVersionMax :: ShelleyNodeToClientVersion
pattern $mShelleyNodeToClientVersionMax :: forall {r}.
ShelleyNodeToClientVersion -> ((# #) -> r) -> ((# #) -> r) -> r
$bShelleyNodeToClientVersionMax :: ShelleyNodeToClientVersion
ShelleyNodeToClientVersionMax <- ((== maxBound) -> True)
  where
    ShelleyNodeToClientVersionMax = ShelleyNodeToClientVersion
forall a. Bounded a => a
maxBound

{-------------------------------------------------------------------------------
  Consensus instances
-------------------------------------------------------------------------------}

type ShelleyBasedHardForkConstraints proto1 era1 proto2 era2 =
  ( ShelleyCompatible proto1 era1
  , ShelleyCompatible proto2 era2
  , LedgerSupportsProtocol (ShelleyBlock proto1 era1)
  , LedgerSupportsProtocol (ShelleyBlock proto2 era2)
  , TxLimits (ShelleyBlock proto1 era1)
  , TxLimits (ShelleyBlock proto2 era2)
  , BlockProtocol (ShelleyBlock proto1 era1) ~ proto1
  , BlockProtocol (ShelleyBlock proto2 era2) ~ proto2
  , TranslateTxMeasure (TxMeasure (ShelleyBlock proto1 era1)) (TxMeasure (ShelleyBlock proto2 era2))
  , SL.PreviousEra era2 ~ era1

  , SL.TranslateEra       era2 SL.NewEpochState
  , SL.TranslateEra       era2 WrapTx

  , SL.TranslationError   era2 SL.NewEpochState ~ Void

    -- At the moment, fix the protocols together
  , ProtoCrypto proto1 ~ ProtoCrypto proto2
  , PraosCrypto (ProtoCrypto proto1)
  , proto1 ~ TPraos (ProtoCrypto proto1)
  , proto1 ~ proto2

  , MemPack (TxOut (LedgerState (ShelleyBlock proto1 era1)))
  , MemPack (TxOut (LedgerState (ShelleyBlock proto2 era2)))
  )

class TranslateTxMeasure a b where
  translateTxMeasure :: a -> b

instance TranslateTxMeasure (IgnoringOverflow ByteSize32) (IgnoringOverflow ByteSize32) where
  translateTxMeasure :: IgnoringOverflow ByteSize32 -> IgnoringOverflow ByteSize32
translateTxMeasure = IgnoringOverflow ByteSize32 -> IgnoringOverflow ByteSize32
forall a. a -> a
id

instance TranslateTxMeasure (IgnoringOverflow ByteSize32) AlonzoMeasure where
  translateTxMeasure :: IgnoringOverflow ByteSize32 -> AlonzoMeasure
translateTxMeasure IgnoringOverflow ByteSize32
x = IgnoringOverflow ByteSize32 -> ExUnits' Natural -> AlonzoMeasure
AlonzoMeasure IgnoringOverflow ByteSize32
x ExUnits' Natural
forall a. Monoid a => a
mempty

instance TranslateTxMeasure (IgnoringOverflow ByteSize32) ConwayMeasure where
  translateTxMeasure :: IgnoringOverflow ByteSize32 -> ConwayMeasure
translateTxMeasure =
    AlonzoMeasure -> ConwayMeasure
forall a b. TranslateTxMeasure a b => a -> b
translateTxMeasure (AlonzoMeasure -> ConwayMeasure)
-> (IgnoringOverflow ByteSize32 -> AlonzoMeasure)
-> IgnoringOverflow ByteSize32
-> ConwayMeasure
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\AlonzoMeasure
x -> AlonzoMeasure
x :: AlonzoMeasure) (AlonzoMeasure -> AlonzoMeasure)
-> (IgnoringOverflow ByteSize32 -> AlonzoMeasure)
-> IgnoringOverflow ByteSize32
-> AlonzoMeasure
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IgnoringOverflow ByteSize32 -> AlonzoMeasure
forall a b. TranslateTxMeasure a b => a -> b
translateTxMeasure

instance TranslateTxMeasure AlonzoMeasure AlonzoMeasure where
  translateTxMeasure :: AlonzoMeasure -> AlonzoMeasure
translateTxMeasure = AlonzoMeasure -> AlonzoMeasure
forall a. a -> a
id

instance TranslateTxMeasure AlonzoMeasure ConwayMeasure where
  translateTxMeasure :: AlonzoMeasure -> ConwayMeasure
translateTxMeasure AlonzoMeasure
x = AlonzoMeasure -> IgnoringOverflow ByteSize32 -> ConwayMeasure
ConwayMeasure AlonzoMeasure
x IgnoringOverflow ByteSize32
forall a. Monoid a => a
mempty

instance TranslateTxMeasure ConwayMeasure ConwayMeasure where
  translateTxMeasure :: ConwayMeasure -> ConwayMeasure
translateTxMeasure = ConwayMeasure -> ConwayMeasure
forall a. a -> a
id

instance ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
      => SerialiseHFC (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
   -- use defaults

instance ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
      => CanHardFork (ShelleyBasedHardForkEras proto1 era1 proto2 era2) where
  type HardForkTxMeasure (ShelleyBasedHardForkEras proto1 era1 proto2 era2) =
      TxMeasure (ShelleyBlock proto2 era2)

  hardForkEraTranslation :: EraTranslation (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
hardForkEraTranslation = EraTranslation {
        translateLedgerState :: InPairs
  (RequiringBoth WrapLedgerConfig TranslateLedgerState)
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
translateLedgerState   = RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock proto1 era1)
  (ShelleyBlock proto2 era2)
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     '[ShelleyBlock proto2 era2]
-> InPairs
     (RequiringBoth WrapLedgerConfig TranslateLedgerState)
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
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 proto1 era1)
  (ShelleyBlock proto2 era2)
translateLedgerState                InPairs
  (RequiringBoth WrapLedgerConfig TranslateLedgerState)
  '[ShelleyBlock proto2 era2]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
      , translateLedgerTables :: InPairs
  TranslateLedgerTables
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
translateLedgerTables  = TranslateLedgerTables
  (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2)
-> InPairs TranslateLedgerTables '[ShelleyBlock proto2 era2]
-> InPairs
     TranslateLedgerTables
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
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 proto1 era1) (ShelleyBlock proto2 era2)
translateLedgerTables               InPairs TranslateLedgerTables '[ShelleyBlock proto2 era2]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
      , translateChainDepState :: InPairs
  (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
translateChainDepState = RequiringBoth
  WrapConsensusConfig
  (Translate WrapChainDepState)
  (ShelleyBlock proto1 era1)
  (ShelleyBlock proto2 era2)
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     '[ShelleyBlock proto2 era2]
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
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 proto1 era1)
  (ShelleyBlock proto2 era2)
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 proto2 era2]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
      , crossEraForecast :: InPairs
  (RequiringBoth
     WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
crossEraForecast       = RequiringBoth
  WrapLedgerConfig
  (CrossEraForecaster LedgerState WrapLedgerView)
  (ShelleyBlock proto1 era1)
  (ShelleyBlock proto2 era2)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     '[ShelleyBlock proto2 era2]
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
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 proto1 era1)
  (ShelleyBlock proto2 era2)
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 proto2 era2]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
      }
    where
      translateLedgerState ::
           InPairs.RequiringBoth
             WrapLedgerConfig
             TranslateLedgerState
             (ShelleyBlock proto1 era1)
             (ShelleyBlock proto2 era2)
      translateLedgerState :: RequiringBoth
  WrapLedgerConfig
  TranslateLedgerState
  (ShelleyBlock proto1 era1)
  (ShelleyBlock proto2 era2)
translateLedgerState =
          (WrapLedgerConfig (ShelleyBlock proto1 era1)
 -> WrapLedgerConfig (ShelleyBlock proto2 era2)
 -> TranslateLedgerState
      (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock proto1 era1)
     (ShelleyBlock proto2 era2)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
InPairs.RequireBoth
        ((WrapLedgerConfig (ShelleyBlock proto1 era1)
  -> WrapLedgerConfig (ShelleyBlock proto2 era2)
  -> TranslateLedgerState
       (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2))
 -> RequiringBoth
      WrapLedgerConfig
      TranslateLedgerState
      (ShelleyBlock proto1 era1)
      (ShelleyBlock proto2 era2))
-> (WrapLedgerConfig (ShelleyBlock proto1 era1)
    -> WrapLedgerConfig (ShelleyBlock proto2 era2)
    -> TranslateLedgerState
         (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2))
-> RequiringBoth
     WrapLedgerConfig
     TranslateLedgerState
     (ShelleyBlock proto1 era1)
     (ShelleyBlock proto2 era2)
forall a b. (a -> b) -> a -> b
$ \WrapLedgerConfig (ShelleyBlock proto1 era1)
_cfg1 WrapLedgerConfig (ShelleyBlock proto2 era2)
cfg2 ->
          HFC.TranslateLedgerState {
            translateLedgerStateWith :: EpochNo
-> LedgerState (ShelleyBlock proto1 era1) EmptyMK
-> LedgerState (ShelleyBlock proto2 era2) DiffMK
translateLedgerStateWith =  \EpochNo
_epochNo ->
                LedgerState (ShelleyBlock proto2 era2) EmptyMK
-> LedgerState (ShelleyBlock proto2 era2) DiffMK
forall (l :: LedgerStateKind) (any :: MapKind).
HasLedgerTables l =>
l any -> l DiffMK
noNewTickingDiffs
              (LedgerState (ShelleyBlock proto2 era2) EmptyMK
 -> LedgerState (ShelleyBlock proto2 era2) DiffMK)
-> (LedgerState (ShelleyBlock proto1 era1) EmptyMK
    -> LedgerState (ShelleyBlock proto2 era2) EmptyMK)
-> LedgerState (ShelleyBlock proto1 era1) EmptyMK
-> LedgerState (ShelleyBlock proto2 era2) DiffMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock proto2 era2)
-> LedgerState (ShelleyBlock proto2 era2) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip
              (Flip LedgerState EmptyMK (ShelleyBlock proto2 era2)
 -> LedgerState (ShelleyBlock proto2 era2) EmptyMK)
-> (LedgerState (ShelleyBlock proto1 era1) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock proto2 era2))
-> LedgerState (ShelleyBlock proto1 era1) EmptyMK
-> LedgerState (ShelleyBlock proto2 era2) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto2) era2
-> Flip LedgerState EmptyMK (ShelleyBlock proto2 era2)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
              ((:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto2) era2
 -> Flip LedgerState EmptyMK (ShelleyBlock proto2 era2))
-> (LedgerState (ShelleyBlock proto1 era1) EmptyMK
    -> (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto2) era2)
-> LedgerState (ShelleyBlock proto1 era1) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock proto2 era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext era2
-> (:.:)
     (Flip LedgerState EmptyMK) (ShelleyBlock proto2) (PreviousEra era2)
-> (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto2) era2
forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
SL.translateEra'
                  (ShelleyLedgerConfig era2 -> TranslationContext era2
forall era. ShelleyLedgerConfig era -> TranslationContext era
shelleyLedgerTranslationContext (WrapLedgerConfig (ShelleyBlock proto2 era2)
-> LedgerConfig (ShelleyBlock proto2 era2)
forall blk. WrapLedgerConfig blk -> LedgerConfig blk
unwrapLedgerConfig WrapLedgerConfig (ShelleyBlock proto2 era2)
cfg2))
              ((:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto1) era1
 -> (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto2) era2)
-> (LedgerState (ShelleyBlock proto1 era1) EmptyMK
    -> (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto1) era1)
-> LedgerState (ShelleyBlock proto1 era1) EmptyMK
-> (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto2) era2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip LedgerState EmptyMK (ShelleyBlock proto1 era1)
-> (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto1) era1
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp
              (Flip LedgerState EmptyMK (ShelleyBlock proto1 era1)
 -> (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto1) era1)
-> (LedgerState (ShelleyBlock proto1 era1) EmptyMK
    -> Flip LedgerState EmptyMK (ShelleyBlock proto1 era1))
-> LedgerState (ShelleyBlock proto1 era1) EmptyMK
-> (:.:) (Flip LedgerState EmptyMK) (ShelleyBlock proto1) era1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState (ShelleyBlock proto1 era1) EmptyMK
-> Flip LedgerState EmptyMK (ShelleyBlock proto1 era1)
forall x y (f :: x -> y -> *) (x1 :: y) (y1 :: x).
f y1 x1 -> Flip f x1 y1
Flip
        }

      translateLedgerTables ::
           TranslateLedgerTables
             (ShelleyBlock proto1 era1)
             (ShelleyBlock proto2 era2)
      translateLedgerTables :: TranslateLedgerTables
  (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2)
translateLedgerTables = HFC.TranslateLedgerTables {
            translateTxInWith :: TxIn (LedgerState (ShelleyBlock proto1 era1))
-> TxIn (LedgerState (ShelleyBlock proto2 era2))
translateTxInWith  = TxIn -> TxIn
TxIn (LedgerState (ShelleyBlock proto1 era1))
-> TxIn (LedgerState (ShelleyBlock proto2 era2))
forall a b. Coercible a b => a -> b
coerce
          , translateTxOutWith :: TxOut (LedgerState (ShelleyBlock proto1 era1))
-> TxOut (LedgerState (ShelleyBlock proto2 era2))
translateTxOutWith = TxOut (PreviousEra era2) -> TxOut era2
TxOut (LedgerState (ShelleyBlock proto1 era1))
-> TxOut (LedgerState (ShelleyBlock proto2 era2))
forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
SL.upgradeTxOut
          }

  hardForkChainSel :: Tails
  AcrossEraSelection
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
hardForkChainSel = AcrossEraSelection
  (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2)
-> Tails
     AcrossEraSelection
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall {k} (f :: k -> k -> *) (x :: k) (y :: k).
f x y -> Tails f '[x, y]
Tails.mk2 AcrossEraSelection
  (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2)
forall a b.
(SelectView (BlockProtocol a) ~ SelectView (BlockProtocol b)) =>
AcrossEraSelection a b
CompareSameSelectView

  hardForkInjectTxs :: InPairs
  (RequiringBoth
     WrapLedgerConfig (Product2 InjectTx InjectValidatedTx))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
hardForkInjectTxs =
        RequiringBoth
  WrapLedgerConfig
  (Product2 InjectTx InjectValidatedTx)
  (ShelleyBlock proto1 era1)
  (ShelleyBlock proto2 era2)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (Product2 InjectTx InjectValidatedTx))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall {k} (f :: k -> k -> *) (x :: k) (y :: k).
f x y -> InPairs f '[x, y]
InPairs.mk2
      (RequiringBoth
   WrapLedgerConfig
   (Product2 InjectTx InjectValidatedTx)
   (ShelleyBlock proto1 era1)
   (ShelleyBlock proto2 era2)
 -> InPairs
      (RequiringBoth
         WrapLedgerConfig (Product2 InjectTx InjectValidatedTx))
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> RequiringBoth
     WrapLedgerConfig
     (Product2 InjectTx InjectValidatedTx)
     (ShelleyBlock proto1 era1)
     (ShelleyBlock proto2 era2)
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (Product2 InjectTx InjectValidatedTx))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall a b. (a -> b) -> a -> b
$ (WrapLedgerConfig (ShelleyBlock proto1 era1)
 -> WrapLedgerConfig (ShelleyBlock proto2 era2)
 -> Product2
      InjectTx
      InjectValidatedTx
      (ShelleyBlock proto1 era1)
      (ShelleyBlock proto2 era2))
-> RequiringBoth
     WrapLedgerConfig
     (Product2 InjectTx InjectValidatedTx)
     (ShelleyBlock proto1 era1)
     (ShelleyBlock proto2 era2)
forall {k} (h :: k -> *) (f :: k -> k -> *) (x :: k) (y :: k).
(h x -> h y -> f x y) -> RequiringBoth h f x y
InPairs.RequireBoth ((WrapLedgerConfig (ShelleyBlock proto1 era1)
  -> WrapLedgerConfig (ShelleyBlock proto2 era2)
  -> Product2
       InjectTx
       InjectValidatedTx
       (ShelleyBlock proto1 era1)
       (ShelleyBlock proto2 era2))
 -> RequiringBoth
      WrapLedgerConfig
      (Product2 InjectTx InjectValidatedTx)
      (ShelleyBlock proto1 era1)
      (ShelleyBlock proto2 era2))
-> (WrapLedgerConfig (ShelleyBlock proto1 era1)
    -> WrapLedgerConfig (ShelleyBlock proto2 era2)
    -> Product2
         InjectTx
         InjectValidatedTx
         (ShelleyBlock proto1 era1)
         (ShelleyBlock proto2 era2))
-> RequiringBoth
     WrapLedgerConfig
     (Product2 InjectTx InjectValidatedTx)
     (ShelleyBlock proto1 era1)
     (ShelleyBlock proto2 era2)
forall a b. (a -> b) -> a -> b
$ \WrapLedgerConfig (ShelleyBlock proto1 era1)
_cfg1 WrapLedgerConfig (ShelleyBlock proto2 era2)
cfg2 ->
        let ctxt :: TranslationContext era2
ctxt = ShelleyLedgerConfig era2 -> TranslationContext era2
forall era. ShelleyLedgerConfig era -> TranslationContext era
shelleyLedgerTranslationContext (WrapLedgerConfig (ShelleyBlock proto2 era2)
-> LedgerConfig (ShelleyBlock proto2 era2)
forall blk. WrapLedgerConfig blk -> LedgerConfig blk
unwrapLedgerConfig WrapLedgerConfig (ShelleyBlock proto2 era2)
cfg2)
        in
          InjectTx (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2)
-> InjectValidatedTx
     (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2)
-> Product2
     InjectTx
     InjectValidatedTx
     (ShelleyBlock proto1 era1)
     (ShelleyBlock proto2 era2)
forall (f :: MapKind) (g :: MapKind) x y.
f x y -> g x y -> Product2 f g x y
Pair2
            ((GenTx (ShelleyBlock proto1 era1)
 -> Maybe (GenTx (ShelleyBlock proto2 era2)))
-> InjectTx (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2)
forall blk blk'.
(GenTx blk -> Maybe (GenTx blk')) -> InjectTx blk blk'
InjectTx          (TranslationContext era2
-> GenTx (ShelleyBlock proto1 era1)
-> Maybe (GenTx (ShelleyBlock proto1 era2))
forall proto.
TranslationContext era2
-> GenTx (ShelleyBlock proto era1)
-> Maybe (GenTx (ShelleyBlock proto era2))
translateTx          TranslationContext era2
ctxt))
            ((WrapValidatedGenTx (ShelleyBlock proto1 era1)
 -> Maybe (WrapValidatedGenTx (ShelleyBlock proto2 era2)))
-> InjectValidatedTx
     (ShelleyBlock proto1 era1) (ShelleyBlock proto2 era2)
forall blk blk'.
(WrapValidatedGenTx blk -> Maybe (WrapValidatedGenTx blk'))
-> InjectValidatedTx blk blk'
InjectValidatedTx (TranslationContext era2
-> WrapValidatedGenTx (ShelleyBlock proto1 era1)
-> Maybe (WrapValidatedGenTx (ShelleyBlock proto1 era2))
forall proto.
TranslationContext era2
-> WrapValidatedGenTx (ShelleyBlock proto era1)
-> Maybe (WrapValidatedGenTx (ShelleyBlock proto era2))
translateValidatedTx TranslationContext era2
ctxt))
    where
      translateTx ::
           SL.TranslationContext era2
        ->        GenTx (ShelleyBlock proto era1)
        -> Maybe (GenTx (ShelleyBlock proto era2))
      translateTx :: forall proto.
TranslationContext era2
-> GenTx (ShelleyBlock proto era1)
-> Maybe (GenTx (ShelleyBlock proto era2))
translateTx TranslationContext era2
transCtxt =
          ((:.:) GenTx (ShelleyBlock proto) era2
 -> GenTx (ShelleyBlock proto era2))
-> Maybe ((:.:) GenTx (ShelleyBlock proto) era2)
-> Maybe (GenTx (ShelleyBlock proto era2))
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (:.:) GenTx (ShelleyBlock proto) era2
-> GenTx (ShelleyBlock proto era2)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
        (Maybe ((:.:) GenTx (ShelleyBlock proto) era2)
 -> Maybe (GenTx (ShelleyBlock proto era2)))
-> (GenTx (ShelleyBlock proto era1)
    -> Maybe ((:.:) GenTx (ShelleyBlock proto) era2))
-> GenTx (ShelleyBlock proto era1)
-> Maybe (GenTx (ShelleyBlock proto era2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Either
  (TranslationError era2 WrapTx)
  ((:.:) GenTx (ShelleyBlock proto) era2)
-> Maybe ((:.:) GenTx (ShelleyBlock proto) era2)
forall a b. Either a b -> Maybe b
eitherToMaybe (Either
   (TranslationError era2 WrapTx)
   ((:.:) GenTx (ShelleyBlock proto) era2)
 -> Maybe ((:.:) GenTx (ShelleyBlock proto) era2))
-> (GenTx (ShelleyBlock proto era1)
    -> Either
         (TranslationError era2 WrapTx)
         ((:.:) GenTx (ShelleyBlock proto) era2))
-> GenTx (ShelleyBlock proto era1)
-> Maybe ((:.:) GenTx (ShelleyBlock proto) era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Except
  (TranslationError era2 WrapTx)
  ((:.:) GenTx (ShelleyBlock proto) era2)
-> Either
     (TranslationError era2 WrapTx)
     ((:.:) GenTx (ShelleyBlock proto) era2)
forall e a. Except e a -> Either e a
runExcept (Except
   (TranslationError era2 WrapTx)
   ((:.:) GenTx (ShelleyBlock proto) era2)
 -> Either
      (TranslationError era2 WrapTx)
      ((:.:) GenTx (ShelleyBlock proto) era2))
-> (GenTx (ShelleyBlock proto era1)
    -> Except
         (TranslationError era2 WrapTx)
         ((:.:) GenTx (ShelleyBlock proto) era2))
-> GenTx (ShelleyBlock proto era1)
-> Either
     (TranslationError era2 WrapTx)
     ((:.:) GenTx (ShelleyBlock proto) era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext era2
-> (:.:) GenTx (ShelleyBlock proto) (PreviousEra era2)
-> Except
     (TranslationError era2 (GenTx :.: ShelleyBlock proto))
     ((:.:) GenTx (ShelleyBlock proto) era2)
forall era (f :: * -> *).
TranslateEra era f =>
TranslationContext era
-> f (PreviousEra era) -> Except (TranslationError era f) (f era)
SL.translateEra TranslationContext era2
transCtxt
        ((:.:) GenTx (ShelleyBlock proto) era1
 -> Except
      (TranslationError era2 WrapTx)
      ((:.:) GenTx (ShelleyBlock proto) era2))
-> (GenTx (ShelleyBlock proto era1)
    -> (:.:) GenTx (ShelleyBlock proto) era1)
-> GenTx (ShelleyBlock proto era1)
-> Except
     (TranslationError era2 WrapTx)
     ((:.:) GenTx (ShelleyBlock proto) era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenTx (ShelleyBlock proto era1)
-> (:.:) GenTx (ShelleyBlock proto) era1
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp

      translateValidatedTx ::
           SL.TranslationContext era2
        ->        WrapValidatedGenTx (ShelleyBlock proto era1)
        -> Maybe (WrapValidatedGenTx (ShelleyBlock proto era2))
      translateValidatedTx :: forall proto.
TranslationContext era2
-> WrapValidatedGenTx (ShelleyBlock proto era1)
-> Maybe (WrapValidatedGenTx (ShelleyBlock proto era2))
translateValidatedTx TranslationContext era2
transCtxt =
            ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2
 -> WrapValidatedGenTx (ShelleyBlock proto era2))
-> Maybe ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
-> Maybe (WrapValidatedGenTx (ShelleyBlock proto era2))
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (:.:) WrapValidatedGenTx (ShelleyBlock proto) era2
-> WrapValidatedGenTx (ShelleyBlock proto era2)
forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp
          (Maybe ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
 -> Maybe (WrapValidatedGenTx (ShelleyBlock proto era2)))
-> (WrapValidatedGenTx (ShelleyBlock proto era1)
    -> Maybe ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2))
-> WrapValidatedGenTx (ShelleyBlock proto era1)
-> Maybe (WrapValidatedGenTx (ShelleyBlock proto era2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Either
  (TranslationError era2 WrapTx)
  ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
-> Maybe ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
forall a b. Either a b -> Maybe b
eitherToMaybe (Either
   (TranslationError era2 WrapTx)
   ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
 -> Maybe ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2))
-> (WrapValidatedGenTx (ShelleyBlock proto era1)
    -> Either
         (TranslationError era2 WrapTx)
         ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2))
-> WrapValidatedGenTx (ShelleyBlock proto era1)
-> Maybe ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Except
  (TranslationError era2 WrapTx)
  ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
-> Either
     (TranslationError era2 WrapTx)
     ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
forall e a. Except e a -> Either e a
runExcept (Except
   (TranslationError era2 WrapTx)
   ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
 -> Either
      (TranslationError era2 WrapTx)
      ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2))
-> (WrapValidatedGenTx (ShelleyBlock proto era1)
    -> Except
         (TranslationError era2 WrapTx)
         ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2))
-> WrapValidatedGenTx (ShelleyBlock proto era1)
-> Either
     (TranslationError era2 WrapTx)
     ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TranslationContext era2
-> (:.:) WrapValidatedGenTx (ShelleyBlock proto) (PreviousEra era2)
-> Except
     (TranslationError era2 (WrapValidatedGenTx :.: ShelleyBlock proto))
     ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
forall era (f :: * -> *).
TranslateEra era f =>
TranslationContext era
-> f (PreviousEra era) -> Except (TranslationError era f) (f era)
SL.translateEra TranslationContext era2
transCtxt
          ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era1
 -> Except
      (TranslationError era2 WrapTx)
      ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2))
-> (WrapValidatedGenTx (ShelleyBlock proto era1)
    -> (:.:) WrapValidatedGenTx (ShelleyBlock proto) era1)
-> WrapValidatedGenTx (ShelleyBlock proto era1)
-> Except
     (TranslationError era2 WrapTx)
     ((:.:) WrapValidatedGenTx (ShelleyBlock proto) era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapValidatedGenTx (ShelleyBlock proto era1)
-> (:.:) WrapValidatedGenTx (ShelleyBlock proto) era1
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp

  hardForkInjTxMeasure :: NS WrapTxMeasure (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> HardForkTxMeasure
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
hardForkInjTxMeasure = \case
      (  Z (WrapTxMeasure TxMeasure x
x)) -> TxMeasure (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> TxMeasure (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall a b. TranslateTxMeasure a b => a -> b
translateTxMeasure TxMeasure x
TxMeasure (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
x
      S (Z (WrapTxMeasure TxMeasure x
x)) -> TxMeasure x
HardForkTxMeasure
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
x

instance ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
      => SupportedNetworkProtocolVersion (ShelleyBasedHardForkBlock proto1 era1 proto2 era2) where
  supportedNodeToNodeVersions :: Proxy (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> Map
     NodeToNodeVersion
     (BlockNodeToNodeVersion
        (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))
supportedNodeToNodeVersions Proxy (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
_ = [(NodeToNodeVersion,
  BlockNodeToNodeVersion
    (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))]
-> Map
     NodeToNodeVersion
     (BlockNodeToNodeVersion
        (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(NodeToNodeVersion,
   BlockNodeToNodeVersion
     (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))]
 -> Map
      NodeToNodeVersion
      (BlockNodeToNodeVersion
         (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)))
-> [(NodeToNodeVersion,
     BlockNodeToNodeVersion
       (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))]
-> Map
     NodeToNodeVersion
     (BlockNodeToNodeVersion
        (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))
forall a b. (a -> b) -> a -> b
$
      [ (NodeToNodeVersion
forall a. Bounded a => a
maxBound, BlockNodeToNodeVersion
  (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
BlockNodeToNodeVersion
  (ShelleyBasedHardForkBlock
     (TPraos (ProtoCrypto proto2))
     era1
     (TPraos (ProtoCrypto proto2))
     era2)
forall proto1 era1 proto2 era2.
BlockNodeToNodeVersion
  (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
ShelleyBasedHardForkNodeToNodeVersionMax)
      ]

  supportedNodeToClientVersions :: Proxy (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> Map
     NodeToClientVersion
     (BlockNodeToClientVersion
        (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))
supportedNodeToClientVersions Proxy (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
_ = [(NodeToClientVersion,
  BlockNodeToClientVersion
    (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))]
-> Map
     NodeToClientVersion
     (BlockNodeToClientVersion
        (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(NodeToClientVersion,
   BlockNodeToClientVersion
     (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))]
 -> Map
      NodeToClientVersion
      (BlockNodeToClientVersion
         (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)))
-> [(NodeToClientVersion,
     BlockNodeToClientVersion
       (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))]
-> Map
     NodeToClientVersion
     (BlockNodeToClientVersion
        (ShelleyBasedHardForkBlock proto1 era1 proto2 era2))
forall a b. (a -> b) -> a -> b
$
      [ (NodeToClientVersion
forall a. Bounded a => a
maxBound, BlockNodeToClientVersion
  (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
BlockNodeToClientVersion
  (ShelleyBasedHardForkBlock
     (TPraos (ProtoCrypto proto2))
     era1
     (TPraos (ProtoCrypto proto2))
     era2)
forall proto1 era1 proto2 era2.
BlockNodeToClientVersion
  (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
ShelleyBasedHardForkNodeToClientVersionMax)
      ]

  latestReleasedNodeVersion :: Proxy (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> (Maybe NodeToNodeVersion, Maybe NodeToClientVersion)
latestReleasedNodeVersion = Proxy (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> (Maybe NodeToNodeVersion, Maybe NodeToClientVersion)
forall blk.
SupportedNetworkProtocolVersion blk =>
Proxy blk -> (Maybe NodeToNodeVersion, Maybe NodeToClientVersion)
latestReleasedNodeVersionDefault

{-------------------------------------------------------------------------------
  Query HF
-------------------------------------------------------------------------------}

answerShelleyBasedQueryHF ::
  ( xs ~ '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
  , ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
  )
  => (   forall blk.
         IsShelleyBlock blk
      => Index xs blk
      -> ExtLedgerCfg blk
      -> BlockQuery blk footprint result
      -> ReadOnlyForker' m (HardForkBlock xs)
      -> m result
     )
  -> Index xs x
  -> ExtLedgerCfg x
  -> BlockQuery x footprint result
  -> ReadOnlyForker' m (HardForkBlock xs)
  -> m result
answerShelleyBasedQueryHF :: forall (xs :: [*]) proto1 era1 proto2 era2
       (footprint :: QueryFootprint) result (m :: * -> *) x.
(xs ~ '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2],
 ShelleyBasedHardForkConstraints proto1 era1 proto2 era2) =>
(forall blk.
 IsShelleyBlock blk =>
 Index xs blk
 -> ExtLedgerCfg blk
 -> BlockQuery blk footprint result
 -> ReadOnlyForker' m (HardForkBlock xs)
 -> m result)
-> Index xs x
-> ExtLedgerCfg x
-> BlockQuery x footprint result
-> ReadOnlyForker' m (HardForkBlock xs)
-> m result
answerShelleyBasedQueryHF forall blk.
IsShelleyBlock blk =>
Index xs blk
-> ExtLedgerCfg blk
-> BlockQuery blk footprint result
-> ReadOnlyForker' m (HardForkBlock xs)
-> m result
f Index xs x
idx ExtLedgerCfg x
cfgs BlockQuery x footprint result
q ReadOnlyForker' m (HardForkBlock xs)
forker = case Index xs x
idx of
    Index xs x
IZ           -> Index xs x
-> ExtLedgerCfg x
-> BlockQuery x footprint result
-> ReadOnlyForker' m (HardForkBlock xs)
-> m result
forall blk.
IsShelleyBlock blk =>
Index xs blk
-> ExtLedgerCfg blk
-> BlockQuery blk footprint result
-> ReadOnlyForker' m (HardForkBlock xs)
-> m result
f Index xs x
idx ExtLedgerCfg x
cfgs BlockQuery x footprint result
q ReadOnlyForker' m (HardForkBlock xs)
forker
    IS Index xs' x
IZ        -> Index xs x
-> ExtLedgerCfg x
-> BlockQuery x footprint result
-> ReadOnlyForker' m (HardForkBlock xs)
-> m result
forall blk.
IsShelleyBlock blk =>
Index xs blk
-> ExtLedgerCfg blk
-> BlockQuery blk footprint result
-> ReadOnlyForker' m (HardForkBlock xs)
-> m result
f Index xs x
idx ExtLedgerCfg x
cfgs BlockQuery x footprint result
q ReadOnlyForker' m (HardForkBlock xs)
forker
    IS (IS Index xs' x
idx') -> case Index xs' x
idx' of {}

instance ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
      => BlockSupportsHFLedgerQuery '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] where
  answerBlockQueryHFLookup :: forall (m :: * -> *) x result.
(All
   SingleEraBlock
   '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2],
 Monad m) =>
Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] x
-> ExtLedgerCfg x
-> BlockQuery x 'QFLookupTables result
-> ReadOnlyForker'
     m
     (HardForkBlock
        '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])
-> m result
answerBlockQueryHFLookup =
    (forall blk.
 IsShelleyBlock blk =>
 Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
 -> ExtLedgerCfg blk
 -> BlockQuery blk 'QFLookupTables result
 -> ReadOnlyForker'
      m
      (HardForkBlock
         '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])
 -> m result)
-> Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] x
-> ExtLedgerCfg x
-> BlockQuery x 'QFLookupTables result
-> ReadOnlyForker'
     m
     (HardForkBlock
        '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])
-> m result
forall (xs :: [*]) proto1 era1 proto2 era2
       (footprint :: QueryFootprint) result (m :: * -> *) x.
(xs ~ '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2],
 ShelleyBasedHardForkConstraints proto1 era1 proto2 era2) =>
(forall blk.
 IsShelleyBlock blk =>
 Index xs blk
 -> ExtLedgerCfg blk
 -> BlockQuery blk footprint result
 -> ReadOnlyForker' m (HardForkBlock xs)
 -> m result)
-> Index xs x
-> ExtLedgerCfg x
-> BlockQuery x footprint result
-> ReadOnlyForker' m (HardForkBlock xs)
-> m result
answerShelleyBasedQueryHF
      (\Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
idx -> (LedgerTables
   (LedgerState
      (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk)))
   KeysMK
 -> LedgerTables
      (LedgerState
         (HardForkBlock
            '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]))
      KeysMK)
-> (TxOut
      (LedgerState
         (HardForkBlock
            '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]))
    -> TxOut (ShelleyBlockLedgerEra blk))
-> (TxIn
      (LedgerState
         (HardForkBlock
            '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]))
    -> TxIn)
-> ExtLedgerCfg
     (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk))
-> BlockQuery
     (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk))
     'QFLookupTables
     result
-> ReadOnlyForker'
     m
     (HardForkBlock
        '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])
-> m result
forall proto era (m :: * -> *) result blk.
(Monad m, ShelleyCompatible proto era) =>
(LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
 -> LedgerTables (LedgerState blk) KeysMK)
-> (TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
-> ReadOnlyForker' m blk
-> m result
answerShelleyLookupQueries
                 (Index
  '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
  (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk))
-> LedgerTables
     (LedgerState
        (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk)))
     KeysMK
-> LedgerTables
     (LedgerState
        (HardForkBlock
           '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]))
     KeysMK
forall (xs :: [*]) x (mk :: MapKind).
(CanMapKeysMK mk, CanMapMK mk, HasCanonicalTxIn xs,
 HasHardForkTxOut xs) =>
Index xs x
-> LedgerTables (LedgerState x) mk
-> LedgerTables (LedgerState (HardForkBlock xs)) mk
injectLedgerTables Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
Index
  '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
  (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk))
idx)
                 (Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
-> DefaultHardForkTxOut
     '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
-> TxOut (LedgerState blk)
forall (xs :: [*]) x.
(SListI xs, HasHardForkTxOut xs) =>
Index xs x -> DefaultHardForkTxOut xs -> TxOut (LedgerState x)
ejectHardForkTxOutDefault Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
idx)
                 (Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
-> CanonicalTxIn
     '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
-> TxIn (LedgerState blk)
forall (xs :: [*]) x.
HasCanonicalTxIn xs =>
Index xs x -> CanonicalTxIn xs -> TxIn (LedgerState x)
forall x.
Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] x
-> CanonicalTxIn
     '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
-> TxIn (LedgerState x)
ejectCanonicalTxIn Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
idx)
      )

  answerBlockQueryHFTraverse :: forall (m :: * -> *) x result.
(All
   SingleEraBlock
   '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2],
 Monad m) =>
Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] x
-> ExtLedgerCfg x
-> BlockQuery x 'QFTraverseTables result
-> ReadOnlyForker'
     m
     (HardForkBlock
        '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])
-> m result
answerBlockQueryHFTraverse =
    (forall blk.
 IsShelleyBlock blk =>
 Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
 -> ExtLedgerCfg blk
 -> BlockQuery blk 'QFTraverseTables result
 -> ReadOnlyForker'
      m
      (HardForkBlock
         '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])
 -> m result)
-> Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] x
-> ExtLedgerCfg x
-> BlockQuery x 'QFTraverseTables result
-> ReadOnlyForker'
     m
     (HardForkBlock
        '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])
-> m result
forall (xs :: [*]) proto1 era1 proto2 era2
       (footprint :: QueryFootprint) result (m :: * -> *) x.
(xs ~ '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2],
 ShelleyBasedHardForkConstraints proto1 era1 proto2 era2) =>
(forall blk.
 IsShelleyBlock blk =>
 Index xs blk
 -> ExtLedgerCfg blk
 -> BlockQuery blk footprint result
 -> ReadOnlyForker' m (HardForkBlock xs)
 -> m result)
-> Index xs x
-> ExtLedgerCfg x
-> BlockQuery x footprint result
-> ReadOnlyForker' m (HardForkBlock xs)
-> m result
answerShelleyBasedQueryHF
      (\Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
idx -> (TxOut
   (LedgerState
      (HardForkBlock
         '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]))
 -> TxOut (ShelleyBlockLedgerEra blk))
-> (TxIn
      (LedgerState
         (HardForkBlock
            '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]))
    -> TxIn)
-> (forall result'.
    BlockQuery
      (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk))
      'QFTraverseTables
      result'
    -> TxOut
         (LedgerState
            (HardForkBlock
               '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]))
    -> Bool)
-> ExtLedgerCfg
     (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk))
-> BlockQuery
     (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk))
     'QFTraverseTables
     result
-> ReadOnlyForker'
     m
     (HardForkBlock
        '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])
-> m result
forall proto era (m :: * -> *) result blk.
(ShelleyCompatible proto era, Ord (TxIn (LedgerState blk)),
 Eq (TxOut (LedgerState blk)), MemPack (TxIn (LedgerState blk)),
 IndexedMemPack (LedgerState blk EmptyMK) (TxOut (LedgerState blk)),
 Monad m) =>
(TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> (forall result'.
    BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
    -> TxOut (LedgerState blk) -> Bool)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> ReadOnlyForker' m blk
-> m result
answerShelleyTraversingQueries
                 (Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
-> DefaultHardForkTxOut
     '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
-> TxOut (LedgerState blk)
forall (xs :: [*]) x.
(SListI xs, HasHardForkTxOut xs) =>
Index xs x -> DefaultHardForkTxOut xs -> TxOut (LedgerState x)
ejectHardForkTxOutDefault Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
idx)
                 (Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
-> CanonicalTxIn
     '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
-> TxIn (LedgerState blk)
forall (xs :: [*]) x.
HasCanonicalTxIn xs =>
Index xs x -> CanonicalTxIn xs -> TxIn (LedgerState x)
forall x.
Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] x
-> CanonicalTxIn
     '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
-> TxIn (LedgerState x)
ejectCanonicalTxIn Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
idx)
                 (forall (xs :: [*]) x result.
BlockSupportsHFLedgerQuery xs =>
Index xs x
-> BlockQuery x 'QFTraverseTables result
-> TxOut (LedgerState (HardForkBlock xs))
-> Bool
queryLedgerGetTraversingFilter @('[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]) Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] blk
Index
  '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]
  (ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk))
idx)
      )

  queryLedgerGetTraversingFilter :: forall x result.
Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] x
-> BlockQuery x 'QFTraverseTables result
-> TxOut
     (LedgerState
        (HardForkBlock
           '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]))
-> Bool
queryLedgerGetTraversingFilter Index '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2] x
IZ BlockQuery x 'QFTraverseTables result
q = \case
    Z (WrapTxOut TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
x) -> BlockQuery
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
  'QFTraverseTables
  result
-> TxOut (LedgerState (ShelleyBlock Any era1)) -> Bool
forall proto era proto' era' result.
(ShelleyBasedEra era, ShelleyBasedEra era') =>
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState (ShelleyBlock proto' era')) -> Bool
shelleyQFTraverseTablesPredicate BlockQuery x 'QFTraverseTables result
BlockQuery
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
  'QFTraverseTables
  result
q TxOut (LedgerState (ShelleyBlock Any era1))
TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
x
    S (Z (WrapTxOut TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
x)) -> BlockQuery
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
  'QFTraverseTables
  result
-> TxOut (LedgerState (ShelleyBlock Any era2)) -> Bool
forall proto era proto' era' result.
(ShelleyBasedEra era, ShelleyBasedEra era') =>
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState (ShelleyBlock proto' era')) -> Bool
shelleyQFTraverseTablesPredicate BlockQuery x 'QFTraverseTables result
BlockQuery
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
  'QFTraverseTables
  result
q TxOut (LedgerState (ShelleyBlock Any era2))
TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
x
  queryLedgerGetTraversingFilter (IS Index xs' x
IZ) BlockQuery x 'QFTraverseTables result
q = \case
    Z (WrapTxOut TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
x) -> BlockQuery
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
  'QFTraverseTables
  result
-> TxOut (LedgerState (ShelleyBlock Any era1)) -> Bool
forall proto era proto' era' result.
(ShelleyBasedEra era, ShelleyBasedEra era') =>
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState (ShelleyBlock proto' era')) -> Bool
shelleyQFTraverseTablesPredicate BlockQuery x 'QFTraverseTables result
BlockQuery
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
  'QFTraverseTables
  result
q TxOut (LedgerState (ShelleyBlock Any era1))
TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
x
    S (Z (WrapTxOut TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
x)) -> BlockQuery
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
  'QFTraverseTables
  result
-> TxOut (LedgerState (ShelleyBlock Any era2)) -> Bool
forall proto era proto' era' result.
(ShelleyBasedEra era, ShelleyBasedEra era') =>
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState (ShelleyBlock proto' era')) -> Bool
shelleyQFTraverseTablesPredicate BlockQuery x 'QFTraverseTables result
BlockQuery
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
  'QFTraverseTables
  result
q TxOut (LedgerState (ShelleyBlock Any era2))
TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
x
  queryLedgerGetTraversingFilter (IS (IS Index xs' x
idx)) BlockQuery x 'QFTraverseTables result
_q = case Index xs' x
idx of {}

{-------------------------------------------------------------------------------
  Protocol info
-------------------------------------------------------------------------------}

protocolInfoShelleyBasedHardFork ::
     forall m proto1 era1 proto2 era2.
     (IOLike m, ShelleyBasedHardForkConstraints proto1 era1 proto2 era2)
  => ProtocolParamsShelleyBased (ProtoCrypto proto1)
  -> SL.ProtVer
  -> SL.ProtVer
  -> L.TransitionConfig era2
  -> TriggerHardFork
  -> ( ProtocolInfo      (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
     , m [BlockForging m (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)]
     )
protocolInfoShelleyBasedHardFork :: forall (m :: * -> *) proto1 era1 proto2 era2.
(IOLike m,
 ShelleyBasedHardForkConstraints proto1 era1 proto2 era2) =>
ProtocolParamsShelleyBased (ProtoCrypto proto1)
-> ProtVer
-> ProtVer
-> TransitionConfig era2
-> TriggerHardFork
-> (ProtocolInfo
      (ShelleyBasedHardForkBlock proto1 era1 proto2 era2),
    m [BlockForging
         m (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)])
protocolInfoShelleyBasedHardFork ProtocolParamsShelleyBased (ProtoCrypto proto1)
protocolParamsShelleyBased
                                 ProtVer
protVer1
                                 ProtVer
protVer2
                                 TransitionConfig era2
transCfg2
                                 TriggerHardFork
hardForkTrigger =
    ProtocolInfo (ShelleyBlock proto1 era1)
-> m [BlockForging m (ShelleyBlock proto1 era1)]
-> EraParams
-> (ConsensusConfig (BlockProtocol (ShelleyBlock proto1 era1))
    -> PartialConsensusConfig
         (BlockProtocol (ShelleyBlock proto1 era1)))
-> (LedgerConfig (ShelleyBlock proto1 era1)
    -> PartialLedgerConfig (ShelleyBlock proto1 era1))
-> ProtocolInfo (ShelleyBlock proto2 era2)
-> m [BlockForging m (ShelleyBlock proto2 era2)]
-> EraParams
-> (ConsensusConfig (BlockProtocol (ShelleyBlock proto2 era2))
    -> PartialConsensusConfig
         (BlockProtocol (ShelleyBlock proto2 era2)))
-> (LedgerConfig (ShelleyBlock proto2 era2)
    -> PartialLedgerConfig (ShelleyBlock proto2 era2))
-> (ProtocolInfo
      (HardForkBlock
         '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2]),
    m [BlockForging
         m
         (HardForkBlock
            '[ShelleyBlock proto1 era1, ShelleyBlock proto2 era2])])
forall (m :: * -> *) blk1 blk2.
(CanHardFork '[blk1, blk2], Monad m) =>
ProtocolInfo blk1
-> m [BlockForging m blk1]
-> EraParams
-> (ConsensusConfig (BlockProtocol blk1)
    -> PartialConsensusConfig (BlockProtocol blk1))
-> (LedgerConfig blk1 -> PartialLedgerConfig blk1)
-> ProtocolInfo blk2
-> m [BlockForging m blk2]
-> EraParams
-> (ConsensusConfig (BlockProtocol blk2)
    -> PartialConsensusConfig (BlockProtocol blk2))
-> (LedgerConfig blk2 -> PartialLedgerConfig blk2)
-> (ProtocolInfo (HardForkBlock '[blk1, blk2]),
    m [BlockForging m (HardForkBlock '[blk1, blk2])])
protocolInfoBinary
      -- Era 1
      ProtocolInfo (ShelleyBlock proto1 era1)
protocolInfo1
      m [BlockForging m (ShelleyBlock proto1 era1)]
blockForging1
      EraParams
eraParams1
      ConsensusConfig (BlockProtocol (ShelleyBlock proto1 era1))
-> PartialConsensusConfig
     (BlockProtocol (ShelleyBlock proto1 era1))
ConsensusConfig (TPraos (ProtoCrypto proto2)) -> TPraosParams
forall c. ConsensusConfig (TPraos c) -> TPraosParams
tpraosParams
      LedgerConfig (ShelleyBlock proto1 era1)
-> PartialLedgerConfig (ShelleyBlock proto1 era1)
toPartialLedgerConfig1
      -- Era 2
      ProtocolInfo (ShelleyBlock proto2 era2)
protocolInfo2
      m [BlockForging m (ShelleyBlock proto2 era2)]
blockForging2
      EraParams
eraParams2
      ConsensusConfig (BlockProtocol (ShelleyBlock proto2 era2))
-> PartialConsensusConfig
     (BlockProtocol (ShelleyBlock proto2 era2))
ConsensusConfig (TPraos (ProtoCrypto proto2)) -> TPraosParams
forall c. ConsensusConfig (TPraos c) -> TPraosParams
tpraosParams
      LedgerConfig (ShelleyBlock proto2 era2)
-> PartialLedgerConfig (ShelleyBlock proto2 era2)
toPartialLedgerConfig2
  where
    ProtocolParamsShelleyBased {
        Nonce
shelleyBasedInitialNonce :: Nonce
shelleyBasedInitialNonce :: forall c. ProtocolParamsShelleyBased c -> Nonce
shelleyBasedInitialNonce
      , [ShelleyLeaderCredentials (ProtoCrypto proto1)]
shelleyBasedLeaderCredentials :: [ShelleyLeaderCredentials (ProtoCrypto proto1)]
shelleyBasedLeaderCredentials :: forall c.
ProtocolParamsShelleyBased c -> [ShelleyLeaderCredentials c]
shelleyBasedLeaderCredentials
      } = ProtocolParamsShelleyBased (ProtoCrypto proto1)
protocolParamsShelleyBased

    -- Era 1

    genesis :: SL.ShelleyGenesis
    genesis :: ShelleyGenesis
genesis = TransitionConfig era2
transCfg2 TransitionConfig era2
-> Getting ShelleyGenesis (TransitionConfig era2) ShelleyGenesis
-> ShelleyGenesis
forall s a. s -> Getting a s a -> a
^. Getting ShelleyGenesis (TransitionConfig era2) ShelleyGenesis
forall era.
EraTransition era =>
Lens' (TransitionConfig era) ShelleyGenesis
Lens' (TransitionConfig era2) ShelleyGenesis
L.tcShelleyGenesisL

    protocolInfo1 :: ProtocolInfo (ShelleyBlock proto1 era1)
    blockForging1 :: m [BlockForging m (ShelleyBlock proto1 era1)]
    (ProtocolInfo (ShelleyBlock proto1 era1)
protocolInfo1, m [BlockForging m (ShelleyBlock proto1 era1)]
blockForging1) =
        ProtocolParamsShelleyBased (ProtoCrypto proto2)
-> TransitionConfig era1
-> ProtVer
-> (ProtocolInfo (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1),
    m [BlockForging
         m (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)])
forall (m :: * -> *) era c.
(IOLike m, ShelleyCompatible (TPraos c) era,
 TxLimits (ShelleyBlock (TPraos c) era)) =>
ProtocolParamsShelleyBased c
-> TransitionConfig era
-> ProtVer
-> (ProtocolInfo (ShelleyBlock (TPraos c) era),
    m [BlockForging m (ShelleyBlock (TPraos c) era)])
protocolInfoTPraosShelleyBased
          ProtocolParamsShelleyBased (ProtoCrypto proto1)
ProtocolParamsShelleyBased (ProtoCrypto proto2)
protocolParamsShelleyBased
          (TransitionConfig era2
transCfg2 TransitionConfig era2
-> Getting
     (TransitionConfig era1)
     (TransitionConfig era2)
     (TransitionConfig era1)
-> TransitionConfig era1
forall s a. s -> Getting a s a -> a
^. Getting
  (TransitionConfig era1)
  (TransitionConfig era2)
  (TransitionConfig era1)
(TransitionConfig (PreviousEra era2)
 -> Const
      (TransitionConfig era1) (TransitionConfig (PreviousEra era2)))
-> TransitionConfig era2
-> Const (TransitionConfig era1) (TransitionConfig era2)
forall era.
(EraTransition era, EraTransition (PreviousEra era)) =>
Lens' (TransitionConfig era) (TransitionConfig (PreviousEra era))
Lens' (TransitionConfig era2) (TransitionConfig (PreviousEra era2))
L.tcPreviousEraConfigL)
          ProtVer
protVer1

    eraParams1 :: History.EraParams
    eraParams1 :: EraParams
eraParams1 = ShelleyGenesis -> EraParams
shelleyEraParams ShelleyGenesis
genesis

    toPartialLedgerConfig1 ::
         LedgerConfig (ShelleyBlock proto1 era1)
      -> PartialLedgerConfig (ShelleyBlock proto1 era1)
    toPartialLedgerConfig1 :: LedgerConfig (ShelleyBlock proto1 era1)
-> PartialLedgerConfig (ShelleyBlock proto1 era1)
toPartialLedgerConfig1 LedgerConfig (ShelleyBlock proto1 era1)
cfg = ShelleyPartialLedgerConfig {
          shelleyLedgerConfig :: ShelleyLedgerConfig era1
shelleyLedgerConfig    = LedgerConfig (ShelleyBlock proto1 era1)
ShelleyLedgerConfig era1
cfg
        , shelleyTriggerHardFork :: TriggerHardFork
shelleyTriggerHardFork = TriggerHardFork
hardForkTrigger
        }

    -- Era 2

    protocolInfo2 :: ProtocolInfo (ShelleyBlock proto2 era2)
    blockForging2 :: m [BlockForging m (ShelleyBlock proto2 era2)]
    (ProtocolInfo (ShelleyBlock proto2 era2)
protocolInfo2, m [BlockForging m (ShelleyBlock proto2 era2)]
blockForging2) =
        ProtocolParamsShelleyBased (ProtoCrypto proto2)
-> TransitionConfig era2
-> ProtVer
-> (ProtocolInfo (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2),
    m [BlockForging
         m (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)])
forall (m :: * -> *) era c.
(IOLike m, ShelleyCompatible (TPraos c) era,
 TxLimits (ShelleyBlock (TPraos c) era)) =>
ProtocolParamsShelleyBased c
-> TransitionConfig era
-> ProtVer
-> (ProtocolInfo (ShelleyBlock (TPraos c) era),
    m [BlockForging m (ShelleyBlock (TPraos c) era)])
protocolInfoTPraosShelleyBased
          ProtocolParamsShelleyBased {
              Nonce
shelleyBasedInitialNonce :: Nonce
shelleyBasedInitialNonce :: Nonce
shelleyBasedInitialNonce
            , [ShelleyLeaderCredentials (ProtoCrypto proto1)]
[ShelleyLeaderCredentials (ProtoCrypto proto2)]
shelleyBasedLeaderCredentials :: [ShelleyLeaderCredentials (ProtoCrypto proto1)]
shelleyBasedLeaderCredentials :: [ShelleyLeaderCredentials (ProtoCrypto proto2)]
shelleyBasedLeaderCredentials
            }
          TransitionConfig era2
transCfg2
          ProtVer
protVer2

    eraParams2 :: History.EraParams
    eraParams2 :: EraParams
eraParams2 = ShelleyGenesis -> EraParams
shelleyEraParams ShelleyGenesis
genesis

    toPartialLedgerConfig2 ::
         LedgerConfig (ShelleyBlock proto2 era2)
      -> PartialLedgerConfig (ShelleyBlock proto2 era2)
    toPartialLedgerConfig2 :: LedgerConfig (ShelleyBlock proto2 era2)
-> PartialLedgerConfig (ShelleyBlock proto2 era2)
toPartialLedgerConfig2 LedgerConfig (ShelleyBlock proto2 era2)
cfg = ShelleyPartialLedgerConfig {
          shelleyLedgerConfig :: ShelleyLedgerConfig era2
shelleyLedgerConfig    = LedgerConfig (ShelleyBlock proto2 era2)
ShelleyLedgerConfig era2
cfg
        , shelleyTriggerHardFork :: TriggerHardFork
shelleyTriggerHardFork = TriggerHardFork
TriggerHardForkNotDuringThisExecution
        }

{-------------------------------------------------------------------------------
  TxGen instance
-------------------------------------------------------------------------------}

-- | Use a generic implementation for 'TxGen'
instance ( TxGen (ShelleyBlock proto1 era1)
         , TxGen (ShelleyBlock proto2 era2)
         , ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
         ) => TxGen (ShelleyBasedHardForkBlock proto1 era1 proto2 era2) where
  type TxGenExtra (ShelleyBasedHardForkBlock proto1 era1 proto2 era2) =
    NP WrapTxGenExtra (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
  testGenTxs :: CoreNodeId
-> NumCoreNodes
-> SlotNo
-> TopLevelConfig
     (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> TxGenExtra (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> LedgerState
     (ShelleyBasedHardForkBlock proto1 era1 proto2 era2) ValuesMK
-> Gen [GenTx (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)]
testGenTxs = CoreNodeId
-> NumCoreNodes
-> SlotNo
-> TopLevelConfig
     (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> TxGenExtra (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> LedgerState
     (ShelleyBasedHardForkBlock proto1 era1 proto2 era2) ValuesMK
-> Gen [GenTx (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)]
CoreNodeId
-> NumCoreNodes
-> SlotNo
-> TopLevelConfig
     (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)
-> NP
     WrapTxGenExtra (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> LedgerState
     (ShelleyBasedHardForkBlock proto1 era1 proto2 era2) ValuesMK
-> Gen [GenTx (ShelleyBasedHardForkBlock proto1 era1 proto2 era2)]
forall (xs :: [*]).
(All TxGen xs, CanHardFork xs) =>
CoreNodeId
-> NumCoreNodes
-> SlotNo
-> TopLevelConfig (HardForkBlock xs)
-> NP WrapTxGenExtra xs
-> LedgerState (HardForkBlock xs) ValuesMK
-> Gen [GenTx (HardForkBlock xs)]
testGenTxsHfc

{-------------------------------------------------------------------------------
  Canonical TxIn
-------------------------------------------------------------------------------}

instance ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
      => HasCanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2) where
  newtype instance CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2) =
    ShelleyHFCTxIn {
        forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxIn
getShelleyHFCTxIn :: SL.TxIn
      }
    deriving stock (Int
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> ShowS
[CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)]
-> ShowS
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> String
(Int
 -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> ShowS)
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> String)
-> ([CanonicalTxIn
       (ShelleyBasedHardForkEras proto1 era1 proto2 era2)]
    -> ShowS)
-> Show
     (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall proto1 era1 proto2 era2.
Int
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> ShowS
forall proto1 era1 proto2 era2.
[CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)]
-> ShowS
forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> String
$cshowsPrec :: forall proto1 era1 proto2 era2.
Int
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> ShowS
showsPrec :: Int
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> ShowS
$cshow :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> String
show :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> String
$cshowList :: forall proto1 era1 proto2 era2.
[CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)]
-> ShowS
showList :: [CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)]
-> ShowS
Show, CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
(CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> Bool)
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> Bool)
-> Eq
     (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
$c== :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
== :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
$c/= :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
/= :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
Eq, Eq
  (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
Eq
  (CanonicalTxIn
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)) =>
(CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> Ordering)
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> Bool)
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> Bool)
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> Bool)
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> Bool)
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn
         (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> CanonicalTxIn
         (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> Ord
     (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Ordering
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall proto1 era1 proto2 era2.
Eq
  (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Ordering
forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
$ccompare :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Ordering
compare :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Ordering
$c< :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
< :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
$c<= :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
<= :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
$c> :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
> :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
$c>= :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
>= :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Bool
$cmax :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
max :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
$cmin :: forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
min :: CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
Ord)
    deriving newtype (Context
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> IO (Maybe ThunkInfo)
Proxy
  (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> String
(Context
 -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> IO (Maybe ThunkInfo))
-> (Context
    -> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> IO (Maybe ThunkInfo))
-> (Proxy
      (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
    -> String)
-> NoThunks
     (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
forall proto1 era1 proto2 era2.
Context
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> IO (Maybe ThunkInfo)
forall proto1 era1 proto2 era2.
Proxy
  (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> String
$cnoThunks :: forall proto1 era1 proto2 era2.
Context
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> IO (Maybe ThunkInfo)
noThunks :: Context
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> IO (Maybe ThunkInfo)
$cwNoThunks :: forall proto1 era1 proto2 era2.
Context
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> IO (Maybe ThunkInfo)
wNoThunks :: Context
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> IO (Maybe ThunkInfo)
$cshowTypeOf :: forall proto1 era1 proto2 era2.
Proxy
  (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> String
showTypeOf :: Proxy
  (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> String
NoThunks)

  injectCanonicalTxIn :: forall x.
Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
-> TxIn (LedgerState x)
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
injectCanonicalTxIn Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
IZ             TxIn (LedgerState x)
txIn = TxIn
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall proto1 era1 proto2 era2.
TxIn
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
ShelleyHFCTxIn TxIn
TxIn (LedgerState x)
txIn
  injectCanonicalTxIn (IS Index xs' x
IZ)        TxIn (LedgerState x)
txIn = TxIn
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall proto1 era1 proto2 era2.
TxIn
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
ShelleyHFCTxIn (TxIn -> TxIn
forall a b. Coercible a b => a -> b
coerce TxIn
TxIn (LedgerState x)
txIn)
  injectCanonicalTxIn (IS (IS Index xs' x
idx')) TxIn (LedgerState x)
_    = case Index xs' x
idx' of {}

  ejectCanonicalTxIn :: forall x.
Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxIn (LedgerState x)
ejectCanonicalTxIn Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
IZ             CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
txIn = CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxIn
forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxIn
getShelleyHFCTxIn CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
txIn
  ejectCanonicalTxIn (IS Index xs' x
IZ)        CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
txIn = TxIn -> TxIn
forall a b. Coercible a b => a -> b
coerce (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxIn
forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxIn
getShelleyHFCTxIn CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
txIn)
  ejectCanonicalTxIn (IS (IS Index xs' x
idx')) CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
_    = case Index xs' x
idx' of {}

deriving newtype instance
  ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
  => MemPack (CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2))

instance ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
      => HasHardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2) where
  type instance HardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2) =
                  DefaultHardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
  injectHardForkTxOut :: forall x.
Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
-> TxOut (LedgerState x)
-> HardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
injectHardForkTxOut = Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
-> TxOut (LedgerState x)
-> HardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
-> TxOut (LedgerState x)
-> NS WrapTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall (xs :: [*]) x.
SListI xs =>
Index xs x -> TxOut (LedgerState x) -> DefaultHardForkTxOut xs
injectHardForkTxOutDefault
  ejectHardForkTxOut :: forall x.
Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
-> HardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxOut (LedgerState x)
ejectHardForkTxOut = Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
-> HardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxOut (LedgerState x)
Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) x
-> NS WrapTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxOut (LedgerState x)
forall (xs :: [*]) x.
(SListI xs, HasHardForkTxOut xs) =>
Index xs x -> DefaultHardForkTxOut xs -> TxOut (LedgerState x)
ejectHardForkTxOutDefault

instance ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
      => SerializeTablesWithHint (LedgerState (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))) where
  encodeTablesWithHint :: LedgerState (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)) EmptyMK
                       -> LedgerTables (LedgerState (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))) ValuesMK
                       -> Encoding
  encodeTablesWithHint :: LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
-> LedgerTables
     (LedgerState
        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
     ValuesMK
-> Encoding
encodeTablesWithHint (HardForkLedgerState (HardForkState Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
idx)) (LedgerTables (ValuesMK Map
  (TxIn
     (LedgerState
        (HardForkBlock
           (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
  (TxOut
     (LedgerState
        (HardForkBlock
           (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
tbs)) =
    let
      np :: NP
  (Current (Flip LedgerState EmptyMK) -.-> K Encoding)
  (ShelleyBasedHardForkEras
     (TPraos (ProtoCrypto proto2))
     era1
     (TPraos (ProtoCrypto proto2))
     era2)
np = ((Current
   (Flip LedgerState EmptyMK)
   (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
 -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> (-.->)
     (Current (Flip LedgerState EmptyMK))
     (K Encoding)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
(f a -> g a) -> (-.->) f g a
Fn ((Current
    (Flip LedgerState EmptyMK)
    (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
  -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
 -> (-.->)
      (Current (Flip LedgerState EmptyMK))
      (K Encoding)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
    -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> (-.->)
     (Current (Flip LedgerState EmptyMK))
     (K Encoding)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall a b. (a -> b) -> a -> b
$ K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall a b. a -> b -> a
const (K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
 -> Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
 -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall a b. (a -> b) -> a -> b
$ Encoding
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall k a (b :: k). a -> K a b
K (Encoding
 -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> Encoding
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall a b. (a -> b) -> a -> b
$ Proxy era1 -> Encoding
forall era. Era era => Proxy era -> Encoding
encOne (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @era1))
        (-.->)
  (Current (Flip LedgerState EmptyMK))
  (K Encoding)
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> NP
     (Current (Flip LedgerState EmptyMK) -.-> K Encoding)
     '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2]
-> NP
     (Current (Flip LedgerState EmptyMK) -.-> K Encoding)
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
forall {k} (f :: k -> *) (x :: k) (xs1 :: [k]).
f x -> NP f xs1 -> NP f (x : xs1)
:* ((Current
   (Flip LedgerState EmptyMK)
   (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
 -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> (-.->)
     (Current (Flip LedgerState EmptyMK))
     (K Encoding)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
(f a -> g a) -> (-.->) f g a
Fn ((Current
    (Flip LedgerState EmptyMK)
    (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
  -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
 -> (-.->)
      (Current (Flip LedgerState EmptyMK))
      (K Encoding)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
    -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> (-.->)
     (Current (Flip LedgerState EmptyMK))
     (K Encoding)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall a b. (a -> b) -> a -> b
$ K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall a b. a -> b -> a
const (K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
 -> Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
 -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall a b. (a -> b) -> a -> b
$ Encoding
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall k a (b :: k). a -> K a b
K (Encoding
 -> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> Encoding
-> K Encoding (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall a b. (a -> b) -> a -> b
$ Proxy era2 -> Encoding
forall era. Era era => Proxy era -> Encoding
encOne (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @era2))
        (-.->)
  (Current (Flip LedgerState EmptyMK))
  (K Encoding)
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> NP (Current (Flip LedgerState EmptyMK) -.-> K Encoding) '[]
-> NP
     (Current (Flip LedgerState EmptyMK) -.-> K Encoding)
     '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2]
forall {k} (f :: k -> *) (x :: k) (xs1 :: [k]).
f x -> NP f xs1 -> NP f (x : xs1)
:* NP (Current (Flip LedgerState EmptyMK) -.-> K Encoding) '[]
forall {k} (f :: k -> *). NP f '[]
Nil
    in NS (K Encoding) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CollapseTo NS Encoding
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse (NS (K Encoding) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> CollapseTo NS Encoding)
-> NS
     (K Encoding) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CollapseTo NS Encoding
forall a b. (a -> b) -> a -> b
$ Prod
  NS
  (Current (Flip LedgerState EmptyMK) -.-> K Encoding)
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (K Encoding) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall k l (h :: (k -> *) -> l -> *) (f :: k -> *) (g :: k -> *)
       (xs :: l).
HAp h =>
Prod h (f -.-> g) xs -> h f xs -> h g xs
forall (f :: * -> *) (g :: * -> *) (xs :: [*]).
Prod NS (f -.-> g) xs -> NS f xs -> NS g xs
hap Prod
  NS
  (Current (Flip LedgerState EmptyMK) -.-> K Encoding)
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
NP
  (Current (Flip LedgerState EmptyMK) -.-> K Encoding)
  (ShelleyBasedHardForkEras
     (TPraos (ProtoCrypto proto2))
     era1
     (TPraos (ProtoCrypto proto2))
     era2)
np (NS
   (Current (Flip LedgerState EmptyMK))
   (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> NS
      (K Encoding) (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (K Encoding) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall a b. (a -> b) -> a -> b
$ Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall {k} (g :: k -> *) (f :: k -> *) (xs :: [k]).
Telescope g f xs -> NS f xs
Telescope.tip Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
idx
   where
     encOne :: forall era. SL.Era era => Proxy era -> Encoding
     encOne :: forall era. Era era => Proxy era -> Encoding
encOne Proxy era
_ = Version -> Encoding -> Encoding
toPlainEncoding (forall era. Era era => Version
SL.eraProtVerLow @era)
                 (Encoding -> Encoding) -> Encoding -> Encoding
forall a b. (a -> b) -> a -> b
$ (CanonicalTxIn
   (ShelleyBasedHardForkEras
      (TPraos (ProtoCrypto proto2))
      era1
      (TPraos (ProtoCrypto proto2))
      era2)
 -> Encoding)
-> (NS
      WrapTxOut
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2)
    -> Encoding)
-> Map
     (CanonicalTxIn
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
     (NS
        WrapTxOut
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
-> Encoding
forall k v.
(k -> Encoding) -> (v -> Encoding) -> Map k v -> Encoding
encodeMap (TxIn -> Encoding
forall a. MemPack a => a -> Encoding
encodeMemPack (TxIn -> Encoding)
-> (CanonicalTxIn
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2)
    -> TxIn)
-> CanonicalTxIn
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
-> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CanonicalTxIn
  (ShelleyBasedHardForkEras
     (TPraos (ProtoCrypto proto2))
     era1
     (TPraos (ProtoCrypto proto2))
     era2)
-> TxIn
forall proto1 era1 proto2 era2.
CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> TxIn
getShelleyHFCTxIn) (\case
                                               Z WrapTxOut x
txout -> TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> Encoding
forall a. MemPack a => a -> Encoding
encodeMemPack (TxOut
   (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
 -> Encoding)
-> TxOut
     (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> Encoding
forall a b. (a -> b) -> a -> b
$ WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> TxOut
     (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
forall blk. WrapTxOut blk -> TxOut (LedgerState blk)
unwrapTxOut WrapTxOut x
WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
txout
                                               S (Z WrapTxOut x
txout) -> TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> Encoding
forall a. MemPack a => a -> Encoding
encodeMemPack (TxOut
   (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
 -> Encoding)
-> TxOut
     (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> Encoding
forall a b. (a -> b) -> a -> b
$ WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> TxOut
     (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
forall blk. WrapTxOut blk -> TxOut (LedgerState blk)
unwrapTxOut WrapTxOut x
WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
txout
                                           ) Map
  (TxIn
     (LedgerState
        (HardForkBlock
           (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
  (TxOut
     (LedgerState
        (HardForkBlock
           (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
Map
  (CanonicalTxIn
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2))
  (NS
     WrapTxOut
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2))
tbs

  decodeTablesWithHint :: forall s. LedgerState (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)) EmptyMK
                    -> Decoder s (LedgerTables (LedgerState (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))) ValuesMK)
  decodeTablesWithHint :: forall s.
LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
decodeTablesWithHint (HardForkLedgerState (HardForkState Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
idx)) =
    let
      np :: NP
  (Current (Flip LedgerState EmptyMK)
   -.-> (Decoder s
         :.: K (LedgerTables
                  (LedgerState
                     (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                  ValuesMK)))
  (ShelleyBasedHardForkEras
     (TPraos (ProtoCrypto proto2))
     era1
     (TPraos (ProtoCrypto proto2))
     era2)
np = ((Current
   (Flip LedgerState EmptyMK)
   (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
 -> (:.:)
      (Decoder s)
      (K (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK))
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> (-.->)
     (Current (Flip LedgerState EmptyMK))
     (Decoder s
      :.: K (LedgerTables
               (LedgerState
                  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
               ValuesMK))
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
(f a -> g a) -> (-.->) f g a
Fn ((Current
    (Flip LedgerState EmptyMK)
    (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
  -> (:.:)
       (Decoder s)
       (K (LedgerTables
             (LedgerState
                (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
             ValuesMK))
       (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
 -> (-.->)
      (Current (Flip LedgerState EmptyMK))
      (Decoder s
       :.: K (LedgerTables
                (LedgerState
                   (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                ValuesMK))
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
    -> (:.:)
         (Decoder s)
         (K (LedgerTables
               (LedgerState
                  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
               ValuesMK))
         (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> (-.->)
     (Current (Flip LedgerState EmptyMK))
     (Decoder s
      :.: K (LedgerTables
               (LedgerState
                  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
               ValuesMK))
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall a b. (a -> b) -> a -> b
$ Decoder
  s
  (K (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> (:.:)
     (Decoder s)
     (K (LedgerTables
           (LedgerState
              (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
           ValuesMK))
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp (Decoder
   s
   (K (LedgerTables
         (LedgerState
            (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
         ValuesMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
 -> (:.:)
      (Decoder s)
      (K (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK))
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
    -> Decoder
         s
         (K (LedgerTables
               (LedgerState
                  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
               ValuesMK)
            (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)))
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> (:.:)
     (Decoder s)
     (K (LedgerTables
           (LedgerState
              (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
           ValuesMK))
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LedgerTables
   (LedgerState
      (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
   ValuesMK
 -> K (LedgerTables
         (LedgerState
            (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
         ValuesMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
-> Decoder
     s
     (K (LedgerTables
           (LedgerState
              (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
           ValuesMK)
        (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
forall a b. (a -> b) -> Decoder s a -> Decoder s b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap LedgerTables
  (LedgerState
     (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
  ValuesMK
-> K (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall k a (b :: k). a -> K a b
K (Decoder
   s
   (LedgerTables
      (LedgerState
         (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
      ValuesMK)
 -> Decoder
      s
      (K (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK)
         (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
    -> Decoder
         s
         (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK))
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> Decoder
     s
     (K (LedgerTables
           (LedgerState
              (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
           ValuesMK)
        (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TxOut
   (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
 -> TxOut
      (LedgerState
         (HardForkBlock
            (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
-> LedgerState
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1) EmptyMK
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
forall proto era.
ShelleyCompatible proto era =>
(TxOut (LedgerState (ShelleyBlock proto era))
 -> TxOut
      (LedgerState
         (HardForkBlock
            (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
-> LedgerState (ShelleyBlock proto era) EmptyMK
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
getOne (WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> NS
     WrapTxOut
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
forall {k} (f :: k -> *) (x :: k) (xs1 :: [k]).
f x -> NS f (x : xs1)
Z (WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
 -> NS
      WrapTxOut
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2))
-> (TxOut era1
    -> WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> TxOut era1
-> NS
     WrapTxOut
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxOut era1
-> WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall blk. TxOut (LedgerState blk) -> WrapTxOut blk
WrapTxOut) (LedgerState
   (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1) EmptyMK
 -> Decoder
      s
      (LedgerTables
         (LedgerState
            (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
         ValuesMK))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
    -> LedgerState
         (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1) EmptyMK)
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip
  LedgerState
  EmptyMK
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> LedgerState
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip (Flip
   LedgerState
   EmptyMK
   (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
 -> LedgerState
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1) EmptyMK)
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
    -> Flip
         LedgerState
         EmptyMK
         (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1))
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> LedgerState
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Current
  (Flip LedgerState EmptyMK)
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> Flip
     LedgerState
     EmptyMK
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
forall (f :: * -> *) blk. Current f blk -> f blk
currentState)
        (-.->)
  (Current (Flip LedgerState EmptyMK))
  (Decoder s
   :.: K (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK))
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era1)
-> NP
     (Current (Flip LedgerState EmptyMK)
      -.-> (Decoder s
            :.: K (LedgerTables
                     (LedgerState
                        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                     ValuesMK)))
     '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2]
-> NP
     (Current (Flip LedgerState EmptyMK)
      -.-> (Decoder s
            :.: K (LedgerTables
                     (LedgerState
                        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                     ValuesMK)))
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
forall {k} (f :: k -> *) (x :: k) (xs1 :: [k]).
f x -> NP f xs1 -> NP f (x : xs1)
:* ((Current
   (Flip LedgerState EmptyMK)
   (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
 -> (:.:)
      (Decoder s)
      (K (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK))
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> (-.->)
     (Current (Flip LedgerState EmptyMK))
     (Decoder s
      :.: K (LedgerTables
               (LedgerState
                  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
               ValuesMK))
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
(f a -> g a) -> (-.->) f g a
Fn ((Current
    (Flip LedgerState EmptyMK)
    (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
  -> (:.:)
       (Decoder s)
       (K (LedgerTables
             (LedgerState
                (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
             ValuesMK))
       (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
 -> (-.->)
      (Current (Flip LedgerState EmptyMK))
      (Decoder s
       :.: K (LedgerTables
                (LedgerState
                   (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                ValuesMK))
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
    -> (:.:)
         (Decoder s)
         (K (LedgerTables
               (LedgerState
                  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
               ValuesMK))
         (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> (-.->)
     (Current (Flip LedgerState EmptyMK))
     (Decoder s
      :.: K (LedgerTables
               (LedgerState
                  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
               ValuesMK))
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall a b. (a -> b) -> a -> b
$ Decoder
  s
  (K (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> (:.:)
     (Decoder s)
     (K (LedgerTables
           (LedgerState
              (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
           ValuesMK))
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp (Decoder
   s
   (K (LedgerTables
         (LedgerState
            (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
         ValuesMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
 -> (:.:)
      (Decoder s)
      (K (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK))
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
    -> Decoder
         s
         (K (LedgerTables
               (LedgerState
                  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
               ValuesMK)
            (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)))
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> (:.:)
     (Decoder s)
     (K (LedgerTables
           (LedgerState
              (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
           ValuesMK))
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LedgerTables
   (LedgerState
      (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
   ValuesMK
 -> K (LedgerTables
         (LedgerState
            (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
         ValuesMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
-> Decoder
     s
     (K (LedgerTables
           (LedgerState
              (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
           ValuesMK)
        (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
forall a b. (a -> b) -> Decoder s a -> Decoder s b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap LedgerTables
  (LedgerState
     (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
  ValuesMK
-> K (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall k a (b :: k). a -> K a b
K (Decoder
   s
   (LedgerTables
      (LedgerState
         (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
      ValuesMK)
 -> Decoder
      s
      (K (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK)
         (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
    -> Decoder
         s
         (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK))
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> Decoder
     s
     (K (LedgerTables
           (LedgerState
              (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
           ValuesMK)
        (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TxOut
   (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
 -> TxOut
      (LedgerState
         (HardForkBlock
            (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
-> LedgerState
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2) EmptyMK
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
forall proto era.
ShelleyCompatible proto era =>
(TxOut (LedgerState (ShelleyBlock proto era))
 -> TxOut
      (LedgerState
         (HardForkBlock
            (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
-> LedgerState (ShelleyBlock proto era) EmptyMK
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
getOne (NS WrapTxOut '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2]
-> NS
     WrapTxOut
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
forall {k} (f :: k -> *) (xs1 :: [k]) (x :: k).
NS f xs1 -> NS f (x : xs1)
S (NS WrapTxOut '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2]
 -> NS
      WrapTxOut
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2))
-> (TxOut era2
    -> NS WrapTxOut '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2])
-> TxOut era2
-> NS
     WrapTxOut
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> NS WrapTxOut '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2]
forall {k} (f :: k -> *) (x :: k) (xs1 :: [k]).
f x -> NS f (x : xs1)
Z (WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
 -> NS WrapTxOut '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2])
-> (TxOut era2
    -> WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> TxOut era2
-> NS WrapTxOut '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxOut era2
-> WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
TxOut
  (LedgerState (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> WrapTxOut (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall blk. TxOut (LedgerState blk) -> WrapTxOut blk
WrapTxOut) (LedgerState
   (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2) EmptyMK
 -> Decoder
      s
      (LedgerTables
         (LedgerState
            (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
         ValuesMK))
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
    -> LedgerState
         (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2) EmptyMK)
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flip
  LedgerState
  EmptyMK
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> LedgerState
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2) EmptyMK
forall x1 y1 (f :: x1 -> y1 -> *) (x2 :: y1) (y2 :: x1).
Flip f x2 y2 -> f y2 x2
unFlip (Flip
   LedgerState
   EmptyMK
   (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
 -> LedgerState
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2) EmptyMK)
-> (Current
      (Flip LedgerState EmptyMK)
      (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
    -> Flip
         LedgerState
         EmptyMK
         (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2))
-> Current
     (Flip LedgerState EmptyMK)
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> LedgerState
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2) EmptyMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Current
  (Flip LedgerState EmptyMK)
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> Flip
     LedgerState
     EmptyMK
     (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
forall (f :: * -> *) blk. Current f blk -> f blk
currentState)
        (-.->)
  (Current (Flip LedgerState EmptyMK))
  (Decoder s
   :.: K (LedgerTables
            (LedgerState
               (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
            ValuesMK))
  (ShelleyBlock (TPraos (ProtoCrypto proto2)) era2)
-> NP
     (Current (Flip LedgerState EmptyMK)
      -.-> (Decoder s
            :.: K (LedgerTables
                     (LedgerState
                        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                     ValuesMK)))
     '[]
-> NP
     (Current (Flip LedgerState EmptyMK)
      -.-> (Decoder s
            :.: K (LedgerTables
                     (LedgerState
                        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                     ValuesMK)))
     '[ShelleyBlock (TPraos (ProtoCrypto proto2)) era2]
forall {k} (f :: k -> *) (x :: k) (xs1 :: [k]).
f x -> NP f xs1 -> NP f (x : xs1)
:* NP
  (Current (Flip LedgerState EmptyMK)
   -.-> (Decoder s
         :.: K (LedgerTables
                  (LedgerState
                     (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                  ValuesMK)))
  '[]
forall {k} (f :: k -> *). NP f '[]
Nil
    in NS
  (K (LedgerTables
        (LedgerState
           (HardForkBlock
              (ShelleyBasedHardForkEras
                 (TPraos (ProtoCrypto proto2))
                 era1
                 (TPraos (ProtoCrypto proto2))
                 era2)))
        ValuesMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CollapseTo
     NS
     (LedgerTables
        (LedgerState
           (HardForkBlock
              (ShelleyBasedHardForkEras
                 (TPraos (ProtoCrypto proto2))
                 era1
                 (TPraos (ProtoCrypto proto2))
                 era2)))
        ValuesMK)
NS
  (K (LedgerTables
        (LedgerState
           (HardForkBlock
              (ShelleyBasedHardForkEras
                 (TPraos (ProtoCrypto proto2))
                 era1
                 (TPraos (ProtoCrypto proto2))
                 era2)))
        ValuesMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> LedgerTables
     (LedgerState
        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
     ValuesMK
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse (NS
   (K (LedgerTables
         (LedgerState
            (HardForkBlock
               (ShelleyBasedHardForkEras
                  (TPraos (ProtoCrypto proto2))
                  era1
                  (TPraos (ProtoCrypto proto2))
                  era2)))
         ValuesMK))
   (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> LedgerTables
      (LedgerState
         (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
      ValuesMK)
-> Decoder
     s
     (NS
        (K (LedgerTables
              (LedgerState
                 (HardForkBlock
                    (ShelleyBasedHardForkEras
                       (TPraos (ProtoCrypto proto2))
                       era1
                       (TPraos (ProtoCrypto proto2))
                       era2)))
              ValuesMK))
        (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (NS
  (Decoder s
   :.: K (LedgerTables
            (LedgerState
               (HardForkBlock
                  (ShelleyBasedHardForkEras
                     (TPraos (ProtoCrypto proto2))
                     era1
                     (TPraos (ProtoCrypto proto2))
                     era2)))
            ValuesMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Decoder
     s
     (NS
        (K (LedgerTables
              (LedgerState
                 (HardForkBlock
                    (ShelleyBasedHardForkEras
                       (TPraos (ProtoCrypto proto2))
                       era1
                       (TPraos (ProtoCrypto proto2))
                       era2)))
              ValuesMK))
        (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
forall (xs :: [*]) (f :: * -> *) (g :: * -> *).
(SListIN NS xs, Applicative f) =>
NS (f :.: g) xs -> f (NS g xs)
forall k l (h :: (k -> *) -> l -> *) (xs :: l) (f :: * -> *)
       (g :: k -> *).
(HSequence h, SListIN h xs, Applicative f) =>
h (f :.: g) xs -> f (h g xs)
hsequence' (NS
   (Decoder s
    :.: K (LedgerTables
             (LedgerState
                (HardForkBlock
                   (ShelleyBasedHardForkEras
                      (TPraos (ProtoCrypto proto2))
                      era1
                      (TPraos (ProtoCrypto proto2))
                      era2)))
             ValuesMK))
   (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> Decoder
      s
      (NS
         (K (LedgerTables
               (LedgerState
                  (HardForkBlock
                     (ShelleyBasedHardForkEras
                        (TPraos (ProtoCrypto proto2))
                        era1
                        (TPraos (ProtoCrypto proto2))
                        era2)))
               ValuesMK))
         (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
-> NS
     (Decoder s
      :.: K (LedgerTables
               (LedgerState
                  (HardForkBlock
                     (ShelleyBasedHardForkEras
                        (TPraos (ProtoCrypto proto2))
                        era1
                        (TPraos (ProtoCrypto proto2))
                        era2)))
               ValuesMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Decoder
     s
     (NS
        (K (LedgerTables
              (LedgerState
                 (HardForkBlock
                    (ShelleyBasedHardForkEras
                       (TPraos (ProtoCrypto proto2))
                       era1
                       (TPraos (ProtoCrypto proto2))
                       era2)))
              ValuesMK))
        (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
forall a b. (a -> b) -> a -> b
$ Prod
  NS
  (Current (Flip LedgerState EmptyMK)
   -.-> (Decoder s
         :.: K (LedgerTables
                  (LedgerState
                     (HardForkBlock
                        (ShelleyBasedHardForkEras
                           (TPraos (ProtoCrypto proto2))
                           era1
                           (TPraos (ProtoCrypto proto2))
                           era2)))
                  ValuesMK)))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Decoder s
      :.: K (LedgerTables
               (LedgerState
                  (HardForkBlock
                     (ShelleyBasedHardForkEras
                        (TPraos (ProtoCrypto proto2))
                        era1
                        (TPraos (ProtoCrypto proto2))
                        era2)))
               ValuesMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall k l (h :: (k -> *) -> l -> *) (f :: k -> *) (g :: k -> *)
       (xs :: l).
HAp h =>
Prod h (f -.-> g) xs -> h f xs -> h g xs
forall (f :: * -> *) (g :: * -> *) (xs :: [*]).
Prod NS (f -.-> g) xs -> NS f xs -> NS g xs
hap Prod
  NS
  (Current (Flip LedgerState EmptyMK)
   -.-> (Decoder s
         :.: K (LedgerTables
                  (LedgerState
                     (HardForkBlock
                        (ShelleyBasedHardForkEras
                           (TPraos (ProtoCrypto proto2))
                           era1
                           (TPraos (ProtoCrypto proto2))
                           era2)))
                  ValuesMK)))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
NP
  (Current (Flip LedgerState EmptyMK)
   -.-> (Decoder s
         :.: K (LedgerTables
                  (LedgerState
                     (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
                  ValuesMK)))
  (ShelleyBasedHardForkEras
     (TPraos (ProtoCrypto proto2))
     era1
     (TPraos (ProtoCrypto proto2))
     era2)
np (NS
   (Current (Flip LedgerState EmptyMK))
   (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> NS
      (Decoder s
       :.: K (LedgerTables
                (LedgerState
                   (HardForkBlock
                      (ShelleyBasedHardForkEras
                         (TPraos (ProtoCrypto proto2))
                         era1
                         (TPraos (ProtoCrypto proto2))
                         era2)))
                ValuesMK))
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Decoder s
      :.: K (LedgerTables
               (LedgerState
                  (HardForkBlock
                     (ShelleyBasedHardForkEras
                        (TPraos (ProtoCrypto proto2))
                        era1
                        (TPraos (ProtoCrypto proto2))
                        era2)))
               ValuesMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall a b. (a -> b) -> a -> b
$ Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall {k} (g :: k -> *) (f :: k -> *) (xs :: [k]).
Telescope g f xs -> NS f xs
Telescope.tip Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
idx)
   where
     getOne :: forall proto era. ShelleyCompatible proto era
            => (TxOut (LedgerState (ShelleyBlock proto era)) -> TxOut (LedgerState (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
            -> LedgerState (ShelleyBlock proto era) EmptyMK
            -> Decoder s (LedgerTables (LedgerState (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))) ValuesMK)
     getOne :: forall proto era.
ShelleyCompatible proto era =>
(TxOut (LedgerState (ShelleyBlock proto era))
 -> TxOut
      (LedgerState
         (HardForkBlock
            (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
-> LedgerState (ShelleyBlock proto era) EmptyMK
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
getOne TxOut (LedgerState (ShelleyBlock proto era))
-> TxOut
     (LedgerState
        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
toShelleyTxOut LedgerState (ShelleyBlock proto era) EmptyMK
st =
       let certInterns :: Interns (Credential 'Staking)
certInterns =
             Map (Credential 'Staking) UMElem -> Interns (Credential 'Staking)
forall k a. Ord k => Map k a -> Interns k
internsFromMap
             (Map (Credential 'Staking) UMElem -> Interns (Credential 'Staking))
-> Map (Credential 'Staking) UMElem
-> Interns (Credential 'Staking)
forall a b. (a -> b) -> a -> b
$ LedgerState (ShelleyBlock proto era) EmptyMK -> NewEpochState era
forall proto era (mk :: MapKind).
LedgerState (ShelleyBlock proto era) mk -> NewEpochState era
shelleyLedgerState LedgerState (ShelleyBlock proto era) EmptyMK
st
               NewEpochState era
-> Getting
     (Map (Credential 'Staking) UMElem)
     (NewEpochState era)
     (Map (Credential 'Staking) UMElem)
-> Map (Credential 'Staking) UMElem
forall s a. s -> Getting a s a -> a
^. (EpochState era
 -> Const (Map (Credential 'Staking) UMElem) (EpochState era))
-> NewEpochState era
-> Const (Map (Credential 'Staking) UMElem) (NewEpochState era)
forall era (f :: * -> *).
Functor f =>
(EpochState era -> f (EpochState era))
-> NewEpochState era -> f (NewEpochState era)
SL.nesEsL
                ((EpochState era
  -> Const (Map (Credential 'Staking) UMElem) (EpochState era))
 -> NewEpochState era
 -> Const (Map (Credential 'Staking) UMElem) (NewEpochState era))
-> ((Map (Credential 'Staking) UMElem
     -> Const
          (Map (Credential 'Staking) UMElem)
          (Map (Credential 'Staking) UMElem))
    -> EpochState era
    -> Const (Map (Credential 'Staking) UMElem) (EpochState era))
-> Getting
     (Map (Credential 'Staking) UMElem)
     (NewEpochState era)
     (Map (Credential 'Staking) UMElem)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LedgerState era
 -> Const (Map (Credential 'Staking) UMElem) (LedgerState era))
-> EpochState era
-> Const (Map (Credential 'Staking) UMElem) (EpochState era)
forall era (f :: * -> *).
Functor f =>
(LedgerState era -> f (LedgerState era))
-> EpochState era -> f (EpochState era)
SL.esLStateL
                ((LedgerState era
  -> Const (Map (Credential 'Staking) UMElem) (LedgerState era))
 -> EpochState era
 -> Const (Map (Credential 'Staking) UMElem) (EpochState era))
-> ((Map (Credential 'Staking) UMElem
     -> Const
          (Map (Credential 'Staking) UMElem)
          (Map (Credential 'Staking) UMElem))
    -> LedgerState era
    -> Const (Map (Credential 'Staking) UMElem) (LedgerState era))
-> (Map (Credential 'Staking) UMElem
    -> Const
         (Map (Credential 'Staking) UMElem)
         (Map (Credential 'Staking) UMElem))
-> EpochState era
-> Const (Map (Credential 'Staking) UMElem) (EpochState era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (CertState era
 -> Const (Map (Credential 'Staking) UMElem) (CertState era))
-> LedgerState era
-> Const (Map (Credential 'Staking) UMElem) (LedgerState era)
forall era (f :: * -> *).
Functor f =>
(CertState era -> f (CertState era))
-> LedgerState era -> f (LedgerState era)
SL.lsCertStateL
                ((CertState era
  -> Const (Map (Credential 'Staking) UMElem) (CertState era))
 -> LedgerState era
 -> Const (Map (Credential 'Staking) UMElem) (LedgerState era))
-> ((Map (Credential 'Staking) UMElem
     -> Const
          (Map (Credential 'Staking) UMElem)
          (Map (Credential 'Staking) UMElem))
    -> CertState era
    -> Const (Map (Credential 'Staking) UMElem) (CertState era))
-> (Map (Credential 'Staking) UMElem
    -> Const
         (Map (Credential 'Staking) UMElem)
         (Map (Credential 'Staking) UMElem))
-> LedgerState era
-> Const (Map (Credential 'Staking) UMElem) (LedgerState era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DState era
 -> Const (Map (Credential 'Staking) UMElem) (DState era))
-> CertState era
-> Const (Map (Credential 'Staking) UMElem) (CertState era)
forall era. EraCertState era => Lens' (CertState era) (DState era)
Lens' (CertState era) (DState era)
SL.certDStateL
                ((DState era
  -> Const (Map (Credential 'Staking) UMElem) (DState era))
 -> CertState era
 -> Const (Map (Credential 'Staking) UMElem) (CertState era))
-> ((Map (Credential 'Staking) UMElem
     -> Const
          (Map (Credential 'Staking) UMElem)
          (Map (Credential 'Staking) UMElem))
    -> DState era
    -> Const (Map (Credential 'Staking) UMElem) (DState era))
-> (Map (Credential 'Staking) UMElem
    -> Const
         (Map (Credential 'Staking) UMElem)
         (Map (Credential 'Staking) UMElem))
-> CertState era
-> Const (Map (Credential 'Staking) UMElem) (CertState era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UMap -> Const (Map (Credential 'Staking) UMElem) UMap)
-> DState era
-> Const (Map (Credential 'Staking) UMElem) (DState era)
forall era (f :: * -> *).
Functor f =>
(UMap -> f UMap) -> DState era -> f (DState era)
SL.dsUnifiedL
                ((UMap -> Const (Map (Credential 'Staking) UMElem) UMap)
 -> DState era
 -> Const (Map (Credential 'Staking) UMElem) (DState era))
-> ((Map (Credential 'Staking) UMElem
     -> Const
          (Map (Credential 'Staking) UMElem)
          (Map (Credential 'Staking) UMElem))
    -> UMap -> Const (Map (Credential 'Staking) UMElem) UMap)
-> (Map (Credential 'Staking) UMElem
    -> Const
         (Map (Credential 'Staking) UMElem)
         (Map (Credential 'Staking) UMElem))
-> DState era
-> Const (Map (Credential 'Staking) UMElem) (DState era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Map (Credential 'Staking) UMElem
 -> Const
      (Map (Credential 'Staking) UMElem)
      (Map (Credential 'Staking) UMElem))
-> UMap -> Const (Map (Credential 'Staking) UMElem) UMap
Lens' UMap (Map (Credential 'Staking) UMElem)
SL.umElemsL
       in ValuesMK
  (TxIn
     (LedgerState
        (HardForkBlock
           (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
  (TxOut
     (LedgerState
        (HardForkBlock
           (ShelleyBasedHardForkEras proto1 era1 proto2 era2))))
-> LedgerTables
     (LedgerState
        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
     ValuesMK
ValuesMK
  (CanonicalTxIn
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2))
  (NS
     WrapTxOut
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2))
-> LedgerTables
     (LedgerState
        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
     ValuesMK
forall (l :: LedgerStateKind) (mk :: MapKind).
mk (TxIn l) (TxOut l) -> LedgerTables l mk
LedgerTables (ValuesMK
   (CanonicalTxIn
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2))
   (NS
      WrapTxOut
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2))
 -> LedgerTables
      (LedgerState
         (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
      ValuesMK)
-> (Map
      (CanonicalTxIn
         (ShelleyBasedHardForkEras
            (TPraos (ProtoCrypto proto2))
            era1
            (TPraos (ProtoCrypto proto2))
            era2))
      (NS
         WrapTxOut
         (ShelleyBasedHardForkEras
            (TPraos (ProtoCrypto proto2))
            era1
            (TPraos (ProtoCrypto proto2))
            era2))
    -> ValuesMK
         (CanonicalTxIn
            (ShelleyBasedHardForkEras
               (TPraos (ProtoCrypto proto2))
               era1
               (TPraos (ProtoCrypto proto2))
               era2))
         (NS
            WrapTxOut
            (ShelleyBasedHardForkEras
               (TPraos (ProtoCrypto proto2))
               era1
               (TPraos (ProtoCrypto proto2))
               era2)))
-> Map
     (CanonicalTxIn
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
     (NS
        WrapTxOut
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
-> LedgerTables
     (LedgerState
        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
     ValuesMK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map
  (CanonicalTxIn
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2))
  (NS
     WrapTxOut
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2))
-> ValuesMK
     (CanonicalTxIn
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
     (NS
        WrapTxOut
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
forall k v. Map k v -> ValuesMK k v
ValuesMK (Map
   (CanonicalTxIn
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2))
   (NS
      WrapTxOut
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2))
 -> LedgerTables
      (LedgerState
         (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
      ValuesMK)
-> Decoder
     s
     (Map
        (CanonicalTxIn
           (ShelleyBasedHardForkEras
              (TPraos (ProtoCrypto proto2))
              era1
              (TPraos (ProtoCrypto proto2))
              era2))
        (NS
           WrapTxOut
           (ShelleyBasedHardForkEras
              (TPraos (ProtoCrypto proto2))
              era1
              (TPraos (ProtoCrypto proto2))
              era2)))
-> Decoder
     s
     (LedgerTables
        (LedgerState
           (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
        ValuesMK)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. Era era => Decoder s t -> Decoder s t
SL.eraDecoder @era (Decoder
  s
  (CanonicalTxIn
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2))
-> Decoder
     s
     (NS
        WrapTxOut
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
-> Decoder
     s
     (Map
        (CanonicalTxIn
           (ShelleyBasedHardForkEras
              (TPraos (ProtoCrypto proto2))
              era1
              (TPraos (ProtoCrypto proto2))
              era2))
        (NS
           WrapTxOut
           (ShelleyBasedHardForkEras
              (TPraos (ProtoCrypto proto2))
              era1
              (TPraos (ProtoCrypto proto2))
              era2)))
forall k s v.
Ord k =>
Decoder s k -> Decoder s v -> Decoder s (Map k v)
decodeMap (TxIn
-> CanonicalTxIn
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
forall proto1 era1 proto2 era2.
TxIn
-> CanonicalTxIn (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
ShelleyHFCTxIn (TxIn
 -> CanonicalTxIn
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2))
-> Decoder s TxIn
-> Decoder
     s
     (CanonicalTxIn
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s TxIn
forall a s. MemPack a => Decoder s a
decodeMemPack) (TxOut era
-> NS
     WrapTxOut
     (ShelleyBasedHardForkEras
        (TPraos (ProtoCrypto proto2))
        era1
        (TPraos (ProtoCrypto proto2))
        era2)
TxOut (LedgerState (ShelleyBlock proto era))
-> TxOut
     (LedgerState
        (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
toShelleyTxOut (TxOut era
 -> NS
      WrapTxOut
      (ShelleyBasedHardForkEras
         (TPraos (ProtoCrypto proto2))
         era1
         (TPraos (ProtoCrypto proto2))
         era2))
-> Decoder s (TxOut era)
-> Decoder
     s
     (NS
        WrapTxOut
        (ShelleyBasedHardForkEras
           (TPraos (ProtoCrypto proto2))
           era1
           (TPraos (ProtoCrypto proto2))
           era2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Share (TxOut era) -> Decoder s (TxOut era)
forall a s. DecShareCBOR a => Share a -> Decoder s a
forall s. Share (TxOut era) -> Decoder s (TxOut era)
decShareCBOR Share (TxOut era)
Interns (Credential 'Staking)
certInterns))

instance ShelleyBasedHardForkConstraints proto1 era1 proto2 era2
      => IndexedMemPack
          (LedgerState (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2)) EmptyMK)
          (DefaultHardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2)) where
  indexedTypeName :: LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
-> String
indexedTypeName LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
_ =
    forall a. MemPack a => String
typeName @(DefaultHardForkTxOut (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  indexedPackedByteCount :: LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
-> DefaultHardForkTxOut
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Int
indexedPackedByteCount LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
_ DefaultHardForkTxOut
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
txout =
    NS (K Int) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CollapseTo NS Int
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse (NS (K Int) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> CollapseTo NS Int)
-> NS (K Int) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CollapseTo NS Int
forall a b. (a -> b) -> a -> b
$
    Proxy MemPackTxOut
-> (forall a. MemPackTxOut a => WrapTxOut a -> K Int a)
-> DefaultHardForkTxOut
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS (K Int) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
       (xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
       (f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @MemPackTxOut)
      (Int -> K Int a
forall k a (b :: k). a -> K a b
K (Int -> K Int a) -> (WrapTxOut a -> Int) -> WrapTxOut a -> K Int a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxOut (LedgerState a) -> Int
forall a. MemPack a => a -> Int
packedByteCount (TxOut (LedgerState a) -> Int)
-> (WrapTxOut a -> TxOut (LedgerState a)) -> WrapTxOut a -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapTxOut a -> TxOut (LedgerState a)
forall blk. WrapTxOut blk -> TxOut (LedgerState blk)
unwrapTxOut)
      DefaultHardForkTxOut
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
txout
  indexedPackM :: forall s.
LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
-> DefaultHardForkTxOut
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Pack s ()
indexedPackM LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
_ =
    NS
  (K (Pack s ())) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> CollapseTo NS (Pack s ())
NS
  (K (Pack s ())) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Pack s ()
forall (xs :: [*]) a.
SListIN NS xs =>
NS (K a) xs -> CollapseTo NS a
forall k l (h :: (k -> *) -> l -> *) (xs :: l) a.
(HCollapse h, SListIN h xs) =>
h (K a) xs -> CollapseTo h a
hcollapse (NS
   (K (Pack s ())) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> Pack s ())
-> (DefaultHardForkTxOut
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
    -> NS
         (K (Pack s ())) (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> DefaultHardForkTxOut
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Pack s ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy MemPackTxOut
-> (forall a.
    MemPackTxOut a =>
    Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) a
    -> WrapTxOut a -> K (Pack s ()) a)
-> DefaultHardForkTxOut
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (K (Pack s ())) (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall {k} (h :: (k -> *) -> [k] -> *) (c :: k -> Constraint)
       (xs :: [k]) (proxy :: (k -> Constraint) -> *) (f1 :: k -> *)
       (f2 :: k -> *).
(HAp h, All c xs, Prod h ~ NP) =>
proxy c
-> (forall (a :: k). c a => Index xs a -> f1 a -> f2 a)
-> h f1 xs
-> h f2 xs
hcimap
      (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @MemPackTxOut)
      (\Index (ShelleyBasedHardForkEras proto1 era1 proto2 era2) a
_ (WrapTxOut TxOut (LedgerState a)
txout) -> Pack s () -> K (Pack s ()) a
forall k a (b :: k). a -> K a b
K (Pack s () -> K (Pack s ()) a) -> Pack s () -> K (Pack s ()) a
forall a b. (a -> b) -> a -> b
$ do
         TxOut (LedgerState a) -> Pack s ()
forall a s. MemPack a => a -> Pack s ()
forall s. TxOut (LedgerState a) -> Pack s ()
packM TxOut (LedgerState a)
txout
      )
  indexedUnpackM :: forall b.
Buffer b =>
LedgerState
  (HardForkBlock (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
  EmptyMK
-> Unpack
     b
     (DefaultHardForkTxOut
        (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
indexedUnpackM (HardForkLedgerState (HardForkState Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
idx)) = do
    NS
  (Unpack b :.: WrapTxOut)
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Unpack
     b
     (DefaultHardForkTxOut
        (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
forall (xs :: [*]) (f :: * -> *) (g :: * -> *).
(SListIN NS xs, Applicative f) =>
NS (f :.: g) xs -> f (NS g xs)
forall k l (h :: (k -> *) -> l -> *) (xs :: l) (f :: * -> *)
       (g :: k -> *).
(HSequence h, SListIN h xs, Applicative f) =>
h (f :.: g) xs -> f (h g xs)
hsequence'
      (NS
   (Unpack b :.: WrapTxOut)
   (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> Unpack
      b
      (DefaultHardForkTxOut
         (ShelleyBasedHardForkEras proto1 era1 proto2 era2)))
-> NS
     (Unpack b :.: WrapTxOut)
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> Unpack
     b
     (DefaultHardForkTxOut
        (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
forall a b. (a -> b) -> a -> b
$ Proxy MemPackTxOut
-> (forall a.
    MemPackTxOut a =>
    Current (Flip LedgerState EmptyMK) a
    -> (:.:) (Unpack b) WrapTxOut a)
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Unpack b :.: WrapTxOut)
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
       (xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
       (f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap
          (forall {k} (t :: k). Proxy t
forall (t :: * -> Constraint). Proxy t
Proxy @MemPackTxOut)
          ((:.:) (Unpack b) WrapTxOut a
-> Current (Flip LedgerState EmptyMK) a
-> (:.:) (Unpack b) WrapTxOut a
forall a b. a -> b -> a
const ((:.:) (Unpack b) WrapTxOut a
 -> Current (Flip LedgerState EmptyMK) a
 -> (:.:) (Unpack b) WrapTxOut a)
-> (:.:) (Unpack b) WrapTxOut a
-> Current (Flip LedgerState EmptyMK) a
-> (:.:) (Unpack b) WrapTxOut a
forall a b. (a -> b) -> a -> b
$ Unpack b (WrapTxOut a) -> (:.:) (Unpack b) WrapTxOut a
forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp (Unpack b (WrapTxOut a) -> (:.:) (Unpack b) WrapTxOut a)
-> Unpack b (WrapTxOut a) -> (:.:) (Unpack b) WrapTxOut a
forall a b. (a -> b) -> a -> b
$ TxOut (LedgerState a) -> WrapTxOut a
forall blk. TxOut (LedgerState blk) -> WrapTxOut blk
WrapTxOut (TxOut (LedgerState a) -> WrapTxOut a)
-> Unpack b (TxOut (LedgerState a)) -> Unpack b (WrapTxOut a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Unpack b (TxOut (LedgerState a))
forall a b. (MemPack a, Buffer b) => Unpack b a
forall b. Buffer b => Unpack b (TxOut (LedgerState a))
unpackM)
          (NS
   (Current (Flip LedgerState EmptyMK))
   (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
 -> NS
      (Unpack b :.: WrapTxOut)
      (ShelleyBasedHardForkEras proto1 era1 proto2 era2))
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Unpack b :.: WrapTxOut)
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall a b. (a -> b) -> a -> b
$ Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
-> NS
     (Current (Flip LedgerState EmptyMK))
     (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
forall {k} (g :: k -> *) (f :: k -> *) (xs :: [k]).
Telescope g f xs -> NS f xs
Telescope.tip Telescope
  (K Past)
  (Current (Flip LedgerState EmptyMK))
  (ShelleyBasedHardForkEras proto1 era1 proto2 era2)
idx