Skip to content

Commit 4b9f758

Browse files
agnusmorxavi-pinsachzkronos73RogerTaulehecmas
authored
Merge pull request #1135 from 0xPolygonHermez/develop
Merge develop (1.0.0-alpha) into main ------------- Co-authored-by: Xavier Pinsach <10213118+xavi-pinsach@users.noreply.github.com> Co-authored-by: agnusmor <agnusmor@gmail.com> Co-authored-by: zkronos73 <zkronos73@gmail.com> Co-authored-by: Roger Taulé Buxadera <55488871+RogerTaule@users.noreply.github.com> Co-authored-by: zkronos73 <94566827+zkronos73@users.noreply.github.com> Co-authored-by: RogerTaule <roger.taulee@gmail.com> Co-authored-by: Héctor Masip Ardevol <hmasip@polygon.technology> Co-authored-by: rickb80 <75077385+rickb80@users.noreply.github.com> Co-authored-by: fractasy <fractasy@gmail.com> Co-authored-by: jestape <jestape@proton.me>
2 parents 6182c8b + d279c84 commit 4b9f758

1,130 files changed

Lines changed: 170520 additions & 31225 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Export the host binary's symbols to dlopen'd plugins.
2+
#
3+
# Proving-key `.so` files (e.g. `recursive1.so`) reference GMP symbols but
4+
# do not list libgmp in their `DT_NEEDED` — they expect the loading process
5+
# to already provide GMP. Without `--export-dynamic`, Rust binaries do not
6+
# expose their statically-linked symbols to libraries opened via `dlopen`,
7+
# causing runtime errors like:
8+
#
9+
# symbol lookup error: .../recursive1.so: undefined symbol: __gmpz_init_set_ui
10+
#
11+
# Linux-only: macOS uses a different export model and the affected `.so`
12+
# files are Linux-targeted anyway.
13+
[target.'cfg(target_os = "linux")']
14+
rustflags = ["-C", "link-arg=-Wl,--export-dynamic"]

.github/scripts/zisk_cycle_diff.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ def delta(b, p):
5757
if b is None or p is None:
5858
return "N/A"
5959
d = p - b
60-
if d == 0:
61-
return "➖ 0.00%"
6260
if b == 0:
61+
if d == 0:
62+
return "➖ 0.00%"
6363
return "🔴 new" if d > 0 else "🟢 —"
64+
pct = d / b * 100
65+
# A diff that rounds to 0.00% is reported as no-change.
66+
if round(pct, 2) == 0:
67+
return "➖ 0.00%"
6468
dot = "🔴" if d > 0 else "🟢"
65-
return f"{dot} {d / b * 100:+.2f}%"
69+
return f"{dot} {pct:+.2f}%"
6670

6771

6872
def summary(rows):

.github/workflows/book.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- "book/**"
1313
merge_group:
1414

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619
# test:
1720
# runs-on: ubuntu-latest

.github/workflows/cycle-tracking.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ jobs:
2929
timeout-minutes: 120
3030
env:
3131
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
32-
WS: ${{ github.workspace }}/.zk-setup
3332
steps:
3433
- name: "Free disk space"
3534
uses: jlumbroso/free-disk-space@v1.3.1

.github/workflows/lib_float_repro.yml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: lib-float reproducibility
22

3-
# Guards the reproducibility of lib-float's artifacts. ziskfloat.elf is compiled
4-
# inside a pinned Docker image (lib-float/c/docker/Dockerfile) and feeds the
5-
# program vk via include_bytes! in core/src/elf2rom.rs, so its bytes must be
6-
# both deterministic (same image -> same bytes) and stable unless changed
7-
# deliberately (locked by the committed per-artifact lib-float/c/*.md5).
3+
# Guards the reproducibility of lib-float's committed artifacts. ziskfloat.elf is
4+
# compiled inside a pinned Docker image (lib-float/c/docker/Dockerfile) and feeds
5+
# the program vk via include_bytes! in core/src/elf2rom.rs. This job rebuilds the
6+
# artifacts from source in that image and fails if the result differs from the
7+
# committed lib-float/c/lib/ziskfloat.elf and libziskfloat.a — i.e. the committed
8+
# binaries must be byte-identical to a fresh reproducible build.
89

910
on:
1011
pull_request:
@@ -36,30 +37,17 @@ jobs:
3637
- name: Checkout sources
3738
uses: actions/checkout@v4
3839

39-
- name: Build in pinned Docker image (run 1)
40+
- name: Rebuild artifacts in the pinned Docker image
4041
run: |
4142
set -euxo pipefail
4243
make clean
4344
make docker
44-
md5sum lib/ziskfloat.elf lib/libziskfloat.a > "$RUNNER_TEMP/run1.md5"
4545
46-
- name: Rebuild from scratch (run 2) and assert determinism
47-
run: |
48-
set -euxo pipefail
49-
make clean
50-
make docker
51-
md5sum lib/ziskfloat.elf lib/libziskfloat.a > "$RUNNER_TEMP/run2.md5"
52-
if ! diff -u "$RUNNER_TEMP/run1.md5" "$RUNNER_TEMP/run2.md5"; then
53-
echo "::error::Non-deterministic build: two clean builds in the pinned image produced different artifacts."
54-
exit 1
55-
fi
56-
echo "Determinism OK: both clean builds produced identical artifacts."
57-
58-
- name: Verify artifacts match md5 references
46+
- name: Verify committed artifacts match built artifacts
5947
run: |
6048
set -euo pipefail
61-
if ! make check-hashes; then
62-
echo "::error::ziskfloat artifacts changed vs the committed lib-float/c/*.md5 -> the code has changed. If this is intended, run 'make -C lib-float/c docker && make -C lib-float/c update-hashes' and commit the updated lib-float/c/*.md5 in this PR."
49+
if ! git diff --exit-code -- lib/ziskfloat.elf lib/libziskfloat.a; then
50+
echo "::error::Committed lib-float/c/lib artifacts differ from built artifacts in the pinned Docker image -> If this is intended, run 'make -C lib-float/c docker' and commit the updated lib-float/c/lib/ziskfloat.elf and libziskfloat.a in this PR."
6351
exit 1
6452
fi
65-
echo "OK: artifacts match the committed c/*.md5 files."
53+
echo "OK: committed ziskfloat.elf / libziskfloat.a match built artifacts."

.github/workflows/pr.yml

Lines changed: 138 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- develop
77
- main
8-
- "pre-develop-[0-9]+.[0-9]+.[0-9]+"
8+
- "pre-develop-[0-9]+.[0-9]+.[0-9]*"
99
paths-ignore:
1010
- 'book/**'
1111
workflow_dispatch:
@@ -14,39 +14,117 @@ concurrency:
1414
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
1515
cancel-in-progress: true
1616

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
cargo-tests:
1922
name: Cargo tests
20-
runs-on: ubuntu-latest
23+
runs-on: rocket
24+
container:
25+
image: ubuntu:22.04
2126
env:
2227
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
28+
2329
steps:
2430
- name: Checkout sources
2531
uses: actions/checkout@v4
2632

2733
- name: Install dependencies
2834
run: |
2935
cd "$GITHUB_WORKSPACE/tools/test-env"
30-
sudo ./install_deps.sh
36+
./install_deps.sh
37+
38+
- name: Add Cargo to PATH
39+
# install_deps.sh already installs Rust via rustup into ~/.cargo/bin;
40+
# just expose it to subsequent steps.
41+
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
42+
43+
- name: Show versions
44+
run: |
45+
rustc --version
46+
cargo --version
47+
48+
- name: Build cargo-zisk
49+
run: cargo build --bin cargo-zisk
50+
51+
- name: Install ZisK rust toolchain
52+
run: ./target/debug/cargo-zisk toolchain install
3153

3254
- name: Run cargo check
33-
uses: actions-rs/cargo@v1
34-
with:
35-
command: check
36-
args: --all-targets # --all-features
55+
run: cargo check --all-targets
3756

3857
- name: Run cargo test
39-
uses: actions-rs/cargo@v1
40-
with:
41-
command: test
42-
args: --workspace --release
58+
run: cargo test --workspace --release
4359
env:
4460
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
4561
RUST_BACKTRACE: 1
4662

63+
zisk-contracts:
64+
name: Hardhat tests (zisk-contracts)
65+
runs-on: ubuntu-latest
66+
timeout-minutes: 20
67+
env:
68+
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
69+
steps:
70+
- name: Checkout sources
71+
uses: actions/checkout@v4
72+
73+
- name: Install system dependencies
74+
run: |
75+
cd "$GITHUB_WORKSPACE/tools/test-env"
76+
sudo ./install_deps.sh
77+
78+
- name: Install Node.js
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: 20
82+
83+
- uses: Swatinem/rust-cache@v2
84+
with:
85+
cache-on-failure: true
86+
87+
- name: Build cargo-zisk-dev
88+
run: cargo build --release -p cargo-zisk --bin cargo-zisk-dev
89+
90+
- name: Generate Solidity calldata fixture
91+
working-directory: zisk-contracts
92+
run: ../target/release/cargo-zisk-dev export-solidity-calldata -p test/plonk_proof.bin -o fixtures/fixture.json
93+
94+
- name: Install JS dependencies
95+
working-directory: zisk-contracts
96+
run: npm install --no-audit --no-fund
97+
98+
- name: Run Hardhat test
99+
working-directory: zisk-contracts
100+
env:
101+
ZISK_SOLIDITY_FIXTURE: fixtures/fixture.json
102+
run: npx hardhat test
103+
104+
build-riscv64im:
105+
name: Build ziskos-staticlib (riscv64im-unknown-none-elf)
106+
runs-on: ubuntu-latest
107+
env:
108+
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
109+
steps:
110+
- name: Checkout sources
111+
uses: actions/checkout@v4
112+
113+
- name: Install Rust nightly with rust-src
114+
# riscv64im-unknown-none-elf is a Tier 3 target — no pre-built std is available.
115+
# rust-src is required so that -Z build-std can compile core/alloc from source.
116+
# No cross-compiler is needed; Rust uses its bundled rust-lld linker.
117+
run: rustup toolchain install nightly --component rust-src --no-self-update
118+
119+
- name: Build ziskos-staticlib for riscv64im-unknown-none-elf
120+
run: cargo +nightly build -p ziskos-staticlib --release --target riscv64im-unknown-none-elf -Z build-std=core,alloc --config 'profile.release.lto="fat"' --features panic-handler
121+
env:
122+
RUSTFLAGS: "-D warnings"
123+
47124
test-x86_64:
48125
name: Test on Ubuntu x86_64
49-
runs-on: gpu-hosted
126+
runs-on:
127+
group: zisk-gpu
50128
timeout-minutes: 180
51129
# NOTE: We intentionally use 'docker exec' in individual steps rather than
52130
# defining a job-level container. The test scripts deploy systemd services
@@ -73,6 +151,12 @@ jobs:
73151
sudo chown -R 1000:1000 "$GITHUB_WORKSPACE"
74152
sudo chmod -R u+rwX "$GITHUB_WORKSPACE"
75153
154+
- name: Prepare cache-setup directory
155+
run: |
156+
sudo mkdir -p /home/gha/cache-setup
157+
sudo chown -R 1000:1000 /home/gha/cache-setup
158+
sudo chmod -R u+rwX /home/gha/cache-setup
159+
76160
- name: Start test container with systemd
77161
run: |
78162
docker rm -f "${TEST_CONTAINER}" || true
@@ -88,7 +172,6 @@ jobs:
88172
-v /home/gha/cache-setup:/home/ziskuser/output:rw \
89173
-e ZISK_GHA=1 \
90174
-e ZISK_REPO_DIR=/workspace/zisk \
91-
-e ZISK_TESTVECTORS_BRANCH="${ZISK_TESTVECTORS_BRANCH}" \
92175
-e PROVE_FLAGS=-y \
93176
-e TERM=xterm \
94177
ziskvm/zisk-runner-gpu:latest \
@@ -110,6 +193,24 @@ jobs:
110193
systemctl is-system-running || true
111194
'
112195
196+
# Wait for the in-container Docker daemon (started by systemd) to be
197+
# ready. lib-float/build.rs invokes `docker` early in the build, so it
198+
# must be up before the "Build ZisK" step runs.
199+
echo "Waiting for in-container Docker daemon..."
200+
for i in $(seq 1 30); do
201+
if docker exec -u ziskuser "${TEST_CONTAINER}" docker info >/dev/null 2>&1; then
202+
echo "Docker daemon is ready."
203+
break
204+
fi
205+
if [ "$i" -eq 30 ]; then
206+
echo "Docker daemon did not become ready in time"
207+
docker exec "${TEST_CONTAINER}" systemctl status docker.service --no-pager || true
208+
docker exec "${TEST_CONTAINER}" journalctl -u docker.service --no-pager -n 50 || true
209+
exit 1
210+
fi
211+
sleep 2
212+
done
213+
113214
- name: Build ZisK
114215
run: |
115216
.github/scripts/docker_exec.sh \
@@ -168,12 +269,20 @@ jobs:
168269
./test_diagnostic.sh
169270
'
170271
272+
- name: Build zec-reth ELF file
273+
run: |
274+
.github/scripts/docker_exec.sh \
275+
-u ziskuser \
276+
-- bash -lc '
277+
cd /workspace/zisk/tools/test-env
278+
./build_zec_reth.sh
279+
'
280+
171281
- name: Prove Ethereum block
172282
run: |
173283
.github/scripts/docker_exec.sh \
174284
-u ziskuser \
175285
-e BLOCK_INPUTS_SINGLE="mainnet_24628607_66_7_zec_reth.bin,mainnet_24626900_221_16_zec_reth.bin" \
176-
-e ZISK_ETH_CLIENT_BRANCH="${ZISK_ETH_CLIENT_BRANCH}" \
177286
-- bash -lc '
178287
cd /workspace/zisk/tools/test-env
179288
./test_eth_block.sh
@@ -184,8 +293,6 @@ jobs:
184293
.github/scripts/docker_exec.sh \
185294
-u ziskuser \
186295
-e BLOCK_INPUTS_ETHPROOFS="mainnet_24628595_641_54_zec_reth.bin,mainnet_24697073_308_22_zec_reth.bin" \
187-
-e ZISK_ETHPROOFS_BRANCH="${ZISK_ETHPROOFS_BRANCH}" \
188-
-e ZISK_ETH_CLIENT_BRANCH="${ZISK_ETH_CLIENT_BRANCH}" \
189296
-- bash -lc '
190297
cd /workspace/zisk/tools/test-env
191298
./test_ethproofs.sh
@@ -195,8 +302,6 @@ jobs:
195302
run: |
196303
.github/scripts/docker_exec.sh \
197304
-u ziskuser \
198-
-e ZISK_ETHPROOFS_BRANCH="${ZISK_ETHPROOFS_BRANCH}" \
199-
-e ZISK_ETH_CLIENT_BRANCH="${ZISK_ETH_CLIENT_BRANCH}" \
200305
-e ENABLE_HINTS="1" \
201306
-- bash -lc '
202307
cd /workspace/zisk/tools/test-env
@@ -213,7 +318,7 @@ jobs:
213318
test-macos:
214319
name: Test on macOS
215320
runs-on: macos-14
216-
timeout-minutes: 30
321+
timeout-minutes: 45
217322
defaults:
218323
run:
219324
shell: bash
@@ -238,6 +343,11 @@ jobs:
238343
cd "$GITHUB_WORKSPACE/tools/test-env"
239344
./build_zisk.sh
240345
346+
- name: Build zec-reth ELF file
347+
run: |
348+
cd "$GITHUB_WORKSPACE/tools/test-env"
349+
./build_zec_reth.sh
350+
241351
- name: Test sha_hasher
242352
run: |
243353
cd "$GITHUB_WORKSPACE/tools/test-env"
@@ -283,6 +393,15 @@ jobs:
283393
env:
284394
CARGO_INCREMENTAL: 1
285395

396+
- name: Build cargo-zisk
397+
uses: actions-rs/cargo@v1
398+
with:
399+
command: build
400+
args: --bin cargo-zisk
401+
402+
- name: Install ZisK rust toolchain
403+
run: ./target/debug/cargo-zisk toolchain install
404+
286405
- name: Run cargo clippy
287406
uses: actions-rs/cargo@v1
288407
with:

.github/workflows/pr_emulator.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- develop
77
- main
8-
- "pre-develop-[0-9]+.[0-9]+.[0-9]+"
8+
- "pre-develop-[0-9]+.[0-9]+.[0-9]*"
99
paths:
1010
- "emulator/**"
1111
- "emulator-asm/**"
@@ -19,6 +19,9 @@ concurrency:
1919
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
2020
cancel-in-progress: true
2121

22+
permissions:
23+
contents: read
24+
2225
jobs:
2326
riscof-elf-tests-rust:
2427
name: Riscof ELF tests (rust emulator)

0 commit comments

Comments
 (0)