From f96ff13b0d21914ceaf06f8941f1e25fdf2ee164 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Tue, 26 Sep 2023 15:58:24 +0200 Subject: [PATCH 1/4] chore: remove unused dependencies --- Cargo.lock | 229 +++++++++++++++-------------- crates/interpreter/Cargo.toml | 20 +-- crates/interpreter/src/lib.rs | 1 + crates/precompile/Cargo.toml | 27 ++-- crates/precompile/src/lib.rs | 1 + crates/precompile/src/secp256k1.rs | 16 +- crates/primitives/Cargo.toml | 37 +---- crates/primitives/src/lib.rs | 1 + crates/revm/src/lib.rs | 10 +- 9 files changed, 169 insertions(+), 173 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c86d29a0b..eaeb846a7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,12 +50,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e416903084d3392ebd32d94735c395d6709415b76c7728e594d3f996f2b03e65" dependencies = [ "alloy-rlp", + "arbitrary", "bytes", "cfg-if", "const-hex", + "derive_arbitrary", "derive_more", "hex-literal", "itoa", + "proptest", + "proptest-derive", "ruint", "serde", "tiny-keccak", @@ -79,8 +83,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aa5bb468bc7c46e0c5074d418f575262ff79451242e5ac1380121ed4e23c4fd" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -116,9 +120,6 @@ name = "arbitrary" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" -dependencies = [ - "derive_arbitrary", -] [[package]] name = "ark-ff" @@ -164,7 +165,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" dependencies = [ - "quote", + "quote 1.0.33", "syn 1.0.109", ] @@ -174,7 +175,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" dependencies = [ - "quote", + "quote 1.0.33", "syn 1.0.109", ] @@ -186,7 +187,7 @@ checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ "num-bigint", "num-traits", - "quote", + "quote 1.0.33", "syn 1.0.109", ] @@ -198,8 +199,8 @@ checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ "num-bigint", "num-traits", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -256,8 +257,8 @@ version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -290,8 +291,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" dependencies = [ "proc-macro-error", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -354,8 +355,8 @@ dependencies = [ "log", "peeking_take_while", "prettyplease", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "regex", "rustc-hash", "shlex", @@ -563,18 +564,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.4" +version = "4.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d7b8d5ec32af0fadc644bf1fd509a688c2103b185644bb1e29d164e0703136" +checksum = "824956d0dca8334758a5b7f7e50518d66ea319330cbceedcf76905c2f6ab30e3" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.4" +version = "4.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5179bb514e4d7c2051749d8fcefa2ed6d06a9f4e6d69faf3805f5d80b8cf8d56" +checksum = "122ec64120a49b4563ccaedcbea7818d069ed8e9aa6d829b82d8a4128936b2ab" dependencies = [ "anstyle", "clap_lex", @@ -641,7 +642,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.4.4", + "clap 4.4.5", "criterion-plot", "is-terminal", "itertools", @@ -668,16 +669,6 @@ dependencies = [ "itertools", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.3" @@ -767,8 +758,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -778,8 +769,8 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -790,8 +781,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "rustc_version 0.4.0", "syn 1.0.109", ] @@ -895,8 +886,8 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -1015,7 +1006,7 @@ dependencies = [ "tempfile", "thiserror", "tiny-keccak", - "unicode-xid", + "unicode-xid 0.2.4", ] [[package]] @@ -1170,8 +1161,8 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -1516,8 +1507,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -1850,8 +1841,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" dependencies = [ "proc-macro-crate", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -1902,8 +1893,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" dependencies = [ "bytes", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -1928,8 +1919,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ "proc-macro-crate", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -1996,8 +1987,8 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -2078,7 +2069,7 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.67", "syn 2.0.37", ] @@ -2113,8 +2104,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", "version_check", ] @@ -2125,11 +2116,20 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "version_check", ] +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + [[package]] name = "proc-macro2" version = "1.0.67" @@ -2161,13 +2161,13 @@ dependencies = [ [[package]] name = "proptest-derive" -version = "0.4.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf16337405ca084e9c78985114633b6827711d22b9e6ef6c6c0d665eb3f0b6e" +checksum = "90b46295382dc76166cb7cf2bb4a97952464e4b7ed5a43e6cd34e1fec3349ddc" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "proc-macro2 0.4.30", + "quote 0.6.13", + "syn 0.15.44", ] [[package]] @@ -2176,13 +2176,22 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", +] + [[package]] name = "quote" version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.67", ] [[package]] @@ -2232,9 +2241,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -2242,14 +2251,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -2357,11 +2364,6 @@ dependencies = [ name = "revm-interpreter" version = "1.1.2" dependencies = [ - "arbitrary", - "derive_more", - "enumn", - "proptest", - "proptest-derive", "revm-primitives", "serde", ] @@ -2378,7 +2380,6 @@ dependencies = [ "ripemd", "secp256k1", "sha2", - "sha3", "substrate-bn", ] @@ -2388,21 +2389,14 @@ version = "1.1.2" dependencies = [ "alloy-primitives", "alloy-rlp", - "arbitrary", "auto_impl", "bitflags 2.4.0", "bitvec", - "bytes", "c-kzg", - "derive_more", "enumn", "hashbrown 0.14.0", "hex", "once_cell", - "primitive-types", - "proptest", - "proptest-derive", - "ruint", "serde", ] @@ -2476,8 +2470,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -2653,8 +2647,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" dependencies = [ "proc-macro-crate", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -2757,8 +2751,8 @@ version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -2931,8 +2925,8 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck 0.3.3", "proc-macro-error", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 1.0.109", ] @@ -2952,8 +2946,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" dependencies = [ "heck 0.4.1", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "rustversion", "syn 2.0.37", ] @@ -2977,14 +2971,25 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + [[package]] name = "syn" version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "unicode-ident", ] @@ -2994,8 +2999,8 @@ version = "2.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "unicode-ident", ] @@ -3042,8 +3047,8 @@ version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -3141,8 +3146,8 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -3226,8 +3231,8 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] @@ -3349,6 +3354,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + [[package]] name = "unicode-xid" version = "0.2.4" @@ -3449,8 +3460,8 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", "wasm-bindgen-shared", ] @@ -3473,7 +3484,7 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ - "quote", + "quote 1.0.33", "wasm-bindgen-macro-support", ] @@ -3483,8 +3494,8 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -3758,7 +3769,7 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.67", + "quote 1.0.33", "syn 2.0.37", ] diff --git a/crates/interpreter/Cargo.toml b/crates/interpreter/Cargo.toml index 50ba07e97e..44da9a4a35 100644 --- a/crates/interpreter/Cargo.toml +++ b/crates/interpreter/Cargo.toml @@ -12,32 +12,14 @@ readme = "../../README.md" [dependencies] revm-primitives = { path = "../primitives", version = "1.1.2", default-features = false } -#utility -derive_more = "0.99" -enumn = "0.1" - # optional serde = { version = "1.0", features = ["derive", "rc"], optional = true } -arbitrary = { version = "1.3", features = ["derive"], optional = true } -proptest = { version = "1.1", optional = true } -proptest-derive = { version = "0.4", optional = true } - -[dev-dependencies] -arbitrary = { version = "1.3", features = ["derive"] } -proptest = "1.1" -proptest-derive = "0.4" [features] default = ["std"] std = ["revm-primitives/std"] serde = ["dep:serde", "revm-primitives/serde"] -arbitrary = [ - "std", - "dep:arbitrary", - "dep:proptest", - "dep:proptest-derive", - "revm-primitives/arbitrary", -] +arbitrary = ["std", "revm-primitives/arbitrary"] dev = [ "memory_limit", diff --git a/crates/interpreter/src/lib.rs b/crates/interpreter/src/lib.rs index 7ecbd729d2..a55265d791 100644 --- a/crates/interpreter/src/lib.rs +++ b/crates/interpreter/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] +#![warn(unused_crate_dependencies)] extern crate alloc; diff --git a/crates/precompile/Cargo.toml b/crates/precompile/Cargo.toml index 518184ea84..07abfac633 100644 --- a/crates/precompile/Cargo.toml +++ b/crates/precompile/Cargo.toml @@ -14,37 +14,42 @@ exclude = ["build.rs", "src/blob/kzg_settings/*.txt"] [dependencies] revm-primitives = { path = "../primitives", version = "1.1.2", default-features = false } bn = { package = "substrate-bn", version = "0.6", default-features = false } -k256 = { version = "0.13", default-features = false, features = ["ecdsa"] } num = { version = "0.4.0", default-features = false, features = ["alloc"] } once_cell = { version = "1.17", default-features = false, features = ["alloc"] } ripemd = { version = "0.1", default-features = false } +sha2 = { version = "0.10", default-features = false } + +# Optional KZG precompile +c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true } + +# Either one enable the `` +k256 = { version = "0.13", default-features = false, features = [ + "ecdsa", +], optional = true } secp256k1 = { version = "0.27.0", default-features = false, features = [ "alloc", "recovery", ], optional = true } -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 } [features] default = ["std", "c-kzg", "secp256k1"] std = [ "revm-primitives/std", - "k256/std", "num/std", "once_cell/std", "ripemd/std", "sha2/std", - "sha3/std", "c-kzg?/std", + "k256?/std", "secp256k1?/std", ] -# The following features may not work on all platforms as they depend on C libraries. -# Enables the KZG point evaluation precompile. +# * Enables the KZG point evaluation precompile. c-kzg = ["dep:c-kzg", "revm-primitives/c-kzg"] -# Use `secp256k1` as a faster alternative to `k256`. -# The problem that `secp256k1` has is it fails to build for `wasm` target on Windows and Mac as it is c lib. -# In Linux it passes. If you don't require to build wasm on win/mac, it is safe to use it and it is enabled by default. +# Either enables the ecRecover precompile +k256 = ["dep:k256"] +# * `secp256k1` as a faster alternative to `k256`. secp256k1 = ["dep:secp256k1"] + +# * = This library may not work on all platforms as it depends on C libraries. diff --git a/crates/precompile/src/lib.rs b/crates/precompile/src/lib.rs index 9a70d21805..e0303ae63f 100644 --- a/crates/precompile/src/lib.rs +++ b/crates/precompile/src/lib.rs @@ -1,4 +1,5 @@ #![no_std] +#![warn(unused_crate_dependencies)] #[macro_use] extern crate alloc; diff --git a/crates/precompile/src/secp256k1.rs b/crates/precompile/src/secp256k1.rs index beb7581404..89c2643433 100644 --- a/crates/precompile/src/secp256k1.rs +++ b/crates/precompile/src/secp256k1.rs @@ -5,7 +5,7 @@ pub const ECRECOVER: PrecompileAddress = PrecompileAddress( Precompile::Standard(ec_recover_run as StandardPrecompileFn), ); -#[cfg(not(feature = "secp256k1"))] +#[cfg(all(not(feature = "secp256k1"), feature = "k256"))] #[allow(clippy::module_inception)] mod secp256k1 { use crate::B256; @@ -44,6 +44,10 @@ mod secp256k1 { Message, Secp256k1, }; + // In case that both features are enabled we prefer `secp256k1`, so silence the unused warning. + #[cfg(feature = "k256")] + use k256 as _; + pub fn ecrecover(sig: &[u8; 65], msg: &B256) -> Result { let sig = RecoverableSignature::from_compact(&sig[0..64], RecoveryId::from_i32(sig[64] as i32)?)?; @@ -57,6 +61,16 @@ mod secp256k1 { } } +#[cfg(not(any(feature = "k256", feature = "secp256k1")))] +mod secp256k1 { + use crate::B256; + + #[deprecated = "warning: no `ecRecover` backend is enabled"] + pub fn ecrecover(_sig: &[u8; 65], _msg: &B256) -> Result { + unimplemented!("no `ecRecover` backend is enabled") + } +} + fn ec_recover_run(i: &[u8], target_gas: u64) -> PrecompileResult { use alloc::vec::Vec; use core::cmp::min; diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 5e8da5c4c3..8b07514b18 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -11,12 +11,10 @@ readme = "../../README.md" [dependencies] alloy-primitives = { version = "0.3", default-features = false, features = [ - "rlp" + "rlp", ] } alloy-rlp = { version = "0.3", default-features = false, features = ["derive"] } -bytes = { version = "1.5", default-features = false } hashbrown = "0.14" -primitive-types = { version = "0.12", default-features = false } auto_impl = "1.1" bitvec = { version = "1", default-features = false, features = ["alloc"] } bitflags = { version = "2.4.0", default-features = false } @@ -25,53 +23,28 @@ bitflags = { version = "2.4.0", default-features = false } c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true } # utility -derive_more = "0.99" enumn = "0.1" -once_cell = { version = "1.18", default-features = false } +once_cell = { version = "1.18", default-features = false, optional = true } # optional serde = { version = "1.0", features = ["derive", "rc"], optional = true } -arbitrary = { version = "1.3", features = ["derive"], optional = true } -proptest = { version = "1.1", optional = true } -proptest-derive = { version = "0.4", optional = true } - -[dev-dependencies] -arbitrary = { version = "1.3", features = ["derive"] } -proptest = "1.1" -proptest-derive = "0.4" -ruint = { version = "1.10.1", features = [ - "primitive-types", - "rlp", - "proptest", - "arbitrary", -] } [build-dependencies] hex = "0.4" [features] default = ["std", "c-kzg"] -std = ["bytes/std", "alloy-rlp/std", "hex/std", "bitvec/std", "bitflags/std"] +std = ["alloy-rlp/std", "hex/std", "bitvec/std", "bitflags/std"] serde = [ "dep:serde", "alloy-primitives/serde", "hex/serde", "hashbrown/serde", - "ruint/serde", - "bytes/serde", "bitvec/serde", "bitflags/serde", "c-kzg?/serde", ] -arbitrary = [ - "std", - "ruint/arbitrary", - "ruint/proptest", - "dep:arbitrary", - "dep:proptest", - "dep:proptest-derive", - "bitflags/arbitrary", -] +arbitrary = ["std", "alloy-primitives/arbitrary", "bitflags/arbitrary"] dev = [ "memory_limit", @@ -90,4 +63,4 @@ optional_gas_refund = [] optional_no_base_fee = [] # See comments in `revm-precompile` -c-kzg = ["dep:c-kzg"] +c-kzg = ["dep:c-kzg", "dep:once_cell"] diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 33b67c74a3..ae7fb0a5f2 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] +#![warn(unused_crate_dependencies)] extern crate alloc; diff --git a/crates/revm/src/lib.rs b/crates/revm/src/lib.rs index 6b93b8705b..d13ab58649 100644 --- a/crates/revm/src/lib.rs +++ b/crates/revm/src/lib.rs @@ -1,9 +1,17 @@ #![cfg_attr(not(feature = "std"), no_std)] -#![warn(unreachable_pub)] +#![warn(unused_crate_dependencies, unreachable_pub)] #[macro_use] extern crate alloc; +// Actually used in benches and examples +#[cfg(test)] +mod unused { + use anyhow as _; + use criterion as _; + use ethers_contract as _; +} + pub mod db; mod evm; mod evm_impl; From 33bd28e58ede48fed3ed964b647f14121c14fce9 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Tue, 26 Sep 2023 16:05:33 +0200 Subject: [PATCH 2/4] secp256k1 explanation --- crates/precompile/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/precompile/Cargo.toml b/crates/precompile/Cargo.toml index 07abfac633..6651c13bfa 100644 --- a/crates/precompile/Cargo.toml +++ b/crates/precompile/Cargo.toml @@ -22,7 +22,7 @@ sha2 = { version = "0.10", default-features = false } # Optional KZG precompile c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true } -# Either one enable the `` +# Either enables the ecRecover precompile k256 = { version = "0.13", default-features = false, features = [ "ecdsa", ], optional = true } @@ -50,6 +50,8 @@ c-kzg = ["dep:c-kzg", "revm-primitives/c-kzg"] # Either enables the ecRecover precompile k256 = ["dep:k256"] # * `secp256k1` as a faster alternative to `k256`. +# The problem that `secp256k1` has is it fails to build for `wasm` target on Windows and Mac as it is c lib. +# In Linux it passes. If you don't require to build wasm on win/mac, it is safe to use it and it is enabled by default. secp256k1 = ["dep:secp256k1"] # * = This library may not work on all platforms as it depends on C libraries. From cf0a5804ea06f30cf1348c3f96709dd3d10899d7 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Tue, 26 Sep 2023 16:09:50 +0200 Subject: [PATCH 3/4] default to k256 --- crates/precompile/Cargo.toml | 12 ++++-------- crates/precompile/src/secp256k1.rs | 15 ++------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/crates/precompile/Cargo.toml b/crates/precompile/Cargo.toml index 6651c13bfa..88f21dc5ef 100644 --- a/crates/precompile/Cargo.toml +++ b/crates/precompile/Cargo.toml @@ -19,13 +19,11 @@ once_cell = { version = "1.17", default-features = false, features = ["alloc"] } ripemd = { version = "0.1", default-features = false } sha2 = { version = "0.10", default-features = false } -# Optional KZG precompile +# Optional KZG point evaluation precompile c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true } -# Either enables the ecRecover precompile -k256 = { version = "0.13", default-features = false, features = [ - "ecdsa", -], optional = true } +# ecRecover precompile +k256 = { version = "0.13", default-features = false, features = ["ecdsa"] } secp256k1 = { version = "0.27.0", default-features = false, features = [ "alloc", "recovery", @@ -35,20 +33,18 @@ secp256k1 = { version = "0.27.0", default-features = false, features = [ default = ["std", "c-kzg", "secp256k1"] std = [ "revm-primitives/std", + "k256/std", "num/std", "once_cell/std", "ripemd/std", "sha2/std", "c-kzg?/std", - "k256?/std", "secp256k1?/std", ] # * Enables the KZG point evaluation precompile. c-kzg = ["dep:c-kzg", "revm-primitives/c-kzg"] -# Either enables the ecRecover precompile -k256 = ["dep:k256"] # * `secp256k1` as a faster alternative to `k256`. # The problem that `secp256k1` has is it fails to build for `wasm` target on Windows and Mac as it is c lib. # In Linux it passes. If you don't require to build wasm on win/mac, it is safe to use it and it is enabled by default. diff --git a/crates/precompile/src/secp256k1.rs b/crates/precompile/src/secp256k1.rs index 89c2643433..f2408a7846 100644 --- a/crates/precompile/src/secp256k1.rs +++ b/crates/precompile/src/secp256k1.rs @@ -5,7 +5,7 @@ pub const ECRECOVER: PrecompileAddress = PrecompileAddress( Precompile::Standard(ec_recover_run as StandardPrecompileFn), ); -#[cfg(all(not(feature = "secp256k1"), feature = "k256"))] +#[cfg(not(feature = "secp256k1"))] #[allow(clippy::module_inception)] mod secp256k1 { use crate::B256; @@ -44,8 +44,7 @@ mod secp256k1 { Message, Secp256k1, }; - // In case that both features are enabled we prefer `secp256k1`, so silence the unused warning. - #[cfg(feature = "k256")] + // Silence the unused crate dependency warning. use k256 as _; pub fn ecrecover(sig: &[u8; 65], msg: &B256) -> Result { @@ -61,16 +60,6 @@ mod secp256k1 { } } -#[cfg(not(any(feature = "k256", feature = "secp256k1")))] -mod secp256k1 { - use crate::B256; - - #[deprecated = "warning: no `ecRecover` backend is enabled"] - pub fn ecrecover(_sig: &[u8; 65], _msg: &B256) -> Result { - unimplemented!("no `ecRecover` backend is enabled") - } -} - fn ec_recover_run(i: &[u8], target_gas: u64) -> PrecompileResult { use alloc::vec::Vec; use core::cmp::min; From d527b3fb744474004a52780d59eef94abce540b1 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Tue, 26 Sep 2023 16:15:47 +0200 Subject: [PATCH 4/4] lint only on not(test) --- crates/revm/src/lib.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/revm/src/lib.rs b/crates/revm/src/lib.rs index d13ab58649..f804392632 100644 --- a/crates/revm/src/lib.rs +++ b/crates/revm/src/lib.rs @@ -1,17 +1,10 @@ #![cfg_attr(not(feature = "std"), no_std)] -#![warn(unused_crate_dependencies, unreachable_pub)] +#![warn(unreachable_pub)] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] #[macro_use] extern crate alloc; -// Actually used in benches and examples -#[cfg(test)] -mod unused { - use anyhow as _; - use criterion as _; - use ethers_contract as _; -} - pub mod db; mod evm; mod evm_impl;