Skip to content

Commit

Permalink
Included the hash in plutus script translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw committed Jan 7, 2025
1 parent 221eaa8 commit 5aed6e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ source-repository-package
-- !WARNING!:
-- MAKE SURE THIS POINTS TO A COMMIT IN `MAlonzo-code` BEFORE MERGE!
subdir: generated
--sha256: sha256-/YE/qwup2ijMB7bo5eWyBIM+gXZ3Z1g0NZyNSfRwoPY=
tag: 93041ddbf659e0dbc1981d73fecb439b0209d484
--sha256: sha256-fzvk/UcLDZbC+pe9K6gao8JQ/al+L+KdzyPxAaL1xiM=
tag: 098ebf75fc06635bf0a38a82f4086bbd840af7c0

-- NOTE: If you would like to update the above, look for the `MAlonzo-code`
-- branch in the `formal-ledger-specifications` repo and copy the SHA of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ instance NFData BootstrapAddr

instance NFData Timelock

instance NFData HashedTimelock
instance NFData HSTimelock

instance NFData HSPlutusScript

instance NFData UTxOState

Expand Down Expand Up @@ -204,7 +206,9 @@ instance ToExpr BootstrapAddr

instance ToExpr Timelock

instance ToExpr HashedTimelock
instance ToExpr HSTimelock

instance ToExpr HSPlutusScript

instance ToExpr TxBody

Expand Down Expand Up @@ -306,7 +310,9 @@ instance FixupSpecRep BootstrapAddr

instance FixupSpecRep Timelock

instance FixupSpecRep HashedTimelock
instance FixupSpecRep HSTimelock

instance FixupSpecRep HSPlutusScript

instance FixupSpecRep UTxOState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,13 @@ instance
) =>
SpecTranslate ctx (Timelock era)
where
type SpecRep (Timelock era) = Agda.HashedTimelock
type SpecRep (Timelock era) = Agda.HSTimelock

toSpecRep tl =
Agda.HashedTimelock
Agda.HSTimelock
<$> timelockToSpecRep tl
<*> toSpecRep (hashScript @era $ TimelockScript tl)
<*> pure (fromIntegral $ originalBytesSize tl)
where
timelockToSpecRep x =
case x of
Expand All @@ -231,9 +232,12 @@ instance
) =>
SpecTranslate ctx (PlutusScript era)
where
type SpecRep (PlutusScript era) = Agda.ScriptHash
type SpecRep (PlutusScript era) = Agda.HSPlutusScript

toSpecRep ps = toSpecRep . hashScript $ PlutusScript @era ps
toSpecRep ps =
Agda.MkHSPlutusScript
<$> toSpecRep (hashScript $ PlutusScript ps)
<*> pure (fromIntegral $ originalBytesSize ps)

instance
( AlonzoEraScript era
Expand All @@ -245,7 +249,7 @@ instance
type SpecRep (AlonzoScript era) = Agda.Script

toSpecRep (TimelockScript s) = Left <$> toSpecRep s
toSpecRep (PlutusScript s) = Right . (,()) <$> toSpecRep s
toSpecRep (PlutusScript s) = Right <$> toSpecRep s

instance
( EraTxOut era
Expand Down

0 comments on commit 5aed6e5

Please sign in to comment.