You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When creating a circuit that is valid in itself but differs from the circuit from the circuit description by adding public inputs to the constraints, the proof creation is successful.
To Reproduce
if applicable add a minimum reproducible example
use dusk_plonk::prelude::*;use rand::rngs::StdRng;use rand::SeedableRng;constCAPACITY:usize = 1 << 4;constLABEL:&[u8] = b"check_public_inputs";#[derive(Default)]pubstructTestPI{public:Vec<BlsScalar>,sum:BlsScalar,}implTestPI{pubfnnew(public:Vec<BlsScalar>,sum:BlsScalar) -> Self{Self{ public, sum }}}implCircuitforTestPI{fncircuit<C>(&self,composer:&mutC) -> Result<(),Error>whereC:Composer,{// this circuit will always have the same amount of gates but different// amount of public inputs, depending on the struct dataletmut sum = C::ZERO;for i in0..2{let constraint = match i < self.public.len(){true => Constraint::new().left(1).a(sum).right(1).b(C::ONE).public(self.public[i]),false => Constraint::new().left(1).a(sum).right(1).b(C::ONE),};
sum = composer.gate_add(constraint);}let expected_sum = composer.append_witness(self.sum);
composer.assert_equal(sum, expected_sum);Ok(())}}#[test]fnpublic_inputs(){let rng = &mutStdRng::seed_from_u64(0x10b);let pp = PublicParameters::setup(CAPACITY, rng).expect("Creation of public parameter shouldn't fail");// compiling the default version of TestPI, which has no pilet(prover, _verifier) = Compiler::compile::<TestPI>(&pp,LABEL).expect("It should be possible to compile the prover and verifier");// Create circuit with public inputslet pi:Vec<BlsScalar> = [BlsScalar::one();2].into();let sum = BlsScalar::from(4);let circuit = TestPI::new(pi, sum);let result = prover.prove(rng,&circuit);assert_eq!(
result,
Err(Error::PublicInputNotFound{ index: 0}),
"proof creation for different sized circuit shouldn't be possible");}
Expected behaviour
This is a minor bug since a Verifier, that doesn't expect public input, won't verify a proof that needs public input. Nevertheless, the proof creation shouldn't be possible for a circuit that doesn't match the circuit description of the Prover.
The text was updated successfully, but these errors were encountered:
Describe the bug
When creating a circuit that is valid in itself but differs from the circuit from the circuit description by adding public inputs to the constraints, the proof creation is successful.
To Reproduce
if applicable add a minimum reproducible example
Expected behaviour
This is a minor bug since a
Verifier
, that doesn't expect public input, won't verify a proof that needs public input. Nevertheless, the proof creation shouldn't be possible for a circuit that doesn't match the circuit description of theProver
.The text was updated successfully, but these errors were encountered: