-
Notifications
You must be signed in to change notification settings - Fork 37
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 Polyeval{Instance, Witness} #315
Conversation
6afc212
to
76aa3db
Compare
} | ||
} | ||
|
||
impl<E: Engine> PolyEvalInstance<E> { |
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.
Now with generic PolyEvalInstance
we can derive various implementations of it, right? Do we use that already (or have plans to create and use) and if so where concretely (more exactly - do we have / need alternative implementation which is different comparing to the previous reference one implemented at Solidity side of things)?
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.
PolyEvalInstance
has been generic since the beginning, and the type itself has not changed:
https://github.com/microsoft/Nova/blob/37871d04ba04771bf19c51e5b336e45fdb86c7f7/src/spartan/mod.rs#L117-L121
I'm not sure I understand the question?
The idea here is that batch_diff_size
is a more general function that performs a re-scaling in case the passed-in arguments have a different # of variables. When the # of variables is the same for every argument, batch
and batch_diff_size
produce exactly the same output, which allows implementing one in terms of the other.
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.
Right, the question is actually - does new PolyEvalInstanse
preserve compatibility with older one and where alt_batch
is planning to be used (since as far as I see it is absent in upstream)
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.
alt_batch
isn't new, it's the moved, old implementation of batch
. it is here in a tests
module, gated by #[cfg(test)]
and is not planned to be used anywhere. It is here specifically to ensure (through fuzzing unit tests) that PolyEval{Instance, Witness}::batch
remains backward-compatible.
76aa3db
to
e08d59b
Compare
e08d59b
to
8405923
Compare
8405923
to
8a63a3a
Compare
After #305 (which it includes, so go review there plz)
Refactors Polynomial evaluation instances / witnesses to express the specialized functions in terms of the general ones.
For review: the refactoring of
PolyEvalInstance::batch_diff_size
, which is strict about the size of its arguments and inspects it ,to be the implementation ofPolyEvalInstance::batch
, has revealed the later call sites are not rigorous about the size of their arguments, nor do they inspect them.I've patched call-sites to be compliant with the rigor of
batch_diff_size
, but there's another "looser" variant of this PR that would eliminatex
from thePolyEvalInstance
.