Skip to content

Commit e7693d8

Browse files
committed
Check whether running aiken changes plutus.json
This ensures the plutus blueprint in plutus.json is up-to-date.
1 parent 13b5b8b commit e7693d8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

hydra-plutus/hydra-plutus.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ test-suite tests
109109
, lens
110110
, lens-aeson
111111
, plutus-ledger-api
112-
, process
113112
, QuickCheck
113+
, typed-process
114114

115115
build-tool-depends: hspec-discover:hspec-discover
116116

hydra-plutus/test/Hydra/Plutus/GoldenSpec.hs

+12
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,22 @@ import Hydra.Plutus (commitValidatorScript, depositValidatorScript, initialValid
2929
import Hydra.Version (gitDescribe)
3030
import PlutusLedgerApi.V3 (serialiseCompiledCode)
3131
import PlutusLedgerApi.V3 qualified as Plutus
32+
import System.Process.Typed (proc, runProcess_)
3233
import Test.Hspec.Golden (Golden (..))
3334

3435
spec :: Spec
3536
spec = do
37+
it "Plutus blueprint is up-to-date" $ do
38+
-- Running aiken -t compact should not change plutus.json
39+
existing <- readFileBS "plutus.json"
40+
runProcess_ $ proc "aiken" ["build", "-t", "compact"]
41+
actual <- readFileBS "plutus.json"
42+
-- Undo any changes made by aiken
43+
writeFileBS "plutus.json" existing
44+
when (actual /= existing) $ do
45+
putTextLn "Plutus blueprint in plutus.json is not up-to-date. Run \"aiken -t compact\" to update it."
46+
actual `shouldBe` existing
47+
3648
it "Head validator script" $
3749
goldenScript "vHead" Head.validatorScript
3850
it "Head minting policy script" $

0 commit comments

Comments
 (0)