Skip to content

feat: turn Poseidon parameters into trait #706

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

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

Oppen
Copy link
Contributor

@Oppen Oppen commented Dec 4, 2023

Rather than having the parameters as internal state, we consider them to
be compile time constants, and implement them via stateless structures
with associated constants, which in turn implement the
PermutationParameters trait.
We use a seal trait for the actual code to avoid overriding methods by
mistake. This is the Poseidon trait. It's automatically implemented
for all implementors of PermutationParameters.

Type of change

  • New feature

Checklist

  • This change requires new documentation.
    • Documentation has been added/updated.

Rather than having the parameters as internal state, we consider them to
be compile time constants, and implement them via stateless structures
with associated constants, which in turn implement the
`PermutationParameters` trait.
We use a seal trait for the actual code to avoid overriding methods by
mistake. This is the `Poseidon` trait. It's automatically implemented
for all implementors of `PermutationParameters`.
@Oppen Oppen requested review from schouhy, ajgara and a team as code owners December 4, 2023 13:43
@codecov-commenter
Copy link

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (f5208ff) 96.26% compared to head (a5dbfe6) 96.29%.

Files Patch % Lines
crypto/src/merkle_tree/backends/field_element.rs 0.00% 5 Missing ⚠️
...o/src/merkle_tree/backends/field_element_vector.rs 0.00% 5 Missing ⚠️
crypto/src/hash/poseidon/starknet/parameters.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #706      +/-   ##
==========================================
+ Coverage   96.26%   96.29%   +0.03%     
==========================================
  Files         130      130              
  Lines       29734    29660      -74     
==========================================
- Hits        28623    28562      -61     
+ Misses       1111     1098      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@entropidelic entropidelic added this pull request to the merge queue Dec 4, 2023
Merged via the queue into main with commit 347957a Dec 4, 2023
@entropidelic entropidelic deleted the feat/poseidon_parameters_trait branch December 4, 2023 14:56
@Oppen Oppen mentioned this pull request Dec 4, 2023
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