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

poseidon: replaced unimplemented with error and added solana feature flag #9

Merged
merged 5 commits into from
Apr 9, 2023

Conversation

ananas-block
Copy link
Contributor

@ananas-block ananas-block commented Apr 8, 2023

Problems:

  • the solana validator segfaults with more than 14 inputs
  • the solana validator segfaults with invalid number of inputs

Solution:

  • introduce a solana feature flag which limits the number of allowed inputs
  • replace unimplemented with error to avoid unintentional panics

@ananas-block ananas-block requested a review from vadorovsky April 8, 2023 10:54
@@ -9,6 +9,10 @@ keywords = ["cryptography", "hash", "poseidon", "zero-knowledge", "zkSNARK"]
license = "Apache-2.0"
edition = "2021"

[features]
# limits the width of poseidon paramters to 13 (12 inputs)
solana = []
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would rename it to something line width_limit_13.

  1. That way, we could introduce other limits if there is need at any time.
  2. The first thing I'd think about when seeing this feature, without knowing the code, would be "oh, this enables some solana-program/Anchor stuff in the crate".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, I will change it

@vadorovsky vadorovsky mentioned this pull request Apr 8, 2023
@ananas-block
Copy link
Contributor Author

@ananas-block ananas-block requested a review from vadorovsky April 8, 2023 22:27
Copy link
Contributor

@vadorovsky vadorovsky left a comment

Choose a reason for hiding this comment

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

Looks awesome, thanks!

@vadorovsky vadorovsky merged commit 8492048 into main Apr 9, 2023
@vadorovsky vadorovsky deleted the add_solana_flag_and_errors branch April 9, 2023 17:45
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