-
Notifications
You must be signed in to change notification settings - Fork 39
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
Use "poseidon_hash_2" for merkle trees instead of poseidon_hash_many #312
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Where is the script generating the jsons tests for utreexo roots ? |
It is generated by Floresta node: https://github.com/keep-starknet-strange/raito/blob/main/docs/data.md#utreexo-data. @m-kus will you have a look? |
Note to future us: we'd need to change the implementation in the accumulator here https://github.com/Davidson-Souza/rpc-utreexo-bridge/blob/115fb5f21a19fc8ed30dab14d2b6558f782fe9b2/src/udata.rs#L514 and reindex the bridge node to recreate test data |
Better now than after proving 1TB of data |
The hash trait is using "poseidon_hash_many" or "array hashing" which is more costly and useless if we know in advance how many elements we hash.
A standard way of hashing two elements is calling the permutation on (x, y, 2) and returning the first element of the state.
see
https://github.com/starkware-libs/cairo-lang/blob/8e11b8cc65ae1d0959328b1b4a40b92df8b58595/src/starkware/cairo/common/poseidon_hash.py#L22-L31
https://docs.starknet.io/architecture-and-concepts/cryptography/hash-functions/#poseidon_hash