execution-spec-tests icon indicating copy to clipboard operation
execution-spec-tests copied to clipboard

test(add): ckzg functions for peerdas tests

Open felix314159 opened this issue 9 months ago • 1 comments

🗒️ Description

Added an eest wrapper for ckzg functions we will probably use in our tests. A few open questions:

  • Their code relies on trusted_setup.txt, I just import in the functions that need it and it assumes it is in the same folder. Is this compatible with our pytest framework or do we need to change how this file is accessed
  • I currently don't understand why I can only create blobs that hold values 0x73 or lower, otherwise calling compute_cells complains
  • It seems to me that every cell holds the exact same commitment. So you commit to your blob once and then copy paste the 48 byte commitment into every cell? Seems odd/wasteful to me, but could be the case

Next steps:

  • Use the functions in here to prepare a few static examples of blob/commitment/cells/proofs and store them as JSON (yml and me don't talk no more) in our repo. Then we can re-use these static examples in our tests instead of having to repeatedly create them at runtime.

🔗 Related Issues

✅ Checklist

  • [ ] All: Set appropriate labels for the changes.
  • [ ] All: Considered squashing commits to improve commit history.
  • [ ] All: Added an entry to CHANGELOG.md.
  • [ ] All: Considered updating the online docs in the ./docs/ directory.
  • [ ] Tests: All converted JSON/YML tests from ethereum/tests have been added to converted-ethereum-tests.txt.
  • [ ] Tests: A PR with removal of converted JSON/YML tests from ethereum/tests have been opened.
  • [ ] Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • [ ] Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • [ ] Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.

felix314159 avatar May 16 '25 09:05 felix314159

I currently don't understand why I can only create blobs that hold values 0x73 or lower, otherwise calling compute_cells complains

Blobs are not entirely opaque sequence of bytes. You can think of a blob as being 32 byte chunks where each 32 byte must represent an integer less than q, where q is the bls12-381 scalar field.

The "easier" way to always have it pass is to generate a 31 byte integer and then serialize that into 32 bytes. This is because every 31 byte integer will be less than q since q is roughly a 32 byte integer.

It seems to me that every cell holds the exact same commitment. So you commit to your blob once and then copy paste the 48 byte commitment into every cell? Seems odd/wasteful to me, but could be the case

Yeah, in the original API it was deduplicated, but then you need another index to index the deduplicated blob because the verify function can take in multiple commitments -- I found this to be more confusing though

kevaundray avatar May 16 '25 15:05 kevaundray

@marioevz Please look at the latest commit, I added fork_at() like you described.

Edit: I think everything is working now, can be reviewed & merged

felix314159 avatar Jun 02 '25 10:06 felix314159

Only thing left to do is splitting the logging changes into a separate PR, will do this tomorrow

felix314159 avatar Jun 26 '25 15:06 felix314159

It can be merged now (surely merging a cryptography related PR on a friday afternoon is not a bad idea:)

felix314159 avatar Jun 27 '25 12:06 felix314159