Skip to content

Commit 30635bd

Browse files
authored
chore: preparing for WASM JS verifier (#43)
## What ❔ * changes to make verifier work with wasm (fixed missing function and u32) * updated zksyncos app.bin * cli tool to return a program_proof file when running in recursion mode (which can later be sent to the browser) ## Why ❔ * preparing for verifier to run in WASM.
1 parent 24f5349 commit 30635bd

File tree

6 files changed

+50
-4
lines changed

6 files changed

+50
-4
lines changed

examples/zksync_os/README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,28 @@ This directory contains a binary built from ZKsyncOS repo.
55
In the future, we should have a proper release pipeline there, so this will no longer be needed.
66

77

8-
Binary built from a80140023d856c4fbe400c810291be474ad72cfe (May 16).
8+
Binary built from 607e52db0e10b4bbce9cd163169c15f59a075a5a (tag: 0.0.1 + fix from PR-40) (June 6).
99

1010

1111
To rebuild:
1212
* checkout zksync-os repo
13-
* cd zksync_os && ./dump_bin.sh
13+
* cd zksync_os && ./dump_bin.sh
14+
* cp app.bin zksync-airbender/examples/zksync_os/app.bin
15+
16+
And in this repo:
17+
18+
```
19+
cargo run --release -p cli generate-vk --bin app.bin --machine standard --output app.vk.json
20+
```
21+
22+
You can also run:
23+
```
24+
cargo run --release -p cli generate-constants app.bin --universal-verifier
25+
```
26+
27+
to see the final verification keys:
28+
29+
```
30+
End params: [450952736, 266097338, 57980520, 3983253845, 3619491068, 640210741, 3659638418, 635428486]
31+
Aux values: [1395365915, 2489455614, 2042893390, 2587610735, 4249872676, 4254236201, 368137084, 3216712393]
32+
```

examples/zksync_os/app.bin

7.31 KB
Binary file not shown.

examples/zksync_os/app.vk.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"machine_type": "Standard",
3+
"bytecode_hash_hex": "abf94b03527ec9f5d7b81cccd79f48948316328f935cda9ed1c1911c97c53074",
4+
"params": [
5+
1018317561,
6+
3153643269,
7+
3950945865,
8+
594785374,
9+
205095070,
10+
139114645,
11+
1195938554,
12+
71465671
13+
],
14+
"params_hex": "3cb24af9bbf8c705eb7ea6492373b45e0c39809e084ab895474892fa04427ac7"
15+
}

fft/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ unsafe fn prefetch_next_line(ptr: *const Mersenne31Field) {
5858
_mm_prefetch(ptr as *const i8, _MM_HINT_ET0);
5959
}
6060

61+
#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))]
62+
#[inline(always)]
63+
unsafe fn prefetch_next_line(ptr: *const Mersenne31Field) {}
64+
6165
use std::time::Instant;
6266
pub struct Timer {
6367
starting_time: Instant,

fft/src/row_major/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn adjust_to_zero_c0_var_length<const N: usize, A: Allocator + Clone>(
3131
assert!(columns_range.end <= trace_columns.width());
3232
let trace_len = trace_columns.len();
3333
// assert no u64 overflow
34-
assert!(worker.num_cores * trace_len < (1 << 32));
34+
assert!((worker.num_cores as u64) * (trace_len as u64) < (1u64 << 32));
3535
let num_chunks = worker.get_geometry(trace_len - 1).len();
3636
let mut per_thread_accumulators = vec![vec![0u64; columns_range.len()]; num_chunks];
3737

tools/cli/src/prover_utils.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,15 @@ pub fn create_proofs(
310310
serialize_to_file(
311311
&recursion_proof_metadata,
312312
&Path::new(output_dir).join("metadata.json"),
313-
)
313+
);
314+
let program_proof = program_proof_from_proof_list_and_metadata(
315+
&recursion_proof_list,
316+
&recursion_proof_metadata,
317+
);
318+
serialize_to_file(
319+
&program_proof,
320+
&Path::new(output_dir).join("recursion_program_proof.json"),
321+
);
314322
}
315323
ProvingLimit::FinalProof => {
316324
let program_proof =

0 commit comments

Comments
 (0)