o1js: process hangs when verifying proof read&deserialized from file
Original issue at Discord: https://discord.com/channels/484437221055922177/1204071024191082496
All the code at https://github.com/TokeniZK/zkapp-test/tree/main/src tried with o1js version: 0.15.2, 0.15.4, & 0.16.0
Reproduce steps:
I have a demo zkProgram(https://github.com/TokeniZK/zkapp-test/blob/main/src/zkprogram.ts),
step1: npm run step1
(seen at /src/step1.ts) I exec one method & gen proof, then serialize the proof into file: proof.json . and then read&deserialize it from file and verify it and smoothly get the result: True.
However,
step2: (seen at /src/step2.ts) npm run step2
I start another process to read the proof from the file on step1(proof.json), deserialize it and try to verify the proof, But the process keep await at verify(*) line !!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 28 (8 by maintainers)
We’re not pre-generating the langrange basis that we need before running the verifier. When we find it missing, the rust code panics, and WASM treats the panic as a halt. The main thread hangs waiting for the dead thread.
Will post a fix soon.
Hey @SebastienGllmt, @andrewferrone, @kadirchan and others. We just released o1js version 1.9.0 which should fix this issue! Please re-open this issue if it is still not working for you 😃
Using compile({ forceRecompile: true }) fixes it
Fair enough. We are working on this and prioritizing the fix. The work around should unblock many users, but I agree it’s not a suitable solution for your use case.
@andrewferrone, the best workaround at the moment is to compile an empty zk program, then use a cached proof from disk.
For instance
createProof()appends its definition to the file after the first run (perhaps too cute…)@Yoga2015 I cloned your repo zkapp-test and upgraded to o1js 1.6.0 and found that both scripts work
Thanks for the great analysis @SpaceManiac
Seems that ‘verify()’ relies on some values computed during compilation, and isn’t able to get them from a cache. We need to fix this!
Running in to the same problem with the dynamic
verifymethod. It seems the workaround is to eitherforceRecompile: trueorcache: Cache.Noneany program at all before attempting to verify proofs. It doesn’t have to be the same program you’re verifying proofs for.Single-file repro. Will succeed on first run, hang on second run, and can be fixed by changing
falsetotrueon line 4.