Skip to content

Commit 75d996e

Browse files
committed
Comment out verification key from op cert issue counter
Doing this temporarily in order to support the old op cert issue counter file format.
1 parent db96b5e commit 75d996e

File tree

5 files changed

+47
-21
lines changed

5 files changed

+47
-21
lines changed

cardano-api/src/Cardano/Api/Typed.hs

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,9 @@ data OperationalCertificate =
867867
data OperationalCertificateIssueCounter =
868868
OperationalCertificateIssueCounter
869869
!Natural
870-
!(VerificationKey StakePoolKey) -- For consistency checking
870+
-- TODO: Commenting this out as we're temporarily supporting the old op
871+
-- cert issue counter format.
872+
-- !(VerificationKey StakePoolKey) -- For consistency checking
871873
deriving (Eq, Show)
872874
deriving anyclass SerialiseAsCBOR
873875

@@ -881,13 +883,20 @@ instance FromCBOR OperationalCertificate where
881883
return (OperationalCertificate ocert vkey)
882884

883885
instance ToCBOR OperationalCertificateIssueCounter where
884-
toCBOR (OperationalCertificateIssueCounter counter vkey) =
885-
toCBOR (counter, vkey)
886+
-- TODO: Commenting this out as we're temporarily supporting the old op
887+
-- cert issue counter format.
888+
-- toCBOR (OperationalCertificateIssueCounter counter vkey) =
889+
-- toCBOR (counter, vkey)
890+
toCBOR (OperationalCertificateIssueCounter counter) =
891+
toCBOR counter
886892

887893
instance FromCBOR OperationalCertificateIssueCounter where
888-
fromCBOR = do
889-
(counter, vkey) <- fromCBOR
890-
return (OperationalCertificateIssueCounter counter vkey)
894+
-- TODO: Commenting this out as we're temporarily supporting the old op
895+
-- cert issue counter format.
896+
-- fromCBOR = do
897+
-- (counter, vkey) <- fromCBOR
898+
-- return (OperationalCertificateIssueCounter counter vkey)
899+
fromCBOR = OperationalCertificateIssueCounter <$> fromCBOR
891900

892901
instance HasTypeProxy OperationalCertificate where
893902
data AsType OperationalCertificate = AsOperationalCertificate
@@ -929,13 +938,20 @@ issueOperationalCertificate :: VerificationKey KesKey
929938
issueOperationalCertificate (KesVerificationKey kesVKey)
930939
(StakePoolSigningKey poolSKey)
931940
kesPeriod
932-
(OperationalCertificateIssueCounter counter poolVKey)
933-
| poolVKey /= poolVKey'
934-
= Left (OperationalCertKeyMismatch poolVKey poolVKey')
935-
936-
| otherwise
937-
= Right (OperationalCertificate ocert poolVKey,
938-
OperationalCertificateIssueCounter (succ counter) poolVKey)
941+
-- TODO: Commenting this out as we're temporarily supporting the old op
942+
-- cert issue counter format.
943+
-- (OperationalCertificateIssueCounter counter poolVKey)
944+
(OperationalCertificateIssueCounter counter)
945+
-- TODO: Commenting this out as we're temporarily supporting the old op
946+
-- cert issue counter format.
947+
-- \| poolVKey /= poolVKey'
948+
-- = Left (OperationalCertKeyMismatch poolVKey poolVKey')
949+
--
950+
-- \| otherwise
951+
-- = Right (OperationalCertificate ocert poolVKey,
952+
-- OperationalCertificateIssueCounter (succ counter) poolVKey)
953+
= Right (OperationalCertificate ocert poolVKey',
954+
OperationalCertificateIssueCounter (succ counter))
939955
where
940956
poolVKey' = getVerificationKey (StakePoolSigningKey poolSKey)
941957

cardano-api/test/Test/Cardano/Api/Typed/Gen.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ genOperationalCertificateWithCounter = do
5959
kesP <- genKESPeriod
6060
c <- Gen.integral $ Range.linear 0 1000
6161
let stakePoolVer = getVerificationKey stakePoolSign
62-
iCounter = OperationalCertificateIssueCounter c stakePoolVer
62+
-- TODO: Commenting this out as we're temporarily supporting the old op
63+
-- cert issue counter format.
64+
-- iCounter = OperationalCertificateIssueCounter c stakePoolVer
65+
iCounter = OperationalCertificateIssueCounter c
6366

6467
case issueOperationalCertificate kesVKey stakePoolSign kesP iCounter of
6568
-- This case should be impossible as we clearly derive the verification

cardano-cli/src/Cardano/CLI/Shelley/Run/Genesis.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ import Control.Monad.Trans.Except.Extra (firstExceptT, handleIOExceptT
3333
import Cardano.Api hiding (writeAddress)
3434
import Cardano.Api.Typed (AsType (..), Error (..), FileError, Hash (..),
3535
OperationalCertificateIssueCounter (..), TextEnvelopeError,
36-
VerificationKey, VrfKey, castVerificationKey, generateSigningKey,
37-
getVerificationKey, readFileTextEnvelope, verificationKeyHash,
38-
writeFileTextEnvelope)
36+
VerificationKey, VrfKey, generateSigningKey, getVerificationKey,
37+
readFileTextEnvelope, verificationKeyHash, writeFileTextEnvelope)
3938

4039
import Ouroboros.Consensus.BlockchainTime (SystemStart (..))
4140
import Ouroboros.Consensus.Shelley.Protocol (TPraosStandardCrypto)
@@ -194,7 +193,9 @@ runGenesisKeyGenDelegate (VerificationKeyFile vkeyPath)
194193
$ writeFileTextEnvelope ocertCtrPath (Just ocertCtrDesc)
195194
$ OperationalCertificateIssueCounter
196195
initialCounter
197-
(castVerificationKey vkey) -- Cast to a 'StakePoolKey'
196+
-- TODO: Commenting this out as we're temporarily supporting the old op
197+
-- cert issue counter format.
198+
-- (castVerificationKey vkey) -- Cast to a 'StakePoolKey'
198199
where
199200
skeyDesc, vkeyDesc, ocertCtrDesc :: TextViewTitle
200201
skeyDesc = TextViewTitle "Genesis delegate operator key"

cardano-cli/src/Cardano/CLI/Shelley/Run/Node.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ runNodeKeyGenCold (VerificationKeyFile vkeyPath) (SigningKeyFile skeyPath)
7171
firstExceptT ShelleyNodeWriteFileError
7272
. newExceptT
7373
$ writeFileTextEnvelope ocertCtrPath (Just ocertCtrDesc)
74-
$ OperationalCertificateIssueCounter initialCounter vkey
74+
-- TODO: Commenting this out as we're temporarily supporting the old op
75+
-- cert issue counter format.
76+
-- \$ OperationalCertificateIssueCounter initialCounter vkey
77+
$ OperationalCertificateIssueCounter initialCounter
7578
where
7679
skeyDesc, vkeyDesc, ocertCtrDesc :: TextViewTitle
7780
skeyDesc = TextViewTitle "Stake Pool Operator Signing Key"
@@ -168,7 +171,10 @@ runNodeIssueOpCert (VerificationKeyFile vkeyKesPath)
168171
$ writeFileTextEnvelope certFile Nothing ocert
169172
where
170173
getCounter :: OperationalCertificateIssueCounter -> Natural
171-
getCounter (OperationalCertificateIssueCounter n _) = n
174+
-- TODO: Commenting this out as we're temporarily supporting the old op
175+
-- cert issue counter format.
176+
-- getCounter (OperationalCertificateIssueCounter n _) = n
177+
getCounter (OperationalCertificateIssueCounter n) = n
172178

173179
ocertCtrDesc :: Natural -> TextViewTitle
174180
ocertCtrDesc n = TextViewTitle $ "Next certificate issue number: " <> show n
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
type: Node operational certificate issue counter
22
title: Next certificate issue number: 6
33
cbor-hex:
4-
8206582074525f5cbbf5d3480459d3199fcd36aa8e29b1afa0d5bd67cf1b0495fe79bb13
4+
06

0 commit comments

Comments
 (0)