diff --git a/CHANGELOG.md b/CHANGELOG.md index 78919cf79..6a8df20b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +4.6.0 +--- +* Add `DisablePact46` execution flag (#TODO) +* Add Zero Knowledge native operations (#1052) +* Add deprecation warning system (#1127) +* Build support for Nix flakes (#1083) +* Passage of time simulation in local pact server build (#1082) +* Fixed parsing failure message for Public Keys (#1097) +* `print` native now pretty prints output using term pretty printing (#1106) +* Typechecker: + - now handles all const value types (#1116) + - inlines mock dynamic references (#1120) + +* Formal Verification: + - Prevent usage of `result` fixed binding in `defpact` verification. (#1113) + - Warning added for invaliding models when decimals are too high a + precision (#1113) + - Typechecker now correctly infers function type arguments (#1112) + - Added debug flag to `verify` native, allowing outputs to be directed to + SMTLib file on a per-module basis. (#1122) + - Add shim for `select` in FV (#1090) + +Thanks to everyone for their contributions, especially new contributors @qooboodoop and @omahs, and welcome to our newest Pact team member, @rsoeldner!. + 4.4.1 --- * Export `ApiReq` constituent data structures (#1055) diff --git a/docs/build.sh b/docs/build.sh index 653fd2316..cab04189f 100755 --- a/docs/build.sh +++ b/docs/build.sh @@ -1,4 +1,4 @@ #!/bin/bash # --- Jump into Nix Shell --- # -nix-shell --pure -p python3 python37Packages.sphinx python37Packages.sphinx_rtd_theme pandoc perl --run "./work.sh" +nix-shell --pure -p python3 python38Packages.sphinx python38Packages.sphinx_rtd_theme pandoc perl --run "./work.sh" diff --git a/docs/en/pact-functions.md b/docs/en/pact-functions.md index c66127fb9..a879dca3c 100644 --- a/docs/en/pact-functions.md +++ b/docs/en/pact-functions.md @@ -461,7 +461,7 @@ Return ID if called during current pact execution, failing if not. Obtain current pact build version. ```lisp pact> (pact-version) -"4.4.1" +"4.6.0" ``` Top level only: this function will fail if used in module code. diff --git a/docs/en/pact-functions.rst b/docs/en/pact-functions.rst index 63982db77..c47d5892f 100644 --- a/docs/en/pact-functions.rst +++ b/docs/en/pact-functions.rst @@ -517,7 +517,7 @@ Obtain current pact build version. .. code:: lisp pact> (pact-version) - "4.4" + "4.6.0" Top level only: this function will fail if used in module code. @@ -846,9 +846,9 @@ by the ordering of keys. .. code:: lisp - (let* + (let* ((qry (lambda (k obj) true)) ;; select all rows - (f (lambda (x) [(at 'firstName x), (at 'b x)])) + (f (lambda (k obj) [(at 'firstName obj), (at 'b obj)])) ) (fold-db people (qry) (f)) ) @@ -1727,34 +1727,6 @@ in INNER-CAP being granted in the scope of OUTER-BODY. (compose-capability (TRANSFER src dest)) -create-module-guard -~~~~~~~~~~~~~~~~~~~ - -*name* ``string`` *→* ``guard`` - -Defines a guard by NAME that enforces the current module admin -predicate. - -create-pact-guard -~~~~~~~~~~~~~~~~~ - -*name* ``string`` *→* ``guard`` - -Defines a guard predicate by NAME that captures the results of -‘pact-id’. At enforcement time, the success condition is that at that -time ‘pact-id’ must return the same value. In effect this ensures that -the guard will only succeed within the multi-transaction identified by -the pact id. - -create-user-guard -~~~~~~~~~~~~~~~~~ - -*closure* ``-> bool`` *→* ``guard`` - -Defines a custom guard CLOSURE whose arguments are strictly evaluated at -definition time, to be supplied to indicated function at enforcement -time. - emit-event ~~~~~~~~~~ @@ -1832,16 +1804,6 @@ one installed with this function. (install-capability (PAY "alice" "bob" 10.0)) -keyset-ref-guard -~~~~~~~~~~~~~~~~ - -*keyset-ref* ``string`` *→* ``guard`` - -Creates a guard for the keyset registered as KEYSET-REF with -‘define-keyset’. Concrete keysets are themselves guard types; this -function is specifically to store references alongside other guards in -the database, etc. - require-capability ~~~~~~~~~~~~~~~~~~ @@ -1938,6 +1900,48 @@ are base-16 strings of length 32. Guards ------ +create-capability-guard +~~~~~~~~~~~~~~~~~~~~~~~ + +*capability* ``-> bool`` *→* ``guard`` + +Creates a guard that will enforce that CAPABILITY is acquired. + +.. code:: lisp + + (create-capability-guard (BANK_DEBIT 10.0)) + +create-capability-pact-guard +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +*capability* ``-> bool`` *→* ``guard`` + +Creates a guard that will enforce that CAPABILITY is acquired and that +the currently-executing defpact is operational. + +.. code:: lisp + + (create-capability-pact-guard (ESCROW owner)) + +create-module-guard +~~~~~~~~~~~~~~~~~~~ + +*name* ``string`` *→* ``guard`` + +Defines a guard by NAME that enforces the current module admin +predicate. + +create-pact-guard +~~~~~~~~~~~~~~~~~ + +*name* ``string`` *→* ``guard`` + +Defines a guard predicate by NAME that captures the results of +‘pact-id’. At enforcement time, the success condition is that at that +time ‘pact-id’ must return the same value. In effect this ensures that +the guard will only succeed within the multi-transaction identified by +the pact id. + create-principal ~~~~~~~~~~~~~~~~ @@ -1953,6 +1957,15 @@ Create a principal which unambiguously identifies GUARD. (create-principal (create-user-guard 'user-guard)) (create-principal (create-pact-guard 'pact-guard)) +create-user-guard +~~~~~~~~~~~~~~~~~ + +*closure* ``-> bool`` *→* ``guard`` + +Defines a custom guard CLOSURE whose arguments are strictly evaluated at +definition time, to be supplied to indicated function at enforcement +time. + is-principal ~~~~~~~~~~~~ @@ -1965,6 +1978,16 @@ proving validity. (enforce (is-principal 'k:462e97a099987f55f6a2b52e7bfd52a36b4b5b470fed0816a3d9b26f9450ba69) "Invalid account structure: non-principal account") +keyset-ref-guard +~~~~~~~~~~~~~~~~ + +*keyset-ref* ``string`` *→* ``guard`` + +Creates a guard for the keyset registered as KEYSET-REF with +‘define-keyset’. Concrete keysets are themselves guard types; this +function is specifically to store references alongside other guards in +the database, etc. + typeof-principal ~~~~~~~~~~~~~~~~ @@ -1988,6 +2011,44 @@ Validate that PRINCIPAL unambiguously identifies GUARD. (enforce (validate-principal (read-keyset 'keyset) account) "Invalid account ID") +.. _Zk: + +Zk +-- + +pairing-check +~~~~~~~~~~~~~ + +*points-g1* ``[]`` *points-g2* ``[]`` *→* ``bool`` + +Perform pairing and final exponentiation points in G1 and G2 in BN254, +check if the result is 1 + +point-add +~~~~~~~~~ + +*type* ``string`` *point1* ```` *point2* ```` *→* ```` + +Add two points together that lie on the curve BN254. Point addition +either in Fq or in Fq2 + +.. code:: lisp + + pact> (point-add 'g1 {'x: 1, 'y: 2} {'x: 1, 'y: 2}) + {"x": 1368015179489954701390400359078579693043519447331113978918064868415326638035,"y": 9918110051302171585080402603319702774565515993150576347155970296011118125764} + +scalar-mult +~~~~~~~~~~~ + +*type* ``string`` *point1* ```` *scalar* ``integer`` *→* ```` + +Multiply a point that lies on the curve BN254 by an integer value + +.. code:: lisp + + pact> (scalar-mult 'g1 {'x: 1, 'y: 2} 2) + {"x": 1368015179489954701390400359078579693043519447331113978918064868415326638035,"y": 9918110051302171585080402603319702774565515993150576347155970296011118125764} + .. _repl-lib: REPL-only functions @@ -2149,7 +2210,7 @@ env-exec-config *→* ``[string]`` Queries, or with arguments, sets execution config flags. Valid flags: -[“AllowReadInLocal”,“DisableHistoryInTransactionalMode”,“DisableInlineMemCheck”,“DisableModuleInstall”,“DisablePact40”,“DisablePact420”,“DisablePact43”,“DisablePact431”,“DisablePact44”,“DisablePactEvents”,“EnforceKeyFormats”,“OldReadOnlyBehavior”,“PreserveModuleIfacesBug”,“PreserveModuleNameBug”,“PreserveNsModuleInstallBug”,“PreserveShowDefs”] +[“AllowReadInLocal”,“DisableHistoryInTransactionalMode”,“DisableInlineMemCheck”,“DisableModuleInstall”,“DisableNewTrans”,“DisablePact40”,“DisablePact420”,“DisablePact43”,“DisablePact431”,“DisablePact44”,“DisablePact45”,“DisablePact46”,“DisablePactEvents”,“EnforceKeyFormats”,“OldReadOnlyBehavior”,“PreserveModuleIfacesBug”,“PreserveModuleNameBug”,“PreserveNsModuleInstallBug”,“PreserveShowDefs”] .. code:: lisp @@ -2427,9 +2488,15 @@ Typecheck MODULE, optionally enabling DEBUG output. verify ~~~~~~ -*module* ``string`` *→* ``string`` +*module* ``string`` *debug* ``bool`` *→* ``string`` + +Verify MODULE, checking that all properties hold. Optionally, if DEBUG +is set to true, write debug output to “pact-verify-MODULE” directory. + +.. code:: lisp -Verify MODULE, checking that all properties hold. + (verify "module") + (verify "module" true) with-applied-env ~~~~~~~~~~~~~~~~ diff --git a/docs/en/pact-reference.rst b/docs/en/pact-reference.rst index 98fbee5f3..8cd08249d 100644 --- a/docs/en/pact-reference.rst +++ b/docs/en/pact-reference.rst @@ -6,8 +6,9 @@ Pact Smart Contract Language Reference This document is a reference for the Pact smart-contract language, designed for correct, transactional execution on a `high-performance blockchain `__. For more background, please see the -`white paper `__ or the -`pact home page `__. +`white +paper `__ +or the `pact home page `__. Copyright (c) 2016 - 2018, Stuart Popejoy. All Rights Reserved. diff --git a/pact.cabal b/pact.cabal index e22b23b43..fd7aa3809 100644 --- a/pact.cabal +++ b/pact.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: pact -version: 4.4.1 +version: 4.6.0 -- ^ 4 digit is prerelease, 3- or 2-digit for prod release synopsis: Smart contract language library and REPL description: