@@ -32,6 +32,7 @@ import qualified Cardano.Ledger.Alonzo.Rules as Alonzo
3232import Cardano.Ledger.Babbage.Rules (
3333 BabbageUtxoPredFailure ,
3434 babbageUtxoValidation ,
35+ updateUTxOStateByTxValidity ,
3536 )
3637import Cardano.Ledger.BaseTypes (
3738 Mismatch (.. ),
@@ -59,7 +60,6 @@ import Cardano.Ledger.Conway.Rules (
5960 ConwayUTXOS ,
6061 ConwayUtxoPredFailure ,
6162 ConwayUtxosPredFailure (.. ),
62- UtxoEnv ,
6363 allegraToConwayUtxoPredFailure ,
6464 alonzoToConwayUtxoPredFailure ,
6565 babbageToConwayUtxoPredFailure ,
@@ -70,14 +70,15 @@ import Cardano.Ledger.Dijkstra.Era (DijkstraEra, DijkstraUTXO)
7070import Cardano.Ledger.Dijkstra.Rules.Utxos ()
7171import Cardano.Ledger.Plutus (ExUnits )
7272import Cardano.Ledger.Rules.ValidationMode (failOnJustStatic )
73- import Cardano.Ledger.Shelley.LedgerState (UTxOState )
74- import qualified Cardano.Ledger.Shelley.LedgerState as Shelley (UTxOState )
73+ import Cardano.Ledger.Shelley.LedgerState (UTxOState (.. ))
7574import Cardano.Ledger.Shelley.Rules (
7675 ShelleyUtxoPredFailure ,
76+ UtxoEnv (.. ),
77+ validSizeComputationCheck ,
7778 )
78- import qualified Cardano.Ledger.Shelley.Rules as Shelley (UtxoEnv , validSizeComputationCheck )
7979import Cardano.Ledger.State (
8080 EraCertState (.. ),
81+ EraStake ,
8182 EraUTxO ,
8283 )
8384import Cardano.Ledger.TxIn (TxIn )
@@ -91,7 +92,6 @@ import Control.State.Transition.Extended (
9192 judgmentContext ,
9293 trans ,
9394 )
94- import Data.Coerce (coerce )
9595import Data.List.NonEmpty (NonEmpty )
9696import Data.Map.NonEmpty (NonEmptyMap )
9797import Data.Set.NonEmpty (NonEmptySet )
@@ -253,12 +253,13 @@ validateNoPtrInCollateralReturn txBody = do
253253 Just collateralReturn
254254 failOnJustStatic hasCollateralTxOut (injectFailure . PtrPresentInCollateralReturn )
255255
256- utxoTransition ::
256+ dijkstraUtxoTransition ::
257257 forall era .
258258 ( EraUTxO era
259259 , EraCertState era
260260 , BabbageEraTxBody era
261- , AlonzoEraTxWits era
261+ , AlonzoEraTx era
262+ , EraStake era
262263 , InjectRuleFailure " UTXO" ShelleyUtxoPredFailure era
263264 , InjectRuleFailure " UTXO" AllegraUtxoPredFailure era
264265 , InjectRuleFailure " UTXO" AlonzoUtxoPredFailure era
@@ -269,27 +270,28 @@ utxoTransition ::
269270 , Signal (EraRule " UTXO" era ) ~ Tx TopTx era
270271 , BaseM (EraRule " UTXO" era ) ~ ShelleyBase
271272 , STS (EraRule " UTXO" era )
273+ , Event (EraRule " UTXO" era ) ~ AlonzoUtxoEvent era
272274 , -- In this function we we call the UTXOS rule, so we need some assumptions
273- Environment (EraRule " UTXOS" era ) ~ UtxoEnv era
275+ Environment (EraRule " UTXOS" era ) ~ PParams era
274276 , State (EraRule " UTXOS" era ) ~ UTxOState era
275277 , Signal (EraRule " UTXOS" era ) ~ Tx TopTx era
276278 , Embed (EraRule " UTXOS" era ) (EraRule " UTXO" era )
277279 ) =>
278280 TransitionRule (EraRule " UTXO" era )
279- utxoTransition = do
280- TRC (_, _ , tx) <- judgmentContext
281+ dijkstraUtxoTransition = do
282+ TRC (UtxoEnv _ pp certState, utxos , tx) <- judgmentContext
281283 babbageUtxoValidation
282-
283284 validateNoPtrInCollateralReturn $ tx ^. bodyTxL
284-
285- trans @ ( EraRule " UTXOS " era ) =<< coerce <$> judgmentContext
285+ updatedUtxos <- trans @ ( EraRule " UTXOS " era ) $ TRC (pp, utxos, tx)
286+ updateUTxOStateByTxValidity pp certState (utxosGovState utxos) tx updatedUtxos
286287
287288instance
288289 forall era .
289290 ( EraTx era
290291 , EraUTxO era
292+ , EraStake era
291293 , ConwayEraTxBody era
292- , AlonzoEraTxWits era
294+ , AlonzoEraTx era
293295 , EraRule " UTXO" era ~ DijkstraUTXO era
294296 , InjectRuleFailure " UTXO" ShelleyUtxoPredFailure era
295297 , InjectRuleFailure " UTXO" AllegraUtxoPredFailure era
@@ -304,7 +306,7 @@ instance
304306 , STS (EraRule " UTXO" era )
305307 , -- In this function we we call the UTXOS rule, so we need some assumptions
306308 Embed (EraRule " UTXOS" era ) (DijkstraUTXO era )
307- , Environment (EraRule " UTXOS" era ) ~ UtxoEnv era
309+ , Environment (EraRule " UTXOS" era ) ~ PParams era
308310 , State (EraRule " UTXOS" era ) ~ UTxOState era
309311 , Signal (EraRule " UTXOS" era ) ~ Tx TopTx era
310312 , EraCertState era
@@ -313,18 +315,18 @@ instance
313315 ) =>
314316 STS (DijkstraUTXO era )
315317 where
316- type State (DijkstraUTXO era ) = Shelley. UTxOState era
318+ type State (DijkstraUTXO era ) = UTxOState era
317319 type Signal (DijkstraUTXO era ) = Tx TopTx era
318- type Environment (DijkstraUTXO era ) = Shelley. UtxoEnv era
320+ type Environment (DijkstraUTXO era ) = UtxoEnv era
319321 type BaseM (DijkstraUTXO era ) = ShelleyBase
320322 type PredicateFailure (DijkstraUTXO era ) = DijkstraUtxoPredFailure era
321323 type Event (DijkstraUTXO era ) = AlonzoUtxoEvent era
322324
323325 initialRules = []
324326
325- transitionRules = [utxoTransition @ era ]
327+ transitionRules = [dijkstraUtxoTransition @ era ]
326328
327- assertions = [Shelley. validSizeComputationCheck]
329+ assertions = [validSizeComputationCheck]
328330
329331instance
330332 ( Era era
0 commit comments