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

Implement a better MSM #65

Open
huitseeker opened this issue Mar 12, 2024 · 1 comment
Open

Implement a better MSM #65

huitseeker opened this issue Mar 12, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@huitseeker
Copy link
Contributor

function multiScalarMul(Bn256AffinePoint[] memory bases, uint256[] memory scalars)
public
returns (Bn256AffinePoint memory r)
{
require(scalars.length == bases.length, "MSM error: length does not match");
r = scalarMul(bases[0], scalars[0]);
for (uint256 i = 1; i < scalars.length; i++) {
r = add(r, scalarMul(bases[i], scalars[i]));
}
}

This is a basic (correct but not super performant) MSM.

We can probably do better with e.g. :
https://github.com/zcash/halo2/blob/7df93fd855395dcdb301a857d4b33f37903bbf76/halo2_proofs/src/arithmetic.rs#L28-L116

@huitseeker huitseeker added the enhancement New feature or request label Mar 12, 2024
@winston-h-zhang winston-h-zhang self-assigned this Mar 12, 2024
@storojs72
Copy link
Collaborator

storojs72 commented Mar 13, 2024

Got it now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants