-
Notifications
You must be signed in to change notification settings - Fork 0
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
Integrate PeerDAS cryptography library #62
Conversation
Note: Things like namespaces will change in the future |
One thing to note:
|
Noting the use of BeforeEach for the setup method in tests. This will implicitly test that loading the same trusted setup does not throw or break. This is in addition to the explicit See here:
*BeforeEach as opposed to BeforeAll |
- change namespace and ensres that the library is loaded once
Currently to run tests with the rust lib, you can do |
Something I noticed, some methods have try-catch logic while others (mainly the new peerdas methods) do not -- Not blocking for this PR, though it looks undesirable since you are not wrapping the potentially arbitrary exceptions from the underlying crypto library into a KZGException |
We could also modify BlobToKZGCommitment to: @Override
public KZGCommitment blobToKzgCommitment(final Bytes blob) throws KZGException {
try {
byte[] commitmentBytes;
if (USE_PEER_DAS) {
commitmentBytes = peerDASinstance.blobToKZGCommitment(blob.toArrayUnsafe());
} else {
commitmentBytes = CKZG4844JNI.blobToKzgCommitment(blob.toArrayUnsafe());
}
return KZGCommitment.fromArray(commitmentBytes);
} catch (final Exception ex) {
throw new KZGException("Failed to produce KZG commitment from blob", ex);
}
} But there are CKZG specific errors in the tests so that would require more changes than I am hoping for |
infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/CKZG4844.java
Outdated
Show resolved
Hide resolved
infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/CKZG4844.java
Outdated
Show resolved
Hide resolved
- update FLAG name from USE_PEER_DAS to `USE_RUST_KZG_LIB` - We now initialize and free the rust kzg lib when the flag is enabled
Changed the flag name, tests can now be ran with |
I've finished with all changes I wanted, happy to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for doing the heavy lifting to separate the two libraries into two different files and adding a flag to the command line, and for adding 4844 fallback methods for the Rust lib! |
PR Description
On top of c-kzg, we plan to have a Rust library that compiles to Java and all of the other targets. A preliminary release has been made, this PR is being made to show the end to end integration of the library and possibly surface any issues.
Fixed Issue(s)
Documentation
doc-change-required
label to this PR if updates are required.Changelog