-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Shelley Ledger Executable Model
@package shelley-spec-ledger
@version 0.1.0.0

module Cardano.Ledger.Compactible
class Compactible a where {
    data family CompactForm a :: Type;
}
toCompact :: Compactible a => a -> Maybe (CompactForm a)
fromCompact :: Compactible a => CompactForm a -> a


-- | This module defines core type families which we know to vary from era
--   to era.
--   
--   Families in this module should be indexed on era.
--   
--   It is intended for qualified import: &gt; import qualified
--   Cardano.Ledger.Core as Core
module Cardano.Ledger.Core

-- | The body of a transaction.
type family TxBody era :: Type

-- | A value is something which quantifies a transaction output.
type family Value era :: Type

-- | Scripts which may lock transaction outputs in this era
type family Script era :: Type

-- | AuxiliaryData which may be attached to a transaction
type family AuxiliaryData era :: Type

-- | Common constraints
--   
--   NOTE: <a>Ord</a> is not included, as <a>Ord</a> for a <tt>Block</tt>
--   or a <tt>NewEpochState</tt> doesn't make sense.
type ChainData t = (Eq t, Show t, NoThunks t, Typeable t)

-- | Constraints for serialising from/to CBOR
type SerialisableData t = (FromCBOR t, ToCBOR t)

-- | Constraints for serialising from/to CBOR using <a>Annotator</a>
type AnnotatedData t = (FromCBOR (Annotator t), ToCBOR t)


-- | Package all the crypto constraints into one place.
module Cardano.Ledger.Crypto
class (HashAlgorithm (HASH c), HashAlgorithm (ADDRHASH c), DSIGNAlgorithm (DSIGN c), KESAlgorithm (KES c), VRFAlgorithm (VRF c), ContextDSIGN (DSIGN c) ~ (), ContextKES (KES c) ~ (), ContextVRF (VRF c) ~ (), Typeable c) => Crypto c where {
    type family HASH c :: Type;
    type family ADDRHASH c :: Type;
    type family DSIGN c :: Type;
    type family KES c :: Type;
    type family VRF c :: Type;
}


-- | Support for multiple (Shelley-based) eras in the ledger.
module Cardano.Ledger.Era
class (Crypto (Crypto e), Typeable e) => Era e
type family Crypto e :: Type

-- | Map an era to its predecessor.
--   
--   For example:
--   
--   <pre>
--   type instance PreviousEra (AllegraEra c) = ShelleyEra c
--   </pre>
type family PreviousEra era :: Type

-- | Per-era context used for <a>TranslateEra</a>.
--   
--   This context will be passed to the translation instances of <i>all</i>
--   types of that particular era. In practice, most instances won't need
--   the context, but this approach makes the translation composable (as
--   opposed to having a separate context per type).
type family TranslationContext era :: Type

-- | Translation of types between eras, e.g., from Shelley to Allegra.
--   
--   When <tt>era</tt> is just a phantom type parameter, an empty
--   standalone deriving can be used:
--   
--   <pre>
--   newtype Foo era = Foo Int
--   
--   instance TranslateEra (Allegra c) Foo
--   </pre>
--   
--   Note that one could use <tt>DerivingAnyClass</tt> (<tt>deriving
--   (TranslateEra (Allegra c))</tt>), but this would introduce an
--   undesired coupling between the era-parametric type and (a) particular
--   era(s). The intention is to have a module with orphan instances per
--   era.
--   
--   In most cases, the <tt>era</tt> parameter won't be phantom, and a
--   manual instance will have to be written:
--   
--   <pre>
--   newtype Bar era = Bar (TxBody era)
--   
--   instance CryptoClass.Crypto c =&gt; TranslateEra (Allegra c) Bar where
--       translateEra ctxt = Bar &lt;$&gt; translateEra ctxt
--   
--   -- With the following instance being in scope:
--   instance CryptoClass.Crypto c =&gt; TranslatEra (Allegra c) TxBody
--   </pre>
--   
--   Note: we use <a>PreviousEra</a> instead of <tt>NextEra</tt> as an era
--   definitely knows its predecessor, but not necessarily its successor.
--   Moreover, one could argue that it makes more sense to define the
--   translation from era A to era B where era B is defined, than where era
--   A is defined.
class (Era era, Era (PreviousEra era)) => TranslateEra era f where {
    
    -- | Most translations should be infallible (default instance), but we
    --   leave the door open for partial translations.
    --   
    --   For a partial translation, override the default type to be <tt>()</tt>
    --   or a concrete error type.
    type family TranslationError era f :: Type;
    type TranslationError era f = Void;
}

-- | Translate a type <tt>f</tt> parameterised by the era from an era to
--   the era after it.
--   
--   The translation is a given the translation context of <tt>era</tt>.
--   
--   A default instance is provided for when the two types are
--   <a>Coercible</a>.
translateEra :: TranslateEra era f => TranslationContext era -> f (PreviousEra era) -> Except (TranslationError era f) (f era)

-- | Translate a type <tt>f</tt> parameterised by the era from an era to
--   the era after it.
--   
--   The translation is a given the translation context of <tt>era</tt>.
--   
--   A default instance is provided for when the two types are
--   <a>Coercible</a>.
translateEra :: (TranslateEra era f, Coercible (f (PreviousEra era)) (f era)) => TranslationContext era -> f (PreviousEra era) -> Except (TranslationError era f) (f era)

-- | Variant of <a>translateEra</a> for when <a>TranslationError</a> is
--   <a>Void</a> and the translation thus cannot fail.
translateEra' :: (TranslateEra era f, TranslationError era f ~ Void) => TranslationContext era -> f (PreviousEra era) -> f era

-- | Variant of <a>translateEra</a> for when <a>TranslationError</a> is
--   <tt>()</tt>, converting the result to a <a>Maybe</a>.
translateEraMaybe :: (TranslateEra era f, TranslationError era f ~ ()) => TranslationContext era -> f (PreviousEra era) -> Maybe (f era)

module Cardano.Ledger.Torsor
class Torsor a where {
    type family Delta a :: Type;
}
addDelta :: Torsor a => a -> Delta a -> a
toDelta :: Torsor a => a -> Delta a

module Shelley.Spec.Ledger.Coin

-- | The amount of value held by a transaction output.
newtype Coin
Coin :: Integer -> Coin
[unCoin] :: Coin -> Integer
data family CompactForm a :: Type
newtype DeltaCoin
DeltaCoin :: Integer -> DeltaCoin
word64ToCoin :: Word64 -> Coin
coinToRational :: Coin -> Rational
rationalToCoinViaFloor :: Rational -> Coin
addDeltaCoin :: Coin -> DeltaCoin -> Coin
toDeltaCoin :: Coin -> DeltaCoin
integerToWord64 :: Integer -> Maybe Word64
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Coin.Coin
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.Coin.Coin
instance Data.PartialOrd.PartialOrd Shelley.Spec.Ledger.Coin.Coin
instance Data.Group.Abelian Shelley.Spec.Ledger.Coin.Coin
instance Data.Group.Group Shelley.Spec.Ledger.Coin.Coin
instance GHC.Base.Monoid Shelley.Spec.Ledger.Coin.Coin
instance GHC.Base.Semigroup Shelley.Spec.Ledger.Coin.Coin
instance GHC.Show.Show Shelley.Spec.Ledger.Coin.Coin
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.Coin.Coin
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.Coin.Coin
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.Coin.Coin
instance GHC.Generics.Generic Shelley.Spec.Ledger.Coin.Coin
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Coin.Coin
instance GHC.Enum.Enum Shelley.Spec.Ledger.Coin.Coin
instance GHC.Classes.Ord Shelley.Spec.Ledger.Coin.Coin
instance GHC.Classes.Eq Shelley.Spec.Ledger.Coin.Coin
instance NoThunks.Class.NoThunks (Cardano.Ledger.Compactible.CompactForm Shelley.Spec.Ledger.Coin.Coin)
instance GHC.Show.Show (Cardano.Ledger.Compactible.CompactForm Shelley.Spec.Ledger.Coin.Coin)
instance GHC.Classes.Eq (Cardano.Ledger.Compactible.CompactForm Shelley.Spec.Ledger.Coin.Coin)
instance Data.PartialOrd.PartialOrd Shelley.Spec.Ledger.Coin.DeltaCoin
instance Data.Group.Abelian Shelley.Spec.Ledger.Coin.DeltaCoin
instance Data.Group.Group Shelley.Spec.Ledger.Coin.DeltaCoin
instance GHC.Base.Monoid Shelley.Spec.Ledger.Coin.DeltaCoin
instance GHC.Base.Semigroup Shelley.Spec.Ledger.Coin.DeltaCoin
instance GHC.Show.Show Shelley.Spec.Ledger.Coin.DeltaCoin
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Coin.DeltaCoin
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.Coin.DeltaCoin
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.Coin.DeltaCoin
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Coin.DeltaCoin
instance GHC.Enum.Enum Shelley.Spec.Ledger.Coin.DeltaCoin
instance GHC.Generics.Generic Shelley.Spec.Ledger.Coin.DeltaCoin
instance GHC.Classes.Ord Shelley.Spec.Ledger.Coin.DeltaCoin
instance GHC.Classes.Eq Shelley.Spec.Ledger.Coin.DeltaCoin
instance Cardano.Ledger.Torsor.Torsor Shelley.Spec.Ledger.Coin.Coin
instance Cardano.Ledger.Compactible.Compactible Shelley.Spec.Ledger.Coin.Coin
instance Cardano.Binary.ToCBOR.ToCBOR (Cardano.Ledger.Compactible.CompactForm Shelley.Spec.Ledger.Coin.Coin)
instance Cardano.Binary.FromCBOR.FromCBOR (Cardano.Ledger.Compactible.CompactForm Shelley.Spec.Ledger.Coin.Coin)


-- | This module defines a generalised notion of a "value" - that is,
--   something with which we may quantify a transaction output.
module Cardano.Ledger.Val
class (Abelian t, Eq t) => Val t

-- | the value with nothing in it
zero :: Val t => t

-- | add two value
(<+>) :: Val t => t -> t -> t

-- | scale a value by an Integral constant
(<×>) :: (Val t, Integral i) => i -> t -> t

-- | subtract two values
(<->) :: Val t => t -> t -> t

-- | Is the argument zero?
isZero :: Val t => t -> Bool

-- | Get the ADA present in the value (since ADA is our "blessed" currency)
coin :: Val t => t -> Coin

-- | Create a value containing only this amount of ADA
inject :: Val t => Coin -> t

-- | modify the blessed Coin part of t
modifyCoin :: Val t => (Coin -> Coin) -> t -> t
size :: Val t => t -> Integer

-- | used to compare values pointwise. Rather than using: (v1 &lt;= v2)
--   use: pointwise (&lt;=) v1 v2 | If a quantity is stored in only one of
--   <tt>v1</tt> or <tt>v2</tt>, we use 0 for the missing quantity.
pointwise :: Val t => (Integer -> Integer -> Bool) -> t -> t -> Bool
infixl 6 <+>
infixl 6 <->
infixl 7 <×>
scale :: (Val t, Integral i) => i -> t -> t
invert :: Val t => t -> t
sumVal :: (Foldable t, Val v) => t v -> v
scaledMinDeposit :: Val v => v -> Coin -> Coin
class DecodeNonNegative v
decodeNonNegative :: DecodeNonNegative v => Decoder s v
class DecodeMint v
decodeMint :: DecodeMint v => Decoder s v
class EncodeMint v
encodeMint :: EncodeMint v => v -> Encoding
instance Cardano.Ledger.Val.Val Shelley.Spec.Ledger.Coin.DeltaCoin
instance Cardano.Ledger.Val.EncodeMint Shelley.Spec.Ledger.Coin.Coin
instance Cardano.Ledger.Val.DecodeMint Shelley.Spec.Ledger.Coin.Coin
instance Cardano.Ledger.Val.DecodeNonNegative Shelley.Spec.Ledger.Coin.Coin
instance (Cardano.Ledger.Val.DecodeNonNegative a, Cardano.Ledger.Compactible.Compactible a, GHC.Show.Show a) => Cardano.Ledger.Val.DecodeNonNegative (Cardano.Ledger.Compactible.CompactForm a)
instance Cardano.Ledger.Val.Val Shelley.Spec.Ledger.Coin.Coin

module Shelley.Spec.Ledger.Hashing
class Era e => HashAnnotated a e | a -> e where {
    type family HashIndex a :: Type;
}
hashAnnotated :: HashAnnotated a e => a -> Hash (HASH (Crypto e)) (HashIndex a)
hashAnnotated :: (HashAnnotated a e, ToCBOR a) => a -> Hash (HASH (Crypto e)) (HashIndex a)
data EraIndependentTx
data EraIndependentTxBody
data EraIndependentBlockBody
data EraIndependentMetadata
data EraIndependentScript

module Cardano.Ledger.Shelley.Constraints
type TxBodyConstraints era = (ChainData (TxBody era), AnnotatedData (TxBody era), HashAnnotated (TxBody era) era, HashIndex (TxBody era) ~ EraIndependentTxBody)

-- | General constraints that will hold true for ledgers which are based on
--   Shelley, and share similar serialisation formats"
type ShelleyBased era = (Era era, Val (Value era), Compactible (Value era), DecodeNonNegative (Value era), ChainData (Value era), Eq (CompactForm (Value era)), SerialisableData (Value era), SerialisableData (CompactForm (Value era)), ChainData (Delta (Value era)), SerialisableData (Delta (Value era)), Torsor (Value era), TxBodyConstraints era, ChainData (Script era), AnnotatedData (Script era), ChainData (AuxiliaryData era), AnnotatedData (AuxiliaryData era))

module Shelley.Spec.Ledger.Serialization
class Typeable a => ToCBORGroup a
toCBORGroup :: ToCBORGroup a => a -> Encoding
encodedGroupSizeExpr :: ToCBORGroup a => (forall x. ToCBOR x => Proxy x -> Size) -> Proxy a -> Size
listLen :: ToCBORGroup a => a -> Word

-- | an upper bound for <a>listLen</a>, used in <a>Size</a> expressions.
listLenBound :: ToCBORGroup a => Proxy a -> Word
class Typeable a => FromCBORGroup a
fromCBORGroup :: FromCBORGroup a => Decoder s a
newtype CBORGroup a
CBORGroup :: a -> CBORGroup a
[unCBORGroup] :: CBORGroup a -> a
newtype CborSeq a
CborSeq :: Seq a -> CborSeq a
[unwrapCborSeq] :: CborSeq a -> Seq a
decodeList :: Decoder s a -> Decoder s [a]
decodeSeq :: Decoder s a -> Decoder s (Seq a)
decodeStrictSeq :: Decoder s a -> Decoder s (StrictSeq a)
decodeSet :: Ord a => Decoder s a -> Decoder s (Set a)
decodeMap :: Ord a => Decoder s a -> Decoder s b -> Decoder s (Map a b)
decodeMapContents :: Decoder s a -> Decoder s [a]
decodeMapTraverse :: (Ord a, Applicative t) => Decoder s (t a) -> Decoder s (t b) -> Decoder s (t (Map a b))
decodeMaybe :: Decoder s a -> Decoder s (Maybe a)
decodeRecordNamed :: Text -> (a -> Int) -> Decoder s a -> Decoder s a
decodeRecordSum :: String -> (Word -> Decoder s (Int, a)) -> Decoder s a
decodeNullMaybe :: Decoder s a -> Decoder s (Maybe a)
encodeFoldable :: (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldableEncoder :: Foldable f => (a -> Encoding) -> f a -> Encoding
encodeFoldableMapEncoder :: Foldable f => (Word -> a -> Maybe Encoding) -> f a -> Encoding
encodeNullMaybe :: (a -> Encoding) -> Maybe a -> Encoding
encodeMap :: (a -> Encoding) -> (b -> Encoding) -> Map a b -> Encoding
groupRecord :: forall a s. (ToCBORGroup a, FromCBORGroup a) => Decoder s a
ratioToCBOR :: ToCBOR a => Ratio a -> Encoding
ratioFromCBOR :: (Integral a, FromCBOR a) => Decoder s (Ratio a)
mapToCBOR :: (ToCBOR a, ToCBOR b) => Map a b -> Encoding
mapFromCBOR :: (Ord a, FromCBOR a, FromCBOR b) => Decoder s (Map a b)
ipv4ToBytes :: IPv4 -> ByteString
ipv4FromBytes :: ByteString -> Either String IPv4
ipv4ToCBOR :: IPv4 -> Encoding
ipv4FromCBOR :: Decoder s IPv4
ipv6ToBytes :: IPv6 -> ByteString
ipv6FromBytes :: ByteString -> Either String IPv6
ipv6ToCBOR :: IPv6 -> Encoding
ipv6FromCBOR :: Decoder s IPv6
listLenInt :: ToCBORGroup a => a -> Int

-- | Run a ByteString <a>Builder</a> using a strategy aimed at making
--   smaller things efficiently.
--   
--   It takes a size hint and produces a strict <tt>ByteString</tt>. This
--   will be fast when the size hint is the same or slightly bigger than
--   the true size.
runByteBuilder :: Int -> Builder -> ByteString
utcTimeToCBOR :: UTCTime -> Encoding
utcTimeFromCBOR :: Decoder s UTCTime
instance Data.Foldable.Foldable Shelley.Spec.Ledger.Serialization.CborSeq
instance Cardano.Binary.ToCBOR.ToCBOR a => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Serialization.CborSeq a)
instance Cardano.Binary.FromCBOR.FromCBOR a => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Serialization.CborSeq a)
instance (Shelley.Spec.Ledger.Serialization.FromCBORGroup a, Shelley.Spec.Ledger.Serialization.ToCBORGroup a) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Serialization.CBORGroup a)
instance Shelley.Spec.Ledger.Serialization.ToCBORGroup a => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Serialization.CBORGroup a)

module Shelley.Spec.Ledger.Metadata

-- | A generic metadatum type.
data Metadatum
Map :: [(Metadatum, Metadatum)] -> Metadatum
List :: [Metadatum] -> Metadatum
I :: !Integer -> Metadatum
B :: !ByteString -> Metadatum
S :: !Text -> Metadatum
data Metadata
pattern Metadata :: Map Word64 Metadatum -> Metadata
validMetadatum :: Metadatum -> Bool
instance GHC.Generics.Generic Shelley.Spec.Ledger.Metadata.Metadatum
instance GHC.Classes.Ord Shelley.Spec.Ledger.Metadata.Metadatum
instance GHC.Classes.Eq Shelley.Spec.Ledger.Metadata.Metadatum
instance GHC.Show.Show Shelley.Spec.Ledger.Metadata.Metadatum
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Metadata.Metadata
instance GHC.Generics.Generic Shelley.Spec.Ledger.Metadata.Metadata
instance GHC.Show.Show Shelley.Spec.Ledger.Metadata.Metadata
instance GHC.Classes.Eq Shelley.Spec.Ledger.Metadata.Metadata
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Metadata.Metadata
instance Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator Shelley.Spec.Ledger.Metadata.Metadata)
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Metadata.Metadatum
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Metadata.Metadatum
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.Metadata.Metadatum

module Shelley.Spec.Ledger.Keys

-- | The role of a key.
--   
--   Note that a role is not _fixed_, nor is it unique. In particular, keys
--   may variously be used as witnesses, and so in many case we will change
--   the role of a key to the <a>Witness</a> role.
--   
--   It is also perfectly allowable for a key to be used in many roles;
--   there is nothing prohibiting somebody using the same underlying key as
--   their payment and staking key, as well as the key for their stake
--   pool. So these roles are more intended for two purposes:
--   
--   <ul>
--   <li>To make explicit how we are using a key in the specifications</li>
--   <li>To provide a guide to downstream implementors, for whom the
--   profusion of keys may be confusing.</li>
--   </ul>
data KeyRole
Genesis :: KeyRole
GenesisDelegate :: KeyRole
Payment :: KeyRole
Staking :: KeyRole
StakePool :: KeyRole
BlockIssuer :: KeyRole
Witness :: KeyRole
class HasKeyRole (a :: KeyRole -> Type -> Type)

-- | General coercion of key roles.
--   
--   The presence of this function is mostly to help the user realise where
--   they are converting key roles.
coerceKeyRole :: HasKeyRole a => a r crypto -> a r' crypto

-- | General coercion of key roles.
--   
--   The presence of this function is mostly to help the user realise where
--   they are converting key roles.
coerceKeyRole :: (HasKeyRole a, Coercible (a r crypto) (a r' crypto)) => a r crypto -> a r' crypto

-- | Use a key as a witness.
--   
--   This is the most common coercion between key roles, because most keys
--   can be used as witnesses to some types of transaction. As such, we
--   provide an explicit coercion for it.
asWitness :: HasKeyRole a => a r crypto -> a 'Witness crypto
type DSignable c = Signable (DSIGN c)

-- | Discriminated verification key
--   
--   We wrap the basic <tt>VerKeyDSIGN</tt> in order to add the key role.
newtype VKey (kd :: KeyRole) crypto
VKey :: VerKeyDSIGN (DSIGN crypto) -> VKey (kd :: KeyRole) crypto
[unVKey] :: VKey (kd :: KeyRole) crypto -> VerKeyDSIGN (DSIGN crypto)

-- | Pair of signing key and verification key, with a usage role.
data KeyPair (kd :: KeyRole) crypto
KeyPair :: !VKey kd crypto -> !SignKeyDSIGN (DSIGN crypto) -> KeyPair (kd :: KeyRole) crypto
[vKey] :: KeyPair (kd :: KeyRole) crypto -> !VKey kd crypto
[sKey] :: KeyPair (kd :: KeyRole) crypto -> !SignKeyDSIGN (DSIGN crypto)

-- | Produce a digital signature
signedDSIGN :: (Crypto crypto, Signable (DSIGN crypto) a) => SignKeyDSIGN (DSIGN crypto) -> a -> SignedDSIGN crypto a

-- | Verify a digital signature
verifySignedDSIGN :: (Crypto crypto, Signable (DSIGN crypto) a) => VKey kd crypto -> a -> SignedDSIGN crypto a -> Bool

-- | Discriminated hash of public Key
newtype KeyHash (discriminator :: KeyRole) crypto
KeyHash :: Hash (ADDRHASH crypto) (VerKeyDSIGN (DSIGN crypto)) -> KeyHash (discriminator :: KeyRole) crypto

-- | Hash a given public key
hashKey :: Crypto crypto => VKey kd crypto -> KeyHash kd crypto
data GenDelegPair crypto
GenDelegPair :: !KeyHash 'GenesisDelegate crypto -> !Hash crypto (VerKeyVRF crypto) -> GenDelegPair crypto
[genDelegKeyHash] :: GenDelegPair crypto -> !KeyHash 'GenesisDelegate crypto
[genDelegVrfHash] :: GenDelegPair crypto -> !Hash crypto (VerKeyVRF crypto)
newtype GenDelegs crypto
GenDelegs :: Map (KeyHash 'Genesis crypto) (GenDelegPair crypto) -> GenDelegs crypto
[unGenDelegs] :: GenDelegs crypto -> Map (KeyHash 'Genesis crypto) (GenDelegPair crypto)
newtype GKeys crypto
GKeys :: Set (VKey 'Genesis crypto) -> GKeys crypto
[unGKeys] :: GKeys crypto -> Set (VKey 'Genesis crypto)
type KESignable c = Signable (KES c)
type VRFSignable c = Signable (VRF c)
decodeSignedDSIGN :: DSIGNAlgorithm v => Decoder s (SignedDSIGN v a)
encodeSignedDSIGN :: DSIGNAlgorithm v => SignedDSIGN v a -> Encoding

-- | A variation on <a>hashWith</a>, but specially for CBOR encodings.
hashWithSerialiser :: HashAlgorithm h => (a -> Encoding) -> a -> Hash h a
decodeSignedKES :: KESAlgorithm v => Decoder s (SignedKES v a)
decodeVerKeyKES :: KESAlgorithm v => Decoder s (VerKeyKES v)
encodeSignedKES :: KESAlgorithm v => SignedKES v a -> Encoding
encodeVerKeyKES :: KESAlgorithm v => VerKeyKES v -> Encoding
signedKES :: (KESAlgorithm v, Signable v a) => ContextKES v -> Period -> a -> SignKeyKES v -> SignedKES v a

-- | Update the KES signature key to the <i>next</i> period, given the
--   <i>current</i> period.
--   
--   It returns <a>Nothing</a> if the cannot be evolved any further.
--   
--   The precondition (to get a <a>Just</a> result) is that the current KES
--   period of the input key is not the last period. The given period must
--   be the current KES period of the input key (not the next or target).
--   
--   The postcondition is that in case a key is returned, its current KES
--   period is incremented by one compared to before.
--   
--   Note that you must track the current period separately, and to skip to
--   a later period requires repeated use of this function, since it only
--   increments one period at once.
updateKES :: KESAlgorithm v => ContextKES v -> SignKeyKES v -> Period -> Maybe (SignKeyKES v)
verifyKES :: (KESAlgorithm v, Signable v a, HasCallStack) => ContextKES v -> VerKeyKES v -> Period -> a -> SigKES v -> Either String ()
verifySignedKES :: (KESAlgorithm v, Signable v a) => ContextKES v -> VerKeyKES v -> Period -> a -> SignedKES v a -> Either String ()
decodeVerKeyVRF :: VRFAlgorithm v => Decoder s (VerKeyVRF v)
encodeVerKeyVRF :: VRFAlgorithm v => VerKeyVRF v -> Encoding
hashVerKeyVRF :: (VRFAlgorithm v, HashAlgorithm h) => VerKeyVRF v -> Hash h (VerKeyVRF v)
verifyVRF :: (VRFAlgorithm v, HasCallStack, Signable v a) => ContextVRF v -> VerKeyVRF v -> a -> (OutputVRF v, CertVRF v) -> Bool
type CertifiedVRF c = CertifiedVRF (VRF c)
type Hash c = Hash (HASH c)
type SignedDSIGN c = SignedDSIGN (DSIGN c)
type SignKeyDSIGN c = SignKeyDSIGN (DSIGN c)
type SignedKES c = SignedKES (KES c)
type SignKeyKES c = SignKeyKES (KES c)
type SignKeyVRF c = SignKeyVRF (VRF c)
type VerKeyKES c = VerKeyKES (KES c)
type VerKeyVRF c = VerKeyVRF (VRF c)
instance GHC.Show.Show Shelley.Spec.Ledger.Keys.KeyRole
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Keys.VKey kd crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.Keys.KeyPair kd crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Keys.KeyPair kd crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Keys.KeyHash discriminator crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Keys.KeyHash discriminator crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Keys.KeyHash discriminator crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Keys.KeyHash discriminator crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Keys.KeyHash discriminator crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Keys.KeyHash discriminator crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.Keys.GKeys crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Keys.GKeys crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Keys.GKeys crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Eq (Shelley.Spec.Ledger.Keys.GKeys crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Keys.GenDelegs crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Keys.GenDelegs crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Keys.GenDelegs crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Keys.GenDelegs crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Keys.GenDelegs crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Keys.GenDelegs crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.Keys.VKey kd crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Eq (Shelley.Spec.Ledger.Keys.VKey kd crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Control.DeepSeq.NFData (Cardano.Crypto.DSIGN.Class.VerKeyDSIGN (Cardano.Ledger.Crypto.DSIGN crypto))) => Control.DeepSeq.NFData (Shelley.Spec.Ledger.Keys.VKey kd crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Keys.VKey kd crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Data.Typeable.Internal.Typeable disc) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Keys.KeyHash disc crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Data.Typeable.Internal.Typeable disc) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Keys.KeyHash disc crypto)
instance Data.Aeson.Types.ToJSON.ToJSONKey (Shelley.Spec.Ledger.Keys.KeyHash disc crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSONKey (Shelley.Spec.Ledger.Keys.KeyHash disc crypto)
instance Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.Keys.KeyHash disc crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.Keys.KeyHash disc crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Keys.GenDelegs crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.Keys.GenDelegPair crypto)
instance Shelley.Spec.Ledger.Keys.HasKeyRole Shelley.Spec.Ledger.Keys.KeyHash
instance (Cardano.Ledger.Crypto.Crypto crypto, Control.DeepSeq.NFData (Cardano.Crypto.DSIGN.Class.VerKeyDSIGN (Cardano.Ledger.Crypto.DSIGN crypto)), Control.DeepSeq.NFData (Cardano.Crypto.DSIGN.Class.SignKeyDSIGN (Cardano.Ledger.Crypto.DSIGN crypto))) => Control.DeepSeq.NFData (Shelley.Spec.Ledger.Keys.KeyPair kd crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Keys.KeyPair kd crypto)
instance Shelley.Spec.Ledger.Keys.HasKeyRole Shelley.Spec.Ledger.Keys.KeyPair
instance Shelley.Spec.Ledger.Keys.HasKeyRole Shelley.Spec.Ledger.Keys.VKey
instance (Cardano.Ledger.Crypto.Crypto crypto, Data.Typeable.Internal.Typeable kd) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Keys.VKey kd crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Data.Typeable.Internal.Typeable kd) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Keys.VKey kd crypto)

module Cardano.Ledger.AuxiliaryData
newtype AuxiliaryDataHash crypto
AuxiliaryDataHash :: Hash crypto EraIndependentMetadata -> AuxiliaryDataHash crypto
[unsafeAuxiliaryDataHash] :: AuxiliaryDataHash crypto -> Hash crypto EraIndependentMetadata
class ValidateAuxiliaryData era
hashAuxiliaryData :: ValidateAuxiliaryData era => AuxiliaryData era -> AuxiliaryDataHash (Crypto era)
validateAuxiliaryData :: ValidateAuxiliaryData era => AuxiliaryData era -> Bool
instance Control.DeepSeq.NFData (Cardano.Ledger.AuxiliaryData.AuxiliaryDataHash crypto)
instance NoThunks.Class.NoThunks (Cardano.Ledger.AuxiliaryData.AuxiliaryDataHash crypto)
instance GHC.Classes.Ord (Cardano.Ledger.AuxiliaryData.AuxiliaryDataHash crypto)
instance GHC.Classes.Eq (Cardano.Ledger.AuxiliaryData.AuxiliaryDataHash crypto)
instance GHC.Show.Show (Cardano.Ledger.AuxiliaryData.AuxiliaryDataHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Cardano.Ledger.AuxiliaryData.AuxiliaryDataHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Ledger.AuxiliaryData.AuxiliaryDataHash crypto)

module Shelley.Spec.Ledger.BaseTypes
type FixedPoint = Digits34
(==>) :: Bool -> Bool -> Bool
infix 1 ==>

-- | Evolve the nonce
(⭒) :: Nonce -> Nonce -> Nonce
data Network
Testnet :: Network
Mainnet :: Network
networkToWord8 :: Network -> Word8
word8ToNetwork :: Word8 -> Maybe Network

-- | Evolving nonce type.
data Nonce
Nonce :: !Hash Blake2b_256 Nonce -> Nonce

-- | Identity element
NeutralNonce :: Nonce

-- | Seed to the verifiable random function.
--   
--   We do not expose the constructor to <a>Seed</a>. Instead, a
--   <a>Seed</a> should be created using <tt>mkSeed</tt> for a VRF
--   calculation.
newtype Seed
Seed :: Hash Blake2b_256 Seed -> Seed

-- | Type to represent a value in the unit interval [0; 1]
data UnitInterval
fpPrecision :: FixedPoint
interval0 :: UnitInterval

-- | Get rational value of <a>UnitInterval</a> type
intervalValue :: UnitInterval -> Ratio Word64
unitIntervalToRational :: UnitInterval -> Rational
unitIntervalFromRational :: Rational -> UnitInterval
invalidKey :: Word -> Decoder s a

-- | Make a nonce from the VRF output bytes
mkNonceFromOutputVRF :: OutputVRF v -> Nonce

-- | Make a nonce from a number.
mkNonceFromNumber :: Word64 -> Nonce

-- | Return a <a>UnitInterval</a> type if <tt>r</tt> is in [0; 1].
mkUnitInterval :: Ratio Word64 -> Maybe UnitInterval

-- | Convert a rational to a <a>UnitInterval</a> by ignoring its integer
--   part.
truncateUnitInterval :: Ratio Word64 -> UnitInterval

-- | Strict <a>Maybe</a>.
--   
--   TODO move to <tt>cardano-prelude</tt>
data StrictMaybe a
SNothing :: StrictMaybe a
SJust :: !a -> StrictMaybe a
strictMaybeToMaybe :: StrictMaybe a -> Maybe a
maybeToStrictMaybe :: Maybe a -> StrictMaybe a
fromSMaybe :: a -> StrictMaybe a -> a
data Url
urlToText :: Url -> Text
textToUrl :: Text -> Maybe Url
data DnsName
dnsToText :: DnsName -> Text
textToDns :: Text -> Maybe DnsName
newtype Port
Port :: Word16 -> Port
[portToWord16] :: Port -> Word16
data ActiveSlotCoeff
mkActiveSlotCoeff :: UnitInterval -> ActiveSlotCoeff
activeSlotVal :: ActiveSlotCoeff -> UnitInterval
activeSlotLog :: ActiveSlotCoeff -> FixedPoint
data Globals
Globals :: !EpochInfo Identity -> !Word64 -> !Word64 -> !Word64 -> !Word64 -> !Word64 -> !Word64 -> !Natural -> !Word64 -> !ActiveSlotCoeff -> !Network -> Globals
[epochInfo] :: Globals -> !EpochInfo Identity
[slotsPerKESPeriod] :: Globals -> !Word64

-- | The window size in which our chosen chain growth property guarantees
--   at least k blocks. From the paper "Ouroboros praos: An
--   adaptively-secure, semi-synchronous proof-of-stake protocol". The
--   <a>stabilityWindow</a> constant is used in a number of places; for
--   example, protocol updates must be submitted at least twice this many
--   slots before an epoch boundary.
[stabilityWindow] :: Globals -> !Word64

-- | Number of slots before the end of the epoch at which we stop updating
--   the candidate nonce for the next epoch.
[randomnessStabilisationWindow] :: Globals -> !Word64

-- | Maximum number of blocks we are allowed to roll back
[securityParameter] :: Globals -> !Word64

-- | Maximum number of KES iterations
[maxKESEvo] :: Globals -> !Word64

-- | Quorum for update system votes and MIR certificates
[quorum] :: Globals -> !Word64

-- | All blocks invalid after this protocol version
[maxMajorPV] :: Globals -> !Natural

-- | Maximum number of lovelace in the system
[maxLovelaceSupply] :: Globals -> !Word64

-- | Active Slot Coefficient, named f in "Ouroboros Praos: An
--   adaptively-secure, semi-synchronous proof-of-stake protocol"
[activeSlotCoeff] :: Globals -> !ActiveSlotCoeff

-- | The network ID
[networkId] :: Globals -> !Network
type ShelleyBase = ReaderT Globals Identity
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance GHC.Classes.Eq Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance GHC.Classes.Ord Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance GHC.Show.Show Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.BaseTypes.Nonce
instance GHC.Show.Show Shelley.Spec.Ledger.BaseTypes.Nonce
instance GHC.Classes.Ord Shelley.Spec.Ledger.BaseTypes.Nonce
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.Nonce
instance GHC.Classes.Eq Shelley.Spec.Ledger.BaseTypes.Nonce
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.BaseTypes.Seed
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.Seed
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.Seed
instance GHC.Show.Show Shelley.Spec.Ledger.BaseTypes.Seed
instance GHC.Classes.Ord Shelley.Spec.Ledger.BaseTypes.Seed
instance GHC.Classes.Eq Shelley.Spec.Ledger.BaseTypes.Seed
instance Data.Traversable.Traversable Shelley.Spec.Ledger.BaseTypes.StrictMaybe
instance Data.Foldable.Foldable Shelley.Spec.Ledger.BaseTypes.StrictMaybe
instance GHC.Base.Functor Shelley.Spec.Ledger.BaseTypes.StrictMaybe
instance GHC.Generics.Generic (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance GHC.Show.Show a => GHC.Show.Show (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.BaseTypes.Url
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.BaseTypes.Url
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.Url
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.BaseTypes.Url
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.BaseTypes.Url
instance GHC.Show.Show Shelley.Spec.Ledger.BaseTypes.Url
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.Url
instance GHC.Classes.Ord Shelley.Spec.Ledger.BaseTypes.Url
instance GHC.Classes.Eq Shelley.Spec.Ledger.BaseTypes.Url
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.BaseTypes.DnsName
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.BaseTypes.DnsName
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.BaseTypes.DnsName
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.DnsName
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.BaseTypes.DnsName
instance GHC.Show.Show Shelley.Spec.Ledger.BaseTypes.DnsName
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.DnsName
instance GHC.Classes.Ord Shelley.Spec.Ledger.BaseTypes.DnsName
instance GHC.Classes.Eq Shelley.Spec.Ledger.BaseTypes.DnsName
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.BaseTypes.Port
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.BaseTypes.Port
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.Port
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.BaseTypes.Port
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.BaseTypes.Port
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.BaseTypes.Port
instance GHC.Num.Num Shelley.Spec.Ledger.BaseTypes.Port
instance GHC.Show.Show Shelley.Spec.Ledger.BaseTypes.Port
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.Port
instance GHC.Classes.Ord Shelley.Spec.Ledger.BaseTypes.Port
instance GHC.Classes.Eq Shelley.Spec.Ledger.BaseTypes.Port
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.ActiveSlotCoeff
instance GHC.Show.Show Shelley.Spec.Ledger.BaseTypes.ActiveSlotCoeff
instance GHC.Classes.Ord Shelley.Spec.Ledger.BaseTypes.ActiveSlotCoeff
instance GHC.Classes.Eq Shelley.Spec.Ledger.BaseTypes.ActiveSlotCoeff
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.Network
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.BaseTypes.Network
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.BaseTypes.Network
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.BaseTypes.Network
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.Network
instance GHC.Show.Show Shelley.Spec.Ledger.BaseTypes.Network
instance GHC.Enum.Bounded Shelley.Spec.Ledger.BaseTypes.Network
instance GHC.Enum.Enum Shelley.Spec.Ledger.BaseTypes.Network
instance GHC.Classes.Ord Shelley.Spec.Ledger.BaseTypes.Network
instance GHC.Classes.Eq Shelley.Spec.Ledger.BaseTypes.Network
instance GHC.Generics.Generic Shelley.Spec.Ledger.BaseTypes.Globals
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.BaseTypes.Nonce
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.BaseTypes.Nonce
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.Globals
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.BaseTypes.Network
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.BaseTypes.Network
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.ActiveSlotCoeff
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.BaseTypes.ActiveSlotCoeff
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.BaseTypes.ActiveSlotCoeff
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.BaseTypes.DnsName
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.BaseTypes.Url
instance NoThunks.Class.NoThunks a => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance GHC.Base.Applicative Shelley.Spec.Ledger.BaseTypes.StrictMaybe
instance GHC.Base.Monad Shelley.Spec.Ledger.BaseTypes.StrictMaybe
instance Control.Monad.Fail.MonadFail Shelley.Spec.Ledger.BaseTypes.StrictMaybe
instance Cardano.Binary.ToCBOR.ToCBOR a => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance Cardano.Binary.FromCBOR.FromCBOR a => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.BaseTypes.StrictMaybe a)
instance Cardano.Crypto.Util.SignableRepresentation Shelley.Spec.Ledger.BaseTypes.Seed
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.BaseTypes.Nonce
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.BaseTypes.Nonce
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.BaseTypes.Nonce
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.BaseTypes.UnitInterval
instance Data.Fixed.HasResolution Shelley.Spec.Ledger.BaseTypes.E34

module Shelley.Spec.Ledger.Scripts
data MultiSig crypto
pattern RequireAllOf :: Crypto crypto => [MultiSig crypto] -> MultiSig crypto
pattern RequireAnyOf :: Crypto crypto => [MultiSig crypto] -> MultiSig crypto
pattern RequireSignature :: Crypto crypto => KeyHash 'Witness crypto -> MultiSig crypto
pattern RequireMOf :: Crypto crypto => Int -> [MultiSig crypto] -> MultiSig crypto
getMultiSigBytes :: MultiSig crypto -> ShortByteString
newtype ScriptHash crypto
ScriptHash :: Hash (ADDRHASH crypto) EraIndependentScript -> ScriptHash crypto

-- | Hashes native multi-signature script.
hashMultiSigScript :: Crypto crypto => MultiSig crypto -> ScriptHash crypto

-- | Magic number representing the tag of the native multi-signature script
--   language. For each script language included, a new tag is chosen and
--   the tag is included in the script hash for a script.
nativeMultiSigTag :: ByteString
instance Data.Typeable.Internal.Typeable crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Scripts.MultiSigRaw crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Scripts.MultiSigRaw crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Scripts.MultiSigRaw crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Scripts.MultiSigRaw crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Scripts.MultiSigRaw crypto)
instance Data.Typeable.Internal.Typeable crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Scripts.MultiSig crypto)
instance Data.Typeable.Internal.Typeable crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Scripts.MultiSig crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Scripts.MultiSig crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Scripts.MultiSig crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Scripts.MultiSig crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Scripts.MultiSig crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.Scripts.MultiSig crypto))
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.Scripts.ScriptHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.Scripts.MultiSigRaw crypto))

module Shelley.Spec.Ledger.STS.Tickn
data TICKN
data TicknEnv
TicknEnv :: Nonce -> Nonce -> Nonce -> TicknEnv
[ticknEnvExtraEntropy] :: TicknEnv -> Nonce
[ticknEnvCandidateNonce] :: TicknEnv -> Nonce

-- | Hash of the last header of the previous epoch as a nonce.
[ticknEnvHashHeaderNonce] :: TicknEnv -> Nonce
data TicknState
TicknState :: !Nonce -> !Nonce -> TicknState
[ticknStateEpochNonce] :: TicknState -> !Nonce
[ticknStatePrevHashNonce] :: TicknState -> !Nonce
data TicknPredicateFailure

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
instance GHC.Generics.Generic Shelley.Spec.Ledger.STS.Tickn.TicknState
instance GHC.Classes.Eq Shelley.Spec.Ledger.STS.Tickn.TicknState
instance GHC.Show.Show Shelley.Spec.Ledger.STS.Tickn.TicknState
instance GHC.Classes.Eq Shelley.Spec.Ledger.STS.Tickn.TicknPredicateFailure
instance GHC.Show.Show Shelley.Spec.Ledger.STS.Tickn.TicknPredicateFailure
instance GHC.Generics.Generic Shelley.Spec.Ledger.STS.Tickn.TicknPredicateFailure
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.STS.Tickn.TicknPredicateFailure
instance Control.State.Transition.Extended.STS Shelley.Spec.Ledger.STS.Tickn.TICKN
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.STS.Tickn.TicknState
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.STS.Tickn.TicknState
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.STS.Tickn.TicknState

module Shelley.Spec.Ledger.Address.Bootstrap
data BootstrapWitness crypto
pattern BootstrapWitness :: Crypto crypto => VKey 'Witness crypto -> SignedDSIGN crypto (Hash crypto EraIndependentTxBody) -> ChainCode -> ByteString -> BootstrapWitness crypto
newtype ChainCode
ChainCode :: ByteString -> ChainCode
[unChainCode] :: ChainCode -> ByteString

-- | Rebuild the addrRoot of the corresponding address.
bootstrapWitKeyHash :: forall crypto. Crypto crypto => BootstrapWitness crypto -> KeyHash 'Witness crypto
unpackByronVKey :: forall crypto. DSIGN crypto ~ Ed25519DSIGN => VerificationKey -> (VKey 'Witness crypto, ChainCode)
makeBootstrapWitness :: forall crypto. (DSIGN crypto ~ Ed25519DSIGN, Crypto crypto) => Hash crypto EraIndependentTxBody -> SigningKey -> Attributes AddrAttributes -> BootstrapWitness crypto
verifyBootstrapWit :: forall crypto. (Crypto crypto, Signable (DSIGN crypto) (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> BootstrapWitness crypto -> Bool
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.Address.Bootstrap.ChainCode
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Address.Bootstrap.ChainCode
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Address.Bootstrap.ChainCode
instance GHC.Show.Show Shelley.Spec.Ledger.Address.Bootstrap.ChainCode
instance GHC.Generics.Generic Shelley.Spec.Ledger.Address.Bootstrap.ChainCode
instance GHC.Classes.Eq Shelley.Spec.Ledger.Address.Bootstrap.ChainCode
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Address.Bootstrap.BootstrapWitness crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.Address.Bootstrap.BootstrapWitness crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Eq (Shelley.Spec.Ledger.Address.Bootstrap.BootstrapWitness crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Address.Bootstrap.BootstrapWitness crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Ord (Shelley.Spec.Ledger.Address.Bootstrap.BootstrapWitness crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Address.Bootstrap.BootstrapWitness crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.Address.Bootstrap.BootstrapWitness crypto))

module Shelley.Spec.Ledger.Slot

-- | The 0-based index for the Ourboros time slot.
newtype SlotNo
SlotNo :: Word64 -> SlotNo
[unSlotNo] :: SlotNo -> Word64
newtype Duration
Duration :: Word64 -> Duration
[unDuration] :: Duration -> Word64
(-*) :: SlotNo -> SlotNo -> Duration
(+*) :: SlotNo -> Duration -> SlotNo

-- | Subtract a duration from a slot
(*-) :: SlotNo -> Duration -> SlotNo

-- | An epoch, i.e. the number of the epoch.
newtype EpochNo
EpochNo :: Word64 -> EpochNo
[unEpochNo] :: EpochNo -> Word64
newtype EpochSize
EpochSize :: Word64 -> EpochSize
[unEpochSize] :: EpochSize -> Word64

-- | Information about epochs
--   
--   Epochs may have different sizes at different times during the lifetime
--   of the blockchain. This information is encapsulated by
--   <a>EpochInfo</a>; it is parameterized over a monad <tt>m</tt> because
--   the information about how long each epoch is may depend on information
--   derived from the blockchain itself, and hence requires access to
--   state.
--   
--   The other functions provide some derived information from epoch sizes.
--   In the default implementation all of these functions query and update
--   an internal cache maintaining cumulative epoch sizes; for that reason,
--   all of these functions live in a monad <tt>m</tt>.
data EpochInfo (m :: Type -> Type)

-- | The 0-based index of the block in the blockchain. BlockNo is &lt;=
--   SlotNo and is only equal at slot N if there is a block for every slot
--   where N &lt;= SlotNo.
newtype BlockNo
BlockNo :: Word64 -> BlockNo
[unBlockNo] :: BlockNo -> Word64
epochInfoEpoch :: HasCallStack => EpochInfo Identity -> SlotNo -> ShelleyBase EpochNo
epochInfoFirst :: HasCallStack => EpochInfo Identity -> EpochNo -> ShelleyBase SlotNo
epochInfoSize :: HasCallStack => EpochInfo Identity -> EpochNo -> ShelleyBase EpochSize
instance GHC.Show.Show Shelley.Spec.Ledger.Slot.Duration
instance GHC.Enum.Enum Shelley.Spec.Ledger.Slot.Duration
instance GHC.Real.Real Shelley.Spec.Ledger.Slot.Duration
instance GHC.Real.Integral Shelley.Spec.Ledger.Slot.Duration
instance GHC.Num.Num Shelley.Spec.Ledger.Slot.Duration
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Slot.Duration
instance GHC.Classes.Ord Shelley.Spec.Ledger.Slot.Duration
instance GHC.Generics.Generic Shelley.Spec.Ledger.Slot.Duration
instance GHC.Classes.Eq Shelley.Spec.Ledger.Slot.Duration
instance GHC.Base.Semigroup Shelley.Spec.Ledger.Slot.Duration
instance GHC.Base.Monoid Shelley.Spec.Ledger.Slot.Duration

module Shelley.Spec.Ledger.STS.Updn
data UPDN crypto
newtype UpdnEnv

-- | New nonce
UpdnEnv :: Nonce -> UpdnEnv
data UpdnState
UpdnState :: Nonce -> Nonce -> UpdnState

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data UpdnPredicateFailure crypto
instance GHC.Classes.Eq Shelley.Spec.Ledger.STS.Updn.UpdnState
instance GHC.Show.Show Shelley.Spec.Ledger.STS.Updn.UpdnState
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Updn.UpdnPredicateFailure crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Updn.UpdnPredicateFailure crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Updn.UpdnPredicateFailure crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Updn.UpdnPredicateFailure crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Updn.UPDN crypto)

module Shelley.Spec.Ledger.OverlaySchedule
isOverlaySlot :: SlotNo -> UnitInterval -> SlotNo -> Bool
classifyOverlaySlot :: SlotNo -> Set (KeyHash 'Genesis crypto) -> UnitInterval -> ActiveSlotCoeff -> SlotNo -> OBftSlot crypto
lookupInOverlaySchedule :: SlotNo -> Set (KeyHash 'Genesis crypto) -> UnitInterval -> ActiveSlotCoeff -> SlotNo -> Maybe (OBftSlot crypto)
data OBftSlot crypto
NonActiveSlot :: OBftSlot crypto
ActiveSlot :: !KeyHash 'Genesis crypto -> OBftSlot crypto

-- | Return the list of overlaySlots for a given epoch. Note that this
--   linear in the size of the epoch, and should probably only be used for
--   testing. If something more performant is needed, we could probably use
--   [start + floor(x<i>d) | x &lt;- [0 .. (spe -1)], floor(x</i>d) &lt;
--   spe] but we would need to make sure that this is equivalent.
overlaySlots :: SlotNo -> UnitInterval -> EpochSize -> [SlotNo]
instance GHC.Generics.Generic (Shelley.Spec.Ledger.OverlaySchedule.OBftSlot crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.OverlaySchedule.OBftSlot crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.OverlaySchedule.OBftSlot crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.OverlaySchedule.OBftSlot crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.OverlaySchedule.OBftSlot crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.OverlaySchedule.OBftSlot crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.OverlaySchedule.OBftSlot crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.OverlaySchedule.OBftSlot crypto)

module Shelley.Spec.Ledger.Orphans
instance Data.Aeson.Types.FromJSON.FromJSON Data.IP.Addr.IPv4
instance Data.Aeson.Types.ToJSON.ToJSON Data.IP.Addr.IPv4
instance Data.Aeson.Types.FromJSON.FromJSON Data.IP.Addr.IPv6
instance Data.Aeson.Types.ToJSON.ToJSON Data.IP.Addr.IPv6
instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Data.Sequence.Strict.StrictSeq a)
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Data.Sequence.Strict.StrictSeq a)
instance NoThunks.Class.NoThunks Data.IP.Addr.IPv4
instance NoThunks.Class.NoThunks Data.IP.Addr.IPv6
instance Control.DeepSeq.NFData Data.IP.Addr.IPv4
instance Control.DeepSeq.NFData Data.IP.Addr.IPv6
instance Control.DeepSeq.NFData Cardano.Slotting.Slot.EpochNo
instance Control.DeepSeq.NFData (Data.Sequence.Strict.StrictSeq a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Cardano.Slotting.Slot.WithOrigin a)
instance Control.DeepSeq.NFData Cardano.Slotting.Block.BlockNo
instance NoThunks.Class.NoThunks Cardano.Crypto.Wallet.XSignature
instance Cardano.Crypto.Util.SignableRepresentation (Cardano.Crypto.Hash.Class.Hash a b)


-- | This module contains just the type of protocol parameters.
module Shelley.Spec.Ledger.PParams

-- | Protocol parameters.
--   
--   We use the HKD type family so that the protocol parameters type and
--   the type for the updates to the protocol parameters can share records
--   fields. The protocol parameters will have type <a>PParams'</a>
--   <a>Identity</a>, and the updates will have type <a>PParams'</a>
--   <a>StrictMaybe</a>, though <a>Identity</a> will be hidden from use.
--   
--   For example:
--   
--   <pre>
--   myParameters =
--     PParams
--       { _minfeeA = 0,
--         _minfeeB = 0,
--         ...
--       }
--   
--   myUpdate =
--     PParamsUpdate
--       { _minfeeA = SNothing,
--         _minfeeB = SJust 42,
--         ...
--       }
--   </pre>
data PParams' f era
PParams :: !HKD f Natural -> !HKD f Natural -> !HKD f Natural -> !HKD f Natural -> !HKD f Natural -> !HKD f Coin -> !HKD f Coin -> !HKD f EpochNo -> !HKD f Natural -> !HKD f Rational -> !HKD f UnitInterval -> !HKD f UnitInterval -> !HKD f UnitInterval -> !HKD f Nonce -> !HKD f ProtVer -> !HKD f Coin -> !HKD f Coin -> PParams' f era

-- | The linear factor for the minimum fee calculation
[_minfeeA] :: PParams' f era -> !HKD f Natural

-- | The constant factor for the minimum fee calculation
[_minfeeB] :: PParams' f era -> !HKD f Natural

-- | Maximal block body size
[_maxBBSize] :: PParams' f era -> !HKD f Natural

-- | Maximal transaction size
[_maxTxSize] :: PParams' f era -> !HKD f Natural

-- | Maximal block header size
[_maxBHSize] :: PParams' f era -> !HKD f Natural

-- | The amount of a key registration deposit
[_keyDeposit] :: PParams' f era -> !HKD f Coin

-- | The amount of a pool registration deposit
[_poolDeposit] :: PParams' f era -> !HKD f Coin

-- | epoch bound on pool retirement
[_eMax] :: PParams' f era -> !HKD f EpochNo

-- | Desired number of pools
[_nOpt] :: PParams' f era -> !HKD f Natural

-- | Pool influence
[_a0] :: PParams' f era -> !HKD f Rational

-- | Monetary expansion
[_rho] :: PParams' f era -> !HKD f UnitInterval

-- | Treasury expansion
[_tau] :: PParams' f era -> !HKD f UnitInterval

-- | Decentralization parameter
[_d] :: PParams' f era -> !HKD f UnitInterval

-- | Extra entropy
[_extraEntropy] :: PParams' f era -> !HKD f Nonce

-- | Protocol version
[_protocolVersion] :: PParams' f era -> !HKD f ProtVer

-- | Minimum UTxO value
[_minUTxOValue] :: PParams' f era -> !HKD f Coin

-- | Minimum Stake Pool Cost
[_minPoolCost] :: PParams' f era -> !HKD f Coin
type PParams era = PParams' Identity era

-- | Returns a basic "empty" <a>PParams</a> structure with all zero values.
emptyPParams :: PParams era
data ProtVer
ProtVer :: !Natural -> !Natural -> ProtVer
[pvMajor] :: ProtVer -> !Natural
[pvMinor] :: ProtVer -> !Natural
data PPUpdateEnv era
PPUpdateEnv :: SlotNo -> GenDelegs era -> PPUpdateEnv era

-- | Update operation for protocol parameters structure @PParams
newtype ProposedPPUpdates era
ProposedPPUpdates :: Map (KeyHash 'Genesis (Crypto era)) (PParamsUpdate era) -> ProposedPPUpdates era
emptyPPPUpdates :: ProposedPPUpdates era
type PParamsUpdate era = PParams' StrictMaybe era
emptyPParamsUpdate :: PParamsUpdate era

-- | Update Proposal
data Update era
Update :: !ProposedPPUpdates era -> !EpochNo -> Update era
updatePParams :: PParams era -> PParamsUpdate era -> PParams era
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.PParams.ProtVer
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.PParams.ProtVer
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.PParams.ProtVer
instance GHC.Classes.Ord Shelley.Spec.Ledger.PParams.ProtVer
instance GHC.Generics.Generic Shelley.Spec.Ledger.PParams.ProtVer
instance GHC.Classes.Eq Shelley.Spec.Ledger.PParams.ProtVer
instance GHC.Show.Show Shelley.Spec.Ledger.PParams.ProtVer
instance GHC.Generics.Generic (Shelley.Spec.Ledger.PParams.PParams' f era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.PParams.PPUpdateEnv era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.PParams.PPUpdateEnv era)
instance GHC.Show.Show (Shelley.Spec.Ledger.PParams.PPUpdateEnv era)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.PParams.ProposedPPUpdates era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.PParams.ProposedPPUpdates era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.PParams.ProposedPPUpdates era)
instance GHC.Show.Show (Shelley.Spec.Ledger.PParams.ProposedPPUpdates era)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.PParams.Update era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.PParams.Update era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.PParams.Update era)
instance GHC.Show.Show (Shelley.Spec.Ledger.PParams.Update era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.PParams.PParams' Data.Functor.Identity.Identity era)
instance GHC.Show.Show (Shelley.Spec.Ledger.PParams.PParams' Data.Functor.Identity.Identity era)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.PParams.PParams' Data.Functor.Identity.Identity era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.PParams.PParams' Shelley.Spec.Ledger.BaseTypes.StrictMaybe era)
instance GHC.Show.Show (Shelley.Spec.Ledger.PParams.PParams' Shelley.Spec.Ledger.BaseTypes.StrictMaybe era)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.PParams.PParams' Shelley.Spec.Ledger.BaseTypes.StrictMaybe era)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.PParams.PParams' Shelley.Spec.Ledger.BaseTypes.StrictMaybe era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.PParams.Update era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.PParams.Update era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.PParams.Update era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.PParams.ProposedPPUpdates era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.PParams.ProposedPPUpdates era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.PParams.ProposedPPUpdates era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.PParams.PParamsUpdate era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.PParams.PParamsUpdate era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.PParams.PParamsUpdate era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.PParams.PPUpdateEnv era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.PParams.PParams era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.PParams.PParams era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.PParams.PParams era)
instance Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.PParams.PParams era)
instance Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.PParams.PParams era)
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.PParams.ProtVer
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.PParams.ProtVer
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.PParams.ProtVer
instance Shelley.Spec.Ledger.Serialization.ToCBORGroup Shelley.Spec.Ledger.PParams.ProtVer
instance Shelley.Spec.Ledger.Serialization.FromCBORGroup Shelley.Spec.Ledger.PParams.ProtVer

module Shelley.Spec.Ledger.HardForks
aggregatedRewards :: PParams era -> Bool

module Shelley.Spec.Ledger.OCert
data OCert crypto
OCert :: !VerKeyKES crypto -> !Word64 -> !KESPeriod -> !SignedDSIGN crypto (OCertSignable crypto) -> OCert crypto

-- | The operational hot key
[ocertVkHot] :: OCert crypto -> !VerKeyKES crypto

-- | counter
[ocertN] :: OCert crypto -> !Word64

-- | Start of key evolving signature period
[ocertKESPeriod] :: OCert crypto -> !KESPeriod

-- | Signature of block operational certificate content
[ocertSigma] :: OCert crypto -> !SignedDSIGN crypto (OCertSignable crypto)
data OCertEnv crypto
OCertEnv :: Set (KeyHash 'StakePool crypto) -> Set (KeyHash 'GenesisDelegate crypto) -> OCertEnv crypto
[ocertEnvStPools] :: OCertEnv crypto -> Set (KeyHash 'StakePool crypto)
[ocertEnvGenDelegs] :: OCertEnv crypto -> Set (KeyHash 'GenesisDelegate crypto)

-- | Signable part of an operational certificate
data OCertSignable crypto
OCertSignable :: !VerKeyKES crypto -> !Word64 -> !KESPeriod -> OCertSignable crypto

-- | Extract the signable part of an operational certificate (for
--   verification)
ocertToSignable :: OCert crypto -> OCertSignable crypto
currentIssueNo :: OCertEnv crypto -> Map (KeyHash 'BlockIssuer crypto) Word64 -> KeyHash 'BlockIssuer crypto -> Maybe Word64
newtype KESPeriod
KESPeriod :: Word -> KESPeriod
[unKESPeriod] :: KESPeriod -> Word
slotsPerKESPeriod :: Globals -> Word64
kesPeriod :: SlotNo -> ShelleyBase KESPeriod
instance GHC.Classes.Eq (Shelley.Spec.Ledger.OCert.OCertEnv crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.OCert.OCertEnv crypto)
instance GHC.Show.Show Shelley.Spec.Ledger.OCert.KESPeriod
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.OCert.KESPeriod
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.OCert.KESPeriod
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.OCert.KESPeriod
instance GHC.Classes.Ord Shelley.Spec.Ledger.OCert.KESPeriod
instance GHC.Generics.Generic Shelley.Spec.Ledger.OCert.KESPeriod
instance GHC.Classes.Eq Shelley.Spec.Ledger.OCert.KESPeriod
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.OCert.OCert crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.OCert.OCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Eq (Shelley.Spec.Ledger.OCert.OCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.OCert.OCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.OCert.OCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Shelley.Spec.Ledger.Serialization.ToCBORGroup (Shelley.Spec.Ledger.OCert.OCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Shelley.Spec.Ledger.Serialization.FromCBORGroup (Shelley.Spec.Ledger.OCert.OCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Crypto.Util.SignableRepresentation (Shelley.Spec.Ledger.OCert.OCertSignable crypto)

module Shelley.Spec.Ledger.Credential

-- | Script hash or key hash for a payment or a staking object.
--   
--   Note that credentials (unlike raw key hashes) do appear to vary from
--   era to era, since they reference the hash of a script, which can
--   change. This parameter is a phantom, however, so in actuality the
--   instances will remain the same.
data Credential (kr :: KeyRole) crypto
ScriptHashObj :: {-# UNPACK #-} !ScriptHash crypto -> Credential (kr :: KeyRole) crypto
KeyHashObj :: {-# UNPACK #-} !KeyHash kr crypto -> Credential (kr :: KeyRole) crypto
newtype GenesisCredential crypto
GenesisCredential :: KeyHash 'Genesis crypto -> GenesisCredential crypto
[unGenesisCredential] :: GenesisCredential crypto -> KeyHash 'Genesis crypto
type Ix = Natural
type PaymentCredential crypto = Credential 'Payment crypto

-- | Pointer to a slot, transaction index and index in certificate list.
data Ptr
Ptr :: !SlotNo -> !Ix -> !Ix -> Ptr
type StakeCredential crypto = Credential 'Staking crypto
data StakeReference crypto
StakeRefBase :: !StakeCredential crypto -> StakeReference crypto
StakeRefPtr :: !Ptr -> StakeReference crypto
StakeRefNull :: StakeReference crypto
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.Credential.Ptr
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Credential.Ptr
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Credential.Ptr
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.Credential.Ptr
instance GHC.Generics.Generic Shelley.Spec.Ledger.Credential.Ptr
instance GHC.Classes.Ord Shelley.Spec.Ledger.Credential.Ptr
instance GHC.Classes.Eq Shelley.Spec.Ledger.Credential.Ptr
instance GHC.Show.Show Shelley.Spec.Ledger.Credential.Ptr
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Credential.StakeReference crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Credential.StakeReference crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Credential.StakeReference crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Credential.StakeReference crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Credential.StakeReference crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Credential.GenesisCredential crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Credential.GenesisCredential crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Credential.GenesisCredential crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Credential.GenesisCredential crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Credential.GenesisCredential crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Credential.StakeReference crypto)
instance Shelley.Spec.Ledger.Serialization.ToCBORGroup Shelley.Spec.Ledger.Credential.Ptr
instance Shelley.Spec.Ledger.Serialization.FromCBORGroup Shelley.Spec.Ledger.Credential.Ptr
instance Shelley.Spec.Ledger.Keys.HasKeyRole Shelley.Spec.Ledger.Credential.Credential
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance Data.Aeson.Types.ToJSON.ToJSONKey (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSONKey (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance (Data.Typeable.Internal.Typeable kr, Cardano.Ledger.Crypto.Crypto crypto) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Credential.Credential kr crypto)
instance (Data.Typeable.Internal.Typeable kr, Cardano.Ledger.Crypto.Crypto crypto) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Credential.Credential kr crypto)

module Shelley.Spec.Ledger.Address
mkVKeyRwdAcnt :: Crypto crypto => Network -> KeyPair 'Staking crypto -> RewardAcnt crypto
mkRwdAcnt :: Network -> Credential 'Staking crypto -> RewardAcnt crypto

-- | Create a base address from a pair of multi-sig scripts (pay and stake)
scriptsToAddr :: Crypto crypto => Network -> (MultiSig crypto, MultiSig crypto) -> Addr crypto

-- | Convert a given multi-sig script to a credential by hashing it and
--   wrapping into the <a>Credential</a> data type.
scriptToCred :: Crypto crypto => MultiSig crypto -> Credential kr crypto
toAddr :: Crypto crypto => Network -> (KeyPair 'Payment crypto, KeyPair 'Staking crypto) -> Addr crypto
toCred :: Crypto crypto => KeyPair kr crypto -> Credential kr crypto

-- | Serialise an address to the external format.
serialiseAddr :: Addr crypto -> ByteString

-- | Deserialise an address from the external format. This will fail if the
--   input data is not in the right format (or if there is trailing data).
deserialiseAddr :: Crypto crypto => ByteString -> Maybe (Addr crypto)

-- | Deserialise a stake refence from a address. This will fail if this is
--   a Bootstrap address (or malformed).
deserialiseAddrStakeRef :: Crypto crypto => ByteString -> Maybe (StakeReference crypto)

-- | An address for UTxO.
data Addr crypto
Addr :: Network -> PaymentCredential crypto -> StakeReference crypto -> Addr crypto
AddrBootstrap :: BootstrapAddress crypto -> Addr crypto
newtype BootstrapAddress crypto
BootstrapAddress :: Address -> BootstrapAddress crypto
[unBootstrapAddress] :: BootstrapAddress crypto -> Address

-- | The size of the extra attributes in a bootstrp (ie Byron) address.
--   Used to help enforce that people do not post huge ones on the chain.
bootstrapAddressAttrsSize :: BootstrapAddress crypto -> Int

-- | Return True if a given address is a redeemer address from the Byron
--   Era
isBootstrapRedeemer :: Addr crypto -> Bool
getNetwork :: Addr crypto -> Network

-- | An account based address for rewards
data RewardAcnt crypto
RewardAcnt :: !Network -> !Credential 'Staking crypto -> RewardAcnt crypto
[getRwdNetwork] :: RewardAcnt crypto -> !Network
[getRwdCred] :: RewardAcnt crypto -> !Credential 'Staking crypto

-- | Serialise a reward account to the external format.
serialiseRewardAcnt :: RewardAcnt crypto -> ByteString

-- | Deserialise an reward account from the external format. This will fail
--   if the input data is not in the right format (or if there is trailing
--   data).
deserialiseRewardAcnt :: Crypto crypto => ByteString -> Maybe (RewardAcnt crypto)
byron :: Int
notBaseAddr :: Int
isEnterpriseAddr :: Int
stakeCredIsScript :: Int
getAddr :: Crypto crypto => Get (Addr crypto)
getKeyHash :: Crypto crypto => Get (Credential kr crypto)
bootstrapKeyHash :: forall crypto. Crypto crypto => BootstrapAddress crypto -> KeyHash 'Payment crypto
getPtr :: Get Ptr
getRewardAcnt :: Crypto crypto => Get (RewardAcnt crypto)
getScriptHash :: Crypto crypto => Get (Credential kr crypto)
getVariableLengthNat :: Get Natural
payCredIsScript :: Int
putAddr :: Addr crypto -> Put
putCredential :: Credential kr crypto -> Put
putPtr :: Ptr -> Put
putRewardAcnt :: RewardAcnt crypto -> Put
putVariableLengthNat :: Natural -> Put
natToWord7s :: Natural -> [Word7]
word7sToNat :: [Word7] -> Natural
newtype Word7
Word7 :: Word8 -> Word7
toWord7 :: Word8 -> Word7
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSONKey (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance Data.Aeson.Types.ToJSON.ToJSONKey (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance GHC.Show.Show Shelley.Spec.Ledger.Address.Word7
instance GHC.Classes.Eq Shelley.Spec.Ledger.Address.Word7
instance GHC.Show.Show (Shelley.Spec.Ledger.Address.BootstrapAddress crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Address.BootstrapAddress crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Address.BootstrapAddress crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Address.BootstrapAddress crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Address.BootstrapAddress crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.Address.Addr crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Address.Addr crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Address.Addr crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Address.Addr crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Address.Addr crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Address.Addr crypto)
instance Data.Aeson.Types.ToJSON.ToJSONKey (Shelley.Spec.Ledger.Address.Addr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSONKey (Shelley.Spec.Ledger.Address.Addr crypto)
instance Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.Address.Addr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.Address.Addr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Address.Addr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Address.Addr crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Address.BootstrapAddress crypto)
instance Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Address.RewardAcnt crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Address.RewardAcnt crypto)

module Shelley.Spec.Ledger.CompactAddr
compactAddr :: Addr crypto -> CompactAddr crypto
decompactAddr :: forall crypto. Crypto crypto => CompactAddr crypto -> Addr crypto
newtype CompactAddr crypto
UnsafeCompactAddr :: ShortByteString -> CompactAddr crypto
substring :: ShortByteString -> Int -> Int -> ShortByteString
instance GHC.Classes.Ord (Shelley.Spec.Ledger.CompactAddr.CompactAddr crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.CompactAddr.CompactAddr crypto)
instance GHC.Base.Functor Shelley.Spec.Ledger.CompactAddr.GetShort
instance GHC.Base.Applicative Shelley.Spec.Ledger.CompactAddr.GetShort
instance GHC.Base.Monad Shelley.Spec.Ledger.CompactAddr.GetShort
instance Control.Monad.Fail.MonadFail Shelley.Spec.Ledger.CompactAddr.GetShort
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.CompactAddr.CompactAddr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.CompactAddr.CompactAddr crypto)

module Shelley.Spec.Ledger.SoftForks
validMetadata :: PParams era -> Bool

module Shelley.Spec.Ledger.StabilityWindow

-- | Calculate the stability window (e.g. the number of slots needed for a
--   block to become stable) from the security param and the active slot
--   coefficient.
--   
--   The value 3k/f is determined to be a suitabe value as per
--   <a>https://docs.google.com/document/d/1B8BNMx8jVWRjYiUBOaI3jfZ7dQNvNTSDODvT5iOuYCU/edit#heading=h.qh2zcajmu6hm</a>
computeStabilityWindow :: Word64 -> ActiveSlotCoeff -> Word64

-- | Calculate the randomness stabilisation window from the security param
--   and the active slot coefficient.
--   
--   The value 4k/f is determined to be a suitabe value as per
--   <a>https://docs.google.com/document/d/1B8BNMx8jVWRjYiUBOaI3jfZ7dQNvNTSDODvT5iOuYCU/edit#heading=h.qh2zcajmu6hm</a>
computeRandomnessStabilisationWindow :: Word64 -> ActiveSlotCoeff -> Word64

module Shelley.Spec.Ledger.TxBody

-- | A heavyweight certificate.
data DCert crypto
DCertDeleg :: !DelegCert crypto -> DCert crypto
DCertPool :: !PoolCert crypto -> DCert crypto
DCertGenesis :: !GenesisDelegCert crypto -> DCert crypto
DCertMir :: !MIRCert crypto -> DCert crypto
data DelegCert crypto

-- | A stake key registration certificate.
RegKey :: !StakeCredential crypto -> DelegCert crypto

-- | A stake key deregistration certificate.
DeRegKey :: !StakeCredential crypto -> DelegCert crypto

-- | A stake delegation certificate.
Delegate :: !Delegation crypto -> DelegCert crypto

-- | The delegation of one stake key to another.
data Delegation crypto
Delegation :: !StakeCredential crypto -> !KeyHash 'StakePool crypto -> Delegation crypto
[_delegator] :: Delegation crypto -> !StakeCredential crypto
[_delegatee] :: Delegation crypto -> !KeyHash 'StakePool crypto

-- | Genesis key delegation certificate
data GenesisDelegCert crypto
GenesisDelegCert :: !KeyHash 'Genesis crypto -> !KeyHash 'GenesisDelegate crypto -> !Hash crypto (VerKeyVRF crypto) -> GenesisDelegCert crypto
type Ix = Natural

-- | Move instantaneous rewards certificate
data MIRCert crypto
MIRCert :: MIRPot -> Map (Credential 'Staking crypto) Coin -> MIRCert crypto
[mirPot] :: MIRCert crypto -> MIRPot
[mirRewards] :: MIRCert crypto -> Map (Credential 'Staking crypto) Coin
data MIRPot
ReservesMIR :: MIRPot
TreasuryMIR :: MIRPot
data PoolCert crypto

-- | A stake pool registration certificate.
RegPool :: !PoolParams crypto -> PoolCert crypto

-- | A stake pool retirement certificate.
RetirePool :: !KeyHash 'StakePool crypto -> !EpochNo -> PoolCert crypto
data PoolMetadata
PoolMetadata :: !Url -> !ByteString -> PoolMetadata
[_poolMDUrl] :: PoolMetadata -> !Url
[_poolMDHash] :: PoolMetadata -> !ByteString

-- | A stake pool.
data PoolParams crypto
PoolParams :: !KeyHash 'StakePool crypto -> !Hash crypto (VerKeyVRF crypto) -> !Coin -> !Coin -> !UnitInterval -> !RewardAcnt crypto -> !Set (KeyHash 'Staking crypto) -> !StrictSeq StakePoolRelay -> !StrictMaybe PoolMetadata -> PoolParams crypto
[_poolId] :: PoolParams crypto -> !KeyHash 'StakePool crypto
[_poolVrf] :: PoolParams crypto -> !Hash crypto (VerKeyVRF crypto)
[_poolPledge] :: PoolParams crypto -> !Coin
[_poolCost] :: PoolParams crypto -> !Coin
[_poolMargin] :: PoolParams crypto -> !UnitInterval
[_poolRAcnt] :: PoolParams crypto -> !RewardAcnt crypto
[_poolOwners] :: PoolParams crypto -> !Set (KeyHash 'Staking crypto)
[_poolRelays] :: PoolParams crypto -> !StrictSeq StakePoolRelay
[_poolMD] :: PoolParams crypto -> !StrictMaybe PoolMetadata

-- | Pointer to a slot, transaction index and index in certificate list.
data Ptr
Ptr :: !SlotNo -> !Ix -> !Ix -> Ptr

-- | An account based address for rewards
data RewardAcnt crypto
RewardAcnt :: !Network -> !Credential 'Staking crypto -> RewardAcnt crypto
[getRwdNetwork] :: RewardAcnt crypto -> !Network
[getRwdCred] :: RewardAcnt crypto -> !Credential 'Staking crypto
newtype StakeCreds crypto
StakeCreds :: Map (Credential 'Staking crypto) SlotNo -> StakeCreds crypto
[unStakeCreds] :: StakeCreds crypto -> Map (Credential 'Staking crypto) SlotNo
data StakePoolRelay

-- | One or both of IPv4 &amp; IPv6
SingleHostAddr :: !StrictMaybe Port -> !StrictMaybe IPv4 -> !StrictMaybe IPv6 -> StakePoolRelay

-- | An <tt>A</tt> or <tt>AAAA</tt> DNS record
SingleHostName :: !StrictMaybe Port -> !DnsName -> StakePoolRelay

-- | A <tt>SRV</tt> DNS record
MultiHostName :: !DnsName -> StakePoolRelay
newtype TxBody era
TxBodyConstr :: MemoBytes (TxBodyRaw era) -> TxBody era

-- | Pattern for use by external users
pattern TxBody :: ProperTo era => Set (TxIn (Crypto era)) -> StrictSeq (TxOut era) -> StrictSeq (DCert (Crypto era)) -> Wdrl (Crypto era) -> Coin -> SlotNo -> StrictMaybe (Update era) -> StrictMaybe (AuxiliaryDataHash (Crypto era)) -> TxBody era
data TxBodyRaw era
TxBodyRaw :: !Set (TxIn (Crypto era)) -> !StrictSeq (TxOut era) -> !StrictSeq (DCert (Crypto era)) -> !Wdrl (Crypto era) -> !Coin -> !SlotNo -> !StrictMaybe (Update era) -> !StrictMaybe (AuxiliaryDataHash (Crypto era)) -> TxBodyRaw era
[_inputsX] :: TxBodyRaw era -> !Set (TxIn (Crypto era))
[_outputsX] :: TxBodyRaw era -> !StrictSeq (TxOut era)
[_certsX] :: TxBodyRaw era -> !StrictSeq (DCert (Crypto era))
[_wdrlsX] :: TxBodyRaw era -> !Wdrl (Crypto era)
[_txfeeX] :: TxBodyRaw era -> !Coin
[_ttlX] :: TxBodyRaw era -> !SlotNo
[_txUpdateX] :: TxBodyRaw era -> !StrictMaybe (Update era)
[_mdHashX] :: TxBodyRaw era -> !StrictMaybe (AuxiliaryDataHash (Crypto era))

-- | A unique ID of a transaction, which is computable from the
--   transaction.
newtype TxId crypto
TxId :: Hash crypto EraIndependentTxBody -> TxId crypto
[_unTxId] :: TxId crypto -> Hash crypto EraIndependentTxBody

-- | The input of a UTxO.
data TxIn crypto
TxInCompact :: {-# UNPACK #-} !TxId crypto -> {-# UNPACK #-} !Word64 -> TxIn crypto
pattern TxIn :: Crypto crypto => TxId crypto -> Natural -> TxIn crypto
data EraIndependentTxBody

-- | Compute an era-independent transaction body hash
eraIndTxBodyHash :: forall era. Era era => TxBody era -> Hash (Crypto era) EraIndependentTxBody

-- | The output of a UTxO.
data TxOut era
TxOutCompact :: {-# UNPACK #-} !CompactAddr (Crypto era) -> !CompactForm (Value era) -> TxOut era
pattern TxOut :: (HasCallStack, ShelleyBased era) => Addr (Crypto era) -> Value era -> TxOut era
data Url
newtype Wdrl crypto
Wdrl :: Map (RewardAcnt crypto) Coin -> Wdrl crypto
[unWdrl] :: Wdrl crypto -> Map (RewardAcnt crypto) Coin

-- | Proof/Witness that a transaction is authorized by the given key
--   holder.
data WitVKey kr crypto
pattern WitVKey :: (Typeable kr, Crypto crypto) => VKey kr crypto -> SignedDSIGN crypto (Hash crypto EraIndependentTxBody) -> WitVKey kr crypto
witKeyHash :: WitVKey kr crypto -> KeyHash 'Witness crypto

-- | The size of the <a>_poolOwners</a> <a>Set</a>. Only used to compute
--   size of encoded <a>PoolParams</a>.
data SizeOfPoolOwners
SizeOfPoolOwners :: SizeOfPoolOwners

-- | The size of the <a>_poolRelays</a> <a>Set</a>. Only used to compute
--   size of encoded <a>PoolParams</a>.
data SizeOfPoolRelays
SizeOfPoolRelays :: SizeOfPoolRelays
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.Delegation crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.Delegation crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.Delegation crypto)
instance GHC.Show.Show Shelley.Spec.Ledger.TxBody.PoolMetadata
instance GHC.Generics.Generic Shelley.Spec.Ledger.TxBody.PoolMetadata
instance GHC.Classes.Ord Shelley.Spec.Ledger.TxBody.PoolMetadata
instance GHC.Classes.Eq Shelley.Spec.Ledger.TxBody.PoolMetadata
instance GHC.Show.Show Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance GHC.Generics.Generic Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance GHC.Classes.Ord Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance GHC.Classes.Eq Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.TxBody.Wdrl crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.Wdrl crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.Wdrl crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.Wdrl crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.Wdrl crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.TxId crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.TxId crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.TxBody.TxId crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.TxId crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.TxId crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.TxIn crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.DelegCert crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.DelegCert crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.DelegCert crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.PoolCert crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.PoolCert crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.PoolCert crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.GenesisDelegCert crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.GenesisDelegCert crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.GenesisDelegCert crypto)
instance GHC.Classes.Eq Shelley.Spec.Ledger.TxBody.MIRPot
instance GHC.Generics.Generic Shelley.Spec.Ledger.TxBody.MIRPot
instance GHC.Show.Show Shelley.Spec.Ledger.TxBody.MIRPot
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.MIRCert crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.MIRCert crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.MIRCert crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.DCert crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.DCert crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.DCert crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.TxBodyRaw era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.TxBodyRaw era)
instance Data.Typeable.Internal.Typeable era => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.TxBody era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.TxBody era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.WitVKey kr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.TxBody.PoolMetadata
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.TxId crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.TxId crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Control.DeepSeq.NFData (Shelley.Spec.Ledger.TxBody.TxId crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.TxBody.TxIn crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.TxIn crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.TxBody.TxIn crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Control.DeepSeq.NFData (Shelley.Spec.Ledger.TxBody.TxIn crypto)
instance (GHC.Classes.Eq (Cardano.Ledger.Core.Value era), GHC.Classes.Eq (Cardano.Ledger.Compactible.CompactForm (Cardano.Ledger.Core.Value era)), Cardano.Ledger.Compactible.Compactible (Cardano.Ledger.Core.Value era)) => GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.TxOut era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.TxOut era)
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.TxBody.MIRPot
instance Cardano.Ledger.Crypto.Crypto (Cardano.Ledger.Era.Crypto era) => Control.DeepSeq.NFData (Shelley.Spec.Ledger.TxBody.TxBodyRaw era)
instance (Cardano.Ledger.Era.Era era, Shelley.Spec.Ledger.TxBody.ProperVal era) => GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.TxBodyRaw era)
instance (Cardano.Ledger.Era.Era era, Shelley.Spec.Ledger.TxBody.ProperVal era) => GHC.Show.Show (Shelley.Spec.Ledger.TxBody.TxBodyRaw era)
instance Cardano.Ledger.Crypto.Crypto (Cardano.Ledger.Era.Crypto era) => Control.DeepSeq.NFData (Shelley.Spec.Ledger.TxBody.TxBody era)
instance Shelley.Spec.Ledger.TxBody.ProperVal era => GHC.Show.Show (Shelley.Spec.Ledger.TxBody.TxBody era)
instance Shelley.Spec.Ledger.TxBody.ProperVal era => GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.TxBody era)
instance Shelley.Spec.Ledger.TxBody.ProperFrom era => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.TxBody.TxBody era))
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.TxBody.WitVKey kr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Eq (Shelley.Spec.Ledger.TxBody.WitVKey kr crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Data.Typeable.Internal.Typeable kr) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.WitVKey kr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.StakeCreds crypto)
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.TxBody.SizeOfPoolRelays
instance Cardano.Ledger.Crypto.Crypto crypto => Shelley.Spec.Ledger.Serialization.ToCBORGroup (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.TxBody.SizeOfPoolOwners
instance Control.Iterate.SetAlgebra.HasExp (Shelley.Spec.Ledger.TxBody.StakeCreds era) (Data.Map.Internal.Map (Shelley.Spec.Ledger.Credential.Credential 'Shelley.Spec.Ledger.Keys.Staking era) Cardano.Slotting.Slot.SlotNo)
instance Control.Iterate.SetAlgebra.Embed (Shelley.Spec.Ledger.TxBody.StakeCreds era) (Data.Map.Internal.Map (Shelley.Spec.Ledger.Credential.Credential 'Shelley.Spec.Ledger.Keys.Staking era) Cardano.Slotting.Slot.SlotNo)
instance (Data.Typeable.Internal.Typeable kr, Cardano.Ledger.Crypto.Crypto crypto) => GHC.Classes.Ord (Shelley.Spec.Ledger.TxBody.WitVKey kr crypto)
instance (Data.Typeable.Internal.Typeable kr, Cardano.Ledger.Crypto.Crypto crypto) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.WitVKey kr crypto)
instance (Data.Typeable.Internal.Typeable kr, Cardano.Ledger.Crypto.Crypto crypto) => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.TxBody.WitVKey kr crypto))
instance Cardano.Ledger.Era.Era era => Shelley.Spec.Ledger.Hashing.HashAnnotated (Shelley.Spec.Ledger.TxBody.TxBody era) era
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.TxBody era)
instance (Cardano.Ledger.Era.Crypto era GHC.Types.~ crypto) => GHC.Records.HasField "inputs" (Shelley.Spec.Ledger.TxBody.TxBody era) (Data.Set.Internal.Set (Shelley.Spec.Ledger.TxBody.TxIn crypto))
instance GHC.Records.HasField "outputs" (Shelley.Spec.Ledger.TxBody.TxBody era) (Data.Sequence.Strict.StrictSeq (Shelley.Spec.Ledger.TxBody.TxOut era))
instance (Cardano.Ledger.Era.Crypto era GHC.Types.~ crypto) => GHC.Records.HasField "certs" (Shelley.Spec.Ledger.TxBody.TxBody era) (Data.Sequence.Strict.StrictSeq (Shelley.Spec.Ledger.TxBody.DCert crypto))
instance (Cardano.Ledger.Era.Crypto era GHC.Types.~ crypto) => GHC.Records.HasField "wdrls" (Shelley.Spec.Ledger.TxBody.TxBody era) (Shelley.Spec.Ledger.TxBody.Wdrl crypto)
instance GHC.Records.HasField "txfee" (Shelley.Spec.Ledger.TxBody.TxBody era) Shelley.Spec.Ledger.Coin.Coin
instance GHC.Records.HasField "ttl" (Shelley.Spec.Ledger.TxBody.TxBody era) Cardano.Slotting.Slot.SlotNo
instance GHC.Records.HasField "update" (Shelley.Spec.Ledger.TxBody.TxBody era) (Shelley.Spec.Ledger.BaseTypes.StrictMaybe (Shelley.Spec.Ledger.PParams.Update era))
instance (Cardano.Ledger.Era.Crypto era GHC.Types.~ crypto) => GHC.Records.HasField "adHash" (Shelley.Spec.Ledger.TxBody.TxBody era) (Shelley.Spec.Ledger.BaseTypes.StrictMaybe (Cardano.Ledger.AuxiliaryData.AuxiliaryDataHash crypto))
instance Shelley.Spec.Ledger.TxBody.ProperFrom era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.TxBodyRaw era)
instance Shelley.Spec.Ledger.TxBody.ProperFrom era => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.TxBody.TxBodyRaw era))
instance Shelley.Spec.Ledger.TxBody.ProperTo era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.TxBodyRaw era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.DCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.DCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.DCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.MIRCert crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.MIRCert crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.MIRCert crypto)
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.TxBody.MIRPot
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.TxBody.MIRPot
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.GenesisDelegCert crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.PoolCert crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.DelegCert crypto)
instance (GHC.Show.Show (Cardano.Ledger.Core.Value era), Cardano.Ledger.Era.Era era, Cardano.Ledger.Compactible.Compactible (Cardano.Ledger.Core.Value era)) => GHC.Show.Show (Shelley.Spec.Ledger.TxBody.TxOut era)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.TxBody.TxOut era)
instance (Cardano.Ledger.Era.Era era, Cardano.Binary.ToCBOR.ToCBOR (Cardano.Ledger.Compactible.CompactForm (Cardano.Ledger.Core.Value era)), Cardano.Ledger.Compactible.Compactible (Cardano.Ledger.Core.Value era)) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.TxOut era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Val.DecodeNonNegative (Cardano.Ledger.Compactible.CompactForm (Cardano.Ledger.Core.Value era)), Cardano.Ledger.Compactible.Compactible (Cardano.Ledger.Core.Value era)) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.TxOut era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.TxIn crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.TxIn crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.TxIn crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.TxBody.Wdrl crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.TxBody.Wdrl crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Shelley.Spec.Ledger.Serialization.FromCBORGroup (Shelley.Spec.Ledger.TxBody.PoolParams crypto)
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.TxBody.StakePoolRelay
instance Data.Aeson.Types.ToJSON.ToJSON Shelley.Spec.Ledger.TxBody.PoolMetadata
instance Data.Aeson.Types.FromJSON.FromJSON Shelley.Spec.Ledger.TxBody.PoolMetadata
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.TxBody.PoolMetadata
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.TxBody.PoolMetadata
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.TxBody.PoolMetadata
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.TxBody.Delegation crypto)

module Shelley.Spec.Ledger.Tx

-- | A fully formed transaction.
data Tx era
Tx' :: !TxBody era -> !WitnessSet era -> !StrictMaybe (AuxiliaryData era) -> ByteString -> Tx era
pattern Tx :: (TxBodyConstraints era, ToCBOR (AuxiliaryData era)) => TxBody era -> WitnessSet era -> StrictMaybe (AuxiliaryData era) -> Tx era
newtype TxBody era
TxBodyConstr :: MemoBytes (TxBodyRaw era) -> TxBody era

-- | Pattern for use by external users
pattern TxBody :: ProperTo era => Set (TxIn (Crypto era)) -> StrictSeq (TxOut era) -> StrictSeq (DCert (Crypto era)) -> Wdrl (Crypto era) -> Coin -> SlotNo -> StrictMaybe (Update era) -> StrictMaybe (AuxiliaryDataHash (Crypto era)) -> TxBody era

-- | The output of a UTxO.
data TxOut era
TxOutCompact :: {-# UNPACK #-} !CompactAddr (Crypto era) -> !CompactForm (Value era) -> TxOut era
pattern TxOut :: (HasCallStack, ShelleyBased era) => Addr (Crypto era) -> Value era -> TxOut era

-- | The input of a UTxO.
data TxIn crypto
TxInCompact :: {-# UNPACK #-} !TxId crypto -> {-# UNPACK #-} !Word64 -> TxIn crypto
pattern TxIn :: Crypto crypto => TxId crypto -> Natural -> TxIn crypto

-- | A unique ID of a transaction, which is computable from the
--   transaction.
newtype TxId crypto
TxId :: Hash crypto EraIndependentTxBody -> TxId crypto
[_unTxId] :: TxId crypto -> Hash crypto EraIndependentTxBody
decodeWits :: forall era s. (TxBodyConstraints era, AnnotatedData (Script era), ValidateScript era) => Decoder s (Annotator (WitnessSet era))
segwitTx :: (TxBodyConstraints era, ToCBOR (AuxiliaryData era)) => Annotator (TxBody era) -> Annotator (WitnessSet era) -> Maybe (Annotator (AuxiliaryData era)) -> Annotator (Tx era)
type WitnessSet = WitnessSetHKD Identity
data WitnessSetHKD f era
pattern WitnessSet :: (Era era, AnnotatedData (Script era)) => Set (WitVKey 'Witness (Crypto era)) -> Map (ScriptHash (Crypto era)) (Script era) -> Set (BootstrapWitness (Crypto era)) -> WitnessSet era

-- | Proof/Witness that a transaction is authorized by the given key
--   holder.
data WitVKey kr crypto
pattern WitVKey :: (Typeable kr, Crypto crypto) => VKey kr crypto -> SignedDSIGN crypto (Hash crypto EraIndependentTxBody) -> WitVKey kr crypto

-- | Typeclass for multis-signature script data types. Allows for script
--   validation and hashing.
class (Era era, ToCBOR (Script era)) => ValidateScript era
validateScript :: ValidateScript era => Script era -> Tx era -> Bool
hashScript :: ValidateScript era => Script era -> ScriptHash (Crypto era)

-- | Multi-signature script witness accessor function for Transactions
txwitsScript :: (TxBodyConstraints era, ToCBOR (AuxiliaryData era)) => Tx era -> Map (ScriptHash (Crypto era)) (Script era)
extractKeyHashWitnessSet :: forall (r :: KeyRole) crypto. [Credential r crypto] -> Set (KeyHash 'Witness crypto)
addrWits' :: WitnessSetHKD f era -> HKD f (Set (WitVKey 'Witness (Crypto era)))

-- | Script evaluator for native multi-signature scheme. <tt>vhks</tt> is
--   the set of key hashes that signed the transaction to be validated.
evalNativeMultiSigScript :: Crypto crypto => MultiSig crypto -> Set (KeyHash 'Witness crypto) -> Bool

-- | Hashes native multi-signature script.
hashMultiSigScript :: Crypto crypto => MultiSig crypto -> ScriptHash crypto

-- | Script validator for native multi-signature scheme.
validateNativeMultiSigScript :: (TxBodyConstraints era, ToCBOR (AuxiliaryData era)) => MultiSig (Crypto era) -> Tx era -> Bool
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Tx.Tx era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Core.ChainData (Cardano.Ledger.Core.Script era)) => GHC.Show.Show (Shelley.Spec.Ledger.Tx.WitnessSetHKD Data.Functor.Identity.Identity era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Core.ChainData (Cardano.Ledger.Core.Script era)) => GHC.Classes.Eq (Shelley.Spec.Ledger.Tx.WitnessSetHKD Data.Functor.Identity.Identity era)
instance Cardano.Ledger.Era.Era era => GHC.Generics.Generic (Shelley.Spec.Ledger.Tx.WitnessSetHKD Data.Functor.Identity.Identity era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Core.ChainData (Cardano.Ledger.Core.Script era)) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Tx.WitnessSetHKD Data.Functor.Identity.Identity era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Tx.Tx era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.Tx.Tx era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.Tx.Tx era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Shelley.Spec.Ledger.Tx.ValidateScript era) => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.Tx.Tx era))
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Shelley.Spec.Ledger.Hashing.HashAnnotated (Shelley.Spec.Ledger.Tx.Tx era) era
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Tx.Tx era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Tx.WitnessSetHKD Data.Functor.Identity.Identity era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Core.AnnotatedData (Cardano.Ledger.Core.Script era)) => GHC.Base.Semigroup (Shelley.Spec.Ledger.Tx.WitnessSetHKD Data.Functor.Identity.Identity era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Core.AnnotatedData (Cardano.Ledger.Core.Script era)) => GHC.Base.Monoid (Shelley.Spec.Ledger.Tx.WitnessSetHKD Data.Functor.Identity.Identity era)


-- | Definition of the shelley era, along with instances ot the
--   <tt>Core</tt> types defined in <tt>module Cardano.Ledger.Core</tt>,
--   and instances of the <tt>API</tt> classes exposed in <tt>module
--   Shelley.Spec.Ledger.API</tt>.
module Cardano.Ledger.Shelley
data ShelleyEra c
instance Cardano.Ledger.Crypto.Crypto c => Cardano.Ledger.Era.Era (Cardano.Ledger.Shelley.ShelleyEra c)
instance (Cardano.Ledger.Crypto.Crypto c, Cardano.Ledger.Shelley.Constraints.TxBodyConstraints (Cardano.Ledger.Shelley.ShelleyEra c)) => Shelley.Spec.Ledger.Tx.ValidateScript (Cardano.Ledger.Shelley.ShelleyEra c)
instance Cardano.Ledger.Crypto.Crypto c => Cardano.Ledger.AuxiliaryData.ValidateAuxiliaryData (Cardano.Ledger.Shelley.ShelleyEra c)

module Shelley.Spec.Ledger.Delegation.PoolParams
poolSpec :: PoolParams crypto -> (Coin, UnitInterval, Coin)

module Shelley.Spec.Ledger.Delegation.Certificates

-- | A heavyweight certificate.
data DCert crypto
DCertDeleg :: !DelegCert crypto -> DCert crypto
DCertPool :: !PoolCert crypto -> DCert crypto
DCertGenesis :: !GenesisDelegCert crypto -> DCert crypto
DCertMir :: !MIRCert crypto -> DCert crypto
data DelegCert crypto

-- | A stake key registration certificate.
RegKey :: !StakeCredential crypto -> DelegCert crypto

-- | A stake key deregistration certificate.
DeRegKey :: !StakeCredential crypto -> DelegCert crypto

-- | A stake delegation certificate.
Delegate :: !Delegation crypto -> DelegCert crypto
data PoolCert crypto

-- | A stake pool registration certificate.
RegPool :: !PoolParams crypto -> PoolCert crypto

-- | A stake pool retirement certificate.
RetirePool :: !KeyHash 'StakePool crypto -> !EpochNo -> PoolCert crypto

-- | Genesis key delegation certificate
data GenesisDelegCert crypto
GenesisDelegCert :: !KeyHash 'Genesis crypto -> !KeyHash 'GenesisDelegate crypto -> !Hash crypto (VerKeyVRF crypto) -> GenesisDelegCert crypto

-- | Move instantaneous rewards certificate
data MIRCert crypto
MIRCert :: MIRPot -> Map (Credential 'Staking crypto) Coin -> MIRCert crypto
[mirPot] :: MIRCert crypto -> MIRPot
[mirRewards] :: MIRCert crypto -> Map (Credential 'Staking crypto) Coin
newtype StakeCreds crypto
StakeCreds :: Map (Credential 'Staking crypto) SlotNo -> StakeCreds crypto
[unStakeCreds] :: StakeCreds crypto -> Map (Credential 'Staking crypto) SlotNo
newtype PoolDistr crypto
PoolDistr :: Map (KeyHash 'StakePool crypto) (IndividualPoolStake crypto) -> PoolDistr crypto
[unPoolDistr] :: PoolDistr crypto -> Map (KeyHash 'StakePool crypto) (IndividualPoolStake crypto)
data IndividualPoolStake crypto
IndividualPoolStake :: !Rational -> !Hash crypto (VerKeyVRF crypto) -> IndividualPoolStake crypto
[individualPoolStake] :: IndividualPoolStake crypto -> !Rational
[individualPoolStakeVrf] :: IndividualPoolStake crypto -> !Hash crypto (VerKeyVRF crypto)

-- | Determine the certificate author
delegCWitness :: DelegCert crypto -> Credential 'Staking crypto
poolCWitness :: PoolCert crypto -> Credential 'StakePool crypto
genesisCWitness :: GenesisDelegCert crypto -> KeyHash 'Genesis crypto

-- | Check for <a>RegKey</a> constructor
isRegKey :: DCert crypto -> Bool

-- | Check for <a>DeRegKey</a> constructor
isDeRegKey :: DCert crypto -> Bool

-- | Check for <a>Delegation</a> constructor
isDelegation :: DCert crypto -> Bool

-- | Check for <a>GenesisDelegate</a> constructor
isGenesisDelegation :: DCert crypto -> Bool

-- | Check for <a>RegPool</a> constructor
isRegPool :: DCert crypto -> Bool

-- | Check for <a>RetirePool</a> constructor
isRetirePool :: DCert crypto -> Bool
isInstantaneousRewards :: DCert crypto -> Bool
isReservesMIRCert :: DCert crypto -> Bool
isTreasuryMIRCert :: DCert crypto -> Bool

-- | Returns True for delegation certificates that require at least one
--   witness, and False otherwise. It is mainly used to ensure that calling
--   a variant of <tt>cwitness</tt> is safe.
requiresVKeyWitness :: DCert crypto -> Bool
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto)
instance Data.Relation.Relation (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto)
instance Control.Iterate.SetAlgebra.HasExp (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto) (Data.Map.Internal.Map (Shelley.Spec.Ledger.Keys.KeyHash 'Shelley.Spec.Ledger.Keys.StakePool crypto) (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto))
instance Control.Iterate.SetAlgebra.Embed (Shelley.Spec.Ledger.Delegation.Certificates.PoolDistr crypto) (Data.Map.Internal.Map (Shelley.Spec.Ledger.Keys.KeyHash 'Shelley.Spec.Ledger.Keys.StakePool crypto) (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto))
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Delegation.Certificates.IndividualPoolStake crypto)


-- | This module defines the types and functions for a simple UTxO Ledger
--   as specified in <i>A Simplified Formal Specification of a UTxO
--   Ledger</i>.
module Shelley.Spec.Ledger.UTxO

-- | The unspent transaction outputs.
newtype UTxO era
UTxO :: Map (TxIn (Crypto era)) (TxOut era) -> UTxO era
[unUTxO] :: UTxO era -> Map (TxIn (Crypto era)) (TxOut era)

-- | Compute the id of a transaction.
txid :: forall era. TxBodyConstraints era => TxBody era -> TxId (Crypto era)

-- | Compute the UTxO inputs of a transaction.
txins :: HasField "inputs" (TxBody era) (Set (TxIn (Crypto era))) => TxBody era -> Set (TxIn (Crypto era))

-- | Lookup a txin for a given UTxO collection
txinLookup :: TxIn (Crypto era) -> UTxO era -> Maybe (TxOut era)

-- | Compute the transaction outputs of a transaction.
txouts :: (ShelleyBased era, HasField "outputs" (TxBody era) (StrictSeq (TxOut era))) => TxBody era -> UTxO era
txup :: (ShelleyBased era, HasField "update" (TxBody era) (StrictMaybe (Update era))) => Tx era -> Maybe (Update era)

-- | Determine the total balance contained in the UTxO.
balance :: ShelleyBased era => UTxO era -> Value era

-- | Determine the total deposit amount needed. The block may
--   (legitimately) contain multiple registration certificates for the same
--   pool, where the first will be treated as a registration and any
--   subsequent ones as re-registration. As such, we must only take a
--   deposit for the first such registration.
--   
--   Note that this is not an issue for key registrations since subsequent
--   registration certificates would be invalid.
totalDeposits :: PParams era -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> [DCert (Crypto era)] -> Coin

-- | Create a witness for transaction
makeWitnessVKey :: forall crypto kr. (Crypto crypto, DSignable crypto (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> KeyPair kr crypto -> WitVKey 'Witness crypto

-- | Create witnesses for transaction
makeWitnessesVKey :: forall crypto kr. (Crypto crypto, DSignable crypto (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> [KeyPair kr crypto] -> Set (WitVKey 'Witness crypto)

-- | From a list of key pairs and a set of key hashes required for a
--   multi-sig scripts, return the set of required keys.
makeWitnessesFromScriptKeys :: (Crypto crypto, DSignable crypto (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> Map (KeyHash kr crypto) (KeyPair kr crypto) -> Set (KeyHash kr crypto) -> Set (WitVKey 'Witness crypto)

-- | Verify a transaction body witness
verifyWitVKey :: (Typeable kr, Crypto crypto, DSignable crypto (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> WitVKey kr crypto -> Bool

-- | Extract script hash from value address with script.
getScriptHash :: Addr crypto -> Maybe (ScriptHash crypto)

-- | Computes the set of script hashes required to unlock the transcation
--   inputs and the withdrawals.
scriptsNeeded :: (ShelleyBased era, HasField "certs" (TxBody era) (StrictSeq (DCert (Crypto era))), HasField "wdrls" (TxBody era) (Wdrl (Crypto era)), HasField "inputs" (TxBody era) (Set (TxIn (Crypto era)))) => UTxO era -> Tx era -> Set (ScriptHash (Crypto era))
scriptCred :: Credential kr crypto -> Maybe (ScriptHash crypto)
scriptStakeCred :: DCert crypto -> Maybe (ScriptHash crypto)

-- | Compute the subset of inputs of the set <tt>txInps</tt> for which each
--   input is locked by a script in the UTxO <tt>u</tt>.
txinsScript :: ShelleyBased era => Set (TxIn (Crypto era)) -> UTxO era -> Set (TxIn (Crypto era))
instance GHC.Generics.Generic (Shelley.Spec.Ledger.UTxO.UTxO era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.UTxO.UTxO era)
instance Cardano.Ledger.Era.Era era => Control.DeepSeq.NFData (Shelley.Spec.Ledger.UTxO.UTxO era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.UTxO.UTxO era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.UTxO.UTxO era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.UTxO.UTxO era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.UTxO.UTxO era)
instance (Cardano.Ledger.Era.Crypto era GHC.Types.~ crypto) => Control.Iterate.SetAlgebra.HasExp (Shelley.Spec.Ledger.UTxO.UTxO era) (Data.Map.Internal.Map (Shelley.Spec.Ledger.TxBody.TxIn crypto) (Shelley.Spec.Ledger.TxBody.TxOut era))
instance (Cardano.Ledger.Era.Crypto era GHC.Types.~ crypto) => Control.Iterate.SetAlgebra.Embed (Shelley.Spec.Ledger.UTxO.UTxO era) (Data.Map.Internal.Map (Shelley.Spec.Ledger.TxBody.TxIn crypto) (Shelley.Spec.Ledger.TxBody.TxOut era))
instance Data.Relation.Relation (Shelley.Spec.Ledger.UTxO.UTxO era)

module Shelley.Spec.Ledger.Genesis

-- | Genesis Shelley staking configuration.
--   
--   This allows us to configure some initial stake pools and delegation to
--   them, in order to test Praos in a static configuration, without
--   requiring on-chain registration and delegation.
--   
--   For simplicity, pools defined in the genesis staking do not pay
--   deposits for their registration.
data ShelleyGenesisStaking crypto
ShelleyGenesisStaking :: !Map (KeyHash 'StakePool crypto) (PoolParams crypto) -> !Map (KeyHash 'Staking crypto) (KeyHash 'StakePool crypto) -> ShelleyGenesisStaking crypto

-- | Pools to register
--   
--   The key in this map is the hash of the public key of the _pool_. This
--   need not correspond to any payment or staking key, but must correspond
--   to the cold key held by <tt>TPraosIsCoreNode</tt>.
[sgsPools] :: ShelleyGenesisStaking crypto -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto)

-- | Stake-holding key hash credentials and the pools to delegate that
--   stake to. We require the raw staking key hash in order to:
--   
--   <ul>
--   <li>Avoid pointer addresses, which would be tricky when there's no
--   slot or transaction to point to.</li>
--   <li>Avoid script credentials.</li>
--   </ul>
[sgsStake] :: ShelleyGenesisStaking crypto -> !Map (KeyHash 'Staking crypto) (KeyHash 'StakePool crypto)

-- | Shelley genesis information
--   
--   Note that this is needed only for a pure Shelley network, hence it
--   being defined here rather than in its own module. In mainnet, Shelley
--   will transition naturally from Byron, and thus will never have its own
--   genesis information.
data ShelleyGenesis era
ShelleyGenesis :: !UTCTime -> !Word32 -> !Network -> !Rational -> !Word64 -> !EpochSize -> !Word64 -> !Word64 -> !NominalDiffTime -> !Word64 -> !Word64 -> !PParams era -> !Map (KeyHash 'Genesis (Crypto era)) (GenDelegPair (Crypto era)) -> !Map (Addr (Crypto era)) Coin -> !ShelleyGenesisStaking (Crypto era) -> ShelleyGenesis era
[sgSystemStart] :: ShelleyGenesis era -> !UTCTime
[sgNetworkMagic] :: ShelleyGenesis era -> !Word32
[sgNetworkId] :: ShelleyGenesis era -> !Network
[sgActiveSlotsCoeff] :: ShelleyGenesis era -> !Rational
[sgSecurityParam] :: ShelleyGenesis era -> !Word64
[sgEpochLength] :: ShelleyGenesis era -> !EpochSize
[sgSlotsPerKESPeriod] :: ShelleyGenesis era -> !Word64
[sgMaxKESEvolutions] :: ShelleyGenesis era -> !Word64
[sgSlotLength] :: ShelleyGenesis era -> !NominalDiffTime
[sgUpdateQuorum] :: ShelleyGenesis era -> !Word64
[sgMaxLovelaceSupply] :: ShelleyGenesis era -> !Word64
[sgProtocolParams] :: ShelleyGenesis era -> !PParams era
[sgGenDelegs] :: ShelleyGenesis era -> !Map (KeyHash 'Genesis (Crypto era)) (GenDelegPair (Crypto era))
[sgInitialFunds] :: ShelleyGenesis era -> !Map (Addr (Crypto era)) Coin
[sgStaking] :: ShelleyGenesis era -> !ShelleyGenesisStaking (Crypto era)
data ValidationErr
EpochNotLongEnough :: EpochSize -> Word64 -> Rational -> EpochSize -> ValidationErr
MaxKESEvolutionsUnsupported :: Word64 -> Word -> ValidationErr
QuorumTooSmall :: Word64 -> Word64 -> Word64 -> ValidationErr

-- | Empty genesis staking
emptyGenesisStaking :: ShelleyGenesisStaking crypto
sgActiveSlotCoeff :: ShelleyGenesis era -> ActiveSlotCoeff
genesisUtxO :: ShelleyBased era => ShelleyGenesis era -> UTxO era

-- | Compute the <a>TxIn</a> of the initial UTxO pseudo-transaction
--   corresponding to the given address in the genesis initial funds.
--   
--   The Shelley initial UTxO is constructed from the <a>sgInitialFunds</a>
--   which is not a full UTxO but just a map from addresses to coin values.
--   
--   This gets turned into a UTxO by making a pseudo-transaction for each
--   address, with the 0th output being the coin value. So to spend from
--   the initial UTxO we need this same <a>TxIn</a> to use as an input to
--   the spending transaction.
initialFundsPseudoTxIn :: forall crypto. Crypto crypto => Addr crypto -> TxIn crypto

-- | Do some basic sanity checking on the Shelley genesis file.
validateGenesis :: forall era. Era era => ShelleyGenesis era -> Either [ValidationErr] ()
describeValidationErr :: ValidationErr -> Text
mkShelleyGlobals :: ShelleyGenesis era -> EpochInfo Identity -> Natural -> Globals
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Genesis.ShelleyGenesisStaking crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Genesis.ShelleyGenesisStaking crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Genesis.ShelleyGenesisStaking crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Genesis.ShelleyGenesis era)
instance GHC.Show.Show (Shelley.Spec.Ledger.Genesis.ShelleyGenesis era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Genesis.ShelleyGenesis era)
instance GHC.Show.Show Shelley.Spec.Ledger.Genesis.ValidationErr
instance GHC.Classes.Eq Shelley.Spec.Ledger.Genesis.ValidationErr
instance Cardano.Ledger.Era.Era era => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Genesis.ShelleyGenesis era)
instance Cardano.Ledger.Era.Era era => Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.Genesis.ShelleyGenesis era)
instance Cardano.Ledger.Era.Era era => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.Genesis.ShelleyGenesis era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Genesis.ShelleyGenesis era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Genesis.ShelleyGenesis era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Genesis.ShelleyGenesisStaking crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Genesis.ShelleyGenesisStaking crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Genesis.ShelleyGenesisStaking crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.ToJSON.ToJSON (Shelley.Spec.Ledger.Genesis.ShelleyGenesisStaking crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Data.Aeson.Types.FromJSON.FromJSON (Shelley.Spec.Ledger.Genesis.ShelleyGenesisStaking crypto)


-- | This modules implements the necessary functions for the changes that
--   can happen at epoch boundaries.
module Shelley.Spec.Ledger.EpochBoundary

-- | Type of stake as map from hash key to coins associated.
newtype Stake crypto
Stake :: Map (Credential 'Staking crypto) Coin -> Stake crypto
[$sel:unStake:Stake] :: Stake crypto -> Map (Credential 'Staking crypto) Coin

-- | Blocks made
newtype BlocksMade crypto
BlocksMade :: Map (KeyHash 'StakePool crypto) Natural -> BlocksMade crypto
[$sel:unBlocksMade:BlocksMade] :: BlocksMade crypto -> Map (KeyHash 'StakePool crypto) Natural

-- | Snapshot of the stake distribution.
data SnapShot crypto
SnapShot :: !Stake crypto -> !Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto) -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto) -> SnapShot crypto
[$sel:_stake:SnapShot] :: SnapShot crypto -> !Stake crypto
[$sel:_delegations:SnapShot] :: SnapShot crypto -> !Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto)
[$sel:_poolParams:SnapShot] :: SnapShot crypto -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto)

-- | Snapshots of the stake distribution.
data SnapShots crypto
SnapShots :: !SnapShot crypto -> !SnapShot crypto -> !SnapShot crypto -> !Coin -> SnapShots crypto
[$sel:_pstakeMark:SnapShots] :: SnapShots crypto -> !SnapShot crypto
[$sel:_pstakeSet:SnapShots] :: SnapShots crypto -> !SnapShot crypto
[$sel:_pstakeGo:SnapShots] :: SnapShots crypto -> !SnapShot crypto
[$sel:_feeSS:SnapShots] :: SnapShots crypto -> !Coin
emptySnapShot :: SnapShot crypto
emptySnapShots :: SnapShots crypto

-- | Sum up all the Coin for each staking Credential
aggregateUtxoCoinByCredential :: forall era. ShelleyBased era => Map Ptr (Credential 'Staking (Crypto era)) -> UTxO era -> Map (Credential 'Staking (Crypto era)) Coin -> Map (Credential 'Staking (Crypto era)) Coin

-- | Get stake of one pool
poolStake :: KeyHash 'StakePool crypto -> Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto) -> Stake crypto -> Stake crypto

-- | Calculate total possible refunds.
obligation :: PParams era -> Map (Credential 'Staking (Crypto era)) Coin -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> Coin

-- | Calculate maximal pool reward
maxPool :: PParams era -> Coin -> Rational -> Rational -> Coin
instance GHC.Show.Show (Shelley.Spec.Ledger.EpochBoundary.BlocksMade crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.EpochBoundary.BlocksMade crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.EpochBoundary.BlocksMade crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.EpochBoundary.BlocksMade crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.EpochBoundary.BlocksMade crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.EpochBoundary.Stake crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.EpochBoundary.Stake crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.EpochBoundary.Stake crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.EpochBoundary.Stake crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.EpochBoundary.Stake crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.EpochBoundary.SnapShot crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.EpochBoundary.SnapShot crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.EpochBoundary.SnapShot crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.EpochBoundary.SnapShots crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.EpochBoundary.SnapShots crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.EpochBoundary.SnapShots crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.EpochBoundary.BlocksMade crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.EpochBoundary.BlocksMade crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.EpochBoundary.Stake crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.EpochBoundary.Stake crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.EpochBoundary.SnapShots crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.EpochBoundary.SnapShots crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.EpochBoundary.SnapShots crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.EpochBoundary.SnapShots crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.EpochBoundary.SnapShot crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.EpochBoundary.SnapShot crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.EpochBoundary.SnapShot crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.EpochBoundary.SnapShot crypto)

module Shelley.Spec.Ledger.Rewards

-- | Desirability calculation for non-myopic utily, corresponding to f^~ in
--   section 5.6.1 of "Design Specification for Delegation and Incentives
--   in Cardano"
desirability :: PParams era -> Coin -> PoolParams (Crypto era) -> PerformanceEstimate -> Coin -> Double

-- | This is a estimate of the proportion of allowed blocks a pool will
--   make in the future. It is used for ranking pools in delegation.
newtype PerformanceEstimate
PerformanceEstimate :: Double -> PerformanceEstimate
[unPerformanceEstimate] :: PerformanceEstimate -> Double
data NonMyopic crypto
NonMyopic :: !Map (KeyHash 'StakePool crypto) Likelihood -> !Coin -> NonMyopic crypto
[likelihoodsNM] :: NonMyopic crypto -> !Map (KeyHash 'StakePool crypto) Likelihood
[rewardPotNM] :: NonMyopic crypto -> !Coin
emptyNonMyopic :: NonMyopic crypto

-- | Computes the top ranked stake pools corresponding to section 5.6.1 of
--   "Design Specification for Delegation and Incentives in Cardano"
getTopRankedPools :: Coin -> Coin -> PParams era -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> Map (KeyHash 'StakePool (Crypto era)) PerformanceEstimate -> Set (KeyHash 'StakePool (Crypto era))

-- | StakeShare type
newtype StakeShare
StakeShare :: Rational -> StakeShare
[unStakeShare] :: StakeShare -> Rational

-- | Calculate pool reward
mkApparentPerformance :: UnitInterval -> Rational -> Natural -> Natural -> Rational
reward :: PParams era -> BlocksMade (Crypto era) -> Coin -> Set (Credential 'Staking (Crypto era)) -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> Stake (Crypto era) -> Map (Credential 'Staking (Crypto era)) (KeyHash 'StakePool (Crypto era)) -> Coin -> ActiveSlotCoeff -> EpochSize -> (Map (Credential 'Staking (Crypto era)) Coin, Map (KeyHash 'StakePool (Crypto era)) Likelihood)

-- | Compute the Non-Myopic Pool Stake
--   
--   This function implements non-myopic stake calculation in section 5.6.2
--   of "Design Specification for Delegation and Incentives in Cardano".
--   Note that the protocol parameters are implicit in the design document.
--   Additionally, instead of passing a rank r to compare with k, we pass
--   the top k desirable pools and check for membership.
nonMyopicStake :: PParams era -> StakeShare -> StakeShare -> StakeShare -> KeyHash 'StakePool (Crypto era) -> Set (KeyHash 'StakePool (Crypto era)) -> StakeShare

-- | Compute the Non-Myopic Pool Member Reward
--   
--   This function implements equation (3) in section 5.6.4 of "Design
--   Specification for Delegation and Incentives in Cardano". Note that the
--   protocol parameters and the reward pot are implicit in the design
--   document. Additionally, instead of passing a rank r to compare with k,
--   we pass the top k desirable pools and check for membership.
nonMyopicMemberRew :: PParams era -> Coin -> PoolParams (Crypto era) -> StakeShare -> StakeShare -> StakeShare -> Set (KeyHash 'StakePool (Crypto era)) -> PerformanceEstimate -> Coin
percentile' :: Likelihood -> PerformanceEstimate
newtype Histogram
Histogram :: StrictSeq LogWeight -> Histogram
[unHistogram] :: Histogram -> StrictSeq LogWeight
newtype LogWeight
LogWeight :: Float -> LogWeight
[unLogWeight] :: LogWeight -> Float
likelihood :: Natural -> Double -> EpochSize -> Likelihood

-- | Decay previous likelihood
applyDecay :: Float -> Likelihood -> Likelihood
newtype Likelihood
Likelihood :: StrictSeq LogWeight -> Likelihood
[unLikelihood] :: Likelihood -> StrictSeq LogWeight
leaderProbability :: ActiveSlotCoeff -> Rational -> UnitInterval -> Double

-- | Calculate pool leader reward
leaderRew :: Coin -> PoolParams crypto -> StakeShare -> StakeShare -> Coin

-- | Calculate pool member reward
memberRew :: Coin -> PoolParams crypto -> StakeShare -> StakeShare -> Coin
instance GHC.Show.Show Shelley.Spec.Ledger.Rewards.LogWeight
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.Rewards.LogWeight
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Rewards.LogWeight
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Rewards.LogWeight
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.Rewards.LogWeight
instance GHC.Num.Num Shelley.Spec.Ledger.Rewards.LogWeight
instance GHC.Classes.Ord Shelley.Spec.Ledger.Rewards.LogWeight
instance GHC.Generics.Generic Shelley.Spec.Ledger.Rewards.LogWeight
instance GHC.Classes.Eq Shelley.Spec.Ledger.Rewards.LogWeight
instance GHC.Generics.Generic Shelley.Spec.Ledger.Rewards.Histogram
instance GHC.Show.Show Shelley.Spec.Ledger.Rewards.Histogram
instance GHC.Classes.Eq Shelley.Spec.Ledger.Rewards.Histogram
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.Rewards.Likelihood
instance GHC.Generics.Generic Shelley.Spec.Ledger.Rewards.Likelihood
instance GHC.Show.Show Shelley.Spec.Ledger.Rewards.Likelihood
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Rewards.PerformanceEstimate
instance GHC.Generics.Generic Shelley.Spec.Ledger.Rewards.PerformanceEstimate
instance GHC.Classes.Eq Shelley.Spec.Ledger.Rewards.PerformanceEstimate
instance GHC.Show.Show Shelley.Spec.Ledger.Rewards.PerformanceEstimate
instance GHC.Generics.Generic (Shelley.Spec.Ledger.Rewards.NonMyopic crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.Rewards.NonMyopic crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.Rewards.NonMyopic crypto)
instance GHC.Show.Show Shelley.Spec.Ledger.Rewards.StakeShare
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Rewards.StakeShare
instance GHC.Classes.Eq Shelley.Spec.Ledger.Rewards.StakeShare
instance GHC.Classes.Ord Shelley.Spec.Ledger.Rewards.StakeShare
instance GHC.Generics.Generic Shelley.Spec.Ledger.Rewards.StakeShare
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.Rewards.NonMyopic crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.Rewards.NonMyopic crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.Rewards.NonMyopic crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.Rewards.NonMyopic crypto)
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Rewards.PerformanceEstimate
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.Rewards.PerformanceEstimate
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.Rewards.Likelihood
instance GHC.Classes.Eq Shelley.Spec.Ledger.Rewards.Likelihood
instance GHC.Base.Semigroup Shelley.Spec.Ledger.Rewards.Likelihood
instance GHC.Base.Monoid Shelley.Spec.Ledger.Rewards.Likelihood
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.Rewards.Likelihood
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.Rewards.Likelihood


-- | This module implements the operation rules for treating UTxO
--   transactions (<a>Tx</a>) as state transformations on a ledger state
--   (<a>LedgerState</a>), as specified in <i>A Simplified Formal
--   Specification of a UTxO Ledger</i>.
module Shelley.Spec.Ledger.LedgerState
data AccountState
AccountState :: !Coin -> !Coin -> AccountState
[_treasury] :: AccountState -> !Coin
[_reserves] :: AccountState -> !Coin

-- | The state associated with the current stake delegation.
data DPState crypto
DPState :: !DState crypto -> !PState crypto -> DPState crypto
[_dstate] :: DPState crypto -> !DState crypto
[_pstate] :: DPState crypto -> !PState crypto

-- | State of staking pool delegations and rewards
data DState crypto
DState :: !RewardAccounts crypto -> !Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto) -> !Bimap Ptr (Credential 'Staking crypto) -> !Map (FutureGenDeleg crypto) (GenDelegPair crypto) -> !GenDelegs crypto -> !InstantaneousRewards crypto -> DState crypto

-- | The active reward accounts.
[_rewards] :: DState crypto -> !RewardAccounts crypto

-- | The current delegations.
[_delegations] :: DState crypto -> !Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto)

-- | The pointed to hash keys.
[_ptrs] :: DState crypto -> !Bimap Ptr (Credential 'Staking crypto)

-- | future genesis key delegations
[_fGenDelegs] :: DState crypto -> !Map (FutureGenDeleg crypto) (GenDelegPair crypto)

-- | Genesis key delegations
[_genDelegs] :: DState crypto -> !GenDelegs crypto

-- | Instantaneous Rewards
[_irwd] :: DState crypto -> !InstantaneousRewards crypto
data EpochState era
EpochState :: !AccountState -> !SnapShots (Crypto era) -> !LedgerState era -> !PParams era -> !PParams era -> !NonMyopic (Crypto era) -> EpochState era
[esAccountState] :: EpochState era -> !AccountState
[esSnapshots] :: EpochState era -> !SnapShots (Crypto era)
[esLState] :: EpochState era -> !LedgerState era
[esPrevPp] :: EpochState era -> !PParams era
[esPp] :: EpochState era -> !PParams era

-- | This field, esNonMyopic, does not appear in the formal spec and is not
--   a part of the protocol. It is only used for providing data to the
--   stake pool ranking calculation <tt>getNonMyopicMemberRewards</tt>. See
--   <a>https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/specs.pool-ranking/latest/download-by-type/doc-pdf/pool-ranking</a>
[esNonMyopic] :: EpochState era -> !NonMyopic (Crypto era)
data FutureGenDeleg crypto
FutureGenDeleg :: !SlotNo -> !KeyHash 'Genesis crypto -> FutureGenDeleg crypto
[fGenDelegSlot] :: FutureGenDeleg crypto -> !SlotNo
[fGenDelegGenKeyHash] :: FutureGenDeleg crypto -> !KeyHash 'Genesis crypto
data InstantaneousRewards crypto
InstantaneousRewards :: !Map (Credential 'Staking crypto) Coin -> !Map (Credential 'Staking crypto) Coin -> InstantaneousRewards crypto
[iRReserves] :: InstantaneousRewards crypto -> !Map (Credential 'Staking crypto) Coin
[iRTreasury] :: InstantaneousRewards crypto -> !Map (Credential 'Staking crypto) Coin
type Ix = Natural

-- | Representation of a list of pairs of key pairs, e.g., pay and stake
--   keys
type KeyPairs crypto = [(KeyPair 'Payment crypto, KeyPair 'Staking crypto)]

-- | The state associated with a <tt>Ledger</tt>.
data LedgerState era
LedgerState :: !UTxOState era -> !DPState (Crypto era) -> LedgerState era

-- | The current unspent transaction outputs.
[_utxoState] :: LedgerState era -> !UTxOState era

-- | The current delegation state
[_delegationState] :: LedgerState era -> !DPState (Crypto era)
data PPUPState era
PPUPState :: !ProposedPPUpdates era -> !ProposedPPUpdates era -> PPUPState era
[proposals] :: PPUPState era -> !ProposedPPUpdates era
[futureProposals] :: PPUPState era -> !ProposedPPUpdates era

-- | Current state of staking pools and their certificate counters.
data PState crypto
PState :: !Map (KeyHash 'StakePool crypto) (PoolParams crypto) -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto) -> !Map (KeyHash 'StakePool crypto) EpochNo -> PState crypto

-- | The pool parameters.
[_pParams] :: PState crypto -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto)

-- | The future pool parameters.
[_fPParams] :: PState crypto -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto)

-- | A map of retiring stake pools to the epoch when they retire.
[_retiring] :: PState crypto -> !Map (KeyHash 'StakePool crypto) EpochNo
type RewardAccounts crypto = Map (Credential 'Staking crypto) Coin
data RewardUpdate crypto
RewardUpdate :: !DeltaCoin -> !DeltaCoin -> !Map (Credential 'Staking crypto) Coin -> !DeltaCoin -> !NonMyopic crypto -> RewardUpdate crypto
[deltaT] :: RewardUpdate crypto -> !DeltaCoin
[deltaR] :: RewardUpdate crypto -> !DeltaCoin
[rs] :: RewardUpdate crypto -> !Map (Credential 'Staking crypto) Coin
[deltaF] :: RewardUpdate crypto -> !DeltaCoin
[nonMyopic] :: RewardUpdate crypto -> !NonMyopic crypto
data UTxOState era
UTxOState :: !UTxO era -> !Coin -> !Coin -> !PPUPState era -> UTxOState era
[_utxo] :: UTxOState era -> !UTxO era
[_deposited] :: UTxOState era -> !Coin
[_fees] :: UTxOState era -> !Coin
[_ppups] :: UTxOState era -> !PPUPState era

-- | Calculate the change to the deposit pool for a given transaction.
depositPoolChange :: HasField "certs" (TxBody era) (StrictSeq (DCert (Crypto era))) => LedgerState era -> PParams era -> TxBody era -> Coin
emptyAccount :: AccountState
emptyDPState :: DPState crypto
emptyDState :: DState crypto
emptyEpochState :: EpochState era
emptyInstantaneousRewards :: InstantaneousRewards crypto
emptyLedgerState :: LedgerState era
emptyPPUPState :: PPUPState era
emptyPState :: PState crypto
emptyRewardUpdate :: RewardUpdate crypto
emptyUTxOState :: UTxOState era
pvCanFollow :: ProtVer -> StrictMaybe ProtVer -> Bool
reapRewards :: RewardAccounts crypto -> RewardAccounts crypto -> RewardAccounts crypto
totalInstantaneousReservesRewards :: InstantaneousRewards crypto -> Coin

-- | Update the protocol parameter updates by clearing out the proposals
--   and making the future proposals become the new proposals, provided the
--   new proposals can follow (otherwise reset them).
updatePpup :: UTxOState era -> PParams era -> UTxOState era
emptyDelegation :: DPState crypto

-- | Creates the ledger state for an empty ledger which contains the
--   specified transaction outputs.
genesisState :: Map (KeyHash 'Genesis (Crypto era)) (GenDelegPair (Crypto era)) -> UTxO era -> LedgerState era
newtype WitHashes crypto
WitHashes :: Set (KeyHash 'Witness crypto) -> WitHashes crypto
[unWitHashes] :: WitHashes crypto -> Set (KeyHash 'Witness crypto)

-- | Check if a set of witness hashes is empty.
nullWitHashes :: WitHashes crypto -> Bool

-- | Extract the difference between two sets of witness hashes.
diffWitHashes :: WitHashes crypto -> WitHashes crypto -> WitHashes crypto

-- | Minimum fee calculation
minfee :: PParams era -> Tx era -> Coin

-- | Minimum fee bound using txsizeBound
minfeeBound :: forall era. (ShelleyBased era, HasField "outputs" (TxBody era) (StrictSeq (TxOut era)), HasField "inputs" (TxBody era) (Set (TxIn (Crypto era)))) => PParams era -> Tx era -> Coin

-- | Implementation of abstract transaction size
txsize :: Tx era -> Integer

-- | Convenience Function to bound the txsize function. | It can be helpful
--   for coin selection.
txsizeBound :: forall era. (ShelleyBased era, HasField "outputs" (TxBody era) (StrictSeq (TxOut era)), HasField "inputs" (TxBody era) (Set (TxIn (Crypto era)))) => Tx era -> Integer

-- | Compute the lovelace which are created by the transaction
produced :: (ShelleyBased era, HasField "certs" (TxBody era) (StrictSeq (DCert (Crypto era))), HasField "outputs" (TxBody era) (StrictSeq (TxOut era)), HasField "txfee" (TxBody era) Coin) => PParams era -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> TxBody era -> Value era

-- | Compute the lovelace which are destroyed by the transaction
consumed :: forall era. (ShelleyBased era, HasField "certs" (TxBody era) (StrictSeq (DCert (Crypto era))), HasField "inputs" (TxBody era) (Set (TxIn (Crypto era))), HasField "wdrls" (TxBody era) (Wdrl (Crypto era))) => PParams era -> UTxO era -> TxBody era -> Value era

-- | Given a ledger state, determine if the UTxO witnesses in a given
--   transaction are correct.
verifiedWits :: (TxBodyConstraints era, AnnotatedData (Script era), ToCBOR (AuxiliaryData era), DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) => Tx era -> Either [VKey 'Witness (Crypto era)] ()

-- | Collect the set of hashes of keys that needs to sign a given
--   transaction. This set consists of the txin owners, certificate
--   authors, and withdrawal reward accounts.
witsVKeyNeeded :: forall era. (ShelleyBased era, HasField "wdrls" (TxBody era) (Wdrl (Crypto era)), HasField "certs" (TxBody era) (StrictSeq (DCert (Crypto era))), HasField "inputs" (TxBody era) (Set (TxIn (Crypto era))), HasField "update" (TxBody era) (StrictMaybe (Update era))) => UTxO era -> Tx era -> GenDelegs (Crypto era) -> WitHashes (Crypto era)

-- | Extract the witness hashes from the Witness set.
witsFromWitnessSet :: (Era era, AnnotatedData (Script era)) => WitnessSet era -> WitHashes (Crypto era)

-- | Compute the key deregistration refunds in a transaction
keyRefunds :: HasField "certs" (TxBody era) (StrictSeq (DCert (Crypto era))) => PParams era -> TxBody era -> Coin
stakeDistr :: forall era. ShelleyBased era => UTxO era -> DState (Crypto era) -> PState (Crypto era) -> SnapShot (Crypto era)

-- | Apply a reward update
applyRUpd :: RewardUpdate (Crypto era) -> EpochState era -> EpochState era

-- | Create a reward update
createRUpd :: EpochSize -> BlocksMade (Crypto era) -> EpochState era -> Coin -> ShelleyBase (RewardUpdate (Crypto era))

-- | New Epoch state and environment
data NewEpochState era
NewEpochState :: !EpochNo -> !BlocksMade (Crypto era) -> !BlocksMade (Crypto era) -> !EpochState era -> !StrictMaybe (RewardUpdate (Crypto era)) -> !PoolDistr (Crypto era) -> NewEpochState era

-- | Last epoch
[nesEL] :: NewEpochState era -> !EpochNo

-- | Blocks made before current epoch
[nesBprev] :: NewEpochState era -> !BlocksMade (Crypto era)

-- | Blocks made in current epoch
[nesBcur] :: NewEpochState era -> !BlocksMade (Crypto era)

-- | Epoch state before current
[nesEs] :: NewEpochState era -> !EpochState era

-- | Possible reward update
[nesRu] :: NewEpochState era -> !StrictMaybe (RewardUpdate (Crypto era))

-- | Stake distribution within the stake pool
[nesPd] :: NewEpochState era -> !PoolDistr (Crypto era)
getGKeys :: NewEpochState era -> Set (KeyHash 'Genesis (Crypto era))

-- | Update new epoch state
updateNES :: NewEpochState era -> BlocksMade (Crypto era) -> LedgerState era -> NewEpochState era

-- | Calculate the current circulation
--   
--   This is used in the rewards calculation, and for API endpoints for
--   pool ranking.
circulation :: EpochState era -> Coin -> Coin
decayFactor :: Float
returnRedeemAddrsToReserves :: ShelleyBased era => EpochState era -> EpochState era
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.FutureGenDeleg crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.LedgerState.FutureGenDeleg crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.FutureGenDeleg crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.FutureGenDeleg crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.InstantaneousRewards crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.InstantaneousRewards crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.InstantaneousRewards crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.DState crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.DState crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.DState crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.PState crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.PState crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.PState crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.DPState crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.DPState crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.DPState crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.RewardUpdate crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.RewardUpdate crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.RewardUpdate crypto)
instance GHC.Generics.Generic Shelley.Spec.Ledger.LedgerState.AccountState
instance GHC.Classes.Eq Shelley.Spec.Ledger.LedgerState.AccountState
instance GHC.Show.Show Shelley.Spec.Ledger.LedgerState.AccountState
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.PPUPState era)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.PPUPState era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.PPUPState era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.PPUPState era)
instance GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.PPUPState era)
instance Cardano.Ledger.Era.Era era => Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.UTxOState era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.UTxOState era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.LedgerState era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.EpochState era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.NewEpochState era)
instance GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.WitHashes crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.LedgerState.WitHashes crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.WitHashes crypto)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.EpochState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.EpochState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.UTxOState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.UTxOState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.NewEpochState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.NewEpochState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.LedgerState.LedgerState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.LedgerState.LedgerState era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.WitHashes crypto)
instance Cardano.Ledger.Era.Era era => Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.NewEpochState era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.NewEpochState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.NewEpochState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.NewEpochState era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.EpochState era)
instance Cardano.Ledger.Era.Era era => Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.EpochState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.EpochState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.EpochState era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.LedgerState era)
instance Cardano.Ledger.Era.Era era => Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.LedgerState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.LedgerState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.LedgerState era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.UTxOState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.UTxOState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.UTxOState era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.PPUPState era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.PPUPState era)
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.LedgerState.AccountState
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.LedgerState.AccountState
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.LedgerState.AccountState
instance Control.DeepSeq.NFData Shelley.Spec.Ledger.LedgerState.AccountState
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.RewardUpdate crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.RewardUpdate crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.RewardUpdate crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.RewardUpdate crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.DPState crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.DPState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.DPState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.DPState crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.PState crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.PState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.PState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.PState crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.DState crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.DState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.DState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.DState crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.InstantaneousRewards crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.InstantaneousRewards crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.InstantaneousRewards crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.InstantaneousRewards crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.LedgerState.FutureGenDeleg crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.LedgerState.FutureGenDeleg crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.LedgerState.FutureGenDeleg crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.LedgerState.FutureGenDeleg crypto)

module Shelley.Spec.Ledger.STS.Snap
data SNAP era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data SnapPredicateFailure era
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Snap.SnapPredicateFailure era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Snap.SnapPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Snap.SnapPredicateFailure era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Snap.SnapPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Snap.SNAP era)

module Shelley.Spec.Ledger.STS.Rupd
data RUPD era
data RupdEnv era
RupdEnv :: BlocksMade (Crypto era) -> EpochState era -> RupdEnv era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data RupdPredicateFailure era
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Rupd.RupdPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Rupd.RupdPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Rupd.RupdPredicateFailure era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Rupd.RupdPredicateFailure era)
instance Data.Typeable.Internal.Typeable era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Rupd.RUPD era)

module Shelley.Spec.Ledger.STS.Ppup
data PPUP era
data PPUPEnv era
PPUPEnv :: SlotNo -> PParams era -> GenDelegs (Crypto era) -> PPUPEnv era
data PpupPredicateFailure era
NonGenesisUpdatePPUP :: !Set (KeyHash 'Genesis (Crypto era)) -> !Set (KeyHash 'Genesis (Crypto era)) -> PpupPredicateFailure era
PPUpdateWrongEpoch :: !EpochNo -> !EpochNo -> !VotingPeriod -> PpupPredicateFailure era
PVCannotFollowPPUP :: !ProtVer -> PpupPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data VotingPeriod
VoteForThisEpoch :: VotingPeriod
VoteForNextEpoch :: VotingPeriod
instance GHC.Generics.Generic Shelley.Spec.Ledger.STS.Ppup.VotingPeriod
instance GHC.Classes.Eq Shelley.Spec.Ledger.STS.Ppup.VotingPeriod
instance GHC.Show.Show Shelley.Spec.Ledger.STS.Ppup.VotingPeriod
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Ppup.PpupPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Ppup.PpupPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Ppup.PpupPredicateFailure era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Ppup.PpupPredicateFailure era)
instance Data.Typeable.Internal.Typeable era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Ppup.PPUP era)
instance (Data.Typeable.Internal.Typeable era, Cardano.Ledger.Era.Era era) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Ppup.PpupPredicateFailure era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Ppup.PpupPredicateFailure era)
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.STS.Ppup.VotingPeriod
instance Cardano.Binary.ToCBOR.ToCBOR Shelley.Spec.Ledger.STS.Ppup.VotingPeriod
instance Cardano.Binary.FromCBOR.FromCBOR Shelley.Spec.Ledger.STS.Ppup.VotingPeriod

module Shelley.Spec.Ledger.STS.Utxo
data UTXO era
data UtxoEnv era
UtxoEnv :: SlotNo -> PParams era -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> GenDelegs (Crypto era) -> UtxoEnv era
data UtxoPredicateFailure era
BadInputsUTxO :: !Set (TxIn (Crypto era)) -> UtxoPredicateFailure era
ExpiredUTxO :: !SlotNo -> !SlotNo -> UtxoPredicateFailure era
MaxTxSizeUTxO :: !Integer -> !Integer -> UtxoPredicateFailure era
InputSetEmptyUTxO :: UtxoPredicateFailure era
FeeTooSmallUTxO :: !Coin -> !Coin -> UtxoPredicateFailure era
ValueNotConservedUTxO :: !Delta (Value era) -> !Delta (Value era) -> UtxoPredicateFailure era
WrongNetwork :: !Network -> !Set (Addr (Crypto era)) -> UtxoPredicateFailure era
WrongNetworkWithdrawal :: !Network -> !Set (RewardAcnt (Crypto era)) -> UtxoPredicateFailure era
OutputTooSmallUTxO :: ![TxOut era] -> UtxoPredicateFailure era
UpdateFailure :: PredicateFailure (PPUP era) -> UtxoPredicateFailure era
OutputBootAddrAttrsTooBig :: ![TxOut era] -> UtxoPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Utxo.UtxoEnv era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Utxo.UtxoPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.STS.Utxo.UtxoPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Utxo.UtxoPredicateFailure era)
instance NoThunks.Class.NoThunks (Cardano.Ledger.Torsor.Delta (Cardano.Ledger.Core.Value era)) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Utxo.UtxoPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Utxo.UtxoPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Utxo.UtxoPredicateFailure era)
instance (Cardano.Ledger.Crypto.Crypto c, Cardano.Ledger.Core.TxBody (Cardano.Ledger.Shelley.ShelleyEra c) GHC.Types.~ Shelley.Spec.Ledger.TxBody.TxBody (Cardano.Ledger.Shelley.ShelleyEra c)) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Utxo.UTXO (Cardano.Ledger.Shelley.ShelleyEra c))
instance Cardano.Ledger.Crypto.Crypto c => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Ppup.PPUP (Cardano.Ledger.Shelley.ShelleyEra c)) (Shelley.Spec.Ledger.STS.Utxo.UTXO (Cardano.Ledger.Shelley.ShelleyEra c))

module Shelley.Spec.Ledger.STS.Utxow
data UTXOW era
data UtxowPredicateFailure era
InvalidWitnessesUTXOW :: ![VKey 'Witness (Crypto era)] -> UtxowPredicateFailure era
MissingVKeyWitnessesUTXOW :: !WitHashes (Crypto era) -> UtxowPredicateFailure era
MissingScriptWitnessesUTXOW :: !Set (ScriptHash (Crypto era)) -> UtxowPredicateFailure era
ScriptWitnessNotValidatingUTXOW :: !Set (ScriptHash (Crypto era)) -> UtxowPredicateFailure era
UtxoFailure :: PredicateFailure (UTXO era) -> UtxowPredicateFailure era
MIRInsufficientGenesisSigsUTXOW :: Set (KeyHash 'Witness (Crypto era)) -> UtxowPredicateFailure era
MissingTxBodyMetadataHash :: !AuxiliaryDataHash (Crypto era) -> UtxowPredicateFailure era
MissingTxMetadata :: !AuxiliaryDataHash (Crypto era) -> UtxowPredicateFailure era
ConflictingMetadataHash :: !AuxiliaryDataHash (Crypto era) -> !AuxiliaryDataHash (Crypto era) -> UtxowPredicateFailure era
InvalidMetadata :: UtxowPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
utxoWitnessed :: forall era. (ShelleyBased era, ValidateScript era, ValidateAuxiliaryData era, STS (UTXOW era), BaseM (UTXOW era) ~ ShelleyBase, Embed (UTXO era) (UTXOW era), DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody), Environment (UTXO era) ~ UtxoEnv era, State (UTXO era) ~ UTxOState era, Signal (UTXO era) ~ Tx era, Environment (UTXOW era) ~ UtxoEnv era, State (UTXOW era) ~ UTxOState era, Signal (UTXOW era) ~ Tx era, PredicateFailure (UTXOW era) ~ UtxowPredicateFailure era, HasField "inputs" (TxBody era) (Set (TxIn (Crypto era))), HasField "wdrls" (TxBody era) (Wdrl (Crypto era)), HasField "certs" (TxBody era) (StrictSeq (DCert (Crypto era))), HasField "adHash" (TxBody era) (StrictMaybe (AuxiliaryDataHash (Crypto era))), HasField "update" (TxBody era) (StrictMaybe (Update era))) => (UTxO era -> Tx era -> Set (ScriptHash (Crypto era))) -> TransitionRule (UTXOW era)
initialLedgerStateUTXOW :: forall era. (Embed (UTXO era) (UTXOW era), Environment (UTXOW era) ~ UtxoEnv era, State (UTXOW era) ~ UTxOState era, Environment (UTXO era) ~ UtxoEnv era, State (UTXO era) ~ UTxOState era) => InitialRule (UTXOW era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Utxow.UtxowPredicateFailure era)
instance (GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxo.UTXO era)), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Utxow.UtxowPredicateFailure era)
instance (GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxo.UTXO era)), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => GHC.Show.Show (Shelley.Spec.Ledger.STS.Utxow.UtxowPredicateFailure era)
instance (NoThunks.Class.NoThunks (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxo.UTXO era)), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Utxow.UtxowPredicateFailure era)
instance (Cardano.Ledger.Crypto.Crypto c, Shelley.Spec.Ledger.Keys.DSignable c (Shelley.Spec.Ledger.Keys.Hash c Shelley.Spec.Ledger.Hashing.EraIndependentTxBody)) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Utxow.UTXOW (Cardano.Ledger.Shelley.ShelleyEra c))
instance (Cardano.Ledger.Era.Era era, Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.Script era), Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.AuxiliaryData era), Cardano.Binary.ToCBOR.ToCBOR (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxo.UTXO era))) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Utxow.UtxowPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, Cardano.Binary.FromCBOR.FromCBOR (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxo.UTXO era)), Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.Script era), Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.AuxiliaryData era)) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Utxow.UtxowPredicateFailure era)
instance Cardano.Ledger.Crypto.Crypto c => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Utxo.UTXO (Cardano.Ledger.Shelley.ShelleyEra c)) (Shelley.Spec.Ledger.STS.Utxow.UTXOW (Cardano.Ledger.Shelley.ShelleyEra c))

module Shelley.Spec.Ledger.STS.PoolReap
data POOLREAP era
data PoolreapState era
PoolreapState :: UTxOState era -> AccountState -> DState (Crypto era) -> PState (Crypto era) -> PoolreapState era
[prUTxOSt] :: PoolreapState era -> UTxOState era
[prAcnt] :: PoolreapState era -> AccountState
[prDState] :: PoolreapState era -> DState (Crypto era)
[prPState] :: PoolreapState era -> PState (Crypto era)

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data PoolreapPredicateFailure era
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.PoolReap.PoolreapPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.PoolReap.PoolreapPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.PoolReap.PoolreapPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.STS.PoolReap.PoolreapState era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.PoolReap.PoolreapPredicateFailure era)
instance Data.Typeable.Internal.Typeable era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.PoolReap.POOLREAP era)

module Shelley.Spec.Ledger.STS.Pool
data POOL (era :: Type)
data PoolEnv era
PoolEnv :: SlotNo -> PParams era -> PoolEnv era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data PoolPredicateFailure era
StakePoolNotRegisteredOnKeyPOOL :: !KeyHash 'StakePool (Crypto era) -> PoolPredicateFailure era
StakePoolRetirementWrongEpochPOOL :: !Word64 -> !Word64 -> !Word64 -> PoolPredicateFailure era
WrongCertificateTypePOOL :: !Word8 -> PoolPredicateFailure era
StakePoolCostTooLowPOOL :: !Coin -> !Coin -> PoolPredicateFailure era
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Pool.PoolEnv era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Pool.PoolEnv era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Pool.PoolPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Pool.PoolPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Pool.PoolPredicateFailure era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Pool.PoolPredicateFailure era)
instance Data.Typeable.Internal.Typeable era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Pool.POOL era)
instance (Data.Typeable.Internal.Typeable era, Cardano.Ledger.Era.Era era) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Pool.PoolPredicateFailure era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Pool.PoolPredicateFailure era)

module Shelley.Spec.Ledger.STS.Newpp
data NEWPP era
data NewppState era
NewppState :: UTxOState era -> AccountState -> PParams era -> NewppState era
data NewppEnv era
NewppEnv :: DState (Crypto era) -> PState (Crypto era) -> NewppEnv era
data NewppPredicateFailure era
UnexpectedDepositPot :: !Coin -> !Coin -> NewppPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Newpp.NewppPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Newpp.NewppPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Newpp.NewppPredicateFailure era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Newpp.NewppPredicateFailure era)
instance Data.Typeable.Internal.Typeable era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Newpp.NEWPP era)

module Shelley.Spec.Ledger.STS.Mir
data MIR era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data MirPredicateFailure era
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Mir.MirPredicateFailure era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Mir.MirPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Mir.MirPredicateFailure era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Mir.MirPredicateFailure era)
instance Data.Typeable.Internal.Typeable era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Mir.MIR era)

module Shelley.Spec.Ledger.STS.Epoch
data EPOCH era
data EpochPredicateFailure era
PoolReapFailure :: PredicateFailure (POOLREAP era) -> EpochPredicateFailure era
SnapFailure :: PredicateFailure (SNAP era) -> EpochPredicateFailure era
NewPpFailure :: PredicateFailure (NEWPP era) -> EpochPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Epoch.EpochPredicateFailure era)
instance GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Snap.SNAP era)) => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Epoch.EpochPredicateFailure era)
instance GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Snap.SNAP era)) => GHC.Show.Show (Shelley.Spec.Ledger.STS.Epoch.EpochPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Epoch.EPOCH era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Epoch.EpochPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Snap.SNAP era) (Shelley.Spec.Ledger.STS.Epoch.EPOCH era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.PoolReap.POOLREAP era) (Shelley.Spec.Ledger.STS.Epoch.EPOCH era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Newpp.NEWPP era) (Shelley.Spec.Ledger.STS.Epoch.EPOCH era)

module Shelley.Spec.Ledger.STS.NewEpoch
data NEWEPOCH era
data NewEpochPredicateFailure era
EpochFailure :: PredicateFailure (EPOCH era) -> NewEpochPredicateFailure era
CorruptRewardUpdate :: !RewardUpdate (Crypto era) -> NewEpochPredicateFailure era
MirFailure :: PredicateFailure (MIR era) -> NewEpochPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
calculatePoolDistr :: SnapShot crypto -> PoolDistr crypto
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.NewEpoch.NewEpochPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.NewEpoch.NewEpochPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.NewEpoch.NewEpochPredicateFailure era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.NewEpoch.NewEpochPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.NewEpoch.NEWEPOCH era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Epoch.EPOCH era) (Shelley.Spec.Ledger.STS.NewEpoch.NEWEPOCH era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Mir.MIR era) (Shelley.Spec.Ledger.STS.NewEpoch.NEWEPOCH era)

module Shelley.Spec.Ledger.STS.Tick
data TICK era

-- | Type of the state which the system transitions between.
type family State a
data TickPredicateFailure era
NewEpochFailure :: PredicateFailure (NEWEPOCH era) -> TickPredicateFailure era
RupdFailure :: PredicateFailure (RUPD era) -> TickPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
adoptGenesisDelegs :: EpochState era -> SlotNo -> EpochState era
data TICKF era
data TickfPredicateFailure era
TickfNewEpochFailure :: PredicateFailure (NEWEPOCH era) -> TickfPredicateFailure era
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Tick.TickPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Tick.TickfPredicateFailure era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Tick.TickfPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Tick.TickfPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Tick.TickPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Tick.TickPredicateFailure era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Tick.TickfPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Tick.TICKF era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.NewEpoch.NEWEPOCH era) (Shelley.Spec.Ledger.STS.Tick.TICKF era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Tick.TickPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Tick.TICK era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.NewEpoch.NEWEPOCH era) (Shelley.Spec.Ledger.STS.Tick.TICK era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Rupd.RUPD era) (Shelley.Spec.Ledger.STS.Tick.TICK era)

module Shelley.Spec.Ledger.STS.Deleg
data DELEG era
data DelegEnv
DelegEnv :: SlotNo -> Ptr -> AccountState -> DelegEnv
[slotNo] :: DelegEnv -> SlotNo
[ptr_] :: DelegEnv -> Ptr
[acnt_] :: DelegEnv -> AccountState

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data DelegPredicateFailure era
StakeKeyAlreadyRegisteredDELEG :: !Credential 'Staking (Crypto era) -> DelegPredicateFailure era

-- | Indicates that the stake key is somehow already in the rewards map.
--   This error is now redundant with StakeKeyAlreadyRegisteredDELEG. We
--   should remove it and replace its one use with
--   StakeKeyAlreadyRegisteredDELEG.
StakeKeyInRewardsDELEG :: !Credential 'Staking (Crypto era) -> DelegPredicateFailure era
StakeKeyNotRegisteredDELEG :: !Credential 'Staking (Crypto era) -> DelegPredicateFailure era
StakeKeyNonZeroAccountBalanceDELEG :: !Maybe Coin -> DelegPredicateFailure era
StakeDelegationImpossibleDELEG :: !Credential 'Staking (Crypto era) -> DelegPredicateFailure era
WrongCertificateTypeDELEG :: DelegPredicateFailure era
GenesisKeyNotInMappingDELEG :: !KeyHash 'Genesis (Crypto era) -> DelegPredicateFailure era
DuplicateGenesisDelegateDELEG :: !KeyHash 'GenesisDelegate (Crypto era) -> DelegPredicateFailure era
InsufficientForInstantaneousRewardsDELEG :: !MIRPot -> !Coin -> !Coin -> DelegPredicateFailure era
MIRCertificateTooLateinEpochDELEG :: !SlotNo -> !SlotNo -> DelegPredicateFailure era
DuplicateGenesisVRFDELEG :: !Hash (Crypto era) (VerKeyVRF (Crypto era)) -> DelegPredicateFailure era
instance GHC.Classes.Eq Shelley.Spec.Ledger.STS.Deleg.DelegEnv
instance GHC.Show.Show Shelley.Spec.Ledger.STS.Deleg.DelegEnv
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Deleg.DelegPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Deleg.DelegPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Deleg.DelegPredicateFailure era)
instance Data.Typeable.Internal.Typeable era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Deleg.DELEG era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Deleg.DelegPredicateFailure era)
instance (Data.Typeable.Internal.Typeable era, Cardano.Ledger.Era.Era era, Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.Script era)) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Deleg.DelegPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.Script era)) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Deleg.DelegPredicateFailure era)

module Shelley.Spec.Ledger.STS.Delpl
data DELPL era
data DelplEnv era
DelplEnv :: SlotNo -> Ptr -> PParams era -> AccountState -> DelplEnv era
[delplSlotNo] :: DelplEnv era -> SlotNo
[delPlPtr] :: DelplEnv era -> Ptr
[delPlPp] :: DelplEnv era -> PParams era
[delPlAcnt] :: DelplEnv era -> AccountState
data DelplPredicateFailure era
PoolFailure :: PredicateFailure (POOL era) -> DelplPredicateFailure era
DelegFailure :: PredicateFailure (DELEG era) -> DelplPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Delpl.DelplPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Delpl.DelplPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Delpl.DelplPredicateFailure era)
instance Cardano.Ledger.Era.Era era => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Delpl.DELPL era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Delpl.DelplPredicateFailure era)
instance (Data.Typeable.Internal.Typeable era, Cardano.Ledger.Era.Era era, Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.Script era)) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Delpl.DelplPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.Script era)) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Delpl.DelplPredicateFailure era)
instance Cardano.Ledger.Era.Era era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Pool.POOL era) (Shelley.Spec.Ledger.STS.Delpl.DELPL era)
instance Cardano.Ledger.Era.Era era => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Deleg.DELEG era) (Shelley.Spec.Ledger.STS.Delpl.DELPL era)

module Shelley.Spec.Ledger.STS.Delegs
data DELEGS era
data DelegsEnv era
DelegsEnv :: SlotNo -> Ix -> PParams era -> Tx era -> AccountState -> DelegsEnv era
[delegsSlotNo] :: DelegsEnv era -> SlotNo
[delegsIx] :: DelegsEnv era -> Ix
[delegspp] :: DelegsEnv era -> PParams era
[delegsTx] :: DelegsEnv era -> Tx era
[delegsAccount] :: DelegsEnv era -> AccountState
data DelegsPredicateFailure era
DelegateeNotRegisteredDELEG :: !KeyHash 'StakePool (Crypto era) -> DelegsPredicateFailure era
WithdrawalsNotInRewardsDELEGS :: !Map (RewardAcnt (Crypto era)) Coin -> DelegsPredicateFailure era
DelplFailure :: PredicateFailure (DELPL era) -> DelegsPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Delegs.DelegsPredicateFailure era)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Delegs.DelegsPredicateFailure era)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Delegs.DelegsPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.STS.Delegs.DelegsEnv era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era, GHC.Records.HasField "wdrls" (Cardano.Ledger.Core.TxBody era) (Shelley.Spec.Ledger.TxBody.Wdrl (Cardano.Ledger.Era.Crypto era))) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Delegs.DELEGS era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Delegs.DelegsPredicateFailure era)
instance (Data.Typeable.Internal.Typeable era, Cardano.Ledger.Era.Era era, Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.Script era)) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Delegs.DelegsPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, Data.Typeable.Internal.Typeable (Cardano.Ledger.Core.Script era)) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Delegs.DelegsPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era, GHC.Records.HasField "wdrls" (Cardano.Ledger.Core.TxBody era) (Shelley.Spec.Ledger.TxBody.Wdrl (Cardano.Ledger.Era.Crypto era))) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Delpl.DELPL era) (Shelley.Spec.Ledger.STS.Delegs.DELEGS era)

module Shelley.Spec.Ledger.STS.Ledger
data LEDGER era
data LedgerEnv era
LedgerEnv :: SlotNo -> Ix -> PParams era -> AccountState -> LedgerEnv era
[ledgerSlotNo] :: LedgerEnv era -> SlotNo
[ledgerIx] :: LedgerEnv era -> Ix
[ledgerPp] :: LedgerEnv era -> PParams era
[ledgerAccount] :: LedgerEnv era -> AccountState
data LedgerPredicateFailure era
UtxowFailure :: PredicateFailure (UTXOW era) -> LedgerPredicateFailure era
DelegsFailure :: PredicateFailure (DELEGS era) -> LedgerPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Ledger.LedgerEnv era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Ledger.LedgerPredicateFailure era)
instance (GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Delegs.DELEGS era)), GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxow.UTXOW era)), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => GHC.Show.Show (Shelley.Spec.Ledger.STS.Ledger.LedgerPredicateFailure era)
instance (GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Delegs.DELEGS era)), GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxow.UTXOW era)), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Ledger.LedgerPredicateFailure era)
instance (NoThunks.Class.NoThunks (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Delegs.DELEGS era)), NoThunks.Class.NoThunks (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxow.UTXOW era)), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Ledger.LedgerPredicateFailure era)
instance (Cardano.Binary.ToCBOR.ToCBOR (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Delegs.DELEGS era)), Cardano.Binary.ToCBOR.ToCBOR (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxow.UTXOW era)), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Ledger.LedgerPredicateFailure era)
instance (Cardano.Binary.FromCBOR.FromCBOR (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Delegs.DELEGS era)), Cardano.Binary.FromCBOR.FromCBOR (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Utxow.UTXOW era)), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Ledger.LedgerPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, Shelley.Spec.Ledger.Keys.DSignable (Cardano.Ledger.Era.Crypto era) (Shelley.Spec.Ledger.Keys.Hash (Cardano.Ledger.Era.Crypto era) Shelley.Spec.Ledger.Hashing.EraIndependentTxBody), Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Delegs.DELEGS era) (Shelley.Spec.Ledger.STS.Ledger.LEDGER era), Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Utxow.UTXOW era) (Shelley.Spec.Ledger.STS.Ledger.LEDGER era), Control.State.Transition.Extended.Environment (Shelley.Spec.Ledger.STS.Utxow.UTXOW era) GHC.Types.~ Shelley.Spec.Ledger.STS.Utxo.UtxoEnv era, Control.State.Transition.Extended.State (Shelley.Spec.Ledger.STS.Utxow.UTXOW era) GHC.Types.~ Shelley.Spec.Ledger.LedgerState.UTxOState era, Control.State.Transition.Extended.Signal (Shelley.Spec.Ledger.STS.Utxow.UTXOW era) GHC.Types.~ Shelley.Spec.Ledger.Tx.Tx era, Control.State.Transition.Extended.Environment (Shelley.Spec.Ledger.STS.Delegs.DELEGS era) GHC.Types.~ Shelley.Spec.Ledger.STS.Delegs.DelegsEnv era, Control.State.Transition.Extended.State (Shelley.Spec.Ledger.STS.Delegs.DELEGS era) GHC.Types.~ Shelley.Spec.Ledger.LedgerState.DPState (Cardano.Ledger.Era.Crypto era), Control.State.Transition.Extended.Signal (Shelley.Spec.Ledger.STS.Delegs.DELEGS era) GHC.Types.~ Data.Sequence.Internal.Seq (Shelley.Spec.Ledger.TxBody.DCert (Cardano.Ledger.Era.Crypto era)), GHC.Records.HasField "certs" (Cardano.Ledger.Core.TxBody era) (Data.Sequence.Strict.StrictSeq (Shelley.Spec.Ledger.TxBody.DCert (Cardano.Ledger.Era.Crypto era)))) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Ledger.LEDGER era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Delegs.DELEGS era)) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Delegs.DELEGS era) (Shelley.Spec.Ledger.STS.Ledger.LEDGER era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Utxow.UTXOW era), Control.State.Transition.Extended.BaseM (Shelley.Spec.Ledger.STS.Utxow.UTXOW era) GHC.Types.~ Shelley.Spec.Ledger.BaseTypes.ShelleyBase) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Utxow.UTXOW era) (Shelley.Spec.Ledger.STS.Ledger.LEDGER era)

module Shelley.Spec.Ledger.STS.Ledgers
data LEDGERS era
data LedgersEnv era
LedgersEnv :: SlotNo -> PParams era -> AccountState -> LedgersEnv era
[ledgersSlotNo] :: LedgersEnv era -> SlotNo
[ledgersPp] :: LedgersEnv era -> PParams era
[ledgersAccount] :: LedgersEnv era -> AccountState
data LedgersPredicateFailure era
LedgerFailure :: PredicateFailure (LEDGER era) -> LedgersPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Ledgers.LedgersPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Ledger.LEDGER era))) => GHC.Show.Show (Shelley.Spec.Ledger.STS.Ledgers.LedgersPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Ledger.LEDGER era))) => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Ledgers.LedgersPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, NoThunks.Class.NoThunks (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Ledger.LEDGER era))) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Ledgers.LedgersPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Cardano.Binary.ToCBOR.ToCBOR (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Ledger.LEDGER era))) => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Ledgers.LedgersPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Cardano.Binary.FromCBOR.FromCBOR (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Ledger.LEDGER era))) => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Ledgers.LedgersPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Ledger.LEDGER era) (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era), Shelley.Spec.Ledger.Keys.DSignable (Cardano.Ledger.Era.Crypto era) (Shelley.Spec.Ledger.Keys.Hash (Cardano.Ledger.Era.Crypto era) Shelley.Spec.Ledger.Hashing.EraIndependentTxBody)) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era)
instance (Cardano.Ledger.Era.Era era, Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Ledger.LEDGER era), Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Shelley.Spec.Ledger.Keys.DSignable (Cardano.Ledger.Era.Crypto era) (Shelley.Spec.Ledger.Keys.Hash (Cardano.Ledger.Era.Crypto era) Shelley.Spec.Ledger.Hashing.EraIndependentTxBody), Control.State.Transition.Extended.Environment (Shelley.Spec.Ledger.STS.Utxo.UTXO era) GHC.Types.~ Shelley.Spec.Ledger.STS.Utxo.UtxoEnv era, Control.State.Transition.Extended.State (Shelley.Spec.Ledger.STS.Utxo.UTXO era) GHC.Types.~ Shelley.Spec.Ledger.LedgerState.UTxOState era) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Ledger.LEDGER era) (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era)

module Shelley.Spec.Ledger.BlockChain

-- | The hash of a Block Header
newtype HashHeader crypto
HashHeader :: Hash crypto (BHeader crypto) -> HashHeader crypto
[unHashHeader] :: HashHeader crypto -> Hash crypto (BHeader crypto)

-- | The previous hash of a block
data PrevHash crypto
GenesisHash :: PrevHash crypto
BlockHash :: !HashHeader crypto -> PrevHash crypto
data LastAppliedBlock crypto
LastAppliedBlock :: !BlockNo -> !SlotNo -> !HashHeader crypto -> LastAppliedBlock crypto
[labBlockNo] :: LastAppliedBlock crypto -> !BlockNo
[labSlotNo] :: LastAppliedBlock crypto -> !SlotNo
[labHash] :: LastAppliedBlock crypto -> !HashHeader crypto
lastAppliedHash :: WithOrigin (LastAppliedBlock crypto) -> PrevHash crypto
data BHBody crypto
BHBody :: !BlockNo -> !SlotNo -> !PrevHash crypto -> !VKey 'BlockIssuer crypto -> !VerKeyVRF crypto -> !CertifiedVRF crypto Nonce -> !CertifiedVRF crypto Natural -> !Natural -> !HashBBody crypto -> !OCert crypto -> !ProtVer -> BHBody crypto

-- | block number
[bheaderBlockNo] :: BHBody crypto -> !BlockNo

-- | block slot
[bheaderSlotNo] :: BHBody crypto -> !SlotNo

-- | Hash of the previous block header
[bheaderPrev] :: BHBody crypto -> !PrevHash crypto

-- | verification key of block issuer
[bheaderVk] :: BHBody crypto -> !VKey 'BlockIssuer crypto

-- | VRF verification key for block issuer
[bheaderVrfVk] :: BHBody crypto -> !VerKeyVRF crypto

-- | block nonce
[bheaderEta] :: BHBody crypto -> !CertifiedVRF crypto Nonce

-- | leader election value
[bheaderL] :: BHBody crypto -> !CertifiedVRF crypto Natural

-- | Size of the block body
[bsize] :: BHBody crypto -> !Natural

-- | Hash of block body
[bhash] :: BHBody crypto -> !HashBBody crypto

-- | operational certificate
[bheaderOCert] :: BHBody crypto -> !OCert crypto

-- | protocol version
[bprotver] :: BHBody crypto -> !ProtVer

-- | Retrieve the pool id (the hash of the pool operator's cold key) from
--   the body of the block header.

-- | <i>Deprecated: poolIDfromBHBody has been deprecated (the name is
--   misleading), use issuerIDfromBHBody</i>
poolIDfromBHBody :: Crypto crypto => BHBody crypto -> KeyHash 'BlockIssuer crypto

-- | Retrieve the issuer id (the hash of the cold key) from the body of the
--   block header. This corresponds to either a genesis/core node or a
--   stake pool.
issuerIDfromBHBody :: Crypto crypto => BHBody crypto -> KeyHash 'BlockIssuer crypto
data BHeader crypto
pattern BHeader :: Crypto crypto => BHBody crypto -> SignedKES crypto (BHBody crypto) -> BHeader crypto
data Block era
Block' :: !BHeader (Crypto era) -> !TxSeq era -> ByteString -> Block era
pattern Block :: Era era => BHeader (Crypto era) -> TxSeq era -> Block era
newtype LaxBlock era
LaxBlock :: Block era -> LaxBlock era
data TxSeq era
TxSeq' :: !StrictSeq (Tx era) -> ByteString -> ByteString -> ByteString -> TxSeq era
pattern TxSeq :: (Era era, TxBodyConstraints era, ToCBOR (AuxiliaryData era)) => StrictSeq (Tx era) -> TxSeq era

-- | Hash of block body
newtype HashBBody crypto
UnsafeHashBBody :: Hash crypto EraIndependentBlockBody -> HashBBody crypto
[unHashBody] :: HashBBody crypto -> Hash crypto EraIndependentBlockBody

-- | Hash a given block header
bhHash :: forall crypto. Crypto crypto => BHeader crypto -> HashHeader crypto

-- | Hash a given block body
bbHash :: forall era. Era era => TxSeq era -> HashBBody (Crypto era)

-- | HashHeader to Nonce
hashHeaderToNonce :: HashHeader crypto -> Nonce
prevHashToNonce :: PrevHash crypto -> Nonce
bHeaderSize :: forall crypto. Crypto crypto => BHeader crypto -> Int
bBodySize :: forall era. Era era => TxSeq era -> Int
slotToNonce :: SlotNo -> Nonce
hBbsize :: BHBody crypto -> Natural
bheader :: Era era => Block era -> BHeader (Crypto era)
bhbody :: Crypto crypto => BHeader crypto -> BHBody crypto
bbody :: Era era => Block era -> TxSeq era

-- | Retrieve the new nonce from the block header body.
bnonce :: BHBody crypto -> Nonce
seedEta :: Nonce
seedL :: Nonce
incrBlocks :: Bool -> KeyHash 'StakePool crypto -> BlocksMade crypto -> BlocksMade crypto

-- | Construct a seed to use in the VRF computation.
mkSeed :: Nonce -> SlotNo -> Nonce -> Seed

-- | Check that the certified input natural is valid for being slot leader.
--   This means we check that
--   
--   fromNat (certNat) &lt; 1 - (1 - f)^σ
--   
--   where fromNat creates an appropriate value in [0;1] from the certified
--   natural. The calculation is done using the following optimization:
--   
--   let p = fromNat (certNat) and c = ln(1 - f)
--   
--   then p &lt; 1 - (1 - f)^σ <a>=</a> 1 / (1 - p) &lt; exp(-σ * c)
--   
--   this can be efficiently be computed by <a>taylorExpCmp</a> which
--   returns <a>ABOVE</a> in case the reference value `1 / (1 - p)` is
--   above the exponential function at `-σ * c`, <a>BELOW</a> if it is
--   below or <a>MaxReached</a> if it couldn't conclusively compute this
--   within the given iteration bounds.
checkLeaderValue :: forall v. VRFAlgorithm v => OutputVRF v -> Rational -> ActiveSlotCoeff -> Bool
instance GHC.Generics.Generic (Shelley.Spec.Ledger.BlockChain.TxSeq era)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BlockChain.HashBBody crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.BlockChain.HashBBody crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.BlockChain.HashBBody crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.HashBBody crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.BlockChain.BHeader crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BlockChain.HashHeader crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.BlockChain.HashHeader crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.BlockChain.HashHeader crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.BlockChain.HashHeader crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.BlockChain.HashHeader crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.HashHeader crypto)
instance GHC.Classes.Ord (Shelley.Spec.Ledger.BlockChain.PrevHash crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.BlockChain.PrevHash crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.BlockChain.PrevHash crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.PrevHash crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.BlockChain.BHBody crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.BlockChain.LastAppliedBlock crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.BlockChain.LastAppliedBlock crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.LastAppliedBlock crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.BlockChain.Block era)
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BlockChain.LaxBlock era)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BlockChain.HashHeader crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.BlockChain.HashHeader crypto)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BlockChain.TxSeq era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.TxSeq era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.BlockChain.TxSeq era)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BlockChain.HashBBody crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.BlockChain.HashBBody crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BlockChain.BHeader crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Eq (Shelley.Spec.Ledger.BlockChain.BHeader crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.BHeader crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.BHBody crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Eq (Shelley.Spec.Ledger.BlockChain.BHBody crypto)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.Block era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.BlockChain.Block era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BlockChain.Block era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.BlockChain.LaxBlock era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Shelley.Spec.Ledger.Tx.ValidateScript era) => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.BlockChain.LaxBlock era))
instance Cardano.Ledger.Era.Era era => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BlockChain.Block era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Shelley.Spec.Ledger.Tx.ValidateScript era) => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.BlockChain.Block era))
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BlockChain.LastAppliedBlock crypto)
instance Control.DeepSeq.NFData (Shelley.Spec.Ledger.BlockChain.LastAppliedBlock crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BlockChain.LastAppliedBlock crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.BlockChain.LastAppliedBlock crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BlockChain.BHeader crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Binary.Annotated.Annotator (Shelley.Spec.Ledger.BlockChain.BHeader crypto))
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BlockChain.PrevHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BlockChain.PrevHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.BlockChain.PrevHash crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Crypto.Util.SignableRepresentation (Shelley.Spec.Ledger.BlockChain.BHBody crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.BlockChain.BHBody crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.BlockChain.BHBody crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.BlockChain.BHBody crypto)
instance Cardano.Ledger.Era.Era era => Shelley.Spec.Ledger.Serialization.ToCBORGroup (Shelley.Spec.Ledger.BlockChain.TxSeq era)

module Shelley.Spec.Ledger.STS.Ocert
data OCERT crypto

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data OCertEnv crypto
OCertEnv :: Set (KeyHash 'StakePool crypto) -> Set (KeyHash 'GenesisDelegate crypto) -> OCertEnv crypto
[ocertEnvStPools] :: OCertEnv crypto -> Set (KeyHash 'StakePool crypto)
[ocertEnvGenDelegs] :: OCertEnv crypto -> Set (KeyHash 'GenesisDelegate crypto)
data OcertPredicateFailure crypto
KESBeforeStartOCERT :: !KESPeriod -> !KESPeriod -> OcertPredicateFailure crypto
KESAfterEndOCERT :: !KESPeriod -> !KESPeriod -> !Word64 -> OcertPredicateFailure crypto
CounterTooSmallOCERT :: !Word64 -> !Word64 -> OcertPredicateFailure crypto
InvalidSignatureOCERT :: !Word64 -> !KESPeriod -> OcertPredicateFailure crypto
InvalidKesSignatureOCERT :: !Word -> !Word -> !Word -> !String -> OcertPredicateFailure crypto
NoCounterForKeyHashOCERT :: !KeyHash 'BlockIssuer crypto -> OcertPredicateFailure crypto
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Ocert.OcertPredicateFailure crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Ocert.OcertPredicateFailure crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Ocert.OcertPredicateFailure crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Ocert.OcertPredicateFailure crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Shelley.Spec.Ledger.Keys.DSignable crypto (Shelley.Spec.Ledger.OCert.OCertSignable crypto), Shelley.Spec.Ledger.Keys.KESignable crypto (Shelley.Spec.Ledger.BlockChain.BHBody crypto)) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Ocert.OCERT crypto)

module Shelley.Spec.Ledger.STS.Overlay
data OVERLAY crypto

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data OverlayEnv crypto
OverlayEnv :: UnitInterval -> PoolDistr crypto -> GenDelegs crypto -> Nonce -> OverlayEnv crypto
data OverlayPredicateFailure crypto
VRFKeyUnknown :: !KeyHash 'StakePool crypto -> OverlayPredicateFailure crypto
VRFKeyWrongVRFKey :: !KeyHash 'StakePool crypto -> !Hash crypto (VerKeyVRF crypto) -> !Hash crypto (VerKeyVRF crypto) -> OverlayPredicateFailure crypto
VRFKeyBadNonce :: !Nonce -> !SlotNo -> !Nonce -> !CertifiedVRF (VRF crypto) Nonce -> OverlayPredicateFailure crypto
VRFKeyBadLeaderValue :: !Nonce -> !SlotNo -> !Nonce -> !CertifiedVRF (VRF crypto) Nonce -> OverlayPredicateFailure crypto
VRFLeaderValueTooBig :: !OutputVRF (VRF crypto) -> !Rational -> !ActiveSlotCoeff -> OverlayPredicateFailure crypto
NotActiveSlotOVERLAY :: !SlotNo -> OverlayPredicateFailure crypto
WrongGenesisColdKeyOVERLAY :: !KeyHash 'BlockIssuer crypto -> !KeyHash 'GenesisDelegate crypto -> OverlayPredicateFailure crypto
WrongGenesisVRFKeyOVERLAY :: !KeyHash 'BlockIssuer crypto -> !Hash crypto (VerKeyVRF crypto) -> !Hash crypto (VerKeyVRF crypto) -> OverlayPredicateFailure crypto
UnknownGenesisKeyOVERLAY :: !KeyHash 'Genesis crypto -> OverlayPredicateFailure crypto
OcertFailure :: PredicateFailure (OCERT crypto) -> OverlayPredicateFailure crypto
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Overlay.OverlayEnv crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Overlay.OverlayPredicateFailure crypto)
instance Cardano.Crypto.VRF.Class.VRFAlgorithm (Cardano.Ledger.Crypto.VRF crypto) => GHC.Show.Show (Shelley.Spec.Ledger.STS.Overlay.OverlayPredicateFailure crypto)
instance Cardano.Crypto.VRF.Class.VRFAlgorithm (Cardano.Ledger.Crypto.VRF crypto) => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Overlay.OverlayPredicateFailure crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Shelley.Spec.Ledger.Keys.DSignable crypto (Shelley.Spec.Ledger.OCert.OCertSignable crypto), Shelley.Spec.Ledger.Keys.KESignable crypto (Shelley.Spec.Ledger.BlockChain.BHBody crypto), Cardano.Crypto.VRF.Class.Signable (Cardano.Ledger.Crypto.VRF crypto) Shelley.Spec.Ledger.BaseTypes.Seed) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Overlay.OVERLAY crypto)
instance Cardano.Crypto.VRF.Class.VRFAlgorithm (Cardano.Ledger.Crypto.VRF crypto) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Overlay.OverlayPredicateFailure crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Shelley.Spec.Ledger.Keys.DSignable crypto (Shelley.Spec.Ledger.OCert.OCertSignable crypto), Shelley.Spec.Ledger.Keys.KESignable crypto (Shelley.Spec.Ledger.BlockChain.BHBody crypto), Cardano.Crypto.VRF.Class.Signable (Cardano.Ledger.Crypto.VRF crypto) Shelley.Spec.Ledger.BaseTypes.Seed) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Ocert.OCERT crypto) (Shelley.Spec.Ledger.STS.Overlay.OVERLAY crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Overlay.OverlayEnv crypto)

module Shelley.Spec.Ledger.STS.Prtcl
data PRTCL crypto

-- | Type of the state which the system transitions between.
type family State a
data PrtclEnv crypto
PrtclEnv :: UnitInterval -> PoolDistr crypto -> GenDelegs crypto -> Nonce -> PrtclEnv crypto
data PrtclState crypto
PrtclState :: !Map (KeyHash 'BlockIssuer crypto) Word64 -> !Nonce -> !Nonce -> PrtclState crypto
data PrtclPredicateFailure crypto
OverlayFailure :: PredicateFailure (OVERLAY crypto) -> PrtclPredicateFailure crypto
UpdnFailure :: PredicateFailure (UPDN crypto) -> PrtclPredicateFailure crypto

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a
data PrtlSeqFailure crypto
WrongSlotIntervalPrtclSeq :: SlotNo -> SlotNo -> PrtlSeqFailure crypto
WrongBlockNoPrtclSeq :: WithOrigin (LastAppliedBlock crypto) -> BlockNo -> PrtlSeqFailure crypto
WrongBlockSequencePrtclSeq :: PrevHash crypto -> PrevHash crypto -> PrtlSeqFailure crypto
prtlSeqChecks :: (MonadError (PrtlSeqFailure crypto) m, Crypto crypto) => WithOrigin (LastAppliedBlock crypto) -> BHeader crypto -> m ()
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Prtcl.PrtclState crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Prtcl.PrtclState crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Prtcl.PrtclState crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Prtcl.PrtclEnv crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Prtcl.PrtclPredicateFailure crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Prtcl.PrtlSeqFailure crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Prtcl.PrtlSeqFailure crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.STS.Prtcl.PrtlSeqFailure crypto)
instance Cardano.Crypto.VRF.Class.VRFAlgorithm (Cardano.Ledger.Crypto.VRF crypto) => GHC.Show.Show (Shelley.Spec.Ledger.STS.Prtcl.PrtclPredicateFailure crypto)
instance Cardano.Crypto.VRF.Class.VRFAlgorithm (Cardano.Ledger.Crypto.VRF crypto) => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Prtcl.PrtclPredicateFailure crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Prtcl.PrtlSeqFailure crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Shelley.Spec.Ledger.Keys.DSignable crypto (Shelley.Spec.Ledger.OCert.OCertSignable crypto), Shelley.Spec.Ledger.Keys.KESignable crypto (Shelley.Spec.Ledger.BlockChain.BHBody crypto), Shelley.Spec.Ledger.Keys.VRFSignable crypto Shelley.Spec.Ledger.BaseTypes.Seed) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Prtcl.PRTCL crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Prtcl.PrtclPredicateFailure crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Shelley.Spec.Ledger.Keys.DSignable crypto (Shelley.Spec.Ledger.OCert.OCertSignable crypto), Shelley.Spec.Ledger.Keys.KESignable crypto (Shelley.Spec.Ledger.BlockChain.BHBody crypto), Shelley.Spec.Ledger.Keys.VRFSignable crypto Shelley.Spec.Ledger.BaseTypes.Seed) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Overlay.OVERLAY crypto) (Shelley.Spec.Ledger.STS.Prtcl.PRTCL crypto)
instance (Cardano.Ledger.Crypto.Crypto crypto, Shelley.Spec.Ledger.Keys.DSignable crypto (Shelley.Spec.Ledger.OCert.OCertSignable crypto), Shelley.Spec.Ledger.Keys.KESignable crypto (Shelley.Spec.Ledger.BlockChain.BHBody crypto), Shelley.Spec.Ledger.Keys.VRFSignable crypto Shelley.Spec.Ledger.BaseTypes.Seed) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Updn.UPDN crypto) (Shelley.Spec.Ledger.STS.Prtcl.PRTCL crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Prtcl.PrtclEnv crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.STS.Prtcl.PrtclState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.STS.Prtcl.PrtclState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Prtcl.PrtclState crypto)

module Shelley.Spec.Ledger.STS.Bbody
data BBODY era
data BbodyState era
BbodyState :: LedgerState era -> BlocksMade (Crypto era) -> BbodyState era
data BbodyEnv era
BbodyEnv :: PParams era -> AccountState -> BbodyEnv era
[bbodyPp] :: BbodyEnv era -> PParams era
[bbodyAccount] :: BbodyEnv era -> AccountState
data BbodyPredicateFailure era
WrongBlockBodySizeBBODY :: !Int -> !Int -> BbodyPredicateFailure era
InvalidBodyHashBBODY :: !HashBBody (Crypto era) -> !HashBBody (Crypto era) -> BbodyPredicateFailure era
LedgersFailure :: PredicateFailure (LEDGERS era) -> BbodyPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a

-- | Type of the state which the system transitions between.
type family State a
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Bbody.BbodyPredicateFailure era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.STS.Bbody.BbodyState era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era))) => GHC.Show.Show (Shelley.Spec.Ledger.STS.Bbody.BbodyPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era))) => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Bbody.BbodyPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, NoThunks.Class.NoThunks (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era))) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Bbody.BbodyPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Shelley.Spec.Ledger.Keys.DSignable (Cardano.Ledger.Era.Crypto era) (Shelley.Spec.Ledger.Keys.Hash (Cardano.Ledger.Era.Crypto era) Shelley.Spec.Ledger.Hashing.EraIndependentTxBody), Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era) (Shelley.Spec.Ledger.STS.Bbody.BBODY era)) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Bbody.BBODY era)
instance (Cardano.Ledger.Era.Era era, Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era), Shelley.Spec.Ledger.Keys.DSignable (Cardano.Ledger.Era.Crypto era) (Shelley.Spec.Ledger.Keys.Hash (Cardano.Ledger.Era.Crypto era) Shelley.Spec.Ledger.Hashing.EraIndependentTxBody), Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Ledgers.LEDGERS era) (Shelley.Spec.Ledger.STS.Bbody.BBODY era)

module Shelley.Spec.Ledger.STS.Chain
data CHAIN era
data ChainState era
ChainState :: NewEpochState era -> Map (KeyHash 'BlockIssuer (Crypto era)) Word64 -> Nonce -> Nonce -> Nonce -> Nonce -> WithOrigin (LastAppliedBlock (Crypto era)) -> ChainState era
[chainNes] :: ChainState era -> NewEpochState era
[chainOCertIssue] :: ChainState era -> Map (KeyHash 'BlockIssuer (Crypto era)) Word64
[chainEpochNonce] :: ChainState era -> Nonce
[chainEvolvingNonce] :: ChainState era -> Nonce
[chainCandidateNonce] :: ChainState era -> Nonce
[chainPrevEpochNonce] :: ChainState era -> Nonce
[chainLastAppliedBlock] :: ChainState era -> WithOrigin (LastAppliedBlock (Crypto era))
data ChainPredicateFailure era
HeaderSizeTooLargeCHAIN :: !Natural -> !Natural -> ChainPredicateFailure era
BlockSizeTooLargeCHAIN :: !Natural -> !Natural -> ChainPredicateFailure era
ObsoleteNodeCHAIN :: !Natural -> !Natural -> ChainPredicateFailure era
BbodyFailure :: !PredicateFailure (BBODY era) -> ChainPredicateFailure era
TickFailure :: !PredicateFailure (TICK era) -> ChainPredicateFailure era
TicknFailure :: !PredicateFailure TICKN -> ChainPredicateFailure era
PrtclFailure :: !PredicateFailure (PRTCL (Crypto era)) -> ChainPredicateFailure era
PrtclSeqFailure :: !PrtlSeqFailure (Crypto era) -> ChainPredicateFailure era

-- | Descriptive type for the possible failures which might cause a
--   transition to fail.
--   
--   As a convention, <a>PredicateFailure</a>s which are "structural"
--   (meaning that they are not "throwable" in practice, and are used to
--   pass control from one transition rule to another) are prefixed with
--   <tt>S_</tt>.
--   
--   Structural <a>PredicateFailure</a>s represent conditions between rules
--   where the disjunction of all rules' preconditions is equal to
--   <a>True</a>. That is, either one rule will throw a structural
--   <a>PredicateFailure</a> and the other will succeed, or vice-versa.
type family PredicateFailure a = (b :: Type) | b -> a

-- | Creates a valid initial chain state
initialShelleyState :: WithOrigin (LastAppliedBlock (Crypto era)) -> EpochNo -> UTxO era -> Coin -> Map (KeyHash 'Genesis (Crypto era)) (GenDelegPair (Crypto era)) -> PParams era -> Nonce -> ChainState era

-- | Calculate the total ada in the chain state
totalAda :: ShelleyBased era => ChainState era -> Coin

-- | Calculate the total ada in the epoch state
totalAdaES :: ShelleyBased era => EpochState era -> Coin

-- | Calculate the total ada pots in the chain state
totalAdaPots :: ShelleyBased era => ChainState era -> AdaPots
data ChainChecksData
ChainChecksData :: Natural -> Natural -> ProtVer -> ChainChecksData
[ccMaxBHSize] :: ChainChecksData -> Natural
[ccMaxBBSize] :: ChainChecksData -> Natural
[ccProtocolVersion] :: ChainChecksData -> ProtVer
pparamsToChainChecksData :: PParams era -> ChainChecksData
chainChecks :: (Era era, MonadError (PredicateFailure (CHAIN era)) m) => Natural -> ChainChecksData -> BHeader (Crypto era) -> m ()
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Chain.ChainState era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.STS.Chain.ChainPredicateFailure era)
instance NoThunks.Class.NoThunks Shelley.Spec.Ledger.STS.Chain.ChainChecksData
instance GHC.Generics.Generic Shelley.Spec.Ledger.STS.Chain.ChainChecksData
instance GHC.Classes.Eq Shelley.Spec.Ledger.STS.Chain.ChainChecksData
instance GHC.Show.Show Shelley.Spec.Ledger.STS.Chain.ChainChecksData
instance GHC.Classes.Eq Shelley.Spec.Ledger.STS.Chain.AdaPots
instance GHC.Show.Show Shelley.Spec.Ledger.STS.Chain.AdaPots
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Show.Show (Shelley.Spec.Ledger.STS.Chain.ChainState era)
instance Cardano.Ledger.Shelley.Constraints.ShelleyBased era => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Chain.ChainState era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Bbody.BBODY era))) => GHC.Show.Show (Shelley.Spec.Ledger.STS.Chain.ChainPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Bbody.BBODY era))) => GHC.Classes.Eq (Shelley.Spec.Ledger.STS.Chain.ChainPredicateFailure era)
instance (Cardano.Ledger.Shelley.Constraints.ShelleyBased era, NoThunks.Class.NoThunks (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Bbody.BBODY era))) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.STS.Chain.ChainPredicateFailure era)
instance (Cardano.Ledger.Era.Era era, c GHC.Types.~ Cardano.Ledger.Era.Crypto era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Bbody.BBODY era) (Shelley.Spec.Ledger.STS.Chain.CHAIN era), Control.State.Transition.Extended.Embed Shelley.Spec.Ledger.STS.Tickn.TICKN (Shelley.Spec.Ledger.STS.Chain.CHAIN era), Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Tick.TICK era) (Shelley.Spec.Ledger.STS.Chain.CHAIN era), Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Prtcl.PRTCL (Cardano.Ledger.Era.Crypto era)) (Shelley.Spec.Ledger.STS.Chain.CHAIN era), Shelley.Spec.Ledger.Keys.DSignable c (Shelley.Spec.Ledger.OCert.OCertSignable c), Shelley.Spec.Ledger.Keys.DSignable c (Shelley.Spec.Ledger.Keys.Hash c Shelley.Spec.Ledger.Hashing.EraIndependentTxBody), Shelley.Spec.Ledger.Keys.KESignable c (Shelley.Spec.Ledger.BlockChain.BHBody c), Cardano.Crypto.VRF.Class.Signable (Cardano.Ledger.Crypto.VRF c) Shelley.Spec.Ledger.BaseTypes.Seed) => Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Chain.CHAIN era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Bbody.BBODY era)) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Bbody.BBODY era) (Shelley.Spec.Ledger.STS.Chain.CHAIN era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era) => Control.State.Transition.Extended.Embed Shelley.Spec.Ledger.STS.Tickn.TICKN (Shelley.Spec.Ledger.STS.Chain.CHAIN era)
instance (Cardano.Ledger.Era.Era era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Tick.TICK era)) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Tick.TICK era) (Shelley.Spec.Ledger.STS.Chain.CHAIN era)
instance (Cardano.Ledger.Era.Era era, c GHC.Types.~ Cardano.Ledger.Era.Crypto era, Cardano.Ledger.Shelley.Constraints.ShelleyBased era, Control.State.Transition.Extended.STS (Shelley.Spec.Ledger.STS.Prtcl.PRTCL c)) => Control.State.Transition.Extended.Embed (Shelley.Spec.Ledger.STS.Prtcl.PRTCL c) (Shelley.Spec.Ledger.STS.Chain.CHAIN era)
instance Cardano.Ledger.Era.Era era => Control.DeepSeq.NFData (Shelley.Spec.Ledger.STS.Chain.ChainState era)


-- | Integration between the Shelley ledger and its corresponding
--   (Transitional Praos) protocol.
--   
--   In particular, this code supports extracting the components of the
--   ledger state needed for protocol execution, both now and in a 2k-slot
--   window.
module Shelley.Spec.Ledger.API.Protocol
class (Crypto c, DSignable c (OCertSignable c), DSignable c (Hash c EraIndependentTxBody), KESignable c (BHBody c), VRFSignable c Seed) => PraosCrypto c
class (ChainData (ChainDepState (Crypto era)), SerialisableData (ChainDepState (Crypto era)), Eq (ChainTransitionError (Crypto era)), Show (ChainTransitionError (Crypto era)), Show (LedgerView (Crypto era)), Show (FutureLedgerViewError era)) => GetLedgerView era
currentLedgerView :: GetLedgerView era => NewEpochState era -> LedgerView (Crypto era)
futureLedgerView :: (GetLedgerView era, MonadError (FutureLedgerViewError era) m) => Globals -> NewEpochState era -> SlotNo -> m (LedgerView (Crypto era))
futureLedgerView :: (GetLedgerView era, ShelleyBased era, MonadError (FutureLedgerViewError era) m) => Globals -> NewEpochState era -> SlotNo -> m (LedgerView (Crypto era))

-- | Data required by the Transitional Praos protocol from the Shelley
--   ledger.
data LedgerView crypto
LedgerView :: UnitInterval -> Nonce -> PoolDistr crypto -> GenDelegs crypto -> ChainChecksData -> LedgerView crypto
[lvD] :: LedgerView crypto -> UnitInterval
[lvExtraEntropy] :: LedgerView crypto -> Nonce
[lvPoolDistr] :: LedgerView crypto -> PoolDistr crypto
[lvGenDelegs] :: LedgerView crypto -> GenDelegs crypto
[lvChainChecks] :: LedgerView crypto -> ChainChecksData
newtype FutureLedgerViewError era
FutureLedgerViewError :: [PredicateFailure (TICKF era)] -> FutureLedgerViewError era
data ChainDepState crypto
ChainDepState :: !PrtclState crypto -> !TicknState -> !Nonce -> ChainDepState crypto
[csProtocol] :: ChainDepState crypto -> !PrtclState crypto
[csTickn] :: ChainDepState crypto -> !TicknState

-- | Nonce constructed from the hash of the last applied block header.
[csLabNonce] :: ChainDepState crypto -> !Nonce
newtype ChainTransitionError crypto
ChainTransitionError :: [PredicateFailure (PRTCL crypto)] -> ChainTransitionError crypto

-- | Tick the chain state to a new epoch.
tickChainDepState :: Globals -> LedgerView crypto -> Bool -> ChainDepState crypto -> ChainDepState crypto

-- | Update the chain state based upon a new block header.
--   
--   This also updates the last applied block hash.
updateChainDepState :: forall crypto m. (PraosCrypto crypto, MonadError (ChainTransitionError crypto) m) => Globals -> LedgerView crypto -> BHeader crypto -> ChainDepState crypto -> m (ChainDepState crypto)

-- | Re-update the chain state based upon a new block header.
--   
--   This function does no validation of whether the header is internally
--   valid or consistent with the chain it is being applied to; the caller
--   must ensure that this is valid through having previously applied it.
reupdateChainDepState :: forall crypto. PraosCrypto crypto => Globals -> LedgerView crypto -> BHeader crypto -> ChainDepState crypto -> ChainDepState crypto
instance GHC.Generics.Generic (Shelley.Spec.Ledger.API.Protocol.LedgerView crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.API.Protocol.LedgerView crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.API.Protocol.LedgerView crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.API.Protocol.ChainDepState crypto)
instance GHC.Show.Show (Shelley.Spec.Ledger.API.Protocol.ChainDepState crypto)
instance GHC.Classes.Eq (Shelley.Spec.Ledger.API.Protocol.ChainDepState crypto)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.API.Protocol.ChainTransitionError crypto)
instance GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Tick.TICKF era)) => GHC.Classes.Eq (Shelley.Spec.Ledger.API.Protocol.FutureLedgerViewError era)
instance GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Tick.TICKF era)) => GHC.Show.Show (Shelley.Spec.Ledger.API.Protocol.FutureLedgerViewError era)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Classes.Eq (Shelley.Spec.Ledger.API.Protocol.ChainTransitionError crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => GHC.Show.Show (Shelley.Spec.Ledger.API.Protocol.ChainTransitionError crypto)
instance Shelley.Spec.Ledger.API.Protocol.PraosCrypto crypto => Shelley.Spec.Ledger.API.Protocol.GetLedgerView (Cardano.Ledger.Shelley.ShelleyEra crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.API.Protocol.ChainTransitionError crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.API.Protocol.ChainDepState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.FromCBOR.FromCBOR (Shelley.Spec.Ledger.API.Protocol.ChainDepState crypto)
instance Cardano.Ledger.Crypto.Crypto crypto => Cardano.Binary.ToCBOR.ToCBOR (Shelley.Spec.Ledger.API.Protocol.ChainDepState crypto)
instance NoThunks.Class.NoThunks (Shelley.Spec.Ledger.API.Protocol.LedgerView crypto)


-- | Interface to the block validation and chain extension logic in the
--   Shelley API.
module Shelley.Spec.Ledger.API.Validation
class (ChainData (Block era), AnnotatedData (Block era), ChainData (BHeader (Crypto era)), AnnotatedData (BHeader (Crypto era)), ChainData (NewEpochState era), SerialisableData (NewEpochState era), ChainData (BlockTransitionError era), ChainData (PredicateFailure (CHAIN era))) => ApplyBlock era

-- | Apply the header level ledger transition.
--   
--   This handles checks and updates that happen on a slot tick, as well as
--   a few header level checks, such as size constraints.
applyTick :: ApplyBlock era => Globals -> NewEpochState era -> SlotNo -> NewEpochState era

-- | Apply the header level ledger transition.
--   
--   This handles checks and updates that happen on a slot tick, as well as
--   a few header level checks, such as size constraints.
applyTick :: (ApplyBlock era, ShelleyBased era) => Globals -> NewEpochState era -> SlotNo -> NewEpochState era

-- | Apply the block level ledger transition.
applyBlock :: (ApplyBlock era, MonadError (BlockTransitionError era) m) => Globals -> NewEpochState era -> Block era -> m (NewEpochState era)

-- | Apply the block level ledger transition.
applyBlock :: (ApplyBlock era, STS (BBODY era), MonadError (BlockTransitionError era) m) => Globals -> NewEpochState era -> Block era -> m (NewEpochState era)

-- | Re-apply a ledger block to the same state it has been applied to
--   before.
--   
--   This function does no validation of whether the block applies
--   successfully; the caller implicitly guarantees that they have
--   previously called <tt>applyBlockTransition</tt> on the same block and
--   that this was successful.
reapplyBlock :: ApplyBlock era => Globals -> NewEpochState era -> Block era -> NewEpochState era

-- | Re-apply a ledger block to the same state it has been applied to
--   before.
--   
--   This function does no validation of whether the block applies
--   successfully; the caller implicitly guarantees that they have
--   previously called <tt>applyBlockTransition</tt> on the same block and
--   that this was successful.
reapplyBlock :: (ApplyBlock era, STS (BBODY era)) => Globals -> NewEpochState era -> Block era -> NewEpochState era
newtype TickTransitionError era
TickTransitionError :: [PredicateFailure (TICK era)] -> TickTransitionError era
newtype BlockTransitionError era
BlockTransitionError :: [PredicateFailure (BBODY era)] -> BlockTransitionError era
chainChecks :: forall era m. (Era era, MonadError (PredicateFailure (CHAIN era)) m) => Globals -> ChainChecksData -> BHeader (Crypto era) -> m ()
instance GHC.Generics.Generic (Shelley.Spec.Ledger.API.Validation.TickTransitionError era)
instance GHC.Generics.Generic (Shelley.Spec.Ledger.API.Validation.BlockTransitionError era)
instance GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Tick.TICK era)) => GHC.Classes.Eq (Shelley.Spec.Ledger.API.Validation.TickTransitionError era)
instance GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Tick.TICK era)) => GHC.Show.Show (Shelley.Spec.Ledger.API.Validation.TickTransitionError era)
instance GHC.Classes.Eq (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Bbody.BBODY era)) => GHC.Classes.Eq (Shelley.Spec.Ledger.API.Validation.BlockTransitionError era)
instance GHC.Show.Show (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Bbody.BBODY era)) => GHC.Show.Show (Shelley.Spec.Ledger.API.Validation.BlockTransitionError era)
instance Shelley.Spec.Ledger.API.Protocol.PraosCrypto crypto => Shelley.Spec.Ledger.API.Validation.ApplyBlock (Cardano.Ledger.Shelley.ShelleyEra crypto)
instance NoThunks.Class.NoThunks (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Bbody.BBODY era)) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.API.Validation.BlockTransitionError era)
instance NoThunks.Class.NoThunks (Control.State.Transition.Extended.PredicateFailure (Shelley.Spec.Ledger.STS.Tick.TICK era)) => NoThunks.Class.NoThunks (Shelley.Spec.Ledger.API.Validation.TickTransitionError era)

module Shelley.Spec.Ledger.API.ByronTranslation

-- | We construct a <a>LedgerView</a> using the Shelley genesis config in
--   the same way as <a>translateToShelleyLedgerState</a>.
mkInitialShelleyLedgerView :: forall c. ShelleyGenesis (ShelleyEra c) -> LedgerView c
translateToShelleyLedgerState :: forall c. (Crypto c, ADDRHASH c ~ Blake2b_224) => ShelleyGenesis (ShelleyEra c) -> EpochNo -> ChainValidationState -> NewEpochState (ShelleyEra c)
translateCompactTxOutByronToShelley :: CompactTxOut -> TxOut (ShelleyEra c)

-- | We use the same hashing algorithm so we can unwrap and rewrap the
--   bytes. We don't care about the type that is hashed, which will differ
--   going from Byron to Shelley, we just use the hashes as IDs.
translateTxIdByronToShelley :: (Crypto c, ADDRHASH c ~ Blake2b_224) => TxId -> TxId c


-- | API to the Shelley ledger
module Shelley.Spec.Ledger.API

-- | Calculate the Non-Myopic Pool Member Rewards for a set of credentials.
--   For each given credential, this function returns a map from each stake
--   pool (identified by the key hash of the pool operator) to the
--   non-myopic pool member reward for that stake pool.
--   
--   This is not based on any snapshot, but uses the current ledger state.
getNonMyopicMemberRewards :: ShelleyBased era => Globals -> NewEpochState era -> Set (Either Coin (Credential 'Staking (Crypto era))) -> Map (Either Coin (Credential 'Staking (Crypto era))) (Map (KeyHash 'StakePool (Crypto era)) Coin)

-- | Get the full UTxO.
getUTxO :: NewEpochState era -> UTxO era

-- | Get the UTxO filtered by address.
getFilteredUTxO :: NewEpochState era -> Set (Addr (Crypto era)) -> UTxO era

-- | Get the (private) leader schedule for this epoch.
--   
--   Given a private VRF key, returns the set of slots in which this node
--   is eligible to lead.
getLeaderSchedule :: (Era era, Signable (VRF (Crypto era)) Seed) => Globals -> NewEpochState era -> ChainDepState (Crypto era) -> KeyHash 'StakePool (Crypto era) -> SignKeyVRF (Crypto era) -> PParams era -> Set SlotNo

-- | Get the registered stake pool parameters for a given ID.
getPoolParameters :: NewEpochState era -> KeyHash 'StakePool (Crypto era) -> Maybe (PoolParams (Crypto era))

-- | Calculate the current total stake.
getTotalStake :: Globals -> NewEpochState era -> Coin

-- | Get pool sizes, but in terms of total stake
--   
--   The stake distribution uses active stake (so that the leader schedule
--   is not affected by undelegated stake), but the wallet wants to display
--   pool saturation for rewards purposes. For that, it needs the fraction
--   of total stake.
--   
--   This is not based on any snapshot, but uses the current ledger state.
poolsByTotalStakeFraction :: forall era. ShelleyBased era => Globals -> NewEpochState era -> PoolDistr (Crypto era)
hashVerKeyVRF :: (VRFAlgorithm v, HashAlgorithm h) => VerKeyVRF v -> Hash h (VerKeyVRF v)

-- | The amount of value held by a transaction output.
newtype Coin
Coin :: Integer -> Coin
[unCoin] :: Coin -> Integer
word64ToCoin :: Word64 -> Coin
data Metadata
pattern Metadata :: Map Word64 Metadatum -> Metadata

-- | A generic metadatum type.
data Metadatum
Map :: [(Metadatum, Metadatum)] -> Metadatum
List :: [Metadatum] -> Metadatum
I :: !Integer -> Metadatum
B :: !ByteString -> Metadatum
S :: !Text -> Metadatum
type VerKeyVRF c = VerKeyVRF (VRF c)
type SignKeyVRF c = SignKeyVRF (VRF c)
type CertifiedVRF c = CertifiedVRF (VRF c)
type VerKeyKES c = VerKeyKES (KES c)
type SignKeyKES c = SignKeyKES (KES c)
type SignedKES c = SignedKES (KES c)
type SignKeyDSIGN c = SignKeyDSIGN (DSIGN c)
type SignedDSIGN c = SignedDSIGN (DSIGN c)
type Hash c = Hash (HASH c)
newtype GenDelegs crypto
GenDelegs :: Map (KeyHash 'Genesis crypto) (GenDelegPair crypto) -> GenDelegs crypto
[unGenDelegs] :: GenDelegs crypto -> Map (KeyHash 'Genesis crypto) (GenDelegPair crypto)
data GenDelegPair crypto
GenDelegPair :: !KeyHash 'GenesisDelegate crypto -> !Hash crypto (VerKeyVRF crypto) -> GenDelegPair crypto
[genDelegKeyHash] :: GenDelegPair crypto -> !KeyHash 'GenesisDelegate crypto
[genDelegVrfHash] :: GenDelegPair crypto -> !Hash crypto (VerKeyVRF crypto)
type KESignable c = Signable (KES c)

-- | Discriminated hash of public Key
newtype KeyHash (discriminator :: KeyRole) crypto
KeyHash :: Hash (ADDRHASH crypto) (VerKeyDSIGN (DSIGN crypto)) -> KeyHash (discriminator :: KeyRole) crypto

-- | Pair of signing key and verification key, with a usage role.
data KeyPair (kd :: KeyRole) crypto
KeyPair :: !VKey kd crypto -> !SignKeyDSIGN (DSIGN crypto) -> KeyPair (kd :: KeyRole) crypto
[vKey] :: KeyPair (kd :: KeyRole) crypto -> !VKey kd crypto
[sKey] :: KeyPair (kd :: KeyRole) crypto -> !SignKeyDSIGN (DSIGN crypto)

-- | Discriminated verification key
--   
--   We wrap the basic <tt>VerKeyDSIGN</tt> in order to add the key role.
newtype VKey (kd :: KeyRole) crypto
VKey :: VerKeyDSIGN (DSIGN crypto) -> VKey (kd :: KeyRole) crypto
[unVKey] :: VKey (kd :: KeyRole) crypto -> VerKeyDSIGN (DSIGN crypto)

-- | General coercion of key roles.
--   
--   The presence of this function is mostly to help the user realise where
--   they are converting key roles.
coerceKeyRole :: HasKeyRole a => a r crypto -> a r' crypto

-- | The role of a key.
--   
--   Note that a role is not _fixed_, nor is it unique. In particular, keys
--   may variously be used as witnesses, and so in many case we will change
--   the role of a key to the <a>Witness</a> role.
--   
--   It is also perfectly allowable for a key to be used in many roles;
--   there is nothing prohibiting somebody using the same underlying key as
--   their payment and staking key, as well as the key for their stake
--   pool. So these roles are more intended for two purposes:
--   
--   <ul>
--   <li>To make explicit how we are using a key in the specifications</li>
--   <li>To provide a guide to downstream implementors, for whom the
--   profusion of keys may be confusing.</li>
--   </ul>
data KeyRole
Genesis :: KeyRole
GenesisDelegate :: KeyRole
Payment :: KeyRole
Staking :: KeyRole
StakePool :: KeyRole
BlockIssuer :: KeyRole
Witness :: KeyRole

-- | Hash a given public key
hashKey :: Crypto crypto => VKey kd crypto -> KeyHash kd crypto
data Network
Testnet :: Network
Mainnet :: Network
data Globals
Globals :: !EpochInfo Identity -> !Word64 -> !Word64 -> !Word64 -> !Word64 -> !Word64 -> !Word64 -> !Natural -> !Word64 -> !ActiveSlotCoeff -> !Network -> Globals
[epochInfo] :: Globals -> !EpochInfo Identity
[slotsPerKESPeriod] :: Globals -> !Word64

-- | The window size in which our chosen chain growth property guarantees
--   at least k blocks. From the paper "Ouroboros praos: An
--   adaptively-secure, semi-synchronous proof-of-stake protocol". The
--   <a>stabilityWindow</a> constant is used in a number of places; for
--   example, protocol updates must be submitted at least twice this many
--   slots before an epoch boundary.
[stabilityWindow] :: Globals -> !Word64

-- | Number of slots before the end of the epoch at which we stop updating
--   the candidate nonce for the next epoch.
[randomnessStabilisationWindow] :: Globals -> !Word64

-- | Maximum number of blocks we are allowed to roll back
[securityParameter] :: Globals -> !Word64

-- | Maximum number of KES iterations
[maxKESEvo] :: Globals -> !Word64

-- | Quorum for update system votes and MIR certificates
[quorum] :: Globals -> !Word64

-- | All blocks invalid after this protocol version
[maxMajorPV] :: Globals -> !Natural

-- | Maximum number of lovelace in the system
[maxLovelaceSupply] :: Globals -> !Word64

-- | Active Slot Coefficient, named f in "Ouroboros Praos: An
--   adaptively-secure, semi-synchronous proof-of-stake protocol"
[activeSlotCoeff] :: Globals -> !ActiveSlotCoeff

-- | The network ID
[networkId] :: Globals -> !Network
newtype Port
Port :: Word16 -> Port
[portToWord16] :: Port -> Word16

-- | Strict <a>Maybe</a>.
--   
--   TODO move to <tt>cardano-prelude</tt>
data StrictMaybe a
SNothing :: StrictMaybe a
SJust :: !a -> StrictMaybe a

-- | Evolving nonce type.
data Nonce
Nonce :: !Hash Blake2b_256 Nonce -> Nonce

-- | Identity element
NeutralNonce :: Nonce
newtype ScriptHash crypto
ScriptHash :: Hash (ADDRHASH crypto) EraIndependentScript -> ScriptHash crypto
data MultiSig crypto
pattern RequireMOf :: Crypto crypto => Int -> [MultiSig crypto] -> MultiSig crypto
pattern RequireSignature :: Crypto crypto => KeyHash 'Witness crypto -> MultiSig crypto
pattern RequireAllOf :: Crypto crypto => [MultiSig crypto] -> MultiSig crypto
pattern RequireAnyOf :: Crypto crypto => [MultiSig crypto] -> MultiSig crypto
data TicknPredicateFailure
data TicknState
TicknState :: !Nonce -> !Nonce -> TicknState
[ticknStateEpochNonce] :: TicknState -> !Nonce
[ticknStatePrevHashNonce] :: TicknState -> !Nonce
data TicknEnv
TicknEnv :: Nonce -> Nonce -> Nonce -> TicknEnv
[ticknEnvExtraEntropy] :: TicknEnv -> Nonce
[ticknEnvCandidateNonce] :: TicknEnv -> Nonce

-- | Hash of the last header of the previous epoch as a nonce.
[ticknEnvHashHeaderNonce] :: TicknEnv -> Nonce
data TICKN
data BootstrapWitness crypto
pattern BootstrapWitness :: Crypto crypto => VKey 'Witness crypto -> SignedDSIGN crypto (Hash crypto EraIndependentTxBody) -> ChainCode -> ByteString -> BootstrapWitness crypto
data OBftSlot crypto
NonActiveSlot :: OBftSlot crypto
ActiveSlot :: !KeyHash 'Genesis crypto -> OBftSlot crypto
isOverlaySlot :: SlotNo -> UnitInterval -> SlotNo -> Bool
classifyOverlaySlot :: SlotNo -> Set (KeyHash 'Genesis crypto) -> UnitInterval -> ActiveSlotCoeff -> SlotNo -> OBftSlot crypto
lookupInOverlaySchedule :: SlotNo -> Set (KeyHash 'Genesis crypto) -> UnitInterval -> ActiveSlotCoeff -> SlotNo -> Maybe (OBftSlot crypto)

-- | Update operation for protocol parameters structure @PParams
newtype ProposedPPUpdates era
ProposedPPUpdates :: Map (KeyHash 'Genesis (Crypto era)) (PParamsUpdate era) -> ProposedPPUpdates era

-- | Update Proposal
data Update era
Update :: !ProposedPPUpdates era -> !EpochNo -> Update era
data ProtVer
ProtVer :: !Natural -> !Natural -> ProtVer
[pvMajor] :: ProtVer -> !Natural
[pvMinor] :: ProtVer -> !Natural
type PParams era = PParams' Identity era

-- | Protocol parameters.
--   
--   We use the HKD type family so that the protocol parameters type and
--   the type for the updates to the protocol parameters can share records
--   fields. The protocol parameters will have type <a>PParams'</a>
--   <a>Identity</a>, and the updates will have type <a>PParams'</a>
--   <a>StrictMaybe</a>, though <a>Identity</a> will be hidden from use.
--   
--   For example:
--   
--   <pre>
--   myParameters =
--     PParams
--       { _minfeeA = 0,
--         _minfeeB = 0,
--         ...
--       }
--   
--   myUpdate =
--     PParamsUpdate
--       { _minfeeA = SNothing,
--         _minfeeB = SJust 42,
--         ...
--       }
--   </pre>
data PParams' f era
PParams :: !HKD f Natural -> !HKD f Natural -> !HKD f Natural -> !HKD f Natural -> !HKD f Natural -> !HKD f Coin -> !HKD f Coin -> !HKD f EpochNo -> !HKD f Natural -> !HKD f Rational -> !HKD f UnitInterval -> !HKD f UnitInterval -> !HKD f UnitInterval -> !HKD f Nonce -> !HKD f ProtVer -> !HKD f Coin -> !HKD f Coin -> PParams' f era

-- | The linear factor for the minimum fee calculation
[_minfeeA] :: PParams' f era -> !HKD f Natural

-- | The constant factor for the minimum fee calculation
[_minfeeB] :: PParams' f era -> !HKD f Natural

-- | Maximal block body size
[_maxBBSize] :: PParams' f era -> !HKD f Natural

-- | Maximal transaction size
[_maxTxSize] :: PParams' f era -> !HKD f Natural

-- | Maximal block header size
[_maxBHSize] :: PParams' f era -> !HKD f Natural

-- | The amount of a key registration deposit
[_keyDeposit] :: PParams' f era -> !HKD f Coin

-- | The amount of a pool registration deposit
[_poolDeposit] :: PParams' f era -> !HKD f Coin

-- | epoch bound on pool retirement
[_eMax] :: PParams' f era -> !HKD f EpochNo

-- | Desired number of pools
[_nOpt] :: PParams' f era -> !HKD f Natural

-- | Pool influence
[_a0] :: PParams' f era -> !HKD f Rational

-- | Monetary expansion
[_rho] :: PParams' f era -> !HKD f UnitInterval

-- | Treasury expansion
[_tau] :: PParams' f era -> !HKD f UnitInterval

-- | Decentralization parameter
[_d] :: PParams' f era -> !HKD f UnitInterval

-- | Extra entropy
[_extraEntropy] :: PParams' f era -> !HKD f Nonce

-- | Protocol version
[_protocolVersion] :: PParams' f era -> !HKD f ProtVer

-- | Minimum UTxO value
[_minUTxOValue] :: PParams' f era -> !HKD f Coin

-- | Minimum Stake Pool Cost
[_minPoolCost] :: PParams' f era -> !HKD f Coin
data OCert crypto
OCert :: !VerKeyKES crypto -> !Word64 -> !KESPeriod -> !SignedDSIGN crypto (OCertSignable crypto) -> OCert crypto

-- | The operational hot key
[ocertVkHot] :: OCert crypto -> !VerKeyKES crypto

-- | counter
[ocertN] :: OCert crypto -> !Word64

-- | Start of key evolving signature period
[ocertKESPeriod] :: OCert crypto -> !KESPeriod

-- | Signature of block operational certificate content
[ocertSigma] :: OCert crypto -> !SignedDSIGN crypto (OCertSignable crypto)
newtype KESPeriod
KESPeriod :: Word -> KESPeriod
[unKESPeriod] :: KESPeriod -> Word
data OCertEnv crypto
OCertEnv :: Set (KeyHash 'StakePool crypto) -> Set (KeyHash 'GenesisDelegate crypto) -> OCertEnv crypto
[ocertEnvStPools] :: OCertEnv crypto -> Set (KeyHash 'StakePool crypto)
[ocertEnvGenDelegs] :: OCertEnv crypto -> Set (KeyHash 'GenesisDelegate crypto)

-- | Pointer to a slot, transaction index and index in certificate list.
data Ptr
Ptr :: !SlotNo -> !Ix -> !Ix -> Ptr
data StakeReference crypto
StakeRefBase :: !StakeCredential crypto -> StakeReference crypto
StakeRefPtr :: !Ptr -> StakeReference crypto
StakeRefNull :: StakeReference crypto

-- | Script hash or key hash for a payment or a staking object.
--   
--   Note that credentials (unlike raw key hashes) do appear to vary from
--   era to era, since they reference the hash of a script, which can
--   change. This parameter is a phantom, however, so in actuality the
--   instances will remain the same.
data Credential (kr :: KeyRole) crypto
ScriptHashObj :: {-# UNPACK #-} !ScriptHash crypto -> Credential (kr :: KeyRole) crypto
KeyHashObj :: {-# UNPACK #-} !KeyHash kr crypto -> Credential (kr :: KeyRole) crypto

-- | An account based address for rewards
data RewardAcnt crypto
RewardAcnt :: !Network -> !Credential 'Staking crypto -> RewardAcnt crypto
[getRwdNetwork] :: RewardAcnt crypto -> !Network
[getRwdCred] :: RewardAcnt crypto -> !Credential 'Staking crypto

-- | An address for UTxO.
data Addr crypto
Addr :: Network -> PaymentCredential crypto -> StakeReference crypto -> Addr crypto
AddrBootstrap :: BootstrapAddress crypto -> Addr crypto

-- | Calculate the stability window (e.g. the number of slots needed for a
--   block to become stable) from the security param and the active slot
--   coefficient.
--   
--   The value 3k/f is determined to be a suitabe value as per
--   <a>https://docs.google.com/document/d/1B8BNMx8jVWRjYiUBOaI3jfZ7dQNvNTSDODvT5iOuYCU/edit#heading=h.qh2zcajmu6hm</a>
computeStabilityWindow :: Word64 -> ActiveSlotCoeff -> Word64

-- | Calculate the randomness stabilisation window from the security param
--   and the active slot coefficient.
--   
--   The value 4k/f is determined to be a suitabe value as per
--   <a>https://docs.google.com/document/d/1B8BNMx8jVWRjYiUBOaI3jfZ7dQNvNTSDODvT5iOuYCU/edit#heading=h.qh2zcajmu6hm</a>
computeRandomnessStabilisationWindow :: Word64 -> ActiveSlotCoeff -> Word64
newtype StakeCreds crypto
StakeCreds :: Map (Credential 'Staking crypto) SlotNo -> StakeCreds crypto
[unStakeCreds] :: StakeCreds crypto -> Map (Credential 'Staking crypto) SlotNo

-- | Proof/Witness that a transaction is authorized by the given key
--   holder.
data WitVKey kr crypto
pattern WitVKey :: (Typeable kr, Crypto crypto) => VKey kr crypto -> SignedDSIGN crypto (Hash crypto EraIndependentTxBody) -> WitVKey kr crypto
newtype TxBody era
TxBodyConstr :: MemoBytes (TxBodyRaw era) -> TxBody era

-- | Pattern for use by external users
pattern TxBody :: ProperTo era => Set (TxIn (Crypto era)) -> StrictSeq (TxOut era) -> StrictSeq (DCert (Crypto era)) -> Wdrl (Crypto era) -> Coin -> SlotNo -> StrictMaybe (Update era) -> StrictMaybe (AuxiliaryDataHash (Crypto era)) -> TxBody era

-- | A heavyweight certificate.
data DCert crypto
DCertDeleg :: !DelegCert crypto -> DCert crypto
DCertPool :: !PoolCert crypto -> DCert crypto
DCertGenesis :: !GenesisDelegCert crypto -> DCert crypto
DCertMir :: !MIRCert crypto -> DCert crypto

-- | Move instantaneous rewards certificate
data MIRCert crypto
MIRCert :: MIRPot -> Map (Credential 'Staking crypto) Coin -> MIRCert crypto
[mirPot] :: MIRCert crypto -> MIRPot
[mirRewards] :: MIRCert crypto -> Map (Credential 'Staking crypto) Coin
data MIRPot
ReservesMIR :: MIRPot
TreasuryMIR :: MIRPot

-- | Genesis key delegation certificate
data GenesisDelegCert crypto
GenesisDelegCert :: !KeyHash 'Genesis crypto -> !KeyHash 'GenesisDelegate crypto -> !Hash crypto (VerKeyVRF crypto) -> GenesisDelegCert crypto
data PoolCert crypto

-- | A stake pool registration certificate.
RegPool :: !PoolParams crypto -> PoolCert crypto

-- | A stake pool retirement certificate.
RetirePool :: !KeyHash 'StakePool crypto -> !EpochNo -> PoolCert crypto
data DelegCert crypto

-- | A stake key registration certificate.
RegKey :: !StakeCredential crypto -> DelegCert crypto

-- | A stake key deregistration certificate.
DeRegKey :: !StakeCredential crypto -> DelegCert crypto

-- | A stake delegation certificate.
Delegate :: !Delegation crypto -> DelegCert crypto

-- | The output of a UTxO.
data TxOut era
TxOutCompact :: {-# UNPACK #-} !CompactAddr (Crypto era) -> !CompactForm (Value era) -> TxOut era
pattern TxOut :: (HasCallStack, ShelleyBased era) => Addr (Crypto era) -> Value era -> TxOut era

-- | The input of a UTxO.
data TxIn crypto
TxInCompact :: {-# UNPACK #-} !TxId crypto -> {-# UNPACK #-} !Word64 -> TxIn crypto
pattern TxIn :: Crypto crypto => TxId crypto -> Natural -> TxIn crypto

-- | A unique ID of a transaction, which is computable from the
--   transaction.
newtype TxId crypto
TxId :: Hash crypto EraIndependentTxBody -> TxId crypto
[_unTxId] :: TxId crypto -> Hash crypto EraIndependentTxBody
newtype Wdrl crypto
Wdrl :: Map (RewardAcnt crypto) Coin -> Wdrl crypto
[unWdrl] :: Wdrl crypto -> Map (RewardAcnt crypto) Coin

-- | A stake pool.
data PoolParams crypto
PoolParams :: !KeyHash 'StakePool crypto -> !Hash crypto (VerKeyVRF crypto) -> !Coin -> !Coin -> !UnitInterval -> !RewardAcnt crypto -> !Set (KeyHash 'Staking crypto) -> !StrictSeq StakePoolRelay -> !StrictMaybe PoolMetadata -> PoolParams crypto
[_poolId] :: PoolParams crypto -> !KeyHash 'StakePool crypto
[_poolVrf] :: PoolParams crypto -> !Hash crypto (VerKeyVRF crypto)
[_poolPledge] :: PoolParams crypto -> !Coin
[_poolCost] :: PoolParams crypto -> !Coin
[_poolMargin] :: PoolParams crypto -> !UnitInterval
[_poolRAcnt] :: PoolParams crypto -> !RewardAcnt crypto
[_poolOwners] :: PoolParams crypto -> !Set (KeyHash 'Staking crypto)
[_poolRelays] :: PoolParams crypto -> !StrictSeq StakePoolRelay
[_poolMD] :: PoolParams crypto -> !StrictMaybe PoolMetadata
data StakePoolRelay

-- | One or both of IPv4 &amp; IPv6
SingleHostAddr :: !StrictMaybe Port -> !StrictMaybe IPv4 -> !StrictMaybe IPv6 -> StakePoolRelay

-- | An <tt>A</tt> or <tt>AAAA</tt> DNS record
SingleHostName :: !StrictMaybe Port -> !DnsName -> StakePoolRelay

-- | A <tt>SRV</tt> DNS record
MultiHostName :: !DnsName -> StakePoolRelay
data PoolMetadata
PoolMetadata :: !Url -> !ByteString -> PoolMetadata
[_poolMDUrl] :: PoolMetadata -> !Url
[_poolMDHash] :: PoolMetadata -> !ByteString

-- | The delegation of one stake key to another.
data Delegation crypto
Delegation :: !StakeCredential crypto -> !KeyHash 'StakePool crypto -> Delegation crypto
[_delegator] :: Delegation crypto -> !StakeCredential crypto
[_delegatee] :: Delegation crypto -> !KeyHash 'StakePool crypto

-- | A fully formed transaction.
data Tx era
Tx' :: !TxBody era -> !WitnessSet era -> !StrictMaybe (AuxiliaryData era) -> ByteString -> Tx era
pattern Tx :: (TxBodyConstraints era, ToCBOR (AuxiliaryData era)) => TxBody era -> WitnessSet era -> StrictMaybe (AuxiliaryData era) -> Tx era
type WitnessSet = WitnessSetHKD Identity
individualPoolStake :: IndividualPoolStake crypto -> Rational
newtype PoolDistr crypto
PoolDistr :: Map (KeyHash 'StakePool crypto) (IndividualPoolStake crypto) -> PoolDistr crypto
[unPoolDistr] :: PoolDistr crypto -> Map (KeyHash 'StakePool crypto) (IndividualPoolStake crypto)

-- | The unspent transaction outputs.
newtype UTxO era
UTxO :: Map (TxIn (Crypto era)) (TxOut era) -> UTxO era
[unUTxO] :: UTxO era -> Map (TxIn (Crypto era)) (TxOut era)

-- | Determine the total balance contained in the UTxO.
balance :: ShelleyBased era => UTxO era -> Value era
data ValidationErr
EpochNotLongEnough :: EpochSize -> Word64 -> Rational -> EpochSize -> ValidationErr
MaxKESEvolutionsUnsupported :: Word64 -> Word -> ValidationErr
QuorumTooSmall :: Word64 -> Word64 -> Word64 -> ValidationErr

-- | Shelley genesis information
--   
--   Note that this is needed only for a pure Shelley network, hence it
--   being defined here rather than in its own module. In mainnet, Shelley
--   will transition naturally from Byron, and thus will never have its own
--   genesis information.
data ShelleyGenesis era
ShelleyGenesis :: !UTCTime -> !Word32 -> !Network -> !Rational -> !Word64 -> !EpochSize -> !Word64 -> !Word64 -> !NominalDiffTime -> !Word64 -> !Word64 -> !PParams era -> !Map (KeyHash 'Genesis (Crypto era)) (GenDelegPair (Crypto era)) -> !Map (Addr (Crypto era)) Coin -> !ShelleyGenesisStaking (Crypto era) -> ShelleyGenesis era
[sgSystemStart] :: ShelleyGenesis era -> !UTCTime
[sgNetworkMagic] :: ShelleyGenesis era -> !Word32
[sgNetworkId] :: ShelleyGenesis era -> !Network
[sgActiveSlotsCoeff] :: ShelleyGenesis era -> !Rational
[sgSecurityParam] :: ShelleyGenesis era -> !Word64
[sgEpochLength] :: ShelleyGenesis era -> !EpochSize
[sgSlotsPerKESPeriod] :: ShelleyGenesis era -> !Word64
[sgMaxKESEvolutions] :: ShelleyGenesis era -> !Word64
[sgSlotLength] :: ShelleyGenesis era -> !NominalDiffTime
[sgUpdateQuorum] :: ShelleyGenesis era -> !Word64
[sgMaxLovelaceSupply] :: ShelleyGenesis era -> !Word64
[sgProtocolParams] :: ShelleyGenesis era -> !PParams era
[sgGenDelegs] :: ShelleyGenesis era -> !Map (KeyHash 'Genesis (Crypto era)) (GenDelegPair (Crypto era))
[sgInitialFunds] :: ShelleyGenesis era -> !Map (Addr (Crypto era)) Coin
[sgStaking] :: ShelleyGenesis era -> !ShelleyGenesisStaking (Crypto era)

-- | Genesis Shelley staking configuration.
--   
--   This allows us to configure some initial stake pools and delegation to
--   them, in order to test Praos in a static configuration, without
--   requiring on-chain registration and delegation.
--   
--   For simplicity, pools defined in the genesis staking do not pay
--   deposits for their registration.
data ShelleyGenesisStaking crypto
ShelleyGenesisStaking :: !Map (KeyHash 'StakePool crypto) (PoolParams crypto) -> !Map (KeyHash 'Staking crypto) (KeyHash 'StakePool crypto) -> ShelleyGenesisStaking crypto

-- | Pools to register
--   
--   The key in this map is the hash of the public key of the _pool_. This
--   need not correspond to any payment or staking key, but must correspond
--   to the cold key held by <tt>TPraosIsCoreNode</tt>.
[sgsPools] :: ShelleyGenesisStaking crypto -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto)

-- | Stake-holding key hash credentials and the pools to delegate that
--   stake to. We require the raw staking key hash in order to:
--   
--   <ul>
--   <li>Avoid pointer addresses, which would be tricky when there's no
--   slot or transaction to point to.</li>
--   <li>Avoid script credentials.</li>
--   </ul>
[sgsStake] :: ShelleyGenesisStaking crypto -> !Map (KeyHash 'Staking crypto) (KeyHash 'StakePool crypto)

-- | Empty genesis staking
emptyGenesisStaking :: ShelleyGenesisStaking crypto
sgActiveSlotCoeff :: ShelleyGenesis era -> ActiveSlotCoeff
genesisUtxO :: ShelleyBased era => ShelleyGenesis era -> UTxO era

-- | Compute the <a>TxIn</a> of the initial UTxO pseudo-transaction
--   corresponding to the given address in the genesis initial funds.
--   
--   The Shelley initial UTxO is constructed from the <a>sgInitialFunds</a>
--   which is not a full UTxO but just a map from addresses to coin values.
--   
--   This gets turned into a UTxO by making a pseudo-transaction for each
--   address, with the 0th output being the coin value. So to spend from
--   the initial UTxO we need this same <a>TxIn</a> to use as an input to
--   the spending transaction.
initialFundsPseudoTxIn :: forall crypto. Crypto crypto => Addr crypto -> TxIn crypto
describeValidationErr :: ValidationErr -> Text

-- | Do some basic sanity checking on the Shelley genesis file.
validateGenesis :: forall era. Era era => ShelleyGenesis era -> Either [ValidationErr] ()
mkShelleyGlobals :: ShelleyGenesis era -> EpochInfo Identity -> Natural -> Globals

-- | Snapshots of the stake distribution.
data SnapShots crypto
SnapShots :: !SnapShot crypto -> !SnapShot crypto -> !SnapShot crypto -> !Coin -> SnapShots crypto
[$sel:_pstakeMark:SnapShots] :: SnapShots crypto -> !SnapShot crypto
[$sel:_pstakeSet:SnapShots] :: SnapShots crypto -> !SnapShot crypto
[$sel:_pstakeGo:SnapShots] :: SnapShots crypto -> !SnapShot crypto
[$sel:_feeSS:SnapShots] :: SnapShots crypto -> !Coin

-- | Snapshot of the stake distribution.
data SnapShot crypto
SnapShot :: !Stake crypto -> !Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto) -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto) -> SnapShot crypto
[$sel:_stake:SnapShot] :: SnapShot crypto -> !Stake crypto
[$sel:_delegations:SnapShot] :: SnapShot crypto -> !Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto)
[$sel:_poolParams:SnapShot] :: SnapShot crypto -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto)

-- | Type of stake as map from hash key to coins associated.
newtype Stake crypto
Stake :: Map (Credential 'Staking crypto) Coin -> Stake crypto
[$sel:unStake:Stake] :: Stake crypto -> Map (Credential 'Staking crypto) Coin
data NonMyopic crypto
newtype WitHashes crypto
WitHashes :: Set (KeyHash 'Witness crypto) -> WitHashes crypto
[unWitHashes] :: WitHashes crypto -> Set (KeyHash 'Witness crypto)

-- | The state associated with a <tt>Ledger</tt>.
data LedgerState era
LedgerState :: !UTxOState era -> !DPState (Crypto era) -> LedgerState era

-- | The current unspent transaction outputs.
[_utxoState] :: LedgerState era -> !UTxOState era

-- | The current delegation state
[_delegationState] :: LedgerState era -> !DPState (Crypto era)

-- | New Epoch state and environment
data NewEpochState era
NewEpochState :: !EpochNo -> !BlocksMade (Crypto era) -> !BlocksMade (Crypto era) -> !EpochState era -> !StrictMaybe (RewardUpdate (Crypto era)) -> !PoolDistr (Crypto era) -> NewEpochState era

-- | Last epoch
[nesEL] :: NewEpochState era -> !EpochNo

-- | Blocks made before current epoch
[nesBprev] :: NewEpochState era -> !BlocksMade (Crypto era)

-- | Blocks made in current epoch
[nesBcur] :: NewEpochState era -> !BlocksMade (Crypto era)

-- | Epoch state before current
[nesEs] :: NewEpochState era -> !EpochState era

-- | Possible reward update
[nesRu] :: NewEpochState era -> !StrictMaybe (RewardUpdate (Crypto era))

-- | Stake distribution within the stake pool
[nesPd] :: NewEpochState era -> !PoolDistr (Crypto era)
data UTxOState era
UTxOState :: !UTxO era -> !Coin -> !Coin -> !PPUPState era -> UTxOState era
[_utxo] :: UTxOState era -> !UTxO era
[_deposited] :: UTxOState era -> !Coin
[_fees] :: UTxOState era -> !Coin
[_ppups] :: UTxOState era -> !PPUPState era
data PPUPState era
PPUPState :: !ProposedPPUpdates era -> !ProposedPPUpdates era -> PPUPState era
[proposals] :: PPUPState era -> !ProposedPPUpdates era
[futureProposals] :: PPUPState era -> !ProposedPPUpdates era
data EpochState era
EpochState :: !AccountState -> !SnapShots (Crypto era) -> !LedgerState era -> !PParams era -> !PParams era -> !NonMyopic (Crypto era) -> EpochState era
[esAccountState] :: EpochState era -> !AccountState
[esSnapshots] :: EpochState era -> !SnapShots (Crypto era)
[esLState] :: EpochState era -> !LedgerState era
[esPrevPp] :: EpochState era -> !PParams era
[esPp] :: EpochState era -> !PParams era

-- | This field, esNonMyopic, does not appear in the formal spec and is not
--   a part of the protocol. It is only used for providing data to the
--   stake pool ranking calculation <tt>getNonMyopicMemberRewards</tt>. See
--   <a>https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/specs.pool-ranking/latest/download-by-type/doc-pdf/pool-ranking</a>
[esNonMyopic] :: EpochState era -> !NonMyopic (Crypto era)
data AccountState
AccountState :: !Coin -> !Coin -> AccountState
[_treasury] :: AccountState -> !Coin
[_reserves] :: AccountState -> !Coin
data RewardUpdate crypto
RewardUpdate :: !DeltaCoin -> !DeltaCoin -> !Map (Credential 'Staking crypto) Coin -> !DeltaCoin -> !NonMyopic crypto -> RewardUpdate crypto
[deltaT] :: RewardUpdate crypto -> !DeltaCoin
[deltaR] :: RewardUpdate crypto -> !DeltaCoin
[rs] :: RewardUpdate crypto -> !Map (Credential 'Staking crypto) Coin
[deltaF] :: RewardUpdate crypto -> !DeltaCoin
[nonMyopic] :: RewardUpdate crypto -> !NonMyopic crypto

-- | The state associated with the current stake delegation.
data DPState crypto
DPState :: !DState crypto -> !PState crypto -> DPState crypto
[_dstate] :: DPState crypto -> !DState crypto
[_pstate] :: DPState crypto -> !PState crypto

-- | Current state of staking pools and their certificate counters.
data PState crypto
PState :: !Map (KeyHash 'StakePool crypto) (PoolParams crypto) -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto) -> !Map (KeyHash 'StakePool crypto) EpochNo -> PState crypto

-- | The pool parameters.
[_pParams] :: PState crypto -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto)

-- | The future pool parameters.
[_fPParams] :: PState crypto -> !Map (KeyHash 'StakePool crypto) (PoolParams crypto)

-- | A map of retiring stake pools to the epoch when they retire.
[_retiring] :: PState crypto -> !Map (KeyHash 'StakePool crypto) EpochNo

-- | State of staking pool delegations and rewards
data DState crypto
DState :: !RewardAccounts crypto -> !Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto) -> !Bimap Ptr (Credential 'Staking crypto) -> !Map (FutureGenDeleg crypto) (GenDelegPair crypto) -> !GenDelegs crypto -> !InstantaneousRewards crypto -> DState crypto

-- | The active reward accounts.
[_rewards] :: DState crypto -> !RewardAccounts crypto

-- | The current delegations.
[_delegations] :: DState crypto -> !Map (Credential 'Staking crypto) (KeyHash 'StakePool crypto)

-- | The pointed to hash keys.
[_ptrs] :: DState crypto -> !Bimap Ptr (Credential 'Staking crypto)

-- | future genesis key delegations
[_fGenDelegs] :: DState crypto -> !Map (FutureGenDeleg crypto) (GenDelegPair crypto)

-- | Genesis key delegations
[_genDelegs] :: DState crypto -> !GenDelegs crypto

-- | Instantaneous Rewards
[_irwd] :: DState crypto -> !InstantaneousRewards crypto
data InstantaneousRewards crypto
InstantaneousRewards :: !Map (Credential 'Staking crypto) Coin -> !Map (Credential 'Staking crypto) Coin -> InstantaneousRewards crypto
[iRReserves] :: InstantaneousRewards crypto -> !Map (Credential 'Staking crypto) Coin
[iRTreasury] :: InstantaneousRewards crypto -> !Map (Credential 'Staking crypto) Coin

-- | Representation of a list of pairs of key pairs, e.g., pay and stake
--   keys
type KeyPairs crypto = [(KeyPair 'Payment crypto, KeyPair 'Staking crypto)]
data PPUPEnv era
PPUPEnv :: SlotNo -> PParams era -> GenDelegs (Crypto era) -> PPUPEnv era
data PPUP era
data UtxoEnv era
UtxoEnv :: SlotNo -> PParams era -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> GenDelegs (Crypto era) -> UtxoEnv era
data UTXO era
data UTXOW era
data POOLREAP era
data PoolEnv era
PoolEnv :: SlotNo -> PParams era -> PoolEnv era
data POOL (era :: Type)
data NEWEPOCH era
calculatePoolDistr :: SnapShot crypto -> PoolDistr crypto
data TICK era
data DelegEnv
DelegEnv :: SlotNo -> Ptr -> AccountState -> DelegEnv
[slotNo] :: DelegEnv -> SlotNo
[ptr_] :: DelegEnv -> Ptr
[acnt_] :: DelegEnv -> AccountState
data DELEG era
data DelplEnv era
DelplEnv :: SlotNo -> Ptr -> PParams era -> AccountState -> DelplEnv era
[delplSlotNo] :: DelplEnv era -> SlotNo
[delPlPtr] :: DelplEnv era -> Ptr
[delPlPp] :: DelplEnv era -> PParams era
[delPlAcnt] :: DelplEnv era -> AccountState
data DELPL era
data DelegsEnv era
DelegsEnv :: SlotNo -> Ix -> PParams era -> Tx era -> AccountState -> DelegsEnv era
[delegsSlotNo] :: DelegsEnv era -> SlotNo
[delegsIx] :: DelegsEnv era -> Ix
[delegspp] :: DelegsEnv era -> PParams era
[delegsTx] :: DelegsEnv era -> Tx era
[delegsAccount] :: DelegsEnv era -> AccountState
data DELEGS era
data LedgerEnv era
LedgerEnv :: SlotNo -> Ix -> PParams era -> AccountState -> LedgerEnv era
[ledgerSlotNo] :: LedgerEnv era -> SlotNo
[ledgerIx] :: LedgerEnv era -> Ix
[ledgerPp] :: LedgerEnv era -> PParams era
[ledgerAccount] :: LedgerEnv era -> AccountState
data LEDGER era
data LedgersEnv era
LedgersEnv :: SlotNo -> PParams era -> AccountState -> LedgersEnv era
[ledgersSlotNo] :: LedgersEnv era -> SlotNo
[ledgersPp] :: LedgersEnv era -> PParams era
[ledgersAccount] :: LedgersEnv era -> AccountState
data LEDGERS era
newtype LaxBlock era
LaxBlock :: Block era -> LaxBlock era
data Block era
Block' :: !BHeader (Crypto era) -> !TxSeq era -> ByteString -> Block era
pattern Block :: Era era => BHeader (Crypto era) -> TxSeq era -> Block era
data BHBody crypto
BHBody :: !BlockNo -> !SlotNo -> !PrevHash crypto -> !VKey 'BlockIssuer crypto -> !VerKeyVRF crypto -> !CertifiedVRF crypto Nonce -> !CertifiedVRF crypto Natural -> !Natural -> !HashBBody crypto -> !OCert crypto -> !ProtVer -> BHBody crypto

-- | block number
[bheaderBlockNo] :: BHBody crypto -> !BlockNo

-- | block slot
[bheaderSlotNo] :: BHBody crypto -> !SlotNo

-- | Hash of the previous block header
[bheaderPrev] :: BHBody crypto -> !PrevHash crypto

-- | verification key of block issuer
[bheaderVk] :: BHBody crypto -> !VKey 'BlockIssuer crypto

-- | VRF verification key for block issuer
[bheaderVrfVk] :: BHBody crypto -> !VerKeyVRF crypto

-- | block nonce
[bheaderEta] :: BHBody crypto -> !CertifiedVRF crypto Nonce

-- | leader election value
[bheaderL] :: BHBody crypto -> !CertifiedVRF crypto Natural

-- | Size of the block body
[bsize] :: BHBody crypto -> !Natural

-- | Hash of block body
[bhash] :: BHBody crypto -> !HashBBody crypto

-- | operational certificate
[bheaderOCert] :: BHBody crypto -> !OCert crypto

-- | protocol version
[bprotver] :: BHBody crypto -> !ProtVer

-- | The previous hash of a block
data PrevHash crypto
GenesisHash :: PrevHash crypto
BlockHash :: !HashHeader crypto -> PrevHash crypto
data BHeader crypto
pattern BHeader :: Crypto crypto => BHBody crypto -> SignedKES crypto (BHBody crypto) -> BHeader crypto

-- | Hash of block body
newtype HashBBody crypto
UnsafeHashBBody :: Hash crypto EraIndependentBlockBody -> HashBBody crypto
[unHashBody] :: HashBBody crypto -> Hash crypto EraIndependentBlockBody

-- | The hash of a Block Header
newtype HashHeader crypto
HashHeader :: Hash crypto (BHeader crypto) -> HashHeader crypto
[unHashHeader] :: HashHeader crypto -> Hash crypto (BHeader crypto)

-- | Hash a given block header
bhHash :: forall crypto. Crypto crypto => BHeader crypto -> HashHeader crypto

-- | Hash a given block body
bbHash :: forall era. Era era => TxSeq era -> HashBBody (Crypto era)
bHeaderSize :: forall crypto. Crypto crypto => BHeader crypto -> Int
bheader :: Era era => Block era -> BHeader (Crypto era)
bbody :: Era era => Block era -> TxSeq era
bhbody :: Crypto crypto => BHeader crypto -> BHBody crypto
data PrtlSeqFailure crypto
WrongSlotIntervalPrtclSeq :: SlotNo -> SlotNo -> PrtlSeqFailure crypto
WrongBlockNoPrtclSeq :: WithOrigin (LastAppliedBlock crypto) -> BlockNo -> PrtlSeqFailure crypto
WrongBlockSequencePrtclSeq :: PrevHash crypto -> PrevHash crypto -> PrtlSeqFailure crypto
data PrtclPredicateFailure crypto
OverlayFailure :: PredicateFailure (OVERLAY crypto) -> PrtclPredicateFailure crypto
UpdnFailure :: PredicateFailure (UPDN crypto) -> PrtclPredicateFailure crypto
data PrtclEnv crypto
PrtclEnv :: UnitInterval -> PoolDistr crypto -> GenDelegs crypto -> Nonce -> PrtclEnv crypto
data PrtclState crypto
PrtclState :: !Map (KeyHash 'BlockIssuer crypto) Word64 -> !Nonce -> !Nonce -> PrtclState crypto
prtlSeqChecks :: (MonadError (PrtlSeqFailure crypto) m, Crypto crypto) => WithOrigin (LastAppliedBlock crypto) -> BHeader crypto -> m ()
data ChainState era
ChainState :: NewEpochState era -> Map (KeyHash 'BlockIssuer (Crypto era)) Word64 -> Nonce -> Nonce -> Nonce -> Nonce -> WithOrigin (LastAppliedBlock (Crypto era)) -> ChainState era
[chainNes] :: ChainState era -> NewEpochState era
[chainOCertIssue] :: ChainState era -> Map (KeyHash 'BlockIssuer (Crypto era)) Word64
[chainEpochNonce] :: ChainState era -> Nonce
[chainEvolvingNonce] :: ChainState era -> Nonce
[chainCandidateNonce] :: ChainState era -> Nonce
[chainPrevEpochNonce] :: ChainState era -> Nonce
[chainLastAppliedBlock] :: ChainState era -> WithOrigin (LastAppliedBlock (Crypto era))
data CHAIN era

-- | Creates a valid initial chain state
initialShelleyState :: WithOrigin (LastAppliedBlock (Crypto era)) -> EpochNo -> UTxO era -> Coin -> Map (KeyHash 'Genesis (Crypto era)) (GenDelegPair (Crypto era)) -> PParams era -> Nonce -> ChainState era
class (ChainData (Tx era), AnnotatedData (Tx era), Eq (ApplyTxError era), Show (ApplyTxError era), Typeable (ApplyTxError era), SerialisableData (ApplyTxError era)) => ApplyTx era
applyTxs :: (ApplyTx era, MonadError (ApplyTxError era) m) => Globals -> SlotNo -> Seq (Tx era) -> NewEpochState era -> m (NewEpochState era)
applyTxs :: (ApplyTx era, MonadError (ApplyTxError era) m, STS (LEDGERS era)) => Globals -> SlotNo -> Seq (Tx era) -> NewEpochState era -> m (NewEpochState era)
data ApplyTxError era
ApplyTxError :: [PredicateFailure (LEDGERS era)] -> ApplyTxError era
class (PraosCrypto (Crypto era), ShelleyBased era, GetLedgerView era, ApplyBlock era, ApplyTx era) => ShelleyBasedEra era
instance Shelley.Spec.Ledger.API.Protocol.PraosCrypto crypto => Shelley.Spec.Ledger.API.ShelleyBasedEra (Cardano.Ledger.Shelley.ShelleyEra crypto)
