-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #652 from IntersectMBO/smelc/extend-key-verificati…
…on-key verification-key: support DRep keys as well as committee keys, extended or not
- Loading branch information
Showing
10 changed files
with
209 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/cc.extended.cold.vkey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "ConstitutionalCommitteeColdExtendedVerificationKey_ed25519_bip32", | ||
"description": "", | ||
"cborHex": "58400a9d35aa5299580a67b1e43a3a4b6d43ef29c94e56c51ce4c17e9a53c1d0f39aa7f68837c38ef680b2dc8f047581707a32f6fcade23d4e02177d389002484798" | ||
} |
5 changes: 5 additions & 0 deletions
5
cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/cc.extended.hot.vkey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "ConstitutionalCommitteeHotExtendedVerificationKey_ed25519_bip32", | ||
"description": "", | ||
"cborHex": "5840f010c4332699c6ea1e43b427919860277169382d43d2969b28a110cfa08d955c4f178f20955541ce918a6a1352c32536f22677008f9f918d109663e4d2bdc084" | ||
} |
5 changes: 5 additions & 0 deletions
5
cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep-extended.vkey.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "DRepExtendedVerificationKey_ed25519_bip32", | ||
"description": "", | ||
"cborHex": "5840b18eacea2003b68e39137545e9d42ce5bca133ca0334d6a75aa9cb1fd02be7ec90e91f5357e2c68949f0f09717c5b9809b6a74d5f87ea35383c82841f2357564" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
cardano-cli/test/cardano-cli-test/Test/Cli/VerificationKey.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
-- | Tests of the command "key verification-key", in particular tests of | ||
-- https://github.com/IntersectMBO/cardano-cli/issues/651 | ||
module Test.Cli.VerificationKey where | ||
|
||
import Control.Monad.Catch (MonadCatch) | ||
import Control.Monad.IO.Class (MonadIO) | ||
import GHC.Stack (HasCallStack) | ||
import qualified GHC.Stack as GHC | ||
|
||
import Test.Cardano.CLI.Aeson (assertEqualModuloDesc) | ||
import Test.Cardano.CLI.Util | ||
|
||
import Hedgehog (MonadTest, Property) | ||
import qualified Hedgehog.Extras.Test.Base as H | ||
|
||
-- | Execute me with: | ||
-- @cabal test cardano-cli-test --test-options '-p "/verification key drep/"'@ | ||
hprop_verification_key_drep :: Property | ||
hprop_verification_key_drep = | ||
propertyOnce . H.moduleWorkspace "tmp" $ runOne ["drep", "key-gen"] | ||
|
||
-- | Execute me with: | ||
-- @cabal test cardano-cli-test --test-options '-p "/verification key committee hot/"'@ | ||
hprop_verification_key_committee_hot :: Property | ||
hprop_verification_key_committee_hot = | ||
propertyOnce . H.moduleWorkspace "tmp" $ runOne ["committee", "key-gen-hot"] | ||
|
||
-- | Execute me with: | ||
-- @cabal test cardano-cli-test --test-options '-p "/verification key committee cold/"'@ | ||
hprop_verification_key_committee_cold :: Property | ||
hprop_verification_key_committee_cold = | ||
propertyOnce . H.moduleWorkspace "tmp" $ runOne ["committee", "key-gen-cold"] | ||
|
||
runOne :: () | ||
=> (HasCallStack, MonadCatch m, MonadIO m, MonadTest m) | ||
=> [String] -- ^ The piece of the command to generate the keys | ||
-> FilePath -- ^ The temporary directory, i.e. where the test is allowed to generate files | ||
-> m () | ||
runOne cmd tempDir = GHC.withFrozenCallStack $ do | ||
verificationKeyFile <- noteTempFile tempDir "gen.vkey" | ||
signingKeyFile <- noteTempFile tempDir "gen.skey" | ||
verificationKeyFileOut <- noteTempFile tempDir "vkey.out" | ||
|
||
H.noteM_ $ execCardanoCLI $ | ||
[ "conway", "governance" ] | ||
++ cmd ++ | ||
[ "--verification-key-file", verificationKeyFile | ||
, "--signing-key-file", signingKeyFile | ||
] | ||
|
||
H.noteM_ $ execCardanoCLI | ||
[ "conway", "key", "verification-key" | ||
, "--signing-key-file", signingKeyFile | ||
, "--verification-key-file", verificationKeyFileOut | ||
] | ||
|
||
assertEqualModuloDesc verificationKeyFile verificationKeyFileOut |