-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1944 from input-output-hk/mrBliss/consensus-requi…
…rements Add classes each era must satisfy for consensus integration
- Loading branch information
Showing
11 changed files
with
67 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,23 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE TypeSynonymInstances #-} | ||
{-# LANGUAGE UndecidableInstances #-} | ||
{-# OPTIONS_GHC -Wno-orphans #-} | ||
|
||
module Cardano.Ledger.Allegra where | ||
|
||
import Cardano.Crypto.Hash (Hash) | ||
import Cardano.Ledger.Crypto (Crypto, HASH) | ||
import Cardano.Ledger.ShelleyMA | ||
import Cardano.Ledger.ShelleyMA.Rules.Utxo () | ||
import Cardano.Ledger.ShelleyMA.Rules.Utxow () | ||
import Cardano.Ledger.ShelleyMA.Scripts () | ||
import Cardano.Ledger.ShelleyMA.TxBody () | ||
import Shelley.Spec.Ledger.API (ApplyBlock, ApplyTx, GetLedgerView) | ||
import Shelley.Spec.Ledger.Hashing (EraIndependentTxBody) | ||
import Shelley.Spec.Ledger.Keys (DSignable) | ||
import Shelley.Spec.Ledger.API (ApplyBlock, ApplyTx, GetLedgerView, PraosCrypto, ShelleyBasedEra) | ||
|
||
type AllegraEra = ShelleyMAEra 'Allegra | ||
|
||
instance | ||
( Crypto c, | ||
DSignable c (Hash (HASH c) EraIndependentTxBody) | ||
) => | ||
ApplyTx (AllegraEra c) | ||
instance PraosCrypto c => ApplyTx (AllegraEra c) | ||
|
||
instance | ||
( Crypto c, | ||
DSignable c (Hash (HASH c) EraIndependentTxBody) | ||
) => | ||
ApplyBlock (AllegraEra c) | ||
instance PraosCrypto c => ApplyBlock (AllegraEra c) | ||
|
||
instance (Crypto c) => GetLedgerView (AllegraEra c) | ||
instance PraosCrypto c => GetLedgerView (AllegraEra c) | ||
|
||
instance PraosCrypto c => ShelleyBasedEra (AllegraEra c) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,23 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE TypeSynonymInstances #-} | ||
{-# LANGUAGE UndecidableInstances #-} | ||
{-# OPTIONS_GHC -Wno-orphans #-} | ||
|
||
module Cardano.Ledger.Mary where | ||
|
||
import Cardano.Crypto.Hash (Hash) | ||
import Cardano.Ledger.Crypto (Crypto, HASH) | ||
import Cardano.Ledger.ShelleyMA | ||
import Cardano.Ledger.ShelleyMA.Rules.Utxo () | ||
import Cardano.Ledger.ShelleyMA.Rules.Utxow () | ||
import Cardano.Ledger.ShelleyMA.Scripts () | ||
import Cardano.Ledger.ShelleyMA.TxBody () | ||
import Shelley.Spec.Ledger.API (ApplyBlock, ApplyTx, GetLedgerView) | ||
import Shelley.Spec.Ledger.Hashing (EraIndependentTxBody) | ||
import Shelley.Spec.Ledger.Keys (DSignable) | ||
import Shelley.Spec.Ledger.API (ApplyBlock, ApplyTx, GetLedgerView, PraosCrypto, ShelleyBasedEra) | ||
|
||
type MaryEra = ShelleyMAEra 'Mary | ||
|
||
instance | ||
( Crypto c, | ||
DSignable c (Hash (HASH c) EraIndependentTxBody) | ||
) => | ||
ApplyTx (MaryEra c) | ||
instance PraosCrypto c => ApplyTx (MaryEra c) | ||
|
||
instance | ||
( Crypto c, | ||
DSignable c (Hash (HASH c) EraIndependentTxBody) | ||
) => | ||
ApplyBlock (MaryEra c) | ||
instance PraosCrypto c => ApplyBlock (MaryEra c) | ||
|
||
instance (Crypto c) => GetLedgerView (MaryEra c) | ||
instance PraosCrypto c => GetLedgerView (MaryEra c) | ||
|
||
instance PraosCrypto c => ShelleyBasedEra (MaryEra c) |
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
18 changes: 18 additions & 0 deletions
18
shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/API.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 |
---|---|---|
@@ -1,12 +1,30 @@ | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
{-# LANGUAGE UndecidableSuperClasses #-} | ||
|
||
-- | API to the Shelley ledger | ||
module Shelley.Spec.Ledger.API | ||
( module X, | ||
ShelleyBasedEra, | ||
) | ||
where | ||
|
||
import Cardano.Ledger.Era (Crypto) | ||
import Cardano.Ledger.Shelley (ShelleyBased, ShelleyEra) | ||
import Shelley.Spec.Ledger.API.ByronTranslation as X | ||
import Shelley.Spec.Ledger.API.Mempool as X | ||
import Shelley.Spec.Ledger.API.Protocol as X | ||
import Shelley.Spec.Ledger.API.Types as X | ||
import Shelley.Spec.Ledger.API.Validation as X | ||
import Shelley.Spec.Ledger.API.Wallet as X | ||
|
||
class | ||
( PraosCrypto (Crypto era), | ||
ShelleyBased era, | ||
GetLedgerView era, | ||
ApplyBlock era, | ||
ApplyTx era | ||
) => | ||
ShelleyBasedEra era | ||
|
||
instance PraosCrypto crypto => ShelleyBasedEra (ShelleyEra crypto) |
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