-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Crypto deprecation to promote migration using deprecation.
Move `Crypto` and `StandardCrypto` back into `cardano-ledger-core` and use deprecation on its imports in order to make this migration easier for the downstream users. Also deprecate all the VRF and KES related type synonyms, just liek it was done with Hash and DSIGN in the previous commit. Crypto related type synonyms have been a point of confusion on many occasions for many people. In other words, practice showed once again how type synonyms can be harmful.
- Loading branch information
Showing
20 changed files
with
199 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
libs/cardano-ledger-core/src/Cardano/Ledger/Crypto/Internal.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE KindSignatures #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
{-# LANGUAGE TypeOperators #-} | ||
|
||
-- Contents of this module will be moved to `Cardano.Protocol.Crypto` at some point later | ||
-- whenever we are ready to remove derpecations | ||
module Cardano.Ledger.Crypto.Internal ( | ||
Crypto (..), | ||
StandardCrypto, | ||
HASH, | ||
ADDRHASH, | ||
DSIGN, | ||
) where | ||
|
||
import Cardano.Crypto.DSIGN | ||
import Cardano.Crypto.Hash as Hash | ||
import qualified Cardano.Crypto.KES as KES | ||
import qualified Cardano.Crypto.VRF as VRF | ||
import qualified Cardano.Crypto.VRF.Praos as VRF | ||
import Cardano.Ledger.Hashes (ADDRHASH, HASH) | ||
import Cardano.Ledger.Keys.Internal (DSIGN) | ||
import Data.Kind (Type) | ||
import Data.Typeable (Typeable) | ||
|
||
class | ||
( KES.UnsoundPureKESAlgorithm (KES c) | ||
, VRF.VRFAlgorithm (VRF c) | ||
, KES.ContextKES (KES c) ~ () | ||
, VRF.ContextVRF (VRF c) ~ () | ||
, Typeable c | ||
) => | ||
Crypto c | ||
where | ||
type KES c :: Type | ||
type VRF c :: Type | ||
|
||
-- ================================ | ||
|
||
-- | The same crypto used on the net | ||
data StandardCrypto | ||
|
||
instance Crypto StandardCrypto where | ||
type KES StandardCrypto = KES.Sum6KES Ed25519DSIGN Blake2b_256 | ||
type VRF StandardCrypto = VRF.PraosVRF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.