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

Split pedersen into stark_curve and stark_hash #282

Merged
merged 8 commits into from
May 25, 2022

Conversation

kkovaacs
Copy link
Contributor

@kkovaacs kkovaacs commented May 9, 2022

This allows us to remove curve_consts.rs and generate it from a build script instead.

@kkovaacs kkovaacs force-pushed the krisztian/pedersen-constants branch 2 times, most recently from 6198629 to 2a2d44e Compare May 11, 2022 13:28
@kkovaacs kkovaacs changed the title Split pedersen into stark_curve and pedersen_hash Split pedersen into stark_curve and stark_hash May 11, 2022
@kkovaacs kkovaacs marked this pull request as ready for review May 11, 2022 14:37
Copy link
Member

@CHr15F0x CHr15F0x left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Just a minor update to the doc comment needed.

crates/stark_curve/src/field.rs Show resolved Hide resolved
Copy link
Contributor

@koivunej koivunej left a comment

Choose a reason for hiding this comment

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

I hate to see the reference impl go but the risk probably isn't there. U32 -> NonZeroU8 could be spread more.

@kkovaacs kkovaacs force-pushed the krisztian/pedersen-constants branch 2 times, most recently from c8292f3 to 0ffbd29 Compare May 24, 2022 08:17
kkovaacs added 8 commits May 25, 2022 10:12
stark_curve contains the math parts of the curve, and pedersen
hash contains the code implementing the hash function.

This will make it possible to move the pre-computation of values
used by the hash function into a build script in pedersen_hash.
Instead of having the code run as an ignored unit test.
Keep the generator in case we need signatures later.
cargo bench output:

pedersen_hash           time:   [44.102 us 44.112 us 44.123 us]
                        change: [-49.728% -49.555% -49.414%] (p = 0.00 < 0.05)
                        Performance has improved.
@kkovaacs kkovaacs force-pushed the krisztian/pedersen-constants branch from 0ffbd29 to e32e249 Compare May 25, 2022 08:33
@kkovaacs kkovaacs merged commit 4e73430 into main May 25, 2022
@kkovaacs kkovaacs deleted the krisztian/pedersen-constants branch May 25, 2022 09:03
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.

5 participants