-
Notifications
You must be signed in to change notification settings - Fork 36
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 'kzg_verify_batch' closure in MLKZG verification #231
Conversation
src/provider/mlkzg.rs
Outdated
let L = NE::GE::vartime_multiscalar_mul(&q_powers_multiplied[..k], &C[..k]) | ||
- E::G1::from(vk.g) * (B_u[0] + d_0 * B_u[1] + d_1 * B_u[2]) | ||
+ E::G1::from(W[0]) * u[0] | ||
+ E::G1::from(W[1]) * (u[1] * d[0]) | ||
+ E::G1::from(W[2]) * (u[2] * d[1]); | ||
+ E::G1::from(W[1]) * (u[1] * d_0) | ||
+ E::G1::from(W[2]) * (u[2] * d_1); |
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.
L
can be computed using a single call to vartime_multiscalar_mul
, with inputs
[q_powers_multiplied[..k], vk.g, W[0], W[1], W[2]]
[C[..k], (B_u[0] + d_0 * B_u[1] + d_1 * B_u[2]), u[0], (u[1] * d_0), (u[2] * d_1)]
In the context where we are writing the verifier can use an MSM implementation like in Solidity, this should be a bit more efficient than computing individual scalar multiplications .
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, indeed! Added this refactoring in e1a5b15
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.
Left a few tweaks inline, overall looks good!
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.
LGTM!
…ications (lurk-lang#231) * refactor: simplify type aliases in tests (lurk-lang#54) Generic type aliases are type functions. In our case, they are made distinct through the arguments they are passed, not by giving them different names. * Simplify map_or expressions, remove clippy override noise, improve doc (lurk-lang#57) * refactor: Rewrite some exact instances of `Result::ok()` * refactor: Increase Clippy lint complexity limits and remove overrides - Removed Clippy linting restrictions on complexity and argument count across several modules including r1cs, lib, supernova/circuit, and bellpepper/shape_cs among others. - added .clippy.toml config file for project-wide limits * doc: Improve markdown formatting - Improved code documentation throughout by adding markdown styling and backticks for code readability. - No major functionality changes conducted,
Fixes #229