Skip to content

Commit

Permalink
Pluggable witness calc (#14)
Browse files Browse the repository at this point in the history
* Witness implementation using tetratelabs/wazero

* fix lint errors

* Update wazero to v1.0.3

* Removed unused constructor parameter sanityCheck from NewCircom2WitnessCalculator

* Rename test_files directory to testdata. It's more goish.

* Make witness calculator pluggable with wasm engine

* Merge fixes

* Upgrade wazero dependency to v1.1.0

* Upgrade wazero dependency to v1.1.0

* Put different wasm implementations into different modules

* add linter and tests for witness calc

* fix test commands

* rename lint and test ci jobs

* Increate timeout for testing witness

* Simplify interface for witness calculator implamentation. Do all serialization and formatting logic in one place.

* go mod tidy

* Update dependencies

* upgrade dependencies

* refactor names

* upgrade dependencies

* go mod tidy

* Dump v2 for witness

* dump wasmer/wazero versions to v2

* fix wazero/wasmer versions

---------

Co-authored-by: Oleksandr Brezhniev <[email protected]>
  • Loading branch information
olomix and OBrezhniev authored May 24, 2023
1 parent caf247d commit 2a0c526
Show file tree
Hide file tree
Showing 22 changed files with 667 additions and 688 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/lint-witness.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: lint-witness

on:
push:
branches:
- master
pull_request:

jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: lint witness
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
working-directory: witness
- name: lint witness/wazero
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
working-directory: witness/wazero
- name: lint witness/wasmer
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
working-directory: witness/wasmer
- name: lint witness/test_wasm_impls
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
working-directory: witness/test_wasm_impls
32 changes: 32 additions & 0 deletions .github/workflows/test-witness.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: test-witness

on:
push:
branches:
- master
pull_request:

jobs:
test:
strategy:
matrix:
containers:
- 1.18.10-bullseye
- 1.19.9-bullseye
- 1.20.4-bullseye
runs-on: ubuntu-20.04
container: golang:${{matrix.containers}}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: cd witness && go test -race -timeout=60s -v ./...
- run: cd witness/wazero && go test -race -timeout=60s -v ./...
- run: cd witness/wasmer && go test -race -timeout=60s -v ./...
- run: cd witness/test_wasm_impls && go test -race -timeout=300s -v ./...
2 changes: 1 addition & 1 deletion witness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Calculates witness, that can be passed to a prover ([snarkjs](https://github.com
## Installation

```
go get github.com/iden3/go-rapidsnark/witness
go get github.com/iden3/go-rapidsnark/witness/v2
```

## Dependencies
Expand Down
129 changes: 0 additions & 129 deletions witness/circom2witnesscalc_test.go

This file was deleted.

189 changes: 0 additions & 189 deletions witness/circom2witnesscalc_wazero_test.go

This file was deleted.

Loading

0 comments on commit 2a0c526

Please sign in to comment.