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(relayer): implement poseidon hash #186

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

Conversation

rnbguy
Copy link
Member

@rnbguy rnbguy commented Jan 11, 2025

Closes #175
Closes #180

  • move code to somewhere reasonable other than starknet-integration-tests

Comment on lines +123 to +128
// let mut trace_path_span = self.trace_path.span();
// while let Option::Some(path) = trace_path_span.pop_front() {
// key_builder.append_serde(path);
// };
// key_builder.append_serde(self.base);
key_builder.append_serde(self);
Copy link
Member Author

@rnbguy rnbguy Jan 11, 2025

Choose a reason for hiding this comment

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

I am not sure why PrefixedDenom was hashed manually when it implements Serde already.

Is this necessary? If yes, I am fine to revert this and make it compatible at relayer e2e side.

Comment on lines 423 to 425
let ibc_prefixed_denom_key = PoseidonState::digest(&[PoseidonState::digest(
&cairo_encoding.encode(&ibc_prefixed_denom)?,
)]);
Copy link
Member Author

Choose a reason for hiding this comment

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

The .key() method in Cairo uses,

PoseidonTrait::new().update(poseidon_hash_span(self.data.span())).finalize()

I am not sure why the double hashing is necessary. Why can't we use the following?

poseidon_hash_span(self.data.span())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant