{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Ouroboros.Consensus.Protocol.Praos.Views
( PolyPraosLedgerView (..)
, PolyPraosValidateView (..)
, ForecastToPolyPraosLedgerView (..)
) where
import Cardano.Crypto.KES (SignedKES)
import Cardano.Crypto.VRF (CertifiedVRF, VRFAlgorithm (VerKeyVRF))
import Cardano.Ledger.BaseTypes
( ProtVer
, StrictMaybe
)
import Cardano.Ledger.Block (EbReferencesAnnouncement)
import Cardano.Ledger.Keys (KeyRole (BlockIssuer), VKey)
import qualified Cardano.Ledger.Shelley.API as SL
import Cardano.Protocol.Crypto (KES, VRF)
import Cardano.Protocol.Praos.VRF (InputVRF)
import Cardano.Protocol.TPraos.BlockHeader (PrevHash)
import Cardano.Protocol.TPraos.OCert (OCert)
import Cardano.Slotting.Slot (SlotNo)
import Data.Kind (Constraint, Type)
import Data.Word (Word16, Word32)
import Ouroboros.Consensus.Leios.Protocol (LeiosLedgerView)
import Ouroboros.Consensus.Protocol.Praos.Common (ShelleyProtocolHeader, WhenLeios)
import Ouroboros.Consensus.Protocol.Signed (Signed)
type PolyPraosValidateView :: Type -> Type -> Type
data PolyPraosValidateView proto crypto =
{ forall proto crypto. PolyPraosValidateView proto crypto -> PrevHash
hvPrevHash :: !PrevHash
, forall proto crypto.
PolyPraosValidateView proto crypto -> VKey BlockIssuer
hvVK :: !(VKey BlockIssuer)
, forall proto crypto.
PolyPraosValidateView proto crypto -> VerKeyVRF (VRF crypto)
hvVrfVK :: !(VerKeyVRF (VRF crypto))
, forall proto crypto.
PolyPraosValidateView proto crypto
-> CertifiedVRF (VRF crypto) InputVRF
hvVrfRes :: !(CertifiedVRF (VRF crypto) InputVRF)
, forall proto crypto.
PolyPraosValidateView proto crypto -> OCert crypto
hvOCert :: !(OCert crypto)
, forall proto crypto. PolyPraosValidateView proto crypto -> SlotNo
hvSlotNo :: !SlotNo
, forall proto crypto.
PolyPraosValidateView proto crypto
-> WhenLeios proto (Bool, StrictMaybe EbReferencesAnnouncement)
hvLeios :: !(WhenLeios proto (Bool, StrictMaybe EbReferencesAnnouncement))
, forall proto crypto.
PolyPraosValidateView proto crypto
-> Signed (ShelleyProtocolHeader proto)
hvSigned :: !(Signed (ShelleyProtocolHeader proto))
, forall proto crypto.
PolyPraosValidateView proto crypto
-> SignedKES (KES crypto) (Signed (ShelleyProtocolHeader proto))
hvSignature :: !(SignedKES (KES crypto) (Signed (ShelleyProtocolHeader proto)))
}
type PolyPraosLedgerView :: Type -> Type
data PolyPraosLedgerView proto = PraosLedgerView
{ forall proto. PolyPraosLedgerView proto -> PoolDistr
plvPoolDistr :: SL.PoolDistr
, :: !Word16
, forall proto. PolyPraosLedgerView proto -> Word32
plvMaxBodySize :: !Word32
, forall proto. PolyPraosLedgerView proto -> ProtVer
plvProtocolVersion :: !ProtVer
, forall proto.
PolyPraosLedgerView proto -> WhenLeios proto LeiosLedgerView
plvLeios :: !(WhenLeios proto LeiosLedgerView)
}
deriving instance
Show (WhenLeios proto LeiosLedgerView) =>
Show (PolyPraosLedgerView proto)
type ForecastToPolyPraosLedgerView :: Type -> Type -> Constraint
class ForecastToPolyPraosLedgerView proto era where
forecastToPolyPraosLedgerView ::
SL.EraForecast era => SL.Forecast t era -> PolyPraosLedgerView proto