-
Notifications
You must be signed in to change notification settings - Fork 73
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
Small refactoring of challenge-based protocols #1567
base: main
Are you sure you want to change the base?
Conversation
@@ -67,11 +64,6 @@ let lookup: expr, expr[], Fp2<expr>, Fp2<expr>, Constr, expr -> Constr[] = |is_f | |||
|
|||
let (lhs_selector, lhs, rhs_selector, rhs) = unpack_lookup_constraint(lookup_constraint); | |||
|
|||
let _ = assert(len(lhs) == len(rhs), || "LHS and RHS should have equal length"); |
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.
This is guaranteed by the type of Constr::Lookup
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.
But you can work around that by just using the enum manually without the in
operator.
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.
The enum now stores an array of pairs so @georgwiese is right?
let _ = if !is_extension(acc) { | ||
assert(!needs_extension(), || "The Goldilocks field is too small and needs to move to the extension field. Pass two accumulators instead!") | ||
} else { }; |
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.
Done inside fp2_from_array
now.
let next_acc = if is_extension(acc) { | ||
next_ext(acc_ext) | ||
} else { | ||
// The second component is 0, but the next operator is not defined on it... | ||
from_base(acc[0]') | ||
}; |
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.
Seems like this has been fixed in the meantime :)
@@ -111,7 +116,16 @@ let is_extension = |arr| match len(arr) { | |||
}; | |||
|
|||
/// Constructs an extension field element `a0 + a1 * X` from either `[a0, a1]` or `[a0]` (setting `a1`to zero in that case) | |||
let fp2_from_array = |arr| if is_extension(arr) { Fp2::Fp2(arr[0], arr[1]) } else { from_base(arr[0]) }; | |||
let fp2_from_array = |arr| { | |||
let _ = if !is_extension(arr) { |
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 think you don't need let _ =
any more here.
} else { }; | ||
if is_extension(arr) { |
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.
Why not combine those?
Some small refactorings of
lookup.asm
andpermutation.asm
.