Remove c-kzg (#8930)

#7330


  Removes `c-kzg` from our `kzg` crate and rely fully on the `rust_eth_kzg` crate.

This removes the old `Blob` type entirely and instead handles `rust_eth_kzg::KzgBlobRef`s directly which allows us to avoid some extra stack allocations . Similarly, we make `Bytes32` and `Bytes48` type aliases rather than structs as this fits better with the new `rust_eth_kzg` API.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2026-03-11 07:43:26 +02:00
committed by GitHub
parent 2bb79f43aa
commit 815040dc3c
14 changed files with 129 additions and 188 deletions

View File

@@ -1,4 +1,4 @@
use c_kzg::BYTES_PER_COMMITMENT;
use crate::{Bytes48, BYTES_PER_COMMITMENT};
use educe::Educe;
use ethereum_hashing::hash_fixed;
use serde::de::{Deserialize, Deserializer};
@@ -14,7 +14,7 @@ pub const VERSIONED_HASH_VERSION_KZG: u8 = 0x01;
#[derive(Educe, Clone, Copy, Encode, Decode)]
#[educe(PartialEq, Eq, Hash)]
#[ssz(struct_behaviour = "transparent")]
pub struct KzgCommitment(pub [u8; c_kzg::BYTES_PER_COMMITMENT]);
pub struct KzgCommitment(pub [u8; BYTES_PER_COMMITMENT]);
impl KzgCommitment {
pub fn calculate_versioned_hash(&self) -> Hash256 {
@@ -24,13 +24,13 @@ impl KzgCommitment {
}
pub fn empty_for_testing() -> Self {
KzgCommitment([0; c_kzg::BYTES_PER_COMMITMENT])
KzgCommitment([0; BYTES_PER_COMMITMENT])
}
}
impl From<KzgCommitment> for c_kzg::Bytes48 {
impl From<KzgCommitment> for Bytes48 {
fn from(value: KzgCommitment) -> Self {
value.0.into()
value.0
}
}