Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

Commit 27e66f6

Browse files
Fix cardano-node-emulator-test build errors
1 parent 3063d7b commit 27e66f6

File tree

7 files changed

+31
-23
lines changed

7 files changed

+31
-23
lines changed

cabal.project

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ repository cardano-haskell-packages
1313

1414
-- See CONTRIBUTING.adoc for how to update index-state
1515
index-state:
16-
, hackage.haskell.org 2023-07-10T00:00:00Z
17-
, cardano-haskell-packages 2023-07-10T00:00:00Z
16+
, hackage.haskell.org 2023-08-23T00:00:00Z
17+
, cardano-haskell-packages 2023-08-23T00:00:00Z
1818

1919
packages: plutus-ledger
2020
plutus-script-utils
@@ -32,6 +32,9 @@ benchmarks: true
3232
-- 'tasty' output.
3333
test-show-details: direct
3434

35+
package cardano-crypto-praos
36+
flags: -external-libsodium-vrf
37+
3538
allow-newer:
3639
-- cardano-ledger packages need aeson >2, the following packages have a
3740
-- too restictive upper bounds on aeson, so we relax them here. The hackage

cardano-node-emulator/cardano-node-emulator.cabal

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ library
5555
build-depends:
5656
, cardano-api:{cardano-api, gen} ^>=8.2
5757
, cardano-crypto
58+
, cardano-ledger-allegra
5859
, cardano-ledger-alonzo
5960
, cardano-ledger-api
6061
, cardano-ledger-babbage
6162
, cardano-ledger-core
63+
, cardano-ledger-mary
6264
, cardano-ledger-shelley
63-
, cardano-ledger-shelley-ma
6465
, cardano-slotting
6566
, ouroboros-consensus
6667
, plutus-core >=1.0.0
@@ -87,6 +88,7 @@ library
8788
, mtl
8889
, prettyprinter >=1.1.0.1
8990
, QuickCheck
91+
, quickcheck-contractmodel
9092
, quickcheck-dynamic
9193
, serialise
9294
, text
@@ -127,20 +129,19 @@ test-suite cardano-node-emulator-test
127129
------------------------
128130
build-depends:
129131
, aeson
130-
, base >=4.9 && <5
132+
, base >=4.9 && <5
131133
, bytestring
132134
, containers
133135
, data-default
134136
, hedgehog
135137
, lens
136138
, mtl
137139
, QuickCheck
140+
, quickcheck-contractmodel
141+
, quickcheck-dynamic
138142
, tasty
139143
, tasty-golden
140144
, tasty-hedgehog
141145
, tasty-hunit
142146
, tasty-quickcheck
143147
, text
144-
145-
-- , quickcheck-contractmodel
146-
-- , quickcheck-dynamic

cardano-node-emulator/src/Cardano/Node/Emulator/Internal/Node/Params.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{-# LANGUAGE RecordWildCards #-}
66
{-# LANGUAGE TemplateHaskell #-}
77
{-# OPTIONS_GHC -Wno-orphans #-}
8+
{-# LANGUAGE TupleSections #-}
89
-- | The set of parameters, like protocol parameters and slot configuration.
910
module Cardano.Node.Emulator.Internal.Node.Params (
1011
Params(..),
@@ -59,6 +60,7 @@ import GHC.Generics (Generic)
5960
import GHC.Natural (Natural)
6061
import Ledger.Test (testnet)
6162
import Ouroboros.Consensus.HardFork.History qualified as Ouroboros
63+
import Plutus.Script.Utils.Scripts (Language (PlutusV3))
6264
import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultCostModelParams)
6365
import PlutusLedgerApi.V1 (POSIXTime (POSIXTime))
6466
import Prettyprinter (Pretty (pretty), viaShow, vsep, (<+>))
@@ -173,7 +175,8 @@ instance Default C.ProtocolParameters where
173175
, protocolParamTreasuryCut = 1 % 5
174176
, protocolParamUTxOCostPerWord = Nothing -- Obsolete from babbage onwards
175177
, protocolParamCostModels =
176-
let costModels = Map.fromList $ fromJust $ traverse (\l -> (,) l <$> (defaultCostModelParams >>= Alonzo.costModelFromMap l)) [minBound .. maxBound]
178+
let costModel = fromJust $ defaultCostModelParams >>= Alonzo.costModelFromMap PlutusV3
179+
costModels = Map.fromList $ map (, costModel) [minBound .. maxBound]
177180
in C.fromAlonzoCostModels $ Alonzo.CostModels costModels mempty mempty
178181
, protocolParamPrices = Just (C.ExecutionUnitPrices {priceExecutionSteps = 721 % 10000000, priceExecutionMemory = 577 % 10000})
179182
, protocolParamMaxTxExUnits = Just (C.ExecutionUnits {executionSteps = 10000000000, executionMemory = 14000000})

cardano-node-emulator/src/Cardano/Node/Emulator/Test.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import Cardano.Node.Emulator.API (EmulatorLogs, EmulatorM, EmulatorMsg (ChainEve
3131
emptyEmulatorStateWithInitialDist, esChainState, getParams)
3232
import Cardano.Node.Emulator.Generators (knownAddresses)
3333
import Cardano.Node.Emulator.Internal.Node qualified as E
34-
import Cardano.Node.Emulator.Internal.Node.Params (pNetworkId, pProtocolParams)
34+
import Cardano.Node.Emulator.Internal.Node.Params (pNetworkId)
3535
import Control.Lens (use, view, (^.))
3636
import Control.Monad.Except (runExceptT)
3737
import Control.Monad.RWS.Strict (evalRWS)
@@ -135,7 +135,7 @@ propRunActionsWithOptions initialDist params predicate actions =
135135
monadic runFinalPredicate monadicPredicate
136136
where
137137
finalState = stateAfter actions
138-
ps = pProtocolParams params
138+
ps = E.bundledProtocolParameters params
139139

140140
monadicPredicate :: PropertyM (RunMonad EmulatorM) Property
141141
monadicPredicate = do

cardano-node-emulator/test/Cardano/Node/Emulator/GeneratorsSpec.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Cardano.Node.Emulator.Generators qualified as Gen
1010
import Cardano.Node.Emulator.Internal.Node.TimeSlot (SlotConfig (scSlotLength))
1111
import Cardano.Node.Emulator.Internal.Node.TimeSlot qualified as TimeSlot
1212
import Data.Aeson qualified as JSON
13-
import Data.Aeson.Internal qualified as Aeson
13+
import Data.Aeson.Types qualified as Aeson
1414
import Data.String (fromString)
1515
import Hedgehog (Gen, Property, forAll, property)
1616
import Hedgehog qualified
@@ -93,8 +93,9 @@ ledgerBytesShowFromHexProp :: Property
9393
ledgerBytesShowFromHexProp = property $ do
9494
bts <- forAll $ Bytes.LedgerBytes . PlutusTx.toBuiltin <$> Gen.genSizedByteString 32
9595
let result = Bytes.fromHex $ fromString $ show bts
96-
97-
Hedgehog.assert $ result == Right bts
96+
case result of
97+
Left _ -> Hedgehog.failure
98+
Right res -> Hedgehog.assert $ res == bts
9899

99100
ledgerBytesToJSONProp :: Property
100101
ledgerBytesToJSONProp = property $ do

cardano-node-emulator/test/Plutus/Example/Game.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ import Control.Monad (void)
2828
import Data.ByteString.Char8 qualified as C
2929
import Data.Map qualified as Map
3030
import GHC.Generics (Generic)
31-
import Ledger (CardanoAddress, POSIXTime, PaymentPrivateKey, UtxoIndex, getValidator)
31+
import Ledger (CardanoAddress, POSIXTime, PaymentPrivateKey, UtxoIndex, Validator, getValidator)
3232
import Ledger.Address (mkValidatorCardanoAddress)
3333
import Ledger.Tx.CardanoAPI qualified as C
3434
import Ledger.Typed.Scripts qualified as Scripts
3535
import Plutus.Script.Utils.Typed (ScriptContextV2, Versioned)
3636
import Plutus.Script.Utils.V2.Typed.Scripts qualified as V2
37-
import PlutusLedgerApi.V2 (Address, Validator)
37+
import PlutusLedgerApi.V2 (Address)
3838
import PlutusLedgerApi.V2.Contexts qualified as V2
3939
import PlutusTx (FromData, ToData)
4040
import PlutusTx qualified
@@ -126,7 +126,7 @@ data GuessArgs =
126126
mkLockTx :: LockArgs -> (C.CardanoBuildTx, UtxoIndex)
127127
mkLockTx LockArgs { lockArgsGameParam, lockArgsSecret, lockArgsValue } =
128128
let gameAddr = mkGameAddress lockArgsGameParam
129-
datum = C.fromPlutusData $ PlutusTx.toData $ hashString lockArgsSecret
129+
datum = C.unsafeHashableScriptData $ C.fromPlutusData $ PlutusTx.toData $ hashString lockArgsSecret
130130
txOut = C.TxOut
131131
gameAddr
132132
(C.toCardanoTxOutValue lockArgsValue)
@@ -144,7 +144,7 @@ mkGuessTx
144144
-> (C.CardanoBuildTx, UtxoIndex)
145145
mkGuessTx utxos GuessArgs { guessArgsGameParam, guessArgsSecret } =
146146
let witnessHeader = either (error . show) id $ C.toCardanoTxInScriptWitnessHeader (getValidator <$> mkGameValidator guessArgsGameParam)
147-
redeemer = C.fromPlutusData $ PlutusTx.toData $ clearString guessArgsSecret
147+
redeemer = C.unsafeHashableScriptData $ C.fromPlutusData $ PlutusTx.toData $ clearString guessArgsSecret
148148
witness = C.BuildTxWith $ C.ScriptWitness C.ScriptWitnessForSpending $
149149
witnessHeader C.InlineScriptDatum redeemer C.zeroExecutionUnits
150150
txIns = (, witness) <$> Map.keys (C.unUTxO utxos)

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)