diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecar.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecar.java index 789bfe01091..4c0598462ca 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecar.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecar.java @@ -135,7 +135,7 @@ public String toLogString() { getBlockRoot(), getIndex(), getBlob().toBriefString(), - getKZGCommitment().toHexString(), + getKZGCommitment().toAbbreviatedString(), getKZGProof().toAbbreviatedString()); } } diff --git a/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java b/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java index 2451959e1e6..f1b791b4f7c 100644 --- a/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java +++ b/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java @@ -15,6 +15,7 @@ import java.util.List; import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes48; /** * This interface specifies all the KZG functions needed for the Deneb specification and is the @@ -53,13 +54,13 @@ public boolean verifyBlobKzgProofBatch( @Override public KZGCommitment blobToKzgCommitment(final Bytes blob) throws KZGException { - return KZGCommitment.infinity(); + return KZGCommitment.fromBytesCompressed(Bytes48.ZERO); } @Override public KZGProof computeBlobKzgProof(final Bytes blob, final KZGCommitment kzgCommitment) throws KZGException { - return KZGProof.INFINITY; + return KZGProof.fromBytesCompressed(Bytes48.ZERO); } }; diff --git a/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZGCommitment.java b/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZGCommitment.java index ad1095d33f9..c63f08b4e84 100644 --- a/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZGCommitment.java +++ b/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZGCommitment.java @@ -23,15 +23,6 @@ public final class KZGCommitment { - /** - * Creates 0x00..00 for point-at-infinity - * - * @return point-at-infinity as per the Eth2 spec - */ - public static KZGCommitment infinity() { - return KZGCommitment.fromBytesCompressed(Bytes48.ZERO); - } - public static KZGCommitment fromHexString(final String hexString) { return KZGCommitment.fromBytesCompressed(Bytes48.fromHexString(hexString)); } diff --git a/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZGProof.java b/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZGProof.java index ca47486cb83..88844853ffe 100644 --- a/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZGProof.java +++ b/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZGProof.java @@ -23,9 +23,6 @@ public final class KZGProof { - /** Creates 0x00..00 for point-at-infinity */ - public static final KZGProof INFINITY = KZGProof.fromBytesCompressed(Bytes48.ZERO); - public static KZGProof fromHexString(final String hexString) { return KZGProof.fromBytesCompressed(Bytes48.fromHexString(hexString)); } diff --git a/infrastructure/kzg/src/test/java/tech/pegasys/teku/kzg/CKZG4844Test.java b/infrastructure/kzg/src/test/java/tech/pegasys/teku/kzg/CKZG4844Test.java index 1933d1ff5e3..8f4895eff1e 100644 --- a/infrastructure/kzg/src/test/java/tech/pegasys/teku/kzg/CKZG4844Test.java +++ b/infrastructure/kzg/src/test/java/tech/pegasys/teku/kzg/CKZG4844Test.java @@ -86,12 +86,12 @@ public void testUsageWithoutLoadedTrustedSetup_shouldThrowException() { () -> CKZG.verifyBlobKzgProofBatch( List.of(Bytes.fromHexString("0x", BYTES_PER_BLOB)), - List.of(KZGCommitment.infinity()), - List.of(KZGProof.INFINITY))), + List.of(getSampleCommitment()), + List.of(getSampleProof()))), assertThrows(KZGException.class, () -> CKZG.blobToKzgCommitment(Bytes.EMPTY)), assertThrows( KZGException.class, - () -> CKZG.computeBlobKzgProof(Bytes.EMPTY, KZGCommitment.infinity()))); + () -> CKZG.computeBlobKzgProof(Bytes.EMPTY, getSampleCommitment()))); assertThat(exceptions) .allSatisfy( @@ -293,6 +293,10 @@ private KZGCommitment getSampleCommitment() { return CKZG.blobToKzgCommitment(getSampleBlob()); } + private KZGProof getSampleProof() { + return CKZG.computeBlobKzgProof(getSampleBlob(), getSampleCommitment()); + } + private UInt256 randomBLSFieldElement() { while (true) { final BigInteger attempt = new BigInteger(BLS_MODULUS.bitLength(), RND);