-
Notifications
You must be signed in to change notification settings - Fork 78
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
Allow different degrees in witgen #1460
Conversation
tests failing |
let mut namespace = | ||
AbsoluteSymbolPath::default().join(SymbolPath::from_str(name).unwrap()); | ||
let name = namespace.pop().unwrap(); | ||
if namespace != current_namespace { |
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.
Should we add an assertion that the degree is the same within a namespace?
ast/src/analyzed/mod.rs
Outdated
} | ||
|
||
/// Returns the set of all degrees in this [`Analyzed<T>`]. |
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.
Symbols without explicit degree are ignored.
ast/src/analyzed/mod.rs
Outdated
@@ -45,10 +44,28 @@ pub struct Analyzed<T> { | |||
} | |||
|
|||
impl<T> Analyzed<T> { | |||
/// @returns the degree if any. Panics if there is none. | |||
/// Returns the common degree in this [`Analyzed<T>`]. |
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.
/// Returns the common degree in this [`Analyzed<T>`]. | |
/// Returns the degree common among all symbols that have an explicit degree. |
backend/src/estark/bin_exporter.rs
Outdated
} | ||
|
||
for i in 0..degree { | ||
for (_name, constant) in polys { |
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.
constant
?
backend/src/estark/mod.rs
Outdated
@@ -65,18 +67,18 @@ fn create_stark_struct(degree: DegreeType, hash_type: &str) -> StarkStruct { | |||
} | |||
} | |||
|
|||
type PatchedConstants<F> = Vec<(String, Vec<F>)>; | |||
type Constants<F> = Vec<(String, Vec<F>)>; |
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.
Is this typedef needed?
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.
Yes, it was already there thanks to clippy
backend/src/estark/mod.rs
Outdated
|
||
// Pre-process the PIL and fixed columns. | ||
let (pil, patched_constants) = first_step_fixup(analyzed, fixed); | ||
let (pil, constants) = first_step_fixup(analyzed, fixed); |
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.
If we rename that variable, why not fixed
?
@@ -279,6 +286,34 @@ pub struct FixedData<'a, T: FieldElement> { | |||
} | |||
|
|||
impl<'a, T: FieldElement> FixedData<'a, T> { | |||
pub fn common_degree<'b>(&self, ids: impl IntoIterator<Item = &'b PolyID>) -> DegreeType { |
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.
Please document
} else { | ||
self.polynomial_degree = Some(namespace_degree); | ||
} | ||
self.polynomial_degree = Some(namespace_degree); | ||
} |
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 would set polynomial_degree
to None
here in the else case. Otherwise, the next namespace "inherits" the previous namespace's degree if it's not set.
I cannot really comment this in-line, so: I would remove the |
@@ -306,6 +306,13 @@ fn naive_byte_decomposition_gl() { | |||
verify_pil(f, Default::default()); | |||
} | |||
|
|||
#[test] | |||
#[should_panic = "NoVariableDegreeAvailable"] |
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.
Does this at least run witgen?
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.
Yes! The error is thrown by the backend.
.collect(); | ||
let degrees = self.analyzed.degrees(); | ||
|
||
let values = match degrees.len() { |
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 use match °rees[..] { [degree] => { ... }, [] => { ... }, _ => unreachable!()}
Fixes #1494
degree
field onSymbol
, inherited from the namespace degree