Skip to content

Commit e9df67c

Browse files
authoredJul 17, 2024
chore!: rename java project's usage of peerdas-kzg -> eth-kzg (#104)
* chore: rename peerdas-kzg -> eth-kzg * update name of java rust crate * java_peerdas_kzg -> java_eth_kzg * remove mention of peerdas in error message
1 parent 218b91d commit e9df67c

File tree

11 files changed

+98
-98
lines changed

11 files changed

+98
-98
lines changed
 

‎.github/scripts/compile_all_targets_java.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
88

99
OUT_DIR="$PROJECT_ROOT/bindings/java/java_code/src/main/resources"
1010
LIB_TYPE="dynamic"
11-
LIB_NAME="java_peerdas_kzg"
11+
LIB_NAME="java_eth_kzg"
1212
$PROJECT_ROOT/scripts/compile_to_native.sh Darwin arm64 $LIB_NAME $LIB_TYPE $OUT_DIR
1313
$PROJECT_ROOT/scripts/compile_to_native.sh Darwin x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR
1414
$PROJECT_ROOT/scripts/compile_to_native.sh Windows x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR

‎Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
rootProject.name = 'peerdas-kzg'
1+
rootProject.name = 'java-eth-kzg'
22

‎bindings/java/java_code/src/main/java/ethereum/cryptography/LibPeerDASKZG.java ‎bindings/java/java_code/src/main/java/ethereum/cryptography/LibEthKZG.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.nio.file.Path;
77
import java.nio.file.StandardCopyOption;
88

9-
public class LibPeerDASKZG implements AutoCloseable{
9+
public class LibEthKZG implements AutoCloseable{
1010
// TODO: Add equality tests
1111
//
1212
/** The number of bytes in a KZG commitment. */
@@ -28,7 +28,7 @@ public class LibPeerDASKZG implements AutoCloseable{
2828
private static final Object libraryLock = new Object();
2929

3030

31-
public LibPeerDASKZG() {
31+
public LibEthKZG() {
3232
ensureLibraryLoaded();
3333
this.contextPtr = DASContextNew();
3434
}
@@ -63,7 +63,7 @@ public void destroy() {
6363
// TODO: add this code to all bindings
6464
private void checkContextHasNotBeenFreed() {
6565
if (contextPtr == 0) {
66-
throw new IllegalStateException("PeerDAS context has been destroyed");
66+
throw new IllegalStateException("KZG context context has been destroyed");
6767
}
6868
}
6969

@@ -107,7 +107,7 @@ private static native boolean verifyCellKZGProofBatch(
107107

108108
private static native CellsAndProofs recoverCellsAndProof(long context_ptr, long[] cellIDs, byte[][] cells);
109109

110-
private static final String LIBRARY_NAME = "java_peerdas_kzg";
110+
private static final String LIBRARY_NAME = "java_eth_kzg";
111111
private static final String PLATFORM_NATIVE_LIBRARY_NAME = System.mapLibraryName(LIBRARY_NAME);
112112

113113
private static String getNormalizedArchitecture() {
@@ -160,7 +160,7 @@ private static void loadNativeLibrary() {
160160
throw new UnsupportedOperationException("Unsupported OS or architecture: " + osName + ", " + osArch);
161161
}
162162

163-
InputStream libraryResource = LibPeerDASKZG.class.getResourceAsStream(libraryResourcePath);
163+
InputStream libraryResource = LibEthKZG.class.getResourceAsStream(libraryResourcePath);
164164

165165
if (libraryResource == null) {
166166
try {

‎bindings/java/java_code/src/test/java/ethereum/cryptography/LibPeerDASKZGTest.java ‎bindings/java/java_code/src/test/java/ethereum/cryptography/LibEthKZGTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,28 @@
2020

2121
import ethereum.cryptography.test_formats.*;
2222

23-
public class LibPeerDASKZGTest {
24-
static LibPeerDASKZG context;
23+
public class LibEthKZGTest {
24+
static LibEthKZG context;
2525

2626
@BeforeAll
2727
public static void setUp() {
28-
context = new LibPeerDASKZG();
28+
context = new LibEthKZG();
2929
}
3030

3131
@Test
3232
void testMultipleInstanceCreation() {
33-
LibPeerDASKZG instance1 = null;
34-
LibPeerDASKZG instance2 = null;
33+
LibEthKZG instance1 = null;
34+
LibEthKZG instance2 = null;
3535
try {
36-
instance1 = new LibPeerDASKZG();
37-
instance2 = new LibPeerDASKZG();
36+
instance1 = new LibEthKZG();
37+
instance2 = new LibEthKZG();
3838

3939
assertNotNull(instance1);
4040
assertNotNull(instance2);
4141
assertNotEquals(instance1, instance2);
4242

4343
// Test a simple operation to ensure both instances are functional
44-
byte[] dummyBlob = new byte[LibPeerDASKZG.BYTES_PER_BLOB];
44+
byte[] dummyBlob = new byte[LibEthKZG.BYTES_PER_BLOB];
4545
byte[] commitment1 = instance1.blobToKZGCommitment(dummyBlob);
4646
byte[] commitment2 = instance2.blobToKZGCommitment(dummyBlob);
4747

‎bindings/java/rust_code/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "java_peerdas_kzg"
2+
name = "java_eth_kzg"
33
version = { workspace = true }
44
authors = { workspace = true }
55
edition = { workspace = true }

‎bindings/java/rust_code/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{env, path::PathBuf};
66
const PATH_TO_JAVA_BINDINGS_FILE: &str = "java/java_code/src/main/java/ethereum/cryptography";
77

88
// These are the files needed to pass to the `javac` command to generate the header file
9-
const INPUT_FILES: [&str; 2] = ["LibPeerDASKZG.java", "CellsAndProofs.java"];
9+
const INPUT_FILES: [&str; 2] = ["LibEthKZG.java", "CellsAndProofs.java"];
1010

1111
fn main() {
1212
let path_to_bindings_dir = path_to_bindings_folder();

‎bindings/java/rust_code/ethereum_cryptography_LibEthKZG.h

+73
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎bindings/java/rust_code/ethereum_cryptography_LibPeerDASKZG.h

-73
This file was deleted.

‎bindings/java/rust_code/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod errors;
88
use errors::Error;
99

1010
#[no_mangle]
11-
pub extern "system" fn Java_ethereum_cryptography_LibPeerDASKZG_DASContextNew(
11+
pub extern "system" fn Java_ethereum_cryptography_LibEthKZG_DASContextNew(
1212
_env: JNIEnv,
1313
_class: JClass,
1414
) -> jlong {
@@ -17,7 +17,7 @@ pub extern "system" fn Java_ethereum_cryptography_LibPeerDASKZG_DASContextNew(
1717
}
1818

1919
#[no_mangle]
20-
pub extern "system" fn Java_ethereum_cryptography_LibPeerDASKZG_DASContextDestroy(
20+
pub extern "system" fn Java_ethereum_cryptography_LibEthKZG_DASContextDestroy(
2121
_env: JNIEnv,
2222
_class: JClass,
2323
ctx_ptr: jlong,
@@ -27,7 +27,7 @@ pub extern "system" fn Java_ethereum_cryptography_LibPeerDASKZG_DASContextDestro
2727
}
2828

2929
#[no_mangle]
30-
pub extern "system" fn Java_ethereum_cryptography_LibPeerDASKZG_computeCellsAndKZGProofs<'local>(
30+
pub extern "system" fn Java_ethereum_cryptography_LibEthKZG_computeCellsAndKZGProofs<'local>(
3131
mut env: JNIEnv<'local>,
3232
_class: JClass,
3333
ctx_ptr: jlong,
@@ -56,7 +56,7 @@ fn compute_cells_and_kzg_proofs<'local>(
5656
}
5757

5858
#[no_mangle]
59-
pub extern "system" fn Java_ethereum_cryptography_LibPeerDASKZG_blobToKZGCommitment<'local>(
59+
pub extern "system" fn Java_ethereum_cryptography_LibEthKZG_blobToKZGCommitment<'local>(
6060
mut env: JNIEnv<'local>,
6161
_class: JClass,
6262
ctx_ptr: jlong,
@@ -84,7 +84,7 @@ fn blob_to_kzg_commitment<'local>(
8484
}
8585

8686
#[no_mangle]
87-
pub extern "system" fn Java_ethereum_cryptography_LibPeerDASKZG_verifyCellKZGProofBatch<'local>(
87+
pub extern "system" fn Java_ethereum_cryptography_LibEthKZG_verifyCellKZGProofBatch<'local>(
8888
mut env: JNIEnv<'local>,
8989
_class: JClass,
9090
ctx_ptr: jlong,
@@ -154,7 +154,7 @@ fn verify_cell_kzg_proof_batch<'local>(
154154
}
155155

156156
#[no_mangle]
157-
pub extern "system" fn Java_ethereum_cryptography_LibPeerDASKZG_recoverCellsAndProof<'local>(
157+
pub extern "system" fn Java_ethereum_cryptography_LibEthKZG_recoverCellsAndProof<'local>(
158158
mut env: JNIEnv<'local>,
159159
_class: JClass,
160160
ctx_ptr: jlong,

‎scripts/compile.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ compile_java() {
1616
echo "Compiling for Java..."
1717
OUT_DIR="$PROJECT_ROOT/bindings/java/java_code/src/main/resources"
1818
LIB_TYPE="dynamic"
19-
LIB_NAME="java_peerdas_kzg"
19+
LIB_NAME="java_eth_kzg"
2020
$PROJECT_ROOT/scripts/compile_to_native.sh $OS $ARCH $LIB_NAME $LIB_TYPE $OUT_DIR
2121
}
2222

0 commit comments

Comments
 (0)