Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,52 @@
4.7.0
---
* `read-*` functions are now recoverable if the key doesn't exist. That is, a call such as `(read-string 'key)` is recoverable
if `'key` does not exist in the data payload by surrounding it with `try`. As an example, `(try "string if key isn't present" (read-string "key"))`. This applies to

### Eval

- Improve advice implementation (#1187)
- Fix inconsistent trace output (#1153)
- Fix coverage, restore defun advice (#1151)
- Create persistence dirs if missing (#1148)
- Differentiate between errors on-chain and off-chain (#1185)
- Don't display function documentation in non-repl context (#1185)
- Runtime type checking on return types now enforced (#1209)

### Natives

- Allow native function versioning in eval (#1195)
- Add new native `dec` for integer to decimal conversion (#1150)
- Implement `shift` in terms of other natives for better gas costing (#1208)
- Intialize body of `env-data` to an empty object instead of Null (#1188)
* `read-*` functions are now recoverable if the key doesn't exist. That is, a call such as `(read-string 'key)` is recoverable if `'key` does not exist in the data payload by surrounding it with `try`. As an example, `(try "string if key isn't present" (read-string "key"))`. This applies to
`read-integer`, `read-string`, `read-decimal`, `read-keyset` and `read-msg` (as long as `read-msg` has a key supplied as an argument).


### Typechecking

- Fix Typechecker treatment of special binding forms (#1212)

### Formal Verification

- Enable warnings during symbolic eval (#1175)
- Remove `emit-event` shim (#1168)
- Remove `hash` shims (#1158)
- Remove `enumerate` shim (#1155)
- Remove `distinct` shim (#1154)
- Remove `describe-namespace` shim (#1156)
- Remove `is-principal`, `typeof-principal`, `create-principal`, and `validate-principal` shims (#1160)
- Remove `format` shim (#1159)

### Documentation

- Remove mention of private defpacts from the reference manual (#1207)
- Add documentation for `enumerate` (#1176)

### Misc

- New PR and Issue templates introduced.

Thanks to everyone for their contributions, especially @CryptoPascal31 for his wonderful feedback and commentary, and welcome to our newest Pact team member, @ak3n!.

4.6.0
---
* Add `DisablePact46` execution flag (#1138)
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 @@ -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.6.0"
"4.7.0"
```

Top level only: this function will fail if used in module code.
Expand Down
18 changes: 15 additions & 3 deletions docs/en/pact-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ returns true.
.. code:: lisp

pact> (enforce (!= (+ 2 2) 4) "Chaos reigns")
<interactive>:0:0: Chaos reigns
<interactive>:0:0:Error: Chaos reigns

enforce-one
~~~~~~~~~~~
Expand Down Expand Up @@ -517,7 +517,7 @@ Obtain current pact build version.
.. code:: lisp

pact> (pact-version)
"4.6.0"
"4.7.0"

Top level only: this function will fail if used in module code.

Expand Down Expand Up @@ -2222,7 +2222,7 @@ env-exec-config
*→* ``[string]``

Queries, or with arguments, sets execution config flags. Valid flags:
[“AllowReadInLocal”,“DisableHistoryInTransactionalMode”,“DisableInlineMemCheck”,“DisableModuleInstall”,“DisableNewTrans”,“DisablePact40”,“DisablePact420”,“DisablePact43”,“DisablePact431”,“DisablePact44”,“DisablePact45”,“DisablePact46”,“DisablePactEvents”,“EnforceKeyFormats”,“OldReadOnlyBehavior”,“PreserveModuleIfacesBug”,“PreserveModuleNameBug”,“PreserveNsModuleInstallBug”,“PreserveShowDefs”]
[“AllowReadInLocal”,“DisableHistoryInTransactionalMode”,“DisableInlineMemCheck”,“DisableModuleInstall”,“DisableNewTrans”,“DisablePact40”,“DisablePact420”,“DisablePact43”,“DisablePact431”,“DisablePact44”,“DisablePact45”,“DisablePact46”,“DisablePact47”,“DisablePactEvents”,“EnforceKeyFormats”,“OldReadOnlyBehavior”,“PreserveModuleIfacesBug”,“PreserveModuleNameBug”,“PreserveNsModuleInstallBug”,“PreserveShowDefs”]

.. code:: lisp

Expand Down Expand Up @@ -2353,6 +2353,18 @@ list of associated capabilities.

(env-sigs [{'key: "my-key", 'caps: [(accounts.USER_GUARD "my-account")]}, {'key: "admin-key", 'caps: []}

env-simulate-onchain
~~~~~~~~~~~~~~~~~~~~

*on-chain* ``bool`` *→* ``string``

Set a flag to simulate on-chain behavior that differs from the repl, in
particular for observing things like errors and stack traces.

.. code:: lisp

(env-simulate-onchain true)

expect
~~~~~~

Expand Down
134 changes: 134 additions & 0 deletions docs/en/pact-properties-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,22 @@ or?

Supported in either invariants or properties.

.. _FBoolHash:

hash
~~~~

.. code:: lisp

(hash s)

- takes ``s``: ``bool``
- produces ``string``

BLAKE2b 256-bit hash of bool values

Supported in properties only.

.. _Object:

Object operators
Expand Down Expand Up @@ -803,6 +819,24 @@ List / string / object contains

Supported in either invariants or properties.

.. _FEnumerate:

enumerate
~~~~~~~~~

.. code:: lisp

(enumerate from to step)

- takes ``from``: ``integer``
- takes ``to``: ``integer``
- takes ``step``: ``integer``
- produces [``integer``]

Returns a sequence of numbers as a list

Supported in either invariants or properties.

.. _FReverse:

reverse
Expand Down Expand Up @@ -922,6 +956,22 @@ filter a list by keeping the values for which ``f`` returns ``true``

Supported in either invariants or properties.

.. _FDistinct:

distinct
~~~~~~~~

.. code:: lisp

(distinct xs)

- takes ``xs``: [*a*]
- produces [*a*]

returns a list of distinct values

Supported in either invariants or properties.

.. _FFold:

fold
Expand All @@ -940,6 +990,24 @@ reduce a list by applying ``f`` to each element and the previous result

Supported in either invariants or properties.

.. _FListHash:

hash
~~~~

.. code:: lisp

(hash xs)

- takes ``xs``: [*a*]
- produces ``string``
- where *a* is of type ``integer``, ``decimal``, ``bool``, or
``string``

BLAKE2b 256-bit hash of lists

Supported in properties only.

.. _String:

String operators
Expand Down Expand Up @@ -1046,6 +1114,39 @@ is negative)

Supported in either invariants or properties.

.. _FStringHash:

hash
~~~~

.. code:: lisp

(hash s)

- takes ``s``: ``string``
- produces ``string``

BLAKE2b 256-bit hash of string values

Supported in properties only.

.. _FNumericalHash:

hash
~~~~

.. code:: lisp

(hash s)

- takes ``s``: *a*
- produces ``string``
- where *a* is of type ``integer`` or ``decimal``

BLAKE2b 256-bit hash of numerical values

Supported in properties only.

.. _Temporal:

Temporal operators
Expand Down Expand Up @@ -1481,6 +1582,39 @@ Whether the keyset in the row is enforced by the function under analysis

Supported in properties only.

.. _FIsPrincipal:

is-principal
~~~~~~~~~~~~

.. code:: lisp

(is-principal s)

- takes ``s``: ``string``
- produces ``bool``

Whether ``s`` conforms to the principal format without proving validity.

Supported in either invariants or properties.

.. _FTypeOfPrincipal:

typeof-principal
~~~~~~~~~~~~~~~~

.. code:: lisp

(typeof-principal s)

- takes ``s``: ``string``
- produces ``string``

Return the protocol type of the given ``s`` value. If input value is not
a principal type, then the empty string is returned.

Supported in either invariants or properties.

.. _Function:

Function operators
Expand Down
2 changes: 1 addition & 1 deletion docs/en/pact-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2493,7 +2493,7 @@ sequential order.
(credit payee amount)))

Defpacts may be nested (though the recursion restrictions apply, so it
must be a different defpact). They may be kicked off like a regular
must be a different defpact). They may be executed like a regular
function call within a defpact, but are continued after the first step
by calling ``continue`` with the same arguments.

Expand Down
2 changes: 1 addition & 1 deletion pact.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: pact
version: 4.6.0
version: 4.7.0
-- ^ 4 digit is prerelease, 3- or 2-digit for prod release
synopsis: Smart contract language library and REPL
description:
Expand Down