Compare commits

...

4 Commits

Author SHA1 Message Date
dante
0df0db4091 update deps 2026-01-15 18:04:24 -05:00
dante
cc945dd589 Update pypi.yml 2026-01-15 17:14:13 -05:00
dante
e752f81802 chore bump toolchain 2026-01-15 17:06:14 -05:00
dante
9ebaffe8b2 chore: update docs and ci 2026-01-15 17:02:50 -05:00
10 changed files with 2154 additions and 1480 deletions

View File

@@ -15,7 +15,7 @@ jobs:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: nanoGPT Mock

View File

@@ -24,12 +24,12 @@ jobs:
matrix:
target: [x86_64, universal2-apple-darwin]
env:
RELEASE_TAG: ${{ github.ref_name }}
RELEASE_TAG: ${{ github.ref_name }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
with:
python-version: 3.12
architecture: x64
@@ -48,22 +48,22 @@ jobs:
mv Cargo.lock Cargo.lock.orig
sed "s/0\\.0\\.0/${RELEASE_TAG//v}/" Cargo.lock.orig >Cargo.lock
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
cache: false
- name: Build wheels
if: matrix.target == 'universal2-apple-darwin'
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
with:
target: ${{ matrix.target }}
args: --release --out dist --features python-bindings
- name: Build wheels
if: matrix.target == 'x86_64'
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
with:
target: ${{ matrix.target }}
args: --release --out dist --features python-bindings
@@ -74,7 +74,7 @@ jobs:
python -c "import ezkl"
- name: Upload wheels
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
with:
name: dist-macos-${{ matrix.target }}
path: dist
@@ -88,10 +88,10 @@ jobs:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
with:
python-version: 3.12
architecture: ${{ matrix.target }}
@@ -114,15 +114,15 @@ jobs:
mv Cargo.lock Cargo.lock.orig
sed "s/0\\.0\\.0/${RELEASE_TAG//v}/" Cargo.lock.orig >Cargo.lock
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
cache: false
- name: Build wheels
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
with:
target: ${{ matrix.target }}
args: --release --out dist --features python-bindings
@@ -132,7 +132,7 @@ jobs:
python -c "import ezkl"
- name: Upload wheels
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0 #v4.6.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0 #v4.6.0
with:
name: dist-windows-${{ matrix.target }}
path: dist
@@ -146,10 +146,10 @@ jobs:
matrix:
target: [x86_64]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
with:
python-version: 3.12
architecture: x64
@@ -178,7 +178,7 @@ jobs:
sudo apt-get update && sudo apt-get install -y openssl pkg-config libssl-dev
- name: Build wheels
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
with:
target: ${{ matrix.target }}
manylinux: auto
@@ -205,7 +205,7 @@ jobs:
python -c "import ezkl"
- name: Upload wheels
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
with:
name: dist-linux-${{ matrix.target }}
path: dist
@@ -220,10 +220,10 @@ jobs:
target:
- x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
with:
python-version: 3.12
architecture: x64
@@ -252,7 +252,7 @@ jobs:
sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- name: Build wheels
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
@@ -273,7 +273,7 @@ jobs:
python3 -c "import ezkl"
- name: Upload wheels
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
with:
name: dist-musllinux-${{ matrix.target }}
path: dist
@@ -289,10 +289,10 @@ jobs:
- target: aarch64-unknown-linux-musl
arch: aarch64
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa #v4.8.0
with:
python-version: 3.12
@@ -315,13 +315,13 @@ jobs:
sed "s/0\\.0\\.0/${RELEASE_TAG//v}/" Cargo.lock.orig >Cargo.lock
- name: Build wheels
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
uses: PyO3/maturin-action@5f8a1b3b0aad13193f46c9131f9b9e663def8ce5 #v1.46.0
with:
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_2
args: --release --out dist --features python-bindings
- uses: uraimo/run-on-arch-action@5397f9e30a9b62422f302092631c99ae1effcd9e #v2.8.1
- uses: uraimo/run-on-arch-action@5397f9e30a9b62422f302092631c99ae1effcd9e #v2.8.1
name: Install built wheel
with:
arch: ${{ matrix.platform.arch }}
@@ -336,7 +336,7 @@ jobs:
python3 -c "import ezkl"
- name: Upload wheels
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
with:
name: dist-musllinux-${{ matrix.platform.target }}
path: dist
@@ -349,7 +349,7 @@ jobs:
if: "startsWith(github.ref, 'refs/tags/')"
needs: [macos, windows, linux, musllinux, musllinux-cross]
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8
with:
pattern: dist-*
merge-multiple: true
@@ -366,11 +366,10 @@ jobs:
# publishes to PyPI
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc #v1.12.4
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc #v1.12.4
with:
packages-dir: ./wheels
doc-publish:
permissions:
contents: read
@@ -378,7 +377,7 @@ jobs:
runs-on: ubuntu-latest
needs: pypi-publish
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
- name: Trigger RTDs build
@@ -386,4 +385,4 @@ jobs:
with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }}
commit_ref: ${{ github.ref_name }}
commit_ref: ${{ github.ref_name }}

View File

@@ -52,7 +52,7 @@ jobs:
steps:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
cache: false
@@ -98,14 +98,11 @@ jobs:
echo "ASSET=build-artifacts/ezkl-linux-gpu.tar.gz" >> $GITHUB_ENV
- name: Upload release archive
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 #v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2.2.1
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream
token: ${{ secrets.RELEASE_TOKEN }}
tag_name: ${{ env.EZKL_VERSION }}
files: ${{ env.ASSET }}
build-release:
permissions:
@@ -127,27 +124,27 @@ jobs:
include:
- build: windows-msvc
os: windows-latest
rust: nightly-2025-05-01
rust: nightly-2025-12-01
target: x86_64-pc-windows-msvc
- build: macos
os: macos-13
rust: nightly-2025-05-01
rust: nightly-2025-12-01
target: x86_64-apple-darwin
- build: macos-aarch64
os: macos-13
rust: nightly-2025-05-01
rust: nightly-2025-12-01
target: aarch64-apple-darwin
- build: linux-musl
os: ubuntu-22.04
rust: nightly-2025-05-01
rust: nightly-2025-12-01
target: x86_64-unknown-linux-musl
- build: linux-gnu
os: ubuntu-22.04
rust: nightly-2025-05-01
rust: nightly-2025-12-01
target: x86_64-unknown-linux-gnu
- build: linux-aarch64
os: ubuntu-22.04
rust: nightly-2025-05-01
rust: nightly-2025-12-01
target: aarch64-unknown-linux-gnu
steps:
@@ -240,11 +237,8 @@ jobs:
echo "ASSET=build-artifacts/ezkl-win.zip" >> $GITHUB_ENV
- name: Upload release archive
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 #v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2.2.1
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream
token: ${{ secrets.RELEASE_TOKEN }}
tag_name: ${{ env.EZKL_VERSION }}
files: ${{ env.ASSET }}

View File

@@ -33,7 +33,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3
@@ -58,7 +58,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: install libc6
@@ -82,7 +82,7 @@ jobs:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: install libc6
@@ -106,7 +106,7 @@ jobs:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: install libc6
@@ -140,7 +140,7 @@ jobs:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
@@ -185,7 +185,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: install libc6
@@ -223,7 +223,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: install libc6
@@ -256,7 +256,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
@@ -331,7 +331,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
@@ -344,7 +344,7 @@ jobs:
with:
persist-credentials: false
- name: "Add rust-src"
run: rustup component add rust-src --toolchain nightly-2025-05-01-x86_64-unknown-linux-gnu
run: rustup component add rust-src --toolchain nightly-2025-12-01-x86_64-unknown-linux-gnu
# - name: Install solc
# run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.20 && solc --version
- name: Install Anvil
@@ -380,11 +380,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: Add rust-src
run: rustup component add rust-src --toolchain nightly-2025-05-01-x86_64-unknown-linux-gnu
run: rustup component add rust-src --toolchain nightly-2025-12-01-x86_64-unknown-linux-gnu
- name: Force rebuild icicle dependencies
run: cargo clean -p icicle-runtime -p icicle-core -p icicle-hash -p icicle-bn254
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
@@ -437,11 +437,11 @@ jobs:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: Add rust-src
run: rustup component add rust-src --toolchain nightly-2025-05-01-x86_64-unknown-linux-gnu
run: rustup component add rust-src --toolchain nightly-2025-12-01-x86_64-unknown-linux-gnu
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
with:
crate: cargo-nextest
@@ -486,7 +486,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: install libc6
@@ -520,7 +520,7 @@ jobs:
python-version: "3.12"
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- name: Install cmake
@@ -554,7 +554,7 @@ jobs:
python-version: "3.12"
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0
@@ -592,7 +592,7 @@ jobs:
python-version: "3.11"
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy
- uses: baptiste0928/cargo-install@91c5da15570085bcde6f4d7aed98cb82d6769fd3 #v3.3.0

View File

@@ -17,7 +17,7 @@ jobs:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
with:
toolchain: nightly-2025-05-01
toolchain: nightly-2025-12-01
override: true
components: rustfmt, clippy

3370
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -51,17 +51,16 @@ semver = { version = "1.0.22", optional = true }
# evm related deps
serde_json = { version = "1.0.97", features = ["float_roundtrip", "raw_value"] }
alloy = { git = "https://github.com/alloy-rs/alloy", version = "0.1.0", rev = "5fbf57bac99edef9d8475190109a7ea9fb7e5e83", features = [
alloy = { version = "1.0", features = [
"provider-http",
"signers",
"contract",
"rpc-types-eth",
"signer-wallet",
"signer-local",
"node-bindings",
], optional = true }
foundry-compilers = { version = "0.4.1", features = [
foundry-compilers = { version = "0.19.1", features = [
"svm-solc",
], optional = true }
ethabi = { version = "18", optional = true }
@@ -80,16 +79,16 @@ tokio = { version = "1.35.0", default-features = false, features = [
"macros",
"rt-multi-thread",
], optional = true }
pyo3 = { version = "0.24.2", features = [
pyo3 = { version = "0.27.2", features = [
"extension-module",
"abi3-py37",
"macros",
], default-features = false, optional = true }
pyo3-async-runtimes = { git = "https://github.com/PyO3/pyo3-async-runtimes", version = "0.24.0", features = [
pyo3-async-runtimes = { git = "https://github.com/PyO3/pyo3-async-runtimes", version = "0.27.0", features = [
"attributes",
"tokio-runtime",
], default-features = false, optional = true }
pyo3-log = { version = "0.12.0", default-features = false, optional = true }
pyo3-log = { version = "0.13.2", default-features = false, optional = true }
tract-onnx = { git = "https://github.com/sonos/tract/", rev = "37132e0397d0a73e5bd3a8615d932dabe44f6736", default-features = false, optional = true }
tabled = { version = "0.12.0", optional = true }
objc = { version = "0.2.4", optional = true }

View File

@@ -155,5 +155,5 @@ Check out `docs/advanced_security` for more advanced information on potential th
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2025 Zkonduit Inc.
Copyright (c) 2026 Zkonduit Inc.

View File

@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-05-01"
channel = "nightly-2025-12-01"
components = ["rustfmt", "clippy"]

View File

@@ -4,31 +4,26 @@ use alloy::core::primitives::Address as H160;
use alloy::core::primitives::Bytes;
use alloy::core::primitives::I256;
use alloy::dyn_abi::abi::TokenSeq;
// use alloy::providers::Middleware;
use alloy::json_abi::JsonAbi;
use alloy::network::{Ethereum, EthereumWallet};
use alloy::primitives::ruint::ParseError;
use alloy::primitives::ParseSignedError;
use alloy::providers::fillers::{
ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, SignerFiller,
};
use alloy::providers::network::{Ethereum, EthereumSigner};
use alloy::providers::ProviderBuilder;
use alloy::providers::{Identity, Provider, RootProvider};
use alloy::rpc::types::eth::TransactionInput;
use alloy::rpc::types::eth::TransactionRequest;
use alloy::providers::Provider;
use alloy::rpc::types::TransactionInput;
use alloy::rpc::types::TransactionRequest;
use alloy::signers::k256::ecdsa;
use alloy::signers::wallet::{LocalWallet, WalletError};
use alloy::signers::local::{PrivateKeySigner, LocalSignerError};
use alloy::transports::http::Http;
use alloy::transports::{RpcError, TransportErrorKind};
use foundry_compilers::artifacts::Settings as SolcSettings;
use foundry_compilers::error::{SolcError, SolcIoError};
use foundry_compilers::Solc;
use foundry_compilers::solc::Solc;
use halo2_solidity_verifier::encode_register_vk_calldata;
use halo2curves::bn256::{Fr, G1Affine};
use log::{debug, info, warn};
use reqwest::Client;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
const ANVIL_DEFAULT_PRIVATE_KEY: &str =
@@ -52,8 +47,10 @@ pub enum EthError {
Transport(#[from] RpcError<TransportErrorKind>),
#[error("a contract error occurred: {0}")]
Contract(#[from] alloy::contract::Error),
#[error("a pending transaction error occurred: {0}")]
PendingTransaction(#[from] alloy::providers::PendingTransactionError),
#[error("a wallet error occurred: {0}")]
Wallet(#[from] WalletError),
Wallet(#[from] LocalSignerError),
#[error("failed to parse url {0}")]
UrlParse(String),
#[error("Private key must be in hex format, 64 chars, without 0x prefix")]
@@ -102,49 +99,57 @@ pub enum EthError {
}
pub type EthersClient = Arc<
FillProvider<
JoinFill<
JoinFill<JoinFill<JoinFill<Identity, GasFiller>, NonceFiller>, ChainIdFiller>,
SignerFiller<EthereumSigner>,
alloy::providers::fillers::FillProvider<
alloy::providers::fillers::JoinFill<
alloy::providers::fillers::JoinFill<
alloy::providers::fillers::JoinFill<
alloy::providers::fillers::JoinFill<
alloy::providers::Identity,
alloy::providers::fillers::GasFiller,
>,
alloy::providers::fillers::NonceFiller,
>,
alloy::providers::fillers::ChainIdFiller,
>,
alloy::providers::fillers::WalletFiller<EthereumWallet>,
>,
RootProvider<Http<Client>>,
alloy::providers::RootProvider<Http<Client>>,
Http<Client>,
Ethereum,
>,
>;
pub type ContractFactory<M> = CallBuilder<Http<Client>, Arc<M>, ()>;
pub type ContractFactory<M> = CallBuilder<Arc<M>, (), Ethereum>;
/// Return an instance of Anvil and a client for the given RPC URL. If none is provided, a local client is used.
pub async fn setup_eth_backend(
rpc_url: &str,
private_key: Option<&str>,
) -> Result<(EthersClient, alloy::primitives::Address), EthError> {
) -> Result<(Arc<impl Provider + Clone>, alloy::primitives::Address), EthError> {
// Launch anvil
let endpoint = rpc_url.to_string();
// Instantiate the wallet
let wallet: LocalWallet;
let signer: PrivateKeySigner;
if let Some(private_key) = private_key {
debug!("using private key {}", private_key);
if private_key.len() != 64 {
return Err(EthError::PrivateKeyFormat);
}
let private_key_buffer = hex::decode(private_key)?;
wallet = LocalWallet::from_slice(&private_key_buffer)?;
signer = PrivateKeySigner::from_slice(&private_key_buffer)?;
} else {
wallet = LocalWallet::from_str(ANVIL_DEFAULT_PRIVATE_KEY)?;
signer = ANVIL_DEFAULT_PRIVATE_KEY.parse()?;
}
let wallet_address = wallet.address();
let wallet_address = signer.address();
let wallet = EthereumWallet::from(signer);
// Connect to the network
let client = Arc::new(
ProviderBuilder::new()
.with_recommended_fillers()
.signer(EthereumSigner::from(wallet))
.on_http(endpoint.parse().map_err(|_| EthError::UrlParse(endpoint))?),
.wallet(wallet)
.connect_http(endpoint.parse().map_err(|_| EthError::UrlParse(endpoint))?),
);
let chain_id = client.get_chain_id().await?;
@@ -194,7 +199,7 @@ pub async fn register_vka_via_rv(
let tx = TransactionRequest::default().to(rv_address).input(input);
debug!("transaction {:#?}", tx);
let result = client.call(&tx).await;
let result = client.call(tx.clone()).await;
if let Err(e) = result {
return Err(EthError::EvmVerificationError(e.to_string()).into());
@@ -204,7 +209,7 @@ pub async fn register_vka_via_rv(
// decode return bytes value into uint8
let output = result.to_vec();
let gas = client.estimate_gas(&tx).await?;
let gas = client.estimate_gas(tx.clone()).await?;
info!("estimated vka registration cost: {:#?}", gas);
@@ -215,11 +220,11 @@ pub async fn register_vka_via_rv(
result.watch().await?;
// if gas is greater than 30 million warn the user that the gas cost is above ethereum's 30 million block gas limit
if gas > 30_000_000_u128 {
if gas > 30_000_000_u64 {
warn!(
"Gas cost of verify transaction is greater than 30 million block gas limit. It will fail on mainnet."
);
} else if gas > 15_000_000_u128 {
} else if gas > 15_000_000_u64 {
warn!(
"Gas cost of verify transaction is greater than 15 million, the target block size for ethereum"
);
@@ -266,7 +271,7 @@ pub async fn verify_proof_via_solidity(
let tx = TransactionRequest::default().to(addr).input(input);
debug!("transaction {:#?}", tx);
let result = client.call(&tx).await;
let result = client.call(tx.clone()).await;
if let Err(e) = result {
return Err(EthError::EvmVerificationError(e.to_string()).into());
@@ -291,7 +296,7 @@ pub async fn verify_proof_via_solidity(
if !scaled_matches(inst, exp) {
return Err(EthError::RescaleCheckError(RescaleCheckError::Mismatch {
idx,
expected: exp.clone(),
expected: exp.to_string(),
got: to_decimal_18(inst),
}));
}
@@ -308,16 +313,16 @@ pub async fn verify_proof_via_solidity(
return Err(EthError::EvmVerificationError("Invalid proof".into()));
}
let gas = client.estimate_gas(&tx).await?;
let gas = client.estimate_gas(tx.clone()).await?;
info!("estimated verify gas cost: {:#?}", gas);
// if gas is greater than 30 million warn the user that the gas cost is above ethereum's 30 million block gas limit
if gas > 30_000_000_u128 {
if gas > 30_000_000_u64 {
warn!(
"Gas cost of verify transaction is greater than 30 million block gas limit. It will fail on mainnet."
);
} else if gas > 15_000_000_u128 {
} else if gas > 15_000_000_u64 {
warn!(
"Gas cost of verify transaction is greater than 15 million, the target block size for ethereum"
);
@@ -327,7 +332,7 @@ pub async fn verify_proof_via_solidity(
}
/// Generates the contract factory for a solidity verifier. The factory is used to deploy the contract
fn get_sol_contract_factory<'a, M: 'static + Provider<Http<Client>, Ethereum>, T: TokenSeq<'a>>(
fn get_sol_contract_factory<'a, M: 'static + Provider, T: TokenSeq<'a>>(
abi: JsonAbi,
bytecode: Bytes,
runtime_bytecode: Bytes,
@@ -365,7 +370,7 @@ fn get_sol_contract_factory<'a, M: 'static + Provider<Http<Client>, Ethereum>, T
}
};
Ok(CallBuilder::new_raw_deploy(client, data))
Ok(CallBuilder::<_, _, Ethereum>::new_raw_deploy(client, data))
}
/// Compiles a solidity verifier contract and returns the abi, bytecode, and runtime bytecode
@@ -374,11 +379,12 @@ pub async fn get_contract_artifacts(
contract_name: &str,
runs: usize,
) -> Result<(JsonAbi, Bytes, Bytes), EthError> {
use foundry_compilers::{
artifacts::{output_selection::OutputSelection, Optimizer},
compilers::CompilerInput,
SolcInput, SHANGHAI_SOLC,
use foundry_compilers::artifacts::{
output_selection::OutputSelection, Optimizer, SolcInput, SolcLanguage,
};
use semver::Version;
const SHANGHAI_SOLC: Version = Version::new(0, 8, 20);
if !sol_code_path.exists() {
return Err(EthError::ContractNotFound(
@@ -396,16 +402,14 @@ pub async fn get_contract_artifacts(
..Default::default()
};
let input = SolcInput::build(
std::collections::BTreeMap::from([(
sol_code_path.clone(),
foundry_compilers::artifacts::Source::read(sol_code_path)?,
)]),
settings,
&SHANGHAI_SOLC,
);
let sources = foundry_compilers::artifacts::Sources::from([(
sol_code_path.clone(),
foundry_compilers::artifacts::Source::read(&sol_code_path)?,
)]);
let solc_opt = Solc::find_svm_installed_version(SHANGHAI_SOLC.to_string())?;
let input = SolcInput::new(SolcLanguage::Solidity, sources, settings).sanitized(&SHANGHAI_SOLC);
let solc_opt = Solc::find_svm_installed_version(&SHANGHAI_SOLC)?;
let solc = match solc_opt {
Some(solc) => solc,
None => {
@@ -416,7 +420,7 @@ pub async fn get_contract_artifacts(
}
};
let compiled: foundry_compilers::CompilerOutput = solc.compile(&input[0])?;
let compiled = solc.compile(&input)?;
let (abi, bytecode, runtime_bytecode) = match compiled.find(contract_name) {
Some(c) => c.into_parts_or_default(),