Skip to content
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

Merged
merged 4 commits into from
Jan 4, 2024
Merged

Conversation

storojs72
Copy link
Contributor

Fixes #229

Comment on lines 337 to 341
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);
Copy link
Contributor

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 .

Copy link
Contributor Author

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

adr1anh
adr1anh previously approved these changes Jan 4, 2024
@storojs72 storojs72 added this pull request to the merge queue Jan 4, 2024
Copy link
Contributor

@huitseeker huitseeker left a 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!

src/provider/mlkzg.rs Outdated Show resolved Hide resolved
src/provider/mlkzg.rs Outdated Show resolved Hide resolved
src/provider/mlkzg.rs Outdated Show resolved Hide resolved
src/provider/mlkzg.rs Outdated Show resolved Hide resolved
@storojs72 storojs72 removed this pull request from the merge queue due to a manual request Jan 4, 2024
Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@storojs72 storojs72 added this pull request to the merge queue Jan 4, 2024
Merged via the queue into dev with commit 0c41dd0 Jan 4, 2024
7 checks passed
@storojs72 storojs72 deleted the issue-229 branch January 4, 2024 17:06
huitseeker added a commit to huitseeker/arecibo that referenced this pull request Jan 14, 2024
…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,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring the kzg_verify_batch in MLKZG implementation
3 participants