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: streamline some traits and bounds #207

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

huitseeker
Copy link
Contributor

@huitseeker huitseeker commented Jul 21, 2023

What this does

  • removes uneeded trait bounds in a few places (1st commit),
  • pegs the group trait on the zkcrypto::group::Group (2nd commit),

What this does not do

  • use the zkcrypto::group::GroupEncoding trait, as the chosen GroupEncoding implementations for Pallas and Vesta are the same ([u8;32]) and it would thus not be possible to implement two distinct instances of CompressedGroupElement on this type, requiring exactly the same sort of wrapper as we have now.

Partially helps with #198.

Happy to adapt depending on feedback:

- the main Group trait now uses ::zkcrypto::group::Group
- Refactored the usage of generic type associated 'Scalar' across multiple files and functions from 'G::Scalar' to fully qualified '<G as Group>::Scalar'.
- No new features were added, functionality remained the same, changes were mostly aimed at improving type inference and handling.
@huitseeker huitseeker changed the title Streamline traits and bounds refactor: streamline some traits and bounds Jul 22, 2023
@srinathsetty
Copy link
Collaborator

What this does

  • removes uneeded trait bounds in a few places (1st commit),
  • pegs the group trait on the zkcrypto::group::Group (2nd commit),

What this does not do

  • use the zkcrypto::group::GroupEncoding trait, as the chosen GroupEncoding implementations for Pallas and Vesta are the same ([u8;32]) and it would thus not be possible to implement two distinct instances of CompressedGroupElement on this type, requiring exactly the same sort of wrapper as we have now.

Partially helps with #198.

Happy to adapt depending on feedback:

Thanks for the PR, @huitseeker!

The first commit looks great!

I've mixed feelings about the second commit. Could you please elaborate a bit more on what is the gain from taking a dependency on the group crate? I couldn't quite tell if it simplified the Nova code in some way. It looks like it made our code more verbose because we have to disambiguate the two Groups.

@huitseeker
Copy link
Contributor Author

huitseeker commented Jul 23, 2023

I couldn't quite tell if it simplified the Nova code in some way. It looks like it made our code more verbose because we have to disambiguate the two Groups.

Yes. That's what I was saying, though what we're disambiguating is the two Scalar associated types (which are constrained to be one and the same). Though the disambiguation can be done by chosing a different name for the associated type, rather than using a qualified form, the gains are overall limited to fewer explicit trait requirements (src/traits/mod.rs is the only place with semantically meaningful changes)

I was hoping to inform #198, and for @CPerezz to share some insight. Otherwise, as I mentioned, I'm happy to revert the last commit.

@CPerezz
Copy link
Contributor

CPerezz commented Jul 24, 2023

Hey!
Apologies, I've been OOO for the last days.

So I kinda see the point of @srinathsetty but I think once #198 is actually done, the syntax could definitely improve.
But I think once #198 is executed (Will try to start this week), then this syntax will not happen or at least the situation will improve.

Not sure which is the best way to go for now. Specially since #198 is not even prototyped yet. The main idea for me there is to have the Group trait being declared in group and then, any other thing we miss, added on a GroupExt crate or similar.

@huitseeker
Copy link
Contributor Author

@CPerezz @srinathsetty I've reverted the last commit, leaving addressing the group-based trait to @CPerezz when #198 is more fleshed out.

@CPerezz
Copy link
Contributor

CPerezz commented Jul 24, 2023

@huitseeker will try to get at it this week! There's quiote a lot of work on HyperNova

@srinathsetty srinathsetty merged commit cdab403 into microsoft:main Jul 25, 2023
2 checks passed
huitseeker pushed a commit to huitseeker/Nova that referenced this pull request Dec 21, 2023
huitseeker pushed a commit to argumentcomputer/Nova that referenced this pull request Jan 25, 2024
huitseeker pushed a commit to huitseeker/Nova that referenced this pull request Jan 26, 2024
huitseeker pushed a commit to argumentcomputer/Nova that referenced this pull request Jan 26, 2024
huitseeker pushed a commit to argumentcomputer/Nova that referenced this pull request Jan 26, 2024
huitseeker pushed a commit to argumentcomputer/Nova that referenced this pull request Feb 21, 2024
huitseeker pushed a commit to argumentcomputer/Nova that referenced this pull request May 2, 2024
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.

3 participants