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

Public inputs improvement to Cairo Verifier #727

Open
5 tasks
MauroToscano opened this issue Dec 22, 2023 · 0 comments
Open
5 tasks

Public inputs improvement to Cairo Verifier #727

MauroToscano opened this issue Dec 22, 2023 · 0 comments

Comments

@MauroToscano
Copy link
Collaborator

MauroToscano commented Dec 22, 2023

Currently public inputs are not given a pre verification. The following tasks improve robustness of the verifier:

  • Change the proving mode with a trace to actually use public memory (This may need a small PR to the cairo VM to add a derive deserialize to the public inputs, so we can load it)
  • Add an option to take a compiled program with proof mode from Cairo0, and use that code to check the public memory, enforcing the program used is the given one
  • Add an option to take a Cairo (1) Program as an input. Inside the code should be updated as the Cairo1 Proof Mode in the VM. Then public memory constraints should be applied.
  • Add small checks from the Starkex Verifier (rc min < rc max, etc)
  • Investigate additional checks to be added

For the first task, this is the recommended approach:

We have the public inputs here

https://github.com/lambdaclass/cairo-vm/blob/8f2ddf818f2797cd1a38486b646a09384fd71f9e/vm/src/air_public_input.rs#L59-L68

The VM currently serializes the public inputs in the same format as the old python VM, but can't deserialize because that's something it doesn't need. Now, since we have everything written in rust, it may be easier to just add the deserialize there in the Cairo VM. Most of the work is just adding a Deserialize derive everywhere. If I remember correctly the problem comes here

https://github.com/lambdaclass/cairo-vm/blob/8f2ddf818f2797cd1a38486b646a09384fd71f9e/vm/src/air_public_input.rs#L66-L67

Since layout_params is a reference to something that is not in the public input, Serde can't derive how to create the data type.

We can start by replicating the PublicInput assuming there are no relevant layout params, or that we can write whatever we need ourselves (Like in plain layout). And then add a From method to transform this new struct that can be something like PublicInputForDeserializer, to the real PublicInput. And if we have this it's easy to include in the proof or use them to verify.

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

No branches or pull requests

2 participants