-
Notifications
You must be signed in to change notification settings - Fork 720
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CLI test for creating genesis key delegation certificates
- Loading branch information
Showing
5 changed files
with
88 additions
and
13 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
13 changes: 0 additions & 13 deletions
13
...no-cli/test/Test/Golden/Shelley/TextEnvelope/Certificates/GenesisDelegationCertificate.hs
This file was deleted.
Oops, something went wrong.
79 changes: 79 additions & 0 deletions
79
...cli/test/Test/Golden/Shelley/TextEnvelope/Certificates/GenesisKeyDelegationCertificate.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,79 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Test.Golden.Shelley.TextEnvelope.Certificates.GenesisKeyDelegationCertificate | ||
( golden_shelleyGenesisKeyDelegationCertificate | ||
) where | ||
|
||
import Cardano.Prelude | ||
|
||
import Hedgehog (Property) | ||
|
||
import Cardano.Api.Typed (AsType (..), HasTextEnvelope (..)) | ||
|
||
import Test.OptParse | ||
|
||
{- HLINT ignore "Use camelCase" -} | ||
|
||
golden_shelleyGenesisKeyDelegationCertificate :: Property | ||
golden_shelleyGenesisKeyDelegationCertificate = | ||
propertyOnce . moduleWorkspace "tmp" $ \tempDir -> do | ||
-- Reference certificate | ||
referenceCertificateFilePath <- | ||
noteInputFile $ | ||
"test/data/golden/shelley/certificates/" | ||
<> "genesis_key_delegation_certificate" | ||
|
||
-- Verification key and certificate filepaths | ||
genesisVerKeyFilePath <- | ||
noteTempFile tempDir "genesis-verification-key-file" | ||
genesisDelegVerKeyFilePath <- | ||
noteTempFile tempDir "genesis-delegate-verification-key-file" | ||
vrfVerKeyFilePath <- noteTempFile tempDir "vrf-verification-key-file" | ||
genesisKeyDelegCertFilePath <- | ||
noteTempFile tempDir "genesis-key-delegation-certificate-file" | ||
|
||
-- Generate genesis key pair | ||
void $ execCardanoCLI | ||
[ "shelley","genesis","key-gen-genesis" | ||
, "--verification-key-file", genesisVerKeyFilePath | ||
, "--signing-key-file", "/dev/null" | ||
] | ||
|
||
-- Generate genesis delegate key pair | ||
void $ execCardanoCLI | ||
[ "shelley","genesis","key-gen-delegate" | ||
, "--verification-key-file", genesisDelegVerKeyFilePath | ||
, "--signing-key-file", "/dev/null" | ||
, "--operational-certificate-issue-counter-file", "/dev/null" | ||
] | ||
|
||
-- Generate VRF key pair | ||
void $ execCardanoCLI | ||
[ "shelley","node","key-gen-VRF" | ||
, "--verification-key-file", vrfVerKeyFilePath | ||
, "--signing-key-file", "/dev/null" | ||
] | ||
|
||
assertFilesExist | ||
[ genesisVerKeyFilePath | ||
, genesisDelegVerKeyFilePath | ||
, vrfVerKeyFilePath | ||
] | ||
|
||
-- Create genesis key delegation certificate | ||
void $ execCardanoCLI | ||
[ "shelley","governance","create-genesis-key-delegation-certificate" | ||
, "--genesis-verification-key-file", genesisVerKeyFilePath | ||
, "--genesis-delegate-verification-key-file", genesisDelegVerKeyFilePath | ||
, "--vrf-verification-key-file", vrfVerKeyFilePath | ||
, "--out-file", genesisKeyDelegCertFilePath | ||
] | ||
|
||
assertFilesExist [genesisKeyDelegCertFilePath] | ||
|
||
let certificateType = textEnvelopeType AsCertificate | ||
|
||
checkTextEnvelopeFormat | ||
certificateType | ||
referenceCertificateFilePath | ||
genesisKeyDelegCertFilePath |
5 changes: 5 additions & 0 deletions
5
cardano-cli/test/data/golden/shelley/certificates/genesis_key_delegation_certificate
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": "CertificateShelley", | ||
"description": "Genesis Key Delegation Certificate", | ||
"cborHex": "8405581cc3db461200fa59c81a4ecc8495446d9e42de27483ff6ee4339c9ab94581cd52ac434259f2af7fd2a538ece5ef8d80386527aa93e207473acb31c58201b9de69baec0dff8dde6e81d71f40f8b65fb3df55bb6ece5783aade88b17354d" | ||
} |