-
Notifications
You must be signed in to change notification settings - Fork 119
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 support for EIP-7594 #452
Conversation
I have included Go bindings for this new method. I will add Rust bindings later. This will break the Rust bindings build until then, sorry about that.
The sample structure now includes the data, proof, and indices. This should make things easier to read and understand. Bindings will be broken for a little while. Going to remove the 2d functions, as I don't think they are that useful at the moment.
|
||
foreach (string testFile in testFiles) | ||
{ | ||
string yaml = File.ReadAllText(testFile); |
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.
In general cases could be separated to a source passed to TestCaseSource attribute
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.
Good idea. I only did this for the new ones. Let's follow-up with a PR for the old tests later.
{ | ||
Ckzg.ComputeCellsAndKzgProofs(cells, proofs, blob, _ts); | ||
Assert.That(test.Output, Is.Not.EqualTo(null)); | ||
byte[] expectedCells = GetFlatBytes(test.Output.ElementAt(0)); |
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.
Can the type of it be an array of arrays instead? Could you access elements just by [index]?
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.
Hmm I'm not sure about this one. Let's look into this afterwards.
@@ -43,24 +43,36 @@ public static void loadNativeLibrary() { | |||
} | |||
} | |||
|
|||
/** Scalar field modulus of BLS12-381 */ | |||
public static final BigInteger BLS_MODULUS = |
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.
Why did we decide to make the constants private. They could be useful to projects using the library. We use some of them in Teku.
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.
Hmm, protecting those constants was a conscious decision. It was an attempt to remove cryptographic details from the clients. In some cases cryptography code can be easy to mess up, and client devs might not be aware of the various cryptographic intricacies, so this change was done so that cryptography logic gets concentrated in the libraries.
How do you use these constants in Teku?
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.
We have a utility class which flattens a list of commitments/proofs for example and we calculate the expected size based on these constants to initialize the array e.g. https://github.com/Consensys/teku/blob/master/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/CKZG4844Utils.java
We also use in tests https://github.com/Consensys/teku/blob/master/infrastructure/kzg/src/test/java/tech/pegasys/teku/kzg/CKZG4844Test.java
I suppose not an issue to replicate those in Teku internally in the module, but would lead to duplication.
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.
Stefan, we've decided to revert this change. So these constants are public again for all bindings. With the exception of the BYTES_PER_G*
constants because load_trusted_setup
takes a flat array of bytes now.
I believe this affects how clients see the return types. It appears as a slice instead of an array of a known size. This isn't right.
This reverts commit e689135.
This is a big PR which merges the das branch into main.
Client teams: when you have time, please review the changes to the bindings you use.
When we merge this, please squash the commits.
Notable changes to the bindings
compute_cells_and_kzg_proofs
,recover_cells_and_kzg_proofs
,verify_cell_kzg_proof_batch
bindings.load_trusted_setup
(bytes version) to take flat array of bytes rather than list of point bytes.precompute
parameter to functions which load the trusted setup.Make some of the previously public constants private.Notable changes to the core implementation
load_trusted_setup_file
.g1_lincomb_fast
to work with points at infinity.CHECK
macro with normal conditions.Other notable changes
Replace old C LLVMFuzzer with new cargo-fuzz implementation in Rust.This will also differentially fuzz with Constantine & PeerDAS-KZG where possible.