Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions gnark/gnark-jni/gnark-eip-2537.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ eip2537blsG1Add adds two G1 points together and returns a G1 Point.
- JNI:
- javaInputBuf must be at least 2*EIP2537PreallocateForG1 bytes (two G1 points)
- javaOutputBuf must be at least EIP2537PreallocateForG1 bytes to safely store the result
- javaOutputBuf must be zero initialized

*/
//export eip2537blsG1Add
Expand Down Expand Up @@ -133,6 +134,7 @@ eip2537blsG1MultiExp performs multi-scalar multiplication on multiple G1 points
- JNI:
- javaInputBuf must be at least n*(EIP2537PreallocateForG1 + EIP2537PreallocateForScalar) bytes, where n is the number of point-scalar pairs
- javaOutputBuf must be at least EIP2537PreallocateForG1 bytes to safely store the result
- javaOutputBuf must be zero initialized

*/
//export eip2537blsG1MultiExp
Expand Down Expand Up @@ -245,6 +247,7 @@ eip2537blsG2Add adds two G2 points together and returns a G2 Point.
- JNI:
- javaInputBuf must be at least 2*EIP2537PreallocateForG2 bytes (two G2 points)
- javaOutputBuf must be at least EIP2537PreallocateForG2 bytes to safely store the result
- javaOutputBuf must be zero initialized

*/
//export eip2537blsG2Add
Expand Down Expand Up @@ -313,6 +316,7 @@ eip2537blsG2MultiExp performs multi-scalar multiplication on multiple G2 points
- JNI:
- javaInputBuf must be at least n*(EIP2537PreallocateForG2 + EIP2537PreallocateForScalar) bytes, where n is the number of point-scalar pairs
- javaOutputBuf must be at least EIP2537PreallocateForG2 bytes to safely store the result
- javaOutputBuf must be zero initialized

*/
//export eip2537blsG2MultiExp
Expand Down Expand Up @@ -424,6 +428,7 @@ eip2537blsPairing performs a pairing check on a collection of G1 and G2 point pa
- JNI:
- javaInputBuf must be at least n*(EIP2537PreallocateForG1 + EIP2537PreallocateForG2) bytes, where n is the number of G1-G2 point pairs
- javaOutputBuf must be at least 32 bytes to safely store the result (0x01 for success, 0x00 otherwise)
- javaOutputBuf must be zero initialized

*/
//export eip2537blsPairing
Expand Down Expand Up @@ -519,6 +524,7 @@ eip2537blsMapFpToG1 maps a field element to a point on the G1 curve.
- JNI:
- javaInputBuf must be at least EIP2537PreallocateForFp bytes to store the input field element
- javaOutputBuf must be at least EIP2537PreallocateForG1 bytes to safely store the result
- javaOutputBuf must be zero initialized

*/
//export eip2537blsMapFpToG1
Expand Down Expand Up @@ -586,6 +592,7 @@ eip2537blsMapFp2ToG2 maps a field element in the quadratic extension field Fp^2
- JNI:
- javaInputBuf must be at least 2*EIP2537PreallocateForFp bytes to store the input Fp^2 field element (two Fp elements)
- javaOutputBuf must be at least EIP2537PreallocateForG2 bytes to safely store the result
- javaOutputBuf must be zero initialized

*/
//export eip2537blsMapFp2ToG2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public class LibGnarkEIP2537 implements Library {

/**
* Here as a compatibility shim for the pre-existing matter-labs implementation.
*
* IMPORTANT: The output buffer MUST be zero-initialized before calling this method.
* The native implementation relies on this pre-initialization for proper functioning.
*/
public static int eip2537_perform_operation(
byte op,
Expand Down
Loading