Skip to content
Open
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
1 change: 1 addition & 0 deletions eras/babbage/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.13.0.0

* Add `babbageUtxoTests`
* Remove deprecated functions `txOutData`, `txOutDataHash`, `txOutScript`
* Remove deprecated type `Babbage`
* Removed deprecated accessor functions:
Expand Down
38 changes: 30 additions & 8 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
module Cardano.Ledger.Babbage.Rules.Utxo (
BabbageUTXO,
BabbageUtxoPredFailure (..),
babbageUtxoTests,
utxoTransition,
feesOK,
validateTotalCollateral,
Expand Down Expand Up @@ -347,8 +348,7 @@ validateOutputTooSmallUTxO pp outs =
)
outs'

-- | The UTxO transition rule for the Babbage eras.
utxoTransition ::
babbageUtxoTests ::
forall era.
( EraUTxO era
, BabbageEraTxBody era
Expand All @@ -363,14 +363,10 @@ utxoTransition ::
, BaseM (EraRule "UTXO" era) ~ ShelleyBase
, STS (EraRule "UTXO" era)
, -- In this function we we call the UTXOS rule, so we need some assumptions
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment no longer holds I believe

Suggested change
, -- In this function we we call the UTXOS rule, so we need some assumptions

Embed (EraRule "UTXOS" era) (EraRule "UTXO" era)
, Environment (EraRule "UTXOS" era) ~ UtxoEnv era
, State (EraRule "UTXOS" era) ~ UTxOState era
, Signal (EraRule "UTXOS" era) ~ Tx TopTx era
, EraCertState era
EraCertState era
) =>
TransitionRule (EraRule "UTXO" era)
utxoTransition = do
babbageUtxoTests = do
TRC (Shelley.UtxoEnv slot pp certState, utxos, tx) <- judgmentContext
let utxo = utxosUtxo utxos

Expand Down Expand Up @@ -440,7 +436,33 @@ utxoTransition = do

{- ‖collateral tx‖ ≤ maxCollInputs pp -}
runTest $ Alonzo.validateTooManyCollateralInputs pp txBody
pure utxos
Copy link
Contributor

Choose a reason for hiding this comment

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

Might it be better to return unit perhaps, to make it clear that the function doesn't change the given state?


-- | The UTxO transition rule for the Babbage eras.
utxoTransition ::
forall era.
( EraUTxO era
, BabbageEraTxBody era
, AlonzoEraTxWits era
, InjectRuleFailure "UTXO" ShelleyUtxoPredFailure era
, InjectRuleFailure "UTXO" AllegraUtxoPredFailure era
, InjectRuleFailure "UTXO" AlonzoUtxoPredFailure era
, InjectRuleFailure "UTXO" BabbageUtxoPredFailure era
, Environment (EraRule "UTXO" era) ~ UtxoEnv era
, State (EraRule "UTXO" era) ~ UTxOState era
, Signal (EraRule "UTXO" era) ~ Tx TopTx era
, BaseM (EraRule "UTXO" era) ~ ShelleyBase
, STS (EraRule "UTXO" era)
, -- In this function we we call the UTXOS rule, so we need some assumptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Accidental double

Suggested change
, -- In this function we we call the UTXOS rule, so we need some assumptions
, -- In this function we call the UTXOS rule, so we need some assumptions

Embed (EraRule "UTXOS" era) (EraRule "UTXO" era)
, Environment (EraRule "UTXOS" era) ~ UtxoEnv era
, State (EraRule "UTXOS" era) ~ UTxOState era
, Signal (EraRule "UTXOS" era) ~ Tx TopTx era
, EraCertState era
) =>
TransitionRule (EraRule "UTXO" era)
utxoTransition = do
_ <- babbageUtxoTests
trans @(EraRule "UTXOS" era) =<< coerce <$> judgmentContext

--------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.21.0.0

* Re-export `UtxoEnv` from `Cardano.Ledger.Conway.Rules.Utxo`
* Change the field type of `ConwayIncompleteWithdrawals` to `Map RewardAccount (Mismatch RelEQ Coin)`
* Make `ConwayAccountState` a pattern synonym
* Remove deprecated type `Conway`
Expand Down
3 changes: 2 additions & 1 deletion eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Cardano.Ledger.Conway.Rules.Utxo (
babbageToConwayUtxoPredFailure,
alonzoToConwayUtxoPredFailure,
ConwayUtxoPredFailure (..),
UtxoEnv (..),
) where

import Cardano.Ledger.Address (Addr, RewardAccount)
Expand Down Expand Up @@ -66,7 +67,7 @@ import Cardano.Ledger.Conway.Rules.Utxos (
)
import Cardano.Ledger.Plutus (ExUnits)
import qualified Cardano.Ledger.Shelley.LedgerState as Shelley (UTxOState)
import Cardano.Ledger.Shelley.Rules (ShelleyUtxoPredFailure)
import Cardano.Ledger.Shelley.Rules (ShelleyUtxoPredFailure, UtxoEnv (..))
import qualified Cardano.Ledger.Shelley.Rules as Shelley (UtxoEnv, validSizeComputationCheck)
import Cardano.Ledger.State (EraCertState (..), EraUTxO, UTxO (..))
import Cardano.Ledger.TxIn (TxIn)
Expand Down
4 changes: 4 additions & 0 deletions eras/dijkstra/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 0.2.0.0

* Add `Test.Cardano.Ledger.Dijkstra.Imp.UtxoSpec`
* Add `DijkstraUtxoPredFailure`
* Add `DijkstraUTXO`
* Add `requiredTopLevelGuardsDijkstraTxBodyRawL`
* Add `dstbRequiredTopLevelGuards` to `TxBody`
* Add `dstbrRequiredTopLevelGuards` to `DijkstraSubTxBodyRaw`
Expand All @@ -24,6 +27,7 @@

### `testlib`

* Add `Arbitrary` and `ToExpr` instances to `DijkstraUtxoPredFailure`
* Remove CDDL `certificate` redefinition to reuse from conway.
* Add CDDL exports for `plutus_v4_script`, `dijkstra_native_script`, `script_require_guard`
* Remove CDDL `protocol_version` redefinition
Expand Down
2 changes: 2 additions & 0 deletions eras/dijkstra/impl/cardano-ledger-dijkstra.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ library
nothunks,
plutus-ledger-api,
small-steps >=1.1.2,
validation-selective,

if flag(asserts)
ghc-options: -fno-ignore-asserts
Expand All @@ -118,6 +119,7 @@ library testlib
Test.Cardano.Ledger.Dijkstra.Era
Test.Cardano.Ledger.Dijkstra.Examples
Test.Cardano.Ledger.Dijkstra.Imp
Test.Cardano.Ledger.Dijkstra.Imp.UtxoSpec
Test.Cardano.Ledger.Dijkstra.Imp.UtxowSpec
Test.Cardano.Ledger.Dijkstra.ImpTest
Test.Cardano.Ledger.Dijkstra.TreeDiff
Expand Down
5 changes: 4 additions & 1 deletion eras/dijkstra/impl/src/Cardano/Ledger/Dijkstra/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
module Cardano.Ledger.Dijkstra.Era (
DijkstraEra,
DijkstraCERT,
DijkstraUTXO,
) where

import Cardano.Ledger.Conway.Core
Expand Down Expand Up @@ -89,7 +90,9 @@ type instance EraRule "GOVCERT" DijkstraEra = ConwayGOVCERT DijkstraEra

type instance EraRule "UTXOW" DijkstraEra = ConwayUTXOW DijkstraEra

type instance EraRule "UTXO" DijkstraEra = ConwayUTXO DijkstraEra
data DijkstraUTXO era

type instance EraRule "UTXO" DijkstraEra = DijkstraUTXO DijkstraEra

type instance EraRule "BBODY" DijkstraEra = ConwayBBODY DijkstraEra

Expand Down
4 changes: 2 additions & 2 deletions eras/dijkstra/impl/src/Cardano/Ledger/Dijkstra/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Dijkstra.Rules () where
module Cardano.Ledger.Dijkstra.Rules (DijkstraUtxoPredFailure (..)) where

import Cardano.Ledger.Conway.Rules (
ConwayEpochEvent (..),
Expand All @@ -22,7 +22,7 @@ import Cardano.Ledger.Dijkstra.Rules.GovCert ()
import Cardano.Ledger.Dijkstra.Rules.Ledger ()
import Cardano.Ledger.Dijkstra.Rules.Ledgers ()
import Cardano.Ledger.Dijkstra.Rules.Pool ()
import Cardano.Ledger.Dijkstra.Rules.Utxo ()
import Cardano.Ledger.Dijkstra.Rules.Utxo (DijkstraUtxoPredFailure (..))
import Cardano.Ledger.Dijkstra.Rules.Utxos ()
import Cardano.Ledger.Dijkstra.Rules.Utxow ()
import Cardano.Ledger.Shelley.Rules (ShelleyTickEvent (..))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Cardano.Ledger.Conway.Rules (
import Cardano.Ledger.Dijkstra.Core (EraRuleEvent, EraRuleFailure, InjectRuleFailure (..))
import Cardano.Ledger.Dijkstra.Era (DijkstraEra)
import Cardano.Ledger.Dijkstra.Rules.Certs ()
import Cardano.Ledger.Dijkstra.Rules.Utxo (DijkstraUtxoPredFailure)
import Cardano.Ledger.Dijkstra.Rules.Utxow ()
import Cardano.Ledger.Shelley.Rules (
ShelleyLedgerPredFailure,
Expand Down Expand Up @@ -95,3 +96,6 @@ instance InjectRuleFailure "LEDGER" ConwayGovCertPredFailure DijkstraEra where

instance InjectRuleFailure "LEDGER" ConwayGovPredFailure DijkstraEra where
injectFailure = ConwayGovFailure

instance InjectRuleFailure "LEDGER" DijkstraUtxoPredFailure DijkstraEra where
injectFailure = ConwayUtxowFailure . injectFailure
Loading