Skip to content

Commit

Permalink
Use SigningKey () instead of OfSigningKey and VerificationKey() inste…
Browse files Browse the repository at this point in the history
…ad of OfVerificationKey
  • Loading branch information
newhoggy committed Apr 18, 2023
1 parent 948bc61 commit e1e75c9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
36 changes: 18 additions & 18 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -838,16 +838,16 @@ createDelegateKeys :: FilePath -> Word -> ExceptT ShelleyGenesisCmdError IO ()
createDelegateKeys dir index = do
liftIO $ createDirectoryIfMissing False dir
runGenesisKeyGenDelegate
(File @OfVerificationKey $ dir </> "delegate" ++ strIndex ++ ".vkey")
(File @(VerificationKey ()) $ dir </> "delegate" ++ strIndex ++ ".vkey")
(onlyOut coldSK)
(onlyOut opCertCtr)
runGenesisKeyGenDelegateVRF
(File @OfVerificationKey $ dir </> "delegate" ++ strIndex ++ ".vrf.vkey")
(File @OfSigningKey $ dir </> "delegate" ++ strIndex ++ ".vrf.skey")
(File @(VerificationKey ()) $ dir </> "delegate" ++ strIndex ++ ".vrf.vkey")
(File @(SigningKey ()) $ dir </> "delegate" ++ strIndex ++ ".vrf.skey")
firstExceptT ShelleyGenesisCmdNodeCmdError $ do
runNodeKeyGenKES
(onlyOut kesVK)
(File @OfSigningKey $ dir </> "delegate" ++ strIndex ++ ".kes.skey")
(File @(SigningKey ()) $ dir </> "delegate" ++ strIndex ++ ".kes.skey")
runNodeIssueOpCert
(VerificationKeyFilePath (onlyIn kesVK))
(onlyIn coldSK)
Expand All @@ -856,39 +856,39 @@ createDelegateKeys dir index = do
(File $ dir </> "opcert" ++ strIndex ++ ".cert")
where
strIndex = show index
kesVK = File @OfVerificationKey $ dir </> "delegate" ++ strIndex ++ ".kes.vkey"
coldSK = File @OfSigningKey $ dir </> "delegate" ++ strIndex ++ ".skey"
kesVK = File @(VerificationKey ()) $ dir </> "delegate" ++ strIndex ++ ".kes.vkey"
coldSK = File @(SigningKey ()) $ dir </> "delegate" ++ strIndex ++ ".skey"
opCertCtr = File $ dir </> "delegate" ++ strIndex ++ ".counter"

createGenesisKeys :: FilePath -> Word -> ExceptT ShelleyGenesisCmdError IO ()
createGenesisKeys dir index = do
liftIO $ createDirectoryIfMissing False dir
let strIndex = show index
runGenesisKeyGenGenesis
(File @OfVerificationKey $ dir </> "genesis" ++ strIndex ++ ".vkey")
(File @OfSigningKey $ dir </> "genesis" ++ strIndex ++ ".skey")
(File @(VerificationKey ()) $ dir </> "genesis" ++ strIndex ++ ".vkey")
(File @(SigningKey ()) $ dir </> "genesis" ++ strIndex ++ ".skey")


createUtxoKeys :: FilePath -> Word -> ExceptT ShelleyGenesisCmdError IO ()
createUtxoKeys dir index = do
liftIO $ createDirectoryIfMissing False dir
let strIndex = show index
runGenesisKeyGenUTxO
(File @OfVerificationKey $ dir </> "utxo" ++ strIndex ++ ".vkey")
(File @OfSigningKey $ dir </> "utxo" ++ strIndex ++ ".skey")
(File @(VerificationKey ()) $ dir </> "utxo" ++ strIndex ++ ".vkey")
(File @(SigningKey ()) $ dir </> "utxo" ++ strIndex ++ ".skey")

createPoolCredentials :: FilePath -> Word -> ExceptT ShelleyGenesisCmdError IO ()
createPoolCredentials dir index = do
liftIO $ createDirectoryIfMissing False dir
firstExceptT ShelleyGenesisCmdNodeCmdError $ do
runNodeKeyGenKES
(onlyOut kesVK)
(File @OfSigningKey $ dir </> "kes" ++ strIndex ++ ".skey")
(File @(SigningKey ()) $ dir </> "kes" ++ strIndex ++ ".skey")
runNodeKeyGenVRF
(File @OfVerificationKey $ dir </> "vrf" ++ strIndex ++ ".vkey")
(File @OfSigningKey $ dir </> "vrf" ++ strIndex ++ ".skey")
(File @(VerificationKey ()) $ dir </> "vrf" ++ strIndex ++ ".vkey")
(File @(SigningKey ()) $ dir </> "vrf" ++ strIndex ++ ".skey")
runNodeKeyGenCold
(File @OfVerificationKey $ dir </> "cold" ++ strIndex ++ ".vkey")
(File @(VerificationKey ()) $ dir </> "cold" ++ strIndex ++ ".vkey")
(onlyOut coldSK)
(onlyOut opCertCtr)
runNodeIssueOpCert
Expand All @@ -899,12 +899,12 @@ createPoolCredentials dir index = do
(File $ dir </> "opcert" ++ strIndex ++ ".cert")
firstExceptT ShelleyGenesisCmdStakeAddressCmdError $
runStakeAddressKeyGenToFile
(File @OfVerificationKey $ dir </> "staking-reward" ++ strIndex ++ ".vkey")
(File @OfSigningKey $ dir </> "staking-reward" ++ strIndex ++ ".skey")
(File @(VerificationKey ()) $ dir </> "staking-reward" ++ strIndex ++ ".vkey")
(File @(SigningKey ()) $ dir </> "staking-reward" ++ strIndex ++ ".skey")
where
strIndex = show index
kesVK = File @OfVerificationKey $ dir </> "kes" ++ strIndex ++ ".vkey"
coldSK = File @OfSigningKey $ dir </> "cold" ++ strIndex ++ ".skey"
kesVK = File @(VerificationKey ()) $ dir </> "kes" ++ strIndex ++ ".vkey"
coldSK = File @(SigningKey ()) $ dir </> "cold" ++ strIndex ++ ".skey"
opCertCtr = File $ dir </> "opcert" ++ strIndex ++ ".counter"

data Delegation = Delegation
Expand Down
15 changes: 5 additions & 10 deletions cardano-cli/src/Cardano/CLI/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ module Cardano.CLI.Types
, CurrentKesPeriod (..)
, EpochLeadershipSchedule (..)
, GenesisFile (..)
, OfSigningKey
, OfVerificationKey
, OpCertEndingKesPeriod (..)
, OpCertIntervalInformation (..)
, OpCertOnDiskCounter (..)
Expand Down Expand Up @@ -57,8 +55,9 @@ import Data.Word (Word64)
import qualified Cardano.Chain.Slotting as Byron

import Cardano.Api (AddressAny, AnyScriptLanguage, EpochNo, ExecutionUnits, File (..),
FileDirection (..), Hash, HashableScriptData, PaymentKey, PolicyId, ScriptData,
SlotNo (SlotNo), TxId, TxIn, Value, WitCtxMint, WitCtxStake, WitCtxTxIn)
FileDirection (..), Hash, HashableScriptData, Key (..), PaymentKey, PolicyId,
ScriptData, SlotNo (SlotNo), TxId, TxIn, Value, WitCtxMint, WitCtxStake,
WitCtxTxIn)

import qualified Cardano.Ledger.Crypto as Crypto

Expand Down Expand Up @@ -227,16 +226,12 @@ instance Crypto.Crypto crypto => ToJSON (Params crypto) where
, "retiring" .= r
]

data OfSigningKey

type SigningKeyFile = File OfSigningKey
type SigningKeyFile = File (SigningKey ())

newtype UpdateProposalFile = UpdateProposalFile { unUpdateProposalFile :: FilePath }
deriving newtype (Eq, Show)

data OfVerificationKey

type VerificationKeyFile = File OfVerificationKey
type VerificationKeyFile = File (VerificationKey ())

newtype ScriptFile = ScriptFile { unScriptFile :: FilePath }
deriving (Eq, Show)
Expand Down

0 comments on commit e1e75c9

Please sign in to comment.