This week's puzzle is all about soundness - the requirement of a proof system that it should not be possible to prove false statements.
Here, we use a toy proof system based on BCTV14 which is unsound.
This proof system is intended to allow a prover to show that a certain set of arithmetic constraints is satisfiable. Each constraint is of the form:
If you're familiar with the concept of rank-1 constraint systems, the format of an R1CS constraint may look similar. However, our constraints are much more limited: our kind of constraint system can only describe a very specific kind of arithmetic relations. In particular, it is not universal, since multiplication of variables is not possible. However, we can still prove statements such as 1+1+1+1=4.
Each variable can be represented by a pair of polynomials, one which encodes every time that variable is an input in a constraint, and one polynomial which encodes every time that variable is an output in a constraint.
First, let's fix a domain , one field element for each constraint. (In general, these will be roots of unity; for our purposes, they only need to be distinct from each other)
Then the input polynomial for is defined as a polynomial of degree such that for all , if
where comes from constraint .
We can think of this polynomial as encoding the coefficients of the variable in each constraint.
Similarly, the output polynomial for each variable is defined as a polynomial of degree such that for all
where comes from constraint .
Together with the vanishing polynomial , defined so for all , the polynomials define what we will call the "circuit" for our proving system.
Our succinct proving system requires a trusted setup.
Suppose we have constraints over variables, with polynomials . We use the pairing-friendly BLS12-381 elliptic curve, with groups .
Using the notation and , where is a generator in and is a generator in and refers to scalar multiplication by .
Trusted setup elements | |
---|---|
Powers of tau | |
Input polynomial commitments | |
Input polynomial commitments | |
Output polynomial commitments | |
Output polynomial commitments | |
Vanishing polynomial |
This trusted setup mostly copies the BCTV14 trusted setup, with minor modifications to the constraint format. In theory, the elements of the trusted setup help the verifier check that a proof is properly constructed.
For the puzzle, there was no multi-party computation ceremony, or any other special measures taken; random values of are taken and the trusted setup values computed directly and honestly.
Suppose an assignment of values to the variables satisfies all constraints. Then equality:
must hold, because it simplifies to:
which is simply constraint 1. Therefore, the polynomial equation:
must hold over the entire domain . Further, this polynomial equation holds over the domain if and only if the assignment actually satisfies every constraint; therefore, we can simply prove that this polynomial equation holds over this domain, and then conclude the constraint system is satisfied.
Rearranging everything to the left and denoting it as :
We get that for all . Therefore, is divisible by the vanishing polynomial ; put another way, there exists a polynomial such that .
Therefore, if we compute a polynomial commitment , a verifier should be able to confirm that over the correct domain.
We also compute some additional proof elements, which encode the private inputs and also help the verifier verify this fact:
The final proof is
The given verifier takes in the public inputs . The public inputs get encoded into:
The verifier checks, where is the pairing operation:
The final pairing effectively checks the condition that as required.
The proof system in this puzzle has two soundness bugs; the verifier accepts proofs even when the constraint system is unsatisfiable with given public inputs.
The first bug is an implementation bug. Recall that for variable , the polynomials and were defined as a polynomial of degree with certain values on a domain. In the puzzle, and were interpolated without regard to the resulting degree, which meant that sometimes was degenerate. When this happens for a public input variable, the verifier may ignore this public input.
The correct fix is to ensure that every polynomial is actually degree . This can be achieved by taking the polynomial mod and adding , since is known to be exactly degree . Since zero-knowledge blinding wasn't necessary for this puzzle, this necessary step was omitted.
The second bug is a conceptual bug, based on the one that occurs in BCTV14. The trusted setup includes terms:
which are not used anywhere by the prover or verifier.
However, these elements can be used to alter any valid proof for public input to work for an arbitrary public input:
The proof will verify against the arbitrarily-chosen public input .
The fix for this bug is to remove the unnecessary elements of the trusted setup.