diff --git a/Cargo.lock b/Cargo.lock index 90068fab00..7f3f76b1a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,6 +43,28 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-trait" +version = "0.1.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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", +] + [[package]] name = "atty" version = "0.2.14" @@ -84,6 +106,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + [[package]] name = "bitflags" version = "1.3.2" @@ -102,15 +130,6 @@ dependencies = [ "wyz", ] -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.10.3" @@ -128,7 +147,7 @@ checksum = "c34e20109dce74b02019885a01edc8ca485380a297ed8d6eb9e63e657774074b" dependencies = [ "getrandom", "js-sys", - "primitive-types 0.12.1", + "primitive-types", "rustc-hex", "thiserror", "uint", @@ -158,6 +177,9 @@ name = "bytes" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +dependencies = [ + "serde", +] [[package]] name = "cc" @@ -171,6 +193,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "clap" version = "2.34.0" @@ -212,22 +244,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - [[package]] name = "cpufeatures" version = "0.2.5" @@ -272,6 +288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" dependencies = [ "const-oid", + "zeroize", ] [[package]] @@ -287,22 +304,13 @@ dependencies = [ "syn", ] -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - [[package]] name = "digest" version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ - "block-buffer 0.10.3", + "block-buffer", "crypto-common", "subtle", ] @@ -328,7 +336,7 @@ dependencies = [ "base16ct", "crypto-bigint", "der", - "digest 0.10.6", + "digest", "ff", "generic-array", "group", @@ -355,9 +363,9 @@ dependencies = [ [[package]] name = "ethabi" -version = "17.2.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4966fba78396ff92db3b817ee71143eccd98acf0f876b8d600e585a670c5d1b" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ "ethereum-types", "hex", @@ -372,60 +380,106 @@ dependencies = [ [[package]] name = "ethbloom" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" dependencies = [ "crunchy", - "fixed-hash 0.7.0", + "fixed-hash", + "impl-codec", "impl-rlp", - "impl-serde 0.3.2", + "impl-serde", + "scale-info", "tiny-keccak", ] [[package]] name = "ethereum-types" -version = "0.13.1" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ "ethbloom", - "fixed-hash 0.7.0", + "fixed-hash", + "impl-codec", "impl-rlp", - "impl-serde 0.3.2", - "primitive-types 0.11.1", + "impl-serde", + "primitive-types", + "scale-info", "uint", ] [[package]] -name = "fastrand" -version = "1.8.0" +name = "ethers-core" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "ade3e9c97727343984e1ceada4fdab11142d2ee3472d2c67027d56b1251d4f15" dependencies = [ - "instant", + "arrayvec", + "bytes", + "chrono", + "elliptic-curve", + "ethabi", + "generic-array", + "hex", + "k256", + "open-fastrlp", + "rand", + "rlp", + "rlp-derive", + "serde", + "serde_json", + "strum", + "thiserror", + "tiny-keccak", + "unicode-xid", ] [[package]] -name = "ff" -version = "0.12.1" +name = "ethers-providers" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +checksum = "a1a9e0597aa6b2fdc810ff58bc95e4eeaa2c219b3e615ed025106ecb027407d8" dependencies = [ - "rand_core", - "subtle", + "async-trait", + "auto_impl", + "base64", + "ethers-core", + "futures-channel", + "futures-core", + "futures-timer", + "futures-util", + "getrandom", + "hashers", + "hex", + "http", + "once_cell", + "parking_lot", + "pin-project", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-timer", + "web-sys", + "ws_stream_wasm", ] [[package]] -name = "fixed-hash" -version = "0.7.0" +name = "ff" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", + "rand_core", + "subtle", ] [[package]] @@ -446,21 +500,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.1.0" @@ -571,6 +610,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.6" @@ -647,28 +695,12 @@ dependencies = [ ] [[package]] -name = "headers" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" -dependencies = [ - "base64", - "bitflags", - "bytes", - "headers-core", - "http", - "httpdate", - "mime", - "sha1", -] - -[[package]] -name = "headers-core" -version = "0.2.0" +name = "hashers" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" dependencies = [ - "http", + "fxhash", ] [[package]] @@ -680,6 +712,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -710,7 +748,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest", ] [[package]] @@ -772,27 +810,16 @@ dependencies = [ ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "hyper-rustls" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ - "bytes", + "http", "hyper", - "native-tls", + "rustls", "tokio", - "tokio-native-tls", -] - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "tokio-rustls", ] [[package]] @@ -823,15 +850,6 @@ dependencies = [ "rlp", ] -[[package]] -name = "impl-serde" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" -dependencies = [ - "serde", -] - [[package]] name = "impl-serde" version = "0.4.0" @@ -881,6 +899,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -904,21 +925,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonrpc-core" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" -dependencies = [ - "futures", - "futures-executor", - "futures-util", - "log", - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "k256" version = "0.11.6" @@ -975,12 +981,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - [[package]] name = "memchr" version = "2.5.0" @@ -1008,25 +1008,7 @@ dependencies = [ "libc", "log", "wasi", - "windows-sys 0.42.0", -] - -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", + "windows-sys", ] [[package]] @@ -1149,56 +1131,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "openssl" -version = "0.10.43" +name = "open-fastrlp" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020433887e44c27ff16365eaa2d380547a94544ad509aff6eb5b6e3e0b27b376" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", ] [[package]] -name = "openssl-macros" -version = "0.1.0" +name = "open-fastrlp-derive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" dependencies = [ + "bytes", "proc-macro2", "quote", "syn", ] -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d5c8cb6e57b3a3612064d7b18b117912b4ce70955c2504d4b741c9e244b132" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "parity-scale-codec" version = "3.2.1" @@ -1227,25 +1183,27 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ + "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.9.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", + "instant", "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "winapi", ] [[package]] @@ -1254,6 +1212,16 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version", +] + [[package]] name = "pin-project" version = "1.0.12" @@ -1287,10 +1255,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "pkg-config" -version = "0.3.26" +name = "pkcs8" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] [[package]] name = "plain_hasher" @@ -1313,29 +1285,17 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "primitive-types" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" -dependencies = [ - "fixed-hash 0.7.0", - "impl-codec", - "impl-rlp", - "impl-serde 0.3.2", - "uint", -] - [[package]] name = "primitive-types" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ - "fixed-hash 0.8.0", + "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde 0.4.0", + "impl-serde", + "scale-info", "uint", ] @@ -1455,19 +1415,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "reqwest" +version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "reqwest" -version = "0.11.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ "base64", "bytes", @@ -1478,25 +1429,27 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-tls", + "hyper-rustls", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", + "rustls", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", - "tokio-native-tls", + "tokio-rustls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] @@ -1508,7 +1461,9 @@ dependencies = [ "auto_impl", "bytes", "derive_more", - "fixed-hash 0.8.0", + "ethers-core", + "ethers-providers", + "fixed-hash", "futures", "hashbrown 0.13.1", "hex", @@ -1520,7 +1475,6 @@ dependencies = [ "serde", "sha3", "tokio", - "web3", ] [[package]] @@ -1545,7 +1499,7 @@ dependencies = [ "once_cell", "ripemd", "ruint", - "secp256k1 0.24.1", + "secp256k1", "sha2", "sha3", "substrate-bn", @@ -1562,7 +1516,7 @@ dependencies = [ "hex-literal", "indicatif", "plain_hasher", - "primitive-types 0.12.1", + "primitive-types", "revm", "rlp", "ruint", @@ -1584,7 +1538,7 @@ dependencies = [ "getrandom", "hex", "js-sys", - "primitive-types 0.12.1", + "primitive-types", "revm", "ruint", "wasm-bindgen", @@ -1601,13 +1555,28 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "ripemd" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", + "digest", ] [[package]] @@ -1620,6 +1589,17 @@ dependencies = [ "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", +] + [[package]] name = "ruint" version = "1.7.0" @@ -1628,7 +1608,7 @@ checksum = "0ad3a104dc8c3867f653b0fec89c65e00b0ceb752718ad282177a7e0f33257ac" dependencies = [ "bn-rs", "derive_more", - "primitive-types 0.12.1", + "primitive-types", "rlp", "ruint-macro", "rustc_version", @@ -1657,6 +1637,33 @@ dependencies = [ "semver", ] +[[package]] +name = "rustls" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +dependencies = [ + "base64", +] + +[[package]] +name = "rustversion" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" + [[package]] name = "ryu" version = "1.0.11" @@ -1673,13 +1680,27 @@ dependencies = [ ] [[package]] -name = "schannel" -version = "0.1.20" +name = "scale-info" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ - "lazy_static", - "windows-sys 0.36.1", + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1688,6 +1709,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "sec1" version = "0.3.0" @@ -1697,35 +1728,18 @@ dependencies = [ "base16ct", "der", "generic-array", + "pkcs8", "subtle", "zeroize", ] -[[package]] -name = "secp256k1" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" -dependencies = [ - "secp256k1-sys 0.4.2", -] - [[package]] name = "secp256k1" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" dependencies = [ - "secp256k1-sys 0.6.1", -] - -[[package]] -name = "secp256k1-sys" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" -dependencies = [ - "cc", + "secp256k1-sys", ] [[package]] @@ -1737,35 +1751,18 @@ dependencies = [ "cc", ] -[[package]] -name = "security-framework" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +[[package]] +name = "send_wrapper" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "930c0acf610d3fdb5e2ab6213019aaa04e227ebe9547b0649ba599b16d788bd7" + [[package]] name = "serde" version = "1.0.148" @@ -1811,26 +1808,13 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha1" -version = "0.10.5" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest", ] [[package]] @@ -1841,7 +1825,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest", ] [[package]] @@ -1850,26 +1834,17 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.6", + "digest", "keccak", ] -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - [[package]] name = "signature" version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.10.6", + "digest", "rand_core", ] @@ -1898,27 +1873,22 @@ dependencies = [ "winapi", ] -[[package]] -name = "soketto" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" -dependencies = [ - "base64", - "bytes", - "futures", - "httparse", - "log", - "rand", - "sha-1", -] - [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -1948,13 +1918,35 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro-error", "proc-macro2", "quote", "syn", ] +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "substrate-bn" version = "0.6.0" @@ -1991,20 +1983,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - [[package]] name = "terminal_size" version = "0.1.17" @@ -2080,9 +2058,7 @@ dependencies = [ "memchr", "mio", "num_cpus", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "winapi", @@ -2100,24 +2076,30 @@ dependencies = [ ] [[package]] -name = "tokio-native-tls" -version = "0.3.0" +name = "tokio-rustls" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "native-tls", + "rustls", "tokio", + "webpki", ] [[package]] -name = "tokio-stream" -version = "0.1.11" +name = "tokio-tungstenite" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" dependencies = [ - "futures-core", - "pin-project-lite", + "futures-util", + "log", + "rustls", "tokio", + "tokio-rustls", + "tungstenite", + "webpki", + "webpki-roots", ] [[package]] @@ -2128,7 +2110,6 @@ checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "pin-project-lite", "tokio", @@ -2170,6 +2151,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "triehash" version = "0.8.4" @@ -2186,6 +2177,27 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "tungstenite" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +dependencies = [ + "base64", + "byteorder", + "bytes", + "http", + "httparse", + "log", + "rand", + "rustls", + "sha-1", + "thiserror", + "url", + "utf-8", + "webpki", +] + [[package]] name = "typenum" version = "1.15.0" @@ -2237,6 +2249,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -2244,15 +2268,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", - "idna 0.3.0", + "idna", "percent-encoding", ] [[package]] -name = "vcpkg" -version = "0.2.15" +name = "utf-8" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "vec_map" @@ -2359,6 +2383,21 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.60" @@ -2370,50 +2409,22 @@ dependencies = [ ] [[package]] -name = "web3" -version = "0.19.0" -source = "git+https://github.com/tomusdrw/rust-web3#c593b722d57da0c2885123867a7d4662a288d6cc" +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" dependencies = [ - "arrayvec", - "base64", - "bytes", - "derive_more", - "ethabi", - "ethereum-types", - "futures", - "futures-timer", - "headers", - "hex", - "idna 0.2.3", - "jsonrpc-core", - "log", - "once_cell", - "parking_lot", - "pin-project", - "reqwest", - "rlp", - "secp256k1 0.21.3", - "serde", - "serde_json", - "soketto", - "tiny-keccak", - "tokio", - "tokio-stream", - "tokio-util", - "url", - "web3-async-native-tls", + "ring", + "untrusted", ] [[package]] -name = "web3-async-native-tls" -version = "0.4.0" +name = "webpki-roots" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6d8d1636b2627fe63518d5a9b38a569405d9c9bc665c43c9c341de57227ebb" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ - "native-tls", - "thiserror", - "tokio", - "url", + "webpki", ] [[package]] @@ -2447,19 +2458,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -2467,12 +2465,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_x86_64_msvc", ] [[package]] @@ -2481,48 +2479,24 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - [[package]] name = "windows_aarch64_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - [[package]] name = "windows_i686_gnu" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - [[package]] name = "windows_i686_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - [[package]] name = "windows_x86_64_gnu" version = "0.42.0" @@ -2535,12 +2509,6 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - [[package]] name = "windows_x86_64_msvc" version = "0.42.0" @@ -2556,6 +2524,24 @@ dependencies = [ "winapi", ] +[[package]] +name = "ws_stream_wasm" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ca1ab42f5afed7fc332b22b6e932ca5414b209465412c8cdf0ad23bc0de645" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "pharos", + "rustc_version", + "send_wrapper", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "wyz" version = "0.5.1" diff --git a/bins/revme/Cargo.toml b/bins/revme/Cargo.toml index f129efd90c..73df9fc9b8 100644 --- a/bins/revme/Cargo.toml +++ b/bins/revme/Cargo.toml @@ -18,7 +18,7 @@ indicatif = "0.17" plain_hasher = "0.2" primitive-types = { version = "0.12", features = ["rlp", "serde"] } revm = { path = "../../crates/revm", version = "2.3.1", default-features = false, features = [ - "web3db", + "ethersdb", "std", "secp256k1", "with-serde", diff --git a/bins/revme/web3.txt b/bins/revme/web3.txt deleted file mode 100644 index 490f1f00ac..0000000000 --- a/bins/revme/web3.txt +++ /dev/null @@ -1 +0,0 @@ -cargo run -- debug --web3 https://mainnet.infura.io/v3/0954246eab5544e89ac236b668980810 --history=his.log --env.tx.caller=0xee0235eb8602dac2830a878593c29a954aa617a0 --env.tx.value=100000 --env.tx.to=0x7a250d5630b4cf539739df2c5dacb4c659f2488d --env.tx.data=7ff36ab50000000000000000000000000000000000000000000000bf09b200842a36c90d0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000ee0235eb8602dac2830a878593c29a954aa617a00000000000000000000000000000000000000000000000000000000061aab4dd0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ca7b3ba66556c4da2e2a9afef9c64f909a59430a \ No newline at end of file diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 4a945719e6..6c5aeea29c 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -10,7 +10,7 @@ version = "2.3.1" readme = "../../README.md" [dependencies] -arrayref = "0.3" +arrayref = "0.3" auto_impl = { version = "1.0", default-features = false } bytes = { version = "1.1", default-features = false } futures = { version = "0.3.24", optional = true } @@ -19,22 +19,33 @@ hex = { version = "0.4", optional = true } num_enum = { version = "0.5", default-features = false } # used for SpecId from u8 cast revm_precompiles = { path = "../revm_precompiles", version = "1.1.2", default-features = false } rlp = { version = "0.5", default-features = false } # used for create2 address calculation -ruint = { version = "1.7.0", features = ["primitive-types", "rlp",] } -serde = { version = "1.0", features = ["derive","rc"], optional = true } -tokio = { version = "1.21", features = ["rt-multi-thread", "macros"], optional = true } -web3 = { git = "https://github.com/tomusdrw/rust-web3", version = "0.19", optional = true } +ruint = { version = "1.7.0", features = ["primitive-types", "rlp"] } +serde = { version = "1.0", features = ["derive", "rc"], optional = true } +tokio = { version = "1.21", features = [ + "rt-multi-thread", + "macros", +], optional = true } +ethers-providers = { version = "1.0.2", optional = true } +ethers-core = { version = "1.0.2", optional = true } # bits B256 B160 crate -fixed-hash = { version = "0.8", default-features = false, features = ["rustc-hex"]} +fixed-hash = { version = "0.8", default-features = false, features = [ + "rustc-hex", +] } hex-literal = "0.3" derive_more = "0.99" # sha3 keccak hasher -sha3 = { version = "0.10", default-features = false, features = []} +sha3 = { version = "0.10", default-features = false, features = [] } [features] default = ["std", "secp256k1"] -dev = ["memory_limit", "optional_block_gas_limit", "optional_eip3607", "optional_gas_refund"] +dev = [ + "memory_limit", + "optional_block_gas_limit", + "optional_eip3607", + "optional_gas_refund", +] memory_limit = [] no_gas_measuring = [] optional_block_gas_limit = [] @@ -43,5 +54,6 @@ optional_gas_refund = [] std = ["bytes/std", "num_enum/std", "rlp/std"] secp256k1 = ["revm_precompiles/secp256k1"] k256 = ["revm_precompiles/k256_ecrecover"] -web3db = ["futures", "tokio", "web3"] +web3db = [] +ethersdb = ["tokio", "futures", "ethers-providers", "ethers-core", "hex"] with-serde = ["serde", "hex", "hex/serde", "hashbrown/serde"] diff --git a/crates/revm/src/db.rs b/crates/revm/src/db.rs index aac22434bf..4c63c22e79 100644 --- a/crates/revm/src/db.rs +++ b/crates/revm/src/db.rs @@ -1,9 +1,14 @@ mod in_memory_db; +#[cfg(feature = "ethersdb")] +pub mod ethersdb; +#[cfg(feature = "ethersdb")] +pub use ethersdb::EthersDB; + #[cfg(feature = "web3db")] -pub mod web3db; -#[cfg(feature = "web3db")] -pub use web3db::Web3DB; +compile_error!( + "`web3db` feature is deprecated, drop-in replacement can be found with feature `ethersdb`" +); use crate::bits::{B160, B256}; use crate::AccountInfo; diff --git a/crates/revm/src/db/ethersdb.rs b/crates/revm/src/db/ethersdb.rs new file mode 100644 index 0000000000..a17664ffce --- /dev/null +++ b/crates/revm/src/db/ethersdb.rs @@ -0,0 +1,216 @@ +use std::sync::Arc; + +use crate::{ + interpreter::bytecode::Bytecode, AccountInfo, Database, B160, B256, KECCAK_EMPTY, U256, +}; + +use ethers_core::types::{BlockId, H160 as eH160, H256, U64 as eU64}; +use ethers_providers::Middleware; +use tokio::runtime::{Handle, Runtime}; + +pub struct EthersDB +where + M: Middleware, +{ + client: Arc, + runtime: Option, + block_number: Option, +} + +impl EthersDB +where + M: Middleware, +{ + /// create ethers db connector inputs are url and block on what we are basing our database (None for latest) + pub fn new(client: Arc, block_number: Option) -> Option { + let runtime = Handle::try_current() + .is_err() + .then(|| Runtime::new().unwrap()); + + let client = client; + + let mut out = Self { + client, + runtime, + block_number: None, + }; + let bnum = if let Some(block_number) = block_number { + block_number.into() + } else { + out.block_on(out.client.get_block_number()).ok()? + }; + + out.block_number = Some(BlockId::from(bnum)); + Some(out) + } + + /// internal utility function to call tokio feature and wait for output + fn block_on(&self, f: F) -> F::Output { + match &self.runtime { + Some(runtime) => runtime.block_on(f), + None => futures::executor::block_on(f), + } + } +} + +impl Database for EthersDB +where + M: Middleware, +{ + type Error = (); + + fn basic(&mut self, address: B160) -> Result, Self::Error> { + let add = eH160::from(address.0); + + let f = async { + let nonce = self.client.get_transaction_count(add, self.block_number); + let balance = self.client.get_balance(add, self.block_number); + let code = self.client.get_code(add, self.block_number); + tokio::join!(nonce, balance, code) + }; + let (nonce, balance, code) = self.block_on(f); + // panic on not getting data? + Ok(Some(AccountInfo::new( + U256::from_limbs( + balance + .unwrap_or_else(|e| panic!("ethers get balance error: {e:?}")) + .0, + ), + nonce + .unwrap_or_else(|e| panic!("ethers get nonce error: {e:?}")) + .as_u64(), + Bytecode::new_raw( + code.unwrap_or_else(|e| panic!("ethers get code error: {e:?}")) + .0, + ), + ))) + } + + fn code_by_hash(&mut self, _code_hash: B256) -> Result { + panic!("Should not be called. Code is already loaded"); + // not needed because we already load code with basic info + } + + fn storage(&mut self, address: B160, index: U256) -> Result { + let add = eH160::from(address.0); + let index = H256::from(index.to_be_bytes()); + let f = async { + let storage = self + .client + .get_storage_at(add, index, self.block_number) + .await + .unwrap(); + U256::from_be_bytes(storage.to_fixed_bytes()) + }; + Ok(self.block_on(f)) + } + + fn block_hash(&mut self, number: U256) -> Result { + // saturate usize + if number > U256::from(u64::MAX) { + return Ok(KECCAK_EMPTY); + } + let number = eU64::from(u64::try_from(number).unwrap()); + let f = async { + self.client + .get_block(BlockId::from(number)) + .await + .ok() + .flatten() + }; + Ok(B256(self.block_on(f).unwrap().hash.unwrap().0)) + } +} + +/// Run tests with `cargo test -- --nocapture` to see print statements +#[cfg(test)] +mod tests { + use std::str::FromStr; + + use super::*; + use ethers_core::types::U256 as eU256; + use ethers_providers::{Http, Provider}; + + #[test] + fn can_get_basic() { + let client = Provider::::try_from( + "https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27", + ) + .unwrap(); + let client = Arc::new(client); + + let mut ethersdb = EthersDB::new( + Arc::clone(&client), // public infura mainnet + Some(16148323), + ) + .unwrap(); + + // ETH/USDT pair on Uniswap V2 + let address = "0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852" + .parse::() + .unwrap(); + let address = address.as_fixed_bytes().into(); + + let acc_info = ethersdb.basic(address).unwrap().unwrap(); + + // check if not empty + assert!(acc_info.exists()); + } + + #[test] + fn can_get_storage() { + let client = Provider::::try_from( + "https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27", + ) + .unwrap(); + let client = Arc::new(client); + + let mut ethersdb = EthersDB::new( + Arc::clone(&client), // public infura mainnet + Some(16148323), + ) + .unwrap(); + + // ETH/USDT pair on Uniswap V2 + let address = "0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852" + .parse::() + .unwrap(); + let address = address.as_fixed_bytes().into(); + + // select test index + let index = U256::from(5); + let storage = ethersdb.storage(address, index).unwrap(); + + // https://etherscan.io/address/0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852#readContract + // storage[5] -> factory: address + let actual = U256::from_limbs(eU256::from("0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f").0); + + assert_eq!(storage, actual); + } + + #[test] + fn can_get_block_hash() { + let client = Provider::::try_from( + "https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27", + ) + .unwrap(); + let client = Arc::new(client); + + let mut ethersdb = EthersDB::new( + Arc::clone(&client), // public infura mainnet + None, + ) + .unwrap(); + + // block number to test + let block_num = U256::from(16148323); + let block_hash = ethersdb.block_hash(block_num).unwrap(); + + // https://etherscan.io/block/16148323 + let actual = + B256::from_str("0xc133a5a4ceef2a6b5cd6fc682e49ca0f8fce3f18da85098c6a15f8e0f6f4c2cf") + .unwrap(); + + assert_eq!(block_hash, actual); + } +} diff --git a/crates/revm/src/db/web3db.rs b/crates/revm/src/db/web3db.rs deleted file mode 100644 index eb75597893..0000000000 --- a/crates/revm/src/db/web3db.rs +++ /dev/null @@ -1,116 +0,0 @@ -use crate::{ - interpreter::bytecode::Bytecode, AccountInfo, Database, B160, B256, KECCAK_EMPTY, U256, -}; -use bytes::Bytes; -use tokio::runtime::{Handle, Runtime}; -use web3::{ - transports::Http, - types::{BlockId, BlockNumber, H160 as wH160, U256 as wU256, U64 as wU64}, - Web3, -}; - -pub struct Web3DB { - web3: Web3, - runtime: Option, - block_number: Option, -} - -impl Web3DB { - /// create web3 db connector inputs are url and block on what we are basing our database (None for latest) - pub fn new(url: &str, block_number: Option) -> Option { - let runtime = Handle::try_current() - .is_err() - .then(|| Runtime::new().unwrap()); - let transport = web3::transports::Http::new(url).ok()?; - let web3 = Web3::new(transport); - - let mut out = Self { - web3, - runtime, - block_number: None, - }; - let bnum = if let Some(block_number) = block_number { - block_number.into() - } else { - out.block_on(out.web3.eth().block_number()).ok()? - }; - - out.block_number = Some(BlockNumber::Number(bnum)); - Some(out) - } - - /// internal utility function to call tokio feature and wait for output - fn block_on(&self, f: F) -> F::Output { - match &self.runtime { - Some(runtime) => runtime.block_on(f), - None => futures::executor::block_on(f), - } - } -} - -impl Database for Web3DB { - type Error = (); - - fn basic(&mut self, address: B160) -> Result, Self::Error> { - let add = wH160::from(address.0); - let f = async { - let nonce = self.web3.eth().transaction_count(add, self.block_number); - let balance = self.web3.eth().balance(add, self.block_number); - let code = self.web3.eth().code(add, self.block_number); - tokio::join!(nonce, balance, code) - }; - let (nonce, balance, code) = self.block_on(f); - // panic on not getting data? - Ok(Some(AccountInfo::new( - U256::from_limbs( - balance - .unwrap_or_else(|e| panic!("web3 get balance error:{e:?}")) - .0, - ), - nonce - .unwrap_or_else(|e| panic!("web3 get nonce error:{e:?}")) - .as_u64(), - Bytecode::new_raw(Bytes::from( - code.unwrap_or_else(|e| panic!("web3 get node error:{e:?}")) - .0, - )), - ))) - } - - fn code_by_hash(&mut self, _code_hash: B256) -> Result { - panic!("Should not be called. Code is already loaded"); - // not needed because we already load code with basic info - } - - fn storage(&mut self, address: B160, index: U256) -> Result { - let add = wH160::from(address.0); - let index = wU256(*index.as_limbs()); - let f = async { - let storage = self - .web3 - .eth() - .storage(add, index, self.block_number) - .await - .unwrap(); - U256::from_be_bytes(storage.to_fixed_bytes()) - }; - Ok(self.block_on(f)) - } - - fn block_hash(&mut self, number: U256) -> Result { - // saturate usize - if number > U256::from(u64::MAX) { - return Ok(KECCAK_EMPTY); - } - let number = wU64::from(u64::try_from(number).unwrap()); - let f = async { - self.web3 - .eth() - .block(BlockId::Number(BlockNumber::Number(number))) - .await - .ok() - .flatten() - }; - Ok(B256(self.block_on(f).unwrap().hash.unwrap().0)) - } -}