Skip to content

Commit c10b2c9

Browse files
committed
Included the hash in plutus script translation
1 parent 221eaa8 commit c10b2c9

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

cabal.project

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ repository cardano-haskell-packages
2020
-- $ nix-prefetch-git https://github.com/intersectmbo/formal-ledger-specifications --rev <GIT_SHA> | jq .hash
2121
source-repository-package
2222
type: git
23-
location: https://github.com/IntersectMBO/formal-ledger-specifications.git
23+
location: https://github.com/Soupstraw/exec-spec-temporary.git
2424
-- !WARNING!:
2525
-- MAKE SURE THIS POINTS TO A COMMIT IN `MAlonzo-code` BEFORE MERGE!
26-
subdir: generated
27-
--sha256: sha256-/YE/qwup2ijMB7bo5eWyBIM+gXZ3Z1g0NZyNSfRwoPY=
28-
tag: 93041ddbf659e0dbc1981d73fecb439b0209d484
26+
--subdir: generated
27+
--sha256: sha256-AchcHHnOf63NKnSyfhcPjt+z11PPIjV3olCexvzKKKo=
28+
tag: 8cf7321a142917dd0eaf20a83b24a2eed6757969
2929

3030
-- NOTE: If you would like to update the above, look for the `MAlonzo-code`
3131
-- branch in the `formal-ledger-specifications` repo and copy the SHA of

libs/cardano-ledger-conformance/src/Test/Cardano/Ledger/Conformance/Orphans.hs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ instance NFData BootstrapAddr
6262

6363
instance NFData Timelock
6464

65-
instance NFData HashedTimelock
65+
instance NFData HSTimelock
66+
67+
instance NFData HSPlutusScript
6668

6769
instance NFData UTxOState
6870

@@ -204,7 +206,9 @@ instance ToExpr BootstrapAddr
204206

205207
instance ToExpr Timelock
206208

207-
instance ToExpr HashedTimelock
209+
instance ToExpr HSTimelock
210+
211+
instance ToExpr HSPlutusScript
208212

209213
instance ToExpr TxBody
210214

@@ -306,7 +310,9 @@ instance FixupSpecRep BootstrapAddr
306310

307311
instance FixupSpecRep Timelock
308312

309-
instance FixupSpecRep HashedTimelock
313+
instance FixupSpecRep HSTimelock
314+
315+
instance FixupSpecRep HSPlutusScript
310316

311317
instance FixupSpecRep UTxOState
312318

libs/cardano-ledger-conformance/src/Test/Cardano/Ledger/Conformance/SpecTranslate/Conway/Base.hs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,13 @@ instance
201201
) =>
202202
SpecTranslate ctx (Timelock era)
203203
where
204-
type SpecRep (Timelock era) = Agda.HashedTimelock
204+
type SpecRep (Timelock era) = Agda.HSTimelock
205205

206206
toSpecRep tl =
207-
Agda.HashedTimelock
207+
Agda.HSTimelock
208208
<$> timelockToSpecRep tl
209209
<*> toSpecRep (hashScript @era $ TimelockScript tl)
210+
<*> pure (fromIntegral $ originalBytesSize tl)
210211
where
211212
timelockToSpecRep x =
212213
case x of
@@ -231,9 +232,12 @@ instance
231232
) =>
232233
SpecTranslate ctx (PlutusScript era)
233234
where
234-
type SpecRep (PlutusScript era) = Agda.ScriptHash
235+
type SpecRep (PlutusScript era) = Agda.HSPlutusScript
235236

236-
toSpecRep ps = toSpecRep . hashScript $ PlutusScript @era ps
237+
toSpecRep ps =
238+
Agda.MkHSPlutusScript
239+
<$> toSpecRep (hashScript $ PlutusScript ps)
240+
<*> pure (fromIntegral $ originalBytesSize ps)
237241

238242
instance
239243
( AlonzoEraScript era
@@ -245,7 +249,7 @@ instance
245249
type SpecRep (AlonzoScript era) = Agda.Script
246250

247251
toSpecRep (TimelockScript s) = Left <$> toSpecRep s
248-
toSpecRep (PlutusScript s) = Right . (,()) <$> toSpecRep s
252+
toSpecRep (PlutusScript s) = Right <$> toSpecRep s
249253

250254
instance
251255
( EraTxOut era

0 commit comments

Comments
 (0)