-
Notifications
You must be signed in to change notification settings - Fork 1
364 lines (303 loc) · 15.3 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
name: CI Checks
on:
push:
branches: [main, develop]
pull_request:
jobs:
cargo-test:
name: cargo test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust Toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
sudo apt install -y build-essential libbenchmark-dev libomp-dev libgmp-dev nlohmann-json3-dev nasm libsodium-dev cmake
- name: Install pil2-stark
working-directory: pil2-stark
run: |
git submodule update --init --recursive
git submodule update
make clean
make starks_lib -j
make -j bctree
- name: cargo test
run: cargo test --workspace --features no_lib_link
cargo-check:
name: cargo check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Set up Rust Toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
cargo-fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust Toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: cargo fmt
run: cargo fmt -- --check
cargo-fix:
name: cargo fix
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Set up Rust Toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: cargo fix --workspace
run: |
# Run cargo fix on the project
cargo fix --workspace --features no_lib_link --allow-dirty --allow-staged
# Check for local git changes
if ! git diff --exit-code; then
echo "There are local changes after running 'cargo fix --workspace' ❌"
exit 1
else
echo "No changes detected after running 'cargo fix --workspace' ✅"
fi
cargo-clippy:
name: cargo clippy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Set up Rust Toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Modify stark-prover-lib
run: sed -i 's/default = \[\]/default = \["no_lib_link"\]/g' ./provers/starks-lib-c/Cargo.toml
- name: cargo clippy
run: cargo clippy --workspace --features no_lib_link -- -D warnings
cargo-audit:
name: cargo audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Set up Rust Toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: install cargo-audit
run: cargo install cargo-audit
- name: cargo audit
run: cargo audit
tests:
name: Test fibonacci square && std
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Install npm
run: npm install -g npm
- name: Check npm version
run: npm --version
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install z3-solver
run: |
python -m pip install z3-solver
- name: Check out pil2-proofman-js
uses: actions/checkout@v4
with:
repository: 0xPolygonHermez/pil2-proofman-js
token: ${{ secrets.ZISK_CI_TOKEN }}
ref: 0.0.6
path: pil2-proofman-js
- name: Install pil2-proofman-js dependencies
working-directory: pil2-proofman-js
run: npm install
- name: Check out pil2-compiler
uses: actions/checkout@v4
with:
repository: 0xPolygonHermez/pil2-compiler
token: ${{ secrets.GITHUB_TOKEN }}
ref: develop
path: pil2-compiler
- name: Install pil2-compiler dependencies
working-directory: pil2-compiler
run: npm install
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
sudo apt install -y build-essential libbenchmark-dev libomp-dev libgmp-dev nlohmann-json3-dev nasm libsodium-dev cmake
- name: Install pil2-stark
working-directory: pil2-stark
run: |
git submodule update --init --recursive
make clean
make starks_lib -j
make -j bctree
- name: Modify Cargo.toml std
run: |
sed -i 's/# *"pil2-components\/lib\/std\/rs"/"pil2-components\/lib\/std\/rs"/' ./Cargo.toml
- name: Modify Cargo.toml std lookup
run: |
sed -i 's/# *"pil2-components\/test\/std\/lookup\/rs"/"pil2-components\/test\/std\/lookup\/rs"/' ./Cargo.toml
- name: Modify Cargo.toml std permutation
run: |
sed -i 's/# *"pil2-components\/test\/std\/permutation\/rs"/"pil2-components\/test\/std\/permutation\/rs"/' ./Cargo.toml
- name: Modify Cargo.toml std connection
run: |
sed -i 's/# *"pil2-components\/test\/std\/connection\/rs"/"pil2-components\/test\/std\/connection\/rs"/' ./Cargo.toml
- name: Modify Cargo.toml std range-check
run: |
sed -i 's/# *"pil2-components\/test\/std\/range_check\/rs"/"pil2-components\/test\/std\/range_check\/rs"/' ./Cargo.toml
- name: Modify Cargo.toml std simple
run: |
sed -i 's/# *"pil2-components\/test\/simple\/rs"/"pil2-components\/test\/simple\/rs"/' ./Cargo.toml
- name: Modify Cargo.toml Fibonacci Square
run: |
sed -i 's/# *"examples\/fibonacci-square"/"examples\/fibonacci-square"/' ./Cargo.toml
- name: Compile PIL Fibonacci Square
run: |
node pil2-compiler/src/pil.js ./examples/fibonacci-square/pil/build.pil -I ./pil2-components/lib/std/pil -o ./examples/fibonacci-square/pil/build.pilout
- name: Generate setup Fibonacci Square
run: |
node pil2-proofman-js/src/main_setup.js -a ./examples/fibonacci-square/pil/build.pilout -b ./examples/fibonacci-square/build -t pil2-stark/build/bctree
- name: Generate PIL Helpers Fibonacci Square
run: |
cargo run --bin proofman-cli pil-helpers --pilout ./examples/fibonacci-square/pil/build.pilout --path ./examples/fibonacci-square/src -o
- name: Create dir build lookup
run: |
mkdir -p ./pil2-components/test/std/lookup/build/
- name: Compile PIL Lookup
run: |
node pil2-compiler/src/pil.js ./pil2-components/test/std/lookup/lookup.pil -I ./pil2-components/lib/std/pil -o ./pil2-components/test/std/lookup/build/build.pilout
- name: Generate setup Lookup
run: |
node pil2-proofman-js/src/main_setup.js -a ./pil2-components/test/std/lookup/build/build.pilout -b ./pil2-components/test/std/lookup/build -t pil2-stark/build/bctree
- name: Generate PIL Helpers Lookup
run: |
cargo run --bin proofman-cli pil-helpers --pilout ./pil2-components/test/std/lookup/build/build.pilout --path ./pil2-components/test/std/lookup/rs/src -o
- name: Create dir build permutation
run: |
mkdir -p ./pil2-components/test/std/permutation/build/
- name: Compile PIL permutation
run: |
node pil2-compiler/src/pil.js ./pil2-components/test/std/permutation/permutation.pil -I ./pil2-components/lib/std/pil -o ./pil2-components/test/std/permutation/build/build.pilout
- name: Generate setup permutation
run: |
node pil2-proofman-js/src/main_setup.js -a ./pil2-components/test/std/permutation/build/build.pilout -b ./pil2-components/test/std/permutation/build -t pil2-stark/build/bctree
- name: Generate PIL Helpers permutation
run: |
cargo run --bin proofman-cli pil-helpers --pilout ./pil2-components/test/std/permutation/build/build.pilout --path ./pil2-components/test/std/permutation/rs/src -o
- name: Create dir build connection
run: |
mkdir -p ./pil2-components/test/std/connection/build/
- name: Compile PIL connection
run: |
node pil2-compiler/src/pil.js ./pil2-components/test/std/connection/connection.pil -I ./pil2-components/lib/std/pil -o ./pil2-components/test/std/connection/build/build.pilout
- name: Generate setup connection
run: |
node pil2-proofman-js/src/main_setup.js -a ./pil2-components/test/std/connection/build/build.pilout -b ./pil2-components/test/std/connection/build -t pil2-stark/build/bctree
- name: Generate PIL Helpers connection
run: |
cargo run --bin proofman-cli pil-helpers --pilout ./pil2-components/test/std/connection/build/build.pilout --path ./pil2-components/test/std/connection/rs/src -o
- name: Create dir build range-check
run: |
mkdir -p ./pil2-components/test/std/range_check/build/
- name: Compile PIL range-check
run: |
node pil2-compiler/src/pil.js ./pil2-components/test/std/range_check/build.pil -I ./pil2-components/lib/std/pil -o ./pil2-components/test/std/range_check/build/build.pilout
- name: Generate setup range-check
run: |
node pil2-proofman-js/src/main_setup.js -a ./pil2-components/test/std/range_check/build/build.pilout -b ./pil2-components/test/std/range_check/build -t pil2-stark/build/bctree
- name: Generate PIL Helpers range-check
run: |
cargo run --bin proofman-cli pil-helpers --pilout ./pil2-components/test/std/range_check/build/build.pilout --path ./pil2-components/test/std/range_check/rs/src -o
- name: Create dir build simple
run: |
mkdir -p ./pil2-components/test/simple/build/
- name: Compile PIL simple
run: |
node pil2-compiler/src/pil.js ./pil2-components/test/simple/simple.pil -I ./pil2-components/lib/std/pil -o ./pil2-components/test/simple/build/build.pilout
- name: Generate setup simple
run: |
node pil2-proofman-js/src/main_setup.js -a ./pil2-components/test/simple/build/build.pilout -b ./pil2-components/test/simple/build -t pil2-stark/build/bctree
- name: Generate PIL Helpers simple
run: |
cargo run --bin proofman-cli pil-helpers --pilout ./pil2-components/test/simple/build/build.pilout --path ./pil2-components/test/simple/rs/src -o
- name: Cargo build
run: RUST_BACKTRACE=1 cargo build -v
- name: Verify constraints Fibonacci Square
run: |
cargo run --bin proofman-cli verify-constraints --witness-lib ./target/debug/libfibonacci_square.so --proving-key examples/fibonacci-square/build/provingKey/ --public-inputs examples/fibonacci-square/src/inputs.json
- name: Generate proof Fibonacci Square
run: |
cargo run --bin proofman-cli prove --witness-lib ./target/debug/libfibonacci_square.so --proving-key examples/fibonacci-square/build/provingKey/ --public-inputs examples/fibonacci-square/src/inputs.json --output-dir examples/fibonacci-square/build/proofs -d
- name: Verify proof Fibonacci Square
run: |
node pil2-proofman-js/src/main_verify -k examples/fibonacci-square/build/provingKey -p examples/fibonacci-square/build/proofs
- name: Verify constraints Lookup
run: |
cargo run --bin proofman-cli verify-constraints --witness-lib ./target/debug/liblookup.so --proving-key ./pil2-components/test/std/lookup/build/provingKey
- name: Generate proof Lookup
run: |
cargo run --bin proofman-cli prove --witness-lib ./target/debug/liblookup.so --proving-key ./pil2-components/test/std/lookup/build/provingKey --output-dir ./pil2-components/test/std/lookup/build -d
- name: Verify proof Lookup
run: |
node pil2-proofman-js/src/main_verify -k ./pil2-components/test/std/lookup/build/provingKey -p ./pil2-components/test/std/lookup/build
- name: Verify constraints permutation
run: |
cargo run --bin proofman-cli verify-constraints --witness-lib ./target/debug/libpermutation.so --proving-key ./pil2-components/test/std/permutation/build/provingKey
- name: Generate proof permutation
run: |
cargo run --bin proofman-cli prove --witness-lib ./target/debug/libpermutation.so --proving-key ./pil2-components/test/std/permutation/build/provingKey --output-dir ./pil2-components/test/std/permutation/build -d
- name: Verify proof permutation
run: |
node pil2-proofman-js/src/main_verify -k ./pil2-components/test/std/permutation/build/provingKey -p ./pil2-components/test/std/permutation/build
- name: Verify constraints connection
run: |
cargo run --bin proofman-cli verify-constraints --witness-lib ./target/debug/libconnection.so --proving-key ./pil2-components/test/std/connection/build/provingKey
- name: Generate proof connection
run: |
cargo run --bin proofman-cli prove --witness-lib ./target/debug/libconnection.so --proving-key ./pil2-components/test/std/connection/build/provingKey --output-dir ./pil2-components/test/std/connection/build -d
- name: Verify proof connection
run: |
node pil2-proofman-js/src/main_verify -k ./pil2-components/test/std/connection/build/provingKey -p ./pil2-components/test/std/connection/build
- name: Verify constraints range-check
run: |
cargo run --bin proofman-cli verify-constraints --witness-lib ./target/debug/librange_check.so --proving-key ./pil2-components/test/std/range_check/build/provingKey
- name: Generate proof range-check
run: |
cargo run --bin proofman-cli prove --witness-lib ./target/debug/librange_check.so --proving-key ./pil2-components/test/std/range_check/build/provingKey --output-dir ./pil2-components/test/std/range_check/build -d
- name: Verify proof range-check
run: |
node pil2-proofman-js/src/main_verify -k ./pil2-components/test/std/range_check/build/provingKey -p ./pil2-components/test/std/range_check/build
- name: Verify constraints simple
run: |
cargo run --bin proofman-cli verify-constraints --witness-lib ./target/debug/libsimple.so --proving-key ./pil2-components/test/simple/build/provingKey
- name: Generate proof simple
run: |
cargo run --bin proofman-cli prove --witness-lib ./target/debug/libsimple.so --proving-key ./pil2-components/test/simple/build/provingKey --output-dir ./pil2-components/test/simple/build -d
- name: Verify proof simple
run: |
node pil2-proofman-js/src/main_verify -k ./pil2-components/test/simple/build/provingKey -p ./pil2-components/test/simple/build