-
Notifications
You must be signed in to change notification settings - Fork 94
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: Make the circuit constructors field agnostic so we can check circuits on grumpkin #534
Conversation
d0d43b0
to
b570f63
Compare
I reduced scope to only having standard circuits on Grumpkin because ultra circuits require field-agnostic plookup components and I want to prioritise getting Standard Honk on Grumpkin before moving to Ultra (which should be overall similar but would likely require more components in bberg to be templated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks. I'm only asking for cleanup and conversations.
@@ -15,5 +16,6 @@ class BN254 { | |||
using AffineElement = typename Group::affine_element; | |||
using G2AffineElement = typename barretenberg::g2::affine_element; | |||
using G2BaseField = typename barretenberg::fq2; | |||
using Fq12 = barretenberg::fq12; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give this a more generic name like PairingTargetField
or something like this? That way, if we have end up implementing another pairing-friendly curve with possibly a different pairing extension degree (not 12), we will not have to change aliases. It's also more readable for someone looking at the library for the first time. It might also more future-proof to not refer to the name of the prime in the alias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dyt TargetField
is enough? You won't have a target field unless the curve supports pairings.
}; | ||
|
||
using poly_triple = poly_triple_<barretenberg::fr>; | ||
|
||
// TODO: figure out what to do with this... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unresolved TODO. If you conclude this does not need to be handled now, please make a github issue and update the comment to read // TODO(#<issue number>): ...
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cleaned some boilerplatecode as you suggested, thanks for that - my idea is that this is sort of okay to get to MVP with Grumpkin on StandardHonk without much hassle in the rest of the codebase but then should be cleaned up (opened issue 557 for this file); the nicest thing to do imo is have no alias and just make the type for each gate explicit when we refer to them in the codebase. They don't appear in that many places after i did a bit of cleanup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp
Outdated
Show resolved
Hide resolved
cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp
Outdated
Show resolved
Hide resolved
@@ -15,7 +15,7 @@ TEST(ultra_circuit_constructor, create_gates_from_plookup_accumulators) | |||
{ | |||
UltraCircuitConstructor circuit_constructor = UltraCircuitConstructor(); | |||
|
|||
barretenberg::fr input_value = fr::random_element(); | |||
fr input_value = fr::random_element(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this make the file a little less clear? We'll want to find and replace barretenberg::fr
to bn254::fr
at some point in the future, and so I'd rather leave this as it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, this change was trigger by the fact that there's fr almost everywhere and then four places with barretenberg::fr and we are using
the namespace. Should I change all places to barretenberg::fr
?
cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp
Outdated
Show resolved
Hide resolved
cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp
Outdated
Show resolved
Hide resolved
771fc41
to
e901c9c
Compare
ea67137
to
37c4f7d
Compare
Opens issue #557 for addressing TODOs with templating gates. |
d4a8ca6
to
babec93
Compare
…rcuits on grumpkin (AztecProtocol/barretenberg#534) Co-authored-by: maramihali <mara@aztecprotocol.com> Co-authored-by: codygunton <codygunton@gmail.com>
…rcuits on grumpkin (AztecProtocol/barretenberg#534) Co-authored-by: maramihali <mara@aztecprotocol.com> Co-authored-by: codygunton <codygunton@gmail.com>
This PR continues the work of getting Honk over Grumpkin by making the circuit constructors and gates field agnostic and ensuring the
StandardCircuitConstructor
is able to verify basic circuits over Grumpkin.Checklist:
/markdown/specs
have been updated.@brief
describing the intended functionality.