Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Co-authored-by: Erik de Castro Lopo  <erik.de.castro.lopo@iohk.io>
  • Loading branch information
JaredCorduan authored and Jimbo4350 committed Oct 20, 2021
1 parent e5e22ab commit e5436e2
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 72 deletions.
31 changes: 17 additions & 14 deletions cabal.project
Expand Up @@ -145,8 +145,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
tag: 64d7702866225f6d53afab4e2fe935f2f0d5848a
--sha256: 0aalxzrgb1pgaz254mddmrcn2zk6g0yip383kc346ma1nn49frh1
tag: 654f5b7c76f7cc57900b4ddc664a82fc3b925fb0
--sha256: 0j4x9zbx5dkww82sqi086h39p456iq5xr476ylmrnpwcpfb4xai4
subdir:
base-deriving-via
binary
Expand All @@ -162,14 +162,14 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-crypto
tag: 07397f0e50da97eaa0575d93bee7ac4b2b2576ec
--sha256: 06sdx5ndn2g722jhpicmg96vsrys89fl81k8290b3lr6b1b0w4m3
tag: f73079303f663e028288f9f4a9e08bcca39a923e
--sha256: 1n87i15x54s0cjkh3nsxs4r1x016cdw1fypwmr68936n3xxsjn6q

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: ac51494e151af0ad99b937a787458ce71db0aaea
--sha256: 1dh80kaqhq4fn0w1dixcqiir3mz5nahr7n9drds3rrjlx1nkczi4
tag: bf008ce028751cae9fb0b53c3bef20f07c06e333
--sha256: 0my3801w1vinc0kf5yh9lxl6saqxgwm6ccg0vvzi104pafcwwcqx
subdir:
eras/alonzo/impl
eras/alonzo/test-suite
Expand All @@ -184,6 +184,7 @@ source-repository-package
eras/shelley-ma/impl
eras/shelley-ma/test-suite
libs/cardano-ledger-core
libs/cardano-ledger-pretty
libs/cardano-protocol-tpraos
libs/small-steps
libs/small-steps-test
Expand All @@ -195,8 +196,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-prelude
tag: fd773f7a58412131512b9f694ab95653ac430852
--sha256: 02jddik1yw0222wd6q0vv10f7y8rdgrlqaiy83ph002f9kjx7mh6
tag: bb4ed71ba8e587f672d06edf9d2e376f4b055555
--sha256: 00h10l5mmiza9819p9v5q5749nb9pzgi20vpzpy1d34zmh6gf1cj
subdir:
cardano-prelude
cardano-prelude-test
Expand Down Expand Up @@ -231,8 +232,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: e72d3dc867e946d877f45c22de0b6462723eb589
--sha256: 01rpknlp926x7nifr9zhv3nvn6wv0p3i84vibkb1n3g4minlwb25
tag: 94782e5ca52f234ff8eeddc6322a46cca0b69c0e
--sha256: 1da3pka4pn6sjf6w19d957aryjc9ip1a3g0vz7jz66pjri3v2n0j
subdir:
io-sim
io-classes
Expand All @@ -246,14 +247,16 @@ source-repository-package
ouroboros-network-framework
ouroboros-network-testing
typed-protocols
typed-protocols-cborg
typed-protocols-examples

source-repository-package
type: git
location: https://github.com/input-output-hk/plutus
tag: 15121dd4dc66df7c17c6c0f2f4a8702ad841c020
--sha256: 1g5jm1r58x5ly3vsk8hr3dviqnv1bqhxi2b87vmr53554pd6zcqp
tag: 1efbb276ef1a10ca6961d0fd32e6141e9798bd11
--sha256: 1jicyk4hr8p0xksj4048gdxndrb42jz4wsnkhc3ymxbm5v6snalf
subdir:
freer-extras
plutus-core
plutus-ledger
plutus-ledger-api
Expand All @@ -266,8 +269,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ekg-forward
tag: 2d6691dd8ff68a0be4d9c73912b9559c96b76a25
--sha256: 00wlv9sx9jfnqf503mwvssf44q5lv0cq6virkdf6w25m3cnhx06w
tag: d9e8fd302fa6ba41c07183d371e6777286d37bc2
--sha256: 0s8cblhq3i528jj7r7yd4v82nqzafj8vrgf0y80l7saxc3a5f2lk

-- Drops an instance breaking our code. Should be released to Hackage eventually.
source-repository-package
Expand Down
4 changes: 2 additions & 2 deletions cardano-api/gen/Gen/Cardano/Api.hs
Expand Up @@ -76,8 +76,8 @@ genPrices = do

genExUnits :: Gen Alonzo.ExUnits
genExUnits = do
exUnitsMem' <- Gen.word64 (Range.linear 0 10)
exUnitsSteps' <- Gen.word64 (Range.linear 0 10)
exUnitsMem' <- Gen.integral (Range.linear 0 10)
exUnitsSteps' <- Gen.integral (Range.linear 0 10)
return Alonzo.ExUnits
{ Alonzo.exUnitsMem = exUnitsMem'
, Alonzo.exUnitsSteps = exUnitsSteps'
Expand Down
8 changes: 4 additions & 4 deletions cardano-api/src/Cardano/Api/Block.hs
Expand Up @@ -70,8 +70,8 @@ import qualified Ouroboros.Network.Block as Consensus
import qualified Cardano.Chain.Block as Byron
import qualified Cardano.Chain.UTxO as Byron
import qualified Cardano.Ledger.Era as Ledger
import qualified Cardano.Protocol.TPraos.BHeader as Praos
import qualified Cardano.Ledger.Shelley.BlockChain as Ledger
import qualified Cardano.Protocol.TPraos.BHeader as TPraos
import qualified Cardano.Ledger.Block as Ledger

import Cardano.Api.Eras
import Cardano.Api.HasTypeProxy
Expand Down Expand Up @@ -158,7 +158,7 @@ getShelleyBlockTxs :: forall era ledgerera.
ledgerera ~ ShelleyLedgerEra era
=> Consensus.ShelleyBasedEra ledgerera
=> ShelleyBasedEra era
-> Ledger.Block ledgerera
-> Ledger.Block TPraos.BHeader ledgerera
-> [Tx era]
getShelleyBlockTxs era (Ledger.Block _header txs) =
[ ShelleyTx era txinblock
Expand Down Expand Up @@ -261,7 +261,7 @@ getBlockHeader (ShelleyBlock shelleyEra block) = case shelleyEra of
where
Consensus.HeaderFields {
Consensus.headerFieldHash
= Consensus.ShelleyHash (Praos.HashHeader (Cardano.Crypto.Hash.Class.UnsafeHash hashSBS)),
= Consensus.ShelleyHash (TPraos.HashHeader (Cardano.Crypto.Hash.Class.UnsafeHash hashSBS)),
Consensus.headerFieldSlot,
Consensus.headerFieldBlockNo
} = Consensus.getHeaderFields block
Expand Down
16 changes: 12 additions & 4 deletions cardano-api/src/Cardano/Api/Fees.hs
Expand Up @@ -352,7 +352,7 @@ data ScriptExecutionError =
-- the whole point of it is to discover how many execution units are
-- needed).
--
| ScriptErrorEvaluationFailed Plutus.EvaluationError
| ScriptErrorEvaluationFailed Plutus.EvaluationError [Text.Text]

-- | The execution units overflowed a 64bit word. Congratulations if
-- you encounter this error. With the current style of cost model this
Expand All @@ -364,6 +364,9 @@ data ScriptExecutionError =
-- | An attempt was made to spend a key witnessed tx input
-- with a script witness.
| ScriptErrorNotPlutusWitnessedTxIn ScriptWitnessIndex

-- | A cost model was missing for a language which was used.
| ScriptErrorMissingCostModel Alonzo.Language
deriving Show

instance Error ScriptExecutionError where
Expand All @@ -379,7 +382,7 @@ instance Error ScriptExecutionError where
"The Plutus script witness has the wrong datum (according to the UTxO). "
++ "The expected datum value has hash " ++ show dh

displayError (ScriptErrorEvaluationFailed evalErr) =
displayError (ScriptErrorEvaluationFailed evalErr _logs) = -- TODO display logs
"The Plutus script evaluation failed: " ++ pp evalErr
where
pp :: PP.Pretty p => p -> String
Expand All @@ -397,6 +400,9 @@ instance Error ScriptExecutionError where
renderScriptWitnessIndex scriptWitness <> " is not a Plutus script \
\witnessed tx input and cannot be spent using a Plutus script witness."

displayError (ScriptErrorMissingCostModel language) =
"No cost model was found for language " <> show language

-- | The transaction validity interval is too far into the future.
--
-- Transactions with Plutus scripts need to have a validity interval that is
Expand Down Expand Up @@ -524,7 +530,8 @@ evaluateTransactionExecutionUnits _eraInMode systemstart history pparams utxo tx
Alonzo.InvalidTxIn txin -> ScriptErrorTxInWithoutDatum txin'
where txin' = fromShelleyTxIn txin
Alonzo.MissingDatum dh -> ScriptErrorWrongDatum (ScriptDataHash dh)
Alonzo.ValidationFailed err -> ScriptErrorEvaluationFailed err
Alonzo.ValidationFailedV1 err logs -> ScriptErrorEvaluationFailed err logs
Alonzo.ValidationFailedV2 err logs -> ScriptErrorEvaluationFailed err logs
Alonzo.IncompatibleBudget _ -> ScriptErrorExecutionUnitsOverflow

-- This is only possible for spending scripts and occurs when
Expand All @@ -536,6 +543,7 @@ evaluateTransactionExecutionUnits _eraInMode systemstart history pparams utxo tx
-- build transactions in the API:
Alonzo.MissingScript rdmrPtr ->
impossible ("MissingScript " ++ show (fromAlonzoRdmrPtr rdmrPtr))
Alonzo.NoCostModel l -> ScriptErrorMissingCostModel l

impossible detail = error $ "evaluateTransactionExecutionUnits: "
++ "the impossible happened: " ++ detail
Expand Down Expand Up @@ -790,7 +798,7 @@ handleExUnitsErrors ScriptInvalid failuresMap exUnitsMap
scriptFailures = filter isScriptErrorEvaluationFailed (Map.toList failuresMap)
isScriptErrorEvaluationFailed :: (ScriptWitnessIndex, ScriptExecutionError) -> Bool
isScriptErrorEvaluationFailed (_, e) = case e of
ScriptErrorEvaluationFailed _ -> True
ScriptErrorEvaluationFailed _ _ -> True
_ -> True

data BalancedTxBody era
Expand Down
1 change: 0 additions & 1 deletion cardano-api/src/Cardano/Api/LedgerState.hs
Expand Up @@ -112,7 +112,6 @@ import qualified Ouroboros.Network.Protocol.ChainSync.Client as CS
import qualified Ouroboros.Network.Protocol.ChainSync.ClientPipelined as CSP
import Ouroboros.Network.Protocol.ChainSync.PipelineDecision
import qualified Cardano.Ledger.Shelley.Genesis as Shelley.Spec
import qualified Cardano.Ledger.Shelley.PParams as Shelley.Spec
import Data.Maybe (mapMaybe)
import Ouroboros.Consensus.TypeFamilyWrappers (WrapLedgerEvent(WrapLedgerEvent))

Expand Down
17 changes: 10 additions & 7 deletions cardano-api/src/Cardano/Api/Orphans.hs
Expand Up @@ -48,9 +48,9 @@ import qualified Cardano.Ledger.Core as Ledger
import qualified Cardano.Ledger.Crypto as Crypto
import qualified Cardano.Ledger.Era as Ledger
import qualified Cardano.Ledger.Mary.Value as Mary
import qualified Cardano.Ledger.PoolDistr as Ledger
import qualified Cardano.Ledger.SafeHash as SafeHash
import qualified Cardano.Ledger.Shelley.Constraints as Shelley
import qualified Cardano.Protocol.TPraos as Praos
import qualified Ouroboros.Consensus.Shelley.Eras as Consensus
import qualified Cardano.Ledger.Shelley.API as Shelley
import qualified Cardano.Ledger.Shelley.EpochBoundary as ShelleyEpoch
Expand Down Expand Up @@ -279,13 +279,13 @@ instance Crypto.Crypto crypto => ToJSON (Shelley.PulsingRewUpdate crypto) where
instance ToJSON Shelley.DeltaCoin where
toJSON (Shelley.DeltaCoin i) = toJSON i

instance Crypto.Crypto crypto => ToJSON (Praos.PoolDistr crypto) where
toJSON (Praos.PoolDistr m) = toJSON m
instance Crypto.Crypto crypto => ToJSON (Ledger.PoolDistr crypto) where
toJSON (Ledger.PoolDistr m) = toJSON m

instance Crypto.Crypto crypto => ToJSON (Praos.IndividualPoolStake crypto) where
instance Crypto.Crypto crypto => ToJSON (Ledger.IndividualPoolStake crypto) where
toJSON indivPoolStake =
object [ "individualPoolStake" .= Praos.individualPoolStake indivPoolStake
, "individualPoolStakeVrf" .= Praos.individualPoolStakeVrf indivPoolStake
object [ "individualPoolStake" .= Ledger.individualPoolStake indivPoolStake
, "individualPoolStakeVrf" .= Ledger.individualPoolStakeVrf indivPoolStake
]

instance Crypto.Crypto crypto => ToJSON (Shelley.Reward crypto) where
Expand All @@ -304,8 +304,10 @@ instance Crypto.Crypto c => ToJSON (SafeHash.SafeHash c a) where

-----

deriving instance ToJSON a => ToJSON (Alonzo.ExUnits' a)
instance ToJSON Alonzo.ExUnits
deriving instance FromJSON Alonzo.ExUnits
deriving instance FromJSON a => FromJSON (Alonzo.ExUnits' a)
deriving newtype instance FromJSON Alonzo.ExUnits

instance ToJSON Alonzo.Prices where
toJSON Alonzo.Prices { Alonzo.prSteps, Alonzo.prMem } =
Expand Down Expand Up @@ -335,6 +337,7 @@ deriving newtype instance ToJSON Alonzo.CostModel

languageToText :: Alonzo.Language -> Text
languageToText Alonzo.PlutusV1 = "PlutusV1"
languageToText Alonzo.PlutusV2 = "PlutusV2"

languageFromText :: MonadFail m => Text -> m Alonzo.Language
languageFromText "PlutusV1" = pure Alonzo.PlutusV1
Expand Down
6 changes: 3 additions & 3 deletions cardano-api/src/Cardano/Api/ProtocolParameters.hs
Expand Up @@ -84,8 +84,7 @@ import Cardano.Ledger.Crypto (StandardCrypto)
import qualified Cardano.Ledger.Era as Ledger
import qualified Cardano.Ledger.Keys as Ledger

import qualified Cardano.Ledger.Shelley.PParams as Ledger (ProposedPPUpdates (..), ProtVer (..),
Update (..))
import qualified Cardano.Ledger.Shelley.PParams as Ledger (ProposedPPUpdates (..), Update (..))
-- Some of the things from Cardano.Ledger.Shelley.PParams are generic across all
-- eras, and some are specific to the Shelley era (and other pre-Alonzo eras).
-- So we import in twice under different names.
Expand Down Expand Up @@ -780,6 +779,7 @@ toAlonzoScriptLanguage (AnyPlutusScriptVersion PlutusScriptV1) = Alonzo.PlutusV1

fromAlonzoScriptLanguage :: Alonzo.Language -> AnyPlutusScriptVersion
fromAlonzoScriptLanguage Alonzo.PlutusV1 = AnyPlutusScriptVersion PlutusScriptV1
fromAlonzoScriptLanguage Alonzo.PlutusV2 = error "PlutusV2 is not supported"

toAlonzoCostModel :: CostModel -> Alonzo.CostModel
toAlonzoCostModel (CostModel m) = Alonzo.CostModel m
Expand Down Expand Up @@ -1258,7 +1258,7 @@ toAlonzoPParams ProtocolParameters {
Alonzo.PParams {
Alonzo._protocolVersion
= let (maj, minor) = protocolParamProtocolVersion
in Alonzo.ProtVer maj minor
in Ledger.ProtVer maj minor
, Alonzo._d = fromMaybe
(error "toAlonzoPParams: invalid Decentralization value")
(Ledger.boundRational protocolParamDecentralization)
Expand Down
14 changes: 8 additions & 6 deletions cardano-api/src/Cardano/Api/Script.hs
Expand Up @@ -96,7 +96,6 @@ module Cardano.Api.Script (

import Prelude

import Data.Word (Word64)
import qualified Data.ByteString.Lazy as LBS
import Data.ByteString.Short (ShortByteString)
import qualified Data.ByteString.Short as SBS
Expand Down Expand Up @@ -330,6 +329,7 @@ toAlonzoLanguage (AnyPlutusScriptVersion PlutusScriptV1) = Alonzo.PlutusV1

fromAlonzoLanguage :: Alonzo.Language -> AnyPlutusScriptVersion
fromAlonzoLanguage Alonzo.PlutusV1 = AnyPlutusScriptVersion PlutusScriptV1
fromAlonzoLanguage Alonzo.PlutusV2 = error "PlutusV2 not supported"


class HasTypeProxy lang => IsScriptLanguage lang where
Expand Down Expand Up @@ -749,11 +749,11 @@ deriving instance Show (ScriptWitnessInCtx witctx)
data ExecutionUnits =
ExecutionUnits {
-- | This corresponds roughly to the time to execute a script.
executionSteps :: Word64,
executionSteps :: Natural,

-- | This corresponds roughly to the peak memory used during script
-- execution.
executionMemory :: Word64
executionMemory :: Natural
}
deriving (Eq, Show)

Expand Down Expand Up @@ -846,7 +846,7 @@ hashScript (PlutusScript PlutusScriptV1 (PlutusScriptSerialised script)) =
-- hash that. Later ledger eras have to be compatible anyway.
ScriptHash
. Ledger.hashScript @(ShelleyLedgerEra AlonzoEra)
$ Alonzo.PlutusScript script
$ Alonzo.PlutusScript Alonzo.PlutusV1 script

toShelleyScriptHash :: ScriptHash -> Shelley.ScriptHash StandardCrypto
toShelleyScriptHash (ScriptHash h) = h
Expand Down Expand Up @@ -1029,7 +1029,7 @@ toShelleyScript (ScriptInEra langInEra (SimpleScript SimpleScriptV2 script)) =
toShelleyScript (ScriptInEra langInEra (PlutusScript PlutusScriptV1
(PlutusScriptSerialised script))) =
case langInEra of
PlutusScriptV1InAlonzo -> Alonzo.PlutusScript script
PlutusScriptV1InAlonzo -> Alonzo.PlutusScript Alonzo.PlutusV1 script

fromShelleyBasedScript :: ShelleyBasedEra era
-> Ledger.Script (ShelleyLedgerEra era)
Expand All @@ -1054,10 +1054,12 @@ fromShelleyBasedScript era script =
ScriptInEra SimpleScriptV2InAlonzo $
SimpleScript SimpleScriptV2 $
fromAllegraTimelock TimeLocksInSimpleScriptV2 s
Alonzo.PlutusScript s ->
Alonzo.PlutusScript Alonzo.PlutusV1 s ->
ScriptInEra PlutusScriptV1InAlonzo $
PlutusScript PlutusScriptV1 $
PlutusScriptSerialised s
Alonzo.PlutusScript Alonzo.PlutusV2 _ ->
error "PlutusV2 not supported"


-- | Conversion for the 'Shelley.MultiSig' language used by the Shelley era.
Expand Down

0 comments on commit e5436e2

Please sign in to comment.