From 91327bf83bffa665b56cb18321061867c75a96e7 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Tue, 23 Apr 2024 20:11:53 +0200 Subject: [PATCH] Fixes required by rebasing --- .../src/Testnet/EpochStateProcessing.hs | 14 ++++++++------ .../Testnet/Test/LedgerEvents/Gov/DRepActivity.hs | 2 +- .../Testnet/Test/LedgerEvents/Gov/InfoAction.hs | 5 +++-- .../Test/LedgerEvents/Gov/PredefinedAbstainDRep.hs | 8 ++++---- .../LedgerEvents/Gov/PredefinedNoConfidenceDRep.hs | 4 ++-- .../LedgerEvents/Gov/ProposeNewConstitution.hs | 4 ++-- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/cardano-testnet/src/Testnet/EpochStateProcessing.hs b/cardano-testnet/src/Testnet/EpochStateProcessing.hs index 63d1a962d35..9bf4b72da2a 100644 --- a/cardano-testnet/src/Testnet/EpochStateProcessing.hs +++ b/cardano-testnet/src/Testnet/EpochStateProcessing.hs @@ -5,10 +5,10 @@ module Testnet.EpochStateProcessing , findCondition ) where -import Cardano.Api (AnyNewEpochState (..), ConwayEra, EpochNo, File (File), - FoldBlocksError, LedgerStateCondition (..), MonadIO, ShelleyBasedEra, - ValidationMode (FullValidation), foldEpochState, runExceptT, - shelleyBasedEraConstraints) +import Cardano.Api (AnyNewEpochState (..), ConwayEra, ConwayEraOnwards, EpochNo, + File (File), FoldBlocksError, LedgerStateCondition (..), MonadIO, + ValidationMode (FullValidation), conwayEraOnwardsToShelleyBasedEra, + foldEpochState, runExceptT, shelleyBasedEraConstraints) import qualified Cardano.Api as Api import Cardano.Api.Ledger (GovActionId (..)) import qualified Cardano.Api.Ledger as L @@ -58,11 +58,13 @@ findCondition epochStateFoldFunc configurationFile socketPath maxEpochNo = withF Just x -> put (Just x) >> pure ConditionMet Nothing -> pure ConditionNotMet -maybeExtractGovernanceActionIndex :: ShelleyBasedEra ConwayEra -- ^ The era in which the test runs +maybeExtractGovernanceActionIndex :: () + => ConwayEraOnwards ConwayEra -- ^ The era in which the test runs -> Api.TxId -> AnyNewEpochState -> Maybe Word32 -maybeExtractGovernanceActionIndex sbe txid (AnyNewEpochState actualEra newEpochState) = +maybeExtractGovernanceActionIndex ceo txid (AnyNewEpochState actualEra newEpochState) = + let sbe = conwayEraOnwardsToShelleyBasedEra ceo in case testEquality sbe actualEra of Just Refl -> do let proposals = shelleyBasedEraConstraints sbe newEpochState diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/DRepActivity.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/DRepActivity.hs index b0a74c48044..a1a2ba3b961 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/DRepActivity.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/DRepActivity.hs @@ -307,7 +307,7 @@ makeActivityChangeProposal execConfig epochStateView configurationFile socketPat governanceActionTxId <- retrieveTransactionId execConfig signedProposalTx - !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex sbe (fromString governanceActionTxId)) + !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex ceo (fromString governanceActionTxId)) (unFile configurationFile) (unFile socketPath) (EpochNo timeout) diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/InfoAction.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/InfoAction.hs index 655d68e9623..cca982bf58d 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/InfoAction.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/InfoAction.hs @@ -55,7 +55,8 @@ hprop_ledger_events_info_action = H.integrationRetryWorkspace 0 "info-hash" $ \t work <- H.createDirectoryIfMissing $ tempAbsPath' "work" - let sbe = ShelleyBasedEraConway + let ceo = ConwayEraOnwardsConway + sbe = conwayEraOnwardsToShelleyBasedEra ceo era = toCardanoEra sbe fastTestnetOptions = cardanoDefaultTestnetOptions { cardanoEpochLength = 100 @@ -149,7 +150,7 @@ hprop_ledger_events_info_action = H.integrationRetryWorkspace 0 "info-hash" $ \t , "--tx-file", txbodySignedFp ] - !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex sbe (fromString txidString)) + !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex ceo (fromString txidString)) configurationFile socketPath (EpochNo 10) diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedAbstainDRep.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedAbstainDRep.hs index 404eb1fe30b..4b714097a78 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedAbstainDRep.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedAbstainDRep.hs @@ -27,6 +27,7 @@ import Prelude import Control.Monad (void) import Control.Monad.Catch (MonadCatch) +import Data.Data (Typeable) import Data.String (fromString) import qualified Data.Text as Text import Data.Word (Word32) @@ -312,7 +313,7 @@ makeDesiredPoolNumberChangeProposal execConfig epochStateView configurationFile governanceActionTxId <- retrieveTransactionId execConfig signedProposalTx - !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex sbe (fromString governanceActionTxId)) + !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex ceo (fromString governanceActionTxId)) (unFile configurationFile) (unFile socketPath) (EpochNo 30) @@ -338,11 +339,10 @@ type DefaultSPOVote = (String, Int) -- | Create and issue votes for (or against) a government proposal with default -- Delegate Representative (DReps created by 'cardanoTestnetDefault') and -- default Stake Pool Operatorsusing using @cardano-cli@. -voteChangeProposal :: (MonadTest m, MonadIO m, MonadCatch m, H.MonadAssertion m) +voteChangeProposal :: (Typeable era, MonadTest m, MonadIO m, MonadCatch m, H.MonadAssertion m) => H.ExecConfig -- ^ Specifies the CLI execution configuration. -> EpochStateView -- ^ Current epoch state view for transaction building. It can be obtained - -- using the 'getEpochStateView' function. - -> ConwayEraOnwards ConwayEra -- ^ The @ConwayEraOnwards@ witness for the Conway era. + -> ConwayEraOnwards era -- ^ The @ConwayEraOnwards@ witness for the current era. -> FilePath -- ^ Base directory path where the subdirectory with the intermediate files will be created. -> String -- ^ Name for the subdirectory that will be created for storing the intermediate files. -> String -- ^ Transaction id of the governance action to vote. diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedNoConfidenceDRep.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedNoConfidenceDRep.hs index 1311a84b5a3..e6af8af600d 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedNoConfidenceDRep.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedNoConfidenceDRep.hs @@ -302,7 +302,7 @@ makeUpdateConstitutionalCommitteeProposal execConfig epochStateView configuratio governanceActionTxId <- retrieveTransactionId execConfig signedProposalTx - !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex sbe (fromString governanceActionTxId)) + !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex ceo (fromString governanceActionTxId)) (unFile configurationFile) (unFile socketPath) (EpochNo 10) @@ -441,7 +441,7 @@ makeNoConfidenceProposal execConfig epochStateView configurationFile socketPath governanceActionTxId <- retrieveTransactionId execConfig signedProposalTx - !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex sbe (fromString governanceActionTxId)) + !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex ceo (fromString governanceActionTxId)) (unFile configurationFile) (unFile socketPath) (EpochNo 30) diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/ProposeNewConstitution.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/ProposeNewConstitution.hs index d5d62a23806..6a40ce33fe4 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/ProposeNewConstitution.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/ProposeNewConstitution.hs @@ -172,7 +172,7 @@ hprop_ledger_events_propose_new_constitution = H.integrationWorkspace "propose-n governanceActionTxId <- retrieveTransactionId execConfig signedProposalTx - !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex sbe (fromString governanceActionTxId)) + !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex ceo (fromString governanceActionTxId)) configurationFile socketPath (EpochNo 10) @@ -205,7 +205,7 @@ hprop_ledger_events_propose_new_constitution = H.integrationWorkspace "propose-n (File configurationFile) (File socketPath) FullValidation - (EpochNo 10) + (EpochNo 30) () (\epochState _ _ -> foldBlocksCheckConstitutionWasRatified constitutionHash constitutionScriptHash epochState)