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

Refactor Gadget definition strategy to treat it as a Gate or Collection of Gates #102

Open
CPerezz opened this issue Jan 28, 2022 · 0 comments
Assignees
Labels
D-medium Difficulty: medium P-medium Priority: medium T-design Type: discuss API design and/or research T-refactor Type: cleanup/refactor T-test Type: test improvements

Comments

@CPerezz
Copy link
Contributor

CPerezz commented Jan 28, 2022

With this change, it would be possible to add &str definitions for each gate created which can be used for debugging purposes later on.

The idea is to end up with something much closer and that is better handled in other libs such as Halo2 which looks like:

meta.create_gate("R1CS constraint", |meta| {
             let a = meta.query_advice(a, Rotation::cur());
             let b = meta.query_advice(b, Rotation::cur());
             let c = meta.query_advice(c, Rotation::cur());
             let s = meta.query_selector(s);

             // BUG: Should be a * b - c
             Some(("buggy R1CS", s * (a * b + c)))
         });

Which enables producing better err messages while debugging like:

Err(vec![VerifyFailure::ConstraintNotSatisfied {
constraint: ((0, "R1CS constraint").into(), 0, "buggy R1CS").into(),
location: FailureLocation::InRegion {
region: (0, "Example region").into(),
offset: 0,
},

That overall should help to:

@CPerezz CPerezz added D-medium Difficulty: medium P-medium Priority: medium T-design Type: discuss API design and/or research T-refactor Type: cleanup/refactor T-test Type: test improvements labels Jan 28, 2022
@CPerezz CPerezz self-assigned this Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-medium Difficulty: medium P-medium Priority: medium T-design Type: discuss API design and/or research T-refactor Type: cleanup/refactor T-test Type: test improvements
Projects
None yet
Development

No branches or pull requests

1 participant