From 03a7a8d732d1735ea2b7bb4c35a34c7c4898d152 Mon Sep 17 00:00:00 2001 From: gabriel-aranha-cw <166405807+gabriel-aranha-cw@users.noreply.github.com> Date: Thu, 6 Feb 2025 16:06:19 -0300 Subject: [PATCH] chore: move to alloy pt6 (#2004) --- Cargo.lock | 94 ------------------- Cargo.toml | 3 +- src/alias.rs | 5 - src/eth/primitives/bytes.rs | 13 --- .../blockchain_client/blockchain_client.rs | 4 +- 5 files changed, 3 insertions(+), 116 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3939eb34..70f4e159d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1568,10 +1568,8 @@ checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" dependencies = [ "crunchy", "fixed-hash", - "impl-codec", "impl-rlp", "impl-serde", - "scale-info", "tiny-keccak", ] @@ -1583,41 +1581,12 @@ checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ "ethbloom", "fixed-hash", - "impl-codec", "impl-rlp", "impl-serde", "primitive-types", - "scale-info", "uint", ] -[[package]] -name = "ethers-core" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" -dependencies = [ - "arrayvec", - "bytes", - "chrono", - "const-hex", - "elliptic-curve", - "ethabi", - "generic-array", - "k256", - "num_enum", - "open-fastrlp", - "rand", - "rlp", - "serde", - "serde_json", - "strum", - "tempfile", - "thiserror 1.0.61", - "tiny-keccak", - "unicode-xid", -] - [[package]] name = "event-listener" version = "5.4.0" @@ -3321,31 +3290,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e296cf87e61c9cfc1a61c3c63a0f7f286ed4554e0e22be84e8a38e1d264a2a29" -[[package]] -name = "open-fastrlp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", - "ethereum-types", - "open-fastrlp-derive", -] - -[[package]] -name = "open-fastrlp-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" -dependencies = [ - "bytes", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "openssl" version = "0.10.68" @@ -3722,7 +3666,6 @@ dependencies = [ "impl-codec", "impl-rlp", "impl-serde", - "scale-info", "uint", ] @@ -4264,21 +4207,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", - "rlp-derive", "rustc-hex", ] -[[package]] -name = "rlp-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rocksdb" version = "0.22.0" @@ -4599,30 +4530,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "scale-info" -version = "2.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346a3b32eba2640d17a9cb5927056b08f3de90f65b72fe09402c2ad07d684d0b" -dependencies = [ - "cfg-if", - "derive_more 1.0.0", - "parity-scale-codec", - "scale-info-derive", -] - -[[package]] -name = "scale-info-derive" -version = "2.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6630024bf739e2179b91fb424b28898baf819414262c5d376677dbff1fe7ebf" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.96", -] - [[package]] name = "schannel" version = "0.1.27" @@ -5354,7 +5261,6 @@ dependencies = [ "dotenvy", "ethabi", "ethereum-types", - "ethers-core", "fake", "futures", "futures-channel", diff --git a/Cargo.toml b/Cargo.toml index bc5cd4c25..31ba087de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ rust_decimal = "=1.36.0" rustc-hash = "=2.0.0" smallvec = "=1.13.2" static_assertions = "=1.1.0" -strum = "=0.26.2" +strum = { version = "=0.26.2", features = ["derive"] } quick_cache = "=0.6.9" sugars = "=3.0.1" thiserror = "=1.0.61" @@ -75,7 +75,6 @@ futures-channel = "=0.3.31" # ethereum / rpc ethabi = "=18.0.0" ethereum-types = "=0.14.1" -ethers-core = "=2.0.14" keccak-hasher = "=0.15.3" # this version must be compatible with triehash rlp = "=0.5.2" triehash = "=0.8.4" diff --git a/src/alias.rs b/src/alias.rs index 8df7f28f6..0e9bf095d 100644 --- a/src/alias.rs +++ b/src/alias.rs @@ -30,11 +30,6 @@ pub type AlloyConsensusHeader = alloy_consensus::Header; pub type AlloyHeader = alloy_rpc_types_eth::Header; pub type AlloyUint256 = alloy_primitives::Uint<256, 4>; -// ----------------------------------------------------------------------------- -// Ethers -// ----------------------------------------------------------------------------- -pub type EthersBytes = ethers_core::types::Bytes; - // ----------------------------------------------------------------------------- // REVM // ----------------------------------------------------------------------------- diff --git a/src/eth/primitives/bytes.rs b/src/eth/primitives/bytes.rs index 3da3ce682..3230345ab 100644 --- a/src/eth/primitives/bytes.rs +++ b/src/eth/primitives/bytes.rs @@ -4,7 +4,6 @@ use std::ops::DerefMut; use display_json::DebugAsJson; -use crate::alias::EthersBytes; use crate::alias::RevmBytes; use crate::alias::RevmOutput; use crate::gen_newtype_from; @@ -55,12 +54,6 @@ impl<'de> serde::Deserialize<'de> for Bytes { // ----------------------------------------------------------------------------- gen_newtype_from!(self = Bytes, other = Vec, &[u8], [u8; 32]); -impl From for Bytes { - fn from(value: EthersBytes) -> Self { - Self(value.0.into()) - } -} - impl From for Bytes { fn from(value: RevmBytes) -> Self { Self(value.0.into()) @@ -99,12 +92,6 @@ impl DerefMut for Bytes { } } -impl From for EthersBytes { - fn from(value: Bytes) -> Self { - value.0.into() - } -} - impl From for RevmBytes { fn from(value: Bytes) -> Self { value.0.into() diff --git a/src/infra/blockchain_client/blockchain_client.rs b/src/infra/blockchain_client/blockchain_client.rs index d14afaf25..ffb65171a 100644 --- a/src/infra/blockchain_client/blockchain_client.rs +++ b/src/infra/blockchain_client/blockchain_client.rs @@ -12,8 +12,8 @@ use jsonrpsee::ws_client::WsClientBuilder; use tokio::sync::RwLock; use tokio::sync::RwLockReadGuard; +use crate::alias::AlloyBytes; use crate::alias::AlloyTransaction; -use crate::alias::EthersBytes; use crate::alias::JsonValue; use crate::eth::primitives::Address; use crate::eth::primitives::BlockNumber; @@ -215,7 +215,7 @@ impl BlockchainClient { // ------------------------------------------------------------------------- /// Forwards a transaction to leader. - pub async fn send_raw_transaction_to_leader(&self, tx: EthersBytes, rpc_client: &RpcClientApp) -> Result { + pub async fn send_raw_transaction_to_leader(&self, tx: AlloyBytes, rpc_client: &RpcClientApp) -> Result { tracing::debug!("sending raw transaction to leader"); let tx = to_json_value(tx);