From 7cced4b15367674998ada6abd4b7bb809af38456 Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Mon, 4 Sep 2023 20:23:47 +0530 Subject: [PATCH 1/7] Making ply-core compatible with node 8.1.2, see https://github.com/mlabs-haskell/ply/pull/49 for more discussion --- cabal.project | 20 ++++++++++---------- ply-core/ply-core.cabal | 6 +++--- ply-core/src/Ply/Core/Types.hs | 4 ++-- ply-core/src/Ply/Core/UPLC.hs | 11 +++++++---- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/cabal.project b/cabal.project index 75fd403..5abca02 100644 --- a/cabal.project +++ b/cabal.project @@ -1,5 +1,3 @@ -index-state: 2022-10-31T00:00:00Z - repository cardano-haskell-packages url: https://input-output-hk.github.io/cardano-haskell-packages secure: True @@ -11,17 +9,18 @@ repository cardano-haskell-packages c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56 d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee -index-state: cardano-haskell-packages 2022-10-31T00:00:00Z +-- Repeating the index-state for hackage to work around hackage.nix parsing limitation. +index-state: 2023-06-06T00:00:00Z + +index-state: + , hackage.haskell.org 2023-06-06T00:00:00Z + , cardano-haskell-packages 2023-06-05T06:39:32Z packages: - ./ply-plutarch +-- ./ply-plutarch ./ply-core - ./genPurs - ./example - -write-ghc-environment-files: never - -tests: true +-- ./genPurs +-- ./example test-show-details: direct @@ -39,3 +38,4 @@ constraints: package nothunks flags: +vector + flags: +vector diff --git a/ply-core/ply-core.cabal b/ply-core/ply-core.cabal index cfb76ac..41553c5 100644 --- a/ply-core/ply-core.cabal +++ b/ply-core/ply-core.cabal @@ -27,9 +27,9 @@ common common-deps , bytestring , cardano-binary , containers - , plutus-core - , plutus-ledger-api - , plutus-tx + , plutus-core >= 1.6.0.0 && < 1.8 + , plutus-ledger-api >= 1.6.0.0 && < 1.8 + , plutus-tx >= 1.6.0.0 && < 1.8 , serialise , tagged , text diff --git a/ply-core/src/Ply/Core/Types.hs b/ply-core/src/Ply/Core/Types.hs index bd01fcd..eb394c0 100644 --- a/ply-core/src/Ply/Core/Types.hs +++ b/ply-core/src/Ply/Core/Types.hs @@ -34,7 +34,7 @@ import Data.Aeson.Types ( import Cardano.Binary as CBOR (DecoderError) import qualified Cardano.Binary as CBOR -import PlutusLedgerApi.Common (deserialiseUPLC, serialiseUPLC) +import PlutusLedgerApi.Common (uncheckedDeserialiseUPLC, serialiseUPLC) import UntypedPlutusCore (DeBruijn, DefaultFun, DefaultUni, Program) import Ply.Core.Serialize.Script (serializeScriptCbor) @@ -86,7 +86,7 @@ data TypedScriptEnvelope = TypedScriptEnvelope deriving stock (Eq, Show) cborToScript :: ByteString -> Either DecoderError UPLCProgram -cborToScript x = deserialiseUPLC <$> CBOR.decodeFull' x +cborToScript x = uncheckedDeserialiseUPLC <$> CBOR.decodeFull' x instance FromJSON TypedScriptEnvelope where parseJSON (Object v) = diff --git a/ply-core/src/Ply/Core/UPLC.hs b/ply-core/src/Ply/Core/UPLC.hs index 6f90ffe..baf471c 100644 --- a/ply-core/src/Ply/Core/UPLC.hs +++ b/ply-core/src/Ply/Core/UPLC.hs @@ -5,21 +5,22 @@ import Data.String (IsString) import PlutusCore (Some (Some), ValueOf (ValueOf)) import qualified PlutusCore as PLC +import qualified PlutusCore.Version as PLC import UntypedPlutusCore ( DeBruijn (DeBruijn), DefaultFun, DefaultUni, Index, Program (Program), - Term (Apply, Builtin, Constant, Delay, Error, Force, LamAbs, Var), + Term (Apply, Builtin, Constant, Delay, Error, Force, LamAbs, Var, Constr, Case), Version, ) -pattern DefaultVersion :: Version () +pattern DefaultVersion :: Version pattern DefaultVersion <- - ((== PLC.defaultVersion ()) -> True) + ((== PLC.plcVersion100) -> True) where - DefaultVersion = PLC.defaultVersion () + DefaultVersion = PLC.plcVersion100 {- | Apply a 'DefaultUni' constant to given UPLC program, inlining if necessary. TODO: Subst optimizations when 'Apply'ing over non 'LamAbs' stuff as well, e.g chain of 'Apply'ies. @@ -63,6 +64,8 @@ _termIdOf (Apply () _ _) = "Apply" _termIdOf (LamAbs () _ _) = "LamAbs" _termIdOf (Delay () _) = "Delay" _termIdOf (Force () _) = "Force" +_termIdOf (Constr () _ _) = "Constr" +_termIdOf (Case () _ _) = "Case" isSmallConstant :: Some (ValueOf DefaultUni) -> Bool isSmallConstant c = case c of From c301d9514982abce1b4497237ba8231cf3ca058d Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Mon, 4 Sep 2023 20:38:47 +0530 Subject: [PATCH 2/7] Making ply-core compatible with node 8.1.2, see https://github.com/mlabs-haskell/ply/pull/49 for more discussion --- cabal.project | 1 - 1 file changed, 1 deletion(-) diff --git a/cabal.project b/cabal.project index 5abca02..41b53ef 100644 --- a/cabal.project +++ b/cabal.project @@ -38,4 +38,3 @@ constraints: package nothunks flags: +vector - flags: +vector From 5b3deb74adcd768531a80e7b21001dbd56cb9a33 Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Thu, 20 Jun 2024 16:46:11 +0530 Subject: [PATCH 3/7] feat: remove version constraints to `plutus-*` libraries inside `ply-core` --- ply-core/ply-core.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ply-core/ply-core.cabal b/ply-core/ply-core.cabal index 1390aef..536a66e 100644 --- a/ply-core/ply-core.cabal +++ b/ply-core/ply-core.cabal @@ -27,9 +27,9 @@ common common-deps , bytestring , cardano-binary , containers - , plutus-core >= 1.6.0.0 && < 1.8 - , plutus-ledger-api >= 1.6.0.0 && < 1.8 - , plutus-tx >= 1.6.0.0 && < 1.8 + , plutus-core + , plutus-ledger-api + , plutus-tx , serialise , tagged , text From b13674633771f572a5eedfb47276c0ac3993ab85 Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Thu, 20 Jun 2024 17:19:28 +0530 Subject: [PATCH 4/7] feat: make it build with plutus libraries verision 1.21.* --- ply-core/ply-core.cabal | 6 +++--- ply-core/src/Ply/Core/Class.hs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ply-core/ply-core.cabal b/ply-core/ply-core.cabal index 536a66e..9253112 100644 --- a/ply-core/ply-core.cabal +++ b/ply-core/ply-core.cabal @@ -27,9 +27,9 @@ common common-deps , bytestring , cardano-binary , containers - , plutus-core - , plutus-ledger-api - , plutus-tx + , plutus-core ^>=1.21 + , plutus-ledger-api ^>=1.21 + , plutus-tx ^>=1.21 , serialise , tagged , text diff --git a/ply-core/src/Ply/Core/Class.hs b/ply-core/src/Ply/Core/Class.hs index 32a300e..36ad3cf 100644 --- a/ply-core/src/Ply/Core/Class.hs +++ b/ply-core/src/Ply/Core/Class.hs @@ -13,7 +13,7 @@ import Data.Text (Text) import GHC.TypeLits (ErrorMessage (ShowType, Text)) import Ply.Core.Types (AsData (AsData)) -import PlutusCore (DefaultUni, Includes, Some, ValueOf) +import PlutusCore (DefaultUni, HasTermLevel, Some, ValueOf) import qualified PlutusCore as PLC import qualified PlutusTx.AssocMap as PlutusMap @@ -53,7 +53,7 @@ As a result, 'toBuiltinArg' is partial for types that don't hold their invariant 4. 'toBuiltinArgData' implementation must perform the same validations/normalizations as 'toBuiltinArg'. -} -class DefaultUni `Includes` UPLCRep a => PlyArg a where +class DefaultUni `HasTermLevel` UPLCRep a => PlyArg a where type UPLCRep a :: Type type ToDataConstraint a :: Constraint type ToDataConstraint a = () From 4a61941b3287782d2c11f9ab1cae0889d0a57385 Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Wed, 21 Aug 2024 17:19:13 +0530 Subject: [PATCH 5/7] feat: conway compatibility --- ply-core/ply-core.cabal | 6 +++--- ply-core/src/Ply/Core/Class.hs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ply-core/ply-core.cabal b/ply-core/ply-core.cabal index 9253112..ab5406f 100644 --- a/ply-core/ply-core.cabal +++ b/ply-core/ply-core.cabal @@ -27,9 +27,9 @@ common common-deps , bytestring , cardano-binary , containers - , plutus-core ^>=1.21 - , plutus-ledger-api ^>=1.21 - , plutus-tx ^>=1.21 + , plutus-core ^>=1.30 + , plutus-ledger-api ^>=1.30 + , plutus-tx ^>=1.30 , serialise , tagged , text diff --git a/ply-core/src/Ply/Core/Class.hs b/ply-core/src/Ply/Core/Class.hs index 36ad3cf..058075e 100644 --- a/ply-core/src/Ply/Core/Class.hs +++ b/ply-core/src/Ply/Core/Class.hs @@ -153,7 +153,7 @@ instance PlyArg Value where ( \(cs, tkMap) -> ( toBuiltinArgData cs , toBuiltinArgData - . PlutusMap.fromList + . PlutusMap.unsafeFromList $ map (bimap toBuiltinArg toBuiltinArg) tkMap ) ) From f3190d3c6e09d8067525e0df4418a55bbace2625 Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Wed, 15 Jan 2025 18:14:22 +0530 Subject: [PATCH 6/7] feat: bump plutus library constraints to make it compatible with node 10.1.3 --- ply-core/ply-core.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ply-core/ply-core.cabal b/ply-core/ply-core.cabal index d0bc484..d5c55a6 100644 --- a/ply-core/ply-core.cabal +++ b/ply-core/ply-core.cabal @@ -27,9 +27,9 @@ common common-deps , bytestring , cardano-binary , containers - , plutus-core ^>=1.30 - , plutus-ledger-api ^>=1.30 - , plutus-tx ^>=1.30 + , plutus-core ^>=1.36 + , plutus-ledger-api ^>=1.36 + , plutus-tx ^>=1.36 , serialise , tagged , text From 38ff38abac64d3c56608aa39ee3c1f40148d62cb Mon Sep 17 00:00:00 2001 From: Yurii Pytomets Date: Tue, 25 Feb 2025 00:10:44 +0200 Subject: [PATCH 7/7] Add ScriptV3 --- ply-core/src/Ply/Core/Internal/Reify.hs | 3 +++ ply-core/src/Ply/Core/Types.hs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ply-core/src/Ply/Core/Internal/Reify.hs b/ply-core/src/Ply/Core/Internal/Reify.hs index 788655c..a354857 100644 --- a/ply-core/src/Ply/Core/Internal/Reify.hs +++ b/ply-core/src/Ply/Core/Internal/Reify.hs @@ -26,6 +26,9 @@ instance ReifyVersion ScriptV1 where instance ReifyVersion ScriptV2 where reifyVersion _ = ScriptV2 +instance ReifyVersion ScriptV3 where + reifyVersion _ = ScriptV3 + instance ReifyRole ValidatorRole where reifyRole _ = ValidatorRole diff --git a/ply-core/src/Ply/Core/Types.hs b/ply-core/src/Ply/Core/Types.hs index fd5f7ac..8689b44 100644 --- a/ply-core/src/Ply/Core/Types.hs +++ b/ply-core/src/Ply/Core/Types.hs @@ -58,7 +58,7 @@ data ScriptRole = ValidatorRole | MintingPolicyRole deriving anyclass (ToJSON, FromJSON) -- | Version identifier for the Plutus script. -data ScriptVersion = ScriptV1 | ScriptV2 +data ScriptVersion = ScriptV1 | ScriptV2 | ScriptV3 deriving stock (Bounded, Enum, Eq, Ord, Show, Generic) deriving anyclass (ToJSON, FromJSON) @@ -100,6 +100,7 @@ instance FromJSON TypedScriptEnvelope where version = v .: "version" <|> (parseType =<< v .: "type") parseType "PlutusScriptV1" = pure ScriptV1 parseType "PlutusScriptV2" = pure ScriptV2 + parseType "PlutusScriptV3" = pure ScriptV3 parseType s = fail $ s <> " is not a valid ScriptVersion" parseAndDeserialize v =