-
Notifications
You must be signed in to change notification settings - Fork 155
/
ConcreteCryptoTypes.hs
56 lines (48 loc) · 1.56 KB
/
ConcreteCryptoTypes.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
module Test.Shelley.Spec.Ledger.ConcreteCryptoTypes where
import Cardano.Crypto.DSIGN (MockDSIGN, VerKeyDSIGN)
import qualified Cardano.Crypto.DSIGN.Class as DSIGN
import Cardano.Crypto.Hash (MD5Prefix)
import Cardano.Crypto.KES (MockKES)
import qualified Cardano.Crypto.KES.Class as KES
import Cardano.Crypto.Util (SignableRepresentation)
import qualified Cardano.Crypto.VRF as VRF
import Cardano.Ledger.Crypto
import Shelley.Spec.Ledger.BaseTypes (Seed)
import Test.Cardano.Crypto.VRF.Fake (FakeVRF)
import Cardano.Ledger.Shelley (ShelleyEra)
import Shelley.Spec.Ledger.API (PraosCrypto)
-- | Mocking constraints used in generators
type Mock c =
( PraosCrypto c,
KES.Signable (KES c) ~ SignableRepresentation,
DSIGN.Signable (DSIGN c)
~ SignableRepresentation,
VRF.Signable
(VRF c)
Seed
)
-- | Additional mocking constraints used in examples.
type ExMock c =
( Mock c,
Num (DSIGN.SignKeyDSIGN (DSIGN c)),
Num (VerKeyDSIGN (DSIGN c)),
(VRF c) ~ FakeVRF
)
type C = ShelleyEra C_Crypto
data C_Crypto
instance Cardano.Ledger.Crypto.Crypto C_Crypto where
type HASH C_Crypto = MD5Prefix 10
type ADDRHASH C_Crypto = MD5Prefix 8
type DSIGN C_Crypto = MockDSIGN
type KES C_Crypto = MockKES 10
type VRF C_Crypto = FakeVRF
instance PraosCrypto C_Crypto