Skip to content

Commit

Permalink
Update to match with API refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Jan 10, 2025
1 parent 18fc533 commit 49e7fcc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ carryHashChecksWrapper
carryHashChecksWrapper checkHash anchor checkType =
firstExceptT (GovernanceActionsHashCheckError checkType) $
carryHashChecks
validateGovActionAnchorData
(validateGovActionAnchorData CIP108)
( PotentiallyCheckedAnchor
{ pcaMustCheck = checkHash
, pcaAnchor = anchor
Expand Down
5 changes: 2 additions & 3 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -117,7 +116,7 @@ runGovernanceDRepRegistrationCertificateCmd

mapM_
( withExceptT RegistrationDRepHashCheckError
. carryHashChecks (validateDRepAnchorData . DRepMetadata)
. carryHashChecks (validateGovActionAnchorData CIP119)
)
mAnchor

Expand Down Expand Up @@ -168,7 +167,7 @@ runGovernanceDRepUpdateCertificateCmd
conwayEraOnwardsConstraints w $ do
mapM_
( withExceptT GovernanceDRepHashCheckError
. carryHashChecks (validateDRepAnchorData . DRepMetadata)
. carryHashChecks (validateGovActionAnchorData CIP119)
)
mAnchor
drepCredential <- modifyError GovernanceCmdKeyReadError $ readDRepCredential drepHashSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ runGovernanceVoteCreateCmd

mapM_
( withExceptT GovernanceVoteCmdResignationCertHashCheckError
. carryHashChecks validateGovActionAnchorData
. carryHashChecks (validateGovActionAnchorData CIP108)
)
mAnchor'

Expand Down
11 changes: 5 additions & 6 deletions cardano-cli/src/Cardano/CLI/EraBased/Transaction/HashCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -43,7 +42,7 @@ checkCertificateHashes cert = do
(return mempty)
( checkAnchorMetadataHash
( if isDRepRegOrUpdateCert cert
then validateDRepAnchorData . Shelley.DRepMetadata
then validateGovActionAnchorData Shelley.CIP119
else const $ return ()
)
)
Expand All @@ -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
Expand All @@ -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.

0 comments on commit 49e7fcc

Please sign in to comment.