Skip to content

Commit

Permalink
committee key-hash: test extended CC keys
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Apr 15, 2024
1 parent 9c6fbff commit bc91dfa
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

{- HLINT ignore "Use camelCase" -}
Expand All @@ -8,9 +9,11 @@ import Control.Monad (forM_, void)
import System.FilePath ((</>))

import Test.Cardano.CLI.Aeson (assertHasMappings)
import qualified Test.Cardano.CLI.Util as H hiding (noteTempFile)
import Test.Cardano.CLI.Util

import Hedgehog (Property)
import qualified Hedgehog as H
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.Golden as H

Expand Down Expand Up @@ -205,3 +208,21 @@ hprop_golden_verification_key_committee = do
]

H.diffFileVsGoldenFile vkeyFileOut vkeyGolden

-- | Execute me with:
-- @cabal test cardano-cli-golden --test-options '-p "/golden governance extended committee key hash/"'@
hprop_golden_governance_extended_committee_key_hash :: Property
hprop_golden_governance_extended_committee_key_hash =
let supplyValues = [ (inputDir </> "governance/committee/cc.extended.cold.vkey", "9fe92405abcd903d34e21a97328e7cd222eebd4ced5995a95777f7a3\n")
, (inputDir </> "governance/committee/cc.extended.hot.vkey", "4eb7202ffcc6d5513dba5edc618bd7b582a257c76d6b0cd83975f4e6\n")
] in
propertyOnce $ forM_ supplyValues $ \(extendedKeyFile, expected) ->
H.moduleWorkspace "tmp" $ \_tempDir -> do
verificationKeyFile <- H.noteInputFile extendedKeyFile

result <- execCardanoCLI
[ "conway", "governance", "committee", "key-hash"
, "--verification-key-file", verificationKeyFile
]

result H.=== expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeColdExtendedVerificationKey_ed25519_bip32",
"description": "",
"cborHex": "58400a9d35aa5299580a67b1e43a3a4b6d43ef29c94e56c51ce4c17e9a53c1d0f39aa7f68837c38ef680b2dc8f047581707a32f6fcade23d4e02177d389002484798"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeHotExtendedVerificationKey_ed25519_bip32",
"description": "",
"cborHex": "5840f010c4332699c6ea1e43b427919860277169382d43d2969b28a110cfa08d955c4f178f20955541ce918a6a1352c32536f22677008f9f918d109663e4d2bdc084"
}

0 comments on commit bc91dfa

Please sign in to comment.