Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcardon committed Jul 17, 2023
2 parents 6a40805 + 266d4a3 commit fe6a41b
Show file tree
Hide file tree
Showing 35 changed files with 353 additions and 140 deletions.
86 changes: 43 additions & 43 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
* @jwiegley @emilypi
/src-ghc/Pact/ApiReq.hs @sirlensalot
/src-ghc/Pact/Bench.hs @sirlensalot
/src-ghc/Pact/Coverage.hs @sirlensalot
/src-ghc/Pact/Coverage/Report.hs @sirlensalot
/src-ghc/Pact/Interpreter.hs @sirlensalot
/src/Crypto/Hash/Blake2Native.hs @sirlensalot
/src/Pact/Compile.hs @sirlensalot
/src/Pact/Eval.hs @sirlensalot
/src/Pact/Gas.hs @sirlensalot
/src/Pact/Native.hs @sirlensalot
/src/Pact/Native/Capabilities.hs @sirlensalot
/src/Pact/Native/Db.hs @sirlensalot
/src/Pact/Native/Ops.hs @jmcardon
/src/Pact/Parse.hs @sirlensalot
/src/Pact/Persist.hs @sirlensalot
/src/Pact/PersistPactDb.hs @sirlensalot
/src/Pact/Repl.hs @sirlensalot
/src/Pact/Repl/Lib.hs @sirlensalot
/src/Pact/Repl/Types.hs @sirlensalot
/src/Pact/Runtime/Capabilities.hs @sirlensalot
/src/Pact/Runtime/Typecheck.hs @sirlensalot
/src/Pact/Typechecker.hs @sirlensalot
/src/Pact/Types/API.hs @sirlensalot
/src/Pact/Types/Advice.hs @sirlensalot
/src/Pact/Types/Capability.hs @sirlensalot
/src/Pact/Types/Codec.hs @sirlensalot
/src/Pact/Types/Command.hs @sirlensalot
/src/Pact/Types/Continuation.hs @sirlensalot
/src/Pact/Types/Exp.hs @sirlensalot
/src/Pact/Types/Hash.hs @sirlensalot
/src/Pact/Types/Info.hs @sirlensalot
/src/Pact/Types/KeySet.hs @sirlensalot
/src/Pact/Types/PactError.hs @sirlensalot
/src/Pact/Types/PactValue.hs @sirlensalot
/src/Pact/Types/Parser.hs @sirlensalot
/src/Pact/Types/Persistence.hs @sirlensalot
/src/Pact/Types/Purity.hs @sirlensalot
/src/Pact/Types/RPC.hs @sirlensalot
/src/Pact/Types/Runtime.hs @sirlensalot
/src/Pact/Types/Term.hs @sirlensalot
/src/Pact/Types/Type.hs @sirlensalot
/src/Pact/Types/Typecheck.hs @sirlensalot
* @jwiegley @emilypi @jmcardon
/src-ghc/Pact/ApiReq.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src-ghc/Pact/Bench.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src-ghc/Pact/Coverage.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src-ghc/Pact/Coverage/Report.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src-ghc/Pact/Interpreter.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Crypto/Hash/Blake2Native.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Compile.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Eval.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Gas.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Native.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Native/Capabilities.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Native/Db.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Native/Ops.hs @jmcardon @jwiegley @emilypi @jmcardon
/src/Pact/Parse.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Persist.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/PersistPactDb.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Repl.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Repl/Lib.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Repl/Types.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Runtime/Capabilities.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Runtime/Typecheck.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Typechecker.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/API.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Advice.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Capability.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Codec.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Command.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Continuation.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Exp.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Hash.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Info.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/KeySet.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/PactError.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/PactValue.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Parser.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Persistence.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Purity.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/RPC.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Runtime.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Term.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Type.hs @sirlensalot @jwiegley @emilypi @jmcardon
/src/Pact/Types/Typecheck.hs @sirlensalot @jwiegley @emilypi @jmcardon
4 changes: 2 additions & 2 deletions docs/en/pact-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ Retreive any accumulated events and optionally clear event state. Object returne
*→* `[string]`


Queries, or with arguments, sets execution config flags. Valid flags: ["AllowReadInLocal","DisableHistoryInTransactionalMode","DisableInlineMemCheck","DisableModuleInstall","DisableNewTrans","DisablePact40","DisablePact420","DisablePact43","DisablePact431","DisablePact44","DisablePact45","DisablePact46","DisablePact47","DisablePactEvents","DisableRuntimeReturnTypeChecking","EnforceKeyFormats","OldReadOnlyBehavior","PreserveModuleIfacesBug","PreserveModuleNameBug","PreserveNsModuleInstallBug","PreserveShowDefs"]
Queries, or with arguments, sets execution config flags. Valid flags: ["AllowReadInLocal","DisableHistoryInTransactionalMode","DisableInlineMemCheck","DisableModuleInstall","DisableNewTrans","DisablePact40","DisablePact420","DisablePact43","DisablePact431","DisablePact44","DisablePact45","DisablePact46","DisablePact47","DisablePact48","DisablePactEvents","DisableRuntimeReturnTypeChecking","EnforceKeyFormats","OldReadOnlyBehavior","PreserveModuleIfacesBug","PreserveModuleNameBug","PreserveNsModuleInstallBug","PreserveShowDefs"]
```lisp
pact> (env-exec-config ['DisableHistoryInTransactionalMode]) (env-exec-config)
["DisableHistoryInTransactionalMode"]
Expand Down Expand Up @@ -2022,7 +2022,7 @@ pact> (env-hash (hash "hello"))
*keys* `[string]` *→* `string`


DEPRECATED in favor of 'set-sigs'. Set transaction signer KEYS. See 'env-sigs' for setting keys with associated capabilities.
DEPRECATED in favor of 'env-sigs'. Set transaction signer KEYS. See 'env-sigs' for setting keys with associated capabilities.
```lisp
pact> (env-keys ["my-key" "admin-key"])
"Setting transaction keys"
Expand Down
2 changes: 1 addition & 1 deletion docs/en/pact-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,7 @@ env-keys

*keys* ``[string]`` *→* ``string``
DEPRECATED in favor of ‘set-sigs’. Set transaction signer KEYS. See
DEPRECATED in favor of ‘env-sigs’. Set transaction signer KEYS. See
‘env-sigs’ for setting keys with associated capabilities.

.. code:: lisp
Expand Down
4 changes: 2 additions & 2 deletions docs/en/pact-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,10 @@ new `env-sigs` REPL function as follows:
...
)
(set-sigs [{'key: "alice", 'caps: ["(accounts.PAY \"alice\" \"bob\" 10.0)"]}])
(env-sigs [{'key: "alice", 'caps: ["(accounts.PAY \"alice\" \"bob\" 10.0)"]}])
(accounts.pay "alice" "bob" 10.0) ;; works as the cap match the signature caps
(set-sigs [('key: "alice", 'caps: ["(accounts.PAY \"alice\" "\carol\" 10.0)"]}])
(env-sigs [('key: "alice", 'caps: ["(accounts.PAY \"alice\" "\carol\" 10.0)"]}])
(expect-failure "payment to bob will no longer be able to enforce alice's keyset"
(accounts.pay "alice" "bob" 10.0))
```
Expand Down
4 changes: 2 additions & 2 deletions docs/en/pact-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1189,10 +1189,10 @@ as follows:
...
)
(set-sigs [{'key: "alice", 'caps: ["(accounts.PAY \"alice\" \"bob\" 10.0)"]}])
(env-sigs [{'key: "alice", 'caps: ["(accounts.PAY \"alice\" \"bob\" 10.0)"]}])
(accounts.pay "alice" "bob" 10.0) ;; works as the cap match the signature caps
(set-sigs [('key: "alice", 'caps: ["(accounts.PAY \"alice\" "\carol\" 10.0)"]}])
(env-sigs [('key: "alice", 'caps: ["(accounts.PAY \"alice\" "\carol\" 10.0)"]}])
(expect-failure "payment to bob will no longer be able to enforce alice's keyset"
(accounts.pay "alice" "bob" 10.0))
Expand Down
4 changes: 2 additions & 2 deletions pact.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ flag tests-in-lib
-- Pact library

library
cpp-options: -DLEGACY_PARSER -DPACT_TOJSON
cpp-options: -DLEGACY_PARSER
-- common to all configurations:
hs-source-dirs: src
default-language: Haskell2010
Expand Down Expand Up @@ -397,7 +397,7 @@ test-suite hspec
hs-source-dirs: tests
default-language: Haskell2010
ghc-options: -Wall -threaded -rtsopts -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
cpp-options: -DLEGACY_PARSER -DDELTA_BYTES=1 -DPACT_TOJSON
cpp-options: -DLEGACY_PARSER -DDELTA_BYTES=1
build-tool-depends: pact:pact
build-depends:
, aeson
Expand Down
6 changes: 3 additions & 3 deletions src-ghc/Pact/ApiReq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ instance J.Encode ApiPublicMeta where
, "gasPrice" J..?= _apmGasPrice o
, "sender" J..?= _apmSender o
]
{-# INLINE build #-}
{-# INLINABLE build #-}

instance Arbitrary ApiPublicMeta where
arbitrary = ApiPublicMeta
Expand Down Expand Up @@ -217,7 +217,7 @@ instance J.Encode ApiReq where
, "dataFile" J..= fmap (J.text . pack) (_ylDataFile o)
, "nonce" J..= _ylNonce o
]
{-# INLINE build #-}
{-# INLINABLE build #-}

instance Arbitrary ApiReq where
arbitrary = scale (min 5) $ ApiReq
Expand Down Expand Up @@ -248,7 +248,7 @@ instance J.Encode AddSigsReq where
[ "sigs" J..= J.Array (_asrSigs o)
, "unsigned" J..= _asrUnsigned o
]
{-# INLINE build #-}
{-# INLINABLE build #-}

instance Arbitrary AddSigsReq where
arbitrary = AddSigsReq
Expand Down
38 changes: 38 additions & 0 deletions src-ghc/Pact/Bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,21 @@ main = do
let tt = evalReplEval def replS (mapM eval timeTest)
void $! eitherDie "timeTest failed" . fmapL show =<< tt

wrap10Cmd <- parseCode "(bench.wrap10 100)"
wrap10MonoCmd <- parseCode "(bench.wrap10_integer 100)"

arityCmd0 <- parseCode "(bench.arity_tc_0)"
arityCmd1 <- parseCode "(bench.arity_tc_1 1)"
arityCmd10 <- parseCode "(bench.arity_tc_10 1 1 1 1 1 1 1 1 1 1)"
arityCmd40 <- parseCode "(bench.arity_tc_40 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)"

aritySmallObj <- parseCode "(bench.arity_small_obj {\"a\": 1})"
arityMediumObj <- parseCode "(bench.arity_medium_obj {\"a\":1, \"b\":true, \"c\":1, \"d\":{\"a\":1}, \"e\":1, \"f\":true, \"g\":1, \"h\":{\"a\":1} })"
arityLargeObj <- parseCode "(bench.arity_large_obj {\"a\":1, \"b\":true, \"c\":1, \"d\":{\"a\":1}, \"e\":1, \"f\":true, \"g\":1, \"h\":{\"a\":1}, \"i\":1, \"j\":true, \"k\":1, \"l\":{\"a\":1}, \"m\":1, \"n\":true, \"o\":1, \"p\":{\"a\":1} })"

accumCmd0 <- parseCode "(bench.accum (enumerate 1 0))"
accumCmd1 <- parseCode "(bench.accum (enumerate 1 1))"
accumCmd100 <- parseCode "(bench.accum (enumerate 1 100))"

let cleanupSqlite = do
c <- readMVar $ pdPactDbVar sqliteDb
Expand Down Expand Up @@ -385,4 +400,27 @@ main = do
, benchNFIO "round4" $ runPactExec def "round4" [] Null Nothing pureDb round4
]
, benchNFIO "time" $ fmap fst <$> evalReplEval def replS (mapM eval timeTest)
, bgroup "defun"
[ bgroup "return-type-tc"
[ benchNFIO "wrap10" $ runPactExec def "wrap10" [] Null Nothing pureDb wrap10Cmd
, benchNFIO "wrap10_mono" $ runPactExec def "wrap10_mono" [] Null Nothing pureDb wrap10MonoCmd
, benchNFIO "accum100" $ runPactExec def "accum100" [] Null Nothing pureDb accumCmd100
]
, bgroup "arity"
[ benchNFIO "00-args" $ runPactExec def "00-args" [] Null Nothing pureDb arityCmd0
, benchNFIO "01-args" $ runPactExec def "01-args" [] Null Nothing pureDb arityCmd1
, benchNFIO "10-args" $ runPactExec def "10-args" [] Null Nothing pureDb arityCmd10
, benchNFIO "40-args" $ runPactExec def "40-args" [] Null Nothing pureDb arityCmd40
]
, bgroup "object-size"
[ benchNFIO "small-obj" $ runPactExec def "small-obj" [] Null Nothing pureDb aritySmallObj
, benchNFIO "medium-obj" $ runPactExec def "medium-obj" [] Null Nothing pureDb arityMediumObj
, benchNFIO "large-obj" $ runPactExec def "large-obj" [] Null Nothing pureDb arityLargeObj
]
, bgroup "list-tc"
[ benchNFIO "000-items" $ runPactExec def "000-items" [] Null Nothing pureDb accumCmd0
, benchNFIO "001-items" $ runPactExec def "001-items" [] Null Nothing pureDb accumCmd1
, benchNFIO "100-items" $ runPactExec def "100-items" [] Null Nothing pureDb accumCmd100
]
]
]
2 changes: 1 addition & 1 deletion src-ghc/Pact/Persist/SQLite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ data SQLite = SQLite
{ conn :: Database
, config :: SQLiteConfig
, logger :: Logger
, tableStmts :: (M.Map Utf8 TableStmts)
, tableStmts :: M.Map Utf8 TableStmts
, txStmts :: TxStmts
}

Expand Down
6 changes: 6 additions & 0 deletions src-tool/Pact/Analyze/Parse/Prop.hs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,12 @@ inferPreProp preProp = case preProp of
_ -> throwErrorIn preProp $
pretty op' <> " applied to wrong number of arguments"

PreApp s [PreApp a p1, PreApp b p2 , c] | s == SOrQ ->
inferPreProp (PreApp SLogicalDisjunction [PreApp a (p1 ++ [c]), PreApp b (p2 ++ [c])])

PreApp s [PreApp a p1, PreApp b p2 , c] | s == SAndQ ->
inferPreProp (PreApp SLogicalConjunction [PreApp a (p1 ++ [c]), PreApp b (p2 ++ [c])])

PreApp s [a, b] | s == SLogicalImplication -> do
propNotA <- PNot <$> checkPreProp SBool a
Some SBool . POr propNotA <$> checkPreProp SBool b
Expand Down
3 changes: 2 additions & 1 deletion src/Pact/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ abstractBody :: Compile (Term Name) -> [Arg (Term Name)] -> Compile (Scope Int T
abstractBody term args = abstractBody' args =<< bodyForm term

abstractBody' :: [Arg (Term Name)] -> Term Name -> Compile (Scope Int Term Name)
abstractBody' args body = traverse enrichDynamic $ abstract (`elemIndex` bNames) body
abstractBody' args body =
(if M.null modRefArgs then pure else traverse enrichDynamic) $ abstract (`elemIndex` bNames) body
where
bNames = map arg2Name args

Expand Down
52 changes: 36 additions & 16 deletions src/Pact/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ eval' (TModule _tm@(MDModule m) bod i) =
capMName <-
ifExecutionFlagSet' FlagPreserveNsModuleInstallBug (_mName m) (_mName mangledM)
void $ acquireModuleAdminCapability capMName $ return ()

unlessExecutionFlagSet FlagDisablePact48 $ do
evalRefs.rsLoadedModules %= HM.delete (_mName mangledM)
evalRefs.rsQualifiedDeps %= HM.filterWithKey (\k _ -> _fqModule k /= _mName mangledM)

-- build/install module from defs
(g,govM) <- loadModule mangledM bod i g0
szVer <- getSizeOfVersion
Expand Down Expand Up @@ -736,27 +741,42 @@ fullyQualifyDefs info mdef defs = do
checkAddDep = \case
Direct (TVar (FQName fq) _) -> modify' (Set.insert (_fqModule fq))
_ -> pure ()
-- | traverse to find deps and form graph
traverseGraph allDefs memo = fmap stronglyConnCompR $ forM (LHM.sortByKey $ HM.toList allDefs) $ \(defName,defTerm) -> do
let defName' = FullyQualifiedName defName (_mName mdef) (moduleHash mdef)
defTerm' <- forM defTerm $ \(f :: Name) -> do

resolveBareName memo f@(BareName fn _) = case HM.lookup fn defs of
Just _ -> do
let name' = FullyQualifiedName fn (_mName mdef) (moduleHash mdef)
return (Left name') -- decl found
Nothing -> lift (resolveBareModRef info f fn memo (MDModule mdef)) >>= \case
Just mr -> return (Right mr) -- mod ref found
Nothing -> resolveError f

resolveError f = lift (evalError' f $ "Cannot resolve " <> dquotes (pretty f))

resolveName flagPact48Disabled memo = \case
(QName (QualifiedName (ModuleName mn mNs) fn i))
| not flagPact48Disabled
&& mn == _mnName (_mName mdef)
&& isNsMatch -> resolveBareName memo (BareName fn i)
where
isNsMatch = fromMaybe True (liftA2 (==) modNs mNs)

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (8.10.7, 3.10, ubuntu-20.04, true, +build-tool)

• Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (8.10.7, 3.10, ubuntu-22.04, true, +build-tool)

• Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (8.10.7, 3.10, macOS-latest, true, +build-tool)

• Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (9.2, 3.10, ubuntu-20.04, true, +build-tool)

• Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (9.2, 3.10, ubuntu-22.04, true, +build-tool)

• Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (9.2, 3.10, macOS-latest, true, +build-tool)

• Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (9.4.5, 3.10, ubuntu-20.04, true, +build-tool)

Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (9.4.5, 3.10, ubuntu-22.04, true, +build-tool)

Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (9.4.5, 3.10, macOS-latest, true, +build-tool)

Variable not in scope:

Check failure on line 761 in src/Pact/Eval.hs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 9.0.2, 3.10, true, +build-tool)

• Variable not in scope:
modNs = _mnNamespace (_mName mdef)
f -> do
dm <- lift (resolveRefFQN f f) -- lookup ref, don't try modules for barenames
case (dm, f) of
(Just t, _) -> checkAddDep t *> return (Right t) -- ref found
-- for barenames, check decls and finally modules
(Nothing, Name (BareName fn _)) ->
case HM.lookup fn allDefs of
Just _ -> do
let name' = FullyQualifiedName fn (_mName mdef) (moduleHash mdef)
return (Left name') -- decl found
Nothing -> lift (resolveBareModRef info f fn memo (MDModule mdef)) >>= \r -> case r of
Just mr -> return (Right mr) -- mod ref found
Nothing ->
lift (evalError' f $ "Cannot resolve " <> dquotes (pretty f))
-- for qualified names, simply fail
(Nothing, _) -> lift (evalError' f $ "Cannot resolve " <> dquotes (pretty f))
-- for barenames, check decls and finally modules
(Nothing, Name bn@BareName{}) -> resolveBareName memo bn
-- for qualified names, simply fail
(Nothing, _) -> resolveError f

-- | traverse to find deps and form graph
traverseGraph allDefs memo = fmap stronglyConnCompR $ forM (LHM.sortByKey $ HM.toList allDefs) $ \(defName,defTerm) -> do
let defName' = FullyQualifiedName defName (_mName mdef) (moduleHash mdef)
disablePact48 <- lift (isExecutionFlagSet FlagDisablePact48)
defTerm' <- forM defTerm $ \(f :: Name) -> resolveName disablePact48 memo f

return (defTerm', defName', mapMaybe (either Just (const Nothing)) $ toList defTerm')

moduleHash = _mhHash . _mHash


Expand Down
2 changes: 1 addition & 1 deletion src/Pact/Native/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ argsToParams :: Info -> [Term Name] -> Eval e [PactValue]
argsToParams i args = do
elideFun <- ifExecutionFlagSet' FlagDisablePact40 id elideModRefInfo
forM args $ \arg -> case toPactValue arg of
Right pv -> return $! elideFun pv
Right pv -> return $ elideFun pv
Left e -> evalError i $ "Invalid capability argument: " <> pretty e

-- | Workhorse to convert App to Capability by capturing Def,
Expand Down
2 changes: 1 addition & 1 deletion src/Pact/PersistPactDb.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ instance FromJSON UserTableInfo
instance J.Encode UserTableInfo where
build o = J.object
[ "utModule" J..= utModule o ]
{-# INLINE build #-}
{-# INLINABLE build #-}

userTable :: TableName -> TableId
userTable tn = TableId $ "USER_" <> asString tn
Expand Down
2 changes: 1 addition & 1 deletion src/Pact/Repl/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ replDefs = ("Repl",
"Transform PUBLIC-KEY into an address (i.e. a Pact Runtime Public Key) depending on its SCHEME."
,defZRNative "env-keys" setsigs (funType tTyString [("keys",TyList tTyString)])
["(env-keys [\"my-key\" \"admin-key\"])"]
("DEPRECATED in favor of 'set-sigs'. Set transaction signer KEYS. "<>
("DEPRECATED in favor of 'env-sigs'. Set transaction signer KEYS. "<>
"See 'env-sigs' for setting keys with associated capabilities.")
,defZNative "env-sigs" setsigs' (funType tTyString [("sigs",TyList (tTyObject TyAny))])
[LitExample $ "(env-sigs [{'key: \"my-key\", 'caps: [(accounts.USER_GUARD \"my-account\")]}, " <>
Expand Down
2 changes: 1 addition & 1 deletion src/Pact/Types/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ data Signer = Signer
-- ^ pub key value
, _siAddress :: !(Maybe Text)
-- ^ optional "address", for different pub key formats like ETH
, _siCapList :: ![SigCapability]
, _siCapList :: [SigCapability]
-- ^ clist for designating signature to specific caps
} deriving (Eq, Ord, Show, Generic)

Expand Down
Loading

0 comments on commit fe6a41b

Please sign in to comment.