Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ path = "bindings/rust/src/lib.rs"
default = ["std", "portable", "ethereum_kzg_settings"]
std = ["hex/std", "libc/std", "serde?/std", "once_cell?/std"]
serde = ["dep:serde"]
arbitrary = ["dep:arbitrary"]
generate-bindings = ["dep:bindgen"]
ethereum_kzg_settings = ["dep:once_cell"]

Expand All @@ -40,7 +41,7 @@ portable = ["blst/portable"]
no-threads = ["blst/no-threads"]

[dependencies]
arbitrary = { version = "1", features = ["derive"] }
arbitrary = { version = "1", features = ["derive"], optional = true }
blst = { version = "0.3.14", default-features = false }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
libc = { version = "0.2", default-features = false }
Expand Down
14 changes: 8 additions & 6 deletions bindings/rust/src/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ mod serde;
#[cfg(test)]
mod test_formats;

use arbitrary::Arbitrary;

include!("./generated.rs");

use alloc::boxed::Box;
Expand Down Expand Up @@ -855,31 +853,35 @@ impl Default for Cell {
}
}

impl Arbitrary<'_> for Bytes32 {
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for Bytes32 {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let mut bytes = [0u8; 32];
u.fill_buffer(&mut bytes)?;
Ok(Bytes32::from(bytes))
}
}

impl Arbitrary<'_> for Bytes48 {
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for Bytes48 {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let mut bytes = [0u8; 48];
u.fill_buffer(&mut bytes)?;
Ok(Bytes48::from(bytes))
}
}

impl Arbitrary<'_> for Blob {
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for Blob {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let mut bytes = [0u8; BYTES_PER_BLOB];
u.fill_buffer(&mut bytes)?;
Ok(Blob::from(bytes))
}
}

impl Arbitrary<'_> for Cell {
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for Cell {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let mut bytes = [0u8; BYTES_PER_CELL];
u.fill_buffer(&mut bytes)?;
Expand Down
Loading