From 49e7fcc65a909312e952543619e6d5877f60f3b9 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Fri, 10 Jan 2025 15:59:39 +0100 Subject: [PATCH] Update to match with API refactoring --- cabal.project | 4 ++-- .../Cardano/CLI/EraBased/Run/Governance/Actions.hs | 2 +- .../src/Cardano/CLI/EraBased/Run/Governance/DRep.hs | 5 ++--- .../src/Cardano/CLI/EraBased/Run/Governance/Vote.hs | 2 +- .../src/Cardano/CLI/EraBased/Transaction/HashCheck.hs | 11 +++++------ 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/cabal.project b/cabal.project index 53b954aac6..fb640265d4 100644 --- a/cabal.project +++ b/cabal.project @@ -23,8 +23,8 @@ source-repository-package type: git location: https://github.com/IntersectMBO/cardano-api subdir: cardano-api - tag: 4168561fc05d522c51e0c764647fd752b42344f4 - --sha256: sha256-zZ/Cpbyoi1ZdTwPUXTXbRtIVvKGkkXkl6Ma4rKGnjUE= + tag: c38afa8b9007944c865ef6251aa6c8b564d6273a + --sha256: sha256-mkyiXCs69q31QSxWhF99wOTK8WadMtpJSfJ+Z3bFdbg= program-options ghc-options: -Werror diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index ec1532a67c..a476f845bb 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -525,7 +525,7 @@ carryHashChecksWrapper carryHashChecksWrapper checkHash anchor checkType = firstExceptT (GovernanceActionsHashCheckError checkType) $ carryHashChecks - validateGovActionAnchorData + (validateGovActionAnchorData CIP108) ( PotentiallyCheckedAnchor { pcaMustCheck = checkHash , pcaAnchor = anchor diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs index dbcf574874..663584b133 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs @@ -17,7 +17,6 @@ where import Cardano.Api import qualified Cardano.Api.Ledger as L -import Cardano.Api.Shelley (DRepMetadata (DRepMetadata)) import qualified Cardano.CLI.Commands.Hash as Cmd import qualified Cardano.CLI.EraBased.Commands.Governance.DRep as Cmd @@ -117,7 +116,7 @@ runGovernanceDRepRegistrationCertificateCmd mapM_ ( withExceptT RegistrationDRepHashCheckError - . carryHashChecks (validateDRepAnchorData . DRepMetadata) + . carryHashChecks (validateGovActionAnchorData CIP119) ) mAnchor @@ -168,7 +167,7 @@ runGovernanceDRepUpdateCertificateCmd conwayEraOnwardsConstraints w $ do mapM_ ( withExceptT GovernanceDRepHashCheckError - . carryHashChecks (validateDRepAnchorData . DRepMetadata) + . carryHashChecks (validateGovActionAnchorData CIP119) ) mAnchor drepCredential <- modifyError GovernanceCmdKeyReadError $ readDRepCredential drepHashSource diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs index 55a3e51564..fc0207dfd5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs @@ -65,7 +65,7 @@ runGovernanceVoteCreateCmd mapM_ ( withExceptT GovernanceVoteCmdResignationCertHashCheckError - . carryHashChecks validateGovActionAnchorData + . carryHashChecks (validateGovActionAnchorData CIP108) ) mAnchor' diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Transaction/HashCheck.hs b/cardano-cli/src/Cardano/CLI/EraBased/Transaction/HashCheck.hs index 2fcfd3705c..659e8739ab 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Transaction/HashCheck.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Transaction/HashCheck.hs @@ -9,8 +9,7 @@ where import Cardano.Api (Certificate (..), ExceptT, except, firstExceptT, getAnchorDataFromCertificate, getAnchorDataFromGovernanceAction, - isDRepRegOrUpdateCert, validateDRepAnchorData, validateGovActionAnchorData, - withExceptT) + isDRepRegOrUpdateCert, validateGovActionAnchorData, withExceptT) import qualified Cardano.Api.Ledger as L import qualified Cardano.Api.Shelley as Shelley @@ -43,7 +42,7 @@ checkCertificateHashes cert = do (return mempty) ( checkAnchorMetadataHash ( if isDRepRegOrUpdateCert cert - then validateDRepAnchorData . Shelley.DRepMetadata + then validateGovActionAnchorData Shelley.CIP119 else const $ return () ) ) @@ -58,7 +57,7 @@ checkVotingProcedureHashes eon (Shelley.VotingProcedures (L.VotingProcedures vot forM_ voterMap ( mapM $ \(L.VotingProcedure _ mAnchor) -> - forM_ mAnchor $ checkAnchorMetadataHash validateGovActionAnchorData + forM_ mAnchor $ checkAnchorMetadataHash $ validateGovActionAnchorData Shelley.CIP108 ) -- | Find references to anchor data in proposals and check the hashes are valid @@ -75,10 +74,10 @@ checkProposalHashes ) ) = Shelley.shelleyBasedEraConstraints eon $ do - checkAnchorMetadataHash validateGovActionAnchorData anchor + checkAnchorMetadataHash (validateGovActionAnchorData Shelley.CIP108) anchor maybe (return ()) - (checkAnchorMetadataHash validateGovActionAnchorData) + (checkAnchorMetadataHash $ validateGovActionAnchorData Shelley.CIP108) (getAnchorDataFromGovernanceAction govAction) -- Only the `NewConstitution` governance action contains a checkable hash with a corresponding URL.