Skip to content

Commit 3f9e62b

Browse files
committed
Add test for creating registration certificate using literal extended cold key
1 parent b468c43 commit 3f9e62b

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/StakePool/RegistrationCertificate.hs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22

33
module Test.Golden.Shelley.StakePool.RegistrationCertificate where
44

5+
import Cardano.Api
6+
( AsType (AsStakePoolExtendedKey, AsVerificationKey)
7+
, File (File)
8+
, liftIO
9+
, readFileTextEnvelope
10+
, serialiseToBech32
11+
)
12+
513
import Control.Monad (void)
14+
import Data.Text qualified as Text
615

716
import Test.Cardano.CLI.Util
817

918
import Hedgehog (Property)
19+
import Hedgehog qualified as H
1020
import Hedgehog.Extras.Test.Base qualified as H
1121
import Hedgehog.Extras.Test.Golden qualified as H
1222

@@ -89,3 +99,47 @@ hprop_golden_conway_stake_pool_registration_certificate_extended_cold_key = prop
8999
goldenFile <- H.note "test/cardano-cli-golden/files/golden/shelley/reg-certificate-extended.json"
90100

91101
H.diffFileVsGoldenFile registrationCertFile goldenFile
102+
103+
hprop_golden_conway_stake_pool_registration_certificate_extended_literal_cold_key :: Property
104+
hprop_golden_conway_stake_pool_registration_certificate_extended_literal_cold_key = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
105+
operatorVerificationKeyFile <-
106+
noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/extended-operator.vkey"
107+
vrfVerificationKeyFile <-
108+
noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/vrf.vkey"
109+
ownerVerificationKeyFile <-
110+
noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/owner.vkey"
111+
registrationCertFile <- noteTempFile tempDir "registration.cert"
112+
113+
stakePoolExtendedKey <-
114+
H.evalEitherM $
115+
liftIO $
116+
readFileTextEnvelope (AsVerificationKey AsStakePoolExtendedKey) (File operatorVerificationKeyFile)
117+
118+
void $
119+
execCardanoCLI
120+
[ "conway"
121+
, "stake-pool"
122+
, "registration-certificate"
123+
, "--testnet-magic"
124+
, "42"
125+
, "--pool-pledge"
126+
, "0"
127+
, "--pool-cost"
128+
, "0"
129+
, "--pool-margin"
130+
, "0"
131+
, "--stake-pool-verification-extended-key"
132+
, Text.unpack $ serialiseToBech32 stakePoolExtendedKey
133+
, "--vrf-verification-key-file"
134+
, vrfVerificationKeyFile
135+
, "--pool-reward-account-verification-key-file"
136+
, ownerVerificationKeyFile
137+
, "--pool-owner-stake-verification-key-file"
138+
, ownerVerificationKeyFile
139+
, "--out-file"
140+
, registrationCertFile
141+
]
142+
143+
goldenFile <- H.note "test/cardano-cli-golden/files/golden/shelley/reg-certificate-extended.json"
144+
145+
H.diffFileVsGoldenFile registrationCertFile goldenFile

0 commit comments

Comments
 (0)