Skip to content

Commit

Permalink
Remove ethereum_ssz dependency (#701)
Browse files Browse the repository at this point in the history
* chore: remove ethereum ssz dep

* chore: fmt

---------

Co-authored-by: DaniPopes <[email protected]>
  • Loading branch information
eserilev and DaniPopes authored Aug 20, 2024
1 parent 5a74483 commit 2a0bfff
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 276 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ syn-solidity = { version = "0.7.7", path = "crates/syn-solidity", default-featur
serde = { version = "1.0", default-features = false, features = ["alloc"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }

# ssz
ethereum_ssz = { version = "0.5.3", default-features = false }

# macros
proc-macro-error = "1.0"
proc-macro2 = "1.0"
Expand Down
1 change: 0 additions & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ getrandom = ["alloy-primitives/getrandom"]
rand = ["alloy-primitives/rand"]
rlp = ["alloy-primitives/rlp", "dep:alloy-rlp"]
serde = ["alloy-primitives/serde"]
ssz = ["std", "alloy-primitives/ssz"]
arbitrary = [
"std",
"alloy-primitives/arbitrary",
Expand Down
5 changes: 0 additions & 5 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ alloy-rlp = { workspace = true, optional = true }
# serde
serde = { workspace = true, optional = true, features = ["derive"] }

# ssz
ethereum_ssz = { workspace = true, optional = true }

# getrandom
getrandom = { workspace = true, optional = true }

Expand Down Expand Up @@ -92,7 +89,6 @@ getrandom = ["dep:getrandom"]
rand = ["dep:rand", "getrandom", "ruint/rand"]
rlp = ["dep:alloy-rlp", "ruint/alloy-rlp"]
serde = ["dep:serde", "bytes/serde", "hex/serde", "ruint/serde"]
ssz = ["std", "dep:ethereum_ssz", "ruint/ssz"]
arbitrary = [
"std",
"dep:arbitrary",
Expand All @@ -101,7 +97,6 @@ arbitrary = [
"dep:proptest-derive",
"ruint/arbitrary",
"ruint/proptest",
"ethereum_ssz?/arbitrary",
]
k256 = ["dep:k256"]
allocative = ["dep:allocative"]
Expand Down
60 changes: 0 additions & 60 deletions crates/primitives/src/bits/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ macro_rules! wrap_fixed_bytes {
$crate::impl_serde!($name);
$crate::impl_allocative!($name);
$crate::impl_arbitrary!($name, $n);
$crate::impl_ssz_fixed_len!($name, $n);
$crate::impl_rand!($name);

impl $name {
Expand Down Expand Up @@ -665,65 +664,6 @@ macro_rules! impl_arbitrary {
($t:ty, $n:literal) => {};
}

#[doc(hidden)]
#[macro_export]
#[cfg(feature = "ssz")]
macro_rules! impl_ssz_fixed_len {
($type:ty, $fixed_len:expr) => {
impl $crate::private::ssz::Encode for $type {
#[inline]
fn is_ssz_fixed_len() -> bool {
true
}

#[inline]
fn ssz_fixed_len() -> usize {
$fixed_len
}

#[inline]
fn ssz_bytes_len(&self) -> usize {
<$type as $crate::private::ssz::Encode>::ssz_fixed_len()
}

#[inline]
fn ssz_append(&self, buf: &mut $crate::private::Vec<u8>) {
buf.extend_from_slice(self.as_slice());
}
}

impl $crate::private::ssz::Decode for $type {
#[inline]
fn is_ssz_fixed_len() -> bool {
true
}

#[inline]
fn ssz_fixed_len() -> usize {
$fixed_len
}

fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, $crate::private::ssz::DecodeError> {
let len = bytes.len();
let expected: usize = <$type as $crate::private::ssz::Decode>::ssz_fixed_len();

if len != expected {
Err($crate::private::ssz::DecodeError::InvalidByteLength { len, expected })
} else {
Ok(<$type>::from_slice(bytes))
}
}
}
};
}

#[doc(hidden)]
#[macro_export]
#[cfg(not(feature = "ssz"))]
macro_rules! impl_ssz_fixed_len {
($t:ty, $n:literal) => {};
}

macro_rules! fixed_bytes_macros {
($d:tt $($(#[$attr:meta])* macro $name:ident($ty:ident $($rest:tt)*);)*) => {$(
/// Converts a sequence of string literals containing hex-encoded data
Expand Down
3 changes: 0 additions & 3 deletions crates/primitives/src/bits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@ mod rlp;

#[cfg(feature = "serde")]
mod serde;

#[cfg(feature = "ssz")]
mod ssz;
136 changes: 0 additions & 136 deletions crates/primitives/src/bits/ssz.rs

This file was deleted.

3 changes: 0 additions & 3 deletions crates/primitives/src/bytes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ mod rlp;
#[cfg(feature = "serde")]
mod serde;

#[cfg(feature = "ssz")]
mod ssz;

/// Wrapper type around [`bytes::Bytes`] to support "0x" prefixed hex strings.
#[derive(Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
Expand Down
62 changes: 0 additions & 62 deletions crates/primitives/src/bytes/ssz.rs

This file was deleted.

3 changes: 0 additions & 3 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ pub mod private {
#[cfg(feature = "allocative")]
pub use allocative;

#[cfg(feature = "ssz")]
pub use ssz;

#[cfg(feature = "serde")]
pub use serde;

Expand Down

0 comments on commit 2a0bfff

Please sign in to comment.