-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2502: Extend Cardano ThreadNet tests so that Shelley era contains active stake pools r=nfrisby a=nfrisby Fixes #2388. The big commit could be decomposed a little, but the excess diff I'm thinking of is mostly minor (whitespace/renaming/adding one param to `testGenTxs` etc) and localized -- it's obvious when you see it. Please ping me if the decomposition would be worthwhile by making your review that much easier. cc: @edsko FYI Co-authored-by: Nicolas Frisby <nick.frisby@iohk.io>
- Loading branch information
Showing
14 changed files
with
593 additions
and
112 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
45 changes: 45 additions & 0 deletions
45
ouroboros-consensus-cardano/test/Test/Consensus/Cardano/MockCrypto.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 DataKinds #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
{-# OPTIONS_GHC -Wno-orphans #-} | ||
module Test.Consensus.Cardano.MockCrypto ( | ||
BlockCompatByron | ||
, TPraosMockCryptoCompatByron | ||
) where | ||
|
||
import Cardano.Crypto.DSIGN (Ed25519DSIGN) | ||
import Cardano.Crypto.Hash (Blake2b_224, HashAlgorithm) | ||
import Cardano.Crypto.KES (MockKES) | ||
|
||
import Test.Cardano.Crypto.VRF.Fake (FakeVRF) | ||
|
||
import Ouroboros.Consensus.Shelley.Ledger (ShelleyBlock) | ||
import Ouroboros.Consensus.Shelley.Protocol.Crypto (TPraosCrypto) | ||
|
||
import Shelley.Spec.Ledger.Crypto (Crypto (..)) | ||
|
||
-- | A mock replacement for 'TPraosStandardCrypto' that is compatible with | ||
-- bootstrapping from Byron | ||
-- | ||
-- This mocks more components than does | ||
-- 'Test.Consensus.Shelley.MockCrypto.TPraosMockCrypto'. This prevents the | ||
-- @cardano-ledger-specs@ generators from being re-used. Currently, this is not | ||
-- an obstacle for example in the Cardano ThreadNet tests. | ||
-- | ||
-- NOTE: The "Ouroboros.Consensus.Cardano.CanHardFork" translation currently | ||
-- assumes that @ADDRHASH@ has the same bit size as Byron address hashes (ie | ||
-- 224); that's why we use 'Blake2b_224' here. | ||
-- | ||
-- NOTE: The @shelley-spec-ledger@ package currently requires that @'DSIGN' ~ | ||
-- 'Ed25519DSIGN' in order to use Byron bootstrap witnesses. | ||
data TPraosMockCryptoCompatByron h | ||
|
||
instance HashAlgorithm h => Crypto (TPraosMockCryptoCompatByron h) where | ||
type ADDRHASH (TPraosMockCryptoCompatByron h) = Blake2b_224 | ||
type DSIGN (TPraosMockCryptoCompatByron h) = Ed25519DSIGN | ||
type HASH (TPraosMockCryptoCompatByron h) = h | ||
type KES (TPraosMockCryptoCompatByron h) = MockKES 10 | ||
type VRF (TPraosMockCryptoCompatByron h) = FakeVRF | ||
|
||
instance HashAlgorithm h => TPraosCrypto (TPraosMockCryptoCompatByron h) | ||
|
||
type BlockCompatByron h = ShelleyBlock (TPraosMockCryptoCompatByron h) |
Oops, something went wrong.