Skip to content

Commit a7d1125

Browse files
chore: merge main (#1844)
2 parents dabf5d5 + ac7576d commit a7d1125

File tree

50 files changed

+889
-321
lines changed

Some content is hidden

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

50 files changed

+889
-321
lines changed

.github/workflows/cli.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@ name: OpenVM CLI Tests
33
on:
44
push:
55
branches: ["main"]
6+
tags: ["v*"]
67
pull_request:
78
branches: ["**"]
89
paths:
910
- "crates/circuits/primitives/**"
1011
- "crates/vm/**"
12+
- "crates/toolchain/**"
1113
- "crates/sdk/**"
1214
- "crates/cli/**"
1315
- "examples/**"
1416
- "Cargo.toml"
1517
- ".github/workflows/cli.yml"
18+
workflow_dispatch:
19+
inputs:
20+
use_local_openvm:
21+
description: "Test cargo openvm init using local patch"
22+
required: true
23+
type: boolean
24+
default: false
1625

1726
concurrency:
1827
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -75,6 +84,14 @@ jobs:
7584
export RUST_BACKTRACE=1
7685
cargo openvm keygen --config ./example/app_config.toml --output-dir .
7786
87+
- name: Set USE_LOCAL_OPENVM environment variable
88+
run: |
89+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/* ]] || [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.use_local_openvm }}" == "false" ]]; then
90+
echo "USE_LOCAL_OPENVM=0" >> $GITHUB_ENV
91+
else
92+
echo "USE_LOCAL_OPENVM=1" >> $GITHUB_ENV
93+
fi
94+
7895
- name: Run CLI tests
7996
working-directory: crates/cli
8097
run: |

.github/workflows/extension-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
paths:
99
- "crates/circuits/**"
1010
- "crates/vm/**"
11+
- "crates/toolchain/**"
1112
- "extensions/**"
1213
- "Cargo.toml"
1314
- ".github/workflows/extension-tests.yml"
@@ -52,6 +53,7 @@ jobs:
5253
filters: |
5354
- "crates/circuits/**"
5455
- "crates/vm/**"
56+
- "crates/toolchain/**"
5557
- "extensions/${{ matrix.extensions.path }}/**"
5658
- ".github/workflows/extension-tests.yml"
5759
- name: Skip if no changes

.github/workflows/guest-lib-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
paths:
99
- "crates/circuits/**"
1010
- "crates/vm/**"
11+
- "crates/toolchain/**"
1112
- "extensions/**"
1213
- "guest-libs/**"
1314
- "Cargo.toml"
@@ -33,6 +34,7 @@ jobs:
3334
- { name: "p256", path: "p256" }
3435
- { name: "ruint", path: "ruint" }
3536
- { name: "pairing", path: "pairing" }
37+
- { name: "verify_stark", path: "verify_stark" }
3638
# Ensure tests run in parallel even if one fails
3739
fail-fast: false
3840

@@ -52,6 +54,7 @@ jobs:
5254
filters: |
5355
- "crates/circuits/**"
5456
- "crates/vm/**"
57+
- "crates/toolchain/**"
5558
- "extensions/**"
5659
- "guest-libs/${{ matrix.crate.path }}/**"
5760
- ".github/workflows/guest-lib-tests.yml"

.github/workflows/riscv.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ on:
77
branches: ["**"]
88
paths:
99
- "crates/vm/**"
10-
- "crates/toolchain/platform/**"
11-
- "crates/toolchain/instructions/**"
12-
- "crates/toolchain/build/**"
13-
- "crates/toolchain/macros/**"
14-
- "crates/toolchain/tests/**"
10+
- "crates/toolchain/**"
1511
- "Cargo.toml"
1612
- ".github/workflows/riscv.yml"
1713

.github/workflows/sdk.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
paths:
99
- "crates/circuits/primitives/**"
1010
- "crates/vm/**"
11+
- "crates/toolchain/**"
1112
- "crates/sdk/**"
1213
- "Cargo.toml"
1314
- ".github/workflows/sdk.yml"

.github/workflows/versioning.yml

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
# Workflow to verify versioning compatibility between base branch and patch versions
2+
name: Verify Versioning Compatibility
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: "Version tag to compare (e.g., v1.2.0)"
9+
required: true
10+
default: "v1.2.0"
11+
type: string
12+
13+
jobs:
14+
verify-versioning:
15+
runs-on:
16+
- runs-on=${{ github.run_id }}
17+
- runner=64cpu-linux-arm64
18+
- extras=s3-cache
19+
- disk=large
20+
steps:
21+
- name: Checkout base branch
22+
uses: actions/checkout@v4
23+
24+
- name: Set version fallback
25+
run: echo "version=${{ github.event.inputs.version || 'v1.2.0' }}" >> $GITHUB_ENV
26+
27+
- name: Install solc # svm should support arm64 linux
28+
run: (hash svm 2>/dev/null || cargo install --version 0.2.23 svm-rs) && svm install 0.8.19 && solc --version
29+
30+
- name: Install Rust
31+
uses: dtolnay/rust-toolchain@stable
32+
with:
33+
toolchain: stable
34+
35+
- name: Cache Cargo dependencies
36+
uses: Swatinem/rust-cache@v2
37+
38+
# Build and test from base branch
39+
- name: Build base branch CLI
40+
run: cargo install --force --path crates/cli
41+
42+
- name: Run setup from base branch and snapshot ~/.openvm
43+
run: |
44+
cargo openvm setup --evm
45+
rm -rf ~/.openvm-base
46+
mv ~/.openvm ~/.openvm-base
47+
48+
# - name: Build and keygen examples from base branch
49+
# run: |
50+
# mkdir -p ./base-outputs/examples
51+
# for example in examples/*/; do
52+
# if [ -f "$example/Cargo.toml" ]; then
53+
# example_name=$(basename "$example")
54+
# echo "Building and generating keys for example: $example_name"
55+
# cd "$example"
56+
# cargo openvm build --no-transpile
57+
# cargo openvm keygen --output-dir "../../base-outputs/examples/$example_name"
58+
# cd ../..
59+
# fi
60+
# done
61+
62+
- name: Build and keygen benchmarks from base branch
63+
run: |
64+
mkdir -p ./base-outputs/benchmarks
65+
for benchmark in benchmarks/guest/*/; do
66+
if [ -f "$benchmark/Cargo.toml" ]; then
67+
benchmark_name=$(basename "$benchmark")
68+
echo "Building and generating keys for benchmark: $benchmark_name"
69+
cd "$benchmark"
70+
cargo openvm build --no-transpile
71+
cargo openvm keygen --output-dir "../../../base-outputs/benchmarks/$benchmark_name"
72+
cd ../../..
73+
fi
74+
done
75+
76+
# Checkout and test tagged version
77+
- name: Checkout tagged version
78+
uses: actions/checkout@v4
79+
with:
80+
ref: ${{ env.version }}
81+
clean: false
82+
83+
- name: Build tagged CLI
84+
run: cargo install --force --path crates/cli
85+
86+
- name: Run setup from tagged version
87+
run: |
88+
# TODO: Add --evm after v1.3.0 release
89+
cargo openvm setup
90+
91+
# - name: Build and keygen examples from tagged version
92+
# run: |
93+
# mkdir -p ./tagged-outputs/examples
94+
# for example in examples/*/; do
95+
# if [ -f "$example/Cargo.toml" ]; then
96+
# example_name=$(basename "$example")
97+
# echo "Building and generating keys for example: $example_name"
98+
# cd "$example"
99+
# cargo openvm build --no-transpile
100+
# # TODO(yi): Change --vk-output to --output-dir after v1.3.0 release
101+
# mkdir -p "../../tagged-outputs/examples/$example_name"
102+
# cargo openvm keygen --vk-output "../../tagged-outputs/examples/$example_name/app.vk"
103+
# cd ../..
104+
# fi
105+
# done
106+
107+
- name: Build and keygen benchmarks from tagged version
108+
run: |
109+
mkdir -p ./tagged-outputs/benchmarks
110+
for benchmark in benchmarks/guest/*/; do
111+
if [ -f "$benchmark/Cargo.toml" ]; then
112+
benchmark_name=$(basename "$benchmark")
113+
echo "Building and generating keys for benchmark: $benchmark_name"
114+
cd "$benchmark"
115+
cargo openvm build --no-transpile
116+
# TODO(yi): Change --vk-output to --output-dir after v1.3.0 release
117+
mkdir -p "../../../tagged-outputs/benchmarks/$benchmark_name"
118+
cargo openvm keygen --vk-output "../../../tagged-outputs/benchmarks/$benchmark_name/app.vk"
119+
cd ../../..
120+
fi
121+
done
122+
123+
# - name: Compare example verification keys
124+
# run: |
125+
# echo "Comparing example verification keys between base branch and ${{ env.version }}..."
126+
# failed=0
127+
# for example in examples/*/; do
128+
# if [ -f "$example/Cargo.toml" ]; then
129+
# example_name=$(basename "$example")
130+
# echo "Checking example: $example_name"
131+
# if cmp "./base-outputs/examples/$example_name/app.vk" "./tagged-outputs/examples/$example_name/app.vk"; then
132+
# echo "✅ $example_name verification keys are identical"
133+
# else
134+
# echo "❌ $example_name verification keys differ"
135+
# failed=1
136+
# fi
137+
# fi
138+
# done
139+
# if [ $failed -eq 1 ]; then
140+
# echo "❌ Some example verification keys differ - versioning policy violated"
141+
# exit 1
142+
# else
143+
# echo "✅ All example verification keys are identical"
144+
# fi
145+
146+
- name: Compare benchmark verification keys
147+
run: |
148+
echo "Comparing benchmark verification keys between base branch and ${{ env.version }}..."
149+
failed=0
150+
for benchmark in benchmarks/guest/*/; do
151+
if [ -f "$benchmark/Cargo.toml" ]; then
152+
benchmark_name=$(basename "$benchmark")
153+
echo "Checking benchmark: $benchmark_name"
154+
if cmp "./base-outputs/benchmarks/$benchmark_name/app.vk" "./tagged-outputs/benchmarks/$benchmark_name/app.vk"; then
155+
echo "✅ $benchmark_name verification keys are identical"
156+
else
157+
echo "❌ $benchmark_name verification keys differ"
158+
failed=1
159+
fi
160+
fi
161+
done
162+
if [ $failed -eq 1 ]; then
163+
echo "❌ Some benchmark verification keys differ - versioning policy violated"
164+
exit 1
165+
else
166+
echo "✅ All benchmark verification keys are identical"
167+
fi
168+
169+
# Compare all outputs
170+
# TODO: After v1.3.0 release, just compare the contents of ~/.openvm-base
171+
# and ~/.openvm
172+
- name: Compare ~/.openvm contents
173+
run: |
174+
echo "🔍 Comparing ~/.openvm agg and halo2 outputs between base branch and ${{ env.version }}..."
175+
176+
failed=0
177+
178+
# Compare agg.pk with agg_halo2.pk
179+
if cmp ~/.openvm-base/agg.pk ~/.openvm/agg_halo2.pk; then
180+
echo "✅ agg.pk and agg_halo2.pk are identical"
181+
else
182+
echo "❌ agg.pk and agg_halo2.pk differ"
183+
failed=1
184+
fi
185+
186+
# Compare halo2 directories recursively
187+
if diff -r ~/.openvm-base/halo2 ~/.openvm/halo2; then
188+
echo "✅ halo2 directories are identical"
189+
else
190+
echo "❌ halo2 directories differ"
191+
failed=1
192+
fi
193+
194+
if [ $failed -eq 1 ]; then
195+
echo "❌ ~/.openvm outputs differ"
196+
exit 1
197+
else
198+
echo "✅ All checked ~/.openvm outputs are identical"
199+
fi
200+
201+
- name: Final summary
202+
run: |
203+
echo "🎉 Versioning compatibility verification completed successfully!"
204+
echo "✅ Setup outputs are identical between base branch and ${{ env.version }}"
205+
echo "✅ All example verification keys are identical"
206+
echo "✅ All benchmark verification keys are identical"
207+
echo "✅ Versioning policy maintained - patch upgrade is backward compatible"

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/guest/keccak256/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ default = []
1414
[profile.profiling]
1515
inherits = "release"
1616
debug = 2
17+
1718
strip = false
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
[app_vm_config.rv32i]
2+
[app_vm_config.rv32m]
3+
[app_vm_config.io]
4+
[app_vm_config.keccak]
5+
[app_vm_config.sha256]
6+
[app_vm_config.bigint]
7+
8+
[app_vm_config.modular]
9+
supported_moduli = [
10+
"1000000000000000003",
11+
# secp256k1
12+
"115792089237316195423570985008687907853269984665640564039457584007908834671663", # coordinate
13+
"115792089237316195423570985008687907852837564279074904382605163141518161494337", # scalar
14+
# p256
15+
"115792089210356248762697446949407573530086143415290314195533631308867097853951", # coordinate
16+
"115792089210356248762697446949407573529996955224135760342422259061068512044369", # scalar
17+
# bn254 (alt bn128)
18+
"21888242871839275222246405745257275088696311157297823662689037894645226208583", # coordinate
19+
"21888242871839275222246405745257275088548364400416034343698204186575808495617", # scalar
20+
# bls12_381
21+
"4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787", # coordinate
22+
"52435875175126190479447740508185965837690552500527637822603658699938581184513", # scalar
23+
# 2^61 - 1
24+
"2305843009213693951",
25+
"7",
26+
]
27+
28+
[app_vm_config.fp2]
29+
supported_moduli = [
30+
[
31+
"Bn254Fp2",
32+
# bn254 (alt bn128)
33+
"21888242871839275222246405745257275088696311157297823662689037894645226208583",
34+
],
35+
# Bls12_381
36+
[
37+
"Bls12_381Fp2",
38+
"4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787",
39+
],
40+
]
41+
42+
[[app_vm_config.ecc.supported_curves]]
43+
struct_name = "Secp256k1Point"
44+
modulus = "115792089237316195423570985008687907853269984665640564039457584007908834671663"
45+
scalar = "115792089237316195423570985008687907852837564279074904382605163141518161494337"
46+
a = "0"
47+
b = "7"
48+
49+
[[app_vm_config.ecc.supported_curves]]
50+
struct_name = "P256Point"
51+
modulus = "115792089210356248762697446949407573530086143415290314195533631308867097853951"
52+
scalar = "115792089210356248762697446949407573529996955224135760342422259061068512044369"
53+
a = "115792089210356248762697446949407573530086143415290314195533631308867097853948"
54+
b = "41058363725152142129326129780047268409114441015993725554835256314039467401291"
55+
56+
[[app_vm_config.ecc.supported_curves]]
57+
struct_name = "Bn254G1Affine"
58+
modulus = "21888242871839275222246405745257275088696311157297823662689037894645226208583"
59+
scalar = "21888242871839275222246405745257275088548364400416034343698204186575808495617"
60+
a = "0"
61+
b = "3"
62+
63+
[[app_vm_config.ecc.supported_curves]]
64+
struct_name = "Bls12_381G1Affine"
65+
modulus = "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787"
66+
scalar = "52435875175126190479447740508185965837690552500527637822603658699938581184513"
67+
a = "0"
68+
b = "4"
69+
70+
[app_vm_config.pairing]
71+
supported_curves = ["Bn254", "Bls12_381"]
72+

0 commit comments

Comments
 (0)