[Java] Avoid unnecessary array copying in tests (#247)
This commit is contained in:
parent
7695db3330
commit
88924c8aa7
|
@ -6,7 +6,6 @@ import ethereum.ckzg4844.test_formats.*;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -234,10 +233,6 @@ public class TestUtils {
|
|||
return randomBLSFieldElement().toArray(ByteOrder.LITTLE_ENDIAN);
|
||||
}
|
||||
|
||||
private static InputStream readResource(final String resource) {
|
||||
return Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
|
||||
}
|
||||
|
||||
public static List<String> getFiles(String path) {
|
||||
try {
|
||||
try (Stream<Path> stream = Files.list(Paths.get(path))) {
|
||||
|
|
|
@ -7,7 +7,7 @@ public class BlobToKzgCommitmentTest {
|
|||
private String blob;
|
||||
|
||||
public byte[] getBlob() {
|
||||
return Bytes.fromHexString(blob).toArray();
|
||||
return Bytes.fromHexString(blob).toArrayUnsafe();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ public class ComputeBlobKzgProofTest {
|
|||
private String commitment;
|
||||
|
||||
public byte[] getBlob() {
|
||||
return Bytes.fromHexString(blob).toArray();
|
||||
return Bytes.fromHexString(blob).toArrayUnsafe();
|
||||
}
|
||||
|
||||
public byte[] getCommitment() {
|
||||
|
|
|
@ -10,7 +10,7 @@ public class ComputeKzgProofTest {
|
|||
private String z;
|
||||
|
||||
public byte[] getBlob() {
|
||||
return Bytes.fromHexString(blob).toArray();
|
||||
return Bytes.fromHexString(blob).toArrayUnsafe();
|
||||
}
|
||||
|
||||
public byte[] getZ() {
|
||||
|
|
|
@ -15,7 +15,7 @@ public class VerifyBlobKzgProofBatchTest {
|
|||
return TestUtils.flatten(
|
||||
blobs.stream()
|
||||
.map(Bytes::fromHexString)
|
||||
.map(Bytes::toArray)
|
||||
.map(Bytes::toArrayUnsafe)
|
||||
.collect(Collectors.toList())
|
||||
.toArray(byte[][]::new));
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ public class VerifyBlobKzgProofTest {
|
|||
private String proof;
|
||||
|
||||
public byte[] getBlob() {
|
||||
return Bytes.fromHexString(blob).toArray();
|
||||
return Bytes.fromHexString(blob).toArrayUnsafe();
|
||||
}
|
||||
|
||||
public byte[] getCommitment() {
|
||||
|
|
Loading…
Reference in New Issue