mirror of
https://github.com/zkonduit/ezkl.git
synced 2026-01-13 08:17:57 -05:00
Compare commits
27 Commits
vka-hashin
...
ac/fix-uns
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4b6cf445c | ||
|
|
3c7c1fd204 | ||
|
|
94e8664f2e | ||
|
|
960bcb1a56 | ||
|
|
054aaf4938 | ||
|
|
cfeb3143db | ||
|
|
5c2f8079b0 | ||
|
|
24160d887e | ||
|
|
ef7441f3cf | ||
|
|
b94f1a03fc | ||
|
|
c5dd3e7e7f | ||
|
|
ab56aabf2e | ||
|
|
7f54650647 | ||
|
|
8a7b06ee2f | ||
|
|
92ef831185 | ||
|
|
f64ccf7512 | ||
|
|
c703b9ad82 | ||
|
|
87327cab96 | ||
|
|
6e168f4bc4 | ||
|
|
d3495b2f69 | ||
|
|
398bcb5928 | ||
|
|
9077b8debc | ||
|
|
28594c7651 | ||
|
|
b9c5ae76c0 | ||
|
|
c34ce000ff | ||
|
|
3ea68f08b3 | ||
|
|
e81d93a73a |
4
.github/workflows/engine.yml
vendored
4
.github/workflows/engine.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa #v0.4.0
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
run: rustup target add wasm32-unknown-unknown
|
||||
|
||||
- name: Add rust-src
|
||||
run: rustup component add rust-src --toolchain nightly-2025-02-17-x86_64-unknown-linux-gnu
|
||||
run: rustup component add rust-src --toolchain nightly-2025-06-16-x86_64-unknown-linux-gnu
|
||||
- name: Install binaryen
|
||||
run: |
|
||||
set -e
|
||||
|
||||
2
.github/workflows/large-tests.yml
vendored
2
.github/workflows/large-tests.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- name: nanoGPT Mock
|
||||
|
||||
4
.github/workflows/pypi.yml
vendored
4
.github/workflows/pypi.yml
vendored
@@ -50,7 +50,7 @@ jobs:
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
@@ -115,7 +115,7 @@ jobs:
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
|
||||
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
@@ -26,7 +26,6 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
echo "EZKL_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
echo "version is: ${{ env.EZKL_VERSION }}"
|
||||
|
||||
- name: Create Github Release
|
||||
id: create-release
|
||||
@@ -51,7 +50,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- name: Checkout repo
|
||||
@@ -64,7 +63,6 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
echo "EZKL_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
echo "version is: ${{ env.EZKL_VERSION }}"
|
||||
|
||||
- name: Set Cargo.toml version to match github tag
|
||||
shell: bash
|
||||
@@ -119,27 +117,27 @@ jobs:
|
||||
include:
|
||||
- build: windows-msvc
|
||||
os: windows-latest
|
||||
rust: nightly-2025-02-17
|
||||
rust: nightly-2025-06-16
|
||||
target: x86_64-pc-windows-msvc
|
||||
- build: macos
|
||||
os: macos-13
|
||||
rust: nightly-2025-02-17
|
||||
rust: nightly-2025-06-16
|
||||
target: x86_64-apple-darwin
|
||||
- build: macos-aarch64
|
||||
os: macos-13
|
||||
rust: nightly-2025-02-17
|
||||
rust: nightly-2025-06-16
|
||||
target: aarch64-apple-darwin
|
||||
- build: linux-musl
|
||||
os: ubuntu-22.04
|
||||
rust: nightly-2025-02-17
|
||||
rust: nightly-2025-06-16
|
||||
target: x86_64-unknown-linux-musl
|
||||
- build: linux-gnu
|
||||
os: ubuntu-22.04
|
||||
rust: nightly-2025-02-17
|
||||
rust: nightly-2025-06-16
|
||||
target: x86_64-unknown-linux-gnu
|
||||
- build: linux-aarch64
|
||||
os: ubuntu-22.04
|
||||
rust: nightly-2025-02-17
|
||||
rust: nightly-2025-06-16
|
||||
target: aarch64-unknown-linux-gnu
|
||||
|
||||
steps:
|
||||
@@ -152,7 +150,6 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
echo "EZKL_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
echo "version is: ${{ env.EZKL_VERSION }}"
|
||||
|
||||
- name: Set Cargo.toml version to match github tag
|
||||
shell: bash
|
||||
|
||||
556
.github/workflows/rust.yml
vendored
556
.github/workflows/rust.yml
vendored
@@ -30,28 +30,10 @@ jobs:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3
|
||||
@@ -71,28 +53,11 @@ jobs:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- name: Build
|
||||
@@ -108,28 +73,9 @@ jobs:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- name: Docs
|
||||
@@ -145,28 +91,9 @@ jobs:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -189,9 +116,9 @@ jobs:
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
# with:
|
||||
# persist-credentials: false
|
||||
# - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
# - uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
# with:
|
||||
# toolchain: nightly-2025-02-17
|
||||
# toolchain: nightly-2025-06-16
|
||||
# override: true
|
||||
# components: rustfmt, clippy
|
||||
# - uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -217,35 +144,17 @@ jobs:
|
||||
ultra-overflow-tests_og-lookup:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: non-gpu
|
||||
runs-on: non-gpu,non-sgx
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -271,37 +180,22 @@ jobs:
|
||||
ultra-overflow-tests:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: non-gpu
|
||||
runs-on: non-gpu,non-sgx
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
with:
|
||||
crate: cargo-nextest
|
||||
@@ -328,32 +222,16 @@ jobs:
|
||||
runs-on: ubuntu-latest-16-cores
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -366,35 +244,21 @@ jobs:
|
||||
wasm32-tests:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: non-gpu
|
||||
runs-on: ubuntu-latest-64-cores
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
# add `atomics` and `bulk-memory` to RUSTFLAGS to enable wasm-bindgen tests
|
||||
RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa #v0.4.0
|
||||
@@ -407,16 +271,22 @@ jobs:
|
||||
- name: Install wasm32-unknown-unknown
|
||||
run: rustup target add wasm32-unknown-unknown
|
||||
- name: Add rust-src
|
||||
run: rustup component add rust-src --toolchain nightly-2025-02-17-x86_64-unknown-linux-gnu
|
||||
run: rustup component add rust-src --toolchain nightly-2025-06-16-x86_64-unknown-linux-gnu
|
||||
- name: Create webdriver.json to disable timeouts
|
||||
run: |
|
||||
echo '{"args": ["--headless", "--disable-gpu", "--disable-dev-shm-usage", "--no-sandbox"]}' > webdriver.json
|
||||
- name: Run wasm verifier tests
|
||||
# on mac:
|
||||
# AR=/opt/homebrew/opt/llvm/bin/llvm-ar CC=/opt/homebrew/opt/llvm/bin/clang wasm-pack test --firefox --headless -- -Z build-std="panic_abort,std" --features web
|
||||
run: wasm-pack test --chrome --headless -- -Z build-std="panic_abort,std" --features web
|
||||
run: |
|
||||
ulimit -n 65536
|
||||
WASM_BINDGEN_TEST_THREADS=1 \
|
||||
WASM_BINDGEN_TEST_TIMEOUT=1800 \
|
||||
CHROMEDRIVER_ARGS="--log-level=INFO" \
|
||||
wasm-pack test --chrome --headless -- -Z build-std="panic_abort,std" --features web -- --nocapture
|
||||
|
||||
mock-proving-tests:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: non-gpu
|
||||
runs-on: non-gpu,non-sgx
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
@@ -424,27 +294,10 @@ jobs:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -503,38 +356,27 @@ jobs:
|
||||
prove-and-verify-evm-tests:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: non-gpu
|
||||
needs: [build, library-tests, docs, python-tests, python-integration-tests]
|
||||
runs-on: non-gpu,non-sgx
|
||||
# needs: [build, library-tests, docs, python-tests, python-integration-tests]
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa #v0.4.0
|
||||
with:
|
||||
# Pin to version 0.12.1
|
||||
version: "v0.12.1"
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
with:
|
||||
crate: cargo-nextest
|
||||
@@ -552,27 +394,27 @@ jobs:
|
||||
node-version: "18.12.1"
|
||||
cache: "pnpm"
|
||||
- name: "Add rust-src"
|
||||
run: rustup component add rust-src --toolchain nightly-2025-02-17-x86_64-unknown-linux-gnu
|
||||
run: rustup component add rust-src --toolchain nightly-2025-06-16-x86_64-unknown-linux-gnu
|
||||
- name: Install dependencies for js tests and package
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
# - name: Install solc
|
||||
# run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.20 && solc --version
|
||||
- name: Install Anvil
|
||||
run: cargo install --git https://github.com/foundry-rs/foundry --rev 62cdea8ff9e6efef011f77e295823b5f2dbeb3a1 --locked anvil --force
|
||||
run: cargo install --git https://github.com/foundry-rs/foundry --rev 56b806a3ba7866a3b061093bebd0fa2ace97f1fc --locked anvil --force
|
||||
- name: Build wasm package for nodejs target.
|
||||
run: |
|
||||
wasm-pack build --target nodejs --out-dir ./tests/wasm/nodejs . -- -Z build-std="panic_abort,std"
|
||||
- name: KZG prove and verify tests (EVM)
|
||||
run: cargo nextest run --verbose "tests_evm::kzg_evm_prove_and_verify_::" --test-threads 1
|
||||
- name: KZG prove and verify tests (EVM + reusable verifier + col-overflow)
|
||||
run: cargo nextest run --verbose tests_evm::kzg_evm_prove_and_verify_reusable_verifier --test-threads 1
|
||||
run: cargo nextest run --verbose tests_evm::kzg_evm_prove_and_verify_reusable_verifier --features reusable-verifier --test-threads 1
|
||||
- name: KZG prove and verify tests (EVM + kzg all)
|
||||
run: cargo nextest run --verbose tests_evm::kzg_evm_kzg_all_prove_and_verify --test-threads 1
|
||||
- name: KZG prove and verify tests (EVM + kzg inputs)
|
||||
run: cargo nextest run --verbose tests_evm::kzg_evm_kzg_input_prove_and_verify --test-threads 1
|
||||
- name: KZG prove and verify tests (EVM + kzg params)
|
||||
run: cargo nextest run --verbose tests_evm::kzg_evm_kzg_params_prove_and_verify --test-threads 1
|
||||
- name: KZG prove and verify tests (EVM)
|
||||
run: cargo nextest run --verbose tests_evm::kzg_evm_prove_and_verify --test-threads 1
|
||||
- name: KZG prove and verify tests (EVM + hashed inputs)
|
||||
run: cargo nextest run --verbose tests_evm::kzg_evm_hashed_input_prove_and_verify --test-threads 1
|
||||
- name: KZG prove and verify tests (EVM + hashed params)
|
||||
@@ -589,9 +431,9 @@ jobs:
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
# with:
|
||||
# persist-credentials: false
|
||||
# - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
# - uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
# with:
|
||||
# toolchain: nightly-2025-02-17
|
||||
# toolchain: nightly-2025-06-16
|
||||
# override: true
|
||||
# components: rustfmt, clippy
|
||||
# - uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa #v0.4.0
|
||||
@@ -599,7 +441,7 @@ jobs:
|
||||
# # Pin to version 0.12.1
|
||||
# version: 'v0.12.1'
|
||||
# - name: Add rust-src
|
||||
# run: rustup component add rust-src --toolchain nightly-2025-02-17
|
||||
# run: rustup component add rust-src --toolchain nightly-2025-06-16
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
# with:
|
||||
# persist-credentials: false
|
||||
@@ -617,36 +459,21 @@ jobs:
|
||||
prove-and-verify-tests:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: non-gpu
|
||||
runs-on: non-gpu,non-sgx
|
||||
needs: [build, library-tests, docs]
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa #v0.4.0
|
||||
@@ -657,7 +484,7 @@ jobs:
|
||||
run: rustup target add wasm32-unknown-unknown
|
||||
|
||||
- name: Add rust-src
|
||||
run: rustup component add rust-src --toolchain nightly-2025-02-17-x86_64-unknown-linux-gnu
|
||||
run: rustup component add rust-src --toolchain nightly-2025-06-16-x86_64-unknown-linux-gnu
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
@@ -722,13 +549,13 @@ jobs:
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
# with:
|
||||
# persist-credentials: false
|
||||
# - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
# - uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
# with:
|
||||
# toolchain: nightly-2025-02-17
|
||||
# toolchain: nightly-2025-06-16
|
||||
# override: true
|
||||
# components: rustfmt, clippy
|
||||
# - name: Add rust-src
|
||||
# run: rustup component add rust-src --toolchain nightly-2025-02-17-x86_64-unknown-linux-gnu
|
||||
# run: rustup component add rust-src --toolchain nightly-2025-06-16-x86_64-unknown-linux-gnu
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
# - uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
# with:
|
||||
@@ -758,32 +585,16 @@ jobs:
|
||||
needs: [build, library-tests, docs, python-tests, python-integration-tests]
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
|
||||
- uses: dtolnay/rust-toolchain@4f94fbe7e03939b0e674bcc9ca609a16088f63ff #nightly branch, TODO: update when required
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -801,9 +612,9 @@ jobs:
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
# with:
|
||||
# persist-credentials: false
|
||||
# - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
# - uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
# with:
|
||||
# toolchain: nightly-2025-02-17
|
||||
# toolchain: nightly-2025-06-16
|
||||
# override: true
|
||||
# components: rustfmt, clippy
|
||||
# - uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -820,32 +631,16 @@ jobs:
|
||||
needs: [build, library-tests, docs, python-tests, python-integration-tests]
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -862,32 +657,16 @@ jobs:
|
||||
needs: [build, library-tests, docs, python-tests, python-integration-tests]
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -897,7 +676,7 @@ jobs:
|
||||
# - name: Install solc
|
||||
# run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.20 && solc --version
|
||||
- name: Install Anvil
|
||||
run: cargo install --git https://github.com/foundry-rs/foundry --rev 62cdea8ff9e6efef011f77e295823b5f2dbeb3a1 --locked anvil --force
|
||||
run: cargo install --git https://github.com/foundry-rs/foundry --rev 56b806a3ba7866a3b061093bebd0fa2ace97f1fc --locked anvil --force
|
||||
- name: KZG prove and verify aggr tests
|
||||
run: cargo nextest run --verbose tests_evm::kzg_evm_aggr_prove_and_verify_::t --test-threads 4 -- --include-ignored
|
||||
|
||||
@@ -908,32 +687,16 @@ jobs:
|
||||
needs: [build, library-tests, docs]
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -946,39 +709,23 @@ jobs:
|
||||
python-tests:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: non-gpu
|
||||
runs-on: non-gpu,non-sgx
|
||||
needs: [build, library-tests, docs]
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
|
||||
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- name: Install cmake
|
||||
@@ -988,48 +735,32 @@ jobs:
|
||||
- name: Setup Virtual Env and Install python dependencies
|
||||
run: python -m venv .env --clear; source .env/bin/activate; pip install -r requirements.txt;
|
||||
- name: Install Anvil
|
||||
run: cargo install --git https://github.com/foundry-rs/foundry --rev 62cdea8ff9e6efef011f77e295823b5f2dbeb3a1 --locked anvil --force
|
||||
run: cargo install --git https://github.com/foundry-rs/foundry --rev 56b806a3ba7866a3b061093bebd0fa2ace97f1fc --locked anvil --force
|
||||
- name: Build python ezkl
|
||||
run: source .env/bin/activate; unset CONDA_PREFIX; maturin develop --features python-bindings --profile=test-runs
|
||||
run: source .env/bin/activate; unset CONDA_PREFIX; maturin develop --features python-bindings,reusable-verifier --profile=test-runs
|
||||
- name: Run pytest
|
||||
run: source .env/bin/activate; pip install pytest-asyncio; pytest -vv
|
||||
|
||||
accuracy-measurement-tests:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: non-gpu
|
||||
runs-on: non-gpu,non-sgx
|
||||
needs: [build, library-tests, docs, python-tests, python-integration-tests]
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
|
||||
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -1039,7 +770,7 @@ jobs:
|
||||
- name: Setup Virtual Env and Install python dependencies
|
||||
run: python -m venv .env --clear; source .env/bin/activate; pip install -r requirements.txt;
|
||||
- name: Build python ezkl
|
||||
run: source .env/bin/activate; unset CONDA_PREFIX; maturin develop --features python-bindings --profile=test-runs
|
||||
run: source .env/bin/activate; unset CONDA_PREFIX; maturin develop --features python-bindings,reusable-verifier --profile=test-runs
|
||||
- name: Public inputs
|
||||
run: source .env/bin/activate; cargo nextest run --verbose tests::accuracy_measurement_public_inputs_
|
||||
- name: fixed params
|
||||
@@ -1055,35 +786,19 @@ jobs:
|
||||
runs-on: large-self-hosted
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
|
||||
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -1093,13 +808,13 @@ jobs:
|
||||
# - name: Install solc
|
||||
# run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.20 && solc --version
|
||||
- name: Install Anvil
|
||||
run: cargo install --git https://github.com/foundry-rs/foundry --rev 62cdea8ff9e6efef011f77e295823b5f2dbeb3a1 --locked anvil --force
|
||||
run: cargo install --git https://github.com/foundry-rs/foundry --rev 56b806a3ba7866a3b061093bebd0fa2ace97f1fc --locked anvil --force
|
||||
- name: Install pip
|
||||
run: python -m ensurepip --upgrade
|
||||
- name: Setup Virtual Env and Install python dependencies
|
||||
run: python -m venv .env --clear; source .env/bin/activate; pip install -r requirements.txt; python -m ensurepip --upgrade
|
||||
- name: Build python ezkl
|
||||
run: source .env/bin/activate; unset CONDA_PREFIX; maturin develop --features python-bindings --profile=test-runs
|
||||
run: source .env/bin/activate; unset CONDA_PREFIX; maturin develop --features python-bindings,reusable-verifier --profile=test-runs
|
||||
- name: Cat and Dog notebook
|
||||
run: source .env/bin/activate; cargo nextest run py_tests::tests::cat_and_dog_notebook_
|
||||
- name: All notebooks
|
||||
@@ -1134,32 +849,16 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
|
||||
@@ -1167,7 +866,7 @@ jobs:
|
||||
crate: cargo-nextest
|
||||
locked: true
|
||||
- name: Run ios tests
|
||||
run: CARGO_BUILD_TARGET=aarch64-apple-darwin RUSTUP_TOOLCHAIN=nightly-2025-02-17-aarch64-apple-darwin cargo test --test ios_integration_tests --features ios-bindings-test --no-default-features
|
||||
run: CARGO_BUILD_TARGET=aarch64-apple-darwin RUSTUP_TOOLCHAIN=nightly-2025-06-16-aarch64-apple-darwin cargo test --test ios_integration_tests --features ios-bindings-test --no-default-features
|
||||
|
||||
swift-package-tests:
|
||||
permissions:
|
||||
@@ -1177,32 +876,15 @@ jobs:
|
||||
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Git credentials
|
||||
run: |
|
||||
if [ -z "$EVM_VERIFIER_EZKL_TOKEN" ]; then
|
||||
echo "❌ EVM_VERIFIER_EZKL_TOKEN is empty – check repo/org secrets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For libgit2 (what Cargo uses internally)
|
||||
git config --global credential.helper store
|
||||
echo "https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com" > ~/.git-credentials
|
||||
chmod 600 ~/.git-credentials
|
||||
|
||||
# Also set URL replacement with oauth2 format
|
||||
git config --global \
|
||||
url."https://oauth2:${EVM_VERIFIER_EZKL_TOKEN}@github.com/".insteadOf \
|
||||
"https://github.com/"
|
||||
env:
|
||||
EVM_VERIFIER_EZKL_TOKEN: ${{ secrets.EVM_VERIFIER_EZKL_TOKEN }}
|
||||
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- name: Build EzklCoreBindings
|
||||
|
||||
2
.github/workflows/static-analysis.yml
vendored
2
.github/workflows/static-analysis.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6
|
||||
with:
|
||||
toolchain: nightly-2025-02-17
|
||||
toolchain: nightly-2025-06-16
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
|
||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -2585,7 +2585,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "halo2_solidity_verifier"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/zkonduit/ezkl-verifier?branch=main#ff30972bf729d046f0c903ad91703af1a9e33a8f"
|
||||
source = "git+https://github.com/zkonduit/ezkl-verifier?branch=main#a518a917f076adb851a1ae39e09527f8dbde5000"
|
||||
dependencies = [
|
||||
"askama",
|
||||
"blake2b_simd",
|
||||
|
||||
@@ -281,6 +281,7 @@ macos-metal = ["halo2_proofs/macos"]
|
||||
ios-metal = ["halo2_proofs/ios"]
|
||||
jemalloc = ["dep:jemallocator"]
|
||||
mimalloc = ["dep:mimalloc"]
|
||||
reusable-verifier = []
|
||||
|
||||
|
||||
[patch.crates-io]
|
||||
|
||||
@@ -1,312 +0,0 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_contractAddresses",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "_callData",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "_decimals",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "_bits",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "_instanceOffset",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "HALF_ORDER",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ORDER",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "instances",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"name": "attestData",
|
||||
"outputs": [],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "callData",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "contractAddress",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "encoded",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "getInstancesCalldata",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "instances",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "encoded",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "getInstancesMemory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "instances",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "index",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getScalars",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "decimals",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bits",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct DataAttestation.Scalars",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "instanceOffset",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "x",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "y",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "denominator",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "mulDiv",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "result",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int256",
|
||||
"name": "x",
|
||||
"type": "int256"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "decimals",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bits",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct DataAttestation.Scalars",
|
||||
"name": "_scalars",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"name": "quantizeData",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int256",
|
||||
"name": "quantized_data",
|
||||
"type": "int256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "staticCall",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int256",
|
||||
"name": "x",
|
||||
"type": "int256"
|
||||
}
|
||||
],
|
||||
"name": "toFieldElement",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "field_element",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "verifier",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "encoded",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "verifyWithDataAttestation",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -1,98 +0,0 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int256[]",
|
||||
"name": "quantized_data",
|
||||
"type": "int256[]"
|
||||
}
|
||||
],
|
||||
"name": "check_is_valid_field_element",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "output",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes[]",
|
||||
"name": "data",
|
||||
"type": "bytes[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "decimals",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "scales",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"name": "quantize_data_multi",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int256[]",
|
||||
"name": "quantized_data",
|
||||
"type": "int256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "decimals",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "scales",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"name": "quantize_data_single",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int256[]",
|
||||
"name": "quantized_data",
|
||||
"type": "int256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int64[]",
|
||||
"name": "quantized_data",
|
||||
"type": "int64[]"
|
||||
}
|
||||
],
|
||||
"name": "to_field_element",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "output",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -1,32 +0,0 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int256[]",
|
||||
"name": "_numbers",
|
||||
"type": "int256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "arr",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int256",
|
||||
"name": "",
|
||||
"type": "int256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -9,6 +9,6 @@ pytest==8.1.1
|
||||
tomli==2.0.1
|
||||
typing-extensions==4.10.0
|
||||
zipp==3.18.1
|
||||
onnx==1.15.0
|
||||
onnx==1.17.0
|
||||
onnxruntime==1.17.1
|
||||
numpy==1.26.4
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2025-02-17"
|
||||
channel = "nightly-2025-06-16"
|
||||
components = ["rustfmt", "clippy"]
|
||||
|
||||
@@ -93,16 +93,6 @@ impl From<PyG1> for G1 {
|
||||
}
|
||||
}
|
||||
|
||||
impl pyo3::ToPyObject for PyG1 {
|
||||
fn to_object(&self, py: pyo3::Python) -> pyo3::PyObject {
|
||||
let g1_dict = pyo3::types::PyDict::new(py);
|
||||
|
||||
g1_dict.set_item("x", self.x.to_object(py)).unwrap();
|
||||
g1_dict.set_item("y", self.y.to_object(py)).unwrap();
|
||||
g1_dict.set_item("z", self.z.to_object(py)).unwrap();
|
||||
g1_dict.into()
|
||||
}
|
||||
}
|
||||
|
||||
/// pyclass containing the struct used for G1
|
||||
#[pyclass]
|
||||
@@ -135,15 +125,6 @@ impl From<PyG1Affine> for G1Affine {
|
||||
}
|
||||
}
|
||||
|
||||
impl pyo3::ToPyObject for PyG1Affine {
|
||||
fn to_object(&self, py: pyo3::Python) -> pyo3::PyObject {
|
||||
let g1_dict = pyo3::types::PyDict::new(py);
|
||||
|
||||
g1_dict.set_item("x", self.x.to_object(py)).unwrap();
|
||||
g1_dict.set_item("y", self.y.to_object(py)).unwrap();
|
||||
g1_dict.into()
|
||||
}
|
||||
}
|
||||
|
||||
/// Python class containing the struct used for run_args
|
||||
///
|
||||
@@ -884,7 +865,7 @@ fn gen_srs(srs_path: PathBuf, logrows: usize) -> PyResult<()> {
|
||||
))]
|
||||
#[gen_stub_pyfunction]
|
||||
fn get_srs(
|
||||
py: Python,
|
||||
py: Python<'_>,
|
||||
settings_path: Option<PathBuf>,
|
||||
logrows: Option<u32>,
|
||||
srs_path: Option<PathBuf>,
|
||||
@@ -1101,7 +1082,7 @@ fn gen_witness(
|
||||
let err_str = format!("Failed to generate witness: {}", e);
|
||||
PyRuntimeError::new_err(err_str)
|
||||
})?;
|
||||
Python::with_gil(|py| Ok(output.to_object(py)))
|
||||
Python::with_gil(|py| Ok(output.into_pyobject(py).unwrap().into()))
|
||||
}
|
||||
|
||||
/// Mocks the prover
|
||||
@@ -1283,7 +1264,7 @@ fn prove(
|
||||
PyRuntimeError::new_err(err_str)
|
||||
})?;
|
||||
|
||||
Python::with_gil(|py| Ok(snark.to_object(py)))
|
||||
Python::with_gil(|py| Ok(snark.into_pyobject(py).unwrap().into()))
|
||||
}
|
||||
|
||||
/// Verifies a given proof
|
||||
@@ -1649,7 +1630,7 @@ fn encode_evm_calldata<'a>(
|
||||
))]
|
||||
#[gen_stub_pyfunction]
|
||||
fn create_evm_verifier(
|
||||
py: Python,
|
||||
py: Python<'_>,
|
||||
vk_path: PathBuf,
|
||||
settings_path: PathBuf,
|
||||
sol_code_path: PathBuf,
|
||||
@@ -1676,6 +1657,7 @@ fn create_evm_verifier(
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "reusable-verifier")]
|
||||
/// Creates an Evm VK artifact. This command generated a VK with circuit specific meta data encoding in memory for use by the reusable H2 verifier.
|
||||
/// This is useful for deploying verifier that were otherwise too big to fit on chain and required aggregation.
|
||||
///
|
||||
@@ -1709,7 +1691,7 @@ fn create_evm_verifier(
|
||||
))]
|
||||
#[gen_stub_pyfunction]
|
||||
fn create_evm_vka(
|
||||
py: Python,
|
||||
py: Python<'_>,
|
||||
vk_path: PathBuf,
|
||||
settings_path: PathBuf,
|
||||
vka_path: PathBuf,
|
||||
@@ -1739,7 +1721,7 @@ fn create_evm_vka(
|
||||
))]
|
||||
#[gen_stub_pyfunction]
|
||||
fn deploy_evm(
|
||||
py: Python,
|
||||
py: Python<'_>,
|
||||
addr_path: PathBuf,
|
||||
rpc_url: String,
|
||||
sol_code_path: PathBuf,
|
||||
@@ -1766,6 +1748,7 @@ fn deploy_evm(
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "reusable-verifier")]
|
||||
/// Registers a VKA on the EZKL reusable verifier contract
|
||||
///
|
||||
/// Arguments
|
||||
@@ -1922,7 +1905,7 @@ fn verify_evm<'a>(
|
||||
))]
|
||||
#[gen_stub_pyfunction]
|
||||
fn create_evm_verifier_aggr(
|
||||
py: Python,
|
||||
py: Python<'_>,
|
||||
aggregation_settings: Vec<PathBuf>,
|
||||
vk_path: PathBuf,
|
||||
sol_code_path: PathBuf,
|
||||
@@ -1993,11 +1976,13 @@ fn ezkl(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
m.add_function(wrap_pyfunction!(compile_circuit, m)?)?;
|
||||
m.add_function(wrap_pyfunction!(verify_aggr, m)?)?;
|
||||
m.add_function(wrap_pyfunction!(create_evm_verifier, m)?)?;
|
||||
#[cfg(feature = "reusable-verifier")]
|
||||
m.add_function(wrap_pyfunction!(create_evm_vka, m)?)?;
|
||||
m.add_function(wrap_pyfunction!(deploy_evm, m)?)?;
|
||||
m.add_function(wrap_pyfunction!(verify_evm, m)?)?;
|
||||
m.add_function(wrap_pyfunction!(create_evm_verifier_aggr, m)?)?;
|
||||
m.add_function(wrap_pyfunction!(encode_evm_calldata, m)?)?;
|
||||
#[cfg(feature = "reusable-verifier")]
|
||||
m.add_function(wrap_pyfunction!(register_vka, m)?)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -8,8 +8,9 @@ use halo2_proofs::{
|
||||
use log::debug;
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use pyo3::{
|
||||
conversion::{FromPyObject, IntoPy},
|
||||
conversion::FromPyObject,
|
||||
exceptions::PyValueError,
|
||||
IntoPyObject,
|
||||
prelude::*,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -86,12 +87,17 @@ impl CheckMode {
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
/// Converts CheckMode into a PyObject (Required for CheckMode to be compatible with Python)
|
||||
impl IntoPy<PyObject> for CheckMode {
|
||||
fn into_py(self, py: Python) -> PyObject {
|
||||
match self {
|
||||
CheckMode::SAFE => "safe".to_object(py),
|
||||
CheckMode::UNSAFE => "unsafe".to_object(py),
|
||||
}
|
||||
impl<'py> IntoPyObject<'py> for CheckMode {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
let result = match self {
|
||||
CheckMode::SAFE => "safe",
|
||||
CheckMode::UNSAFE => "unsafe",
|
||||
};
|
||||
Ok(result.into_pyobject(py)?.into_any())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4626,7 +4626,7 @@ pub(crate) fn rescale<F: PrimeField + TensorType + PartialOrd + std::hash::Hash>
|
||||
let mut rescaled_inputs = vec![];
|
||||
for (i, ri) in values.iter().enumerate() {
|
||||
if scales[i].1 == 1 {
|
||||
rescaled_inputs.push(ri.clone().clone());
|
||||
rescaled_inputs.push((*ri).clone());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,12 +93,17 @@ pub const DEFAULT_VKA_DIGEST: &str = "vka.digest";
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
/// Converts TranscriptType into a PyObject (Required for TranscriptType to be compatible with Python)
|
||||
impl IntoPy<PyObject> for TranscriptType {
|
||||
fn into_py(self, py: Python) -> PyObject {
|
||||
match self {
|
||||
TranscriptType::Poseidon => "poseidon".to_object(py),
|
||||
TranscriptType::EVM => "evm".to_object(py),
|
||||
}
|
||||
impl<'py> IntoPyObject<'py> for TranscriptType {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
let result = match self {
|
||||
TranscriptType::Poseidon => "poseidon",
|
||||
TranscriptType::EVM => "evm",
|
||||
};
|
||||
Ok(result.into_pyobject(py)?.into_any())
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "python-bindings")]
|
||||
@@ -257,17 +262,22 @@ impl From<&str> for H160Flag {
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
/// Converts CalibrationTarget into a PyObject (Required for CalibrationTarget to be compatible with Python)
|
||||
impl IntoPy<PyObject> for CalibrationTarget {
|
||||
fn into_py(self, py: Python) -> PyObject {
|
||||
match self {
|
||||
impl<'py> IntoPyObject<'py> for CalibrationTarget {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
let result = match self {
|
||||
CalibrationTarget::Resources { col_overflow: true } => {
|
||||
"resources/col-overflow".to_object(py)
|
||||
"resources/col-overflow"
|
||||
}
|
||||
CalibrationTarget::Resources {
|
||||
col_overflow: false,
|
||||
} => "resources".to_object(py),
|
||||
CalibrationTarget::Accuracy => "accuracy".to_object(py),
|
||||
}
|
||||
} => "resources",
|
||||
CalibrationTarget::Accuracy => "accuracy",
|
||||
};
|
||||
Ok(result.into_pyobject(py)?.into_any())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,12 +299,17 @@ impl<'source> FromPyObject<'source> for CalibrationTarget {
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
/// Converts ContractType into a PyObject (Required for ContractType to be compatible with Python)
|
||||
impl IntoPy<PyObject> for ContractType {
|
||||
fn into_py(self, py: Python) -> PyObject {
|
||||
match self {
|
||||
ContractType::Verifier { reusable: true } => "verifier/reusable".to_object(py),
|
||||
ContractType::Verifier { reusable: false } => "verifier".to_object(py),
|
||||
}
|
||||
impl<'py> IntoPyObject<'py> for ContractType {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
let result = match self {
|
||||
ContractType::Verifier { reusable: true } => "verifier/reusable",
|
||||
ContractType::Verifier { reusable: false } => "verifier",
|
||||
};
|
||||
Ok(result.into_pyobject(py)?.into_any())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,7 +728,7 @@ pub enum Commands {
|
||||
#[arg(long, default_value = DEFAULT_CALLDATA, value_hint = clap::ValueHint::FilePath)]
|
||||
calldata_path: Option<PathBuf>,
|
||||
/// The path to the serialized VKA file
|
||||
#[arg(long, value_hint = clap::ValueHint::Other)]
|
||||
#[cfg_attr(all(feature = "reusable-verifier", not(target_arch = "wasm32")), arg(long, value_hint = clap::ValueHint::Other))]
|
||||
vka_path: Option<PathBuf>,
|
||||
},
|
||||
/// Creates an Evm verifier for a single proof
|
||||
@@ -735,13 +750,17 @@ pub enum Commands {
|
||||
/// The path to output the Solidity verifier ABI
|
||||
#[arg(long, default_value = DEFAULT_VERIFIER_ABI, value_hint = clap::ValueHint::FilePath)]
|
||||
abi_path: Option<PathBuf>,
|
||||
/// Whether the to render the verifier as reusable or not. If true, you will need to deploy a VK artifact, passing it as part of the calldata to the verifier.
|
||||
#[arg(long, default_value = DEFAULT_RENDER_REUSABLE, action = clap::ArgAction::SetTrue)]
|
||||
/// Whether to render the verifier as reusable or not. If true, you will need to deploy a VK artifact, passing it as part of the calldata to the verifier.
|
||||
#[cfg_attr(all(feature = "reusable-verifier", not(target_arch = "wasm32")), arg(short = 'R', long, default_value = DEFAULT_RENDER_REUSABLE, action = clap::ArgAction::SetTrue))]
|
||||
reusable: Option<bool>,
|
||||
},
|
||||
/// Creates an evm verifier artifact to be used by the reusable verifier
|
||||
#[command(name = "create-evm-vka")]
|
||||
#[cfg(all(feature = "eth", not(target_arch = "wasm32")))]
|
||||
#[cfg(all(
|
||||
feature = "eth",
|
||||
feature = "reusable-verifier",
|
||||
not(target_arch = "wasm32")
|
||||
))]
|
||||
CreateEvmVka {
|
||||
/// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs
|
||||
#[arg(long, value_hint = clap::ValueHint::FilePath)]
|
||||
@@ -783,8 +802,8 @@ pub enum Commands {
|
||||
// logrows used for aggregation circuit
|
||||
#[arg(long, default_value = DEFAULT_AGGREGATED_LOGROWS, value_hint = clap::ValueHint::Other)]
|
||||
logrows: Option<u32>,
|
||||
/// Whether the to render the verifier as reusable or not. If true, you will need to deploy a VK artifact, passing it as part of the calldata to the verifier.
|
||||
#[arg(long, default_value = DEFAULT_RENDER_REUSABLE, action = clap::ArgAction::SetTrue)]
|
||||
/// Whether to render the verifier as reusable or not. If true, you will need to deploy a VK artifact, passing it as part of the calldata to the verifier.
|
||||
#[cfg_attr(all(feature = "reusable-verifier", not(target_arch = "wasm32")), arg(short = 'R', long, action = clap::ArgAction::SetTrue))]
|
||||
reusable: Option<bool>,
|
||||
},
|
||||
/// Verifies a proof, returning accept or reject
|
||||
@@ -845,6 +864,7 @@ pub enum Commands {
|
||||
#[arg(short = 'P', long, value_hint = clap::ValueHint::Other)]
|
||||
private_key: Option<String>,
|
||||
/// Contract type to be deployed
|
||||
#[cfg(all(feature = "reusable-verifier", not(target_arch = "wasm32")))]
|
||||
#[arg(long = "contract-type", short = 'C', default_value = DEFAULT_CONTRACT_DEPLOYMENT_TYPE, value_hint = clap::ValueHint::Other)]
|
||||
contract: ContractType,
|
||||
},
|
||||
@@ -862,7 +882,7 @@ pub enum Commands {
|
||||
#[arg(short = 'U', long, value_hint = clap::ValueHint::Url)]
|
||||
rpc_url: String,
|
||||
/// The path to the serialized vka file
|
||||
#[arg(long, value_hint = clap::ValueHint::FilePath)]
|
||||
#[cfg_attr(all(feature = "reusable-verifier", not(target_arch = "wasm32")), arg(long, value_hint = clap::ValueHint::FilePath))]
|
||||
vka_path: Option<PathBuf>,
|
||||
/// The path to the serialized encoded calldata file generated via the encode_calldata command
|
||||
#[arg(long, value_hint = clap::ValueHint::FilePath)]
|
||||
@@ -870,7 +890,7 @@ pub enum Commands {
|
||||
},
|
||||
/// Registers a VKA, returning the its digest used to identify it on-chain.
|
||||
#[command(name = "register-vka")]
|
||||
#[cfg(all(feature = "eth", not(target_arch = "wasm32")))]
|
||||
#[cfg(feature = "reusable-verifier")]
|
||||
RegisterVka {
|
||||
/// RPC URL for an Ethereum node, if None will use Anvil but WON'T persist state
|
||||
#[arg(short = 'U', long, value_hint = clap::ValueHint::Url)]
|
||||
|
||||
94
src/eth.rs
94
src/eth.rs
@@ -3,7 +3,7 @@ use crate::pfsys::{encode_calldata, Snark};
|
||||
use alloy::contract::CallBuilder;
|
||||
use alloy::core::primitives::Address as H160;
|
||||
use alloy::core::primitives::Bytes;
|
||||
use alloy::core::primitives::U256;
|
||||
use alloy::core::primitives::I256;
|
||||
use alloy::dyn_abi::abi::TokenSeq;
|
||||
// use alloy::providers::Middleware;
|
||||
use alloy::json_abi::JsonAbi;
|
||||
@@ -279,7 +279,7 @@ pub async fn verify_proof_via_solidity(
|
||||
// From result[96..], iterate through 32 byte chunks converting them to U256
|
||||
let rescaled_instances = result.to_vec()[96..]
|
||||
.chunks_exact(32)
|
||||
.map(|chunk| U256::from_be_slice(chunk).to_string())
|
||||
.map(|chunk| I256::try_from_be_slice(chunk).unwrap().to_string())
|
||||
.collect::<Vec<_>>();
|
||||
if let Some(pretty) = &proof.pretty_public_inputs {
|
||||
// 1️⃣ collect reference decimals --------------------------------------
|
||||
@@ -433,43 +433,95 @@ pub async fn get_contract_artifacts(
|
||||
///
|
||||
/// `"1541748046875000000"` → `"1.541748046875000000"`
|
||||
/// `"273690402507781982"` → `"0.273690402507781982"`
|
||||
/// `"-892333984375000000"` → `"-0.892333984375000000"`
|
||||
fn to_decimal_18(s: &str) -> String {
|
||||
let is_negative = s.starts_with('-');
|
||||
let s = if is_negative { &s[1..] } else { s };
|
||||
let s = s.trim_start_matches('0');
|
||||
|
||||
if s.is_empty() {
|
||||
return "0".into();
|
||||
}
|
||||
|
||||
if s.len() <= 18 {
|
||||
// pad on the left so we always have exactly 18 fraction digits
|
||||
return format!("0.{:0>18}", s);
|
||||
let result = format!("0.{:0>18}", s);
|
||||
return if is_negative {
|
||||
format!("-{}", result)
|
||||
} else {
|
||||
result
|
||||
};
|
||||
}
|
||||
let split = s.len() - 18;
|
||||
format!("{}.{}", &s[..split], &s[split..]) // ← correct slice here
|
||||
}
|
||||
|
||||
/// “Banker’s‐round” comparison: compare the **decimal** produced
|
||||
let split = s.len() - 18;
|
||||
let result = format!("{}.{}", &s[..split], &s[split..]);
|
||||
if is_negative {
|
||||
format!("-{}", result)
|
||||
} else {
|
||||
result
|
||||
}
|
||||
}
|
||||
/// "Banker's‐round" comparison: compare the **decimal** produced
|
||||
/// by `instance` to the reference string `expected`.
|
||||
///
|
||||
/// * All digits present in `expected` (integer part **and** fraction)
|
||||
/// * Only the first 18 digits of the expected fraction part are compared.
|
||||
/// * All digits present in the truncated `expected` (integer part **and** first 18 fraction digits)
|
||||
/// must match exactly.
|
||||
/// * Excess digits in `instance` are ignored **unless** the very first
|
||||
/// excess digit ≥ 5; in that case we round the last compared digit
|
||||
/// excess digit ≥ 5; in that case we round the last compared digit
|
||||
/// and check again.
|
||||
fn scaled_matches(instance: &str, expected: &str) -> bool {
|
||||
let inst_dec = to_decimal_18(instance);
|
||||
let (inst_int, inst_frac) = inst_dec.split_once('.').unwrap_or((&inst_dec, ""));
|
||||
let (exp_int, exp_frac) = expected.split_once('.').unwrap_or((expected, ""));
|
||||
|
||||
// Normalize both integer parts to handle "-" vs "-0"
|
||||
let normalized_inst_int = if inst_int == "-" { "-0" } else { inst_int };
|
||||
let normalized_exp_int = if exp_int == "-" { "-0" } else { exp_int };
|
||||
|
||||
// integer part must be identical
|
||||
if inst_int != exp_int {
|
||||
if normalized_inst_int != normalized_exp_int {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If expected has more than 18 decimal places, round it to 18 places
|
||||
let exp_frac_truncated = if exp_frac.len() > 18 {
|
||||
let truncated = &exp_frac[..18];
|
||||
let next_digit = exp_frac.chars().nth(18).unwrap_or('0');
|
||||
|
||||
if next_digit >= '6' {
|
||||
// Need to round up the 18th digit
|
||||
let mut rounded = truncated.chars().collect::<Vec<_>>();
|
||||
let mut carry = true;
|
||||
for d in rounded.iter_mut().rev() {
|
||||
if !carry {
|
||||
break;
|
||||
}
|
||||
let v = d.to_digit(10).unwrap() + 1;
|
||||
*d = char::from_digit(v % 10, 10).unwrap();
|
||||
carry = v == 10;
|
||||
}
|
||||
if carry {
|
||||
// All 18 digits were 9s - this would carry to integer part
|
||||
// For now, return the original truncated (this edge case may need special handling)
|
||||
truncated.to_string()
|
||||
} else {
|
||||
rounded.into_iter().collect::<String>()
|
||||
}
|
||||
} else {
|
||||
truncated.to_string()
|
||||
}
|
||||
} else {
|
||||
exp_frac.to_string()
|
||||
};
|
||||
let exp_frac_truncated = exp_frac_truncated.as_str();
|
||||
|
||||
// fraction‑part comparison with optional rounding
|
||||
let cmp_len = exp_frac.len();
|
||||
let cmp_len = exp_frac_truncated.len();
|
||||
let inst_cmp = &inst_frac[..cmp_len.min(inst_frac.len())];
|
||||
let trailing = inst_frac.chars().nth(cmp_len).unwrap_or('0');
|
||||
|
||||
if inst_cmp == exp_frac {
|
||||
if inst_cmp == exp_frac_truncated {
|
||||
true // exact match
|
||||
} else if trailing >= '5' {
|
||||
// need to round
|
||||
@@ -486,12 +538,20 @@ fn scaled_matches(instance: &str, expected: &str) -> bool {
|
||||
}
|
||||
if carry {
|
||||
// 0.999… → 1.000…
|
||||
return exp_int
|
||||
== &(num::BigUint::parse_bytes(exp_int.as_bytes(), 10).unwrap() + 1u32)
|
||||
.to_string()
|
||||
&& exp_frac.chars().all(|c| c == '0');
|
||||
// Handle negative numbers in the carry case
|
||||
let is_negative = normalized_inst_int.starts_with('-');
|
||||
let abs_int = normalized_inst_int.trim_start_matches('-');
|
||||
let incremented =
|
||||
(num::BigUint::parse_bytes(abs_int.as_bytes(), 10).unwrap() + 1u32).to_string();
|
||||
let expected_after_carry = if is_negative {
|
||||
format!("-{}", incremented)
|
||||
} else {
|
||||
incremented
|
||||
};
|
||||
return normalized_exp_int == expected_after_carry
|
||||
&& exp_frac_truncated.chars().all(|c| c == '0');
|
||||
}
|
||||
rounded.into_iter().collect::<String>() == exp_frac
|
||||
rounded.into_iter().collect::<String>() == exp_frac_truncated
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ use crate::circuit::region::RegionSettings;
|
||||
use crate::circuit::CheckMode;
|
||||
use crate::commands::CalibrationTarget;
|
||||
#[cfg(all(feature = "eth", not(target_arch = "wasm32")))]
|
||||
use crate::eth::{deploy_contract_via_solidity, register_vka_via_rv};
|
||||
use crate::eth::deploy_contract_via_solidity;
|
||||
#[cfg(all(feature = "reusable-verifier", not(target_arch = "wasm32")))]
|
||||
use crate::eth::register_vka_via_rv;
|
||||
#[allow(unused_imports)]
|
||||
#[cfg(all(feature = "eth", not(target_arch = "wasm32")))]
|
||||
use crate::eth::{get_contract_artifacts, verify_proof_via_solidity};
|
||||
@@ -220,7 +222,11 @@ pub async fn run(command: Commands) -> Result<String, EZKLError> {
|
||||
vka_path,
|
||||
)
|
||||
.map(|e| serde_json::to_string(&e).unwrap()),
|
||||
#[cfg(all(feature = "eth", not(target_arch = "wasm32")))]
|
||||
#[cfg(all(
|
||||
feature = "eth",
|
||||
feature = "reusable-verifier",
|
||||
not(target_arch = "wasm32")
|
||||
))]
|
||||
Commands::CreateEvmVka {
|
||||
vk_path,
|
||||
srs_path,
|
||||
@@ -398,6 +404,7 @@ pub async fn run(command: Commands) -> Result<String, EZKLError> {
|
||||
addr_path,
|
||||
optimizer_runs,
|
||||
private_key,
|
||||
#[cfg(all(feature = "reusable-verifier", not(target_arch = "wasm32")))]
|
||||
contract,
|
||||
} => {
|
||||
deploy_evm(
|
||||
@@ -406,7 +413,10 @@ pub async fn run(command: Commands) -> Result<String, EZKLError> {
|
||||
addr_path.unwrap_or(DEFAULT_CONTRACT_ADDRESS.into()),
|
||||
optimizer_runs,
|
||||
private_key,
|
||||
#[cfg(all(feature = "reusable-verifier", not(target_arch = "wasm32")))]
|
||||
contract,
|
||||
#[cfg(not(all(feature = "reusable-verifier", not(target_arch = "wasm32"))))]
|
||||
ContractType::default(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -427,7 +437,7 @@ pub async fn run(command: Commands) -> Result<String, EZKLError> {
|
||||
)
|
||||
.await
|
||||
}
|
||||
#[cfg(all(feature = "eth", not(target_arch = "wasm32")))]
|
||||
#[cfg(feature = "reusable-verifier")]
|
||||
Commands::RegisterVka {
|
||||
addr_verifier,
|
||||
vka_path,
|
||||
@@ -1111,6 +1121,7 @@ pub(crate) fn calibrate(
|
||||
|
||||
let mut num_failed = 0;
|
||||
let mut num_passed = 0;
|
||||
let mut failure_reasons = vec![];
|
||||
|
||||
for ((input_scale, param_scale), scale_rebase_multiplier) in range_grid {
|
||||
pb.set_message(format!(
|
||||
@@ -1143,6 +1154,13 @@ pub(crate) fn calibrate(
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
error!("circuit creation from run args failed: {:?}", e);
|
||||
failure_reasons.push(format!(
|
||||
"i-scale: {}, p-scale: {}, rebase-(x): {}, reason: {}",
|
||||
input_scale.to_string().blue(),
|
||||
param_scale.to_string().blue(),
|
||||
scale_rebase_multiplier.to_string().yellow(),
|
||||
e
|
||||
));
|
||||
pb.inc(1);
|
||||
num_failed += 1;
|
||||
continue;
|
||||
@@ -1187,6 +1205,13 @@ pub(crate) fn calibrate(
|
||||
error!("forward pass failed: {:?}", e);
|
||||
pb.inc(1);
|
||||
num_failed += 1;
|
||||
failure_reasons.push(format!(
|
||||
"i-scale: {}, p-scale: {}, rebase-(x): {}, reason: {}",
|
||||
input_scale.to_string().blue(),
|
||||
param_scale.to_string().blue(),
|
||||
scale_rebase_multiplier.to_string().yellow(),
|
||||
e
|
||||
));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1241,7 +1266,8 @@ pub(crate) fn calibrate(
|
||||
num_rows: new_settings.num_rows,
|
||||
total_assignments: new_settings.total_assignments,
|
||||
total_const_size: new_settings.total_const_size,
|
||||
total_dynamic_col_size: new_settings.total_dynamic_col_size,
|
||||
dynamic_lookup_params: new_settings.dynamic_lookup_params,
|
||||
shuffle_params: new_settings.shuffle_params,
|
||||
..settings.clone()
|
||||
};
|
||||
|
||||
@@ -1252,7 +1278,14 @@ pub(crate) fn calibrate(
|
||||
found_settings.as_json()?.to_colored_json_auto()?
|
||||
);
|
||||
num_passed += 1;
|
||||
} else {
|
||||
} else if let Err(res) = res {
|
||||
failure_reasons.push(format!(
|
||||
"i-scale: {}, p-scale: {}, rebase-(x): {}, reason: {}",
|
||||
input_scale.to_string().blue(),
|
||||
param_scale.to_string().blue(),
|
||||
scale_rebase_multiplier.to_string().yellow(),
|
||||
res.to_string().red()
|
||||
));
|
||||
num_failed += 1;
|
||||
}
|
||||
|
||||
@@ -1262,6 +1295,13 @@ pub(crate) fn calibrate(
|
||||
pb.finish_with_message("Calibration Done.");
|
||||
|
||||
if found_params.is_empty() {
|
||||
if !failure_reasons.is_empty() {
|
||||
error!("Calibration failed for the following reasons:");
|
||||
for reason in failure_reasons {
|
||||
error!("{}", reason);
|
||||
}
|
||||
}
|
||||
|
||||
return Err("calibration failed, could not find any suitable parameters given the calibration dataset".into());
|
||||
}
|
||||
|
||||
@@ -1460,7 +1500,7 @@ pub(crate) async fn create_evm_verifier(
|
||||
Ok(String::new())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "eth", not(target_arch = "wasm32")))]
|
||||
#[cfg(feature = "reusable-verifier")]
|
||||
pub(crate) async fn create_evm_vka(
|
||||
vk_path: PathBuf,
|
||||
srs_path: Option<PathBuf>,
|
||||
@@ -1468,6 +1508,7 @@ pub(crate) async fn create_evm_vka(
|
||||
vka_path: PathBuf,
|
||||
decimals: usize,
|
||||
) -> Result<String, EZKLError> {
|
||||
log::warn!("Reusable verifier support is experimental and may change in the future. Use at your own risk.");
|
||||
let settings = GraphSettings::load(&settings_path)?;
|
||||
let commitment: Commitments = settings.run_args.commitment.into();
|
||||
let params = load_params_verifier::<KZGCommitmentScheme<Bn256>>(
|
||||
@@ -1550,7 +1591,7 @@ pub(crate) async fn deploy_evm(
|
||||
Ok(String::new())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "eth", not(target_arch = "wasm32")))]
|
||||
#[cfg(all(feature = "reusable-verifier", not(target_arch = "wasm32")))]
|
||||
pub(crate) async fn register_vka(
|
||||
rpc_url: String,
|
||||
rv_addr: H160Flag,
|
||||
@@ -1558,6 +1599,7 @@ pub(crate) async fn register_vka(
|
||||
vka_digest_path: PathBuf,
|
||||
private_key: Option<String>,
|
||||
) -> Result<String, EZKLError> {
|
||||
log::warn!("Reusable verifier support is experimental and may change in the future. Use at your own risk.");
|
||||
// Load the vka, which is bincode serialized, from the vka_path
|
||||
let bytes = std::fs::read(vka_path)?;
|
||||
let vka_buf: Vec<[u8; 32]> = bincode::deserialize(&bytes)
|
||||
|
||||
@@ -7,9 +7,7 @@ use halo2curves::bn256::Fr as Fp;
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use pyo3::prelude::*;
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use pyo3::types::PyDict;
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use pyo3::ToPyObject;
|
||||
use pyo3::IntoPyObject;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use std::io::BufReader;
|
||||
use std::io::BufWriter;
|
||||
@@ -21,10 +19,6 @@ use tract_onnx::tract_core::{
|
||||
value::TValue,
|
||||
};
|
||||
|
||||
type Decimals = u8;
|
||||
type Call = String;
|
||||
type RPCUrl = String;
|
||||
|
||||
/// Represents different types of values that can be stored in a file source
|
||||
/// Used for handling various input types in zero-knowledge proofs
|
||||
#[derive(Clone, Debug, PartialOrd, PartialEq)]
|
||||
@@ -37,6 +31,22 @@ pub enum FileSourceInner {
|
||||
Field(Fp),
|
||||
}
|
||||
|
||||
impl From<Fp> for FileSourceInner {
|
||||
fn from(value: Fp) -> Self {
|
||||
FileSourceInner::Field(value)
|
||||
}
|
||||
}
|
||||
impl From<bool> for FileSourceInner {
|
||||
fn from(value: bool) -> Self {
|
||||
FileSourceInner::Bool(value)
|
||||
}
|
||||
}
|
||||
impl From<f64> for FileSourceInner {
|
||||
fn from(value: f64) -> Self {
|
||||
FileSourceInner::Float(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl FileSourceInner {
|
||||
/// Returns true if the value is a floating point number
|
||||
pub fn is_float(&self) -> bool {
|
||||
@@ -159,115 +169,11 @@ impl<'de> Deserialize<'de> for FileSourceInner {
|
||||
|
||||
/// A collection of input values from a file source
|
||||
/// Organized as a vector of vectors where each inner vector represents a row/entry
|
||||
pub type FileSource = Vec<Vec<FileSourceInner>>;
|
||||
pub type DataSource = Vec<Vec<FileSourceInner>>;
|
||||
|
||||
/// Represents which parts of the model (input/output) are attested to on-chain
|
||||
pub type InputOutput = (bool, bool);
|
||||
|
||||
/// Configuration for accessing on-chain data sources
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialOrd, PartialEq)]
|
||||
pub struct OnChainSource {
|
||||
/// Call specifications for fetching data
|
||||
pub call: CallToAccount,
|
||||
/// RPC endpoint URL for accessing the chain
|
||||
pub rpc: RPCUrl,
|
||||
}
|
||||
|
||||
impl OnChainSource {
|
||||
/// Creates a new OnChainSource
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `call` - Call specification
|
||||
/// * `rpc` - RPC endpoint URL
|
||||
pub fn new(call: CallToAccount, rpc: RPCUrl) -> Self {
|
||||
OnChainSource { call, rpc }
|
||||
}
|
||||
}
|
||||
|
||||
/// Specification for view-only calls to fetch on-chain data
|
||||
/// Used for data attestation in smart contract verification
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialOrd, PartialEq)]
|
||||
pub struct CallsToAccount {
|
||||
/// Vector of (call data, decimals) pairs
|
||||
/// call_data: ABI-encoded function call
|
||||
/// decimals: Number of decimal places for float conversion
|
||||
pub call_data: Vec<(Call, Decimals)>,
|
||||
/// Contract address to call
|
||||
pub address: String,
|
||||
}
|
||||
|
||||
/// Specification for a single view-only call returning an array
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialOrd, PartialEq)]
|
||||
pub struct CallToAccount {
|
||||
/// ABI-encoded function call data
|
||||
pub call_data: Call,
|
||||
/// Number of decimal places for float conversion
|
||||
pub decimals: Vec<Decimals>,
|
||||
/// Contract address to call
|
||||
pub address: String,
|
||||
}
|
||||
|
||||
/// Represents different sources of input/output data for the EZKL model
|
||||
#[derive(Clone, Debug, Serialize, PartialOrd, PartialEq)]
|
||||
pub struct DataSource(FileSource);
|
||||
|
||||
impl DataSource {
|
||||
/// Gets the underlying file source data
|
||||
pub fn values(&self) -> &FileSource {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DataSource {
|
||||
fn default() -> Self {
|
||||
DataSource(vec![vec![]])
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FileSource> for DataSource {
|
||||
fn from(data: FileSource) -> Self {
|
||||
DataSource(data)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec<Vec<Fp>>> for DataSource {
|
||||
fn from(data: Vec<Vec<Fp>>) -> Self {
|
||||
DataSource(
|
||||
data.iter()
|
||||
.map(|e| e.iter().map(|e| FileSourceInner::Field(*e)).collect())
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec<Vec<f64>>> for DataSource {
|
||||
fn from(data: Vec<Vec<f64>>) -> Self {
|
||||
DataSource(
|
||||
data.iter()
|
||||
.map(|e| e.iter().map(|e| FileSourceInner::Float(*e)).collect())
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Always use JSON serialization for untagged enums
|
||||
impl<'de> Deserialize<'de> for DataSource {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
let this_json: Box<serde_json::value::RawValue> = Deserialize::deserialize(deserializer)?;
|
||||
|
||||
// Try deserializing as FileSource first
|
||||
let first_try: Result<FileSource, _> = serde_json::from_str(this_json.get());
|
||||
if let Ok(t) = first_try {
|
||||
return Ok(DataSource(t));
|
||||
}
|
||||
|
||||
Err(serde::de::Error::custom("failed to deserialize DataSource"))
|
||||
}
|
||||
}
|
||||
|
||||
/// Container for input and output data for graph computations
|
||||
///
|
||||
/// Important: Always use JSON serialization for GraphData to handle enum variants correctly
|
||||
@@ -297,7 +203,7 @@ impl GraphData {
|
||||
datum_types: &[tract_onnx::prelude::DatumType],
|
||||
) -> Result<TVec<TValue>, GraphError> {
|
||||
let mut inputs = TVec::new();
|
||||
for (i, input) in self.input_data.values().iter().enumerate() {
|
||||
for (i, input) in self.input_data.iter().enumerate() {
|
||||
if !input.is_empty() {
|
||||
let dt = datum_types[i];
|
||||
let input = input.iter().map(|e| e.to_float()).collect::<Vec<f64>>();
|
||||
@@ -338,7 +244,7 @@ impl GraphData {
|
||||
}
|
||||
}
|
||||
Ok(GraphData {
|
||||
input_data: DataSource(input_data),
|
||||
input_data,
|
||||
output_data: None,
|
||||
})
|
||||
}
|
||||
@@ -424,12 +330,7 @@ impl GraphData {
|
||||
) -> Result<Vec<Self>, GraphError> {
|
||||
let mut batched_inputs = vec![];
|
||||
|
||||
let iterable = match self {
|
||||
GraphData {
|
||||
input_data: DataSource(data),
|
||||
output_data: _,
|
||||
} => data.clone(),
|
||||
};
|
||||
let iterable = self.input_data.clone();
|
||||
|
||||
// Process each input tensor according to its shape
|
||||
for (i, shape) in input_shapes.iter().enumerate() {
|
||||
@@ -474,12 +375,12 @@ impl GraphData {
|
||||
for input in batched_inputs.iter() {
|
||||
batch.push(input[i].clone());
|
||||
}
|
||||
input_batches.push(DataSource(batch));
|
||||
input_batches.push(batch);
|
||||
}
|
||||
|
||||
// Ensure at least one batch exists
|
||||
if input_batches.is_empty() {
|
||||
input_batches.push(DataSource(vec![vec![]]));
|
||||
input_batches.push(vec![vec![]]);
|
||||
}
|
||||
|
||||
// Create GraphData instance for each batch
|
||||
@@ -498,28 +399,14 @@ impl GraphData {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_data_source_serialization_round_trip() {
|
||||
// Test backwards compatibility with old format
|
||||
let source = DataSource::from(vec![vec![0.053_262_424, 0.074_970_566, 0.052_355_476]]);
|
||||
let serialized = serde_json::to_string(&source).unwrap();
|
||||
const JSON: &str = r#"[[0.053262424,0.074970566,0.052355476]]"#;
|
||||
assert_eq!(serialized, JSON);
|
||||
|
||||
let expect = serde_json::from_str::<DataSource>(JSON)
|
||||
.map_err(|e| e.to_string())
|
||||
.unwrap();
|
||||
assert_eq!(expect, source);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_graph_input_serialization_round_trip() {
|
||||
// Test serialization/deserialization of graph input
|
||||
let file = GraphData::new(DataSource::from(vec![vec![
|
||||
0.05326242372393608,
|
||||
0.07497056573629379,
|
||||
0.05235547572374344,
|
||||
]]));
|
||||
let file = GraphData::new(vec![vec![
|
||||
0.05326242372393608.into(),
|
||||
0.07497056573629379.into(),
|
||||
0.05235547572374344.into(),
|
||||
]]);
|
||||
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
const JSON: &str = r#"{"input_data":[[0.05326242372393608,0.07497056573629379,0.05235547572374344]],"output_data":null}"#;
|
||||
@@ -540,34 +427,29 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
impl ToPyObject for CallToAccount {
|
||||
fn to_object(&self, py: Python) -> PyObject {
|
||||
let dict = PyDict::new(py);
|
||||
dict.set_item("account", &self.address).unwrap();
|
||||
dict.set_item("call_data", &self.call_data).unwrap();
|
||||
dict.set_item("decimals", &self.decimals).unwrap();
|
||||
dict.to_object(py)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
impl ToPyObject for DataSource {
|
||||
fn to_object(&self, py: Python) -> PyObject {
|
||||
self.0.to_object(py)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use crate::pfsys::field_to_string;
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
impl ToPyObject for FileSourceInner {
|
||||
fn to_object(&self, py: Python) -> PyObject {
|
||||
impl<'py> IntoPyObject<'py> for FileSourceInner {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
match self {
|
||||
FileSourceInner::Field(data) => field_to_string(data).to_object(py),
|
||||
FileSourceInner::Bool(data) => data.to_object(py),
|
||||
FileSourceInner::Float(data) => data.to_object(py),
|
||||
FileSourceInner::Field(data) => {
|
||||
let s = field_to_string(&data);
|
||||
Ok(pyo3::types::PyString::new(py, &s).into_any())
|
||||
},
|
||||
FileSourceInner::Bool(data) => {
|
||||
Ok(pyo3::types::PyBool::new(py, data).as_any().clone())
|
||||
},
|
||||
FileSourceInner::Float(data) => {
|
||||
Ok(pyo3::types::PyFloat::new(py, data).into_any())
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
653
src/graph/mod.rs
653
src/graph/mod.rs
@@ -26,11 +26,11 @@ use itertools::Itertools;
|
||||
use tosubcommand::ToFlags;
|
||||
|
||||
#[cfg(any(not(feature = "ezkl"), target_arch = "wasm32"))]
|
||||
use self::input::{FileSource, GraphData};
|
||||
use self::input::GraphData;
|
||||
|
||||
use self::errors::GraphError;
|
||||
#[cfg(all(feature = "ezkl", not(target_arch = "wasm32")))]
|
||||
use self::input::{FileSource, GraphData};
|
||||
use self::input::GraphData;
|
||||
use self::modules::{GraphModules, ModuleConfigs, ModuleForwardResult, ModuleSizes};
|
||||
use crate::circuit::lookup::LookupOp;
|
||||
use crate::circuit::modules::ModulePlanner;
|
||||
@@ -61,7 +61,7 @@ use pyo3::types::PyDict;
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use pyo3::types::PyDictMethods;
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use pyo3::ToPyObject;
|
||||
use pyo3::IntoPyObject;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::ops::Deref;
|
||||
@@ -319,8 +319,12 @@ impl GraphWitness {
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
impl ToPyObject for GraphWitness {
|
||||
fn to_object(&self, py: Python) -> PyObject {
|
||||
impl<'py> IntoPyObject<'py> for GraphWitness {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
// Create a Python dictionary
|
||||
let dict = PyDict::new(py);
|
||||
let dict_inputs = PyDict::new(py);
|
||||
@@ -383,7 +387,7 @@ impl ToPyObject for GraphWitness {
|
||||
dict.set_item("processed_outputs", dict_outputs).unwrap();
|
||||
}
|
||||
|
||||
dict.to_object(py)
|
||||
Ok(dict.into_any())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,8 +417,29 @@ fn insert_polycommit_pydict(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// model parameters
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
/// Parameters for dynamic lookups
|
||||
/// serde should flatten this struct
|
||||
pub struct DynamicLookupParams {
|
||||
/// total dynamic column size
|
||||
pub total_dynamic_col_size: usize,
|
||||
/// max dynamic column input length
|
||||
pub max_dynamic_input_len: usize,
|
||||
/// number of dynamic lookups
|
||||
pub num_dynamic_lookups: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
/// Parameters for shuffle operations
|
||||
pub struct ShuffleParams {
|
||||
/// number of shuffles
|
||||
pub num_shuffles: usize,
|
||||
/// total shuffle column size
|
||||
pub total_shuffle_col_size: usize,
|
||||
}
|
||||
|
||||
/// model parameters
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
pub struct GraphSettings {
|
||||
/// run args
|
||||
pub run_args: RunArgs,
|
||||
@@ -424,16 +449,10 @@ pub struct GraphSettings {
|
||||
pub total_assignments: usize,
|
||||
/// total const size
|
||||
pub total_const_size: usize,
|
||||
/// total dynamic column size
|
||||
pub total_dynamic_col_size: usize,
|
||||
/// max dynamic column input length
|
||||
pub max_dynamic_input_len: usize,
|
||||
/// number of dynamic lookups
|
||||
pub num_dynamic_lookups: usize,
|
||||
/// number of shuffles
|
||||
pub num_shuffles: usize,
|
||||
/// total shuffle column size
|
||||
pub total_shuffle_col_size: usize,
|
||||
/// dynamic lookup parameters, flattened for backwards compatibility, serialize and deserialize flattened for backwards compatibility
|
||||
pub dynamic_lookup_params: DynamicLookupParams,
|
||||
/// shuffle parameters, flattened for backwards compatibility
|
||||
pub shuffle_params: ShuffleParams,
|
||||
/// the shape of public inputs to the model (in order of appearance)
|
||||
pub model_instance_shapes: Vec<Vec<usize>>,
|
||||
/// model output scales
|
||||
@@ -460,6 +479,434 @@ pub struct GraphSettings {
|
||||
pub output_types: Option<Vec<InputType>>,
|
||||
}
|
||||
|
||||
impl Serialize for GraphSettings {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
if serializer.is_human_readable() {
|
||||
// JSON format - use flattened fields for backwards compatibility
|
||||
use serde::ser::SerializeStruct;
|
||||
let mut state = serializer.serialize_struct("GraphSettings", 21)?;
|
||||
state.serialize_field("run_args", &self.run_args)?;
|
||||
state.serialize_field("num_rows", &self.num_rows)?;
|
||||
state.serialize_field("total_assignments", &self.total_assignments)?;
|
||||
state.serialize_field("total_const_size", &self.total_const_size)?;
|
||||
|
||||
// Flatten DynamicLookupParams fields
|
||||
state.serialize_field(
|
||||
"total_dynamic_col_size",
|
||||
&self.dynamic_lookup_params.total_dynamic_col_size,
|
||||
)?;
|
||||
state.serialize_field(
|
||||
"max_dynamic_input_len",
|
||||
&self.dynamic_lookup_params.max_dynamic_input_len,
|
||||
)?;
|
||||
state.serialize_field(
|
||||
"num_dynamic_lookups",
|
||||
&self.dynamic_lookup_params.num_dynamic_lookups,
|
||||
)?;
|
||||
|
||||
// Flatten ShuffleParams fields
|
||||
state.serialize_field("num_shuffles", &self.shuffle_params.num_shuffles)?;
|
||||
state.serialize_field(
|
||||
"total_shuffle_col_size",
|
||||
&self.shuffle_params.total_shuffle_col_size,
|
||||
)?;
|
||||
|
||||
state.serialize_field("model_instance_shapes", &self.model_instance_shapes)?;
|
||||
state.serialize_field("model_output_scales", &self.model_output_scales)?;
|
||||
state.serialize_field("model_input_scales", &self.model_input_scales)?;
|
||||
state.serialize_field("module_sizes", &self.module_sizes)?;
|
||||
state.serialize_field("required_lookups", &self.required_lookups)?;
|
||||
state.serialize_field("required_range_checks", &self.required_range_checks)?;
|
||||
state.serialize_field("check_mode", &self.check_mode)?;
|
||||
state.serialize_field("version", &self.version)?;
|
||||
state.serialize_field("num_blinding_factors", &self.num_blinding_factors)?;
|
||||
state.serialize_field("timestamp", &self.timestamp)?;
|
||||
state.serialize_field("input_types", &self.input_types)?;
|
||||
state.serialize_field("output_types", &self.output_types)?;
|
||||
state.end()
|
||||
} else {
|
||||
// Binary format (bincode) - use nested struct format
|
||||
use serde::ser::SerializeTuple;
|
||||
let mut state = serializer.serialize_tuple(18)?;
|
||||
state.serialize_element(&self.run_args)?;
|
||||
state.serialize_element(&self.num_rows)?;
|
||||
state.serialize_element(&self.total_assignments)?;
|
||||
state.serialize_element(&self.total_const_size)?;
|
||||
state.serialize_element(&self.dynamic_lookup_params)?;
|
||||
state.serialize_element(&self.shuffle_params)?;
|
||||
state.serialize_element(&self.model_instance_shapes)?;
|
||||
state.serialize_element(&self.model_output_scales)?;
|
||||
state.serialize_element(&self.model_input_scales)?;
|
||||
state.serialize_element(&self.module_sizes)?;
|
||||
state.serialize_element(&self.required_lookups)?;
|
||||
state.serialize_element(&self.required_range_checks)?;
|
||||
state.serialize_element(&self.check_mode)?;
|
||||
state.serialize_element(&self.version)?;
|
||||
state.serialize_element(&self.num_blinding_factors)?;
|
||||
state.serialize_element(&self.timestamp)?;
|
||||
state.serialize_element(&self.input_types)?;
|
||||
state.serialize_element(&self.output_types)?;
|
||||
state.end()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for GraphSettings {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
use serde::de::{self, MapAccess, Visitor};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(field_identifier, rename_all = "snake_case")]
|
||||
enum Field {
|
||||
RunArgs,
|
||||
NumRows,
|
||||
TotalAssignments,
|
||||
TotalConstSize,
|
||||
// Flattened DynamicLookupParams fields
|
||||
TotalDynamicColSize,
|
||||
MaxDynamicInputLen,
|
||||
NumDynamicLookups,
|
||||
// Flattened ShuffleParams fields
|
||||
NumShuffles,
|
||||
TotalShuffleColSize,
|
||||
ModelInstanceShapes,
|
||||
ModelOutputScales,
|
||||
ModelInputScales,
|
||||
ModuleSizes,
|
||||
RequiredLookups,
|
||||
RequiredRangeChecks,
|
||||
CheckMode,
|
||||
Version,
|
||||
NumBlindingFactors,
|
||||
Timestamp,
|
||||
InputTypes,
|
||||
OutputTypes,
|
||||
// Legacy nested struct fields for backwards compatibility
|
||||
DynamicLookupParams,
|
||||
ShuffleParams,
|
||||
}
|
||||
|
||||
struct GraphSettingsVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for GraphSettingsVisitor {
|
||||
type Value = GraphSettings;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("struct GraphSettings")
|
||||
}
|
||||
|
||||
fn visit_map<V>(self, mut map: V) -> Result<GraphSettings, V::Error>
|
||||
where
|
||||
V: MapAccess<'de>,
|
||||
{
|
||||
let mut run_args = None;
|
||||
let mut num_rows = None;
|
||||
let mut total_assignments = None;
|
||||
let mut total_const_size = None;
|
||||
let mut total_dynamic_col_size = None;
|
||||
let mut max_dynamic_input_len = None;
|
||||
let mut num_dynamic_lookups = None;
|
||||
let mut num_shuffles = None;
|
||||
let mut total_shuffle_col_size = None;
|
||||
let mut model_instance_shapes = None;
|
||||
let mut model_output_scales = None;
|
||||
let mut model_input_scales = None;
|
||||
let mut module_sizes = None;
|
||||
let mut required_lookups = None;
|
||||
let mut required_range_checks = None;
|
||||
let mut check_mode = None;
|
||||
let mut version = None;
|
||||
let mut num_blinding_factors = None;
|
||||
let mut timestamp = None;
|
||||
let mut input_types = None;
|
||||
let mut output_types = None;
|
||||
|
||||
while let Some(key) = map.next_key()? {
|
||||
match key {
|
||||
Field::RunArgs => {
|
||||
if run_args.is_some() {
|
||||
return Err(de::Error::duplicate_field("run_args"));
|
||||
}
|
||||
run_args = Some(map.next_value()?);
|
||||
}
|
||||
Field::NumRows => {
|
||||
if num_rows.is_some() {
|
||||
return Err(de::Error::duplicate_field("num_rows"));
|
||||
}
|
||||
num_rows = Some(map.next_value()?);
|
||||
}
|
||||
Field::TotalAssignments => {
|
||||
if total_assignments.is_some() {
|
||||
return Err(de::Error::duplicate_field("total_assignments"));
|
||||
}
|
||||
total_assignments = Some(map.next_value()?);
|
||||
}
|
||||
Field::TotalConstSize => {
|
||||
if total_const_size.is_some() {
|
||||
return Err(de::Error::duplicate_field("total_const_size"));
|
||||
}
|
||||
total_const_size = Some(map.next_value()?);
|
||||
}
|
||||
Field::TotalDynamicColSize => {
|
||||
if total_dynamic_col_size.is_some() {
|
||||
return Err(de::Error::duplicate_field("total_dynamic_col_size"));
|
||||
}
|
||||
total_dynamic_col_size = Some(map.next_value()?);
|
||||
}
|
||||
Field::MaxDynamicInputLen => {
|
||||
if max_dynamic_input_len.is_some() {
|
||||
return Err(de::Error::duplicate_field("max_dynamic_input_len"));
|
||||
}
|
||||
max_dynamic_input_len = Some(map.next_value()?);
|
||||
}
|
||||
Field::NumDynamicLookups => {
|
||||
if num_dynamic_lookups.is_some() {
|
||||
return Err(de::Error::duplicate_field("num_dynamic_lookups"));
|
||||
}
|
||||
num_dynamic_lookups = Some(map.next_value()?);
|
||||
}
|
||||
Field::NumShuffles => {
|
||||
if num_shuffles.is_some() {
|
||||
return Err(de::Error::duplicate_field("num_shuffles"));
|
||||
}
|
||||
num_shuffles = Some(map.next_value()?);
|
||||
}
|
||||
Field::TotalShuffleColSize => {
|
||||
if total_shuffle_col_size.is_some() {
|
||||
return Err(de::Error::duplicate_field("total_shuffle_col_size"));
|
||||
}
|
||||
total_shuffle_col_size = Some(map.next_value()?);
|
||||
}
|
||||
Field::ModelInstanceShapes => {
|
||||
if model_instance_shapes.is_some() {
|
||||
return Err(de::Error::duplicate_field("model_instance_shapes"));
|
||||
}
|
||||
model_instance_shapes = Some(map.next_value()?);
|
||||
}
|
||||
Field::ModelOutputScales => {
|
||||
if model_output_scales.is_some() {
|
||||
return Err(de::Error::duplicate_field("model_output_scales"));
|
||||
}
|
||||
model_output_scales = Some(map.next_value()?);
|
||||
}
|
||||
Field::ModelInputScales => {
|
||||
if model_input_scales.is_some() {
|
||||
return Err(de::Error::duplicate_field("model_input_scales"));
|
||||
}
|
||||
model_input_scales = Some(map.next_value()?);
|
||||
}
|
||||
Field::ModuleSizes => {
|
||||
if module_sizes.is_some() {
|
||||
return Err(de::Error::duplicate_field("module_sizes"));
|
||||
}
|
||||
module_sizes = Some(map.next_value()?);
|
||||
}
|
||||
Field::RequiredLookups => {
|
||||
if required_lookups.is_some() {
|
||||
return Err(de::Error::duplicate_field("required_lookups"));
|
||||
}
|
||||
required_lookups = Some(map.next_value()?);
|
||||
}
|
||||
Field::RequiredRangeChecks => {
|
||||
if required_range_checks.is_some() {
|
||||
return Err(de::Error::duplicate_field("required_range_checks"));
|
||||
}
|
||||
required_range_checks = Some(map.next_value()?);
|
||||
}
|
||||
Field::CheckMode => {
|
||||
if check_mode.is_some() {
|
||||
return Err(de::Error::duplicate_field("check_mode"));
|
||||
}
|
||||
check_mode = Some(map.next_value()?);
|
||||
}
|
||||
Field::Version => {
|
||||
if version.is_some() {
|
||||
return Err(de::Error::duplicate_field("version"));
|
||||
}
|
||||
version = Some(map.next_value()?);
|
||||
}
|
||||
Field::NumBlindingFactors => {
|
||||
if num_blinding_factors.is_some() {
|
||||
return Err(de::Error::duplicate_field("num_blinding_factors"));
|
||||
}
|
||||
num_blinding_factors = map.next_value()?;
|
||||
}
|
||||
Field::Timestamp => {
|
||||
if timestamp.is_some() {
|
||||
return Err(de::Error::duplicate_field("timestamp"));
|
||||
}
|
||||
timestamp = Some(map.next_value()?);
|
||||
}
|
||||
Field::InputTypes => {
|
||||
if input_types.is_some() {
|
||||
return Err(de::Error::duplicate_field("input_types"));
|
||||
}
|
||||
input_types = map.next_value()?;
|
||||
}
|
||||
Field::OutputTypes => {
|
||||
if output_types.is_some() {
|
||||
return Err(de::Error::duplicate_field("output_types"));
|
||||
}
|
||||
output_types = map.next_value()?;
|
||||
}
|
||||
// Handle legacy nested struct fields for backwards compatibility
|
||||
Field::DynamicLookupParams => {
|
||||
let legacy_params: DynamicLookupParams = map.next_value()?;
|
||||
if total_dynamic_col_size.is_none() {
|
||||
total_dynamic_col_size = Some(legacy_params.total_dynamic_col_size);
|
||||
}
|
||||
if max_dynamic_input_len.is_none() {
|
||||
max_dynamic_input_len = Some(legacy_params.max_dynamic_input_len);
|
||||
}
|
||||
if num_dynamic_lookups.is_none() {
|
||||
num_dynamic_lookups = Some(legacy_params.num_dynamic_lookups);
|
||||
}
|
||||
}
|
||||
Field::ShuffleParams => {
|
||||
let legacy_params: ShuffleParams = map.next_value()?;
|
||||
if num_shuffles.is_none() {
|
||||
num_shuffles = Some(legacy_params.num_shuffles);
|
||||
}
|
||||
if total_shuffle_col_size.is_none() {
|
||||
total_shuffle_col_size = Some(legacy_params.total_shuffle_col_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let run_args = run_args.ok_or_else(|| de::Error::missing_field("run_args"))?;
|
||||
let num_rows = num_rows.ok_or_else(|| de::Error::missing_field("num_rows"))?;
|
||||
let total_assignments = total_assignments
|
||||
.ok_or_else(|| de::Error::missing_field("total_assignments"))?;
|
||||
let total_const_size =
|
||||
total_const_size.ok_or_else(|| de::Error::missing_field("total_const_size"))?;
|
||||
let model_instance_shapes = model_instance_shapes
|
||||
.ok_or_else(|| de::Error::missing_field("model_instance_shapes"))?;
|
||||
let model_output_scales = model_output_scales
|
||||
.ok_or_else(|| de::Error::missing_field("model_output_scales"))?;
|
||||
let model_input_scales = model_input_scales
|
||||
.ok_or_else(|| de::Error::missing_field("model_input_scales"))?;
|
||||
let module_sizes =
|
||||
module_sizes.ok_or_else(|| de::Error::missing_field("module_sizes"))?;
|
||||
let required_lookups =
|
||||
required_lookups.ok_or_else(|| de::Error::missing_field("required_lookups"))?;
|
||||
let required_range_checks = required_range_checks
|
||||
.ok_or_else(|| de::Error::missing_field("required_range_checks"))?;
|
||||
let check_mode =
|
||||
check_mode.ok_or_else(|| de::Error::missing_field("check_mode"))?;
|
||||
let version = version.ok_or_else(|| de::Error::missing_field("version"))?;
|
||||
|
||||
// Build the nested structs from flattened fields, with defaults if missing
|
||||
let dynamic_lookup_params = DynamicLookupParams {
|
||||
total_dynamic_col_size: total_dynamic_col_size.unwrap_or_default(),
|
||||
max_dynamic_input_len: max_dynamic_input_len.unwrap_or_default(),
|
||||
num_dynamic_lookups: num_dynamic_lookups.unwrap_or_default(),
|
||||
};
|
||||
|
||||
let shuffle_params = ShuffleParams {
|
||||
num_shuffles: num_shuffles.unwrap_or_default(),
|
||||
total_shuffle_col_size: total_shuffle_col_size.unwrap_or_default(),
|
||||
};
|
||||
|
||||
Ok(GraphSettings {
|
||||
run_args,
|
||||
num_rows,
|
||||
total_assignments,
|
||||
total_const_size,
|
||||
dynamic_lookup_params,
|
||||
shuffle_params,
|
||||
model_instance_shapes,
|
||||
model_output_scales,
|
||||
model_input_scales,
|
||||
module_sizes,
|
||||
required_lookups,
|
||||
required_range_checks,
|
||||
check_mode,
|
||||
version,
|
||||
num_blinding_factors,
|
||||
timestamp,
|
||||
input_types,
|
||||
output_types,
|
||||
})
|
||||
}
|
||||
|
||||
fn visit_seq<V>(self, mut seq: V) -> Result<GraphSettings, V::Error>
|
||||
where
|
||||
V: serde::de::SeqAccess<'de>,
|
||||
{
|
||||
use serde::de::Error;
|
||||
|
||||
// For bincode compatibility, deserialize in the same order as tuple serialization
|
||||
let run_args = seq.next_element()?.ok_or_else(|| Error::invalid_length(0, &self))?;
|
||||
let num_rows = seq.next_element()?.ok_or_else(|| Error::invalid_length(1, &self))?;
|
||||
let total_assignments = seq.next_element()?.ok_or_else(|| Error::invalid_length(2, &self))?;
|
||||
let total_const_size = seq.next_element()?.ok_or_else(|| Error::invalid_length(3, &self))?;
|
||||
let dynamic_lookup_params = seq.next_element()?.ok_or_else(|| Error::invalid_length(4, &self))?;
|
||||
let shuffle_params = seq.next_element()?.ok_or_else(|| Error::invalid_length(5, &self))?;
|
||||
let model_instance_shapes = seq.next_element()?.ok_or_else(|| Error::invalid_length(6, &self))?;
|
||||
let model_output_scales = seq.next_element()?.ok_or_else(|| Error::invalid_length(7, &self))?;
|
||||
let model_input_scales = seq.next_element()?.ok_or_else(|| Error::invalid_length(8, &self))?;
|
||||
let module_sizes = seq.next_element()?.ok_or_else(|| Error::invalid_length(9, &self))?;
|
||||
let required_lookups = seq.next_element()?.ok_or_else(|| Error::invalid_length(10, &self))?;
|
||||
let required_range_checks = seq.next_element()?.ok_or_else(|| Error::invalid_length(11, &self))?;
|
||||
let check_mode = seq.next_element()?.ok_or_else(|| Error::invalid_length(12, &self))?;
|
||||
let version = seq.next_element()?.ok_or_else(|| Error::invalid_length(13, &self))?;
|
||||
let num_blinding_factors = seq.next_element()?.ok_or_else(|| Error::invalid_length(14, &self))?;
|
||||
let timestamp = seq.next_element()?.ok_or_else(|| Error::invalid_length(15, &self))?;
|
||||
let input_types = seq.next_element()?.ok_or_else(|| Error::invalid_length(16, &self))?;
|
||||
let output_types = seq.next_element()?.ok_or_else(|| Error::invalid_length(17, &self))?;
|
||||
|
||||
Ok(GraphSettings {
|
||||
run_args,
|
||||
num_rows,
|
||||
total_assignments,
|
||||
total_const_size,
|
||||
dynamic_lookup_params,
|
||||
shuffle_params,
|
||||
model_instance_shapes,
|
||||
model_output_scales,
|
||||
model_input_scales,
|
||||
module_sizes,
|
||||
required_lookups,
|
||||
required_range_checks,
|
||||
check_mode,
|
||||
version,
|
||||
num_blinding_factors,
|
||||
timestamp,
|
||||
input_types,
|
||||
output_types,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Universal deserializer that works with both JSON (map) and bincode (tuple)
|
||||
if deserializer.is_human_readable() {
|
||||
// JSON format - use struct/map deserialization with flattened fields
|
||||
const FIELDS: &'static [&'static str] = &[
|
||||
"run_args", "num_rows", "total_assignments", "total_const_size",
|
||||
"total_dynamic_col_size", "max_dynamic_input_len", "num_dynamic_lookups",
|
||||
"num_shuffles", "total_shuffle_col_size", "model_instance_shapes",
|
||||
"model_output_scales", "model_input_scales", "module_sizes",
|
||||
"required_lookups", "required_range_checks", "check_mode", "version",
|
||||
"num_blinding_factors", "timestamp", "input_types", "output_types",
|
||||
"dynamic_lookup_params", "shuffle_params",
|
||||
];
|
||||
deserializer.deserialize_struct("GraphSettings", FIELDS, GraphSettingsVisitor)
|
||||
} else {
|
||||
// Binary format (bincode) - use tuple deserialization
|
||||
deserializer.deserialize_tuple(18, GraphSettingsVisitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GraphSettings {
|
||||
/// Calc the number of rows required for lookup tables
|
||||
pub fn lookup_log_rows(&self) -> u32 {
|
||||
@@ -495,15 +942,16 @@ impl GraphSettings {
|
||||
}
|
||||
|
||||
fn dynamic_lookup_and_shuffle_logrows(&self) -> u32 {
|
||||
(self.total_dynamic_col_size as f64 + self.total_shuffle_col_size as f64)
|
||||
(self.dynamic_lookup_params.total_dynamic_col_size as f64
|
||||
+ self.shuffle_params.total_shuffle_col_size as f64)
|
||||
.log2()
|
||||
.ceil() as u32
|
||||
}
|
||||
|
||||
/// calculate the number of rows required for the dynamic lookup and shuffle
|
||||
pub fn dynamic_lookup_and_shuffle_logrows_with_blinding(&self) -> u32 {
|
||||
(self.total_dynamic_col_size as f64
|
||||
+ self.total_shuffle_col_size as f64
|
||||
(self.dynamic_lookup_params.total_dynamic_col_size as f64
|
||||
+ self.shuffle_params.total_shuffle_col_size as f64
|
||||
+ RESERVED_BLINDING_ROWS as f64)
|
||||
.log2()
|
||||
.ceil() as u32
|
||||
@@ -511,13 +959,14 @@ impl GraphSettings {
|
||||
|
||||
/// calculate the number of rows required for the dynamic lookup and shuffle
|
||||
pub fn min_dynamic_lookup_and_shuffle_logrows_with_blinding(&self) -> u32 {
|
||||
(self.max_dynamic_input_len as f64 + RESERVED_BLINDING_ROWS as f64)
|
||||
(self.dynamic_lookup_params.max_dynamic_input_len as f64 + RESERVED_BLINDING_ROWS as f64)
|
||||
.log2()
|
||||
.ceil() as u32
|
||||
}
|
||||
|
||||
fn dynamic_lookup_and_shuffle_col_size(&self) -> usize {
|
||||
self.total_dynamic_col_size + self.total_shuffle_col_size
|
||||
self.dynamic_lookup_params.total_dynamic_col_size
|
||||
+ self.shuffle_params.total_shuffle_col_size
|
||||
}
|
||||
|
||||
/// calculate the number of rows required for the module constraints
|
||||
@@ -653,12 +1102,12 @@ impl GraphSettings {
|
||||
|
||||
/// requires dynamic lookup
|
||||
pub fn requires_dynamic_lookup(&self) -> bool {
|
||||
self.num_dynamic_lookups > 0
|
||||
self.dynamic_lookup_params.num_dynamic_lookups > 0
|
||||
}
|
||||
|
||||
/// requires dynamic shuffle
|
||||
pub fn requires_shuffle(&self) -> bool {
|
||||
self.num_shuffles > 0
|
||||
self.shuffle_params.num_shuffles > 0
|
||||
}
|
||||
|
||||
/// any kzg visibility
|
||||
@@ -956,13 +1405,13 @@ impl GraphCircuit {
|
||||
let shapes = self.model().graph.input_shapes()?;
|
||||
let scales = self.model().graph.get_input_scales();
|
||||
let input_types = self.model().graph.get_input_types()?;
|
||||
self.load_file_data(data.input_data.values(), &shapes, scales, input_types)
|
||||
self.load_file_data(&data.input_data, &shapes, scales, input_types)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn load_file_data(
|
||||
&mut self,
|
||||
file_data: &FileSource,
|
||||
file_data: &DataSource,
|
||||
shapes: &Vec<Vec<usize>>,
|
||||
scales: Vec<crate::Scale>,
|
||||
input_types: Vec<InputType>,
|
||||
@@ -1655,3 +2104,155 @@ impl Circuit<Fp> for GraphCircuit {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
/// Tests for the graph module
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_graph_settings_serialization_roundtrip() {
|
||||
use crate::{CheckMode, RunArgs};
|
||||
|
||||
// Create a test GraphSettings with nested structs
|
||||
let original = GraphSettings {
|
||||
run_args: RunArgs::default(),
|
||||
num_rows: 1000,
|
||||
total_assignments: 500,
|
||||
total_const_size: 100,
|
||||
dynamic_lookup_params: DynamicLookupParams {
|
||||
total_dynamic_col_size: 42,
|
||||
max_dynamic_input_len: 128,
|
||||
num_dynamic_lookups: 5,
|
||||
},
|
||||
shuffle_params: ShuffleParams {
|
||||
num_shuffles: 3,
|
||||
total_shuffle_col_size: 256,
|
||||
},
|
||||
model_instance_shapes: vec![vec![1, 2, 3]],
|
||||
model_output_scales: vec![],
|
||||
model_input_scales: vec![],
|
||||
module_sizes: ModuleSizes::default(),
|
||||
required_lookups: vec![],
|
||||
required_range_checks: vec![],
|
||||
check_mode: CheckMode::SAFE,
|
||||
version: "1.0.0".to_string(),
|
||||
num_blinding_factors: Some(5),
|
||||
timestamp: Some(123456789),
|
||||
input_types: None,
|
||||
output_types: None,
|
||||
};
|
||||
|
||||
// Test 1: JSON serialization roundtrip with flattened format
|
||||
let json_str = serde_json::to_string_pretty(&original).unwrap();
|
||||
println!("JSON serialized (flattened):\n{}", json_str);
|
||||
|
||||
// Verify the JSON contains flattened fields
|
||||
assert!(json_str.contains("\"total_dynamic_col_size\": 42"));
|
||||
assert!(json_str.contains("\"max_dynamic_input_len\": 128"));
|
||||
assert!(json_str.contains("\"num_dynamic_lookups\": 5"));
|
||||
assert!(json_str.contains("\"num_shuffles\": 3"));
|
||||
assert!(json_str.contains("\"total_shuffle_col_size\": 256"));
|
||||
|
||||
// Verify the JSON does NOT contain nested structs
|
||||
assert!(!json_str.contains("\"dynamic_lookup_params\""));
|
||||
assert!(!json_str.contains("\"shuffle_params\""));
|
||||
|
||||
// Deserialize from JSON
|
||||
let deserialized: GraphSettings = serde_json::from_str(&json_str).unwrap();
|
||||
assert_eq!(original, deserialized);
|
||||
|
||||
|
||||
// now do JSON bytes
|
||||
let json_bytes = serde_json::to_vec(&original).unwrap();
|
||||
let deserialized_from_bytes: GraphSettings = serde_json::from_slice(&json_bytes).unwrap();
|
||||
assert_eq!(original, deserialized_from_bytes);
|
||||
|
||||
// Test 2: Bincode serialization roundtrip
|
||||
let bincode_data = bincode::serialize(&original).unwrap();
|
||||
let bincode_deserialized: GraphSettings = bincode::deserialize(&bincode_data).unwrap();
|
||||
assert_eq!(original, bincode_deserialized);
|
||||
|
||||
// Test 3: Backwards compatibility - deserialize old nested format
|
||||
let old_format_json = r#"{
|
||||
"run_args": {
|
||||
"tolerance": {
|
||||
"val": 0.0,
|
||||
"scale": 1.0
|
||||
},
|
||||
"input_scale": 0,
|
||||
"param_scale": 0,
|
||||
"scale_rebase_multiplier": 10,
|
||||
"lookup_range": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"logrows": 6,
|
||||
"num_inner_cols": 2,
|
||||
"variables": [
|
||||
[
|
||||
"batch_size",
|
||||
1
|
||||
]
|
||||
],
|
||||
"input_visibility": "Private",
|
||||
"output_visibility": "Public",
|
||||
"param_visibility": "Private",
|
||||
"rebase_frac_zero_constants": false,
|
||||
"check_mode": "UNSAFE",
|
||||
"commitment": "KZG",
|
||||
"decomp_base": 128,
|
||||
"decomp_legs": 2,
|
||||
"bounded_log_lookup": false,
|
||||
"ignore_range_check_inputs_outputs": false
|
||||
},
|
||||
"num_rows": 236,
|
||||
"total_assignments": 472,
|
||||
"total_const_size": 4,
|
||||
"total_dynamic_col_size": 0,
|
||||
"max_dynamic_input_len": 0,
|
||||
"num_dynamic_lookups": 0,
|
||||
"num_shuffles": 0,
|
||||
"total_shuffle_col_size": 0,
|
||||
"model_instance_shapes": [
|
||||
[
|
||||
1,
|
||||
4
|
||||
]
|
||||
],
|
||||
"model_output_scales": [
|
||||
0
|
||||
],
|
||||
"model_input_scales": [
|
||||
0
|
||||
],
|
||||
"module_sizes": {
|
||||
"polycommit": [],
|
||||
"poseidon": [
|
||||
0,
|
||||
[
|
||||
0
|
||||
]
|
||||
]
|
||||
},
|
||||
"required_lookups": [],
|
||||
"required_range_checks": [
|
||||
[
|
||||
-1,
|
||||
1
|
||||
],
|
||||
[
|
||||
0,
|
||||
127
|
||||
]
|
||||
],
|
||||
"check_mode": "UNSAFE",
|
||||
"version": "0.0.0",
|
||||
"num_blinding_factors": null,
|
||||
"timestamp": 1741214578354
|
||||
}"#;
|
||||
|
||||
let _backwards_compatible: GraphSettings = serde_json::from_str(old_format_json).unwrap();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ use crate::circuit::Input;
|
||||
use crate::circuit::InputType;
|
||||
use crate::circuit::Unknown;
|
||||
use crate::fieldutils::IntegerRep;
|
||||
use crate::graph::DynamicLookupParams;
|
||||
use crate::graph::ShuffleParams;
|
||||
use crate::tensor::ValType;
|
||||
use crate::{
|
||||
circuit::{lookup::LookupOp, BaseConfig as PolyConfig, CheckMode, Op},
|
||||
@@ -100,12 +102,10 @@ pub type NodeGraph = BTreeMap<usize, NodeType>;
|
||||
pub struct DummyPassRes {
|
||||
/// number of rows use
|
||||
pub num_rows: usize,
|
||||
/// num dynamic lookups
|
||||
pub num_dynamic_lookups: usize,
|
||||
/// max dynamic lookup input len
|
||||
pub max_dynamic_input_len: usize,
|
||||
/// dynamic lookup col size
|
||||
pub dynamic_lookup_col_coord: usize,
|
||||
/// dynamic lookup parameters
|
||||
pub dynamic_lookup_params: DynamicLookupParams,
|
||||
/// shuffle parameters
|
||||
pub shuffle_params: ShuffleParams,
|
||||
/// num shuffles
|
||||
pub num_shuffles: usize,
|
||||
/// shuffle
|
||||
@@ -585,16 +585,13 @@ impl Model {
|
||||
num_rows: res.num_rows,
|
||||
total_assignments: res.linear_coord,
|
||||
required_lookups: res.lookup_ops.into_iter().collect(),
|
||||
max_dynamic_input_len: res.max_dynamic_input_len,
|
||||
required_range_checks: res.range_checks.into_iter().collect(),
|
||||
model_output_scales: self.graph.get_output_scales()?,
|
||||
model_input_scales: self.graph.get_input_scales(),
|
||||
input_types: self.get_input_types().ok(),
|
||||
output_types: Some(self.get_output_types()),
|
||||
num_dynamic_lookups: res.num_dynamic_lookups,
|
||||
total_dynamic_col_size: res.dynamic_lookup_col_coord,
|
||||
num_shuffles: res.num_shuffles,
|
||||
total_shuffle_col_size: res.shuffle_col_coord,
|
||||
dynamic_lookup_params: res.dynamic_lookup_params,
|
||||
shuffle_params: res.shuffle_params,
|
||||
total_const_size: res.total_const_size,
|
||||
check_mode,
|
||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
@@ -1523,15 +1520,21 @@ impl Model {
|
||||
let res = DummyPassRes {
|
||||
num_rows: region.row(),
|
||||
linear_coord: region.linear_coord(),
|
||||
max_dynamic_input_len: region.max_dynamic_input_len(),
|
||||
dynamic_lookup_params: DynamicLookupParams {
|
||||
total_dynamic_col_size: region.dynamic_lookup_col_coord(),
|
||||
max_dynamic_input_len: region.max_dynamic_input_len(),
|
||||
num_dynamic_lookups: region.dynamic_lookup_index(),
|
||||
},
|
||||
shuffle_params: ShuffleParams {
|
||||
num_shuffles: region.shuffle_index(),
|
||||
total_shuffle_col_size: region.shuffle_col_coord(),
|
||||
},
|
||||
total_const_size: region.total_constants(),
|
||||
lookup_ops: region.used_lookups(),
|
||||
range_checks: region.used_range_checks(),
|
||||
max_lookup_inputs: region.max_lookup_inputs(),
|
||||
min_lookup_inputs: region.min_lookup_inputs(),
|
||||
max_range_size: region.max_range_size(),
|
||||
num_dynamic_lookups: region.dynamic_lookup_index(),
|
||||
dynamic_lookup_col_coord: region.dynamic_lookup_col_coord(),
|
||||
num_shuffles: region.shuffle_index(),
|
||||
shuffle_col_coord: region.shuffle_col_coord(),
|
||||
outputs,
|
||||
|
||||
@@ -9,7 +9,7 @@ use itertools::Itertools;
|
||||
use log::debug;
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use pyo3::{
|
||||
exceptions::PyValueError, FromPyObject, IntoPy, PyObject, PyResult, Python, ToPyObject,
|
||||
exceptions::PyValueError, FromPyObject, IntoPyObject, PyResult, Python,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(all(feature = "ezkl", not(target_arch = "wasm32")))]
|
||||
@@ -107,27 +107,31 @@ impl<'a> From<&'a str> for Visibility {
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
impl IntoPy<PyObject> for Visibility {
|
||||
impl<'py> IntoPyObject<'py> for Visibility {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
/// Converts Visibility to Python object
|
||||
fn into_py(self, py: Python) -> PyObject {
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
match self {
|
||||
Visibility::Private => "private".to_object(py),
|
||||
Visibility::Public => "public".to_object(py),
|
||||
Visibility::Fixed => "fixed".to_object(py),
|
||||
Visibility::KZGCommit => "polycommit".to_object(py),
|
||||
Visibility::Private => Ok("private".into_pyobject(py)?.into_any()),
|
||||
Visibility::Public => Ok("public".into_pyobject(py)?.into_any()),
|
||||
Visibility::Fixed => Ok("fixed".into_pyobject(py)?.into_any()),
|
||||
Visibility::KZGCommit => Ok("polycommit".into_pyobject(py)?.into_any()),
|
||||
Visibility::Hashed {
|
||||
hash_is_public,
|
||||
outlets,
|
||||
} => {
|
||||
if hash_is_public {
|
||||
"hashed/public".to_object(py)
|
||||
Ok("hashed/public".into_pyobject(py)?.into_any())
|
||||
} else {
|
||||
let outlets = outlets
|
||||
.iter()
|
||||
.map(|o| o.to_string())
|
||||
.collect_vec()
|
||||
.join(",");
|
||||
format!("hashed/private/{}", outlets).to_object(py)
|
||||
Ok(format!("hashed/private/{}", outlets).into_pyobject(py)?.into_any())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,12 +187,17 @@ impl From<ProofType> for StrategyType {
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
impl ToPyObject for ProofType {
|
||||
fn to_object(&self, py: Python) -> PyObject {
|
||||
match self {
|
||||
ProofType::Single => "Single".to_object(py),
|
||||
ProofType::ForAggr => "ForAggr".to_object(py),
|
||||
}
|
||||
impl<'py> pyo3::IntoPyObject<'py> for ProofType {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: pyo3::Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
let result = match self {
|
||||
ProofType::Single => "Single",
|
||||
ProofType::ForAggr => "ForAggr",
|
||||
};
|
||||
Ok(result.into_pyobject(py)?.into_any())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,12 +250,17 @@ impl std::fmt::Display for StrategyType {
|
||||
}
|
||||
#[cfg(feature = "python-bindings")]
|
||||
/// Converts StrategyType into a PyObject (Required for StrategyType to be compatible with Python)
|
||||
impl pyo3::IntoPy<PyObject> for StrategyType {
|
||||
fn into_py(self, py: Python) -> PyObject {
|
||||
match self {
|
||||
StrategyType::Single => "single".to_object(py),
|
||||
StrategyType::Accum => "accum".to_object(py),
|
||||
}
|
||||
impl<'py> pyo3::IntoPyObject<'py> for StrategyType {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: pyo3::Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
let result = match self {
|
||||
StrategyType::Single => "single",
|
||||
StrategyType::Accum => "accum",
|
||||
};
|
||||
Ok(result.into_pyobject(py)?.into_any())
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "python-bindings")]
|
||||
@@ -304,15 +314,6 @@ impl ToFlags for TranscriptType {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
impl ToPyObject for TranscriptType {
|
||||
fn to_object(&self, py: Python) -> PyObject {
|
||||
match self {
|
||||
TranscriptType::Poseidon => "Poseidon".to_object(py),
|
||||
TranscriptType::EVM => "EVM".to_object(py),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
///
|
||||
@@ -401,14 +402,18 @@ where
|
||||
}
|
||||
|
||||
#[cfg(feature = "python-bindings")]
|
||||
use pyo3::{types::PyDict, PyObject, Python, ToPyObject};
|
||||
use pyo3::{types::PyDict, IntoPyObject, Python};
|
||||
#[cfg(feature = "python-bindings")]
|
||||
impl<F: PrimeField + SerdeObject + Serialize, C: CurveAffine + Serialize> ToPyObject for Snark<F, C>
|
||||
impl<'py, F: PrimeField + SerdeObject + Serialize, C: CurveAffine + Serialize> IntoPyObject<'py> for Snark<F, C>
|
||||
where
|
||||
C::Scalar: Serialize + DeserializeOwned,
|
||||
C::ScalarExt: Serialize + DeserializeOwned,
|
||||
{
|
||||
fn to_object(&self, py: Python) -> PyObject {
|
||||
type Target = pyo3::PyAny;
|
||||
type Output = pyo3::Bound<'py, Self::Target>;
|
||||
type Error = pyo3::PyErr;
|
||||
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
let dict = PyDict::new(py);
|
||||
let field_elems: Vec<Vec<String>> = self
|
||||
.instances
|
||||
@@ -418,9 +423,9 @@ where
|
||||
dict.set_item("instances", field_elems).unwrap();
|
||||
let hex_proof = hex::encode(&self.proof);
|
||||
dict.set_item("proof", format!("0x{}", hex_proof)).unwrap();
|
||||
dict.set_item("transcript_type", self.transcript_type.to_object(py))
|
||||
dict.set_item("transcript_type", self.transcript_type.into_pyobject(py)?)
|
||||
.unwrap();
|
||||
dict.to_object(py)
|
||||
Ok(dict.into_any())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
mod native_tests {
|
||||
|
||||
// use ezkl::circuit::table::RESERVED_BLINDING_ROWS_PAD;
|
||||
use ezkl::graph::input::{FileSource, GraphData};
|
||||
use ezkl::graph::input::GraphData;
|
||||
use ezkl::graph::GraphSettings;
|
||||
use ezkl::pfsys::Snark;
|
||||
use ezkl::Commitments;
|
||||
@@ -163,14 +163,12 @@ mod native_tests {
|
||||
let data = GraphData::from_path(format!("{}/{}/input.json", test_dir, test).into())
|
||||
.expect("failed to load input data");
|
||||
|
||||
let duplicated_input_data: FileSource = data
|
||||
.input_data
|
||||
.values()
|
||||
.iter()
|
||||
.map(|data| (0..num_batches).flat_map(|_| data.clone()).collect())
|
||||
.collect();
|
||||
let duplicated_input_data = data.input_data.into_iter().map(|input| {
|
||||
(0..num_batches)
|
||||
.map(move |_| input.clone()).flatten().collect::<Vec<_>>()
|
||||
}).collect::<Vec<_>>();
|
||||
|
||||
let duplicated_data = GraphData::new(duplicated_input_data.into());
|
||||
let duplicated_data = GraphData::new(duplicated_input_data);
|
||||
|
||||
let res =
|
||||
duplicated_data.save(format!("{}/{}/input.json", test_dir, output_dir).into());
|
||||
@@ -1017,7 +1015,7 @@ mod native_tests {
|
||||
|
||||
});
|
||||
|
||||
seq!(N in 0..4 {
|
||||
seq!(N in 0..=98 {
|
||||
#(#[test_case(TESTS[N])])*
|
||||
fn kzg_evm_prove_and_verify_reusable_verifier_(test: &str) {
|
||||
crate::native_tests::init_binary();
|
||||
@@ -1027,7 +1025,7 @@ mod native_tests {
|
||||
init_logger();
|
||||
log::error!("Running kzg_evm_prove_and_verify_reusable_verifier_ for test: {}", test);
|
||||
// default vis
|
||||
let reusable_verifier_address: String = kzg_evm_prove_and_verify_reusable_verifier(2, path, test.to_string(), "private", "private", "public", &mut REUSABLE_VERIFIER_ADDR.lock().unwrap(), false);
|
||||
let reusable_verifier_address: String = kzg_evm_prove_and_verify_reusable_verifier(2, path, test.to_string(), "public", "private", "private", &mut REUSABLE_VERIFIER_ADDR.lock().unwrap(), false);
|
||||
// public/public vis
|
||||
let reusable_verifier_address: String = kzg_evm_prove_and_verify_reusable_verifier(2, path, test.to_string(), "public", "private", "public", &mut Some(reusable_verifier_address), false);
|
||||
// hashed input
|
||||
@@ -1049,7 +1047,7 @@ mod native_tests {
|
||||
|
||||
#(#[test_case(TESTS[N])])*
|
||||
fn kzg_evm_prove_and_verify_reusable_verifier_with_overflow_(test: &str) {
|
||||
// verifier too big to fit on chain with overflow calibration target
|
||||
// verifier too big to fit on chain with overflow calibration target or num instances exceed 0x10000
|
||||
if test == "1l_eltwise_div" || test == "lenet_5" || test == "ltsf" || test == "lstm_large" {
|
||||
return;
|
||||
}
|
||||
@@ -2093,7 +2091,7 @@ mod native_tests {
|
||||
rpc_arg.as_str(),
|
||||
addr_path_arg.as_str(),
|
||||
sol_arg.as_str(),
|
||||
"-C=verifier/reusable",
|
||||
"--contract-type=verifier/reusable",
|
||||
];
|
||||
|
||||
let status = Command::new(format!("{}/{}", *CARGO_TARGET_DIR, TEST_BINARY))
|
||||
@@ -2243,6 +2241,7 @@ mod native_tests {
|
||||
assert!(status.success());
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn build_ezkl() {
|
||||
#[cfg(feature = "icicle")]
|
||||
let args = [
|
||||
@@ -2275,6 +2274,15 @@ mod native_tests {
|
||||
"--features",
|
||||
"ezkl,solidity-verifier,eth",
|
||||
];
|
||||
#[cfg(feature = "reusable-verifier")]
|
||||
let args = [
|
||||
"build",
|
||||
"--profile=test-runs",
|
||||
"--bin",
|
||||
"ezkl",
|
||||
"--features",
|
||||
"reusable-verifier",
|
||||
];
|
||||
|
||||
let status = Command::new("cargo")
|
||||
.args(args)
|
||||
|
||||
Reference in New Issue
Block a user