Skip to content

Commit 6db1056

Browse files
committed
Made predicate failures for NEWEPOCH subrules Void
1 parent d1657a4 commit 6db1056

File tree

17 files changed

+60
-294
lines changed

17 files changed

+60
-294
lines changed

eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Epoch.hs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,9 @@ import Cardano.Ledger.Shelley.Rewards ()
8383
import Cardano.Ledger.Shelley.Rules (
8484
ShelleyPOOLREAP,
8585
ShelleyPoolreapEvent,
86-
ShelleyPoolreapPredFailure,
8786
ShelleyPoolreapState (..),
8887
ShelleySNAP,
89-
ShelleySnapPredFailure,
9088
SnapEnv (..),
91-
UpecPredFailure,
9289
)
9390
import qualified Cardano.Ledger.Shelley.Rules as Shelley
9491
import Cardano.Ledger.Slot (EpochNo)
@@ -164,8 +161,6 @@ instance
164161
, Environment (EraRule "POOLREAP" era) ~ ()
165162
, State (EraRule "POOLREAP" era) ~ ShelleyPoolreapState era
166163
, Signal (EraRule "POOLREAP" era) ~ EpochNo
167-
, Eq (UpecPredFailure era)
168-
, Show (UpecPredFailure era)
169164
, Embed (EraRule "RATIFY" era) (ConwayEPOCH era)
170165
, Environment (EraRule "RATIFY" era) ~ RatifyEnv era
171166
, GovState era ~ ConwayGovState era
@@ -258,8 +253,6 @@ epochTransition ::
258253
( RunConwayRatify era
259254
, ConwayEraCertState era
260255
, EraTxOut era
261-
, Eq (UpecPredFailure era)
262-
, Show (UpecPredFailure era)
263256
, Environment (EraRule "SNAP" era) ~ SnapEnv era
264257
, State (EraRule "SNAP" era) ~ SnapShots
265258
, Signal (EraRule "SNAP" era) ~ ()
@@ -388,7 +381,6 @@ epochTransition = do
388381
instance
389382
( Era era
390383
, STS (ShelleyPOOLREAP era)
391-
, PredicateFailure (EraRule "POOLREAP" era) ~ ShelleyPoolreapPredFailure era
392384
, Event (EraRule "POOLREAP" era) ~ ShelleyPoolreapEvent era
393385
) =>
394386
Embed (ShelleyPOOLREAP era) (ConwayEPOCH era)
@@ -400,7 +392,6 @@ instance
400392
( EraTxOut era
401393
, EraStake era
402394
, EraCertState era
403-
, PredicateFailure (EraRule "SNAP" era) ~ ShelleySnapPredFailure era
404395
, Event (EraRule "SNAP" era) ~ Shelley.SnapEvent era
405396
) =>
406397
Embed (ShelleySNAP era) (ConwayEPOCH era)

eras/conway/impl/src/Cardano/Ledger/Conway/Rules/NewEpoch.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import Cardano.Ledger.Shelley.Rules (
4747
RupdEvent (..),
4848
ShelleyTICK,
4949
ShelleyTickEvent (..),
50-
ShelleyTickPredFailure (..),
5150
)
5251
import Cardano.Ledger.Slot (EpochNo (EpochNo))
5352
import Cardano.Ledger.State
@@ -221,7 +220,7 @@ instance
221220
) =>
222221
Embed (ConwayNEWEPOCH era) (ShelleyTICK era)
223222
where
224-
wrapFailed = NewEpochFailure
223+
wrapFailed = \case {}
225224
wrapEvent = TickNewEpochEvent
226225

227226
instance

eras/shelley/impl/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
## 1.17.0.0
44

5+
* Remove:
6+
* `ShelleyEpochPredFailure`
7+
* `ShelleyMirPredFailure`
8+
* `ShelleyNewEpochPredFailure`
9+
* `ShelleyPoolreapPredFailure`
10+
* `ShelleyRupdPredFailure`
11+
* `ShelleySnapPredFailure`
12+
* `ShelleyTickPredFailure`
13+
* `ShelleyTickfPredFailure`
14+
* `ShelleyUpecPredFailure`
15+
* `TickTransitionError`
16+
* `UpecPredFailure`
517
* Refactor pool deposits to use `StakePoolState`. #5234
618
* Update `Pool` rule to store deposits in individual `StakePoolState` records
719
* Add and export `prUTxOStateL`, `prChainAccountStateL`, and `prCertStateL` lenses for `ShelleyPoolreapState`

eras/shelley/impl/src/Cardano/Ledger/Shelley/API/Validation.hs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module Cardano.Ledger.Shelley.API.Validation (
2121
applyBlockEitherNoEvents,
2222
applyBlockNoValidaton,
2323
applyTickNoEvents,
24-
TickTransitionError (..),
2524
BlockTransitionError (..),
2625
chainChecks,
2726
) where
@@ -223,22 +222,6 @@ updateNewEpochState ::
223222
updateNewEpochState ss (STS.BbodyState ls bcur) =
224223
LedgerState.updateNES ss bcur ls
225224

226-
newtype TickTransitionError era
227-
= TickTransitionError (NonEmpty (STS.PredicateFailure (EraRule "TICK" era)))
228-
deriving (Generic)
229-
230-
instance
231-
NoThunks (STS.PredicateFailure (EraRule "TICK" era)) =>
232-
NoThunks (TickTransitionError era)
233-
234-
deriving stock instance
235-
Eq (STS.PredicateFailure (EraRule "TICK" era)) =>
236-
Eq (TickTransitionError era)
237-
238-
deriving stock instance
239-
Show (STS.PredicateFailure (EraRule "TICK" era)) =>
240-
Show (TickTransitionError era)
241-
242225
newtype BlockTransitionError era
243226
= BlockTransitionError (NonEmpty (STS.PredicateFailure (EraRule "BBODY" era)))
244227
deriving (Generic)

eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Epoch.hs

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{-# LANGUAGE DataKinds #-}
22
{-# LANGUAGE DeriveGeneric #-}
33
{-# LANGUAGE DerivingStrategies #-}
4+
{-# LANGUAGE EmptyCase #-}
45
{-# LANGUAGE FlexibleContexts #-}
56
{-# LANGUAGE FlexibleInstances #-}
7+
{-# LANGUAGE LambdaCase #-}
68
{-# LANGUAGE MultiParamTypeClasses #-}
79
{-# LANGUAGE PatternSynonyms #-}
810
{-# LANGUAGE ScopedTypeVariables #-}
@@ -15,10 +17,8 @@
1517

1618
module Cardano.Ledger.Shelley.Rules.Epoch (
1719
ShelleyEPOCH,
18-
ShelleyEpochPredFailure (..),
1920
ShelleyEpochEvent (..),
2021
PredicateFailure,
21-
UpecPredFailure,
2222
) where
2323

2424
import Cardano.Ledger.BaseTypes (ShelleyBase)
@@ -47,16 +47,14 @@ import Cardano.Ledger.Shelley.Rewards ()
4747
import Cardano.Ledger.Shelley.Rules.PoolReap (
4848
ShelleyPOOLREAP,
4949
ShelleyPoolreapEvent,
50-
ShelleyPoolreapPredFailure,
5150
ShelleyPoolreapState (..),
5251
)
5352
import Cardano.Ledger.Shelley.Rules.Snap (
5453
ShelleySNAP,
55-
ShelleySnapPredFailure,
5654
SnapEnv (..),
5755
SnapEvent,
5856
)
59-
import Cardano.Ledger.Shelley.Rules.Upec (ShelleyUPEC, ShelleyUpecPredFailure, UpecState (..))
57+
import Cardano.Ledger.Shelley.Rules.Upec (ShelleyUPEC, UpecState (..))
6058
import Cardano.Ledger.Slot (EpochNo)
6159
import Cardano.Ledger.State
6260
import Control.DeepSeq (NFData)
@@ -72,46 +70,6 @@ import Data.Default (Default)
7270
import Data.Void (Void)
7371
import GHC.Generics (Generic)
7472
import Lens.Micro
75-
import NoThunks.Class (NoThunks (..))
76-
77-
type UpecPredFailure era = UpecPredFailurePV (ProtVerLow era) era
78-
79-
type family UpecPredFailurePV pv era where
80-
UpecPredFailurePV 2 era = ShelleyUpecPredFailure era
81-
UpecPredFailurePV 3 era = ShelleyUpecPredFailure era
82-
UpecPredFailurePV 4 era = ShelleyUpecPredFailure era
83-
UpecPredFailurePV 5 era = ShelleyUpecPredFailure era
84-
UpecPredFailurePV 6 era = ShelleyUpecPredFailure era
85-
UpecPredFailurePV 7 era = ShelleyUpecPredFailure era
86-
UpecPredFailurePV 8 era = ShelleyUpecPredFailure era
87-
UpecPredFailurePV _ era = Void
88-
89-
data ShelleyEpochPredFailure era
90-
= PoolReapFailure (PredicateFailure (EraRule "POOLREAP" era)) -- Subtransition Failures
91-
| SnapFailure (PredicateFailure (EraRule "SNAP" era)) -- Subtransition Failures
92-
| UpecFailure (UpecPredFailure era) -- Subtransition Failures
93-
deriving (Generic)
94-
95-
deriving stock instance
96-
( Eq (PredicateFailure (EraRule "POOLREAP" era))
97-
, Eq (PredicateFailure (EraRule "SNAP" era))
98-
, Eq (UpecPredFailure era)
99-
) =>
100-
Eq (ShelleyEpochPredFailure era)
101-
102-
deriving stock instance
103-
( Show (PredicateFailure (EraRule "POOLREAP" era))
104-
, Show (PredicateFailure (EraRule "SNAP" era))
105-
, Show (UpecPredFailure era)
106-
) =>
107-
Show (ShelleyEpochPredFailure era)
108-
109-
instance
110-
( NFData (PredicateFailure (EraRule "POOLREAP" era))
111-
, NFData (PredicateFailure (EraRule "SNAP" era))
112-
, NFData (UpecPredFailure era)
113-
) =>
114-
NFData (ShelleyEpochPredFailure era)
11573

11674
data ShelleyEpochEvent era
11775
= PoolReapEvent (Event (EraRule "POOLREAP" era))
@@ -152,26 +110,17 @@ instance
152110
, State (EraRule "UPEC" era) ~ UpecState era
153111
, Signal (EraRule "UPEC" era) ~ ()
154112
, Default (PParams era)
155-
, Eq (UpecPredFailure era)
156-
, Show (UpecPredFailure era)
157113
) =>
158114
STS (ShelleyEPOCH era)
159115
where
160116
type State (ShelleyEPOCH era) = EpochState era
161117
type Signal (ShelleyEPOCH era) = EpochNo
162118
type Environment (ShelleyEPOCH era) = ()
163119
type BaseM (ShelleyEPOCH era) = ShelleyBase
164-
type PredicateFailure (ShelleyEPOCH era) = ShelleyEpochPredFailure era
120+
type PredicateFailure (ShelleyEPOCH era) = Void
165121
type Event (ShelleyEPOCH era) = ShelleyEpochEvent era
166122
transitionRules = [epochTransition]
167123

168-
instance
169-
( NoThunks (PredicateFailure (EraRule "POOLREAP" era))
170-
, NoThunks (PredicateFailure (EraRule "SNAP" era))
171-
, NoThunks (UpecPredFailure era)
172-
) =>
173-
NoThunks (ShelleyEpochPredFailure era)
174-
175124
epochTransition ::
176125
forall era.
177126
( Embed (EraRule "SNAP" era) (ShelleyEPOCH era)
@@ -237,33 +186,30 @@ epochTransition = do
237186
instance
238187
( EraTxOut era
239188
, EraStake era
240-
, PredicateFailure (EraRule "SNAP" era) ~ ShelleySnapPredFailure era
241189
, Event (EraRule "SNAP" era) ~ SnapEvent era
242190
, EraCertState era
243191
) =>
244192
Embed (ShelleySNAP era) (ShelleyEPOCH era)
245193
where
246-
wrapFailed = SnapFailure
194+
wrapFailed = \case {}
247195
wrapEvent = SnapEvent
248196

249197
instance
250198
( Era era
251199
, STS (ShelleyPOOLREAP era)
252-
, PredicateFailure (EraRule "POOLREAP" era) ~ ShelleyPoolreapPredFailure era
253200
, Event (EraRule "POOLREAP" era) ~ ShelleyPoolreapEvent era
254201
) =>
255202
Embed (ShelleyPOOLREAP era) (ShelleyEPOCH era)
256203
where
257-
wrapFailed = PoolReapFailure
204+
wrapFailed = \case {}
258205
wrapEvent = PoolReapEvent
259206

260207
instance
261208
( Era era
262209
, STS (ShelleyUPEC era)
263-
, UpecPredFailure era ~ ShelleyUpecPredFailure era
264210
, Event (EraRule "UPEC" era) ~ Void
265211
) =>
266212
Embed (ShelleyUPEC era) (ShelleyEPOCH era)
267213
where
268-
wrapFailed = UpecFailure
214+
wrapFailed = \case {}
269215
wrapEvent = UpecEvent

eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Mir.hs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
module Cardano.Ledger.Shelley.Rules.Mir (
1515
ShelleyMIR,
1616
PredicateFailure,
17-
ShelleyMirPredFailure,
1817
ShelleyMirEvent (..),
1918
emptyInstantaneousRewards,
2019
) where
@@ -51,14 +50,9 @@ import Control.State.Transition (
5150
import Data.Default (Default)
5251
import Data.Foldable (fold)
5352
import qualified Data.Map.Strict as Map
53+
import Data.Void (Void)
5454
import GHC.Generics (Generic)
5555
import Lens.Micro
56-
import NoThunks.Class (NoThunks (..))
57-
58-
data ShelleyMirPredFailure era
59-
deriving (Show, Generic, Eq)
60-
61-
instance NFData (ShelleyMirPredFailure era)
6256

6357
data ShelleyMirEvent era
6458
= MirTransfer InstantaneousRewards
@@ -72,8 +66,6 @@ deriving instance Eq (ShelleyMirEvent era)
7266

7367
instance NFData (ShelleyMirEvent era)
7468

75-
instance NoThunks (ShelleyMirPredFailure era)
76-
7769
instance
7870
( Default (EpochState era)
7971
, EraGov era
@@ -86,7 +78,7 @@ instance
8678
type Environment (ShelleyMIR era) = ()
8779
type BaseM (ShelleyMIR era) = ShelleyBase
8880
type Event (ShelleyMIR era) = ShelleyMirEvent era
89-
type PredicateFailure (ShelleyMIR era) = ShelleyMirPredFailure era
81+
type PredicateFailure (ShelleyMIR era) = Void
9082

9183
transitionRules = [mirTransition]
9284

0 commit comments

Comments
 (0)