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

Arrabbiata: new poseidon gadget #3053

Merged
merged 7 commits into from
Feb 25, 2025

Conversation

dannywillems
Copy link
Member

Following #3050

It seems that with nextest, it uses debug instead of release, even if it is
compiled with release
@dannywillems dannywillems marked this pull request as draft February 20, 2025 14:53
@dannywillems dannywillems force-pushed the arrabbiata/implement-new-poseidon-gadget branch 2 times, most recently from 1431888 to 65d7b28 Compare February 20, 2025 17:20
@dannywillems dannywillems force-pushed the arrabbiata/implement-new-poseidon-gadget branch from 65d7b28 to 46f2c8b Compare February 20, 2025 17:30
@dannywillems dannywillems marked this pull request as ready for review February 20, 2025 17:31
Base automatically changed from arrabbiata/create-cli-file to master February 21, 2025 09:58
/// setup, with [crate::NUMBER_OF_COLUMNS] columns, we can compute 5 full
/// The following gadgets implement the Poseidon hash instance described in
/// the top-level documentation. In the current setup, with
/// [crate::NUMBER_OF_COLUMNS] columns, we can compute 5 full
/// rounds per row.
Poseidon,
Copy link
Member Author

@dannywillems dannywillems Feb 21, 2025

Choose a reason for hiding this comment

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

Note: the old Poseidon gadget will be removed later.
By introducing incrementally the gadget PoseidonPermutation, I hope it will ease the reviewer's work.

/// using "public inputs".
///
/// We split the Poseidon gadget in 13 sub-gadgets, one for each set of 5
/// permutations and one for the absorbtion. The parameteris the starting
Copy link
Contributor

Choose a reason for hiding this comment

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

in my mind the term permutation is usually used for the full poseidon, not a round

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good point!
Changing it in a quick follow-up (to avoid breaking the PR train you already approved).

Copy link
Member Author

Choose a reason for hiding this comment

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

See #3066

/// using "public inputs".
///
/// We split the Poseidon gadget in 13 sub-gadgets, one for each set of 5
/// permutations and one for the absorbtion. The parameteris the starting
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// permutations and one for the absorbtion. The parameteris the starting
/// permutations and one for the absorbtion. The parameter is the starting

Copy link
Member Author

Choose a reason for hiding this comment

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

Oopsie.

Copy link
Member Author

Choose a reason for hiding this comment

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

See #3066

Gadget::EllipticCurveScaling => 2,
Gadget::Poseidon => 3,
Gadget::PoseidonSpongeAbsorb => 4,
Gadget::PoseidonPermutation(starting_round) => 5 + starting_round / 5,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like that we could have two different gadget with the same conversion to usize
I know it's not supposed to happens as Gadget::PoseidonPermutation(6) should not be created but it has the same int representation as Gadget::PoseidonPermutation(10)
In general, as previously commented I'd be happy if we can avoid a conversion to usize

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point!
What about enforcing starting_round being a multiple of five and smaller than the number of full rounds?
I'll think about the conversion to usize. It is mostly to get an index and a count. There might be a more elegant solution.

@dannywillems dannywillems merged commit ef24045 into master Feb 25, 2025
12 checks passed
@dannywillems dannywillems deleted the arrabbiata/implement-new-poseidon-gadget branch February 25, 2025 14:23
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.

2 participants