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

add serialization and deserialization for BytesHash #1645

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

carlogf
Copy link
Contributor

@carlogf carlogf commented Jan 3, 2025

This PR adds the implementation of the serialize and deserialize traits for the BytesHash struct.

Since the Keccak hash function uses BytesHash as its hash type, it is now possible to serialize and deserialize proofs that use the KeccakGoldilocksConfig, like in this example

Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

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

Thank you for this, good catch! Just left a small comment inline.

Comment on lines 219 to 226
let mut bytes = [0u8; N];
for i in 0..N {
bytes[i] = seq.next_element().unwrap().unwrap();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It think it may be best to catch deserialization errors here instead of simply panicking.

Copy link

@fndecroix fndecroix Jan 6, 2025

Choose a reason for hiding this comment

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

Hi! Thanks for reviewing this!

Good call, we changed that piece of code to catch the errors. Could you look at it?

Also, there is an error when running cargo clippy, but it is not related to the code we modified. Should we fix that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you don't mind, you can include it in this PR, otherwise I'll open a separate one and merge yours after :)
Thanks!

Choose a reason for hiding this comment

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

Done! We included those changes in a separate commit

@fndecroix fndecroix force-pushed the 19-12-add-circuit-serde branch from 6a4617f to fb4291a Compare January 6, 2025 14:34
Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

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

Thank you again! LGTM!

@Nashtare Nashtare merged commit 02e80e9 into 0xPolygonZero:main Jan 7, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants