Skip to content

Commit

Permalink
List-modules moved to local-only (#1326)
Browse files Browse the repository at this point in the history
* list-modules local

* test for local-only behavior

* fix libcrypto in cabal.project

* regen docs

* use ghc964 in nix

* all tests pass

---------

Co-authored-by: chessai <[email protected]>
  • Loading branch information
jmcardon and chessai authored Feb 16, 2024
1 parent fb80a66 commit 1779158
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 31 deletions.
22 changes: 22 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
packages: .

-- -------------------------------------------------------------------------- --
-- Platform specific locations of external libraries

if os(darwin)
if arch(aarch64)
package *
extra-include-dirs:
/opt/homebrew/include
/opt/homebrew/opt/openssl/include
extra-lib-dirs:
/opt/homebrew/lib
/opt/homebrew/opt/openssl/lib
else
package *
extra-include-dirs:
/opt/local/include
/usr/local/opt/openssl/include
extra-lib-dirs:
/opt/local/lib
/usr/local/opt/openssl/lib/
----------------------------------------------------------------------------------

package pact
ghc-options: -Wno-missed-extra-shared-lib

Expand Down
2 changes: 1 addition & 1 deletion docs/en/pact-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ Retreive any accumulated events and optionally clear event state. Object returne
*&rarr;*&nbsp;`[string]`


Queries, or with arguments, sets execution config flags. Valid flags: ["AllowReadInLocal","DisableHistoryInTransactionalMode","DisableInlineMemCheck","DisableModuleInstall","DisableNewTrans","DisablePact40","DisablePact410","DisablePact42","DisablePact43","DisablePact431","DisablePact44","DisablePact45","DisablePact46","DisablePact47","DisablePact48","DisablePact49","DisablePactEvents","DisableRuntimeReturnTypeChecking","DisableVerifiers","EnforceKeyFormats","OldReadOnlyBehavior","PreserveModuleIfacesBug","PreserveModuleNameBug","PreserveNsModuleInstallBug","PreserveShowDefs"]
Queries, or with arguments, sets execution config flags. Valid flags: ["AllowReadInLocal","DisableHistoryInTransactionalMode","DisableInlineMemCheck","DisableModuleInstall","DisableNewTrans","DisablePact40","DisablePact410","DisablePact411","DisablePact42","DisablePact43","DisablePact431","DisablePact44","DisablePact45","DisablePact46","DisablePact47","DisablePact48","DisablePact49","DisablePactEvents","DisableRuntimeReturnTypeChecking","DisableVerifiers","EnforceKeyFormats","OldReadOnlyBehavior","PreserveModuleIfacesBug","PreserveModuleNameBug","PreserveNsModuleInstallBug","PreserveShowDefs"]
```lisp
pact> (env-exec-config ['DisableHistoryInTransactionalMode]) (env-exec-config)
["DisableHistoryInTransactionalMode"]
Expand Down
89 changes: 62 additions & 27 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Kadena's Pact smart contract language";

inputs = {
hs-nix-infra.url = "github:kadena-io/hs-nix-infra";
hs-nix-infra.url = "github:kadena-io/hs-nix-infra/chessai/update-1";
flake-utils.url = "github:numtide/flake-utils";
};

Expand All @@ -25,7 +25,7 @@
pact =
final.haskell-nix.project' {
src = ./.;
compiler-nix-name = "ghc963";
compiler-nix-name = "ghc964";
shell.tools = {
cabal = {};
haskell-language-server = {};
Expand All @@ -34,7 +34,7 @@
shell.buildInputs = with pkgs; [
zlib
z3_4_11
pkgconfig
pkg-config
(python3.withPackages (ps: [ps.sphinx ps.sphinx_rtd_theme]))
pandoc perl
];
Expand Down
1 change: 1 addition & 0 deletions src/Pact/Native.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,7 @@ typeof'' i as = argsError i as

listModules :: RNativeFun e
listModules i _ = do
unlessExecutionFlagSet FlagDisablePact411 $ checkNonLocalAllowed i
mods <- keys (_faInfo i) Modules
return $ toTermList tTyString $ map asString mods

Expand Down
2 changes: 2 additions & 0 deletions src/Pact/Types/Runtime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ data ExecutionFlag
| FlagDisablePact49
-- | Disable Pact 4.10 Features
| FlagDisablePact410
-- | Disable Pact 4.11 Features
| FlagDisablePact411
-- | Disable verifiers
| FlagDisableVerifiers
deriving (Eq,Ord,Show,Enum,Bounded)
Expand Down
8 changes: 8 additions & 0 deletions tests/pact/toplevel.repl
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,11 @@
"old env unchanged"
"hello"
(read-msg 'b))

; Pact 4.11 list-modules moved to local only
(env-exec-config ["DisablePact411", "DisableHistoryInTransactionalMode"])
(expect "list-modules is isn't local-only after pact 4.11" ["repl-natives" "toplevel"] (list-modules))


(env-exec-config ["DisableHistoryInTransactionalMode"])
(expect-failure "list-modules is local-only after pact 4.11" (list-modules))

0 comments on commit 1779158

Please sign in to comment.