{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

-- | Peras support for Shelley.
--
-- NOTE: this module exists solely because the orphan module
-- 'Ouroboros.Consensus.Shelley.Node.Serialisation' needs some of these
-- instances, but defining them there would be too confusing.
module Ouroboros.Consensus.Shelley.Node.Peras () where

import Cardano.Ledger.Api
import Data.Typeable (Typeable)
import Ouroboros.Consensus.Block.SupportsPeras
  ( BlockSupportsPeras (..)
  , VoidPerasCert
  , VoidPerasCrypto
  , VoidPerasError
  , VoidPerasVote
  , VoidPerasVotingCommitteeScheme
  , defaultForgePerasCert
  , defaultForgePerasVoteIfEligible
  , defaultVerifyPerasCert
  , defaultVerifyPerasVote
  )
import Ouroboros.Consensus.HardFork.History (EpochToPerasRoundInfo, forgetEraIndex)
import Ouroboros.Consensus.Peras.Context (StateSupportsPerasEpochContext (..))
import Ouroboros.Consensus.Protocol.Abstract
  ( ChainDepStateSupportsPeras
  , ConsensusProtocol (..)
  )
import Ouroboros.Consensus.Shelley.Ledger.Block (ShelleyBlock (..))
import Ouroboros.Consensus.Shelley.Ledger.Ledger ()
import Ouroboros.Consensus.Ticked (Ticked)

{-------------------------------------------------------------------------------
  StateSupportsPerasEpochContext
-------------------------------------------------------------------------------}

instance
  ( Typeable proto
  , ChainDepStateSupportsPeras (ChainDepState proto)
  , ChainDepStateSupportsPeras (Ticked (ChainDepState proto))
  ) =>
  StateSupportsPerasEpochContext (ShelleyBlock proto ShelleyEra)
  where
  type
    MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto ShelleyEra) =
      EpochToPerasRoundInfo
  toMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
All Top (HardForkIndices (ShelleyBlock proto ShelleyEra)) =>
proxy (ShelleyBlock proto ShelleyEra)
-> EraIndexed
     (HardForkIndices (ShelleyBlock proto ShelleyEra))
     EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto ShelleyEra)
toMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto ShelleyEra)
_ = EraIndexed '[ShelleyBlock proto ShelleyEra] EpochToPerasRoundInfo
-> EpochToPerasRoundInfo
EraIndexed
  (HardForkIndices (ShelleyBlock proto ShelleyEra))
  EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto ShelleyEra)
forall (xs :: [*]) a. EraIndexed xs a -> a
forgetEraIndex
  fromMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
proxy (ShelleyBlock proto ShelleyEra)
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto ShelleyEra)
-> EpochToPerasRoundInfo
fromMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto ShelleyEra)
_ = EpochToPerasRoundInfo -> EpochToPerasRoundInfo
MaybeEraIndexedEpochToPerasRoundInfo
  (ShelleyBlock proto ShelleyEra)
-> EpochToPerasRoundInfo
forall a. a -> a
id
  mkBoundedPerasEpochContext :: forall (ledgerState :: MapKind -> *) chainDepState.
(LedgerStateSupportsPeras ledgerState,
 ChainDepStateSupportsPeras chainDepState) =>
MaybeEraIndexedEpochToPerasRoundInfo
  (ShelleyBlock proto ShelleyEra)
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (BoundedPerasEpochContext (ShelleyBlock proto ShelleyEra))
mkBoundedPerasEpochContext = [Char]
-> EpochToPerasRoundInfo
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (VoidPerasError (ShelleyBlock proto ShelleyEra))
     (BoundedPerasEpochContext (ShelleyBlock proto ShelleyEra))
forall a. HasCallStack => [Char] -> a
error [Char]
"mkBoundedPerasEpochContext: ShelleyEra does not support Peras"

instance
  ( Typeable proto
  , ChainDepStateSupportsPeras (ChainDepState proto)
  , ChainDepStateSupportsPeras (Ticked (ChainDepState proto))
  ) =>
  StateSupportsPerasEpochContext (ShelleyBlock proto AllegraEra)
  where
  type
    MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto AllegraEra) =
      EpochToPerasRoundInfo
  toMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
All Top (HardForkIndices (ShelleyBlock proto AllegraEra)) =>
proxy (ShelleyBlock proto AllegraEra)
-> EraIndexed
     (HardForkIndices (ShelleyBlock proto AllegraEra))
     EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto AllegraEra)
toMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto AllegraEra)
_ = EraIndexed '[ShelleyBlock proto AllegraEra] EpochToPerasRoundInfo
-> EpochToPerasRoundInfo
EraIndexed
  (HardForkIndices (ShelleyBlock proto AllegraEra))
  EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto AllegraEra)
forall (xs :: [*]) a. EraIndexed xs a -> a
forgetEraIndex
  fromMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
proxy (ShelleyBlock proto AllegraEra)
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto AllegraEra)
-> EpochToPerasRoundInfo
fromMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto AllegraEra)
_ = EpochToPerasRoundInfo -> EpochToPerasRoundInfo
MaybeEraIndexedEpochToPerasRoundInfo
  (ShelleyBlock proto AllegraEra)
-> EpochToPerasRoundInfo
forall a. a -> a
id
  mkBoundedPerasEpochContext :: forall (ledgerState :: MapKind -> *) chainDepState.
(LedgerStateSupportsPeras ledgerState,
 ChainDepStateSupportsPeras chainDepState) =>
MaybeEraIndexedEpochToPerasRoundInfo
  (ShelleyBlock proto AllegraEra)
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (BoundedPerasEpochContext (ShelleyBlock proto AllegraEra))
mkBoundedPerasEpochContext = [Char]
-> EpochToPerasRoundInfo
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (VoidPerasError (ShelleyBlock proto AllegraEra))
     (BoundedPerasEpochContext (ShelleyBlock proto AllegraEra))
forall a. HasCallStack => [Char] -> a
error [Char]
"mkBoundedPerasEpochContext: AllegraEra does not support Peras"

instance
  ( Typeable proto
  , ChainDepStateSupportsPeras (ChainDepState proto)
  , ChainDepStateSupportsPeras (Ticked (ChainDepState proto))
  ) =>
  StateSupportsPerasEpochContext (ShelleyBlock proto MaryEra)
  where
  type
    MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto MaryEra) =
      EpochToPerasRoundInfo
  toMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
All Top (HardForkIndices (ShelleyBlock proto MaryEra)) =>
proxy (ShelleyBlock proto MaryEra)
-> EraIndexed
     (HardForkIndices (ShelleyBlock proto MaryEra))
     EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto MaryEra)
toMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto MaryEra)
_ = EraIndexed '[ShelleyBlock proto MaryEra] EpochToPerasRoundInfo
-> EpochToPerasRoundInfo
EraIndexed
  (HardForkIndices (ShelleyBlock proto MaryEra))
  EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto MaryEra)
forall (xs :: [*]) a. EraIndexed xs a -> a
forgetEraIndex
  fromMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
proxy (ShelleyBlock proto MaryEra)
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto MaryEra)
-> EpochToPerasRoundInfo
fromMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto MaryEra)
_ = EpochToPerasRoundInfo -> EpochToPerasRoundInfo
MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto MaryEra)
-> EpochToPerasRoundInfo
forall a. a -> a
id
  mkBoundedPerasEpochContext :: forall (ledgerState :: MapKind -> *) chainDepState.
(LedgerStateSupportsPeras ledgerState,
 ChainDepStateSupportsPeras chainDepState) =>
MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto MaryEra)
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (BoundedPerasEpochContext (ShelleyBlock proto MaryEra))
mkBoundedPerasEpochContext = [Char]
-> EpochToPerasRoundInfo
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (VoidPerasError (ShelleyBlock proto MaryEra))
     (BoundedPerasEpochContext (ShelleyBlock proto MaryEra))
forall a. HasCallStack => [Char] -> a
error [Char]
"mkBoundedPerasEpochContext: MaryEra does not support Peras"

instance
  ( Typeable proto
  , ChainDepStateSupportsPeras (ChainDepState proto)
  , ChainDepStateSupportsPeras (Ticked (ChainDepState proto))
  ) =>
  StateSupportsPerasEpochContext (ShelleyBlock proto AlonzoEra)
  where
  type
    MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto AlonzoEra) =
      EpochToPerasRoundInfo
  toMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
All Top (HardForkIndices (ShelleyBlock proto AlonzoEra)) =>
proxy (ShelleyBlock proto AlonzoEra)
-> EraIndexed
     (HardForkIndices (ShelleyBlock proto AlonzoEra))
     EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto AlonzoEra)
toMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto AlonzoEra)
_ = EraIndexed '[ShelleyBlock proto AlonzoEra] EpochToPerasRoundInfo
-> EpochToPerasRoundInfo
EraIndexed
  (HardForkIndices (ShelleyBlock proto AlonzoEra))
  EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto AlonzoEra)
forall (xs :: [*]) a. EraIndexed xs a -> a
forgetEraIndex
  fromMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
proxy (ShelleyBlock proto AlonzoEra)
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto AlonzoEra)
-> EpochToPerasRoundInfo
fromMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto AlonzoEra)
_ = EpochToPerasRoundInfo -> EpochToPerasRoundInfo
MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto AlonzoEra)
-> EpochToPerasRoundInfo
forall a. a -> a
id
  mkBoundedPerasEpochContext :: forall (ledgerState :: MapKind -> *) chainDepState.
(LedgerStateSupportsPeras ledgerState,
 ChainDepStateSupportsPeras chainDepState) =>
MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto AlonzoEra)
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (BoundedPerasEpochContext (ShelleyBlock proto AlonzoEra))
mkBoundedPerasEpochContext = [Char]
-> EpochToPerasRoundInfo
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (VoidPerasError (ShelleyBlock proto AlonzoEra))
     (BoundedPerasEpochContext (ShelleyBlock proto AlonzoEra))
forall a. HasCallStack => [Char] -> a
error [Char]
"mkBoundedPerasEpochContext: AlonzoEra does not support Peras"

instance
  ( Typeable proto
  , ChainDepStateSupportsPeras (ChainDepState proto)
  , ChainDepStateSupportsPeras (Ticked (ChainDepState proto))
  ) =>
  StateSupportsPerasEpochContext (ShelleyBlock proto BabbageEra)
  where
  type
    MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto BabbageEra) =
      EpochToPerasRoundInfo
  toMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
All Top (HardForkIndices (ShelleyBlock proto BabbageEra)) =>
proxy (ShelleyBlock proto BabbageEra)
-> EraIndexed
     (HardForkIndices (ShelleyBlock proto BabbageEra))
     EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto BabbageEra)
toMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto BabbageEra)
_ = EraIndexed '[ShelleyBlock proto BabbageEra] EpochToPerasRoundInfo
-> EpochToPerasRoundInfo
EraIndexed
  (HardForkIndices (ShelleyBlock proto BabbageEra))
  EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto BabbageEra)
forall (xs :: [*]) a. EraIndexed xs a -> a
forgetEraIndex
  fromMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
proxy (ShelleyBlock proto BabbageEra)
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto BabbageEra)
-> EpochToPerasRoundInfo
fromMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto BabbageEra)
_ = EpochToPerasRoundInfo -> EpochToPerasRoundInfo
MaybeEraIndexedEpochToPerasRoundInfo
  (ShelleyBlock proto BabbageEra)
-> EpochToPerasRoundInfo
forall a. a -> a
id
  mkBoundedPerasEpochContext :: forall (ledgerState :: MapKind -> *) chainDepState.
(LedgerStateSupportsPeras ledgerState,
 ChainDepStateSupportsPeras chainDepState) =>
MaybeEraIndexedEpochToPerasRoundInfo
  (ShelleyBlock proto BabbageEra)
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (BoundedPerasEpochContext (ShelleyBlock proto BabbageEra))
mkBoundedPerasEpochContext = [Char]
-> EpochToPerasRoundInfo
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (VoidPerasError (ShelleyBlock proto BabbageEra))
     (BoundedPerasEpochContext (ShelleyBlock proto BabbageEra))
forall a. HasCallStack => [Char] -> a
error [Char]
"mkBoundedPerasEpochContext: BabbageEra does not support Peras"

instance
  ( Typeable proto
  , ChainDepStateSupportsPeras (ChainDepState proto)
  , ChainDepStateSupportsPeras (Ticked (ChainDepState proto))
  ) =>
  StateSupportsPerasEpochContext (ShelleyBlock proto ConwayEra)
  where
  type
    MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto ConwayEra) =
      EpochToPerasRoundInfo
  toMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
All Top (HardForkIndices (ShelleyBlock proto ConwayEra)) =>
proxy (ShelleyBlock proto ConwayEra)
-> EraIndexed
     (HardForkIndices (ShelleyBlock proto ConwayEra))
     EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto ConwayEra)
toMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto ConwayEra)
_ = EraIndexed '[ShelleyBlock proto ConwayEra] EpochToPerasRoundInfo
-> EpochToPerasRoundInfo
EraIndexed
  (HardForkIndices (ShelleyBlock proto ConwayEra))
  EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto ConwayEra)
forall (xs :: [*]) a. EraIndexed xs a -> a
forgetEraIndex
  fromMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
proxy (ShelleyBlock proto ConwayEra)
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto ConwayEra)
-> EpochToPerasRoundInfo
fromMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto ConwayEra)
_ = EpochToPerasRoundInfo -> EpochToPerasRoundInfo
MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto ConwayEra)
-> EpochToPerasRoundInfo
forall a. a -> a
id
  mkBoundedPerasEpochContext :: forall (ledgerState :: MapKind -> *) chainDepState.
(LedgerStateSupportsPeras ledgerState,
 ChainDepStateSupportsPeras chainDepState) =>
MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto ConwayEra)
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (BoundedPerasEpochContext (ShelleyBlock proto ConwayEra))
mkBoundedPerasEpochContext = [Char]
-> EpochToPerasRoundInfo
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (VoidPerasError (ShelleyBlock proto ConwayEra))
     (BoundedPerasEpochContext (ShelleyBlock proto ConwayEra))
forall a. HasCallStack => [Char] -> a
error [Char]
"mkBoundedPerasEpochContext: ConwayEra does not support Peras"

instance
  ( Typeable proto
  , ChainDepStateSupportsPeras (ChainDepState proto)
  , ChainDepStateSupportsPeras (Ticked (ChainDepState proto))
  ) =>
  StateSupportsPerasEpochContext (ShelleyBlock proto DijkstraEra)
  where
  type
    MaybeEraIndexedEpochToPerasRoundInfo (ShelleyBlock proto DijkstraEra) =
      EpochToPerasRoundInfo
  toMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
All Top (HardForkIndices (ShelleyBlock proto DijkstraEra)) =>
proxy (ShelleyBlock proto DijkstraEra)
-> EraIndexed
     (HardForkIndices (ShelleyBlock proto DijkstraEra))
     EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto DijkstraEra)
toMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto DijkstraEra)
_ = EraIndexed '[ShelleyBlock proto DijkstraEra] EpochToPerasRoundInfo
-> EpochToPerasRoundInfo
EraIndexed
  (HardForkIndices (ShelleyBlock proto DijkstraEra))
  EpochToPerasRoundInfo
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto DijkstraEra)
forall (xs :: [*]) a. EraIndexed xs a -> a
forgetEraIndex
  fromMaybeEraIndexedEpochToPerasRoundInfo :: forall (proxy :: * -> *).
proxy (ShelleyBlock proto DijkstraEra)
-> MaybeEraIndexedEpochToPerasRoundInfo
     (ShelleyBlock proto DijkstraEra)
-> EpochToPerasRoundInfo
fromMaybeEraIndexedEpochToPerasRoundInfo proxy (ShelleyBlock proto DijkstraEra)
_ = EpochToPerasRoundInfo -> EpochToPerasRoundInfo
MaybeEraIndexedEpochToPerasRoundInfo
  (ShelleyBlock proto DijkstraEra)
-> EpochToPerasRoundInfo
forall a. a -> a
id
  mkBoundedPerasEpochContext :: forall (ledgerState :: MapKind -> *) chainDepState.
(LedgerStateSupportsPeras ledgerState,
 ChainDepStateSupportsPeras chainDepState) =>
MaybeEraIndexedEpochToPerasRoundInfo
  (ShelleyBlock proto DijkstraEra)
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (BoundedPerasEpochContext (ShelleyBlock proto DijkstraEra))
mkBoundedPerasEpochContext = [Char]
-> EpochToPerasRoundInfo
-> ledgerState EmptyMK
-> chainDepState
-> Either
     (VoidPerasError (ShelleyBlock proto DijkstraEra))
     (BoundedPerasEpochContext (ShelleyBlock proto DijkstraEra))
forall a. HasCallStack => [Char] -> a
error [Char]
"mkBoundedPerasEpochContext: DijkstraEra does not support Peras (yet)"

{-------------------------------------------------------------------------------
  BlockSupportsPeras
-------------------------------------------------------------------------------}

instance Typeable proto => BlockSupportsPeras (ShelleyBlock proto ShelleyEra) where
  type PerasVote (ShelleyBlock proto ShelleyEra) = VoidPerasVote (ShelleyBlock proto ShelleyEra)
  type PerasCert (ShelleyBlock proto ShelleyEra) = VoidPerasCert (ShelleyBlock proto ShelleyEra)
  type PerasError (ShelleyBlock proto ShelleyEra) = VoidPerasError (ShelleyBlock proto ShelleyEra)
  type PerasCrypto (ShelleyBlock proto ShelleyEra) = VoidPerasCrypto (ShelleyBlock proto ShelleyEra)
  type PerasVotingCommitteeScheme (ShelleyBlock proto ShelleyEra) = VoidPerasVotingCommitteeScheme
  forgePerasVoteIfEligible :: PerasEpochContext (ShelleyBlock proto ShelleyEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto ShelleyEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto ShelleyEra)
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto ShelleyEra)))
forgePerasVoteIfEligible = PerasEpochContext (ShelleyBlock proto ShelleyEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto ShelleyEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto ShelleyEra)
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto ShelleyEra)))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PoolId
-> PrivateKey (PerasCrypto blk)
-> PerasRoundNo
-> Point blk
-> Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
defaultForgePerasVoteIfEligible
  verifyPerasVote :: PerasEpochContext (ShelleyBlock proto ShelleyEra)
-> PerasVote (ShelleyBlock proto ShelleyEra)
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (ValidatedPerasVote (ShelleyBlock proto ShelleyEra))
verifyPerasVote = PerasEpochContext (ShelleyBlock proto ShelleyEra)
-> PerasVote (ShelleyBlock proto ShelleyEra)
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (ValidatedPerasVote (ShelleyBlock proto ShelleyEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVote blk
-> Either (PerasError blk) (ValidatedPerasVote blk)
defaultVerifyPerasVote
  forgePerasCert :: PerasEpochContext (ShelleyBlock proto ShelleyEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto ShelleyEra)
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (ValidatedPerasCert (ShelleyBlock proto ShelleyEra))
forgePerasCert = PerasEpochContext (ShelleyBlock proto ShelleyEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto ShelleyEra)
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (ValidatedPerasCert (ShelleyBlock proto ShelleyEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVoteCollectionWithQuorum blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultForgePerasCert
  verifyPerasCert :: PerasEpochContext (ShelleyBlock proto ShelleyEra)
-> PerasCert (ShelleyBlock proto ShelleyEra)
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (ValidatedPerasCert (ShelleyBlock proto ShelleyEra))
verifyPerasCert = PerasEpochContext (ShelleyBlock proto ShelleyEra)
-> PerasCert (ShelleyBlock proto ShelleyEra)
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (ValidatedPerasCert (ShelleyBlock proto ShelleyEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasCert blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultVerifyPerasCert
  getPerasCertInBlock :: ShelleyBlock proto ShelleyEra
-> Either
     (PerasError (ShelleyBlock proto ShelleyEra))
     (Maybe (PerasCert (ShelleyBlock proto ShelleyEra)))
getPerasCertInBlock ShelleyBlock proto ShelleyEra
_ = Maybe (VoidPerasCert (ShelleyBlock proto ShelleyEra))
-> Either
     (VoidPerasError (ShelleyBlock proto ShelleyEra))
     (Maybe (VoidPerasCert (ShelleyBlock proto ShelleyEra)))
forall a b. b -> Either a b
Right Maybe (VoidPerasCert (ShelleyBlock proto ShelleyEra))
forall a. Maybe a
Nothing

instance Typeable proto => BlockSupportsPeras (ShelleyBlock proto AllegraEra) where
  type PerasVote (ShelleyBlock proto AllegraEra) = VoidPerasVote (ShelleyBlock proto AllegraEra)
  type PerasCert (ShelleyBlock proto AllegraEra) = VoidPerasCert (ShelleyBlock proto AllegraEra)
  type PerasError (ShelleyBlock proto AllegraEra) = VoidPerasError (ShelleyBlock proto AllegraEra)
  type PerasCrypto (ShelleyBlock proto AllegraEra) = VoidPerasCrypto (ShelleyBlock proto AllegraEra)
  type PerasVotingCommitteeScheme (ShelleyBlock proto AllegraEra) = VoidPerasVotingCommitteeScheme
  forgePerasVoteIfEligible :: PerasEpochContext (ShelleyBlock proto AllegraEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto AllegraEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto AllegraEra)
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto AllegraEra)))
forgePerasVoteIfEligible = PerasEpochContext (ShelleyBlock proto AllegraEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto AllegraEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto AllegraEra)
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto AllegraEra)))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PoolId
-> PrivateKey (PerasCrypto blk)
-> PerasRoundNo
-> Point blk
-> Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
defaultForgePerasVoteIfEligible
  verifyPerasVote :: PerasEpochContext (ShelleyBlock proto AllegraEra)
-> PerasVote (ShelleyBlock proto AllegraEra)
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (ValidatedPerasVote (ShelleyBlock proto AllegraEra))
verifyPerasVote = PerasEpochContext (ShelleyBlock proto AllegraEra)
-> PerasVote (ShelleyBlock proto AllegraEra)
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (ValidatedPerasVote (ShelleyBlock proto AllegraEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVote blk
-> Either (PerasError blk) (ValidatedPerasVote blk)
defaultVerifyPerasVote
  forgePerasCert :: PerasEpochContext (ShelleyBlock proto AllegraEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto AllegraEra)
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (ValidatedPerasCert (ShelleyBlock proto AllegraEra))
forgePerasCert = PerasEpochContext (ShelleyBlock proto AllegraEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto AllegraEra)
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (ValidatedPerasCert (ShelleyBlock proto AllegraEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVoteCollectionWithQuorum blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultForgePerasCert
  verifyPerasCert :: PerasEpochContext (ShelleyBlock proto AllegraEra)
-> PerasCert (ShelleyBlock proto AllegraEra)
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (ValidatedPerasCert (ShelleyBlock proto AllegraEra))
verifyPerasCert = PerasEpochContext (ShelleyBlock proto AllegraEra)
-> PerasCert (ShelleyBlock proto AllegraEra)
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (ValidatedPerasCert (ShelleyBlock proto AllegraEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasCert blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultVerifyPerasCert
  getPerasCertInBlock :: ShelleyBlock proto AllegraEra
-> Either
     (PerasError (ShelleyBlock proto AllegraEra))
     (Maybe (PerasCert (ShelleyBlock proto AllegraEra)))
getPerasCertInBlock ShelleyBlock proto AllegraEra
_ = Maybe (VoidPerasCert (ShelleyBlock proto AllegraEra))
-> Either
     (VoidPerasError (ShelleyBlock proto AllegraEra))
     (Maybe (VoidPerasCert (ShelleyBlock proto AllegraEra)))
forall a b. b -> Either a b
Right Maybe (VoidPerasCert (ShelleyBlock proto AllegraEra))
forall a. Maybe a
Nothing

instance Typeable proto => BlockSupportsPeras (ShelleyBlock proto MaryEra) where
  type PerasVote (ShelleyBlock proto MaryEra) = VoidPerasVote (ShelleyBlock proto MaryEra)
  type PerasCert (ShelleyBlock proto MaryEra) = VoidPerasCert (ShelleyBlock proto MaryEra)
  type PerasError (ShelleyBlock proto MaryEra) = VoidPerasError (ShelleyBlock proto MaryEra)
  type PerasCrypto (ShelleyBlock proto MaryEra) = VoidPerasCrypto (ShelleyBlock proto MaryEra)
  type PerasVotingCommitteeScheme (ShelleyBlock proto MaryEra) = VoidPerasVotingCommitteeScheme
  forgePerasVoteIfEligible :: PerasEpochContext (ShelleyBlock proto MaryEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto MaryEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto MaryEra)
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto MaryEra)))
forgePerasVoteIfEligible = PerasEpochContext (ShelleyBlock proto MaryEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto MaryEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto MaryEra)
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto MaryEra)))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PoolId
-> PrivateKey (PerasCrypto blk)
-> PerasRoundNo
-> Point blk
-> Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
defaultForgePerasVoteIfEligible
  verifyPerasVote :: PerasEpochContext (ShelleyBlock proto MaryEra)
-> PerasVote (ShelleyBlock proto MaryEra)
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (ValidatedPerasVote (ShelleyBlock proto MaryEra))
verifyPerasVote = PerasEpochContext (ShelleyBlock proto MaryEra)
-> PerasVote (ShelleyBlock proto MaryEra)
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (ValidatedPerasVote (ShelleyBlock proto MaryEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVote blk
-> Either (PerasError blk) (ValidatedPerasVote blk)
defaultVerifyPerasVote
  forgePerasCert :: PerasEpochContext (ShelleyBlock proto MaryEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto MaryEra)
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (ValidatedPerasCert (ShelleyBlock proto MaryEra))
forgePerasCert = PerasEpochContext (ShelleyBlock proto MaryEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto MaryEra)
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (ValidatedPerasCert (ShelleyBlock proto MaryEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVoteCollectionWithQuorum blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultForgePerasCert
  verifyPerasCert :: PerasEpochContext (ShelleyBlock proto MaryEra)
-> PerasCert (ShelleyBlock proto MaryEra)
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (ValidatedPerasCert (ShelleyBlock proto MaryEra))
verifyPerasCert = PerasEpochContext (ShelleyBlock proto MaryEra)
-> PerasCert (ShelleyBlock proto MaryEra)
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (ValidatedPerasCert (ShelleyBlock proto MaryEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasCert blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultVerifyPerasCert
  getPerasCertInBlock :: ShelleyBlock proto MaryEra
-> Either
     (PerasError (ShelleyBlock proto MaryEra))
     (Maybe (PerasCert (ShelleyBlock proto MaryEra)))
getPerasCertInBlock ShelleyBlock proto MaryEra
_ = Maybe (VoidPerasCert (ShelleyBlock proto MaryEra))
-> Either
     (VoidPerasError (ShelleyBlock proto MaryEra))
     (Maybe (VoidPerasCert (ShelleyBlock proto MaryEra)))
forall a b. b -> Either a b
Right Maybe (VoidPerasCert (ShelleyBlock proto MaryEra))
forall a. Maybe a
Nothing

instance Typeable proto => BlockSupportsPeras (ShelleyBlock proto AlonzoEra) where
  type PerasVote (ShelleyBlock proto AlonzoEra) = VoidPerasVote (ShelleyBlock proto AlonzoEra)
  type PerasCert (ShelleyBlock proto AlonzoEra) = VoidPerasCert (ShelleyBlock proto AlonzoEra)
  type PerasError (ShelleyBlock proto AlonzoEra) = VoidPerasError (ShelleyBlock proto AlonzoEra)
  type PerasCrypto (ShelleyBlock proto AlonzoEra) = VoidPerasCrypto (ShelleyBlock proto AlonzoEra)
  type PerasVotingCommitteeScheme (ShelleyBlock proto AlonzoEra) = VoidPerasVotingCommitteeScheme
  forgePerasVoteIfEligible :: PerasEpochContext (ShelleyBlock proto AlonzoEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto AlonzoEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto AlonzoEra)
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto AlonzoEra)))
forgePerasVoteIfEligible = PerasEpochContext (ShelleyBlock proto AlonzoEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto AlonzoEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto AlonzoEra)
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto AlonzoEra)))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PoolId
-> PrivateKey (PerasCrypto blk)
-> PerasRoundNo
-> Point blk
-> Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
defaultForgePerasVoteIfEligible
  verifyPerasVote :: PerasEpochContext (ShelleyBlock proto AlonzoEra)
-> PerasVote (ShelleyBlock proto AlonzoEra)
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (ValidatedPerasVote (ShelleyBlock proto AlonzoEra))
verifyPerasVote = PerasEpochContext (ShelleyBlock proto AlonzoEra)
-> PerasVote (ShelleyBlock proto AlonzoEra)
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (ValidatedPerasVote (ShelleyBlock proto AlonzoEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVote blk
-> Either (PerasError blk) (ValidatedPerasVote blk)
defaultVerifyPerasVote
  forgePerasCert :: PerasEpochContext (ShelleyBlock proto AlonzoEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto AlonzoEra)
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (ValidatedPerasCert (ShelleyBlock proto AlonzoEra))
forgePerasCert = PerasEpochContext (ShelleyBlock proto AlonzoEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto AlonzoEra)
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (ValidatedPerasCert (ShelleyBlock proto AlonzoEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVoteCollectionWithQuorum blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultForgePerasCert
  verifyPerasCert :: PerasEpochContext (ShelleyBlock proto AlonzoEra)
-> PerasCert (ShelleyBlock proto AlonzoEra)
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (ValidatedPerasCert (ShelleyBlock proto AlonzoEra))
verifyPerasCert = PerasEpochContext (ShelleyBlock proto AlonzoEra)
-> PerasCert (ShelleyBlock proto AlonzoEra)
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (ValidatedPerasCert (ShelleyBlock proto AlonzoEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasCert blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultVerifyPerasCert
  getPerasCertInBlock :: ShelleyBlock proto AlonzoEra
-> Either
     (PerasError (ShelleyBlock proto AlonzoEra))
     (Maybe (PerasCert (ShelleyBlock proto AlonzoEra)))
getPerasCertInBlock ShelleyBlock proto AlonzoEra
_ = Maybe (VoidPerasCert (ShelleyBlock proto AlonzoEra))
-> Either
     (VoidPerasError (ShelleyBlock proto AlonzoEra))
     (Maybe (VoidPerasCert (ShelleyBlock proto AlonzoEra)))
forall a b. b -> Either a b
Right Maybe (VoidPerasCert (ShelleyBlock proto AlonzoEra))
forall a. Maybe a
Nothing

instance Typeable proto => BlockSupportsPeras (ShelleyBlock proto BabbageEra) where
  type PerasVote (ShelleyBlock proto BabbageEra) = VoidPerasVote (ShelleyBlock proto BabbageEra)
  type PerasCert (ShelleyBlock proto BabbageEra) = VoidPerasCert (ShelleyBlock proto BabbageEra)
  type PerasError (ShelleyBlock proto BabbageEra) = VoidPerasError (ShelleyBlock proto BabbageEra)
  type PerasCrypto (ShelleyBlock proto BabbageEra) = VoidPerasCrypto (ShelleyBlock proto BabbageEra)
  type PerasVotingCommitteeScheme (ShelleyBlock proto BabbageEra) = VoidPerasVotingCommitteeScheme
  forgePerasVoteIfEligible :: PerasEpochContext (ShelleyBlock proto BabbageEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto BabbageEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto BabbageEra)
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto BabbageEra)))
forgePerasVoteIfEligible = PerasEpochContext (ShelleyBlock proto BabbageEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto BabbageEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto BabbageEra)
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto BabbageEra)))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PoolId
-> PrivateKey (PerasCrypto blk)
-> PerasRoundNo
-> Point blk
-> Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
defaultForgePerasVoteIfEligible
  verifyPerasVote :: PerasEpochContext (ShelleyBlock proto BabbageEra)
-> PerasVote (ShelleyBlock proto BabbageEra)
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (ValidatedPerasVote (ShelleyBlock proto BabbageEra))
verifyPerasVote = PerasEpochContext (ShelleyBlock proto BabbageEra)
-> PerasVote (ShelleyBlock proto BabbageEra)
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (ValidatedPerasVote (ShelleyBlock proto BabbageEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVote blk
-> Either (PerasError blk) (ValidatedPerasVote blk)
defaultVerifyPerasVote
  forgePerasCert :: PerasEpochContext (ShelleyBlock proto BabbageEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto BabbageEra)
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (ValidatedPerasCert (ShelleyBlock proto BabbageEra))
forgePerasCert = PerasEpochContext (ShelleyBlock proto BabbageEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto BabbageEra)
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (ValidatedPerasCert (ShelleyBlock proto BabbageEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVoteCollectionWithQuorum blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultForgePerasCert
  verifyPerasCert :: PerasEpochContext (ShelleyBlock proto BabbageEra)
-> PerasCert (ShelleyBlock proto BabbageEra)
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (ValidatedPerasCert (ShelleyBlock proto BabbageEra))
verifyPerasCert = PerasEpochContext (ShelleyBlock proto BabbageEra)
-> PerasCert (ShelleyBlock proto BabbageEra)
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (ValidatedPerasCert (ShelleyBlock proto BabbageEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasCert blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultVerifyPerasCert
  getPerasCertInBlock :: ShelleyBlock proto BabbageEra
-> Either
     (PerasError (ShelleyBlock proto BabbageEra))
     (Maybe (PerasCert (ShelleyBlock proto BabbageEra)))
getPerasCertInBlock ShelleyBlock proto BabbageEra
_ = Maybe (VoidPerasCert (ShelleyBlock proto BabbageEra))
-> Either
     (VoidPerasError (ShelleyBlock proto BabbageEra))
     (Maybe (VoidPerasCert (ShelleyBlock proto BabbageEra)))
forall a b. b -> Either a b
Right Maybe (VoidPerasCert (ShelleyBlock proto BabbageEra))
forall a. Maybe a
Nothing

instance Typeable proto => BlockSupportsPeras (ShelleyBlock proto ConwayEra) where
  type PerasVote (ShelleyBlock proto ConwayEra) = VoidPerasVote (ShelleyBlock proto ConwayEra)
  type PerasCert (ShelleyBlock proto ConwayEra) = VoidPerasCert (ShelleyBlock proto ConwayEra)
  type PerasError (ShelleyBlock proto ConwayEra) = VoidPerasError (ShelleyBlock proto ConwayEra)
  type PerasCrypto (ShelleyBlock proto ConwayEra) = VoidPerasCrypto (ShelleyBlock proto ConwayEra)
  type PerasVotingCommitteeScheme (ShelleyBlock proto ConwayEra) = VoidPerasVotingCommitteeScheme
  forgePerasVoteIfEligible :: PerasEpochContext (ShelleyBlock proto ConwayEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto ConwayEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto ConwayEra)
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto ConwayEra)))
forgePerasVoteIfEligible = PerasEpochContext (ShelleyBlock proto ConwayEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto ConwayEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto ConwayEra)
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto ConwayEra)))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PoolId
-> PrivateKey (PerasCrypto blk)
-> PerasRoundNo
-> Point blk
-> Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
defaultForgePerasVoteIfEligible
  verifyPerasVote :: PerasEpochContext (ShelleyBlock proto ConwayEra)
-> PerasVote (ShelleyBlock proto ConwayEra)
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (ValidatedPerasVote (ShelleyBlock proto ConwayEra))
verifyPerasVote = PerasEpochContext (ShelleyBlock proto ConwayEra)
-> PerasVote (ShelleyBlock proto ConwayEra)
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (ValidatedPerasVote (ShelleyBlock proto ConwayEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVote blk
-> Either (PerasError blk) (ValidatedPerasVote blk)
defaultVerifyPerasVote
  forgePerasCert :: PerasEpochContext (ShelleyBlock proto ConwayEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto ConwayEra)
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (ValidatedPerasCert (ShelleyBlock proto ConwayEra))
forgePerasCert = PerasEpochContext (ShelleyBlock proto ConwayEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto ConwayEra)
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (ValidatedPerasCert (ShelleyBlock proto ConwayEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVoteCollectionWithQuorum blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultForgePerasCert
  verifyPerasCert :: PerasEpochContext (ShelleyBlock proto ConwayEra)
-> PerasCert (ShelleyBlock proto ConwayEra)
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (ValidatedPerasCert (ShelleyBlock proto ConwayEra))
verifyPerasCert = PerasEpochContext (ShelleyBlock proto ConwayEra)
-> PerasCert (ShelleyBlock proto ConwayEra)
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (ValidatedPerasCert (ShelleyBlock proto ConwayEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasCert blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultVerifyPerasCert
  getPerasCertInBlock :: ShelleyBlock proto ConwayEra
-> Either
     (PerasError (ShelleyBlock proto ConwayEra))
     (Maybe (PerasCert (ShelleyBlock proto ConwayEra)))
getPerasCertInBlock ShelleyBlock proto ConwayEra
_ = Maybe (VoidPerasCert (ShelleyBlock proto ConwayEra))
-> Either
     (VoidPerasError (ShelleyBlock proto ConwayEra))
     (Maybe (VoidPerasCert (ShelleyBlock proto ConwayEra)))
forall a b. b -> Either a b
Right Maybe (VoidPerasCert (ShelleyBlock proto ConwayEra))
forall a. Maybe a
Nothing

-- NOTE: temporarily wired to the void implementation until we land some of the
-- machinery needed to use production types (and which conflicted with the
-- degenerate 'BlockSupportsPeras' instance).
instance Typeable proto => BlockSupportsPeras (ShelleyBlock proto DijkstraEra) where
  type PerasVote (ShelleyBlock proto DijkstraEra) = VoidPerasVote (ShelleyBlock proto DijkstraEra)
  type PerasCert (ShelleyBlock proto DijkstraEra) = VoidPerasCert (ShelleyBlock proto DijkstraEra)
  type PerasError (ShelleyBlock proto DijkstraEra) = VoidPerasError (ShelleyBlock proto DijkstraEra)
  type PerasCrypto (ShelleyBlock proto DijkstraEra) = VoidPerasCrypto (ShelleyBlock proto DijkstraEra)
  type PerasVotingCommitteeScheme (ShelleyBlock proto DijkstraEra) = VoidPerasVotingCommitteeScheme
  forgePerasVoteIfEligible :: PerasEpochContext (ShelleyBlock proto DijkstraEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto DijkstraEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto DijkstraEra)
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto DijkstraEra)))
forgePerasVoteIfEligible = PerasEpochContext (ShelleyBlock proto DijkstraEra)
-> PoolId
-> PrivateKey (PerasCrypto (ShelleyBlock proto DijkstraEra))
-> PerasRoundNo
-> Point (ShelleyBlock proto DijkstraEra)
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (Maybe (ValidatedPerasVote (ShelleyBlock proto DijkstraEra)))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PoolId
-> PrivateKey (PerasCrypto blk)
-> PerasRoundNo
-> Point blk
-> Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
defaultForgePerasVoteIfEligible
  verifyPerasVote :: PerasEpochContext (ShelleyBlock proto DijkstraEra)
-> PerasVote (ShelleyBlock proto DijkstraEra)
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (ValidatedPerasVote (ShelleyBlock proto DijkstraEra))
verifyPerasVote = PerasEpochContext (ShelleyBlock proto DijkstraEra)
-> PerasVote (ShelleyBlock proto DijkstraEra)
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (ValidatedPerasVote (ShelleyBlock proto DijkstraEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVote blk
-> Either (PerasError blk) (ValidatedPerasVote blk)
defaultVerifyPerasVote
  forgePerasCert :: PerasEpochContext (ShelleyBlock proto DijkstraEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto DijkstraEra)
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (ValidatedPerasCert (ShelleyBlock proto DijkstraEra))
forgePerasCert = PerasEpochContext (ShelleyBlock proto DijkstraEra)
-> PerasVoteCollectionWithQuorum (ShelleyBlock proto DijkstraEra)
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (ValidatedPerasCert (ShelleyBlock proto DijkstraEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasVoteCompatibleWithVotingCommittee
   (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasVoteCollectionWithQuorum blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultForgePerasCert
  verifyPerasCert :: PerasEpochContext (ShelleyBlock proto DijkstraEra)
-> PerasCert (ShelleyBlock proto DijkstraEra)
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (ValidatedPerasCert (ShelleyBlock proto DijkstraEra))
verifyPerasCert = PerasEpochContext (ShelleyBlock proto DijkstraEra)
-> PerasCert (ShelleyBlock proto DijkstraEra)
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (ValidatedPerasCert (ShelleyBlock proto DijkstraEra))
forall blk.
(BlockSupportsPeras blk,
 CryptoSupportsVotingCommittee
   (PerasCrypto blk) (PerasVotingCommitteeScheme blk),
 PerasCertCompatibleWithVotingCommittee
   (PerasCert blk)
   (PerasCrypto blk)
   (PerasVotingCommitteeScheme blk)) =>
PerasEpochContext blk
-> PerasCert blk
-> Either (PerasError blk) (ValidatedPerasCert blk)
defaultVerifyPerasCert
  getPerasCertInBlock :: ShelleyBlock proto DijkstraEra
-> Either
     (PerasError (ShelleyBlock proto DijkstraEra))
     (Maybe (PerasCert (ShelleyBlock proto DijkstraEra)))
getPerasCertInBlock ShelleyBlock proto DijkstraEra
_ = Maybe (VoidPerasCert (ShelleyBlock proto DijkstraEra))
-> Either
     (VoidPerasError (ShelleyBlock proto DijkstraEra))
     (Maybe (VoidPerasCert (ShelleyBlock proto DijkstraEra)))
forall a b. b -> Either a b
Right Maybe (VoidPerasCert (ShelleyBlock proto DijkstraEra))
forall a. Maybe a
Nothing