Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mopro wasm halo2 #254

Merged
merged 22 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
55df378
feat: added wasm exporter for halo2
sifnoc Oct 29, 2024
01e7455
chore: added gh action for testing halo2 wasm
sifnoc Nov 7, 2024
cfdde57
fix: lint
sifnoc Nov 7, 2024
ce30b43
fix: repo updates with Cargo
sifnoc Nov 7, 2024
6c3b932
feat: added simple web page for testing halo2 wasm code
sifnoc Nov 26, 2024
69f28c4
feat: added html style, test script with selenium driver
sifnoc Nov 28, 2024
6d4a876
feat: add test steps for halo2-wasm-web in gh action workflow
sifnoc Nov 28, 2024
2b541b0
fix: gh action workflow
sifnoc Nov 28, 2024
66fa25f
fix: halo2 wasm app workflow
sifnoc Nov 28, 2024
7b04f7f
chore: updated documentation and readme
sifnoc Nov 30, 2024
d1a994c
Update dependency and compiled wasm circuits
sifnoc Dec 2, 2024
f03978a
refactor: applied suggestions in PR review
sifnoc Dec 3, 2024
0a9c596
fix: using multi-thread on wasm
sifnoc Dec 3, 2024
1e2f0c3
chore: update compiled wasm
sifnoc Dec 3, 2024
71a61bc
fix: wasm proof & verify functions
sifnoc Dec 3, 2024
b403703
Merge branch 'main' into 'mopro-wasm' and resolve conflicts in Cargo.…
sifnoc Dec 3, 2024
8c0de02
fix: initialize wasm instance in test_halo2.js
sifnoc Dec 3, 2024
0cc084f
fix: test cases in workflow and local
sifnoc Dec 3, 2024
fa543ff
fix: check test case validity while testing on halo2 wasm
sifnoc Dec 3, 2024
514bd4d
fix: use 'lite-server' instead of 'serve' for serving files outside o…
sifnoc Dec 4, 2024
e6c0fbc
updated docs and names following PR reviews
sifnoc Dec 4, 2024
63e90b9
refactor: test web page and testing script for expliciting web-worker…
sifnoc Dec 4, 2024
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
141 changes: 141 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4

- name: Check formatting
run: cargo fmt --all -- --check

Expand Down Expand Up @@ -58,6 +59,77 @@ jobs:
override: true
- name: Run ffi ashlang tests
run: cd mopro-ffi && cargo test --features ashlang --no-default-features
setup-halo2-wasm-env:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
outputs:
chrome-dir: ${{ steps.parsed-chrome-chromedriver-dir.outputs.chrome-dir }}
chromedriver-dir: ${{ steps.parsed-chrome-chromedriver-dir.outputs.chromedriver-dir }}
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-07-18
override: true
- name: Cache wasm-pack
id: cache-wasm-pack
uses: actions/cache@v4
with:
path: ~/.cargo/bin/wasm-pack
key: ${{ runner.os }}-wasm-pack
- name: Install wasm-pack
if: steps.cache-wasm-pack.outputs.cache-hit != 'true'
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Setup Chrome and ChromeDriver
uses: browser-actions/setup-chrome@v1
id: setup-chrome-chromedriver
with:
chrome-version: 130
install-chromedriver: true
- name: Parse Chrome and ChromeDriver Directories
id: parsed-chrome-chromedriver-dir
run: |
echo "chrome-dir=$(dirname ${{ steps.setup-chrome-chromedriver.outputs.chrome-path }})" >> $GITHUB_OUTPUT
echo "chromedriver-dir=$(dirname ${{ steps.setup-chrome-chromedriver.outputs.chromedriver-path }})" >> $GITHUB_OUTPUT
- name: Cache Chrome and ChromeDriver
id: cache-chrome-chromedriver
uses: actions/cache@v4
with:
path: |
${{ steps.parsed-chrome-chromedriver-dir.outputs.chrome-dir }}
${{ steps.parsed-chrome-chromedriver-dir.outputs.chromedriver-dir }}
key: ${{ runner.os }}-cache-chrome-chromedriver

test-wasm-halo2:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
needs: setup-halo2-wasm-env
env:
CHROME_BIN: ${{ needs.setup-halo2-wasm-env.outputs.chrome-dir }}/chrome
CHROMEDRIVER_BIN: ${{ needs.setup-halo2-wasm-env.outputs.chromedriver-dir }}/chromedriver
steps:
- uses: actions/checkout@v4
- name: Restore cached wasm-pack
uses: actions/cache@v4
with:
path: ~/.cargo/bin/wasm-pack
key: ${{ runner.os }}-wasm-pack
- name: Restore cached chrome and chromedriver
uses: actions/cache@v4
with:
path: |
${{ needs.setup-halo2-wasm-env.outputs.chrome-dir }}
${{ needs.setup-halo2-wasm-env.outputs.chromedriver-dir }}
key: ${{ runner.os }}-cache-chrome-chromedriver
- name: Run wasm halo2 tests
run: |
echo "Override default chrome path for 'wasm-pack test'"
ln -sf $CHROME_BIN /usr/local/bin/google-chrome-stable
echo "Check override chrome version"
google-chrome-stable --version
cd mopro-wasm
wasm-pack test --chrome --chromedriver $CHROMEDRIVER_BIN --headless
test-e2e:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
Expand Down Expand Up @@ -192,3 +264,72 @@ jobs:
uses: android-actions/[email protected]
- name: Build android app
run: cd test-e2e/android && ./gradlew build
build-halo2-wasm-web:
runs-on: ubuntu-latest
needs: setup-halo2-wasm-env
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- name: Restore cached wasm-pack
uses: actions/cache@v4
with:
path: ~/.cargo/bin/wasm-pack
key: ${{ runner.os }}-wasm-pack
- name: Cache halo2 wasm circuit
id: cache-halo2-wasm-circuit
uses: actions/cache@v4
with:
path: |
test-e2e/web/halo2-plonk-fibonacci
test-e2e/web/halo2-hyperplonk-fibonacci
test-e2e/web/halo2-gemini-fibonacci
key: ${{ runner.os }}-halo2-wasm-circuit-${{ hashFiles('mopro-wasm/**/*') }}
- name: Build circuits for Wasm Web app
if: steps.cache-halo2-wasm-circuit.outputs.cache-hit != 'true'
run: |
cd mopro-wasm
wasm-pack build --target web --out-dir ../test-e2e/web/halo2-plonk-fibonacci -- --features plonk
wasm-pack build --target web --out-dir ../test-e2e/web/halo2-hyperplonk-fibonacci -- --features hyperplonk
wasm-pack build --target web --out-dir ../test-e2e/web/halo2-gemini-fibonacci -- --features gemini
test-halo2-wasm-web:
runs-on: ubuntu-latest
needs:
- setup-halo2-wasm-env
- build-halo2-wasm-web
env:
CHROME_BIN: ${{ needs.setup-halo2-wasm-env.outputs.chrome-dir }}/chrome
CHROMEDRIVER_BIN: ${{ needs.setup-halo2-wasm-env.outputs.chromedriver-dir }}/chromedriver
defaults:
run:
working-directory: test-e2e/web
steps:
- uses: actions/checkout@v4
- name: Restore cached chrome and chromedriver
uses: actions/cache@v4
with:
path: |
${{ needs.setup-halo2-wasm-env.outputs.chrome-dir }}
${{ needs.setup-halo2-wasm-env.outputs.chromedriver-dir }}
key: ${{ runner.os }}-cache-chrome-chromedriver
- name: Restore cached halo2 wasm circuit
uses: actions/cache@v4
with:
path: |
test-e2e/web/halo2-plonk-fibonacci
test-e2e/web/halo2-hyperplonk-fibonacci
test-e2e/web/halo2-gemini-fibonacci
key: ${{ runner.os }}-halo2-wasm-circuit-${{ hashFiles('mopro-wasm/**/*') }}
- name: Install dependencies
run: yarn install
- name: Run halo2-wasm-app server and test it
run: |
nohup yarn start &
for i in {1..30}; do
if curl --silent http://localhost:3000 > /dev/null; then
echo "Server is ready!"
break
fi
echo "Waiting for server..."
sleep 1
done
yarn test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ mopro-example-app
!templates/mopro-example-app
graph.bin

*.xcframework/
*.xcframework/
node_modules
Loading
Loading