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

feat: improve poseidon API #109

Merged
merged 4 commits into from
Feb 11, 2025
Merged

Conversation

varun-doshi
Copy link
Contributor

Pull Request type

What is the current behavior?

StarkHash trait does have hash_single funciton

Resolves: #107

What is the new behavior?

  • StarkHash now implements hash_single function

Does this introduce a breaking change?

No

Other information

This results in Pedersen needing to implement hash_single as well. Currently, it is set as todo!

@tdelabro
Copy link
Collaborator

tdelabro commented Jan 7, 2025

@varun-doshi need any help?

@varun-doshi
Copy link
Contributor Author

@varun-doshi need any help?

I'm not sure how to go about hash_single for Pedersen...since it's now in the trait for both Poseidon and Pedersen hence it needs to be implemented as well.

I can open this PR for review if that'll help?

@varun-doshi varun-doshi marked this pull request as ready for review January 9, 2025 06:30
@tdelabro
Copy link
Collaborator

@varun-doshi I think the pedersen hash_single impl should be pedersen(0, value)

@tdelabro
Copy link
Collaborator

@varun-doshi let's go with pedersen(value, 0) (based on @liorgold2 feedbacks) and make it very explicit in the documentation that there is room for collision as:
pedersen(value) and pedersen(value, 0) will return the same values
and
pedersen_array([value]) and pedersen(pedersen(0, value), 1) will too

Add the first example to the hash_single doc and the second one to the hash_array doc

@varun-doshi varun-doshi requested a review from jbcaron January 24, 2025 18:05
@tdelabro
Copy link
Collaborator

@varun-doshi it looks like your branch fails to build. Can you check what is going wrong?

@varun-doshi
Copy link
Contributor Author

@varun-doshi it looks like your branch fails to build. Can you check what is going wrong?

@tdelabro it seems that command is running successfully on my local. This is build error showing up on CI

error: package `parity-scale-codec v3.7.1` cannot be built because it requires rustc 1.79.0 or newer, while the currently active rustc version is 1.77.2
Either upgrade to rustc 1.79.0 or newer, or use
cargo update parity-scale-codec@3.7.1 --precise ver
where `ver` is the latest version of `parity-scale-codec` supporting rustc 1.77.2

Is it possible its a CI issue? Pls correct me if im wrong

@varun-doshi varun-doshi requested a review from tdelabro January 31, 2025 18:47
@tdelabro
Copy link
Collaborator

tdelabro commented Feb 3, 2025

@varun-doshi I will suggest you update https://github.com/starknet-io/types-rs/blob/main/rust-toolchain.toml
setting the toolchain to the latest rust release 1.84.1

@varun-doshi
Copy link
Contributor Author

@tdelabro updating the toolchain version of this PR back to 1.80.1(which is what is on main right now) after you confirm
Currently this PR is on 1.84.1 as you had suggested

@jbcaron
Copy link
Collaborator

jbcaron commented Feb 5, 2025

@tdelabro updating the toolchain version of this PR back to 1.80.1(which is what is on main right now) after you confirm Currently this PR is on 1.84.1 as you had suggested

The CI passing with version 1.80.1.

@jbcaron jbcaron added the enhancement New feature or request label Feb 11, 2025
@jbcaron jbcaron requested a review from antiyro February 11, 2025 13:07
@antiyro antiyro merged commit ae310ba into starknet-io:main Feb 11, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dev: improve poseidon API
4 participants