From db407f39505ed9c2ecf60f82c9eedbadc202f3ee Mon Sep 17 00:00:00 2001 From: Daniyar Itegulov Date: Fri, 24 Jan 2025 20:56:45 +1100 Subject: [PATCH] chore: only set used alloy features (#46) --- Cargo.lock | 254 +------------------------------- Cargo.toml | 14 +- src/network/receipt_envelope.rs | 5 +- 3 files changed, 13 insertions(+), 260 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c75b510..a48ccc1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,10 +46,8 @@ dependencies = [ "alloy-contract", "alloy-core", "alloy-eips", - "alloy-genesis", "alloy-network", "alloy-provider", - "alloy-pubsub", "alloy-rpc-client", "alloy-rpc-types", "alloy-serde", @@ -57,15 +55,13 @@ dependencies = [ "alloy-signer-local", "alloy-transport", "alloy-transport-http", - "alloy-transport-ipc", - "alloy-transport-ws", ] [[package]] name = "alloy-chains" -version = "0.1.53" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da226340862e036ab26336dc99ca85311c6b662267c1440e1733890fd688802c" +checksum = "4ab9d1367c6ffb90c93fb4a9a4989530aa85112438c6f73a734067255d348469" dependencies = [ "alloy-primitives", "num_enum", @@ -86,7 +82,6 @@ dependencies = [ "auto_impl", "c-kzg", "derive_more", - "k256", "serde", ] @@ -116,7 +111,6 @@ dependencies = [ "alloy-network-primitives", "alloy-primitives", "alloy-provider", - "alloy-pubsub", "alloy-rpc-types-eth", "alloy-sol-types", "alloy-transport", @@ -175,7 +169,6 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "derive_more", - "k256", "serde", ] @@ -197,19 +190,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "alloy-genesis" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d2a7fe5c1a9bd6793829ea21a636f30fc2b3f5d2e7418ba86d96e41dd1f460" -dependencies = [ - "alloy-eips", - "alloy-primitives", - "alloy-serde", - "alloy-trie", - "serde", -] - [[package]] name = "alloy-json-abi" version = "0.8.18" @@ -314,13 +294,10 @@ dependencies = [ "alloy-network", "alloy-network-primitives", "alloy-primitives", - "alloy-pubsub", "alloy-rpc-client", "alloy-rpc-types-eth", "alloy-transport", "alloy-transport-http", - "alloy-transport-ipc", - "alloy-transport-ws", "async-stream", "async-trait", "auto_impl", @@ -341,25 +318,6 @@ dependencies = [ "wasmtimer", ] -[[package]] -name = "alloy-pubsub" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2269fd635f7b505f27c63a3cb293148cd02301efce4c8bdd9ff54fbfc4a20e23" -dependencies = [ - "alloy-json-rpc", - "alloy-primitives", - "alloy-transport", - "bimap", - "futures", - "serde", - "serde_json", - "tokio", - "tokio-stream", - "tower 0.5.2", - "tracing", -] - [[package]] name = "alloy-rlp" version = "0.3.10" @@ -390,11 +348,8 @@ checksum = "d06a292b37e182e514903ede6e623b9de96420e8109ce300da288a96d88b7e4b" dependencies = [ "alloy-json-rpc", "alloy-primitives", - "alloy-pubsub", "alloy-transport", "alloy-transport-http", - "alloy-transport-ipc", - "alloy-transport-ws", "futures", "pin-project", "reqwest", @@ -415,7 +370,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9383845dd924939e7ab0298bbfe231505e20928907d7905aa3bf112287305e06" dependencies = [ "alloy-primitives", - "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -432,22 +386,6 @@ dependencies = [ "alloy-serde", ] -[[package]] -name = "alloy-rpc-types-engine" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f821f30344862a0b6eb9a1c2eb91dfb2ff44c7489f37152a526cdcab79264" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "derive_more", - "serde", - "strum", -] - [[package]] name = "alloy-rpc-types-eth" version = "0.9.2" @@ -561,9 +499,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eda2711ab2e1fb517fc6e2ffa9728c9a232e296d16810810e6957b781a1b8bc" +checksum = "74e60b084fe1aef8acecda2743ff2d93c18ff3eb67a2d3b12f62582a1e66ef5e" dependencies = [ "serde", "winnow", @@ -617,43 +555,6 @@ dependencies = [ "url", ] -[[package]] -name = "alloy-transport-ipc" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4da44bc9a5155ab599666d26decafcf12204b72a80eeaba7c5e234ee8ac205" -dependencies = [ - "alloy-json-rpc", - "alloy-pubsub", - "alloy-transport", - "bytes", - "futures", - "interprocess", - "pin-project", - "serde_json", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "alloy-transport-ws" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58011745b2f17b334db40df9077d75b181f78360a5bc5c35519e15d4bfce15e2" -dependencies = [ - "alloy-pubsub", - "alloy-transport", - "futures", - "http", - "rustls", - "serde_json", - "tokio", - "tokio-tungstenite", - "tracing", - "ws_stream_wasm", -] - [[package]] name = "alloy-trie" version = "0.7.8" @@ -675,12 +576,10 @@ name = "alloy-zksync" version = "0.9.0" dependencies = [ "alloy", - "alloy-consensus-any", "anyhow", "assert_matches", "async-trait", "chrono", - "futures-utils-wasm", "hex", "jsonrpsee", "k256", @@ -887,17 +786,6 @@ dependencies = [ "syn 2.0.95", ] -[[package]] -name = "async_io_stream" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" -dependencies = [ - "futures", - "pharos", - "rustc_version 0.4.1", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -954,12 +842,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "bimap" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" - [[package]] name = "bit-set" version = "0.5.3" @@ -1178,12 +1060,6 @@ dependencies = [ "parking_lot_core", ] -[[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - [[package]] name = "der" version = "0.7.9" @@ -1258,12 +1134,6 @@ dependencies = [ "syn 2.0.95", ] -[[package]] -name = "doctest-file" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" - [[package]] name = "dunce" version = "1.0.5" @@ -1951,21 +1821,6 @@ dependencies = [ "serde", ] -[[package]] -name = "interprocess" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "894148491d817cb36b6f778017b8ac46b17408d522dd90f539d677ea938362eb" -dependencies = [ - "doctest-file", - "futures-core", - "libc", - "recvmsg", - "tokio", - "widestring", - "windows-sys 0.52.0", -] - [[package]] name = "ipnet" version = "2.10.1" @@ -2282,9 +2137,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8983bb634df7248924ee0c4c3a749609b5abcb082c28fffe3254b3eb3602b307" dependencies = [ - "alloy-rlp", "const-hex", - "proptest", "serde", "smallvec", ] @@ -2420,16 +2273,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "pharos" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" -dependencies = [ - "futures", - "rustc_version 0.4.1", -] - [[package]] name = "pin-project" version = "1.1.8" @@ -2619,12 +2462,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "recvmsg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" - [[package]] name = "redox_syscall" version = "0.5.8" @@ -2813,7 +2650,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "once_cell", - "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -2957,12 +2793,6 @@ dependencies = [ "pest", ] -[[package]] -name = "send_wrapper" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" - [[package]] name = "serde" version = "1.0.217" @@ -3398,22 +3228,6 @@ dependencies = [ "tokio-util", ] -[[package]] -name = "tokio-tungstenite" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" -dependencies = [ - "futures-util", - "log", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tungstenite", - "webpki-roots", -] - [[package]] name = "tokio-util" version = "0.7.13" @@ -3525,26 +3339,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tungstenite" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand", - "rustls", - "rustls-pki-types", - "sha1", - "thiserror 1.0.69", - "utf-8", -] - [[package]] name = "typenum" version = "1.17.0" @@ -3604,12 +3398,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf16_iter" version = "1.0.5" @@ -3755,21 +3543,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki-roots" -version = "0.26.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "widestring" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" - [[package]] name = "windows-core" version = "0.52.0" @@ -3912,25 +3685,6 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" -[[package]] -name = "ws_stream_wasm" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" -dependencies = [ - "async_io_stream", - "futures", - "js-sys", - "log", - "pharos", - "rustc_version 0.4.1", - "send_wrapper", - "thiserror 1.0.69", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "wyz" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index 5e796a9..454056c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,16 +7,16 @@ license = "MIT OR Apache-2.0" description = "ZKsync network implementation for alloy" [dependencies] -alloy = { version = "0.9.2", features = [ - "full", +alloy = { version = "0.9.2", default-features = false, features = [ "rlp", - "serde", - "sol-types", -] } # TODO: Set features granularly? -alloy-consensus-any = { version = "0.9.2" } + "serde", # TODO: Make optional along with other `serde` dependencies + "rpc-types", + "signer-local", + "reqwest", + "contract", +] } async-trait = "0.1.80" chrono = { version = "0.4.38", features = ["serde"] } -futures-utils-wasm = "0.1.0" k256 = "0.13.3" rand = "0.8.5" reqwest = "0.12.8" diff --git a/src/network/receipt_envelope.rs b/src/network/receipt_envelope.rs index e1fd5d2..7f24e59 100644 --- a/src/network/receipt_envelope.rs +++ b/src/network/receipt_envelope.rs @@ -2,8 +2,8 @@ use core::fmt; use alloy::consensus::{TxReceipt, TxType}; use alloy::network::eip2718::{Decodable2718, Eip2718Error, Encodable2718}; +use alloy::network::AnyReceiptEnvelope; use alloy::primitives::Log; -use alloy_consensus_any::AnyReceiptEnvelope; use serde::{Deserialize, Serialize}; /// Receipt envelope is a wrapper around the receipt data. @@ -91,8 +91,7 @@ impl Decodable2718 for ReceiptEnvelope { match tx_type_result { Ok(_) => alloy::consensus::ReceiptEnvelope::typed_decode(ty, buf) .map(ReceiptEnvelope::Native), - Err(_) => alloy_consensus_any::AnyReceiptEnvelope::typed_decode(ty, buf) - .map(ReceiptEnvelope::Eip712), + Err(_) => AnyReceiptEnvelope::typed_decode(ty, buf).map(ReceiptEnvelope::Eip712), } }