Skip to content

Commit

Permalink
Fixes required by rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Apr 29, 2024
1 parent 5e484d7 commit 06ef149
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
14 changes: 8 additions & 6 deletions cardano-testnet/src/Testnet/EpochStateProcessing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Control.Monad.Catch (MonadCatch)
import qualified Data.Aeson as Aeson
import qualified Data.Aeson.Lens as AL
import Data.ByteString.Lazy.Char8 (pack)
import Data.Data (Typeable)
import Data.String (fromString)
import qualified Data.Text as Text
import Data.Word (Word32)
Expand Down Expand Up @@ -198,7 +199,6 @@ desiredPoolNumberProposalTest
-> m (String, Word32)
desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo work prefix
wallet previousProposalInfo votes change expected epochsToWait = do
let sbe = conwayEraOnwardsToShelleyBasedEra ceo

baseDir <- H.createDirectoryIfMissing $ work </> prefix

Expand All @@ -210,7 +210,7 @@ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socket
makeDesiredPoolNumberChangeProposal execConfig epochStateView (File configurationFile) (File socketPath)
ceo baseDir "proposal" previousProposalInfo (fromIntegral change) wallet

voteChangeProposal execConfig epochStateView sbe baseDir "vote"
voteChangeProposal execConfig epochStateView ceo baseDir "vote"
governanceActionTxId governanceActionIndex propVotes [] wallet

(EpochNo epochAfterProp) <- getCurrentEpochNo epochStateView
Expand Down Expand Up @@ -298,7 +298,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)
Expand All @@ -313,10 +313,10 @@ makeDesiredPoolNumberChangeProposal execConfig epochStateView configurationFile

return (governanceActionTxId, governanceActionIndex)

voteChangeProposal :: (MonadTest m, MonadIO m, MonadCatch m, H.MonadAssertion m)
voteChangeProposal :: (Typeable era, MonadTest m, MonadIO m, MonadCatch m, H.MonadAssertion m)
=> H.ExecConfig
-> EpochStateView
-> ShelleyBasedEra ConwayEra
-> ConwayEraOnwards era
-> FilePath
-> FilePath
-> String
Expand All @@ -325,10 +325,11 @@ voteChangeProposal :: (MonadTest m, MonadIO m, MonadCatch m, H.MonadAssertion m)
-> [(String, Int)]
-> PaymentKeyInfo
-> m ()
voteChangeProposal execConfig epochStateView sbe work prefix governanceActionTxId governanceActionIndex drepVotes spoVotes wallet = do
voteChangeProposal execConfig epochStateView ceo work prefix governanceActionTxId governanceActionIndex drepVotes spoVotes wallet = do
baseDir <- H.createDirectoryIfMissing $ work </> prefix

let era = toCardanoEra sbe
let sbe = conwayEraOnwardsToShelleyBasedEra ceo
era = toCardanoEra sbe
cEra = AnyCardanoEra era

drepVoteFiles <- DRep.generateVoteFiles execConfig baseDir "drep-vote-files"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ updateConstitutionalCommittee
-> m (String, Word32)
updateConstitutionalCommittee execConfig epochStateView configurationFile socketPath ceo work prefix
wallet previousProposalInfo votes waitTillEpoch = do
let sbe = conwayEraOnwardsToShelleyBasedEra ceo

baseDir <- H.createDirectoryIfMissing $ work </> prefix

Expand All @@ -214,7 +213,7 @@ updateConstitutionalCommittee execConfig epochStateView configurationFile socket
makeUpdateConstitutionalCommitteeProposal execConfig epochStateView (File configurationFile) (File socketPath)
ceo baseDir "proposal" previousProposalInfo [coldKeyHash] wallet

voteChangeProposal execConfig epochStateView sbe baseDir "vote"
voteChangeProposal execConfig epochStateView ceo baseDir "vote"
governanceActionTxId governanceActionIndex propVotes (zip (repeat "yes") [1..3]) wallet

(EpochNo epochAfterProp) <- getCurrentEpochNo epochStateView
Expand Down Expand Up @@ -304,7 +303,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)
Expand Down Expand Up @@ -351,7 +350,7 @@ testNoConfidenceProposal
-> m (String, Word32)
testNoConfidenceProposal execConfig epochStateView configurationFile socketPath ceo work prefix
wallet previousProposalInfo votes waitTillEpoch = do
let sbe = conwayEraOnwardsToShelleyBasedEra ceo

baseDir <- H.createDirectoryIfMissing $ work </> prefix

let propVotes :: [(String, Int)]
Expand All @@ -362,7 +361,7 @@ testNoConfidenceProposal execConfig epochStateView configurationFile socketPath
makeNoConfidenceProposal execConfig epochStateView (File configurationFile) (File socketPath)
ceo baseDir "proposal" previousProposalInfo wallet

voteChangeProposal execConfig epochStateView sbe baseDir "vote"
voteChangeProposal execConfig epochStateView ceo baseDir "vote"
governanceActionTxId governanceActionIndex propVotes (zip (repeat "yes") [1..3]) wallet

(EpochNo epochAfterProp) <- getCurrentEpochNo epochStateView
Expand Down Expand Up @@ -444,7 +443,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 06ef149

Please sign in to comment.