diff --git a/Cargo.lock b/Cargo.lock index eef035a626..76ba4ebd18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2378,8 +2378,6 @@ dependencies = [ "ethers-core", "ethers-providers", "futures", - "hex", - "hex-literal", "revm-interpreter", "revm-precompile", "serde", @@ -2405,7 +2403,6 @@ name = "revm-precompile" version = "2.0.3" dependencies = [ "c-kzg", - "hex", "k256", "num", "once_cell", @@ -2433,7 +2430,6 @@ dependencies = [ "enumn", "hashbrown 0.14.0", "hex", - "hex-literal", "once_cell", "primitive-types", "proptest", @@ -2449,8 +2445,6 @@ dependencies = [ "alloy-rlp", "hash-db", "hashbrown 0.14.0", - "hex", - "hex-literal", "indicatif", "plain_hasher", "revm", diff --git a/bins/revme/Cargo.toml b/bins/revme/Cargo.toml index 154a8380f4..ebe28a9591 100644 --- a/bins/revme/Cargo.toml +++ b/bins/revme/Cargo.toml @@ -12,7 +12,6 @@ version = "0.2.0" [dependencies] hash-db = "0.15" hashbrown = "0.14" -hex = "0.4" indicatif = "0.17" plain_hasher = "0.2" revm = { path = "../../crates/revm", version = "3.3.0", default-features = false, features = [ @@ -20,7 +19,9 @@ revm = { path = "../../crates/revm", version = "3.3.0", default-features = false "std", "serde", ] } -alloy-rlp = { version = "0.3", default-features = false, features = ["arrayvec"] } +alloy-rlp = { version = "0.3", default-features = false, features = [ + "arrayvec", +] } ruint = { version = "1.9.0", features = ["rlp", "serde"] } serde = { version = "1.0", features = ["derive", "rc"] } serde_json = { version = "1.0", features = ["preserve_order"] } @@ -28,4 +29,3 @@ structopt = "0.3" thiserror = "1.0" triehash = "0.8" walkdir = "2.4" -hex-literal = "0.4" diff --git a/crates/precompile/Cargo.toml b/crates/precompile/Cargo.toml index 576046ed79..a333fa2623 100644 --- a/crates/precompile/Cargo.toml +++ b/crates/precompile/Cargo.toml @@ -26,12 +26,6 @@ sha2 = { version = "0.10.5", default-features = false } sha3 = { version = "0.10.7", default-features = false } c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true } -[dev-dependencies] -hex = "0.4" - -[build-dependencies] -hex = "0.4" - [features] default = ["secp256k1", "std"] # Used to disable kzg lib as i couldn't make it compile for wasm target diff --git a/crates/precompile/src/modexp.rs b/crates/precompile/src/modexp.rs index 573f763a7d..da6dd9900f 100644 --- a/crates/precompile/src/modexp.rs +++ b/crates/precompile/src/modexp.rs @@ -196,8 +196,8 @@ fn berlin_gas_calc(base_length: u64, exp_length: u64, mod_length: u64, exp_highp #[cfg(test)] mod tests { - use super::*; + use revm_primitives::hex; struct Test { input: &'static str, diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index be2a98cf47..e10c3fe9c7 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -10,7 +10,9 @@ version = "1.1.2" readme = "../../README.md" [dependencies] -alloy-primitives = { version = "0.3", default-features = false, features = ["rlp"] } +alloy-primitives = { version = "0.3", default-features = false, features = [ + "rlp", +] } alloy-rlp = { version = "0.3", default-features = false, features = ["derive"] } bytes = { version = "1.5", default-features = false } hashbrown = "0.14" @@ -22,10 +24,7 @@ bitflags = { version = "2.4.0", default-features = false } # For setting the CfgEnv KZGSettings. Enabled by std flag. c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true } - -#utility -hex-literal = "0.4" -hex = { version = "0.4", default-features = false, features = ["alloc"]} +# utility derive_more = "0.99" enumn = "0.1" once_cell = { version = "1.18", default-features = false } @@ -71,7 +70,6 @@ std = [ "alloy-primitives/std", "alloy-rlp/std", "bytes/std", - "hex/std", "bitvec/std", "bitflags/std", "dep:c-kzg", @@ -79,7 +77,6 @@ std = [ serde = [ "dep:serde", "alloy-primitives/serde", - "hex/serde", "hashbrown/serde", "bytes/serde", "bitvec/serde", diff --git a/crates/primitives/src/utilities.rs b/crates/primitives/src/utilities.rs index 635ceebddf..ea88c302a6 100644 --- a/crates/primitives/src/utilities.rs +++ b/crates/primitives/src/utilities.rs @@ -69,35 +69,6 @@ pub fn fake_exponential(factor: u64, numerator: u64, denominator: u64) -> u64 { (output / denominator) as u64 } -/// Serde functions to serde as [bytes::Bytes] hex string -#[cfg(feature = "serde")] -pub mod serde_hex_bytes { - use alloc::string::{String, ToString}; - use serde::{Deserialize, Deserializer, Serializer}; - - pub fn serialize(x: T, s: S) -> Result - where - S: Serializer, - T: AsRef<[u8]>, - { - s.serialize_str(&alloc::format!("0x{}", hex::encode(x.as_ref()))) - } - - pub fn deserialize<'de, D>(d: D) -> Result - where - D: Deserializer<'de>, - { - let value = String::deserialize(d)?; - if let Some(value) = value.strip_prefix("0x") { - hex::decode(value) - } else { - hex::decode(&value) - } - .map(Into::into) - .map_err(|e| serde::de::Error::custom(e.to_string())) - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 421f6ffbfd..dba0c4b68b 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -30,9 +30,7 @@ ethers-core = { version = "2.0", optional = true } futures = { version = "0.3.27", optional = true } [dev-dependencies] -hex-literal = "0.4" ethers-contract = { version = "2.0.10", default-features = false } -hex = "0.4.3" anyhow = "1.0.75" criterion = "0.5" diff --git a/crates/revm/benches/bench.rs b/crates/revm/benches/bench.rs index e52a65ee23..37056277f9 100644 --- a/crates/revm/benches/bench.rs +++ b/crates/revm/benches/bench.rs @@ -4,7 +4,9 @@ use criterion::{ use revm::{ db::BenchmarkDB, interpreter::{analysis::to_analysed, BytecodeLocked, Contract, DummyHost, Interpreter}, - primitives::{address, bytes, BerlinSpec, Bytecode, BytecodeState, Bytes, TransactTo, U256}, + primitives::{ + address, bytes, hex, BerlinSpec, Bytecode, BytecodeState, Bytes, TransactTo, U256, + }, }; use std::time::Duration;