diff --git a/plutus-benchmark/plutus-benchmark.cabal b/plutus-benchmark/plutus-benchmark.cabal index df3f1f0aa52..5182a13d4e6 100644 --- a/plutus-benchmark/plutus-benchmark.cabal +++ b/plutus-benchmark/plutus-benchmark.cabal @@ -438,6 +438,7 @@ benchmark bls12-381-benchmarks library script-contexts-internal import: lang, ghc-version-support, os-support hs-source-dirs: script-contexts/src + visibility: public exposed-modules: PlutusBenchmark.V1.Data.ScriptContexts PlutusBenchmark.V1.ScriptContexts diff --git a/plutus-benchmark/script-contexts/src/PlutusBenchmark/V2/Data/ScriptContexts.hs b/plutus-benchmark/script-contexts/src/PlutusBenchmark/V2/Data/ScriptContexts.hs index 6f873704c09..6a282dff64f 100644 --- a/plutus-benchmark/script-contexts/src/PlutusBenchmark/V2/Data/ScriptContexts.hs +++ b/plutus-benchmark/script-contexts/src/PlutusBenchmark/V2/Data/ScriptContexts.hs @@ -4,6 +4,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} +-- {-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:certify=ScriptContextCert #-} module PlutusBenchmark.V2.Data.ScriptContexts where @@ -20,6 +21,8 @@ import PlutusTx.Data.List qualified as DataList import PlutusTx.Plugin () import PlutusTx.Prelude qualified as PlutusTx +-- import PlutusTx.Test.Util.Compiled (compiledCodeToCertPath) + -- | A very crude deterministic generator for 'ScriptContext's with size -- approximately proportional to the input integer. mkScriptContext :: Integer -> ScriptContext diff --git a/plutus-benchmark/script-contexts/test/V2/Spec.hs b/plutus-benchmark/script-contexts/test/V2/Spec.hs index 625690047df..2a6e8434e0b 100644 --- a/plutus-benchmark/script-contexts/test/V2/Spec.hs +++ b/plutus-benchmark/script-contexts/test/V2/Spec.hs @@ -167,11 +167,12 @@ testDataFwdStakeTrick = testDataFwdStakeTrickManual :: TestTree testDataFwdStakeTrickManual = - runTestGhcSOP + (runTestGhcSOP [ Tx.goldenPirReadable "dataFwdStakeTrickManual" testAbsCode , Tx.goldenUPlcReadable "dataFwdStakeTrickManual" testAbsCode , Tx.goldenEvalCekCatchBudget "dataFwdStakeTrickManual" testCode ] + ) where testCredential = Data.SC.mkStakingCredential "someCredential" diff --git a/plutus-executables/plutus-executables.cabal b/plutus-executables/plutus-executables.cabal index d3de421c090..6bc902bb48e 100644 --- a/plutus-executables/plutus-executables.cabal +++ b/plutus-executables/plutus-executables.cabal @@ -156,11 +156,18 @@ test-suite test-certifier type: exitcode-stdio-1.0 main-is: Spec.hs hs-source-dirs: test/certifier - other-modules: Test.Certifier.Executable + other-modules: + Test.Certifier.Executable + Test.Certifier.Plugin + build-depends: , base , directory , filepath + , plutus-benchmark:script-contexts-internal + , plutus-tx + , plutus-tx-plugin + , plutus-tx-test-util , process , tasty , tasty-hunit diff --git a/plutus-executables/test/certifier/Spec.hs b/plutus-executables/test/certifier/Spec.hs index 36da623b869..1b772d109ad 100644 --- a/plutus-executables/test/certifier/Spec.hs +++ b/plutus-executables/test/certifier/Spec.hs @@ -9,6 +9,7 @@ import GHC.IO.Encoding (setLocaleEncoding, utf8) import Test.Tasty import Test.Certifier.Executable (executableTests) +import Test.Certifier.Plugin (pluginTests) main :: IO () main = do @@ -16,4 +17,5 @@ main = do defaultMain $ testGroup "Certification" [ executableTests + , pluginTests ] diff --git a/plutus-executables/test/certifier/Test/Certifier/Plugin.hs b/plutus-executables/test/certifier/Test/Certifier/Plugin.hs new file mode 100644 index 00000000000..3091bde085c --- /dev/null +++ b/plutus-executables/test/certifier/Test/Certifier/Plugin.hs @@ -0,0 +1,38 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TemplateHaskell #-} + +{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:certify=ScriptContextCert #-} + +module Test.Certifier.Plugin where + +import PlutusTx.Test.Util.Compiled (compiledCodeToCertPath) + +import Test.Certifier.Executable (runAgda) + +import PlutusBenchmark.V2.Data.ScriptContexts qualified as Data (forwardWithStakeTrick) + +import PlutusTx qualified + +import Data.Maybe (fromJust) +import System.Directory (removeDirectoryRecursive) +import System.Exit + +import Test.Tasty +import Test.Tasty.HUnit + +mkCertTest :: String -> PlutusTx.CompiledCode a -> TestTree +mkCertTest name code = testCase name $ do + let cPath = fromJust $ compiledCodeToCertPath code + (resECode, resText) <- runAgda cPath + -- removeDirectoryRecursive cPath + putStrLn cPath + assertBool + (name <> " creates an invalid certificate:" <> resText) + (resECode == ExitSuccess) + +pluginTests :: TestTree +pluginTests = + testGroup "Certifier with plugin tests" $ + [ mkCertTest "TESTING Data.forwardWithStakeTrick" $$(PlutusTx.compile [|| Data.forwardWithStakeTrick ||]) + -- Add more tests here as needed + ] diff --git a/plutus-metatheory/src/Certifier.hs b/plutus-metatheory/src/Certifier.hs index fd04632168d..083c6dbd37e 100644 --- a/plutus-metatheory/src/Certifier.hs +++ b/plutus-metatheory/src/Certifier.hs @@ -4,6 +4,7 @@ module Certifier ( , prettyCertifierError , prettyCertifierSuccess , CertifierError (..) + , CertifierSuccess (..) ) where import Control.Monad ((>=>)) diff --git a/plutus-tx-plugin/src/PlutusTx/Compiler/Types.hs b/plutus-tx-plugin/src/PlutusTx/Compiler/Types.hs index 009d89a37ee..4d80dccceed 100644 --- a/plutus-tx-plugin/src/PlutusTx/Compiler/Types.hs +++ b/plutus-tx-plugin/src/PlutusTx/Compiler/Types.hs @@ -35,6 +35,8 @@ import Control.Monad.Reader import Control.Monad.State import Control.Monad.Writer +import Flat (Flat (..)) + import Data.Map qualified as Map import Data.Set (Set) import Data.Set qualified as Set @@ -203,6 +205,64 @@ stableModuleCmp m1 m2 = -- See Note [Stable name comparisons] (GHC.moduleUnit m1 `GHC.stableUnitCmp` GHC.moduleUnit m2) +newtype CertificatePath = CertificatePath + { getCertPath :: Maybe FilePath + } + +instance Flat CertificatePath where + encode (CertificatePath mp) = encode mp + decode = CertificatePath <$> decode + size (CertificatePath mp) = size mp + +instance Semigroup CertificatePath where + CertificatePath p1 <> CertificatePath p2 = + case (p1, p2) of + (Nothing, Nothing) -> CertificatePath Nothing + (Nothing, Just p) -> CertificatePath (Just p) + (Just p, Nothing) -> CertificatePath (Just p) + -- Overwrite the old path with the new path + (Just _, Just p) -> CertificatePath (Just p) + +instance Monoid CertificatePath where + mempty = CertificatePath Nothing + +data CompileOutput = CompileOutput + { coCoverageIndex :: CoverageIndex + , coCertPath :: CertificatePath + } + +instance Semigroup CompileOutput where + CompileOutput i1 c1 <> CompileOutput i2 c2 = + CompileOutput (i1 <> i2) (c1 <> c2) + +instance Monoid CompileOutput where + mempty = CompileOutput mempty mempty + +instance Flat CompileOutput where + encode (CompileOutput i c) = encode i <> encode c + decode = CompileOutput <$> decode <*> decode + size (CompileOutput i c) x = size i x + size c x + +-- | Include a location coverage annotation in the index +addLocationToCoverageIndex :: MonadWriter CompileOutput m => CovLoc -> m CoverageAnnotation +addLocationToCoverageIndex src = do + let ann = CoverLocation src + tell $ CompileOutput (CoverageIndex $ Map.singleton ann mempty) mempty + pure ann + +-- | Include a boolean coverage annotation in the index +addBoolCaseToCoverageIndex :: MonadWriter CompileOutput m + => CovLoc -> Bool -> CoverageMetadata -> m CoverageAnnotation +addBoolCaseToCoverageIndex src b meta = do + let ann = CoverBool src b + tell $ CompileOutput (CoverageIndex (Map.singleton ann meta)) mempty + pure ann + +addCertificatePath :: MonadWriter CompileOutput m => FilePath -> m () +addCertificatePath path = do + let certPath = CertificatePath (Just path) + tell $ CompileOutput mempty certPath + -- See Note [Scopes] type Compiling uni fun m ann = ( MonadError (CompileError uni fun ann) m @@ -210,7 +270,8 @@ type Compiling uni fun m ann = , MonadReader (CompileContext uni fun) m , MonadState CompileState m , MonadDefs LexName uni fun Ann m - , MonadWriter CoverageIndex m + -- TODO: fix + , MonadWriter CompileOutput m ) -- Packing up equality constraints gives us a nice way of writing type signatures as this way diff --git a/plutus-tx-plugin/src/PlutusTx/Plugin.hs b/plutus-tx-plugin/src/PlutusTx/Plugin.hs index e6d3230e170..2ffe283f8de 100644 --- a/plutus-tx-plugin/src/PlutusTx/Plugin.hs +++ b/plutus-tx-plugin/src/PlutusTx/Plugin.hs @@ -22,7 +22,6 @@ import PlutusTx.Compiler.Error import PlutusTx.Compiler.Expr import PlutusTx.Compiler.Trace import PlutusTx.Compiler.Types -import PlutusTx.Coverage import PlutusTx.Function qualified import PlutusTx.Optimize.Inline qualified import PlutusTx.PIRTypes @@ -412,7 +411,7 @@ compileMarkedExpr locStr codeTy origE = do , 'useToOpaque , 'useFromOpaque , 'mkNilOpaque - , 'PlutusTx.Builtins.equalsInteger + , 'PlutusTx.Builtins.equalsInteger ] modBreaks <- asks pcModuleModBreaks let coverage = @@ -446,7 +445,7 @@ compileMarkedExpr locStr codeTy origE = do -- See Note [Occurrence analysis] let origE' = GHC.occurAnalyseExpr origE - ((pirP, uplcP), covIdx) <- + ((pirP, uplcP), compOut) <- runWriterT . runQuoteT . flip runReaderT ctx . flip evalStateT st $ traceCompilation 1 ("Compiling expr at" GHC.<+> GHC.text locStr) $ runCompiler moduleNameStr opts origE' @@ -454,7 +453,8 @@ compileMarkedExpr locStr codeTy origE = do -- serialize the PIR, PLC, and coverageindex outputs into a bytestring. bsPir <- makeByteStringLiteral $ flat pirP bsPlc <- makeByteStringLiteral $ flat (UPLC.UnrestrictedProgram uplcP) - covIdxFlat <- makeByteStringLiteral $ flat covIdx + compOutFlat <- makeByteStringLiteral $ flat compOut + builder <- lift . lift . GHC.lookupId =<< thNameToGhcNameOrFail 'mkCompiledCode @@ -464,7 +464,7 @@ compileMarkedExpr locStr codeTy origE = do `GHC.App` GHC.Type codeTy `GHC.App` bsPlc `GHC.App` bsPir - `GHC.App` covIdxFlat + `GHC.App` compOutFlat {-| The GHC.Core to PIR to PLC compiler pipeline. Returns both the PIR and PLC output. It invokes the whole compiler chain: Core expr -> PIR expr -> PLC expr -> UPLC expr. @@ -475,7 +475,7 @@ runCompiler , fun ~ PLC.DefaultFun , MonadReader (CompileContext uni fun) m , MonadState CompileState m - , MonadWriter CoverageIndex m + , MonadWriter CompileOutput m , MonadQuote m , MonadError (CompileError uni fun Ann) m , MonadIO m @@ -613,15 +613,19 @@ runCompiler moduleName opts expr = do let optCertify = opts ^. posCertify (uplcP, simplTrace) <- flip runReaderT plcOpts $ PLC.compileProgramWithTrace plcP - liftIO $ case optCertify of - Just certName -> do - result <- runCertifier $ mkCertifier simplTrace certName - case result of - Right certSuccess -> - hPutStrLn stderr $ prettyCertifierSuccess certSuccess - Left err -> - hPutStrLn stderr $ prettyCertifierError err - Nothing -> pure () + certP <- + liftIO $ case optCertify of + Just certName -> do + result <- runCertifier $ mkCertifier simplTrace certName + case result of + Right certSuccess -> do + hPutStrLn stderr $ prettyCertifierSuccess certSuccess + pure $ Just (certDir certSuccess) + Left err -> do + hPutStrLn stderr $ prettyCertifierError err + pure Nothing + Nothing -> pure Nothing + maybe (pure ()) addCertificatePath certP dbP <- liftExcept $ traverseOf UPLC.progTerm UPLC.deBruijnTerm uplcP when (opts ^. posDumpUPlc) . liftIO $ dumpFlat @@ -696,8 +700,8 @@ stripTicks = \case e -> e -- | Helper to avoid doing too much construction of Core ourselves -mkCompiledCode :: forall a. BS.ByteString -> BS.ByteString -> BS.ByteString -> CompiledCode a -mkCompiledCode plcBS pirBS ci = SerializedCode plcBS (Just pirBS) (fold . unflat $ ci) +mkCompiledCode :: forall a. BS.ByteString -> BS.ByteString -> BS.ByteString -> Maybe CertPath -> CompiledCode a +mkCompiledCode plcBS pirBS ci mcp = SerializedCode plcBS (Just pirBS) (fold . unflat $ ci) mcp {-| Make a 'NameInfo' mapping the given set of TH names to their 'GHC.TyThing's for later reference. diff --git a/plutus-tx-test-util/testlib/PlutusTx/Test/Util/Compiled.hs b/plutus-tx-test-util/testlib/PlutusTx/Test/Util/Compiled.hs index 4c0eea2de58..bdd16bb5171 100644 --- a/plutus-tx-test-util/testlib/PlutusTx/Test/Util/Compiled.hs +++ b/plutus-tx-test-util/testlib/PlutusTx/Test/Util/Compiled.hs @@ -10,6 +10,7 @@ module PlutusTx.Test.Util.Compiled , toAnonDeBruijnProg , toNamedDeBruijnTerm , compiledCodeToTerm + , compiledCodeToCertPath , haskellValueToTerm , unsafeRunTermCek , runTermCek @@ -56,6 +57,11 @@ compiledCodeToTerm :: Tx.CompiledCodeIn DefaultUni DefaultFun a -> Term compiledCodeToTerm (Tx.getPlcNoAnn -> UPLC.Program _ _ body) = body +{- | Extract the path to the generated certificate, if one exists. -} +compiledCodeToCertPath + :: Tx.CompiledCodeIn DefaultUni DefaultFun a -> Maybe FilePath +compiledCodeToCertPath (Tx.getCertPath -> mpath) = mpath + {- | Lift a Haskell value to a PLC term. The constraints get a bit out of control if we try to do this over an arbitrary universe.-} haskellValueToTerm diff --git a/plutus-tx/src/PlutusTx.hs b/plutus-tx/src/PlutusTx.hs index 00196fb23fb..a5878fcc69a 100644 --- a/plutus-tx/src/PlutusTx.hs +++ b/plutus-tx/src/PlutusTx.hs @@ -26,13 +26,15 @@ module PlutusTx ( safeLiftCode, liftCode, liftCodeDef, + getCovIdx, + getCertPath, ) where import PlutusCore.Data (Data (..)) import PlutusTx.Blueprint.TH (makeIsDataSchemaIndexed) import PlutusTx.Builtins (BuiltinData, builtinDataToData, dataToBuiltinData) -import PlutusTx.Code (CompiledCode, CompiledCodeIn, applyCode, getPir, getPirNoAnn, getPlc, - getPlcNoAnn, unsafeApplyCode) +import PlutusTx.Code (CompiledCode, CompiledCodeIn, applyCode, getCertPath, getCovIdx, getPir, + getPirNoAnn, getPlc, getPlcNoAnn, unsafeApplyCode) import PlutusTx.IsData (FromData (..), ToData (..), UnsafeFromData (..), fromData, makeIsDataIndexed, toData, unstableMakeIsData) import PlutusTx.Lift (liftCode, liftCodeDef, makeLift, safeLiftCode) diff --git a/plutus-tx/src/PlutusTx/Code.hs b/plutus-tx/src/PlutusTx/Code.hs index 4f6d369e568..0ed457febac 100644 --- a/plutus-tx/src/PlutusTx/Code.hs +++ b/plutus-tx/src/PlutusTx/Code.hs @@ -50,16 +50,20 @@ if you want to put it on the chain you must normalize the types first. -} data CompiledCodeIn uni fun a = -- | Serialized UPLC code and possibly serialized PIR code with metadata used for program coverage. - SerializedCode BS.ByteString (Maybe BS.ByteString) CoverageIndex + SerializedCode BS.ByteString (Maybe BS.ByteString) CoverageIndex (Maybe CertPath) | -- | Deserialized UPLC program, and possibly deserialized PIR program with metadata used for program coverage. DeserializedCode (UPLC.Program UPLC.NamedDeBruijn uni fun SrcSpans) (Maybe (PIR.Program PLC.TyName PLC.Name uni fun SrcSpans)) CoverageIndex + (Maybe CertPath) -- | 'CompiledCodeIn' instantiated with default built-in types and functions. type CompiledCode = CompiledCodeIn PLC.DefaultUni PLC.DefaultFun +-- | Type alias for the path to the certified compilation certificate, if one exists. +type CertPath = FilePath + -- | Apply a compiled function to a compiled argument. Will fail if the versions don't match. applyCode :: ( PLC.Closed uni @@ -95,7 +99,9 @@ applyCode fun arg = do <> display argPir (Nothing, Nothing) -> Left "Missing PIR for both the function program and the argument." - pure $ DeserializedCode uplc pir (getCovIdx fun <> getCovIdx arg) + -- I don't think it makes sense to compose certificates, so we just + -- return Nothing here. + pure $ DeserializedCode uplc pir (getCovIdx fun <> getCovIdx arg) Nothing {-| Apply a compiled function to a compiled argument. Will throw if the versions don't match, should only be used in non-production code. @@ -133,10 +139,10 @@ getPlc :: (PLC.Closed uni, uni `PLC.Everywhere` Flat, Flat fun) => CompiledCodeIn uni fun a -> UPLC.Program UPLC.NamedDeBruijn uni fun SrcSpans getPlc wrapper = case wrapper of - SerializedCode plc _ _ -> case unflat (BSL.fromStrict plc) of + SerializedCode plc _ _ _ -> case unflat (BSL.fromStrict plc) of Left e -> throw $ ImpossibleDeserialisationFailure e Right (UPLC.UnrestrictedProgram p) -> p - DeserializedCode plc _ _ -> plc + DeserializedCode plc _ _ _ -> plc getPlcNoAnn :: (PLC.Closed uni, uni `PLC.Everywhere` Flat, Flat fun) @@ -148,12 +154,12 @@ getPir :: (PLC.Closed uni, uni `PLC.Everywhere` Flat, Flat fun) => CompiledCodeIn uni fun a -> Maybe (PIR.Program PIR.TyName PIR.Name uni fun SrcSpans) getPir wrapper = case wrapper of - SerializedCode _ pir _ -> case pir of + SerializedCode _ pir _ _ -> case pir of Just bs -> case unflat (BSL.fromStrict bs) of Left e -> throw $ ImpossibleDeserialisationFailure e Right p -> Just p Nothing -> Nothing - DeserializedCode _ pir _ -> pir + DeserializedCode _ pir _ _ -> pir getPirNoAnn :: (PLC.Closed uni, uni `PLC.Everywhere` Flat, Flat fun) @@ -162,5 +168,10 @@ getPirNoAnn = fmap void . getPir getCovIdx :: CompiledCodeIn uni fun a -> CoverageIndex getCovIdx wrapper = case wrapper of - SerializedCode _ _ idx -> idx - DeserializedCode _ _ idx -> idx + SerializedCode _ _ idx _ -> idx + DeserializedCode _ _ idx _ -> idx + +getCertPath :: CompiledCodeIn uni fun a -> Maybe CertPath +getCertPath wrapper = case wrapper of + SerializedCode _ _ _ certPath -> certPath + DeserializedCode _ _ _ certPath -> certPath diff --git a/plutus-tx/src/PlutusTx/Coverage.hs b/plutus-tx/src/PlutusTx/Coverage.hs index 58db725b5d4..8cbbbdb8b32 100644 --- a/plutus-tx/src/PlutusTx/Coverage.hs +++ b/plutus-tx/src/PlutusTx/Coverage.hs @@ -25,8 +25,6 @@ module PlutusTx.Coverage ( coverageMetadata, coveredAnnotations, addCoverageMetadata, - addLocationToCoverageIndex, - addBoolCaseToCoverageIndex, coverageDataFromLogMsg, ) where @@ -46,8 +44,6 @@ import Data.Set qualified as Set import Data.String import Text.Read -import Control.Monad.Writer - import Prettyprinter import Prelude @@ -152,22 +148,6 @@ instance Semigroup CoverageIndex where instance Monoid CoverageIndex where mempty = CoverageIndex Map.empty --- | Include a location coverage annotation in the index -addLocationToCoverageIndex :: (MonadWriter CoverageIndex m) => CovLoc -> m CoverageAnnotation -addLocationToCoverageIndex src = do - let ann = CoverLocation src - tell $ CoverageIndex $ Map.singleton ann mempty - pure ann - --- | Include a boolean coverage annotation in the index -addBoolCaseToCoverageIndex - :: (MonadWriter CoverageIndex m) - => CovLoc -> Bool -> CoverageMetadata -> m CoverageAnnotation -addBoolCaseToCoverageIndex src b meta = do - let ann = CoverBool src b - tell $ CoverageIndex (Map.singleton ann meta) - pure ann - -- | Add metadata to a coverage annotation. Does nothing if the annotation is not in the index. addCoverageMetadata :: CoverageAnnotation -> Metadata -> CoverageIndex -> CoverageIndex addCoverageMetadata ann meta idx = diff --git a/plutus-tx/src/PlutusTx/Lift.hs b/plutus-tx/src/PlutusTx/Lift.hs index 6a98aafda11..ca20af43268 100644 --- a/plutus-tx/src/PlutusTx/Lift.hs +++ b/plutus-tx/src/PlutusTx/Lift.hs @@ -241,7 +241,8 @@ safeLiftCode safeLiftCode v = fmap ( \(pir, uplc) -> - DeserializedCode (mempty <$ uplc) (Just (mempty <$ pir)) mempty + -- TODO: maybe fix? + DeserializedCode (mempty <$ uplc) (Just (mempty <$ pir)) mempty mempty ) . safeLiftProgram v @@ -269,7 +270,8 @@ safeLiftCodeUnopt safeLiftCodeUnopt v = fmap ( \(pir, uplc) -> - DeserializedCode (mempty <$ uplc) (Just (mempty <$ pir)) mempty + -- TODO: maybe fix? + DeserializedCode (mempty <$ uplc) (Just (mempty <$ pir)) mempty mempty ) . safeLiftProgramUnopt v @@ -519,4 +521,5 @@ typeCode p prog = do flip runReaderT PLC.defaultCompilationOpts $ PLC.compileProgram prog db <- traverseOf UPLC.progTerm UPLC.deBruijnTerm compiled - pure $ DeserializedCode (mempty <$ db) Nothing mempty + -- TODO: maybe fix? + pure $ DeserializedCode (mempty <$ db) Nothing mempty mempty diff --git a/plutus-tx/src/PlutusTx/Plugin/Utils.hs b/plutus-tx/src/PlutusTx/Plugin/Utils.hs index 24ae14c57dc..6889fc2e901 100644 --- a/plutus-tx/src/PlutusTx/Plugin/Utils.hs +++ b/plutus-tx/src/PlutusTx/Plugin/Utils.hs @@ -29,5 +29,5 @@ a Proxy to avoid this. -- | Marks the given expression for compilation to PLC. plc :: forall (loc :: Symbol) a. Proxy loc -> a -> CompiledCode a -- this constructor is only really there to get rid of the unused warning -plc _ _ = SerializedCode (mustBeReplaced "plc") (mustBeReplaced "pir") (mustBeReplaced "covidx") +plc _ _ = SerializedCode (mustBeReplaced "plc") (mustBeReplaced "pir") (mustBeReplaced "covidx") (mustBeReplaced "certpath") {-# OPAQUE plc #-} diff --git a/plutus-tx/src/PlutusTx/TH.hs b/plutus-tx/src/PlutusTx/TH.hs index e5a5fde021c..69989ec6347 100644 --- a/plutus-tx/src/PlutusTx/TH.hs +++ b/plutus-tx/src/PlutusTx/TH.hs @@ -30,7 +30,8 @@ loadFromFile fp = TH.liftCode $ do -- We don't have a 'Lift' instance for 'CompiledCode' (we could but it would be tedious), -- so we lift the bytestring and construct the value in the quote. bs <- liftIO $ BS.readFile fp - TH.examineCode [||SerializedCode bs Nothing mempty||] + -- TODO: maybe fix? + TH.examineCode [||SerializedCode bs Nothing mempty mempty ||] {- Note [Typed TH] It's nice to use typed TH! However, we sadly can't *quite* use it thoroughly, because we