-
Notifications
You must be signed in to change notification settings - Fork 94
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
Created CRHF trait and conform RescueCRH impl #169
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about replacing all the current calls to RescueCRHF
with (Fixed/Variable)LengthRescueCRHF
?
Yes I have considered this, the problem is, currently A possible middle ground is we declare another API: |
primitives/src/rescue/mod.rs
Outdated
@@ -30,7 +30,7 @@ use ark_std::{vec, vec::Vec}; | |||
/// The state size of rescue hash. | |||
pub const STATE_SIZE: usize = 4; | |||
/// The rate of the sponge used in RescueCRHF. | |||
pub const CRHF_RATE: usize = 3; | |||
pub(crate) const CRHF_RATE: usize = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do the same thing to STATE_SIZE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suddenly I feel like we should export these 2 constants. Perhaps we could make them trait/struct dependent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to disagree. I think it's intuitive that CRHF_RATE
is a internal detail of CRHF, thus try to hide from public is sensible. whereas STATE_SIZE
is a parameter of our Rescue permutation instance, which like A
and MDS
should be public.
I think the current visibility makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what if the user need to know the "rate of compression"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would the user want to know that? I couldn't think of a use case for now.
alright, maybe I will just expose them. I don't see much harm either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed back in 7b77e79
Update: during refactoring of @tessico's suggestion
I need to use Therefore this forces me try the following: pub struct FixedLengthRescueCommitment<F: RescueParameter, const INPUT_LEN: usize>(PhantomData<F>); meanwhile, I might as well just declare a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I left some final minor comments.
Description
Part of: #168
Changes include:
trait CRHF
struct FixedLengthRescueCRHF
andstruct VariableLengthRescueCRHF
conforming to the trait.trait CommitmentScheme
struct FixedLengthRescueCRHF
NOTE:
to hack around some nightly-only feature on using const generic in an expression, we have a temporarily excessive generic parameter on
FixedLengthRescueCRHF<F, INPUT_LEN, INPUT_LEN_PLUS_ONE>
which will be fixed in the future.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.
Pending
section inCHANGELOG.md
Files changed
in the GitHub PR explorer