Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding some instances needed for consensus. #2283

Merged
merged 1 commit into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion alonzo/impl/src/Cardano/Ledger/Alonzo/Translation.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -37,6 +39,8 @@ import qualified Cardano.Ledger.Tx as LTX
import Control.Monad.Except (Except, throwError)
import Data.Map.Strict (Map)
import Data.Text (Text)
import GHC.Generics (Generic)
import NoThunks.Class (NoThunks)
import Numeric.Natural (Natural)
import Shelley.Spec.Ledger.API
( EpochState (..),
Expand Down Expand Up @@ -73,7 +77,7 @@ data AlonzoGenesis = AlonzoGenesis
collateralPercentage :: Natural,
maxCollateralInputs :: Natural
}
deriving (Eq)
deriving (Eq, Generic, NoThunks)

type instance PreviousEra (AlonzoEra c) = MaryEra c

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import Cardano.Ledger.Coin (Coin)
import qualified Cardano.Ledger.Core as Core
import qualified Cardano.Ledger.Crypto as CryptoClass
import Cardano.Ledger.Era (SupportsSegWit (..), ValidateScript (..))
import qualified Cardano.Ledger.Era as E (Era (Crypto))
import qualified Cardano.Ledger.Era as E (Era (Crypto), TranslationContext)
import Cardano.Ledger.Hashes (EraIndependentAuxiliaryData)
import Cardano.Ledger.SafeHash (makeHashWithExplicitProxys)
import Cardano.Ledger.Shelley.Constraints
Expand Down Expand Up @@ -73,6 +73,8 @@ instance CryptoClass.Crypto c => UsesTxOut (ShelleyEra c) where
instance CryptoClass.Crypto c => UsesPParams (ShelleyEra c) where
mergePPUpdates _ = updatePParams

type instance E.TranslationContext (ShelleyEra c) = ()
Copy link
Contributor

@nfrisby nfrisby May 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat questionable, since we never actually use TranslationContext for ShelleyEra. But that's also the reason that it's harmless. And it currently simplifies Consensus. Also, it's arguably more consistent: every era within the Shelley mega-era now has a TranslationContext instance. (Which is trivial prior to Alonzo.)


--------------------------------------------------------------------------------
-- Core instances
--------------------------------------------------------------------------------
Expand Down