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

feat: Goblin recursive verifier #1822

Merged
merged 13 commits into from
Sep 5, 2023
Merged

Conversation

ledwards2225
Copy link
Contributor

Updates the existing Ultra recursive verifier to allow for goblinized group operations. (Currently limited to batch_mul)

Checklist:

Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.

  • If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag.
  • I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code.
  • Every change is related to the PR description.
  • I have linked this pull request to relevant issues (if any exist).

@iAmMichaelConnor iAmMichaelConnor added the crypto cryptography label Aug 26, 2023
@ledwards2225 ledwards2225 force-pushed the lde/goblin_recursive_verifier branch from 6d654db to 3d95476 Compare August 28, 2023 17:32
auto op_tuple = builder->queue_ecc_mul_accum(point.get_value(), scalar.get_value());

// Adds constraints demonstrating proper decomposition of point coordinates.
// Note: may need to do point.x.assert_is_in_field() prior to the assert_eq() according to Kesha.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mental model I have for assert equal is "this is a memcpy but for circuits", in particular:

  • memcpy does not assert things are equal
  • and memcpy(a,b) is not the same as memcpy(b,a)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm yeah taking a closer look there is a big DO NOT USE IN CIRCUITS warning. Definitely don't understand the details here but it's on the list of things to figure out. Either way the fact that this mistake can be made is a bad sign

@ledwards2225 ledwards2225 force-pushed the lde/goblin_recursive_verifier branch 3 times, most recently from 67eefe8 to d9d2b0c Compare September 1, 2023 13:33
// achieved through a builder Simulator, the stdlib codepath should become the only codepath.
if constexpr (Curve::is_stdlib_type) {
std::vector<GroupElement> commitments = { batched_f, batched_g };
auto one = Fr::from_witness(r.get_context(), 1);
Copy link
Contributor

@Rumata888 Rumata888 Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a non-constrained witness, so one can become anything. You probably just wanted Fr(1).

Copy link
Contributor Author

@ledwards2225 ledwards2225 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to Fr(ctx, 1); so that the builder can be used correctly in the naf decomp in batch_mul.

lhs -= GroupElement::one(ctx) * claim.opening_pair.evaluation;
}
auto builder = verifier_transcript.builder;
auto one = Fr::from_witness(builder, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue with one being an unconstrained witness

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

for (const auto& val : vanishing_evals) {
inverse_vanishing_evals.emplace_back(val.invert());
auto builder = nu.get_context();
evaluation_zero = Fr::from_witness(builder, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same constraint issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

// [G] = [Q] - ∑ⱼ ρʲ / ( r − xⱼ )⋅[fⱼ] + G₀⋅[1]
// = [Q] - [∑ⱼ ρʲ ⋅ ( fⱼ(X) − vⱼ) / ( r − xⱼ )]
commitments.emplace_back(Q_commitment);
scalars.emplace_back(Fr::from_witness(builder, 1)); // Fr(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here, too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

{}

template <typename Flavor>
UltraRecursiveVerifier_<Flavor>& UltraRecursiveVerifier_<Flavor>::operator=(UltraRecursiveVerifier_&& other) noexcept
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you delete these? Just curious, not a comment on the decision

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not currently in use and it's not clear they will be needed. I prefer to implement them and check their correctness as needed rather than leave them around to be used incorrectly.

Copy link
Contributor

@Rumata888 Rumata888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good, I'm just worried about the from_witness issue.

@ledwards2225 ledwards2225 force-pushed the lde/goblin_recursive_verifier branch from d9d2b0c to e52d884 Compare September 5, 2023 18:59
@ledwards2225 ledwards2225 force-pushed the lde/goblin_recursive_verifier branch from b7ae155 to 05e872f Compare September 5, 2023 19:41
Copy link
Contributor

@Rumata888 Rumata888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ledwards2225 ledwards2225 merged commit f962cb6 into master Sep 5, 2023
@ledwards2225 ledwards2225 deleted the lde/goblin_recursive_verifier branch September 5, 2023 22:31
spypsy pushed a commit that referenced this pull request Sep 6, 2023
🤖 I have created a new Aztec Packages release
---


##
[0.1.0-alpha60](v0.1.0-alpha59...v0.1.0-alpha60)
(2023-09-06)


### Features

* Goblin recursive verifier
([#1822](#1822))
([f962cb6](f962cb6))
* initial `is_valid` eip1271 style wallet + minimal test changes
([#1935](#1935))
([f264c54](f264c54))


### Bug Fixes

* benchmark git repo
([#2041](#2041))
([3c696bb](3c696bb))
* cli canary & deployment
([#2053](#2053))
([1ddd24a](1ddd24a))
* **rpc:** Fixes getNodeInfo serialisation
([#1991](#1991))
([0a29fa8](0a29fa8))


### Miscellaneous

* **circuits:** - use msgpack for cbind routines of native private
kernel circuits
([#1938](#1938))
([3dc5c07](3dc5c07))
* **docs:** API docs stucture
([#2014](#2014))
([9aab9dd](9aab9dd))
* Update function selector computation
([#2001](#2001))
([e07ea1a](e07ea1a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto cryptography
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants