Skip to content

Commit

Permalink
Merge pull request #56 from mlabs-haskell/bug-fixes
Browse files Browse the repository at this point in the history
Fix some crucial bugs (0.7.1)
  • Loading branch information
TotallyNotChase authored Sep 15, 2024
2 parents 0b16bbc + 1011308 commit 93306f5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.7.1 - BUG FIX

- Fix function application producing absurd code when applying small constants (unit, bool, integer).

Thanks [@sourabhxyz](https://github.com/sourabhxyz) for [finding the bug](https://github.com/mlabs-haskell/ply/issues/54)!
- Fix `ScriptRoleError` being thrown with the wrong `expectedRole` field.

# 0.7.0 - Bump plutus version to 1.30.0.0

- Dropped V1 support for `Ply.Plutarch`.
Expand Down
2 changes: 1 addition & 1 deletion genPurs/genPurs.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ply-ctl
version: 0.7.0
version: 0.7.1
author: Seungheon <[email protected]>
license: MIT

Expand Down
2 changes: 1 addition & 1 deletion ply-core/ply-core.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ply-core
version: 0.7.0
version: 0.7.1
author: Chase <[email protected]>
license: MIT

Expand Down
6 changes: 3 additions & 3 deletions ply-core/src/Ply/Core/TypedReader.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import Ply.Core.Deserialize (readEnvelope)
import Ply.Core.Internal.Reify
import Ply.Core.Types (
ScriptReaderException (ScriptRoleError, ScriptTypeError),
ScriptRole (ValidatorRole),
TypedScript (TypedScriptConstr),
TypedScriptEnvelope (..),
TypedScriptEnvelope (TypedScriptEnvelope, tsDescription, tsParamTypes, tsRole, tsScript, tsVersion),
)
import Ply.Core.Unsafe (unsafeUnTypedScript)

Expand All @@ -34,7 +33,8 @@ mkTypedScript ::
TypedScriptEnvelope ->
Either ScriptReaderException (TypedScript rl params)
mkTypedScript (TypedScriptEnvelope ver rol params _ prog) = do
unless (rol == reifyRole (Proxy @rl)) . Left $ ScriptRoleError ValidatorRole rol
let expectedRole = reifyRole $ Proxy @rl
unless (rol == expectedRole) . Left $ ScriptRoleError expectedRole rol
let expectedParams = reifyTypenames $ Proxy @params
unless (expectedParams == params) . Left $ ScriptTypeError expectedParams params
pure $ TypedScriptConstr ver prog
Expand Down
2 changes: 1 addition & 1 deletion ply-core/src/Ply/Core/UPLC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ applyConstant ::
applyConstant (Program () DefaultVersion f@(LamAbs () _ body)) c =
Program () DefaultVersion $
let arg = Constant () c
in if isSmallConstant c then subst 1 (const body) f else Apply () f arg
in if isSmallConstant c then subst 1 (const arg) body else Apply () f arg
applyConstant (Program () DefaultVersion f) c = Program () DefaultVersion . Apply () f $ Constant () c
applyConstant (Program () v _) _ =
error $
Expand Down
2 changes: 1 addition & 1 deletion ply-plutarch/ply-plutarch.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ply-plutarch
version: 0.7.0
version: 0.7.1
author: Chase <[email protected]>
license: MIT

Expand Down

0 comments on commit 93306f5

Please sign in to comment.