fix compilation issues

This commit is contained in:
realbigsean
2023-01-12 14:17:14 -05:00
parent 06f71e8cce
commit d96d793bfb
10 changed files with 56 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ hex = "0.4.2"
eth2_hashing = "0.3.0"
ethereum-types = "0.12.1"
c-kzg = {git = "https://github.com/pawanjay176/c-kzg-4844", rev = "c9e4fa0dabdd000738b7fcdf85a72880a5da8748" }
arbitrary = { version = "1.0", features = ["derive"], optional = true }
[features]
default = ["mainnet-spec"]

View File

@@ -102,3 +102,12 @@ impl Debug for KzgCommitment {
write!(f, "{}", eth2_serde_utils::hex::encode(&self.0))
}
}
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for KzgCommitment {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let mut bytes = [0u8; KZG_COMMITMENT_BYTES_LEN];
u.fill_buffer(&mut bytes)?;
Ok(KzgCommitment(bytes))
}
}

View File

@@ -126,3 +126,12 @@ impl Debug for KzgProof {
write!(f, "{}", eth2_serde_utils::hex::encode(&self.0))
}
}
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for KzgProof {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let mut bytes = [0u8; KZG_PROOF_BYTES_LEN];
u.fill_buffer(&mut bytes)?;
Ok(KzgProof(bytes))
}
}