Skip to content

Generate public inputs for verifier also via ConstraintSystem API #341

Open
@Pratyush

Description

@Pratyush

Problem Definition

Right now, when the verifier needs to verify the public input, they have to implement and call ToConstraintField on the input. This is error prone for two reasons:

  • the order of calling ToConstraintField on various parts of the public input must match exactly the order of new_input calls in the ConstraintSynthesizer.
  • the impl inside ToConstraintField must match that of new_input exactly, leading to another source of errors.

Proposal

I propose that we instead leverage the existing ConstraintSystem API to generate these inputs: we add a Verifier variant to the Mode enum, which generates variable assignments only for instance/input variables.

My only worry is that this could cause extra memory/computation for the verifier, but we can at least try it and see. I have two ideas to minimize this overhead:

  • a way to minimize these costs alternative would be to provide ConstraintSynthesizer with a finalize_public_input_generation method that allows it to specify when it has completed generating public inputs, so that it can early return.

  • Make a related instantiation of ConstraintSynthesizer that only generates public inputs, and does not have the rest of the circuit logic. This is still better than the ToConstraintField idea because it is easy to match up the new_input statements on both sides.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-designType: discuss API design and/or researchT-featureType: new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions