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

is there any way to optimize the MSM of the verifier contract #500

Closed
cliff0412 opened this issue May 28, 2024 · 3 comments
Closed

is there any way to optimize the MSM of the verifier contract #500

cliff0412 opened this issue May 28, 2024 · 3 comments

Comments

@cliff0412
Copy link

my circuit public input is very big. as my estimation, one public input will lead to one point multiplication and one addition, which is around 6k gas consumption. is there any way to optimize the MSM, e.g. pippenger algorithm or bos coster algorithm. what if the MSM is calculate off chain? people could verify the MSM computation is correct?

@Arvolear
Copy link
Contributor

Arvolear commented Oct 1, 2024

Hey, @cliff0412, I've tried to rewrite the verifier contracts to use alternative point multiplication algorithms and it turns out that the current approach is the cheapest.

Pippenger and other algorithms usually optimize the number of additions in double-and-add approach. However, Solidity verifiers use precompiled contracts to carry out the job. Substituting these precompile calls with the actual multiplication algorithm degrades the gas cost significantly.

Unfortunately, I haven't been able to find a better approach.

@cliff0412
Copy link
Author

thanks for the info

@Arvolear
Copy link
Contributor

Arvolear commented Oct 3, 2024

One way this may work is if you make current public signals private and pass a hash of these signals as a public one (calculate it in a smart contract). Then you may verify the correctness of the hash within the proof.

Not absolutely sure about legitimacy of this approach, but you may give it a shot :)

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

No branches or pull requests

2 participants