Skip to content
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

Starky proof failing to verify recursively #1631

Open
armanthepythonguy opened this issue Oct 15, 2024 · 5 comments
Open

Starky proof failing to verify recursively #1631

armanthepythonguy opened this issue Oct 15, 2024 · 5 comments

Comments

@armanthepythonguy
Copy link
Contributor

I am trying to verify a starky proof inside a plonky2 circuit. I have followed the same procedure as per the FibonacciStark.rs file, but I am getting error :-

I have my custom Starky proof, which can be successfully proved and verified with prove and verify functions but fails during recursive verification.

thread 'dense::tests::test_stark_recursive' panicked at src/dense.rs:115:70:
called Result::unwrap() on an Err value: Partition containing Wire(Wire { row: 53, column: 40 }) was set twice with different values: 5380601374886916272 != 11172169064086565555
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
test dense::tests::test_stark_recursive ... FAILED

@armanthepythonguy
Copy link
Contributor Author

Here's some code snippets :-

fn recursive_verifier(stark: DenseStark, proof: StarkProofWithPublicInputs<F,C,D>, inner_config: &StarkConfig) -> Result<()>{

        let circuit_config = CircuitConfig::standard_recursion_config();
        let mut builder = CircuitBuilder::<F, D>::new(circuit_config);

        let mut pw: PartialWitness<F> = PartialWitness::new();
        let degree_bits = proof.proof.recover_degree_bits(inner_config);

        println!("{:?}", degree_bits);

        let pt = add_virtual_stark_proof_with_pis(&mut builder, &stark, inner_config, degree_bits, 0, 0);
        set_stark_proof_with_pis_target(&mut pw, &pt, &proof, builder.zero())?;

        verify_stark_proof_circuit::<F, C, DenseStark, D>(&mut builder, stark, pt, inner_config);
        
        let data = builder.build::<C>();
        let proof = data.prove(pw)?;
        data.verify(proof)
    }

Also

let trace = stark.generate_trace(pub_inputs.to_vec());
        println!(
            "Duration to generate trace :- {}",
            start.elapsed().as_millis()
        );

        start = Instant::now();
        let (proof, layer_sign) = stark.prove(pub_inputs.to_vec(), trace, *inputs.last().unwrap());
        println!(
            "Duration to generate proof :- {}",
            start.elapsed().as_millis()
        );
        recursive_verifier(stark, proof, &StarkConfig::standard_fast_config())

@Nashtare
Copy link
Collaborator

Hello,
can we have access to the code that generated this error, along with the version of plonky2 / starky you used and the command you used? Thank you.

@armanthepythonguy
Copy link
Contributor Author

Here you can find all the relevant codes, also let me know if you want more details, I will add you as a collaborator to the repo.
https://gist.github.com/armanthepythonguy/2e5a7240f82c3fec4207ab6aa1fbd71f

@armanthepythonguy
Copy link
Contributor Author

Also, I would want to learn more about the constraint degree function used while defining the starky circuits. I have seen many examples where we have used values either 2 or 3, Can you please guide me into the relevance of the constraint degree and if any docs you can share

@armanthepythonguy
Copy link
Contributor Author

Any updates @Nashtare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants