PeerDAS cryptography: Add a missing check and a missing test vector (coverage report of test vectors)#3765
Merged
jtraglia merged 2 commits intoethereum:devfrom May 14, 2024
Merged
Conversation
This is actually covered by test vectors
7bcbefa to
d92a91a
Compare
jtraglia
approved these changes
May 14, 2024
Member
jtraglia
left a comment
There was a problem hiding this comment.
LGTM 👍 thanks! Both of your ckzg notes were useful too, I will fix those.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I spent some time checking which parts of c-kzg are not tested by the test vectors. I did this by exporting coverage information of the C code of c-kzg when the test vectors are tested through the Rust bindings. I was forced to go through the Rust bindings because only the bindings run the test vectors at the moment (and IMO that's fine).
For what it's worth, I used the cargo-llvm-cov project and the following command:
CC=clang LLVM_COV=llvm-cov LLVM_PROFDATA=llvm-profdata cargo llvm-cov --include-ffi --html.In case you are curious, I attach a zip file (c_kzg_coverage.zip) with the coverage report of c-kzg (commit
f5e4b030f) when running the tests of the Rust bindings.All in all, the coverage results were very good (i.e. the test vectors are well thought out!).
In this PR, I fix some minor issues found during the above procedure:
cell_idrange check inrecover_all_cells()(which was actually tested by the test vectors)recover_all_cells()which represents the right side of the spec assertion:assert CELLS_PER_EXT_BLOB / 2 <= len(cell_ids) <= CELLS_PER_EXT_BLOB. The test vector is sorta rendundant because the combination of the duplicate cell_id check and the cell_id range check would have caught this edge case, but still worth checking explicitly since it's not trivial (and it shows up in the coverage as well).Some more notes: