diff --git a/Cargo.lock b/Cargo.lock index d4e57fd..edb4078 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "aes" version = "0.8.1" @@ -245,7 +255,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -354,6 +364,38 @@ dependencies = [ "serde", ] +[[package]] +name = "camino" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ad0e1e3e88dd237a156ab9f571021b8a158caa0ae44b1968a241efb5144c1e" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "406c859255d568f4f742b3146d51851f3bfd49f734a2c289d9107c4395ee0062" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.0.73" @@ -463,13 +505,13 @@ dependencies = [ "bincode", "bs58", "coins-core", - "digest 0.10.3", + "digest 0.10.5", "getrandom 0.2.7", "hmac", "k256", "lazy_static", "serde", - "sha2 0.10.5", + "sha2 0.10.6", "thiserror", ] @@ -486,7 +528,7 @@ dependencies = [ "hmac", "pbkdf2", "rand 0.8.5", - "sha2 0.10.5", + "sha2 0.10.6", "thiserror", ] @@ -500,13 +542,13 @@ dependencies = [ "base64 0.12.3", "bech32", "blake2", - "digest 0.10.3", + "digest 0.10.5", "generic-array 0.14.6", "hex", "ripemd", "serde", "serde_derive", - "sha2 0.10.5", + "sha2 0.10.6", "sha3", "thiserror", ] @@ -568,9 +610,12 @@ checksum = "722e23542a15cea1f65d4a1419c4cfd7a26706c70871a13a04238ca3f40f1661" [[package]] name = "convert_case" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "core-foundation" @@ -654,6 +699,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "digest" version = "0.8.1" @@ -674,9 +730,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -703,6 +759,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "dunce" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" + [[package]] name = "ecdsa" version = "0.14.4" @@ -730,7 +792,7 @@ dependencies = [ "base16ct", "crypto-bigint", "der", - "digest 0.10.3", + "digest 0.10.5", "ff", "generic-array 0.14.6", "group", @@ -771,7 +833,7 @@ checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ "aes", "ctr", - "digest 0.10.3", + "digest 0.10.5", "hex", "hmac", "pbkdf2", @@ -779,7 +841,7 @@ dependencies = [ "scrypt", "serde", "serde_json", - "sha2 0.10.5", + "sha2 0.10.6", "sha3", "thiserror", "uuid", @@ -823,8 +885,10 @@ checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef" dependencies = [ "crunchy", "fixed-hash 0.7.0", + "impl-codec 0.6.0", "impl-rlp 0.3.0", "impl-serde 0.3.2", + "scale-info", "tiny-keccak 2.0.2", ] @@ -850,16 +914,18 @@ checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" dependencies = [ "ethbloom 0.12.1", "fixed-hash 0.7.0", + "impl-codec 0.6.0", "impl-rlp 0.3.0", "impl-serde 0.3.2", "primitive-types 0.11.1", + "scale-info", "uint 0.9.3", ] [[package]] name = "ethers" -version = "0.17.0" -source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -872,8 +938,8 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "0.17.0" -source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" dependencies = [ "ethers-core", "once_cell", @@ -883,9 +949,11 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "0.17.0" -source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" dependencies = [ + "ethers-contract-abigen", + "ethers-contract-derive", "ethers-core", "ethers-providers", "futures-util", @@ -897,21 +965,60 @@ dependencies = [ "thiserror", ] +[[package]] +name = "ethers-contract-abigen" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +dependencies = [ + "Inflector", + "cfg-if", + "dunce", + "ethers-core", + "eyre", + "getrandom 0.2.7", + "hex", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "syn", + "url", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +dependencies = [ + "ethers-contract-abigen", + "ethers-core", + "hex", + "proc-macro2", + "quote", + "serde_json", + "syn", +] + [[package]] name = "ethers-core" -version = "0.17.0" -source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" dependencies = [ "arrayvec 0.7.2", "bytes", + "cargo_metadata", "chrono", "convert_case", "elliptic-curve", "ethabi", - "fastrlp", "generic-array 0.14.6", "hex", "k256", + "once_cell", + "open-fastrlp", "proc-macro2", "rand 0.8.5", "rlp 0.5.1", @@ -928,8 +1035,8 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "0.17.0" -source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" dependencies = [ "ethers-core", "getrandom 0.2.7", @@ -944,8 +1051,8 @@ dependencies = [ [[package]] name = "ethers-middleware" -version = "0.17.0" -source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" dependencies = [ "async-trait", "auto_impl 0.5.0", @@ -969,8 +1076,8 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "0.17.0" -source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" dependencies = [ "async-trait", "auto_impl 1.0.1", @@ -1003,8 +1110,8 @@ dependencies = [ [[package]] name = "ethers-signers" -version = "0.17.0" -source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa" +version = "1.0.0" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" dependencies = [ "async-trait", "coins-bip32", @@ -1014,7 +1121,7 @@ dependencies = [ "ethers-core", "hex", "rand 0.8.5", - "sha2 0.10.5", + "sha2 0.10.6", "thiserror", ] @@ -1074,31 +1181,6 @@ dependencies = [ "instant", ] -[[package]] -name = "fastrlp" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "089263294bb1c38ac73649a6ad563dd9a5142c8dc0482be15b8b9acb22a1611e" -dependencies = [ - "arrayvec 0.7.2", - "auto_impl 1.0.1", - "bytes", - "ethereum-types 0.13.1", - "fastrlp-derive", -] - -[[package]] -name = "fastrlp-derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fa41ebc231af281098b11ad4a4f6182ec9096902afffe948034a20d4e1385a" -dependencies = [ - "bytes", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "ff" version = "0.12.0" @@ -1170,11 +1252,10 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "matches", "percent-encoding", ] @@ -1508,7 +1589,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -1620,11 +1701,10 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" dependencies = [ - "matches", "unicode-bidi", "unicode-normalization", ] @@ -1950,7 +2030,7 @@ dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "sha2 0.10.5", + "sha2 0.10.6", "sha3", ] @@ -2005,12 +2085,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" @@ -2174,9 +2248,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.14.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" @@ -2190,6 +2264,31 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "open-fastrlp" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "131de184f045153e72c537ef4f1d57babddf2a897ca19e67bdff697aebba7f3d" +dependencies = [ + "arrayvec 0.7.2", + "auto_impl 1.0.1", + "bytes", + "ethereum-types 0.13.1", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "openssl" version = "0.10.41" @@ -2344,10 +2443,10 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", "hmac", "password-hash", - "sha2 0.10.5", + "sha2 0.10.6", ] [[package]] @@ -2375,9 +2474,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pharos" @@ -2475,6 +2574,7 @@ dependencies = [ "impl-codec 0.6.0", "impl-rlp 0.3.0", "impl-serde 0.3.2", + "scale-info", "uint 0.9.3", ] @@ -2515,9 +2615,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -2675,9 +2775,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.11" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" +checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" dependencies = [ "base64 0.13.0", "bytes", @@ -2692,10 +2792,10 @@ dependencies = [ "hyper-tls", "ipnet", "js-sys", - "lazy_static", "log", "mime", "native-tls", + "once_cell", "percent-encoding", "pin-project-lite", "rustls", @@ -2743,7 +2843,7 @@ dependencies = [ "primitive-types 0.11.1", "ripemd", "secp256k1", - "sha2 0.10.5", + "sha2 0.10.6", "sha3", "substrate-bn", ] @@ -2780,7 +2880,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1facec54cb5e0dc08553501fa740091086d0259ad0067e0d4103448e4cb22ed3" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -2899,6 +2999,39 @@ dependencies = [ "cipher", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scale-info" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec 3.1.5", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdcd47b380d8c4541044e341dcd9475f55ba37ddc50c908d945fc036a8642496" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "schannel" version = "0.1.20" @@ -2924,7 +3057,7 @@ dependencies = [ "hmac", "pbkdf2", "salsa20", - "sha2 0.10.5", + "sha2 0.10.6", ] [[package]] @@ -2994,9 +3127,12 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +dependencies = [ + "serde", +] [[package]] name = "send_wrapper" @@ -3103,13 +3239,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9db03534dff993187064c4e0c05a5708d2a9728ace9a8959b77bedf415dac5" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -3118,7 +3254,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaedf34ed289ea47c2b741bb72e5357a209512d67bcd4bda44359e5bf0470f56" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", "keccak", ] @@ -3137,7 +3273,7 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0ea32af43239f0d353a7dd75a22d94c329c8cdaafdcb4c1c1335aa10c298a4a" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", "rand_core 0.6.3", ] @@ -3277,9 +3413,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.99" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -3502,9 +3638,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.36" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite", @@ -3514,9 +3650,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", @@ -3525,9 +3661,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ "once_cell", ] @@ -3638,10 +3774,16 @@ dependencies = [ ] [[package]] -name = "unicode-xid" -version = "0.2.3" +name = "unicode-segmentation" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "untrusted" @@ -3651,13 +3793,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.2.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", "idna", - "matches", "percent-encoding", ] @@ -3683,6 +3824,17 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + [[package]] name = "want" version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index f5dadc7..5cacf46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,4 +10,4 @@ members = [ ] [patch.crates-io] -ethers = { git = "https://github.com/gakonst/ethers-rs" } +ethers = { git = "https://github.com/ncitron/ethers-rs", branch = "fix-retry" } diff --git a/client/Cargo.toml b/client/Cargo.toml index e47aca6..cf31906 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -13,7 +13,7 @@ serde = { version = "1.0.143", features = ["derive"] } hex = "0.4.3" ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs" } blst = "0.3.10" -ethers = "0.17.0" +ethers = "1.0.0" jsonrpsee = { version = "0.15.1", features = ["full"] } revm = "1.9.0" bytes = "1.2.1" diff --git a/client/src/client.rs b/client/src/client.rs index 4cfa349..703b1b1 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -83,11 +83,11 @@ impl Client { } pub async fn call(&self, opts: &CallOpts, block: &BlockTag) -> Result> { - self.node.read().await.call(opts, block) + self.node.read().await.call(opts, block).await } pub async fn estimate_gas(&self, opts: &CallOpts) -> Result { - self.node.read().await.estimate_gas(opts) + self.node.read().await.estimate_gas(opts).await } pub async fn get_balance(&self, address: &Address, block: &BlockTag) -> Result { diff --git a/client/src/node.rs b/client/src/node.rs index 2433b7a..1befb44 100644 --- a/client/src/node.rs +++ b/client/src/node.rs @@ -19,7 +19,7 @@ use execution::ExecutionClient; pub struct Node { consensus: ConsensusClient, - execution: ExecutionClient, + execution: Arc>, config: Arc, payloads: BTreeMap, finalized_payloads: BTreeMap, @@ -34,7 +34,7 @@ impl Node { let consensus = ConsensusClient::new(consensus_rpc, checkpoint_hash, config.clone()).await?; - let execution = ExecutionClient::new(execution_rpc)?; + let execution = Arc::new(ExecutionClient::new(execution_rpc)?); let payloads = BTreeMap::new(); let finalized_payloads = BTreeMap::new(); @@ -99,20 +99,20 @@ impl Node { Ok(()) } - pub fn call(&self, opts: &CallOpts, block: &BlockTag) -> Result> { + pub async fn call(&self, opts: &CallOpts, block: &BlockTag) -> Result> { self.check_blocktag_age(block)?; let payload = self.get_payload(block)?; let mut evm = Evm::new(self.execution.clone(), payload.clone(), self.chain_id()); - evm.call(opts) + evm.call(opts).await } - pub fn estimate_gas(&self, opts: &CallOpts) -> Result { + pub async fn estimate_gas(&self, opts: &CallOpts) -> Result { self.check_head_age()?; let payload = self.get_payload(&BlockTag::Latest)?; let mut evm = Evm::new(self.execution.clone(), payload.clone(), self.chain_id()); - evm.estimate_gas(opts) + evm.estimate_gas(opts).await } pub async fn get_balance(&self, address: &Address, block: &BlockTag) -> Result { diff --git a/client/src/rpc.rs b/client/src/rpc.rs index 2201de5..5ff5521 100644 --- a/client/src/rpc.rs +++ b/client/src/rpc.rs @@ -41,6 +41,7 @@ impl Rpc { node: self.node.clone(), port: self.port, }; + let (handle, addr) = start(rpc_inner).await?; self.handle = Some(handle); @@ -133,14 +134,14 @@ impl EthRpcServer for RpcInner { async fn call(&self, opts: CallOpts, block: BlockTag) -> Result { let node = self.node.read().await; - let res = convert_err(node.call(&opts, &block))?; + let res = convert_err(node.call(&opts, &block).await)?; Ok(format!("0x{}", hex::encode(res))) } async fn estimate_gas(&self, opts: CallOpts) -> Result { let node = self.node.read().await; - let gas = convert_err(node.estimate_gas(&opts))?; + let gas = convert_err(node.estimate_gas(&opts).await)?; Ok(u64_to_hex_string(gas)) } diff --git a/common/Cargo.toml b/common/Cargo.toml index a73cd41..da59cfd 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -10,5 +10,5 @@ eyre = "0.6.8" serde = { version = "1.0.143", features = ["derive"] } hex = "0.4.3" ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs" } -ethers = "0.17.0" +ethers = "1.0.0" thiserror = "1.0.37" diff --git a/config/Cargo.toml b/config/Cargo.toml index 931bbd2..0b4eb1a 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -11,7 +11,7 @@ eyre = "0.6.8" serde = { version = "1.0.143", features = ["derive"] } hex = "0.4.3" ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs" } -ethers = "0.17.0" +ethers = "1.0.0" figment = { version = "0.10.7", features = ["toml", "env"] } thiserror = "1.0.37" diff --git a/consensus/Cargo.toml b/consensus/Cargo.toml index e87656b..cb3bddd 100644 --- a/consensus/Cargo.toml +++ b/consensus/Cargo.toml @@ -14,7 +14,7 @@ serde_json = "1.0.85" hex = "0.4.3" ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs" } blst = "0.3.10" -ethers = "0.17.0" +ethers = "1.0.0" bytes = "1.2.1" toml = "0.5.9" async-trait = "0.1.57" diff --git a/execution/Cargo.toml b/execution/Cargo.toml index 3ac8556..b3e8491 100644 --- a/execution/Cargo.toml +++ b/execution/Cargo.toml @@ -14,7 +14,7 @@ serde_json = "1.0.85" hex = "0.4.3" ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs" } blst = "0.3.10" -ethers = "0.17.0" +ethers = "1.0.0" revm = "1.9.0" bytes = "1.2.1" futures = "0.3.23" diff --git a/execution/src/evm.rs b/execution/src/evm.rs index cbfba71..41b625f 100644 --- a/execution/src/evm.rs +++ b/execution/src/evm.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, fmt::Display, str::FromStr, thread}; +use std::{cmp, collections::HashMap, fmt::Display, str::FromStr, sync::Arc, thread}; use bytes::Bytes; use ethers::{ @@ -27,7 +27,11 @@ pub struct Evm { } impl Evm { - pub fn new(execution: ExecutionClient, payload: ExecutionPayload, chain_id: u64) -> Self { + pub fn new( + execution: Arc>, + payload: ExecutionPayload, + chain_id: u64, + ) -> Self { let mut evm: EVM> = EVM::new(); let db = ProofDB::new(execution, payload); evm.database(db); @@ -35,41 +39,71 @@ impl Evm { Evm { evm, chain_id } } - pub fn call(&mut self, opts: &CallOpts) -> Result> { - let account_map = self.batch_fetch_accounts(opts)?; + pub async fn call(&mut self, opts: &CallOpts) -> Result> { + let account_map = self.batch_fetch_accounts(opts).await?; self.evm.db.as_mut().unwrap().set_accounts(account_map); self.evm.env = self.get_env(opts); - let output = self.evm.transact().1; + let tx = self.evm.transact(); + let output = tx.1; - if let Some(err) = &self.evm.db.as_ref().unwrap().error { - return Err(eyre::eyre!(err.clone())); - } + match tx.0 { + revm::Return::Revert => Err(eyre::eyre!("execution reverted")), + revm::Return::OutOfGas => Err(eyre::eyre!("execution reverted: out of gas")), + revm::Return::OutOfFund => Err(eyre::eyre!("not enough funds")), + revm::Return::CallTooDeep => Err(eyre::eyre!("execution reverted: call too deep")), + revm::Return::InvalidJump => { + Err(eyre::eyre!("execution reverted: invalid jump destination")) + } + revm::Return::InvalidOpcode => Err(eyre::eyre!("execution reverted: invalid opcode")), + revm::Return::LackOfFundForGasLimit => Err(eyre::eyre!("not enough funds")), + revm::Return::GasPriceLessThenBasefee => Err(eyre::eyre!("gas price too low")), + _ => { + if let Some(err) = &self.evm.db.as_ref().unwrap().error { + return Err(eyre::eyre!(err.clone())); + } - match output { - TransactOut::None => Err(eyre::eyre!("Invalid Call")), - TransactOut::Create(..) => Err(eyre::eyre!("Invalid Call")), - TransactOut::Call(bytes) => Ok(bytes.to_vec()), + match output { + TransactOut::None => Err(eyre::eyre!("Invalid Call")), + TransactOut::Create(..) => Err(eyre::eyre!("Invalid Call")), + TransactOut::Call(bytes) => Ok(bytes.to_vec()), + } + } } } - pub fn estimate_gas(&mut self, opts: &CallOpts) -> Result { - let account_map = self.batch_fetch_accounts(opts)?; + pub async fn estimate_gas(&mut self, opts: &CallOpts) -> Result { + let account_map = self.batch_fetch_accounts(opts).await?; self.evm.db.as_mut().unwrap().set_accounts(account_map); self.evm.env = self.get_env(opts); - let gas = self.evm.transact().2; + let tx = self.evm.transact(); + let gas = tx.2; - if let Some(err) = &self.evm.db.as_ref().unwrap().error { - return Err(eyre::eyre!(err.clone())); + match tx.0 { + revm::Return::Revert => Err(eyre::eyre!("execution reverted")), + revm::Return::OutOfGas => Err(eyre::eyre!("execution reverted: out of gas")), + revm::Return::OutOfFund => Err(eyre::eyre!("not enough funds")), + revm::Return::CallTooDeep => Err(eyre::eyre!("execution reverted: call too deep")), + revm::Return::InvalidJump => { + Err(eyre::eyre!("execution reverted: invalid jump destination")) + } + revm::Return::InvalidOpcode => Err(eyre::eyre!("execution reverted: invalid opcode")), + revm::Return::LackOfFundForGasLimit => Err(eyre::eyre!("not enough funds")), + revm::Return::GasPriceLessThenBasefee => Err(eyre::eyre!("gas price too low")), + _ => { + if let Some(err) = &self.evm.db.as_ref().unwrap().error { + return Err(eyre::eyre!(err.clone())); + } + + // overestimate to avoid out of gas reverts + let gas_scaled = (1.10 * gas as f64) as u64; + Ok(gas_scaled) + } } - - // overestimate to avoid out of gas reverts - let gas_scaled = (1.10 * gas as f64) as u64; - Ok(gas_scaled) } - fn batch_fetch_accounts(&self, opts: &CallOpts) -> Result> { + async fn batch_fetch_accounts(&self, opts: &CallOpts) -> Result> { let db = self.evm.db.as_ref().unwrap(); let rpc = db.execution.rpc.clone(); let payload = db.payload.clone(); @@ -86,31 +120,34 @@ impl Evm { }; let block_moved = block.clone(); - let handle = thread::spawn(move || { - let list_fut = rpc.create_access_list(&opts_moved, block_moved); - let runtime = Runtime::new()?; - let mut list = runtime.block_on(list_fut)?.0; + let mut list = rpc.create_access_list(&opts_moved, block_moved).await?.0; - let from_access_entry = AccessListItem { - address: opts_moved.from.unwrap_or_default(), - storage_keys: Vec::default(), - }; + let from_access_entry = AccessListItem { + address: opts_moved.from.unwrap_or_default(), + storage_keys: Vec::default(), + }; - let to_access_entry = AccessListItem { - address: opts_moved.to, - storage_keys: Vec::default(), - }; + let to_access_entry = AccessListItem { + address: opts_moved.to, + storage_keys: Vec::default(), + }; - let producer_account = AccessListItem { - address: Address::from_slice(&payload.fee_recipient), - storage_keys: Vec::default(), - }; + let producer_account = AccessListItem { + address: Address::from_slice(&payload.fee_recipient), + storage_keys: Vec::default(), + }; - list.push(from_access_entry); - list.push(to_access_entry); - list.push(producer_account); + list.push(from_access_entry); + list.push(to_access_entry); + list.push(producer_account); - let account_futs = list.iter().map(|account| { + let mut accounts = Vec::new(); + let batch_size = 20; + for i in (0..list.len()).step_by(batch_size) { + let end = cmp::min(i + batch_size, list.len()); + let chunk = &list[i..end]; + + let account_chunk_futs = chunk.iter().map(|account| { let addr_fut = futures::future::ready(account.address); let account_fut = execution.get_account( &account.address, @@ -120,12 +157,10 @@ impl Evm { async move { (addr_fut.await, account_fut.await) } }); - let accounts = runtime.block_on(join_all(account_futs)); + let mut account_chunk = join_all(account_chunk_futs).await; + accounts.append(&mut account_chunk); + } - Ok::<_, eyre::Error>(accounts) - }); - - let accounts = handle.join().unwrap()?; let mut account_map = HashMap::new(); accounts.iter().for_each(|account| { let addr = account.0; @@ -160,14 +195,14 @@ impl Evm { } struct ProofDB { - execution: ExecutionClient, + execution: Arc>, payload: ExecutionPayload, accounts: HashMap, error: Option, } impl ProofDB { - pub fn new(execution: ExecutionClient, payload: ExecutionPayload) -> Self { + pub fn new(execution: Arc>, payload: ExecutionPayload) -> Self { ProofDB { execution, payload, diff --git a/execution/src/rpc/http_rpc.rs b/execution/src/rpc/http_rpc.rs index 74a9343..9084bf0 100644 --- a/execution/src/rpc/http_rpc.rs +++ b/execution/src/rpc/http_rpc.rs @@ -31,8 +31,8 @@ impl Clone for HttpRpc { impl ExecutionRpc for HttpRpc { fn new(rpc: &str) -> Result { let http = Http::from_str(rpc)?; - let mut client = RetryClient::new(http, Box::new(HttpRateLimitRetryPolicy), 100, 250); - client.set_compute_units(100); + let mut client = RetryClient::new(http, Box::new(HttpRateLimitRetryPolicy), 100, 50); + client.set_compute_units(300); let provider = Provider::new(client); Ok(HttpRpc { url: rpc.to_string(), diff --git a/execution/src/rpc/mod.rs b/execution/src/rpc/mod.rs index c3ede4b..8f9a611 100644 --- a/execution/src/rpc/mod.rs +++ b/execution/src/rpc/mod.rs @@ -11,7 +11,7 @@ pub mod http_rpc; pub mod mock_rpc; #[async_trait] -pub trait ExecutionRpc: Send + Clone + 'static { +pub trait ExecutionRpc: Send + Clone + Sync + 'static { fn new(rpc: &str) -> Result where Self: Sized;