Skip to content

Commit

Permalink
No batch processing needed in case of single blob
Browse files Browse the repository at this point in the history
  • Loading branch information
flcl42 committed Jun 10, 2024
1 parent 89d9ce4 commit 8b2d58c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Nethermind/Nethermind.Crypto/KzgPolynomialCommitments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ public static bool VerifyProof(ReadOnlySpan<byte> commitment, ReadOnlySpan<byte>

public static bool AreProofsValid(byte[][] blobs, byte[][] commitments, byte[][] proofs)
{
if (blobs.Length is 1)
{
try
{
return Ckzg.Ckzg.VerifyBlobKzgProof(blobs[0], commitments[0], proofs[0], _ckzgSetup);
}
catch (Exception e) when (e is ArgumentException or ApplicationException or InsufficientMemoryException)
{
return false;
}
}

var length = blobs.Length * Ckzg.Ckzg.BytesPerBlob;
byte[] flatBlobsArray = ArrayPool<byte>.Shared.Rent(length);
var flatBlobs = new Span<byte>(flatBlobsArray, 0, length);
Expand Down

0 comments on commit 8b2d58c

Please sign in to comment.