Skip to content

Commit

Permalink
Added module Cardano.Ledger.Alonzo.Rules.Utxo.
Browse files Browse the repository at this point in the history
After discussion with Nick, we decided to leave PParams abstract, but make
every thing else abstract. Needed to lessen the constraints on Era generaic
functions 'produced', 'consumed', 'txouts', and 'txid', which were all way
over constrained. Moved feesOK and minfee from Cardano.Ledger.Alonzo.Tx
to  Cardano.Ledger.Alonzo.Rules.Utxo.
  • Loading branch information
TimSheard authored and newhoggy committed Feb 23, 2021
1 parent 74b7eb8 commit f5bac40
Show file tree
Hide file tree
Showing 8 changed files with 624 additions and 109 deletions.
3 changes: 3 additions & 0 deletions alonzo/impl/cardano-ledger-alonzo.cabal
Expand Up @@ -28,18 +28,21 @@ library
Cardano.Ledger.Alonzo.Tx
Cardano.Ledger.Alonzo.TxBody
Cardano.Ledger.Alonzo.TxWitness
Cardano.Ledger.Alonzo.Rules.Utxo
build-depends:
base >=4.14 && <4.15,
bytestring,
cardano-binary,
cardano-crypto-class,
cardano-ledger-shelley-ma,
cardano-prelude,
cardano-slotting,
containers,
deepseq,
nothunks,
plutus-ledger-api,
plutus-tx,
transformers,
shelley-spec-ledger,
small-steps,
text
Expand Down
10 changes: 10 additions & 0 deletions alonzo/impl/src/Cardano/Ledger/Alonzo/PParams.hs
@@ -1,3 +1,4 @@
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
Expand Down Expand Up @@ -31,6 +32,7 @@ module Cardano.Ledger.Alonzo.PParams
updatePParams,
getLanguageView,
LangDepView (..),
PParamFeeInfo,
)
where

Expand All @@ -46,6 +48,7 @@ import Cardano.Ledger.Alonzo.Scripts
ExUnits (..),
Prices (..),
)
import qualified Cardano.Ledger.Core as Core
import Cardano.Ledger.Era
import Cardano.Ledger.SafeHash
( EraIndependentPParamView,
Expand Down Expand Up @@ -77,6 +80,7 @@ import Data.Maybe (fromMaybe)
import Data.MemoBytes (MemoBytes (..), memoBytes)
import Data.Typeable
import GHC.Generics (Generic)
import GHC.Records (HasField (..))
import NoThunks.Class (InspectHeapNamed (..), NoThunks (..))
import Numeric.Natural (Natural)
import Shelley.Spec.Ledger.BaseTypes
Expand Down Expand Up @@ -552,3 +556,9 @@ getLanguageView pp PlutusV1 =
case Map.lookup PlutusV1 (_costmdls pp) of
Just x -> (PlutusView x)
Nothing -> error ("CostModel map does not have cost for language: " ++ show PlutusV1)

type PParamFeeInfo era =
( HasField "_minfeeA" (Core.PParams era) Natural,
HasField "_minfeeB" (Core.PParams era) Natural,
HasField "_prices" (Core.PParams era) Prices
)

0 comments on commit f5bac40

Please sign in to comment.