Skip to content
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
7 changes: 0 additions & 7 deletions eras/allegra/impl/src/Cardano/Ledger/Allegra/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,9 @@ module Cardano.Ledger.Allegra.Era (
import Cardano.Ledger.Coin (Coin)
import Cardano.Ledger.Genesis (EraGenesis, NoGenesis)
import Cardano.Ledger.Internal.Era (AllegraEra)
import Cardano.Ledger.Shelley (ShelleyEra)
import Cardano.Ledger.Shelley.Core
import Cardano.Ledger.Shelley.Rules

instance Era AllegraEra where
type PreviousEra AllegraEra = ShelleyEra
type ProtVerLow AllegraEra = 3

eraName = "Allegra"

instance EraGenesis AllegraEra

--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ instance
, Environment (EraRule "PPUP" era) ~ PpupEnv era
, State (EraRule "PPUP" era) ~ ShelleyGovState era
, Signal (EraRule "PPUP" era) ~ StrictMaybe (Update era)
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
, Eq (EraRuleFailure "PPUP" era)
, Show (EraRuleFailure "PPUP" era)
, EraRule "UTXO" era ~ AllegraUTXO era
Expand Down
9 changes: 1 addition & 8 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,12 @@ module Cardano.Ledger.Alonzo.Era (
) where

import Cardano.Ledger.Internal.Era (AlonzoEra)
import Cardano.Ledger.Mary (MaryEra, MaryValue)
import Cardano.Ledger.Mary (MaryValue)
import Cardano.Ledger.Shelley.Core
import Cardano.Ledger.Shelley.Rules

-- =====================================================

instance Era AlonzoEra where
type PreviousEra AlonzoEra = MaryEra
type ProtVerLow AlonzoEra = 5
type ProtVerHigh AlonzoEra = 6

eraName = "Alonzo"

type instance Value AlonzoEra = MaryValue

-------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ transValue (MaryValue c m) = transCoinToValue c <> transMultiAsset m
-- =============================================
-- translate fields like TxCert, Withdrawals, and similar

transTxCert :: (ShelleyEraTxCert era, ProtVerAtMost era 8) => TxCert era -> PV1.DCert
transTxCert :: (ShelleyEraTxCert era, AtMostEra "Babbage" era) => TxCert era -> PV1.DCert
transTxCert txCert =
case transTxCertCommon txCert of
Just cert -> cert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ instance
, Environment (EraRule "DELEGS" era) ~ DelegsEnv era
, State (EraRule "DELEGS" era) ~ CertState era
, Signal (EraRule "DELEGS" era) ~ Seq (TxCert era)
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
, EraCertState era
) =>
STS (AlonzoLEDGER era)
Expand Down
4 changes: 2 additions & 2 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ utxoTransition ::
forall era.
( EraUTxO era
, AlonzoEraTx era
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
, EraRule "UTXO" era ~ AlonzoUTXO era
, InjectRuleFailure "UTXO" ShelleyUtxoPredFailure era
, InjectRuleFailure "UTXO" AlonzoUtxoPredFailure era
Expand Down Expand Up @@ -571,7 +571,7 @@ instance
, InjectRuleFailure "UTXO" ShelleyUtxoPredFailure era
, InjectRuleFailure "UTXO" AlonzoUtxoPredFailure era
, InjectRuleFailure "UTXO" AllegraUtxoPredFailure era
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
, EraCertState era
, SafeToHash (TxWits era)
) =>
Expand Down
4 changes: 2 additions & 2 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxBody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ type ScriptIntegrityHash = SafeHash EraIndependentScriptIntegrity
class (MaryEraTxBody era, AlonzoEraTxOut era) => AlonzoEraTxBody era where
collateralInputsTxBodyL :: Lens' (TxBody era) (Set TxIn)

reqSignerHashesTxBodyL :: ProtVerAtMost era 11 => Lens' (TxBody era) (Set (KeyHash 'Witness))
reqSignerHashesTxBodyL :: AtMostEra "Conway" era => Lens' (TxBody era) (Set (KeyHash 'Witness))

reqSignerHashesTxBodyG ::
SimpleGetter (TxBody era) (Set (KeyHash Witness))
default reqSignerHashesTxBodyG ::
ProtVerAtMost era 11 => SimpleGetter (TxBody era) (Set (KeyHash Witness))
AtMostEra "Conway" era => SimpleGetter (TxBody era) (Set (KeyHash Witness))
reqSignerHashesTxBodyG = reqSignerHashesTxBodyL

scriptIntegrityHashTxBodyL ::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ instance
, Environment (EraRule "DELEGS" era) ~ DelegsEnv era
, State (EraRule "DELEGS" era) ~ CertState era
, Signal (EraRule "DELEGS" era) ~ Seq (TxCert era)
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
, EraCertState era
, Crypto c
) =>
Expand Down
8 changes: 0 additions & 8 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module Cardano.Ledger.Babbage.Era (
BabbageLEDGER,
) where

import Cardano.Ledger.Alonzo (AlonzoEra)
import Cardano.Ledger.Alonzo.Rules (AlonzoBBODY)
import Cardano.Ledger.Core
import Cardano.Ledger.Genesis (EraGenesis, NoGenesis)
Expand All @@ -34,13 +33,6 @@ import Cardano.Ledger.Shelley.Rules (

-- =====================================================

instance Era BabbageEra where
type PreviousEra BabbageEra = AlonzoEra
type ProtVerLow BabbageEra = 7
type ProtVerHigh BabbageEra = 8

eraName = "Babbage"

instance EraGenesis BabbageEra

type instance TranslationContext BabbageEra = NoGenesis BabbageEra
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ instance
, Environment (EraRule "DELEGS" era) ~ DelegsEnv era
, State (EraRule "DELEGS" era) ~ CertState era
, Signal (EraRule "DELEGS" era) ~ Seq (TxCert era)
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
, EraCertState era
) =>
STS (BabbageLEDGER era)
Expand Down
8 changes: 0 additions & 8 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module Cardano.Ledger.Conway.Era (
hardforkConwayDELEGIncorrectDepositsAndRefunds,
) where

import Cardano.Ledger.Babbage (BabbageEra)
import Cardano.Ledger.BaseTypes (ProtVer (pvMajor), natVersion)
import Cardano.Ledger.Core
import Cardano.Ledger.Internal.Era (ConwayEra)
Expand All @@ -46,13 +45,6 @@ import Cardano.Ledger.Shelley.Rules (

-- =====================================================

instance Era ConwayEra where
type PreviousEra ConwayEra = BabbageEra
type ProtVerLow ConwayEra = 9
type ProtVerHigh ConwayEra = 11

eraName = "Conway"

type instance Value ConwayEra = MaryValue

-------------------------------------------------------------------------------
Expand Down
17 changes: 1 addition & 16 deletions eras/dijkstra/src/Cardano/Ledger/Dijkstra/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,13 @@ module Cardano.Ledger.Dijkstra.Era (
DijkstraCERT,
) where

import Cardano.Ledger.Conway (ConwayEra)
import Cardano.Ledger.Conway.Core (
Era (..),
EraRule,
EraRuleEvent,
EraRuleFailure,
Value,
VoidEraRule,
)
import Cardano.Ledger.Conway.Core
import Cardano.Ledger.Conway.Rules
import Cardano.Ledger.Internal.Era (DijkstraEra)
import Cardano.Ledger.Mary (MaryValue)
import qualified Cardano.Ledger.Shelley.API as API
import Cardano.Ledger.Shelley.Rules

instance Era DijkstraEra where
type PreviousEra DijkstraEra = ConwayEra
type ProtVerLow DijkstraEra = 12
type ProtVerHigh DijkstraEra = 12

eraName = "Dijkstra"

-------------------------------------------------------------------------------
-- Deprecated rules
-------------------------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions eras/mary/impl/src/Cardano/Ledger/Mary/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,13 @@

module Cardano.Ledger.Mary.Era (MaryEra) where

import Cardano.Ledger.Allegra (AllegraEra)
import Cardano.Ledger.Allegra.Rules (AllegraUTXO, AllegraUTXOW)
import Cardano.Ledger.Genesis (EraGenesis, NoGenesis)
import Cardano.Ledger.Internal.Era (MaryEra)
import Cardano.Ledger.Mary.Value (MaryValue)
import Cardano.Ledger.Shelley.Core
import Cardano.Ledger.Shelley.Rules

instance Era MaryEra where
type PreviousEra MaryEra = AllegraEra
type ProtVerLow MaryEra = 4

eraName = "Mary"

instance EraGenesis MaryEra

--------------------------------------------------------------------------------
Expand Down
8 changes: 1 addition & 7 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ module Cardano.Ledger.Shelley.Era (

import Cardano.Ledger.BaseTypes (ProtVer (pvMajor), natVersion)
import Cardano.Ledger.Coin (Coin)
import Cardano.Ledger.Core (ByronEra, Era (..), EraRule, Value)
import Cardano.Ledger.Core (EraRule, Value)
import Cardano.Ledger.Internal.Era (ShelleyEra)

instance Era ShelleyEra where
type PreviousEra ShelleyEra = ByronEra
type ProtVerLow ShelleyEra = 2

eraName = "Shelley"

type instance Value ShelleyEra = Coin

data ShelleyBBODY era
Expand Down
16 changes: 8 additions & 8 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ pvCanFollow (ProtVer curMajor curMinor) (ProtVer newMajor newMinor) =
-- | Check whether `PParamsUpdate` contains a valid `ProtVer` update. When a protocol version
-- update is not included in `PParamsUpdate` it is considered a legal update.
hasLegalProtVerUpdate ::
(ProtVerAtMost era 8, EraPParams era) => PParams era -> PParamsUpdate era -> Bool
(AtMostEra "Babbage" era, EraPParams era) => PParams era -> PParamsUpdate era -> Bool
hasLegalProtVerUpdate pp ppu =
case ppu ^. ppuProtocolVersionL of
SNothing -> True
Expand Down Expand Up @@ -426,31 +426,31 @@ ppTau =
, ppUpdate = Just $ PParamUpdate 11 ppuTauL
}

ppD :: (EraPParams era, ProtVerAtMost era 6) => PParam era
ppD :: (EraPParams era, AtMostEra "Alonzo" era) => PParam era
ppD =
PParam
{ ppName = "decentralization"
, ppLens = ppDL
, ppUpdate = Just $ PParamUpdate 12 ppuDL
}

ppExtraEntropy :: (EraPParams era, ProtVerAtMost era 6) => PParam era
ppExtraEntropy :: (EraPParams era, AtMostEra "Alonzo" era) => PParam era
ppExtraEntropy =
PParam
{ ppName = "extraPraosEntropy"
, ppLens = ppExtraEntropyL
, ppUpdate = Just $ PParamUpdate 13 ppuExtraEntropyL
}

ppProtocolVersion :: (EraPParams era, ProtVerAtMost era 8) => PParam era
ppProtocolVersion :: (EraPParams era, AtMostEra "Babbage" era) => PParam era
ppProtocolVersion =
PParam
{ ppName = "protocolVersion"
, ppLens = ppProtocolVersionL
, ppUpdate = Just $ PParamUpdate 14 ppuProtocolVersionL
}

ppMinUTxOValue :: (EraPParams era, ProtVerAtMost era 4) => PParam era
ppMinUTxOValue :: (EraPParams era, AtMostEra "Mary" era) => PParam era
ppMinUTxOValue =
PParam
{ ppName = "minUTxOValue"
Expand All @@ -468,9 +468,9 @@ ppMinPoolCost =

shelleyPParams ::
( EraPParams era
, ProtVerAtMost era 4
, ProtVerAtMost era 6
, ProtVerAtMost era 8
, AtMostEra "Mary" era
, AtMostEra "Alonzo" era
, AtMostEra "Babbage" era
) =>
[PParam era]
shelleyPParams =
Expand Down
6 changes: 3 additions & 3 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ newtype ShelleyDelegEvent era = DelegNewEpoch EpochNo
instance NFData (ShelleyDelegEvent era)

instance
(EraPParams era, ShelleyEraAccounts era, ShelleyEraTxCert era, ProtVerAtMost era 8) =>
(EraPParams era, ShelleyEraAccounts era, ShelleyEraTxCert era, AtMostEra "Babbage" era) =>
STS (ShelleyDELEG era)
where
type State (ShelleyDELEG era) = DState era
Expand Down Expand Up @@ -245,7 +245,7 @@ instance
k -> invalidKey k

delegationTransition ::
(ShelleyEraAccounts era, ShelleyEraTxCert era, EraPParams era, ProtVerAtMost era 8) =>
(ShelleyEraAccounts era, ShelleyEraTxCert era, EraPParams era, AtMostEra "Babbage" era) =>
TransitionRule (ShelleyDELEG era)
delegationTransition = do
TRC (DelegEnv slot epochNo ptr chainAccountState pp, ds, c) <- judgmentContext
Expand Down Expand Up @@ -369,7 +369,7 @@ delegationTransition = do
pure ds

checkSlotNotTooLate ::
(ShelleyEraAccounts era, ShelleyEraTxCert era, EraPParams era, ProtVerAtMost era 8) =>
(ShelleyEraAccounts era, ShelleyEraTxCert era, EraPParams era, AtMostEra "Babbage" era) =>
SlotNo ->
EpochNo ->
Rule (ShelleyDELEG era) 'Transition ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ instance
( ShelleyEraAccounts era
, ShelleyEraTxCert era
, EraPParams era
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
, PredicateFailure (EraRule "DELEG" era) ~ ShelleyDelegPredFailure era
, Event (EraRule "DELEG" era) ~ ShelleyDelegEvent era
) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ instance
, Environment (EraRule "DELEGS" era) ~ DelegsEnv era
, State (EraRule "DELEGS" era) ~ CertState era
, Signal (EraRule "DELEGS" era) ~ Seq (TxCert era)
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
) =>
STS (ShelleyLEDGER era)
where
Expand Down
6 changes: 3 additions & 3 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Newpp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ data NewppEnv era = NewppEnv
instance
( EraGov era
, GovState era ~ ShelleyGovState era
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
) =>
STS (ShelleyNEWPP era)
where
Expand All @@ -70,7 +70,7 @@ newPpTransition ::
forall era.
( GovState era ~ ShelleyGovState era
, EraGov era
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
) =>
TransitionRule (ShelleyNEWPP era)
newPpTransition = do
Expand All @@ -89,7 +89,7 @@ newPpTransition = do
updatePpup ::
( EraPParams era
, GovState era ~ ShelleyGovState era
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
) =>
Word64 ->
GovState era ->
Expand Down
5 changes: 3 additions & 2 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Ppup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ newtype PpupEvent era = PpupNewEpoch EpochNo

instance NFData (PpupEvent era)

instance (EraPParams era, ProtVerAtMost era 8) => STS (ShelleyPPUP era) where
instance (EraPParams era, AtMostEra "Babbage" era) => STS (ShelleyPPUP era) where
type State (ShelleyPPUP era) = ShelleyGovState era
type Signal (ShelleyPPUP era) = StrictMaybe (Update era)
type Environment (ShelleyPPUP era) = PpupEnv era
Expand All @@ -147,7 +147,8 @@ instance Era era => DecCBOR (ShelleyPpupPredFailure era) where
2 -> SumD PVCannotFollowPPUP <! From
k -> Invalid k

ppupTransitionNonEmpty :: (EraPParams era, ProtVerAtMost era 8) => TransitionRule (ShelleyPPUP era)
ppupTransitionNonEmpty ::
(EraPParams era, AtMostEra "Babbage" era) => TransitionRule (ShelleyPPUP era)
ppupTransitionNonEmpty = do
TRC
( PPUPEnv slot pp (GenDelegs genDelegs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ instance
( EraGov era
, Default (PParams era)
, GovState era ~ ShelleyGovState era
, ProtVerAtMost era 8
, AtMostEra "Babbage" era
) =>
STS (ShelleyUPEC era)
where
Expand Down
2 changes: 1 addition & 1 deletion eras/shelley/impl/src/Cardano/Ledger/Shelley/TxBody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import GHC.Generics (Generic)
import Lens.Micro
import NoThunks.Class (NoThunks (..))

class (ShelleyEraTxCert era, EraTxBody era, ProtVerAtMost era 8) => ShelleyEraTxBody era where
class (ShelleyEraTxCert era, EraTxBody era, AtMostEra "Babbage" era) => ShelleyEraTxBody era where
ttlTxBodyL :: ExactEra ShelleyEra era => Lens' (TxBody era) SlotNo

updateTxBodyL :: Lens' (TxBody era) (StrictMaybe (Update era))
Expand Down
Loading