Skip to content

Commit e4af931

Browse files
authored
Merge pull request #4914 from IntersectMBO/ldan/conwaycertstate
Add `ConwayCertState` Resolves #4896
2 parents c821385 + 35a5ddd commit e4af931

File tree

193 files changed

+1017
-1003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+1017
-1003
lines changed

eras/allegra/impl/cardano-ledger-allegra.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ library
3535

3636
hs-source-dirs: src
3737
other-modules:
38-
Cardano.Ledger.Allegra.CertState
3938
Cardano.Ledger.Allegra.Era
4039
Cardano.Ledger.Allegra.PParams
4140
Cardano.Ledger.Allegra.Rules.Bbody
@@ -48,6 +47,7 @@ library
4847
Cardano.Ledger.Allegra.Rules.Ppup
4948
Cardano.Ledger.Allegra.Rules.Utxo
5049
Cardano.Ledger.Allegra.Rules.Utxow
50+
Cardano.Ledger.Allegra.State.CertState
5151
Cardano.Ledger.Allegra.State.Stake
5252
Cardano.Ledger.Allegra.TxCert
5353
Cardano.Ledger.Allegra.TxOut
@@ -71,7 +71,7 @@ library
7171
bytestring,
7272
cardano-ledger-binary >=1.4,
7373
cardano-ledger-core >=1.17,
74-
cardano-ledger-shelley ^>=1.16,
74+
cardano-ledger-shelley ^>=1.17,
7575
cardano-slotting,
7676
cardano-strict-containers,
7777
cborg,

eras/allegra/impl/src/Cardano/Ledger/Allegra/Rules/Utxo.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import Cardano.Ledger.BaseTypes (
3939
)
4040
import Cardano.Ledger.Binary (DecCBOR (..), EncCBOR (..), serialize)
4141
import Cardano.Ledger.Binary.Coders
42-
import Cardano.Ledger.CertState (EraCertState (..))
4342
import Cardano.Ledger.Coin (Coin)
4443
import Cardano.Ledger.Rules.ValidationMode (Test, runTest)
4544
import qualified Cardano.Ledger.Shelley.LedgerState as Shelley

eras/allegra/impl/src/Cardano/Ledger/Allegra/Rules/Utxow.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import Cardano.Ledger.Allegra.Core
1414
import Cardano.Ledger.Allegra.Era (AllegraEra, AllegraUTXOW)
1515
import Cardano.Ledger.Allegra.Rules.Utxo (AllegraUTXO, AllegraUtxoPredFailure)
1616
import Cardano.Ledger.BaseTypes
17-
import Cardano.Ledger.CertState
1817
import Cardano.Ledger.Shelley.LedgerState (UTxOState)
1918
import Cardano.Ledger.Shelley.Rules (
2019
ShelleyPpupPredFailure,
@@ -26,7 +25,10 @@ import Cardano.Ledger.Shelley.Rules (
2625
)
2726
import qualified Cardano.Ledger.Shelley.Rules as Shelley
2827
import Cardano.Ledger.Shelley.UTxO (ShelleyScriptsNeeded)
29-
import Cardano.Ledger.State (EraUTxO (..))
28+
import Cardano.Ledger.State (
29+
EraCertState (..),
30+
EraUTxO (..),
31+
)
3032
import Control.State.Transition.Extended
3133

3234
type instance EraRuleFailure "UTXOW" AllegraEra = ShelleyUtxowPredFailure AllegraEra

eras/allegra/impl/src/Cardano/Ledger/Allegra/State.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ module Cardano.Ledger.Allegra.State (
44

55
import Cardano.Ledger.Shelley.State
66

7+
import Cardano.Ledger.Allegra.State.CertState ()
78
import Cardano.Ledger.Allegra.State.Stake ()

eras/allegra/impl/src/Cardano/Ledger/Allegra/CertState.hs renamed to eras/allegra/impl/src/Cardano/Ledger/Allegra/State/CertState.hs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,17 @@
22
{-# LANGUAGE TypeFamilies #-}
33
{-# OPTIONS_GHC -Wno-orphans #-}
44

5-
module Cardano.Ledger.Allegra.CertState () where
5+
module Cardano.Ledger.Allegra.State.CertState () where
66

77
import Cardano.Ledger.Allegra.Era (AllegraEra)
8-
import Cardano.Ledger.CertState
9-
import Cardano.Ledger.Shelley.CertState
10-
import Data.Coerce (coerce)
8+
import Cardano.Ledger.Shelley.State
119

1210
instance EraCertState AllegraEra where
1311
type CertState AllegraEra = ShelleyCertState AllegraEra
1412

15-
mkCertState = mkShelleyCertState
16-
17-
upgradeCertState = coerce
18-
1913
certDStateL = shelleyCertDStateL
2014
{-# INLINE certDStateL #-}
2115

22-
certVStateL = shelleyCertVStateL
23-
{-# INLINE certVStateL #-}
24-
2516
certPStateL = shelleyCertPStateL
2617
{-# INLINE certPStateL #-}
2718

eras/allegra/impl/src/Cardano/Ledger/Allegra/Transition.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
module Cardano.Ledger.Allegra.Transition (TransitionConfig (..)) where
77

8-
import Cardano.Ledger.Allegra.CertState ()
98
import Cardano.Ledger.Allegra.Era
9+
import Cardano.Ledger.Allegra.State ()
1010
import Cardano.Ledger.Allegra.Translation ()
1111
import Cardano.Ledger.Genesis (NoGenesis (..))
1212
import Cardano.Ledger.Shelley

eras/allegra/impl/src/Cardano/Ledger/Allegra/Translation.hs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,18 @@
1212

1313
module Cardano.Ledger.Allegra.Translation (shelleyToAllegraAVVMsToDelete) where
1414

15-
import Cardano.Ledger.Allegra.CertState ()
1615
import Cardano.Ledger.Allegra.Era (AllegraEra)
1716
import Cardano.Ledger.Allegra.State
1817
import Cardano.Ledger.Allegra.Tx ()
1918
import Cardano.Ledger.Binary (DecoderError)
20-
import Cardano.Ledger.CertState (CommitteeState (..))
2119
import Cardano.Ledger.Genesis (NoGenesis (..))
2220
import Cardano.Ledger.Shelley (ShelleyEra)
23-
import Cardano.Ledger.Shelley.CertState (ShelleyCertState)
2421
import Cardano.Ledger.Shelley.Core
2522
import Cardano.Ledger.Shelley.LedgerState (
26-
DState (..),
2723
EpochState (..),
2824
LedgerState (..),
2925
NewEpochState (..),
30-
PState (..),
3126
UTxOState (..),
32-
VState (..),
3327
returnRedeemAddrsToReserves,
3428
)
3529
import Cardano.Ledger.Shelley.PParams (ProposedPPUpdates (..), Update (..))
@@ -139,15 +133,16 @@ instance TranslateEra AllegraEra DState where
139133
instance TranslateEra AllegraEra CommitteeState where
140134
translateEra _ CommitteeState {..} = pure CommitteeState {..}
141135

142-
instance TranslateEra AllegraEra VState where
143-
translateEra ctx VState {..} = do
144-
committeeState <- translateEra ctx vsCommitteeState
145-
pure VState {vsCommitteeState = committeeState, ..}
146-
147136
instance TranslateEra AllegraEra PState where
148137
translateEra _ PState {..} = pure PState {..}
149138

150-
instance TranslateEra AllegraEra ShelleyCertState
139+
instance TranslateEra AllegraEra ShelleyCertState where
140+
translateEra ctxt ls =
141+
pure
142+
ShelleyCertState
143+
{ shelleyCertDState = translateEra' ctxt $ shelleyCertDState ls
144+
, shelleyCertPState = translateEra' ctxt $ shelleyCertPState ls
145+
}
151146

152147
instance TranslateEra AllegraEra LedgerState where
153148
translateEra ctxt ls =

eras/allegra/impl/src/Cardano/Ledger/Allegra/UTxO.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
module Cardano.Ledger.Allegra.UTxO () where
88

9-
import Cardano.Ledger.Allegra.CertState ()
109
import Cardano.Ledger.Allegra.Core
1110
import Cardano.Ledger.Allegra.Era (AllegraEra)
11+
import Cardano.Ledger.Allegra.State ()
1212
import Cardano.Ledger.Shelley.UTxO (
1313
ShelleyScriptsNeeded (..),
1414
getConsumedCoin,
1515
getShelleyMinFeeTxUtxo,
1616
getShelleyScriptsNeeded,
1717
getShelleyWitsVKeyNeeded,
18+
shelleyConsumed,
1819
shelleyProducedValue,
1920
)
2021
import Cardano.Ledger.State (EraUTxO (..), ScriptsProvided (..))
@@ -23,6 +24,8 @@ import Lens.Micro
2324
instance EraUTxO AllegraEra where
2425
type ScriptsNeeded AllegraEra = ShelleyScriptsNeeded AllegraEra
2526

27+
consumed = shelleyConsumed
28+
2629
getConsumedValue pp lookupKeyDeposit _ = getConsumedCoin pp lookupKeyDeposit
2730

2831
getProducedValue = shelleyProducedValue

eras/alonzo/impl/cardano-ledger-alonzo.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ library
4949

5050
hs-source-dirs: src
5151
other-modules:
52-
Cardano.Ledger.Alonzo.CertState
5352
Cardano.Ledger.Alonzo.Era
5453
Cardano.Ledger.Alonzo.Rules.Bbody
5554
Cardano.Ledger.Alonzo.Rules.Deleg
@@ -62,6 +61,7 @@ library
6261
Cardano.Ledger.Alonzo.Rules.Utxo
6362
Cardano.Ledger.Alonzo.Rules.Utxos
6463
Cardano.Ledger.Alonzo.Rules.Utxow
64+
Cardano.Ledger.Alonzo.State.CertState
6565
Cardano.Ledger.Alonzo.State.Stake
6666
Cardano.Ledger.Alonzo.TxCert
6767

@@ -86,7 +86,7 @@ library
8686
cardano-ledger-binary ^>=1.6,
8787
cardano-ledger-core ^>=1.18,
8888
cardano-ledger-mary ^>=1.8,
89-
cardano-ledger-shelley ^>=1.16,
89+
cardano-ledger-shelley ^>=1.17,
9090
cardano-slotting,
9191
cardano-strict-containers,
9292
containers,

eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Ledger.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import Cardano.Ledger.Alonzo.Rules.Utxos (AlonzoUtxosPredFailure)
2323
import Cardano.Ledger.Alonzo.Rules.Utxow (AlonzoUTXOW, AlonzoUtxowEvent, AlonzoUtxowPredFailure)
2424
import Cardano.Ledger.Alonzo.Tx (AlonzoEraTx (..), AlonzoTx (..), IsValid (..))
2525
import Cardano.Ledger.BaseTypes (ShelleyBase)
26-
import Cardano.Ledger.CertState (EraCertState)
2726
import Cardano.Ledger.Shelley.Core
2827
import Cardano.Ledger.Shelley.LedgerState (
2928
CertState,
@@ -54,6 +53,7 @@ import Cardano.Ledger.Shelley.Rules as Shelley (
5453
renderDepositEqualsObligationViolation,
5554
)
5655
import Cardano.Ledger.Slot (epochFromSlot)
56+
import Cardano.Ledger.State (EraCertState)
5757
import Control.State.Transition (
5858
Embed (..),
5959
STS (..),

0 commit comments

Comments
 (0)