-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does StarkProof.verify
return two felts?
#48
Comments
Like what if my use case is:
With the current impl, I cannot run checks upon the public output myself. |
Hi I understand your use-case, the way that hashing output makes sense is to assert that output is not growing indefinitely in recursion schemes that leverage verification of previous layers. |
@tdelabro we could add optional return of raw output, let me know if we should support it, do u wanna contribute? |
I would make it a separate method rather than an optional argument, but yeah it would be nice. I'm not sure I will find time for it, don't rely on me sorry :) |
let output_len: usize = (output_stop - output_start).to_bigint().try_into()?;
let output = &memory[memory.len() - output_len * 2..];
let hash = output.iter().skip(1).step_by(2).fold(FELT_0, |acc, e| pedersen_hash(&acc, e));
let output_hash = pedersen_hash(&hash, &Felt::from(output_len)); Also, this code is very obscure. Why |
If you don't add the method that returns the full output, you should at least give me a function that allows me to pass my expected output as an argument and return the hash computed the way you are doing it. The same probably applies to computing the program hash. let hash = program.iter().fold(FELT_0, |acc, &e| pedersen_hash(&acc, e));
let program_hash = pedersen_hash(&hash, &Felt::from(program.len())); |
output_start and output_stop are the addresses of the memory so we calculate output_len and mul it by 2 to traverse the correct amount of elems in serialized memory |
Okay, thanks a lot for the explanation. Now I'm able to write my hashing of the outputs to match yours, but I still think it would be better if you provide it yourselves in some |
@Okm165 I can take this one now if you want. I have to code it locally anyway |
https://docs.rs/swiftness/latest/swiftness/types/struct.StarkProof.html#method.verify
I understand the first one is the program hash, which make sense, and that the second is the hash of the public output. Which doesn't totally make sense to me. Why this choice rather than returning the full output?
The text was updated successfully, but these errors were encountered: