plonk icon indicating copy to clipboard operation
plonk copied to clipboard

TurboComposer: Replace internal `Vec<BlsScalar>` for selectors by `Vec<Constraint>`

Open vlopes11 opened this issue 3 years ago • 0 comments

Describe what you want implemented Every constraint appended to a composer must also push its Constraint instance to an internal vector of constraints.

This will deprecate the multiple selectors that are stored individually as well as self.n that can be trivially replaced by self.constraints.len()

After this is implemented, we should split the sparse store of public inputs by a single vector that will contain the constraint positions that are included with a public input. The value of the public input should not be evaluated because they can be 0 - the criteria is to include a public input index whenever the constraint is constructed with Constraint::public. This sparse public input indexes will be used for the composition of VerifierData. The Constraint should keep the dense public inputs set normally, using zeroes when required.

Describe "Why" this is needed The selectors count must always be equal. This is handled manually in the code and is the source of potential problems. One example is the inclusion of the plonkup that was far harder than necessary because we needed to update every different part of the codebase that added at least one selector.

Also, this will greatly facilitate future API improvements regarding the wired witnesses and circuit description.

Describe alternatives you've considered N/A

Additional context N/A

vlopes11 avatar Oct 08 '21 10:10 vlopes11