@@ -51,7 +51,7 @@ import Cardano.Ledger.Credential (
5151 Ptr (.. ),
5252 StakeReference (.. ),
5353 )
54- import qualified Cardano.Ledger.Crypto as CC (Crypto )
54+ import Cardano.Ledger.Crypto (Crypto )
5555import Cardano.Ledger.Keys (
5656 Hash ,
5757 KeyRole (.. ),
@@ -67,12 +67,14 @@ import Cardano.Ledger.Shelley.TxBody (
6767import Cardano.Ledger.Slot (SlotNo (.. ))
6868import Cardano.Protocol.TPraos.OCert (KESPeriod (.. ))
6969import qualified Data.ByteString.Char8 as BS (pack )
70+ import qualified Data.List.NonEmpty as NE
7071import Data.Maybe (fromJust )
7172import qualified Data.Sequence.Strict as StrictSeq
7273import qualified Data.Set as Set
7374import Test.Cardano.Ledger.Core.KeyPair (KeyPair (.. ), mkAddr )
7475import Test.Cardano.Ledger.Shelley.Generator.Core (
7576 AllIssuerKeys (.. ),
77+ VRFKeyPair (.. ),
7678 )
7779import Test.Cardano.Ledger.Shelley.Utils (
7880 RawSeed (.. ),
@@ -83,50 +85,50 @@ import Test.Cardano.Ledger.Shelley.Utils (
8385 )
8486
8587-- | Alice's payment key pair
86- alicePay :: CC. Crypto c => KeyPair 'Payment c
88+ alicePay :: Crypto c => KeyPair 'Payment c
8789alicePay = KeyPair vk sk
8890 where
8991 (sk, vk) = mkKeyPair (RawSeed 0 0 0 0 0 )
9092
9193-- | Alice's stake key pair
92- aliceStake :: CC. Crypto c => KeyPair 'Staking c
94+ aliceStake :: Crypto c => KeyPair 'Staking c
9395aliceStake = KeyPair vk sk
9496 where
9597 (sk, vk) = mkKeyPair (RawSeed 1 1 1 1 1 )
9698
9799-- | Alice's stake pool keys (cold keys, VRF keys, hot KES keys)
98- alicePoolKeys :: CC. Crypto c => AllIssuerKeys c 'StakePool
100+ alicePoolKeys :: Crypto c => AllIssuerKeys c 'StakePool
99101alicePoolKeys =
100102 AllIssuerKeys
101103 (KeyPair vkCold skCold)
102104 (mkVRFKeyPair (RawSeed 1 0 0 0 2 ))
103- [( KESPeriod 0 , mkKESKeyPair (RawSeed 1 0 0 0 3 ))]
105+ (( KESPeriod 0 , mkKESKeyPair (RawSeed 1 0 0 0 3 )) NE. :| [] )
104106 (hashKey vkCold)
105107 where
106108 (skCold, vkCold) = mkKeyPair (RawSeed 1 0 0 0 1 )
107109
108110-- | Alice's base address
109- aliceAddr :: CC. Crypto c => Addr c
111+ aliceAddr :: Crypto c => Addr c
110112aliceAddr = mkAddr (alicePay, aliceStake)
111113
112114-- | Alice's payment credential
113- alicePHK :: CC. Crypto c => Credential 'Payment c
115+ alicePHK :: Crypto c => Credential 'Payment c
114116alicePHK = (KeyHashObj . hashKey . vKey) alicePay
115117
116118-- | Alice's stake credential
117- aliceSHK :: CC. Crypto c => Credential 'Staking c
119+ aliceSHK :: Crypto c => Credential 'Staking c
118120aliceSHK = (KeyHashObj . hashKey . vKey) aliceStake
119121
120122-- | Alice's base address
121- alicePtrAddr :: CC. Crypto c => Addr c
123+ alicePtrAddr :: Crypto c => Addr c
122124alicePtrAddr = Addr Testnet alicePHK (StakeRefPtr $ Ptr (SlotNo 10 ) minBound minBound )
123125
124126-- | Alice's stake pool parameters
125- alicePoolParams :: forall c . CC. Crypto c => PoolParams c
127+ alicePoolParams :: forall c . Crypto c => PoolParams c
126128alicePoolParams =
127129 PoolParams
128- { ppId = ( hashKey . vKey . cold) alicePoolKeys
129- , ppVrf = hashVerKeyVRF . snd $ vrf (alicePoolKeys @ c )
130+ { ppId = hashKey . vKey $ aikCold alicePoolKeys
131+ , ppVrf = hashVerKeyVRF . vrfVerKey $ aikVrf (alicePoolKeys @ c )
130132 , ppPledge = Coin 1
131133 , ppCost = Coin 5
132134 , ppMargin = unsafeBoundRational 0.1
@@ -144,99 +146,99 @@ alicePoolParams =
144146-- | Alice's VRF key hash
145147aliceVRFKeyHash ::
146148 forall c .
147- CC. Crypto c =>
149+ Crypto c =>
148150 Hash c (VerKeyVRF c )
149- aliceVRFKeyHash = hashVerKeyVRF (snd $ vrf (alicePoolKeys @ c ))
151+ aliceVRFKeyHash = hashVerKeyVRF (vrfVerKey $ aikVrf (alicePoolKeys @ c ))
150152
151153-- | Bob's payment key pair
152- bobPay :: CC. Crypto c => KeyPair 'Payment c
154+ bobPay :: Crypto c => KeyPair 'Payment c
153155bobPay = KeyPair vk sk
154156 where
155157 (sk, vk) = mkKeyPair (RawSeed 2 2 2 2 2 )
156158
157159-- | Bob's stake key pair
158- bobStake :: CC. Crypto c => KeyPair 'Staking c
160+ bobStake :: Crypto c => KeyPair 'Staking c
159161bobStake = KeyPair vk sk
160162 where
161163 (sk, vk) = mkKeyPair (RawSeed 3 3 3 3 3 )
162164
163165-- | Bob's address
164- bobAddr :: CC. Crypto c => Addr c
166+ bobAddr :: Crypto c => Addr c
165167bobAddr = mkAddr (bobPay, bobStake)
166168
167169-- | Bob's stake credential
168- bobSHK :: CC. Crypto c => Credential 'Staking c
170+ bobSHK :: Crypto c => Credential 'Staking c
169171bobSHK = (KeyHashObj . hashKey . vKey) bobStake
170172
171173-- | Bob's stake pool keys (cold keys, VRF keys, hot KES keys)
172- bobPoolKeys :: CC. Crypto c => AllIssuerKeys c 'StakePool
174+ bobPoolKeys :: Crypto c => AllIssuerKeys c 'StakePool
173175bobPoolKeys =
174176 AllIssuerKeys
175177 (KeyPair vkCold skCold)
176178 (mkVRFKeyPair (RawSeed 2 0 0 0 2 ))
177- [( KESPeriod 0 , mkKESKeyPair (RawSeed 2 0 0 0 3 ))]
179+ (( KESPeriod 0 , mkKESKeyPair (RawSeed 2 0 0 0 3 )) NE. :| [] )
178180 (hashKey vkCold)
179181 where
180182 (skCold, vkCold) = mkKeyPair (RawSeed 2 0 0 0 1 )
181183
182184-- | Bob's stake pool parameters
183- bobPoolParams :: forall c . CC. Crypto c => PoolParams c
185+ bobPoolParams :: forall c . Crypto c => PoolParams c
184186bobPoolParams =
185187 PoolParams
186- { ppId = ( hashKey . vKey . cold) bobPoolKeys
187- , ppVrf = hashVerKeyVRF . snd $ vrf (bobPoolKeys @ c )
188+ { ppId = hashKey . vKey $ aikCold bobPoolKeys
189+ , ppVrf = hashVerKeyVRF . vrfVerKey $ aikVrf (bobPoolKeys @ c )
188190 , ppPledge = Coin 2
189191 , ppCost = Coin 1
190192 , ppMargin = unsafeBoundRational 0.1
191193 , ppRewardAcnt = RewardAcnt Testnet bobSHK
192- , ppOwners = Set. singleton $ ( hashKey . vKey) bobStake
194+ , ppOwners = Set. singleton $ hashKey ( vKey bobStake)
193195 , ppRelays = StrictSeq. empty
194196 , ppMetadata = SNothing
195197 }
196198
197199-- | Bob's VRF key hash
198200bobVRFKeyHash ::
199201 forall c .
200- CC. Crypto c =>
202+ Crypto c =>
201203 Hash c (VerKeyVRF c )
202- bobVRFKeyHash = hashVerKeyVRF (snd $ vrf (bobPoolKeys @ c ))
204+ bobVRFKeyHash = hashVerKeyVRF (vrfVerKey $ aikVrf (bobPoolKeys @ c ))
203205
204206-- Carl's payment key pair
205- carlPay :: CC. Crypto c => KeyPair 'Payment c
207+ carlPay :: Crypto c => KeyPair 'Payment c
206208carlPay = KeyPair vk sk
207209 where
208210 (sk, vk) = mkKeyPair (RawSeed 4 4 4 4 4 )
209211
210212-- | Carl's stake key pair
211- carlStake :: CC. Crypto c => KeyPair 'Staking c
213+ carlStake :: Crypto c => KeyPair 'Staking c
212214carlStake = KeyPair vk sk
213215 where
214216 (sk, vk) = mkKeyPair (RawSeed 5 5 5 5 5 )
215217
216218-- | Carl's address
217- carlAddr :: CC. Crypto c => Addr c
219+ carlAddr :: Crypto c => Addr c
218220carlAddr = mkAddr (carlPay, carlStake)
219221
220222-- | Carl's stake credential
221- carlSHK :: CC. Crypto c => Credential 'Staking c
223+ carlSHK :: Crypto c => Credential 'Staking c
222224carlSHK = (KeyHashObj . hashKey . vKey) carlStake
223225
224226-- | Daria's payment key pair
225- dariaPay :: CC. Crypto c => KeyPair 'Payment c
227+ dariaPay :: Crypto c => KeyPair 'Payment c
226228dariaPay = KeyPair vk sk
227229 where
228230 (sk, vk) = mkKeyPair (RawSeed 6 6 6 6 6 )
229231
230232-- | Daria's stake key pair
231- dariaStake :: CC. Crypto c => KeyPair 'Staking c
233+ dariaStake :: Crypto c => KeyPair 'Staking c
232234dariaStake = KeyPair vk sk
233235 where
234236 (sk, vk) = mkKeyPair (RawSeed 7 7 7 7 7 )
235237
236238-- | Daria's address
237- dariaAddr :: CC. Crypto c => Addr c
239+ dariaAddr :: Crypto c => Addr c
238240dariaAddr = mkAddr (dariaPay, dariaStake)
239241
240242-- | Daria's stake credential
241- dariaSHK :: CC. Crypto c => Credential 'Staking c
243+ dariaSHK :: Crypto c => Credential 'Staking c
242244dariaSHK = (KeyHashObj . hashKey . vKey) dariaStake
0 commit comments