Closed vmx closed 1 year ago
Just in case, there is an opportunity to omit some redundant casts and mutability. Below harmonizes your code with the abovementioned commit and does the cast ajustments.
index 0f5d412..ec664d1 100644
--- a/src/groth16/prover/supraseal.rs
+++ b/src/groth16/prover/supraseal.rs
@@ -74,9 +74,8 @@ where
let mut input_assignments_ref = Vec::with_capacity(num_circuits);
let mut aux_assignments_ref = Vec::with_capacity(num_circuits);
for i in 0..num_circuits {
- input_assignments_ref
- .push(input_assignments_no_repr[i].as_ptr() as *const _ as *const E::Fr);
- aux_assignments_ref.push(aux_assignments_no_repr[i].as_ptr() as *const _ as *const E::Fr);
+ input_assignments_ref.push(input_assignments_no_repr[i].as_ptr());
+ aux_assignments_ref.push(aux_assignments_no_repr[i].as_ptr());
}
let mut a_ref = Vec::with_capacity(num_circuits);
@@ -105,13 +104,14 @@ where
b_ref.as_slice(),
c_ref.as_slice(),
provers[0].a.len(),
- input_assignments_ref.as_mut_slice(),
- aux_assignments_ref.as_mut_slice(),
+ input_assignments_ref.as_slice(),
+ aux_assignments_ref.as_slice(),
input_assignment_len,
aux_assignment_len,
provers[0].a_aux_density.bv.as_raw_slice(),
provers[0].b_aux_density.bv.as_raw_slice(),
a_aux_density_total,
+ b_input_density_total,
b_aux_density_total,
num_circuits,
r_s.as_slice(),
Thanks a lot for the fix, it works.
Though, if I run it without a GPU being available, then the proof returns a wrong result. I don't know if there's a CPU fallback implemented or not. So in case there is no CPU fallback, I think it should produce an error on proving time, rather then returning a wrong result.
If I should create a separate issue for that, please let me know.
I've pushed new changes to the debug-supraseal-verification
branch. So the instructions above still apply (I suggest really making a fresh checking, I had issues things not updating correctly even with running cargo update
).
If you want to test it without GPU you can run it as:
CUDA_VISIBLE_DEVICES='' RUST_LOG=trace cargo test --lib supraseal --features cuda-supraseal -- --nocapture
to see the failure.
if I run it without a GPU being available, then the proof returns a wrong result.
It's not really a surprise, as there is no CPU fallback and error handling needs more work. We'll get there:-) Thanks for nudging!
I'm seeing a failure (invalid proofs) on CI and locally. I force pushed to debug-supraseal-verification
again.
Many tests work, but the minroot one fails. This is the command to run it:
cargo test --test minroot minroot_test --features cuda-supraseal
It's not really a minimal example, it's just the test we have. The code for the failing test is at https://github.com/filecoin-project/bellperson/blob/4c7c3af45e2ddbbf43347d8c78b2571653338e59/tests/minroot.rs#L172-L219. So if that's too big to debug/find the issue let me know and I'll try to minimize it. My hope would be that even in it's current state it's good enough.
The code for reading the parameters doesn't seem to be the issue, the tests at mimc
use the same code, but they work as expected.
I pushed another commit which should fix the 2 minroot tests. We require 1 more parameter from bellperson, so bellperson will again need to be modified slightly.
Thanks for the really quick fix, I've verified it locally. Now that all bellperson
tests pass, I'm closing this issue. For not having an error when no GPU is available, I've opened a separate issue at https://github.com/supranational/supra_seal/issues/10.
I currently try to add basic sanity tests to
bellperson
to make sure SupraSeal works. Somehow the proofs return wrong results. It's probably a user error from my side, but I don't know what I'm doing wrong. Here are the steps to reproduce:The error is something like
The source for the test is at https://github.com/filecoin-project/bellperson/blob/debug-supraseal-verification/src/groth16/proof.rs#L339-L411. I tried to make it minimal and deterministic as possible.
It passes when using the non-suprasal code path. It can be run via:
Any help would be appreciated.