Skip to content

Commit acff3e2

Browse files
committed
cardano-testnet | replace StakingKey & SpoColdKey types with their cardano-api counterparts
1 parent 08e3294 commit acff3e2

File tree

6 files changed

+16
-19
lines changed

6 files changed

+16
-19
lines changed

cardano-testnet/src/Testnet/Defaults.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ defaultSpoKeysDir n = "pools-keys" </> defaultSpoName n
501501
-- | The relative path to SPO keys in directories created by cardano-testnet
502502
defaultSpoColdKeyPair
503503
:: Int
504-
-> KeyPair SpoColdKey
504+
-> KeyPair StakePoolKey
505505
defaultSpoColdKeyPair n =
506506
KeyPair
507507
{ verificationKey = File $ defaultSpoKeysDir n </> "cold.vkey"
@@ -526,7 +526,7 @@ defaultSpoKeys n =
526526
}
527527

528528
-- | The relative path to stake delegator key pairs in directories created by cardano-testnet
529-
defaultDelegatorStakeKeyPair :: Int -> KeyPair StakingKey
529+
defaultDelegatorStakeKeyPair :: Int -> KeyPair StakeKey
530530
defaultDelegatorStakeKeyPair n =
531531
KeyPair
532532
{ verificationKey = File $ "stake-delegators" </> ("delegator" <> show n) </> "staking.vkey"

cardano-testnet/src/Testnet/Process/Cli/DRep.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ delegateToDRep
264264
-> FilePath -- ^ Base directory path where generated files will be stored.
265265
-> String -- ^ Name for the subfolder that will be created under 'work' folder.
266266
-> PaymentKeyInfo -- ^ Wallet that will pay for the transaction.
267-
-> KeyPair StakingKey -- ^ Staking key pair used for delegation.
267+
-> KeyPair StakeKey -- ^ Staking key pair used for delegation.
268268
-> KeyPair PaymentKey -- ^ Delegate Representative (DRep) key pair ('PaymentKeyPair') to which delegate.
269269
-> m ()
270270
delegateToDRep execConfig epochStateView sbe work prefix

cardano-testnet/src/Testnet/Process/Cli/Keys.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ module Testnet.Process.Cli.Keys
1818
, cliByronSigningKeyAddress
1919
) where
2020

21-
import Cardano.Api (ByronAddr, ByronKeyLegacy, File (..), FileDirection (..), StakeKey)
22-
import Cardano.Api.Shelley (KesKey, StakePoolKey)
21+
import Cardano.Api (ByronAddr, ByronKeyLegacy, File (..), FileDirection (..))
2322

2423
import Control.Monad.Catch (MonadCatch)
2524
import Control.Monad.IO.Class (MonadIO)

cardano-testnet/src/Testnet/Types.hs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ module Testnet.Types
3030
, VKey
3131
, SKey
3232
, VrfKey
33-
, StakingKey
33+
, StakePoolKey
34+
, StakeKey
3435
, PaymentKey
36+
, KesKey
3537
, DRepKey
36-
, SpoColdKey
3738
, readNodeLoggingFormat
3839
, ShelleyGenesis(..)
3940
, shelleyGenesis
@@ -44,7 +45,7 @@ module Testnet.Types
4445

4546
import Cardano.Api
4647
import Cardano.Api.Experimental (Some (..))
47-
import Cardano.Api.Shelley (VrfKey)
48+
import Cardano.Api.Shelley (KesKey, StakePoolKey, VrfKey)
4849

4950
import qualified Cardano.Chain.Genesis as G
5051
import Cardano.Crypto.ProtocolMagic (RequiresNetworkMagic (..))
@@ -91,10 +92,10 @@ instance MonoFunctor (KeyPair k) where
9192
deriving instance Show (KeyPair k)
9293
deriving instance Eq (KeyPair k)
9394

94-
instance {-# OVERLAPPING #-} Show (Some KeyPair) where
95+
instance Show (Some KeyPair) where
9596
show (Some kp) = show kp
9697

97-
instance {-# OVERLAPPING #-} Eq (Some KeyPair) where
98+
instance Eq (Some KeyPair) where
9899
(Some KeyPair{verificationKey=File vk1, signingKey=File sk1})
99100
== (Some KeyPair{verificationKey=File vk2, signingKey=File sk2}) =
100101
vk1 == vk2 && sk1 == sk2
@@ -147,13 +148,10 @@ isTestnetNodeSpo = isJust . poolKeys
147148
nodeSocketPath :: TestnetNode -> SocketPath
148149
nodeSocketPath = File . H.sprocketSystemName . nodeSprocket
149150

150-
data StakingKey
151-
data SpoColdKey
152-
153151
data SpoNodeKeys = SpoNodeKeys
154-
{ poolNodeKeysCold :: KeyPair SpoColdKey
152+
{ poolNodeKeysCold :: KeyPair StakePoolKey
155153
, poolNodeKeysVrf :: KeyPair VrfKey
156-
, poolNodeKeysStaking :: KeyPair StakingKey
154+
, poolNodeKeysStaking :: KeyPair StakeKey
157155
} deriving (Eq, Show)
158156

159157
type instance Element SpoNodeKeys = FilePath
@@ -167,7 +165,7 @@ data PaymentKeyInfo = PaymentKeyInfo
167165

168166
data Delegator = Delegator
169167
{ paymentKeyPair :: KeyPair PaymentKey
170-
, stakingKeyPair :: KeyPair StakingKey
168+
, stakingKeyPair :: KeyPair StakeKey
171169
} deriving (Eq, Show)
172170

173171
data LeadershipSlot = LeadershipSlot

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Cardano.Api.Internal.Genesis as Api
1919
import Cardano.Api.Ledger (Coin (Coin), EpochInterval (EpochInterval), extractHash,
2020
unboundRational)
2121
import qualified Cardano.Api.Ledger as L
22-
import Cardano.Api.Shelley (StakeCredential (StakeCredentialByKey), StakePoolKey)
22+
import Cardano.Api.Shelley (StakeCredential (StakeCredentialByKey))
2323

2424
import Cardano.CLI.Type.Key (VerificationKeyOrFile (VerificationKeyFilePath),
2525
readVerificationKeyOrFile)

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PredefinedAbstainDRep.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import qualified Testnet.Process.Run as H
4343
import qualified Testnet.Property.Util as H
4444
import Testnet.Start.Types
4545
import Testnet.Types (KeyPair (..),
46-
PaymentKeyInfo (paymentKeyInfoAddr, paymentKeyInfoPair), StakingKey)
46+
PaymentKeyInfo (paymentKeyInfoAddr, paymentKeyInfoPair))
4747

4848
import Hedgehog
4949
import qualified Hedgehog.Extras as H
@@ -133,7 +133,7 @@ delegateToAlwaysAbstain
133133
-> FilePath -- ^ Base directory path where generated files will be stored.
134134
-> String -- ^ Name for the subfolder that will be created under 'work' folder.
135135
-> PaymentKeyInfo -- ^ Wallet that will pay for the transaction.
136-
-> KeyPair StakingKey -- ^ Staking key pair used for delegation.
136+
-> KeyPair StakeKey -- ^ Staking key pair used for delegation.
137137
-> m ()
138138
delegateToAlwaysAbstain execConfig epochStateView sbe work prefix
139139
payingWallet skeyPair@(KeyPair vKeyFile _sKeyFile) = do

0 commit comments

Comments
 (0)