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

Revisit 2278: Unify hash digest format on both sides (MIPS + Keccak) #2480

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

querolita
Copy link
Member

This is based upon #2278.

The only difference is that the above PR assumed that bytes corresponding to the length of the preimage were always read in a different instruction than actual preimage bytes. But I am no longer sure that I had checked that thoroughly back then, so I am creating this PR to solely include the fix for the hash digest format: that is, making sure that both in MIPS and Keccak the data sent to the communication channel corresponds to the 31 bytes of the preimage (no MSB in either of them). I left the check of the length bytes as a FIXME for the future.

Comment on lines +48 to +50
// MIPS + hash_counter + byte_counter + eof + num_bytes_read + chunk + bytes
// + length + has_n_bytes + chunk_bytes + preimage
pub const SCRATCH_SIZE: usize = 98;
Copy link
Contributor

Choose a reason for hiding this comment

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

the comment says you're adding two things, chunk_bytes + preimage, and yet the size only grows by one

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just the preimage key that is being added wrt what's in master. The problem is that in the old comment the chunk_bytes were not written down, but they were in any case part of the state https://github.com/o1-labs/proof-systems/blob/7d51847c00ff790bc22af3c83ddedc1deb070e38/o1vm/src/mips/column.rs#L26C1-L27C1

Base automatically changed from zkvm/syscalls/bytelength-lookups to master September 5, 2024 16:10
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.42%. Comparing base (a407915) to head (9a40d5b).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2480      +/-   ##
==========================================
+ Coverage   73.41%   73.42%   +0.01%     
==========================================
  Files         234      234              
  Lines       54275    54275              
==========================================
+ Hits        39846    39854       +8     
+ Misses      14429    14421       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@querolita querolita merged commit 2cfb94e into master Sep 5, 2024
7 checks passed
@querolita querolita deleted the zkvm/syscalls/fix-preimagekey-lookup-revisit branch September 5, 2024 18:28
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