forked from Consensys/teku
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf17838
commit 008ab85
Showing
10 changed files
with
232 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/Cell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package tech.pegasys.teku.kzg; | ||
|
||
import ethereum.ckzg4844.CKZG4844JNI; | ||
import org.apache.tuweni.bytes.Bytes; | ||
|
||
import java.util.List; | ||
import java.util.stream.IntStream; | ||
|
||
import static ethereum.ckzg4844.CKZG4844JNI.BYTES_PER_CELL; | ||
|
||
public record Cell(Bytes bytes) { | ||
|
||
static Cell ZERO = new Cell(Bytes.wrap(new byte[BYTES_PER_CELL])); | ||
|
||
static List<Cell> splitBytes(Bytes bytes) { | ||
return CKZG4844Utils.bytesChunked(bytes, BYTES_PER_CELL) | ||
.stream() | ||
.map(Cell::new) | ||
.toList(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/CellAndProof.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package tech.pegasys.teku.kzg; | ||
|
||
public record CellAndProof( | ||
Cell cell, | ||
KZGProof proof | ||
) { | ||
} |
14 changes: 14 additions & 0 deletions
14
infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/CellID.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package tech.pegasys.teku.kzg; | ||
|
||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
|
||
public record CellID(UInt64 id) { | ||
|
||
static CellID fromCellColumnIndex(int idx) { | ||
return new CellID(UInt64.valueOf(idx)); | ||
} | ||
|
||
int getColumnIndex() { | ||
return id.intValue(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/CellWithID.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package tech.pegasys.teku.kzg; | ||
|
||
public record CellWithID( | ||
Cell cell, | ||
CellID id | ||
) { | ||
|
||
static CellWithID fromCellAndColumn(Cell cell, int index) { | ||
return new CellWithID(cell, CellID.fromCellColumnIndex(index)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.