Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ethereum_ssz dependency #701

Merged
merged 2 commits into from
Aug 20, 2024
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: 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 @@ -122,9 +122,6 @@ pub mod private {
#[cfg(feature = "allocative")]
pub use allocative;

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

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

Expand Down