Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcardon committed Feb 13, 2024
2 parents e9f3f14 + f9f3143 commit 5a5b332
Show file tree
Hide file tree
Showing 43 changed files with 811 additions and 113 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ hie.yaml
commands.sqlite
cabal.project.local*
/golden/lcov/actual
.DS_Store
.DS_Store
.ghci_history
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Unreleased
---
### Features
- Support for verifier plugins (#1324)


4.10.0
---
### Features
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ console> pact --serve --help
Config file is YAML format with the following properties:
port - HTTP server port
persistDir - Directory for database files.
If ommitted, runs in-memory only.
If omitted, runs in-memory only.
logDir - Directory for HTTP logs
pragmas - SQLite pragmas to use with persistence DBs
verbose - [True|False] Provide extra logging information
Expand Down
24 changes: 15 additions & 9 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
packages: .

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

source-repository-package
type: git
location: https://github.com/kadena-io/pact-json.git
tag: 1d260bfaa48312b54851057885de4c43c420e35f
--sha256: 0fzq4mzaszj5clvixx9mn1x6r4dcrnwvbl2znd0p5mmy5h2jr0hh

-- temporary upper bounds
constraints: sbv <10

-- test upper bounds
constraints: hspec-golden <0.2,

source-repository-package
type: git
tag: e43073d0b8d89d9b300980913b842f4be339846d
location: https://github.com/kadena-io/pact-json
--sha256: sha256-ZWbAId0JBaxDsYhwcYUyw04sjYstXyosSCenzOvUxsQ=

-- These packages are tightly bundled with GHC. The rules ensure that
-- our builds use the version that ships with the GHC version that is
-- used for the build.
Expand All @@ -38,6 +41,9 @@ allow-newer: servant:*
-- Required by trifecta (e.g. to allow mtl >=2.3)
allow-newer: trifecta:*

-- servant-0.20 does not yet support aeson-2.2
--
constraints: aeson <2.2
source-repository-package
type: git
location: https://github.com/kadena-io/kadena-ethereum-bridge.git
tag: ffbf20e9f0430b95448bd66c6b1b530864397fb3
--sha256: sha256-xdawv/tdjh61MbJKcBqm9Fje36+gVljuZsAxOTX1gP0=

51 changes: 43 additions & 8 deletions docs/en/pact-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

Constant denoting the ASCII charset

Constant:
Constant:
&nbsp;&nbsp;`CHARSET_ASCII:integer = 0`

### CHARSET_LATIN1 {#CHARSET_LATIN1}

Constant denoting the Latin-1 charset ISO-8859-1

Constant:
Constant:
&nbsp;&nbsp;`CHARSET_LATIN1:integer = 1`

### at {#at}
Expand Down Expand Up @@ -765,7 +765,7 @@ Top level only: this function will fail if used in module code.

Select rows from TABLE using QRY as a predicate with both key and value, and then accumulate results of the query in CONSUMER. Output is sorted by the ordering of keys.
```lisp
(let*
(let*
((qry (lambda (k obj) true)) ;; select all rows
(f (lambda (k obj) [(at 'firstName obj), (at 'b obj)]))
)
Expand Down Expand Up @@ -924,7 +924,7 @@ pact> (add-time (time "2016-07-22T12:00:00Z") 15)
*n*&nbsp;`integer` *&rarr;*&nbsp;`decimal`


N days, for use with 'add-time'
N days, for use with 'add-time'
```lisp
pact> (add-time (time "2016-07-22T12:00:00Z") (days 1))
"2016-07-23T12:00:00Z"
Expand Down Expand Up @@ -962,7 +962,7 @@ pact> (format-time "%F" (time "2016-07-22T12:00:00Z"))
*n*&nbsp;`integer` *&rarr;*&nbsp;`decimal`


N hours, for use with 'add-time'
N hours, for use with 'add-time'
```lisp
pact> (add-time (time "2016-07-22T12:00:00Z") (hours 1))
"2016-07-22T13:00:00Z"
Expand All @@ -976,7 +976,7 @@ pact> (add-time (time "2016-07-22T12:00:00Z") (hours 1))
*n*&nbsp;`integer` *&rarr;*&nbsp;`decimal`


N minutes, for use with 'add-time'.
N minutes, for use with 'add-time'.
```lisp
pact> (add-time (time "2016-07-22T12:00:00Z") (minutes 1))
"2016-07-22T12:01:00Z"
Expand All @@ -1000,7 +1000,7 @@ pact> (parse-time "%F" "2016-09-12")
*utcval*&nbsp;`string` *&rarr;*&nbsp;`time`


Construct time from UTCVAL using ISO8601 format (%Y-%m-%dT%H:%M:%SZ).
Construct time from UTCVAL using ISO8601 format (%Y-%m-%dT%H:%M:%SZ).
```lisp
pact> (time "2016-07-22T11:26:35Z")
"2016-07-22T11:26:35Z"
Expand Down Expand Up @@ -1582,6 +1582,17 @@ Execute GUARD, or defined keyset KEYSETNAME, to enforce desired predicate logic.
```


### enforce-verifier {#enforce-verifier}

*verifiername*&nbsp;`string` *&rarr;*&nbsp;`bool`


Enforce that a verifier is in scope.
```lisp
(enforce-verifier 'COOLZK)
```


### install-capability {#install-capability}

*capability*&nbsp;` -> bool` *&rarr;*&nbsp;`string`
Expand Down Expand Up @@ -1804,6 +1815,19 @@ pact> (poseidon-hash-hack-a-chain 1 2 3 4 5 6 7 8)
18604317144381847857886385684060986177838410221561136253933256952257712543953
```

## Hyperlane {#Hyperlane}

### hyperlane-message-id {#hyperlane-message-id}

*x*&nbsp;`object:*` *&rarr;*&nbsp;`string`


Get the Message Id of a Hyperlane Message object.
```lisp
pact> (hyperlane-message-id {"destinationDomain": 1,"nonce": 325,"originDomain": 626,"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F","sender": "0x6b622d746f6b656e2d726f75746572","tokenMessage": {"amount": 10000000000000000000.0,"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},"version": 1})
"0x97d98aa7fdb548f43c9be37aaea33fca79680247eb8396148f1df10e6e0adfb7"
```

## REPL-only functions {#repl-lib}

The following functions are loaded automatically into the interactive REPL, or within script files with a `.repl` extension. They are not available for blockchain-based execution.
Expand Down Expand Up @@ -1947,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","DisablePact411","DisablePact42","DisablePact43","DisablePact431","DisablePact44","DisablePact45","DisablePact46","DisablePact47","DisablePact48","DisablePact49","DisablePactEvents","DisableRuntimeReturnTypeChecking","EnforceKeyFormats","OldReadOnlyBehavior","PreserveModuleIfacesBug","PreserveModuleNameBug","PreserveNsModuleInstallBug","PreserveShowDefs"]
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"]
```lisp
pact> (env-exec-config ['DisableHistoryInTransactionalMode]) (env-exec-config)
["DisableHistoryInTransactionalMode"]
Expand Down Expand Up @@ -2081,6 +2105,17 @@ Set a flag to simulate on-chain behavior that differs from the repl, in particul
```


### env-verifiers {#env-verifiers}

*verifiers*&nbsp;`[object:*]` *&rarr;*&nbsp;`string`


Set transaction verifier names and capabilities. VERIFIERS is a list of objects with "name" specifying the verifier name, and "caps" specifying a list of associated capabilities.
```lisp
(env-verifiers [({'name: "COOLZK", 'caps: [(accounts.USER_GUARD "my-account")]}, {'name: "HYPERCHAIN-BRIDGE", 'caps: [(bridge.MINT "mycoin" 20)]}])
```


### expect {#expect}

*doc*&nbsp;`string` *expected*&nbsp;`<a>` *actual*&nbsp;`<a>` *&rarr;*&nbsp;`string`
Expand Down
2 changes: 1 addition & 1 deletion docs/en/pact-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ Modules may be imported at a namespace, and interfaces my be implemented in a si

#### Example: appending code to a namespace

If one is simply appending code to an existing namespace, then the namespace prefix in the fully qualified name may be ommitted, as using a namespace works in a similar way to importing a module: all toplevel definitions within a namespace are brought into scope when `(namespace 'my-namespace)` is declared. Continuing from the previous example:
If one is simply appending code to an existing namespace, then the namespace prefix in the fully qualified name may be omitted, as using a namespace works in a similar way to importing a module: all toplevel definitions within a namespace are brought into scope when `(namespace 'my-namespace)` is declared. Continuing from the previous example:

```lisp
pact> (my-other-namespace.my-other-module.more-hello 3)
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 @@ -806,7 +806,7 @@ Example: appending code to a namespace
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If one is simply appending code to an existing namespace, then the
namespace prefix in the fully qualified name may be ommitted, as using a
namespace prefix in the fully qualified name may be omitted, as using a
namespace works in a similar way to importing a module: all toplevel
definitions within a namespace are brought into scope when
``(namespace 'my-namespace)`` is declared. Continuing from the previous
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
};
shell.buildInputs = with pkgs; [
zlib
z3
z3_4_11
pkgconfig
(python3.withPackages (ps: [ps.sphinx ps.sphinx_rtd_theme]))
pandoc perl
Expand Down
14 changes: 14 additions & 0 deletions golden/gas-model/golden
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,10 @@
"8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a"
"77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a")
- 29
- - |-
(hyperlane-message-id {"destinationDomain": 1,"nonce": 325,"originDomain": 626,"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F","sender": "0x6b622d746f6b656e2d726f75746572","tokenMessage": {"amount": 10000000000000000000.0,"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},"version": 1})
(hyperlane-message-id {"destinationDomain": 1,"nonce": 325,"originDomain": 626,"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F","sender": "0x6b622d746f6b656e2d726f75746572","tokenMessage": {"amount": 10000000000000000000.0,"recipient": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"version": 1})
- 4
- - (^ 2 longNumber)
- 4
- - (^ 2 medNumber)
Expand Down Expand Up @@ -999,6 +1003,16 @@
- 2
- - (>= (time "2016-07-22T12:00:00Z") (time "2018-07-22T12:00:00Z"))
- 6
- - |-
(module m GOV
(defcap GOV () true)

(defcap GOOD () (enforce-verifier 'HYPERLANE))

(defun good () (with-capability (GOOD) 1))
)
(good)
- 59
- - (take 1 longNumberList)
- 3
- - (take 1 medNumberList)
Expand Down
5 changes: 5 additions & 0 deletions pact.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ library
cbits/musl/sqrt_data.c
exposed-modules:
Crypto.Hash.Blake2Native
Crypto.Hash.HyperlaneMessageId
Crypto.Hash.PoseidonNative
Pact.Analyze.Remote.Types
Pact.ApiReq
Expand Down Expand Up @@ -181,6 +182,7 @@ library
Pact.Types.Type
Pact.Types.Typecheck
Pact.Types.Util
Pact.Types.Verifier
Pact.Types.Version
Pact.Utils.Servant

Expand Down Expand Up @@ -223,6 +225,7 @@ library
, filepath >=1.4.1.0
, groups
, hashable >=1.4
, ethereum >= 0.1
, lens >=4.14
, megaparsec >=9
, memory
Expand Down Expand Up @@ -253,6 +256,7 @@ library
, vector >=0.11.0.0
, vector-algorithms >=0.7
, vector-space >=0.10.4
, wide-word >= 0.1
, yaml

if flag(build-tool)
Expand Down Expand Up @@ -465,6 +469,7 @@ test-suite hspec
GasModelSpec
GoldenSpec
HistoryServiceSpec
HyperlaneSpec
PactContinuationSpec
PersistSpec
PoseidonSpec
Expand Down
Loading

0 comments on commit 5a5b332

Please sign in to comment.