{-# LANGUAGE DataKinds #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Test.Cardano.Ledger.Conformance.Imp.Ratify (spec) where

import Cardano.Ledger.BaseTypes (EpochInterval (..), StrictMaybe (..), addEpochInterval)
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Conway (ConwayEra)
import Cardano.Ledger.Conway.Core
import Cardano.Ledger.Conway.Governance (
  Committee (..),
  GovAction (..),
  GovPurposeId (..),
  RatifySignal (..),
  Voter (..),
  committeeGovStateL,
  getRatifyState,
 )
import Cardano.Ledger.Conway.PParams (
  dvtMotionNoConfidenceL,
  pvtMotionNoConfidenceL,
 )
import Cardano.Ledger.Conway.State
import Cardano.Ledger.Credential (Credential (..))
import Cardano.Ledger.Shelley.LedgerState (
  epochStateGovStateL,
  nesELL,
  nesEsL,
 )
import Data.Bifunctor (Bifunctor (..))
import qualified Data.List.NonEmpty as NE
import qualified Data.Map as Map
import qualified Data.Sequence.Strict as SSeq
import Lens.Micro ((&), (.~))
import Lens.Micro.Mtl (use)
import Test.Cardano.Ledger.Conformance (showOpaqueErrorString)
import Test.Cardano.Ledger.Conformance.ExecSpecRule.Conway (
  ConwayRatifyExecContext (..),
 )
import Test.Cardano.Ledger.Conformance.ExecSpecRule.Core (ExecSpecRule (..), runConformance)
import Test.Cardano.Ledger.Conway.ImpTest
import Test.Cardano.Ledger.Core.Rational (IsRatio (..))
import Test.Cardano.Ledger.Imp.Common

spec :: Spec
spec :: Spec
spec = forall t. ImpSpec t => SpecWith (ImpInit t) -> Spec
withImpInit @(LedgerSpec ConwayEra) (SpecWith (ImpInit (LedgerSpec ConwayEra)) -> Spec)
-> SpecWith (ImpInit (LedgerSpec ConwayEra)) -> Spec
forall a b. (a -> b) -> a -> b
$ String
-> SpecWith (ImpInit (LedgerSpec ConwayEra))
-> SpecWith (ImpInit (LedgerSpec ConwayEra))
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"RATIFY" (SpecWith (ImpInit (LedgerSpec ConwayEra))
 -> SpecWith (ImpInit (LedgerSpec ConwayEra)))
-> SpecWith (ImpInit (LedgerSpec ConwayEra))
-> SpecWith (ImpInit (LedgerSpec ConwayEra))
forall a b. (a -> b) -> a -> b
$ Version
-> SpecWith (ImpInit (LedgerSpec ConwayEra))
-> SpecWith (ImpInit (LedgerSpec ConwayEra))
forall era.
ShelleyEraImp era =>
Version
-> SpecWith (ImpInit (LedgerSpec era))
-> SpecWith (ImpInit (LedgerSpec era))
modifyImpInitProtVer (forall era. Era era => Version
eraProtVerHigh @ConwayEra) (SpecWith (ImpInit (LedgerSpec ConwayEra))
 -> SpecWith (ImpInit (LedgerSpec ConwayEra)))
-> SpecWith (ImpInit (LedgerSpec ConwayEra))
-> SpecWith (ImpInit (LedgerSpec ConwayEra))
forall a b. (a -> b) -> a -> b
$ do
  String
-> ImpM (LedgerSpec ConwayEra) Property
-> SpecWith (Arg (ImpM (LedgerSpec ConwayEra) Property))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"NoConfidence accepted conforms" (ImpM (LedgerSpec ConwayEra) Property
 -> SpecWith (Arg (ImpM (LedgerSpec ConwayEra) Property)))
-> ImpM (LedgerSpec ConwayEra) Property
-> SpecWith (Arg (ImpM (LedgerSpec ConwayEra) Property))
forall a b. (a -> b) -> a -> b
$ do
    (PParams ConwayEra -> PParams ConwayEra)
-> ImpM (LedgerSpec ConwayEra) ()
forall era.
ShelleyEraImp era =>
(PParams era -> PParams era) -> ImpTestM era ()
modifyPParams ((PParams ConwayEra -> PParams ConwayEra)
 -> ImpM (LedgerSpec ConwayEra) ())
-> (PParams ConwayEra -> PParams ConwayEra)
-> ImpM (LedgerSpec ConwayEra) ()
forall a b. (a -> b) -> a -> b
$ \PParams ConwayEra
pp ->
      PParams ConwayEra
pp
        PParams ConwayEra
-> (PParams ConwayEra -> PParams ConwayEra) -> PParams ConwayEra
forall a b. a -> (a -> b) -> b
& (DRepVotingThresholds -> Identity DRepVotingThresholds)
-> PParams ConwayEra -> Identity (PParams ConwayEra)
forall era.
ConwayEraPParams era =>
Lens' (PParams era) DRepVotingThresholds
Lens' (PParams ConwayEra) DRepVotingThresholds
ppDRepVotingThresholdsL ((DRepVotingThresholds -> Identity DRepVotingThresholds)
 -> PParams ConwayEra -> Identity (PParams ConwayEra))
-> ((UnitInterval -> Identity UnitInterval)
    -> DRepVotingThresholds -> Identity DRepVotingThresholds)
-> (UnitInterval -> Identity UnitInterval)
-> PParams ConwayEra
-> Identity (PParams ConwayEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnitInterval -> Identity UnitInterval)
-> DRepVotingThresholds -> Identity DRepVotingThresholds
Lens' DRepVotingThresholds UnitInterval
dvtMotionNoConfidenceL ((UnitInterval -> Identity UnitInterval)
 -> PParams ConwayEra -> Identity (PParams ConwayEra))
-> UnitInterval -> PParams ConwayEra -> PParams ConwayEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Integer
9 Integer -> Integer -> UnitInterval
forall r. (IsRatio r, HasCallStack) => Integer -> Integer -> r
%! Integer
10
        PParams ConwayEra
-> (PParams ConwayEra -> PParams ConwayEra) -> PParams ConwayEra
forall a b. a -> (a -> b) -> b
& (PoolVotingThresholds -> Identity PoolVotingThresholds)
-> PParams ConwayEra -> Identity (PParams ConwayEra)
forall era.
ConwayEraPParams era =>
Lens' (PParams era) PoolVotingThresholds
Lens' (PParams ConwayEra) PoolVotingThresholds
ppPoolVotingThresholdsL ((PoolVotingThresholds -> Identity PoolVotingThresholds)
 -> PParams ConwayEra -> Identity (PParams ConwayEra))
-> ((UnitInterval -> Identity UnitInterval)
    -> PoolVotingThresholds -> Identity PoolVotingThresholds)
-> (UnitInterval -> Identity UnitInterval)
-> PParams ConwayEra
-> Identity (PParams ConwayEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnitInterval -> Identity UnitInterval)
-> PoolVotingThresholds -> Identity PoolVotingThresholds
Lens' PoolVotingThresholds UnitInterval
pvtMotionNoConfidenceL ((UnitInterval -> Identity UnitInterval)
 -> PParams ConwayEra -> Identity (PParams ConwayEra))
-> UnitInterval -> PParams ConwayEra -> PParams ConwayEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Integer
0 Integer -> Integer -> UnitInterval
forall r. (IsRatio r, HasCallStack) => Integer -> Integer -> r
%! Integer
1
    (Credential 'DRepRole
dRep, Credential 'HotCommitteeRole
_, GovPurposeId 'CommitteePurpose ConwayEra
_) <- ImpTestM
  ConwayEra
  (Credential 'DRepRole, Credential 'HotCommitteeRole,
   GovPurposeId 'CommitteePurpose ConwayEra)
forall era.
(HasCallStack, ConwayEraImp era) =>
ImpTestM
  era
  (Credential 'DRepRole, Credential 'HotCommitteeRole,
   GovPurposeId 'CommitteePurpose era)
electBasicCommittee
    StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
lastCommittee <- ImpTestM
  ConwayEra (StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra))
forall era.
ConwayEraGov era =>
ImpTestM era (StrictMaybe (GovPurposeId 'CommitteePurpose era))
getLastEnactedCommittee
    GovActionId
noConfidence <- GovAction ConwayEra -> ImpTestM ConwayEra GovActionId
forall era.
(ShelleyEraImp era, ConwayEraTxBody era, HasCallStack) =>
GovAction era -> ImpTestM era GovActionId
submitGovAction (GovAction ConwayEra -> ImpTestM ConwayEra GovActionId)
-> GovAction ConwayEra -> ImpTestM ConwayEra GovActionId
forall a b. (a -> b) -> a -> b
$ StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
-> GovAction ConwayEra
forall era.
StrictMaybe (GovPurposeId 'CommitteePurpose era) -> GovAction era
NoConfidence StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
lastCommittee
    Voter -> GovActionId -> ImpM (LedgerSpec ConwayEra) ()
forall era.
(ShelleyEraImp era, ConwayEraTxBody era, HasCallStack) =>
Voter -> GovActionId -> ImpTestM era ()
submitYesVote_ (Credential 'DRepRole -> Voter
DRepVoter Credential 'DRepRole
dRep) GovActionId
noConfidence
    RatifyEnv ConwayEra
ratEnv <- ImpTestM ConwayEra (RatifyEnv ConwayEra)
forall era.
(ConwayEraGov era, ConwayEraCertState era) =>
ImpTestM era (RatifyEnv era)
getRatifyEnv
    ConwayGovState ConwayEra
govSt <- SimpleGetter (NewEpochState ConwayEra) (ConwayGovState ConwayEra)
-> ImpTestM ConwayEra (ConwayGovState ConwayEra)
forall era a. SimpleGetter (NewEpochState era) a -> ImpTestM era a
getsNES (SimpleGetter (NewEpochState ConwayEra) (ConwayGovState ConwayEra)
 -> ImpTestM ConwayEra (ConwayGovState ConwayEra))
-> SimpleGetter
     (NewEpochState ConwayEra) (ConwayGovState ConwayEra)
-> ImpTestM ConwayEra (ConwayGovState ConwayEra)
forall a b. (a -> b) -> a -> b
$ (EpochState ConwayEra -> Const r (EpochState ConwayEra))
-> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra)
forall era (f :: * -> *).
Functor f =>
(EpochState era -> f (EpochState era))
-> NewEpochState era -> f (NewEpochState era)
nesEsL ((EpochState ConwayEra -> Const r (EpochState ConwayEra))
 -> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra))
-> ((ConwayGovState ConwayEra
     -> Const r (ConwayGovState ConwayEra))
    -> EpochState ConwayEra -> Const r (EpochState ConwayEra))
-> (ConwayGovState ConwayEra -> Const r (ConwayGovState ConwayEra))
-> NewEpochState ConwayEra
-> Const r (NewEpochState ConwayEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (GovState ConwayEra -> Const r (GovState ConwayEra))
-> EpochState ConwayEra -> Const r (EpochState ConwayEra)
(ConwayGovState ConwayEra -> Const r (ConwayGovState ConwayEra))
-> EpochState ConwayEra -> Const r (EpochState ConwayEra)
forall era (f :: * -> *).
Functor f =>
(GovState era -> f (GovState era))
-> EpochState era -> f (EpochState era)
epochStateGovStateL
    let ratSt :: RatifyState ConwayEra
ratSt = ConwayGovState ConwayEra -> RatifyState ConwayEra
forall era. EraStake era => ConwayGovState era -> RatifyState era
getRatifyState ConwayGovState ConwayEra
govSt
    GovActionState ConwayEra
noConfidenceGAS <- GovActionId -> ImpTestM ConwayEra (GovActionState ConwayEra)
forall era.
(HasCallStack, ConwayEraGov era) =>
GovActionId -> ImpTestM era (GovActionState era)
getGovActionState GovActionId
noConfidence
    Coin
treasury <- SimpleGetter (NewEpochState ConwayEra) Coin
-> ImpTestM ConwayEra Coin
forall era a. SimpleGetter (NewEpochState era) a -> ImpTestM era a
getsNES (Coin -> Const r Coin)
-> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra)
SimpleGetter (NewEpochState ConwayEra) Coin
Lens' (NewEpochState ConwayEra) Coin
forall (t :: * -> *) era.
CanSetChainAccountState t =>
Lens' (t era) Coin
treasuryL
    let
      execCtx :: ConwayRatifyExecContext ConwayEra
execCtx =
        Coin
-> [GovActionState ConwayEra] -> ConwayRatifyExecContext ConwayEra
forall era.
Coin -> [GovActionState era] -> ConwayRatifyExecContext era
ConwayRatifyExecContext
          Coin
treasury
          [GovActionState ConwayEra
noConfidenceGAS]
    Natural -> ImpM (LedgerSpec ConwayEra) ()
forall era. ShelleyEraImp era => Natural -> ImpTestM era ()
passNEpochs Natural
2
    ImpTestM
  ConwayEra (StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra))
forall era.
ConwayEraGov era =>
ImpTestM era (StrictMaybe (GovPurposeId 'CommitteePurpose era))
getLastEnactedCommittee ImpTestM
  ConwayEra (StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra))
-> StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
-> ImpM (LedgerSpec ConwayEra) ()
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, Show a, Eq a) =>
m a -> a -> m ()
`shouldReturn` GovPurposeId 'CommitteePurpose ConwayEra
-> StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
forall a. a -> StrictMaybe a
SJust (GovActionId -> GovPurposeId 'CommitteePurpose ConwayEra
forall (p :: GovActionPurpose) era.
GovActionId -> GovPurposeId p era
GovPurposeId GovActionId
noConfidence)
    Property -> ImpM (LedgerSpec ConwayEra) Property
forall a. a -> ImpM (LedgerSpec ConwayEra) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Property -> ImpM (LedgerSpec ConwayEra) Property)
-> Property -> ImpM (LedgerSpec ConwayEra) Property
forall a b. (a -> b) -> a -> b
$
      forall (rule :: Symbol) era.
(ExecSpecRule rule era, ShelleyEraImp era,
 SpecTranslate (ExecContext rule era) (State (EraRule rule era)),
 ForAllExecSpecRep NFData rule era,
 ForAllExecSpecRep ToExpr rule era,
 NFData (SpecRep (PredicateFailure (EraRule rule era))),
 ToExpr (SpecRep (PredicateFailure (EraRule rule era))),
 Eq (SpecRep (PredicateFailure (EraRule rule era))),
 Eq (SpecRep (ExecState rule era)),
 Inject (State (EraRule rule era)) (ExecState rule era),
 SpecTranslate (ExecContext rule era) (ExecState rule era),
 FixupSpecRep (SpecRep (PredicateFailure (EraRule rule era))),
 FixupSpecRep (SpecRep (ExecState rule era)),
 Inject (ExecEnvironment rule era) (Environment (EraRule rule era)),
 Inject (ExecState rule era) (State (EraRule rule era)),
 Inject (ExecSignal rule era) (Signal (EraRule rule era)),
 EncCBOR (ExecContext rule era),
 EncCBOR (Environment (EraRule rule era)),
 EncCBOR (State (EraRule rule era)),
 EncCBOR (Signal (EraRule rule era)), ToExpr (ExecContext rule era),
 ToExpr (PredicateFailure (EraRule rule era)),
 NFData (PredicateFailure (EraRule rule era)), HasCallStack) =>
ExecContext rule era
-> ExecEnvironment rule era
-> ExecState rule era
-> ExecSignal rule era
-> Property
testConformance @"RATIFY" @ConwayEra
        ExecContext "RATIFY" ConwayEra
ConwayRatifyExecContext ConwayEra
execCtx
        ExecEnvironment "RATIFY" ConwayEra
RatifyEnv ConwayEra
ratEnv
        RatifyState ConwayEra
ExecState "RATIFY" ConwayEra
ratSt
        (StrictSeq (GovActionState ConwayEra) -> RatifySignal ConwayEra
forall era. StrictSeq (GovActionState era) -> RatifySignal era
RatifySignal (GovActionState ConwayEra
noConfidenceGAS GovActionState ConwayEra
-> StrictSeq (GovActionState ConwayEra)
-> StrictSeq (GovActionState ConwayEra)
forall a. a -> StrictSeq a -> StrictSeq a
SSeq.:<| StrictSeq (GovActionState ConwayEra)
forall a. StrictSeq a
SSeq.Empty))
  String
-> ImpM (LedgerSpec ConwayEra) ()
-> SpecWith (Arg (ImpM (LedgerSpec ConwayEra) ()))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"Duplicate CC hot keys count as separate votes" (ImpM (LedgerSpec ConwayEra) ()
 -> SpecWith (Arg (ImpM (LedgerSpec ConwayEra) ())))
-> ImpM (LedgerSpec ConwayEra) ()
-> SpecWith (Arg (ImpM (LedgerSpec ConwayEra) ()))
forall a b. (a -> b) -> a -> b
$ do
    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"Setting up a DRep"
    let maxTermLength :: EpochInterval
maxTermLength = Word32 -> EpochInterval
EpochInterval Word32
10
    (PParams ConwayEra -> PParams ConwayEra)
-> ImpM (LedgerSpec ConwayEra) ()
forall era.
ShelleyEraImp era =>
(PParams era -> PParams era) -> ImpTestM era ()
modifyPParams ((PParams ConwayEra -> PParams ConwayEra)
 -> ImpM (LedgerSpec ConwayEra) ())
-> (PParams ConwayEra -> PParams ConwayEra)
-> ImpM (LedgerSpec ConwayEra) ()
forall a b. (a -> b) -> a -> b
$ \PParams ConwayEra
pp ->
      PParams ConwayEra
pp
        PParams ConwayEra
-> (PParams ConwayEra -> PParams ConwayEra) -> PParams ConwayEra
forall a b. a -> (a -> b) -> b
& (EpochInterval -> Identity EpochInterval)
-> PParams ConwayEra -> Identity (PParams ConwayEra)
forall era.
ConwayEraPParams era =>
Lens' (PParams era) EpochInterval
Lens' (PParams ConwayEra) EpochInterval
ppCommitteeMaxTermLengthL ((EpochInterval -> Identity EpochInterval)
 -> PParams ConwayEra -> Identity (PParams ConwayEra))
-> EpochInterval -> PParams ConwayEra -> PParams ConwayEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~ EpochInterval
maxTermLength
        PParams ConwayEra
-> (PParams ConwayEra -> PParams ConwayEra) -> PParams ConwayEra
forall a b. a -> (a -> b) -> b
& (CoinPerByte -> Identity CoinPerByte)
-> PParams ConwayEra -> Identity (PParams ConwayEra)
forall era.
BabbageEraPParams era =>
Lens' (PParams era) CoinPerByte
Lens' (PParams ConwayEra) CoinPerByte
ppCoinsPerUTxOByteL ((CoinPerByte -> Identity CoinPerByte)
 -> PParams ConwayEra -> Identity (PParams ConwayEra))
-> CoinPerByte -> PParams ConwayEra -> PParams ConwayEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Coin -> CoinPerByte
CoinPerByte (Integer -> Coin
Coin Integer
1)
        PParams ConwayEra
-> (PParams ConwayEra -> PParams ConwayEra) -> PParams ConwayEra
forall a b. a -> (a -> b) -> b
& (Natural -> Identity Natural)
-> PParams ConwayEra -> Identity (PParams ConwayEra)
forall era. ConwayEraPParams era => Lens' (PParams era) Natural
Lens' (PParams ConwayEra) Natural
ppCommitteeMinSizeL ((Natural -> Identity Natural)
 -> PParams ConwayEra -> Identity (PParams ConwayEra))
-> Natural -> PParams ConwayEra -> PParams ConwayEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Natural
2
    (Credential 'DRepRole
credDRep, Credential 'Staking
_, KeyPair 'Payment
_) <- Integer
-> ImpTestM
     ConwayEra
     (Credential 'DRepRole, Credential 'Staking, KeyPair 'Payment)
forall era.
ConwayEraImp era =>
Integer
-> ImpTestM
     era (Credential 'DRepRole, Credential 'Staking, KeyPair 'Payment)
setupSingleDRep Integer
300
    (KeyHash 'StakePool
credSPO, Credential 'Payment
_, Credential 'Staking
_) <- Coin
-> ImpTestM
     ConwayEra
     (KeyHash 'StakePool, Credential 'Payment, Credential 'Staking)
forall era.
(ShelleyEraImp era, ConwayEraTxCert era) =>
Coin
-> ImpTestM
     era (KeyHash 'StakePool, Credential 'Payment, Credential 'Staking)
setupPoolWithStake (Coin
 -> ImpTestM
      ConwayEra
      (KeyHash 'StakePool, Credential 'Payment, Credential 'Staking))
-> Coin
-> ImpTestM
     ConwayEra
     (KeyHash 'StakePool, Credential 'Payment, Credential 'Staking)
forall a b. (a -> b) -> a -> b
$ Integer -> Coin
Coin Integer
1_000_000
    -- Ensure that there is no committee yet
    SJust (Committee {committeeMembers :: forall era.
Committee era -> Map (Credential 'ColdCommitteeRole) EpochNo
committeeMembers = Map (Credential 'ColdCommitteeRole) EpochNo
oldCommittee}) <-
      SimpleGetter
  (NewEpochState ConwayEra) (StrictMaybe (Committee ConwayEra))
-> ImpTestM ConwayEra (StrictMaybe (Committee ConwayEra))
forall era a. SimpleGetter (NewEpochState era) a -> ImpTestM era a
getsNES (SimpleGetter
   (NewEpochState ConwayEra) (StrictMaybe (Committee ConwayEra))
 -> ImpTestM ConwayEra (StrictMaybe (Committee ConwayEra)))
-> SimpleGetter
     (NewEpochState ConwayEra) (StrictMaybe (Committee ConwayEra))
-> ImpTestM ConwayEra (StrictMaybe (Committee ConwayEra))
forall a b. (a -> b) -> a -> b
$ (EpochState ConwayEra -> Const r (EpochState ConwayEra))
-> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra)
forall era (f :: * -> *).
Functor f =>
(EpochState era -> f (EpochState era))
-> NewEpochState era -> f (NewEpochState era)
nesEsL ((EpochState ConwayEra -> Const r (EpochState ConwayEra))
 -> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra))
-> ((StrictMaybe (Committee ConwayEra)
     -> Const r (StrictMaybe (Committee ConwayEra)))
    -> EpochState ConwayEra -> Const r (EpochState ConwayEra))
-> (StrictMaybe (Committee ConwayEra)
    -> Const r (StrictMaybe (Committee ConwayEra)))
-> NewEpochState ConwayEra
-> Const r (NewEpochState ConwayEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (GovState ConwayEra -> Const r (GovState ConwayEra))
-> EpochState ConwayEra -> Const r (EpochState ConwayEra)
(ConwayGovState ConwayEra -> Const r (ConwayGovState ConwayEra))
-> EpochState ConwayEra -> Const r (EpochState ConwayEra)
forall era (f :: * -> *).
Functor f =>
(GovState era -> f (GovState era))
-> EpochState era -> f (EpochState era)
epochStateGovStateL ((ConwayGovState ConwayEra -> Const r (ConwayGovState ConwayEra))
 -> EpochState ConwayEra -> Const r (EpochState ConwayEra))
-> ((StrictMaybe (Committee ConwayEra)
     -> Const r (StrictMaybe (Committee ConwayEra)))
    -> ConwayGovState ConwayEra -> Const r (ConwayGovState ConwayEra))
-> (StrictMaybe (Committee ConwayEra)
    -> Const r (StrictMaybe (Committee ConwayEra)))
-> EpochState ConwayEra
-> Const r (EpochState ConwayEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe (Committee ConwayEra)
 -> Const r (StrictMaybe (Committee ConwayEra)))
-> GovState ConwayEra -> Const r (GovState ConwayEra)
(StrictMaybe (Committee ConwayEra)
 -> Const r (StrictMaybe (Committee ConwayEra)))
-> ConwayGovState ConwayEra -> Const r (ConwayGovState ConwayEra)
forall era.
ConwayEraGov era =>
Lens' (GovState era) (StrictMaybe (Committee era))
Lens' (GovState ConwayEra) (StrictMaybe (Committee ConwayEra))
committeeGovStateL

    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"Electing the committee"
    Credential 'ColdCommitteeRole
ccCold0 <- KeyHash 'ColdCommitteeRole -> Credential 'ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (KeyHash 'ColdCommitteeRole -> Credential 'ColdCommitteeRole)
-> ImpM (LedgerSpec ConwayEra) (KeyHash 'ColdCommitteeRole)
-> ImpM (LedgerSpec ConwayEra) (Credential 'ColdCommitteeRole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ImpM (LedgerSpec ConwayEra) (KeyHash 'ColdCommitteeRole)
forall (r :: KeyRole) s g (m :: * -> *).
(HasKeyPairs s, MonadState s m, HasStatefulGen g m) =>
m (KeyHash r)
freshKeyHash
    Credential 'ColdCommitteeRole
ccCold1 <- KeyHash 'ColdCommitteeRole -> Credential 'ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (KeyHash 'ColdCommitteeRole -> Credential 'ColdCommitteeRole)
-> ImpM (LedgerSpec ConwayEra) (KeyHash 'ColdCommitteeRole)
-> ImpM (LedgerSpec ConwayEra) (Credential 'ColdCommitteeRole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ImpM (LedgerSpec ConwayEra) (KeyHash 'ColdCommitteeRole)
forall (r :: KeyRole) s g (m :: * -> *).
(HasKeyPairs s, MonadState s m, HasStatefulGen g m) =>
m (KeyHash r)
freshKeyHash
    Credential 'ColdCommitteeRole
ccCold2 <- KeyHash 'ColdCommitteeRole -> Credential 'ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (KeyHash 'ColdCommitteeRole -> Credential 'ColdCommitteeRole)
-> ImpM (LedgerSpec ConwayEra) (KeyHash 'ColdCommitteeRole)
-> ImpM (LedgerSpec ConwayEra) (Credential 'ColdCommitteeRole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ImpM (LedgerSpec ConwayEra) (KeyHash 'ColdCommitteeRole)
forall (r :: KeyRole) s g (m :: * -> *).
(HasKeyPairs s, MonadState s m, HasStatefulGen g m) =>
m (KeyHash r)
freshKeyHash
    Credential 'HotCommitteeRole
hotKey <- KeyHash 'HotCommitteeRole -> Credential 'HotCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (KeyHash 'HotCommitteeRole -> Credential 'HotCommitteeRole)
-> ImpM (LedgerSpec ConwayEra) (KeyHash 'HotCommitteeRole)
-> ImpM (LedgerSpec ConwayEra) (Credential 'HotCommitteeRole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ImpM (LedgerSpec ConwayEra) (KeyHash 'HotCommitteeRole)
forall (r :: KeyRole) s g (m :: * -> *).
(HasKeyPairs s, MonadState s m, HasStatefulGen g m) =>
m (KeyHash r)
freshKeyHash
    EpochNo
curEpoch <- SimpleGetter (NewEpochState ConwayEra) EpochNo
-> ImpTestM ConwayEra EpochNo
forall era a. SimpleGetter (NewEpochState era) a -> ImpTestM era a
getsNES (EpochNo -> Const r EpochNo)
-> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra)
SimpleGetter (NewEpochState ConwayEra) EpochNo
forall era (f :: * -> *).
Functor f =>
(EpochNo -> f EpochNo)
-> NewEpochState era -> f (NewEpochState era)
nesELL
    let
      ccExpiry :: EpochNo
ccExpiry = EpochNo
curEpoch EpochNo -> EpochInterval -> EpochNo
`addEpochInterval` EpochInterval
maxTermLength
      committee :: Map (Credential 'ColdCommitteeRole) EpochNo
committee =
        [(Credential 'ColdCommitteeRole, EpochNo)]
-> Map (Credential 'ColdCommitteeRole) EpochNo
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
          [ (Credential 'ColdCommitteeRole
ccCold0, EpochNo
ccExpiry)
          , (Credential 'ColdCommitteeRole
ccCold1, EpochNo
ccExpiry)
          , (Credential 'ColdCommitteeRole
ccCold2, EpochNo
ccExpiry)
          ]
    GovActionId
committeeId <-
      GovAction ConwayEra -> ImpTestM ConwayEra GovActionId
forall era.
(ShelleyEraImp era, ConwayEraTxBody era, HasCallStack) =>
GovAction era -> ImpTestM era GovActionId
submitGovAction (GovAction ConwayEra -> ImpTestM ConwayEra GovActionId)
-> GovAction ConwayEra -> ImpTestM ConwayEra GovActionId
forall a b. (a -> b) -> a -> b
$
        StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
-> Set (Credential 'ColdCommitteeRole)
-> Map (Credential 'ColdCommitteeRole) EpochNo
-> UnitInterval
-> GovAction ConwayEra
forall era.
StrictMaybe (GovPurposeId 'CommitteePurpose era)
-> Set (Credential 'ColdCommitteeRole)
-> Map (Credential 'ColdCommitteeRole) EpochNo
-> UnitInterval
-> GovAction era
UpdateCommittee
          StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
forall a. StrictMaybe a
SNothing
          (Map (Credential 'ColdCommitteeRole) EpochNo
-> Set (Credential 'ColdCommitteeRole)
forall k a. Map k a -> Set k
Map.keysSet Map (Credential 'ColdCommitteeRole) EpochNo
oldCommittee) -- Get rid of the initial committee
          Map (Credential 'ColdCommitteeRole) EpochNo
committee
          (Integer
6 Integer -> Integer -> UnitInterval
forall r. (IsRatio r, HasCallStack) => Integer -> Integer -> r
%! Integer
10)
    Voter -> GovActionId -> ImpM (LedgerSpec ConwayEra) ()
forall era.
(ShelleyEraImp era, ConwayEraTxBody era, HasCallStack) =>
Voter -> GovActionId -> ImpTestM era ()
submitYesVote_ (Credential 'DRepRole -> Voter
DRepVoter Credential 'DRepRole
credDRep) GovActionId
committeeId
    Voter -> GovActionId -> ImpM (LedgerSpec ConwayEra) ()
forall era.
(ShelleyEraImp era, ConwayEraTxBody era, HasCallStack) =>
Voter -> GovActionId -> ImpTestM era ()
submitYesVote_ (KeyHash 'StakePool -> Voter
StakePoolVoter KeyHash 'StakePool
credSPO) GovActionId
committeeId
    String
-> ImpM (LedgerSpec ConwayEra) () -> ImpM (LedgerSpec ConwayEra) ()
forall a t. NFData a => String -> ImpM t a -> ImpM t a
impAnn String
"Waiting for the committee to get elected" (ImpM (LedgerSpec ConwayEra) () -> ImpM (LedgerSpec ConwayEra) ())
-> ImpM (LedgerSpec ConwayEra) () -> ImpM (LedgerSpec ConwayEra) ()
forall a b. (a -> b) -> a -> b
$ do
      GovActionId -> ImpM (LedgerSpec ConwayEra) ()
forall era.
(HasCallStack, ConwayEraGov era, ConwayEraCertState era) =>
GovActionId -> ImpTestM era ()
logAcceptedRatio GovActionId
committeeId
      Natural -> ImpM (LedgerSpec ConwayEra) ()
forall era. ShelleyEraImp era => Natural -> ImpTestM era ()
passNEpochs Natural
2
      ImpTestM
  ConwayEra (StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra))
forall era.
ConwayEraGov era =>
ImpTestM era (StrictMaybe (GovPurposeId 'CommitteePurpose era))
getLastEnactedCommittee ImpTestM
  ConwayEra (StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra))
-> StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
-> ImpM (LedgerSpec ConwayEra) ()
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, Show a, Eq a) =>
m a -> a -> m ()
`shouldReturn` GovPurposeId 'CommitteePurpose ConwayEra
-> StrictMaybe (GovPurposeId 'CommitteePurpose ConwayEra)
forall a. a -> StrictMaybe a
SJust (GovActionId -> GovPurposeId 'CommitteePurpose ConwayEra
forall (p :: GovActionPurpose) era.
GovActionId -> GovPurposeId p era
GovPurposeId GovActionId
committeeId)

    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"Registering hotkeys"
    NonEmpty (Credential 'HotCommitteeRole)
_ <- ImpM (LedgerSpec ConwayEra) (Credential 'HotCommitteeRole)
-> NonEmpty (Credential 'ColdCommitteeRole)
-> ImpTestM ConwayEra (NonEmpty (Credential 'HotCommitteeRole))
forall era.
(ShelleyEraImp era, ConwayEraTxCert era) =>
ImpTestM era (Credential 'HotCommitteeRole)
-> NonEmpty (Credential 'ColdCommitteeRole)
-> ImpTestM era (NonEmpty (Credential 'HotCommitteeRole))
registerCommitteeHotKeys (Credential 'HotCommitteeRole
-> ImpM (LedgerSpec ConwayEra) (Credential 'HotCommitteeRole)
forall a. a -> ImpM (LedgerSpec ConwayEra) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Credential 'HotCommitteeRole
hotKey) (Credential 'ColdCommitteeRole
ccCold0 Credential 'ColdCommitteeRole
-> [Credential 'ColdCommitteeRole]
-> NonEmpty (Credential 'ColdCommitteeRole)
forall a. a -> [a] -> NonEmpty a
NE.:| [Credential 'ColdCommitteeRole
ccCold1])

    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"Proposing a new constitution"
    Constitution ConwayEra
newConstitution <- ImpM (LedgerSpec ConwayEra) (Constitution ConwayEra)
forall a (m :: * -> *). (Arbitrary a, MonadGen m) => m a
arbitrary
    GovActionId
constitutionId <- GovAction ConwayEra -> ImpTestM ConwayEra GovActionId
forall era.
(ShelleyEraImp era, ConwayEraTxBody era, HasCallStack) =>
GovAction era -> ImpTestM era GovActionId
submitGovAction (GovAction ConwayEra -> ImpTestM ConwayEra GovActionId)
-> GovAction ConwayEra -> ImpTestM ConwayEra GovActionId
forall a b. (a -> b) -> a -> b
$ StrictMaybe (GovPurposeId 'ConstitutionPurpose ConwayEra)
-> Constitution ConwayEra -> GovAction ConwayEra
forall era.
StrictMaybe (GovPurposeId 'ConstitutionPurpose era)
-> Constitution era -> GovAction era
NewConstitution StrictMaybe (GovPurposeId 'ConstitutionPurpose ConwayEra)
forall a. StrictMaybe a
SNothing Constitution ConwayEra
newConstitution
    Voter -> GovActionId -> ImpM (LedgerSpec ConwayEra) ()
forall era.
(ShelleyEraImp era, ConwayEraTxBody era, HasCallStack) =>
Voter -> GovActionId -> ImpTestM era ()
submitYesVote_ (Credential 'HotCommitteeRole -> Voter
CommitteeVoter Credential 'HotCommitteeRole
hotKey) GovActionId
constitutionId
    Voter -> GovActionId -> ImpM (LedgerSpec ConwayEra) ()
forall era.
(ShelleyEraImp era, ConwayEraTxBody era, HasCallStack) =>
Voter -> GovActionId -> ImpTestM era ()
submitYesVote_ (Credential 'DRepRole -> Voter
DRepVoter Credential 'DRepRole
credDRep) GovActionId
constitutionId
    GovActionState ConwayEra
constitutionGAS <- GovActionId -> ImpTestM ConwayEra (GovActionState ConwayEra)
forall era.
(HasCallStack, ConwayEraGov era) =>
GovActionId -> ImpTestM era (GovActionState era)
getGovActionState GovActionId
constitutionId

    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"Testing conformance"
    Coin
treasury <- SimpleGetter (NewEpochState ConwayEra) Coin
-> ImpTestM ConwayEra Coin
forall era a. SimpleGetter (NewEpochState era) a -> ImpTestM era a
getsNES (Coin -> Const r Coin)
-> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra)
SimpleGetter (NewEpochState ConwayEra) Coin
Lens' (NewEpochState ConwayEra) Coin
forall (t :: * -> *) era.
CanSetChainAccountState t =>
Lens' (t era) Coin
treasuryL
    let execCtx :: ConwayRatifyExecContext ConwayEra
execCtx = Coin
-> [GovActionState ConwayEra] -> ConwayRatifyExecContext ConwayEra
forall era.
Coin -> [GovActionState era] -> ConwayRatifyExecContext era
ConwayRatifyExecContext Coin
treasury [GovActionState ConwayEra
constitutionGAS]
    RatifyEnv ConwayEra
ratEnv <- ImpTestM ConwayEra (RatifyEnv ConwayEra)
forall era.
(ConwayEraGov era, ConwayEraCertState era) =>
ImpTestM era (RatifyEnv era)
getRatifyEnv
    ConwayGovState ConwayEra
govSt <- SimpleGetter (NewEpochState ConwayEra) (ConwayGovState ConwayEra)
-> ImpTestM ConwayEra (ConwayGovState ConwayEra)
forall era a. SimpleGetter (NewEpochState era) a -> ImpTestM era a
getsNES (SimpleGetter (NewEpochState ConwayEra) (ConwayGovState ConwayEra)
 -> ImpTestM ConwayEra (ConwayGovState ConwayEra))
-> SimpleGetter
     (NewEpochState ConwayEra) (ConwayGovState ConwayEra)
-> ImpTestM ConwayEra (ConwayGovState ConwayEra)
forall a b. (a -> b) -> a -> b
$ (EpochState ConwayEra -> Const r (EpochState ConwayEra))
-> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra)
forall era (f :: * -> *).
Functor f =>
(EpochState era -> f (EpochState era))
-> NewEpochState era -> f (NewEpochState era)
nesEsL ((EpochState ConwayEra -> Const r (EpochState ConwayEra))
 -> NewEpochState ConwayEra -> Const r (NewEpochState ConwayEra))
-> ((ConwayGovState ConwayEra
     -> Const r (ConwayGovState ConwayEra))
    -> EpochState ConwayEra -> Const r (EpochState ConwayEra))
-> (ConwayGovState ConwayEra -> Const r (ConwayGovState ConwayEra))
-> NewEpochState ConwayEra
-> Const r (NewEpochState ConwayEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (GovState ConwayEra -> Const r (GovState ConwayEra))
-> EpochState ConwayEra -> Const r (EpochState ConwayEra)
(ConwayGovState ConwayEra -> Const r (ConwayGovState ConwayEra))
-> EpochState ConwayEra -> Const r (EpochState ConwayEra)
forall era (f :: * -> *).
Functor f =>
(GovState era -> f (GovState era))
-> EpochState era -> f (EpochState era)
epochStateGovStateL
    let
      ratSt :: RatifyState ConwayEra
ratSt = ConwayGovState ConwayEra -> RatifyState ConwayEra
forall era. EraStake era => ConwayGovState era -> RatifyState era
getRatifyState ConwayGovState ConwayEra
govSt
      ratSig :: RatifySignal ConwayEra
ratSig = StrictSeq (GovActionState ConwayEra) -> RatifySignal ConwayEra
forall era. StrictSeq (GovActionState era) -> RatifySignal era
RatifySignal (GovActionState ConwayEra
constitutionGAS GovActionState ConwayEra
-> StrictSeq (GovActionState ConwayEra)
-> StrictSeq (GovActionState ConwayEra)
forall a. a -> StrictSeq a -> StrictSeq a
SSeq.:<| StrictSeq (GovActionState ConwayEra)
forall a. Monoid a => a
mempty)
    (Either (NonEmpty Void) RatifyState
implRes, Either OpaqueErrorString RatifyState
agdaRes, Either (NonEmpty Void) (RatifyState ConwayEra, [Void])
implRes') <-
      forall (rule :: Symbol) era.
(ExecSpecRule rule era, ForAllExecSpecRep NFData rule era,
 ForAllExecSpecRep ToExpr rule era,
 FixupSpecRep (SpecRep (ExecState rule era)),
 Inject (State (EraRule rule era)) (ExecState rule era),
 SpecTranslate (ExecContext rule era) (ExecState rule era),
 ToExpr (ExecContext rule era), HasCallStack,
 NFData (PredicateFailure (EraRule rule era))) =>
ExecContext rule era
-> ExecEnvironment rule era
-> ExecState rule era
-> ExecSignal rule era
-> ImpTestM
     era
     (Either
        (NonEmpty (PredicateFailure (EraRule rule era)))
        (SpecRep (ExecState rule era)),
      Either OpaqueErrorString (SpecRep (ExecState rule era)),
      Either
        (NonEmpty (PredicateFailure (EraRule rule era)))
        (State (EraRule rule era), [Event (EraRule rule era)]))
runConformance @"RATIFY" @ConwayEra
        ExecContext "RATIFY" ConwayEra
ConwayRatifyExecContext ConwayEra
execCtx
        ExecEnvironment "RATIFY" ConwayEra
RatifyEnv ConwayEra
ratEnv
        RatifyState ConwayEra
ExecState "RATIFY" ConwayEra
ratSt
        ExecSignal "RATIFY" ConwayEra
RatifySignal ConwayEra
ratSig
    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"===context==="
    ConwayRatifyExecContext ConwayEra -> ImpM (LedgerSpec ConwayEra) ()
forall a t. (HasCallStack, ToExpr a) => a -> ImpM t ()
logToExpr ConwayRatifyExecContext ConwayEra
execCtx
    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"===environment==="
    RatifyEnv ConwayEra -> ImpM (LedgerSpec ConwayEra) ()
forall a t. (HasCallStack, ToExpr a) => a -> ImpM t ()
logToExpr RatifyEnv ConwayEra
ratEnv
    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"===state==="
    RatifyState ConwayEra -> ImpM (LedgerSpec ConwayEra) ()
forall a t. (HasCallStack, ToExpr a) => a -> ImpM t ()
logToExpr RatifyState ConwayEra
ratSt
    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"===signal==="
    RatifySignal ConwayEra -> ImpM (LedgerSpec ConwayEra) ()
forall a t. (HasCallStack, ToExpr a) => a -> ImpM t ()
logToExpr RatifySignal ConwayEra
ratSig
    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"Impl res:"
    Either (NonEmpty Void) RatifyState
-> ImpM (LedgerSpec ConwayEra) ()
forall a t. (HasCallStack, ToExpr a) => a -> ImpM t ()
logToExpr Either (NonEmpty Void) RatifyState
implRes
    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"Agda res:"
    Either OpaqueErrorString RatifyState
-> ImpM (LedgerSpec ConwayEra) ()
forall a t. (HasCallStack, ToExpr a) => a -> ImpM t ()
logToExpr Either OpaqueErrorString RatifyState
agdaRes
    String -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => String -> ImpM t ()
logString String
"Extra information:"
    Globals
globals <- Getting Globals (ImpTestState ConwayEra) Globals
-> ImpM (LedgerSpec ConwayEra) Globals
forall s (m :: * -> *) a. MonadState s m => Getting a s a -> m a
use Getting Globals (ImpTestState ConwayEra) Globals
forall era (f :: * -> *).
Functor f =>
(Globals -> f Globals) -> ImpTestState era -> f (ImpTestState era)
impGlobalsL
    Doc AnsiStyle -> ImpM (LedgerSpec ConwayEra) ()
forall t. HasCallStack => Doc AnsiStyle -> ImpM t ()
logDoc (Doc AnsiStyle -> ImpM (LedgerSpec ConwayEra) ())
-> Doc AnsiStyle -> ImpM (LedgerSpec ConwayEra) ()
forall a b. (a -> b) -> a -> b
$
      forall (rule :: Symbol) era.
(ExecSpecRule rule era, HasCallStack) =>
Globals
-> ExecContext rule era
-> Environment (EraRule rule era)
-> State (EraRule rule era)
-> Signal (EraRule rule era)
-> Either
     OpaqueErrorString
     (State (EraRule rule era), [Event (EraRule rule era)])
-> Doc AnsiStyle
extraInfo @"RATIFY" @ConwayEra
        Globals
globals
        ExecContext "RATIFY" ConwayEra
ConwayRatifyExecContext ConwayEra
execCtx
        RatifyEnv ConwayEra
Environment (EraRule "RATIFY" ConwayEra)
ratEnv
        RatifyState ConwayEra
State (EraRule "RATIFY" ConwayEra)
ratSt
        RatifySignal ConwayEra
Signal (EraRule "RATIFY" ConwayEra)
ratSig
        ((NonEmpty Void -> OpaqueErrorString)
-> Either (NonEmpty Void) (RatifyState ConwayEra, [Void])
-> Either OpaqueErrorString (RatifyState ConwayEra, [Void])
forall a b c. (a -> b) -> Either a c -> Either b c
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first NonEmpty Void -> OpaqueErrorString
forall a. ToExpr a => a -> OpaqueErrorString
showOpaqueErrorString Either (NonEmpty Void) (RatifyState ConwayEra, [Void])
implRes')
    String
-> ImpM (LedgerSpec ConwayEra) () -> ImpM (LedgerSpec ConwayEra) ()
forall a t. NFData a => String -> ImpM t a -> ImpM t a
impAnn String
"Conformance failed" (ImpM (LedgerSpec ConwayEra) () -> ImpM (LedgerSpec ConwayEra) ())
-> ImpM (LedgerSpec ConwayEra) () -> ImpM (LedgerSpec ConwayEra) ()
forall a b. (a -> b) -> a -> b
$
      (NonEmpty Void -> OpaqueErrorString)
-> Either (NonEmpty Void) RatifyState
-> Either OpaqueErrorString RatifyState
forall a b c. (a -> b) -> Either a c -> Either b c
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first NonEmpty Void -> OpaqueErrorString
forall a. ToExpr a => a -> OpaqueErrorString
showOpaqueErrorString Either (NonEmpty Void) RatifyState
implRes Either OpaqueErrorString RatifyState
-> Either OpaqueErrorString RatifyState
-> ImpM (LedgerSpec ConwayEra) ()
forall a (m :: * -> *).
(HasCallStack, ToExpr a, Eq a, MonadIO m) =>
a -> a -> m ()
`shouldBeExpr` Either OpaqueErrorString RatifyState
agdaRes