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

FixedBase refactor: rename msm -> mul, declutter the interface and hide aux methods #746

Merged
merged 13 commits into from
Jan 14, 2024

Conversation

mmagician
Copy link
Member

@mmagician mmagician commented Jan 10, 2024

Description

I don't think it's worth doing a bigger refactor proposed in #432 - yet still the two MSMs we had were confusing people. This PR is sort of bridging this gap of having a documented, simple interface that is clearly distinct from VariableBaseMSM.

I renamed FixedBase::msm into FixedBase::mul and introduces the following refactors:

  • Make all methods except for mul private. (Edit: get_window_table also remains public)
  • Simplify the mul interface: takes g and list of scalars as the parameters. The rest of the parameters can be inferred, and the internal methods called from mul directly.
  • Add a description and add a doctest

@msmirnov18

closes: #432


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

@mmagician mmagician requested review from a team as code owners January 10, 2024 23:29
@mmagician mmagician requested review from z-tech, Pratyush and weikengchen and removed request for a team January 10, 2024 23:29
@mmagician
Copy link
Member Author

Actually, I think get_window_table should remain public e.g. for Groth16.

@Pratyush
Copy link
Member

What do you think about just moving this to the ScalarMul trait? I think since we're doing a breaking change, a larger refactor would be nice too. I can handle it if you'd like.

@mmagician
Copy link
Member Author

Sure, we can move it. I'm open to other refactors too, the question is how useful this method is.

@mmagician
Copy link
Member Author

mmagician commented Jan 11, 2024

What other refactors are you thinking of, actually, aside from moving?

@Pratyush
Copy link
Member

Sure, we can move it. I'm open to other refactors too, the question is how useful this method is.

In general this method is useful whenever you want to multiply the same element by different scalars. This is useful primarily in setup methods for, e.g., Groth16 or KZG, but only in testing.

So I'd like to keep it, and just make it easier to use.

What other refactors are you thinking of, actually, aside from moving?

I'll take a stab at these changes, and then we can compare and see if they're worth it.

@Pratyush Pratyush force-pushed the fixed-base-refactor branch from 9cc62a9 to 9b1655d Compare January 14, 2024 21:25
@Pratyush
Copy link
Member

@mmagician I've added my changes; let me know if there's anything further you'd like to change.

@mmagician
Copy link
Member Author

Looks good, I'd approve if I weren't the PR author 👍🏼 Thanks for the changes!

Copy link
Member

@Pratyush Pratyush left a comment

Choose a reason for hiding this comment

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

Thanks!

@Pratyush Pratyush enabled auto-merge January 14, 2024 22:00
@Pratyush Pratyush added this pull request to the merge queue Jan 14, 2024
Merged via the queue into arkworks-rs:master with commit 1df72d5 Jan 14, 2024
37 checks passed
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.

Refactor FixedBase
2 participants