diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe9f7c2b..6940c3ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,10 @@ jobs: toolchain: stable components: rustfmt, clippy + - name: Install cargo sort + run: | + cargo install cargo-sort + - name: Setup Rust cache uses: Swatinem/rust-cache@v2 diff --git a/Cargo.lock b/Cargo.lock index 7788259f..00c4d527 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,12 +27,16 @@ dependencies = [ "expanded-pathbuf", "hex", "jsonrpsee", + "page_size 0.5.0", "parking_lot 0.12.1", "prost", "prost-build", "protobuf-src", "regex", + "reth-db", + "reth-libmdbx", "ron", + "rustc-hex", "serde", "serde_json", "tempdir", @@ -54,6 +58,28 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.20" @@ -63,11 +89,20 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "arrayref" @@ -113,9 +148,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.61" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -133,6 +168,15 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "atomic-polyfill" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" +dependencies = [ + "critical-section", +] + [[package]] name = "atty" version = "0.2.14" @@ -185,9 +229,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.6.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1304eab461cf02bd70b083ed8273388f9724c549b316ba3d1e213ce0e9e7fb7e" +checksum = "e5694b64066a2459918d8074c2ce0d5a88f409431994c2356617c8ae0c4721fc" dependencies = [ "async-trait", "axum-core", @@ -214,9 +258,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f487e40dc9daee24d8a1779df88522f159a54a980f99cfbe43db0be0bd3444a8" +checksum = "1cae3e661676ffbacb30f1a824089a8c9150e71017f7e1e38f2aa32009188d34" dependencies = [ "async-trait", "bytes", @@ -299,6 +343,26 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.61.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a022e58a142a46fea340d68012b9201c094e93ec3d033a944a24f8fd4a4f09a" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -398,9 +462,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b" +checksum = "b7f0778972c64420fdedc63f09919c8a88bda7b25135357fd25a5d9f3257e832" dependencies = [ "memchr", "serde", @@ -432,9 +496,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" dependencies = [ "serde", ] @@ -459,9 +523,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a" +checksum = "08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07" dependencies = [ "camino", "cargo-platform", @@ -473,9 +537,18 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cexpr" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] [[package]] name = "cfg-if" @@ -489,8 +562,11 @@ version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ + "iana-time-zone", "num-integer", "num-traits", + "serde", + "winapi", ] [[package]] @@ -503,11 +579,22 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" -version = "4.1.1" +version = "4.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2" +checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" dependencies = [ "bitflags", "clap_derive", @@ -540,6 +627,34 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "codecs-derive" +version = "0.1.0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "syn", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "coins-bip32" version = "0.7.0" @@ -618,6 +733,12 @@ dependencies = [ "unicode-segmentation", ] +[[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" @@ -627,6 +748,27 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" + +[[package]] +name = "critical-section" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" + [[package]] name = "crossbeam-channel" version = "0.5.6" @@ -707,6 +849,85 @@ dependencies = [ "cipher", ] +[[package]] +name = "cxx" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc831ee6a32dd495436e317595e639a587aa9907bef96fe6e6abc290ab6204e9" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94331d54f1b1a8895cd81049f7eaaaef9d05a7dcb4d1fd08bf3ff0806246789d" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48dcd35ba14ca9b40d6e4b4b39961f23d835dbb8eed74565ded361d93e1feb8a" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bbeb29798b407ccd82a3324ade1a7286e0d29851475990b612670f6f5124d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "der" version = "0.6.1" @@ -838,9 +1059,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" @@ -873,9 +1094,9 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.31" +version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ "cfg-if", ] @@ -913,6 +1134,17 @@ dependencies = [ "syn", ] +[[package]] +name = "enumn" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88bcb3a067a6555d577aba299e75eff9942da276e6506fc6274327daa026132" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "errno" version = "0.2.8" @@ -991,7 +1223,7 @@ dependencies = [ [[package]] name = "ethereum-interfaces" version = "0.1.0" -source = "git+https://github.com/ledgerwatch/interfaces#70b7f70105013c5b6fb0eb517eed5a9ee92de7f7" +source = "git+https://github.com/ledgerwatch/interfaces#90995b4ec0a6ac9f8c4591ee10d435cdf751918f" dependencies = [ "arrayref", "ethereum-types", @@ -1026,7 +1258,7 @@ source = "git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e5 dependencies = [ "ethers-addressbook", "ethers-contract", - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "ethers-etherscan", "ethers-middleware", "ethers-providers", @@ -1039,7 +1271,7 @@ name = "ethers-addressbook" version = "1.0.2" source = "git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8#c60990d7b6e6b3034f1e50b27b495aeda30e35e8" dependencies = [ - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "once_cell", "serde", "serde_json", @@ -1052,7 +1284,7 @@ source = "git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e5 dependencies = [ "ethers-contract-abigen", "ethers-contract-derive", - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "ethers-providers", "futures-util", "hex", @@ -1071,7 +1303,7 @@ dependencies = [ "Inflector", "cfg-if", "dunce", - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "eyre", "getrandom", "hex", @@ -1093,7 +1325,7 @@ version = "1.0.2" source = "git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8#c60990d7b6e6b3034f1e50b27b495aeda30e35e8" dependencies = [ "ethers-contract-abigen", - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "hex", "proc-macro2", "quote", @@ -1132,12 +1364,40 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "ethers-core" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs#e20bb715699280402c155a0abbfc82656582242e" +dependencies = [ + "arrayvec", + "bytes", + "chrono", + "elliptic-curve", + "ethabi", + "generic-array 0.14.6", + "getrandom", + "hex", + "k256", + "num_enum", + "open-fastrlp", + "rand 0.8.5", + "rlp", + "rlp-derive", + "serde", + "serde_json", + "strum", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", +] + [[package]] name = "ethers-etherscan" version = "1.0.2" source = "git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8#c60990d7b6e6b3034f1e50b27b495aeda30e35e8" dependencies = [ - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "ethers-solc", "getrandom", "reqwest", @@ -1157,7 +1417,7 @@ dependencies = [ "async-trait", "auto_impl 0.5.0", "ethers-contract", - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "ethers-etherscan", "ethers-providers", "ethers-signers", @@ -1183,7 +1443,7 @@ dependencies = [ "auto_impl 1.0.1", "base64 0.21.0", "enr", - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "futures-core", "futures-timer", "futures-util", @@ -1219,7 +1479,7 @@ dependencies = [ "coins-bip39", "elliptic-curve", "eth-keystore", - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "hex", "rand 0.8.5", "sha2 0.10.6", @@ -1233,7 +1493,7 @@ source = "git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e5 dependencies = [ "cfg-if", "dunce", - "ethers-core", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs.git?rev=c60990d7b6e6b3034f1e50b27b495aeda30e35e8)", "getrandom", "glob", "hex", @@ -1355,9 +1615,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -1370,9 +1630,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1380,15 +1640,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1397,9 +1657,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" [[package]] name = "futures-locks" @@ -1413,9 +1673,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1424,15 +1684,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-timer" @@ -1442,9 +1702,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1548,12 +1808,37 @@ dependencies = [ "tracing", ] +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", + "serde", +] + [[package]] name = "hashers" version = "1.0.1" @@ -1563,11 +1848,25 @@ dependencies = [ "fxhash", ] +[[package]] +name = "heapless" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version", + "serde", + "spin 0.9.5", + "stable_deref_trait", +] + [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1587,11 +1886,26 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "hmac" @@ -1653,9 +1967,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.23" +version = "0.14.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" dependencies = [ "bytes", "futures-channel", @@ -1700,6 +2014,36 @@ dependencies = [ "tokio-io-timeout", ] +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -1761,7 +2105,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", ] [[package]] @@ -1787,12 +2132,12 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -1803,14 +2148,14 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -1830,9 +2175,9 @@ checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -1985,12 +2330,37 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + [[package]] name = "linux-raw-sys" version = "0.1.4" @@ -2046,12 +2416,40 @@ dependencies = [ "autocfg", ] +[[package]] +name = "metrics" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b9b8653cec6897f73b519a43fba5ee3d50f62fe9af80b428accdcc093b4a849" +dependencies = [ + "ahash 0.7.6", + "metrics-macros", + "portable-atomic", +] + +[[package]] +name = "metrics-macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "731f8ecebd9f3a4aa847dfe75455e4757a45da40a7793d2f0b1f9b6ed18b23f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "mime" version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "mio" version = "0.8.5" @@ -2061,7 +2459,28 @@ dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "modular-bitfield" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" +dependencies = [ + "modular-bitfield-impl", + "static_assertions", +] + +[[package]] +name = "modular-bitfield-impl" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -2076,6 +2495,25 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -2128,18 +2566,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2202,15 +2640,36 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "page_size" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "page_size" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b7663cbd190cfd818d08efa8497f6cd383076688c49a391ef7c0d03cd12b561" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "c3840933452adf7b3b9145e27086a5a3376c619dca1a21b1e5a5af0d54979bed" dependencies = [ "arrayvec", "bitvec 1.0.1", "byte-slice-cast", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2218,9 +2677,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2246,7 +2705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.6", + "parking_lot_core 0.9.7", ] [[package]] @@ -2265,15 +2724,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -2305,6 +2764,12 @@ dependencies = [ "sha2 0.10.6", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "percent-encoding" version = "2.2.0" @@ -2313,9 +2778,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "petgraph" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", "indexmap", @@ -2430,6 +2895,32 @@ dependencies = [ "spki", ] +[[package]] +name = "plain_hasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e19e6491bdde87c2c43d70f4c194bc8a758f2eb732df00f61e43f7362e3b4cc" +dependencies = [ + "crunchy", +] + +[[package]] +name = "portable-atomic" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" + +[[package]] +name = "postcard" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c2b180dc0bade59f03fd005cb967d3f1e5f69b13922dad0cd6e047cb8af2363" +dependencies = [ + "cobs", + "heapless", + "serde", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2468,13 +2959,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -2503,9 +2993,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -2665,9 +3155,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2732,11 +3222,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.13" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", "bytes", "encoding_rs", "futures-core", @@ -2769,6 +3259,211 @@ dependencies = [ "winreg", ] +[[package]] +name = "reth-codecs" +version = "0.1.0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "bytes", + "codecs-derive", + "revm-interpreter", +] + +[[package]] +name = "reth-db" +version = "0.1.0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "bytes", + "futures", + "heapless", + "metrics", + "modular-bitfield", + "page_size 0.4.2", + "parity-scale-codec", + "postcard", + "rand 0.8.5", + "reth-codecs", + "reth-interfaces", + "reth-libmdbx", + "reth-primitives", + "serde", + "thiserror", + "tokio-stream", +] + +[[package]] +name = "reth-eth-wire" +version = "0.1.0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "bytes", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs)", + "futures", + "hex", + "metrics", + "pin-project", + "reth-codecs", + "reth-primitives", + "reth-rlp", + "serde", + "smol_str", + "snap", + "thiserror", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "reth-interfaces" +version = "0.1.0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "async-trait", + "auto_impl 1.0.1", + "bytes", + "futures", + "modular-bitfield", + "parity-scale-codec", + "rand 0.8.5", + "reth-codecs", + "reth-eth-wire", + "reth-network-api", + "reth-primitives", + "reth-rpc-types", + "thiserror", + "tokio", + "tokio-stream", +] + +[[package]] +name = "reth-libmdbx" +version = "0.1.6" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "bitflags", + "byteorder", + "derive_more", + "indexmap", + "libc", + "parking_lot 0.12.1", + "reth-mdbx-sys", + "thiserror", +] + +[[package]] +name = "reth-mdbx-sys" +version = "0.12.1-0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "bindgen", + "cc", + "libc", +] + +[[package]] +name = "reth-network-api" +version = "0.1.0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "async-trait", + "reth-eth-wire", + "reth-primitives", + "serde", + "thiserror", + "tokio", +] + +[[package]] +name = "reth-primitives" +version = "0.1.0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "bytes", + "crc", + "derive_more", + "ethers-core 1.0.2 (git+https://github.com/gakonst/ethers-rs)", + "fixed-hash", + "hash-db", + "hex", + "hex-literal", + "impl-serde", + "modular-bitfield", + "once_cell", + "parity-scale-codec", + "plain_hasher", + "reth-codecs", + "reth-rlp", + "reth-rlp-derive", + "revm-interpreter", + "secp256k1", + "serde", + "serde_json", + "serde_with", + "strum", + "sucds", + "thiserror", + "tiny-keccak", + "triehash", + "url", +] + +[[package]] +name = "reth-rlp" +version = "0.1.2" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "arrayvec", + "auto_impl 1.0.1", + "bytes", + "ethereum-types", + "reth-rlp-derive", + "revm-interpreter", + "smol_str", +] + +[[package]] +name = "reth-rlp-derive" +version = "0.1.1" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "reth-rpc-types" +version = "0.1.0" +source = "git+https://github.com/paradigmxyz/reth.git?rev=314ea0883b1062375ad86577be1fccc39233739d#314ea0883b1062375ad86577be1fccc39233739d" +dependencies = [ + "bytes", + "reth-network-api", + "reth-primitives", + "reth-rlp", + "serde", + "serde_json", +] + +[[package]] +name = "revm-interpreter" +version = "3.0.0" +source = "git+https://github.com/bluealloy/revm?rev=a05fb262d87c78ee52d400e6c0f4708d4c527f32#a05fb262d87c78ee52d400e6c0f4708d4c527f32" +dependencies = [ + "bytes", + "derive_more", + "enumn", + "fixed-hash", + "hashbrown 0.13.2", + "hex", + "hex-literal", + "rlp", + "ruint", + "serde", + "sha3", +] + [[package]] name = "rfc6979" version = "0.3.1" @@ -2789,7 +3484,7 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi", @@ -2836,6 +3531,27 @@ dependencies = [ "serde", ] +[[package]] +name = "ruint" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad3a104dc8c3867f653b0fec89c65e00b0ceb752718ad282177a7e0f33257ac" +dependencies = [ + "derive_more", + "primitive-types", + "rlp", + "ruint-macro", + "rustc_version", + "serde", + "thiserror", +] + +[[package]] +name = "ruint-macro" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cc5760263ea229d367e7dff3c0cbf09e4797a125bd87059a6c095804f3b2d1" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -2859,16 +3575,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.6" +version = "0.36.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -2952,6 +3668,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + [[package]] name = "scrypt" version = "0.10.0" @@ -2988,6 +3710,24 @@ dependencies = [ "zeroize", ] +[[package]] +name = "secp256k1" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +dependencies = [ + "cc", +] + [[package]] name = "semver" version = "1.0.16" @@ -2999,9 +3739,9 @@ dependencies = [ [[package]] name = "send_wrapper" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "930c0acf610d3fdb5e2ab6213019aaa04e227ebe9547b0649ba599b16d788bd7" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" @@ -3035,9 +3775,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -3056,6 +3796,34 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d904179146de381af4c93d3af6ca4984b3152db687dacb9c3c35e86f39809c" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "indexmap", + "serde", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1966009f3c05f095697c537312f5415d1e3ed31ce0a56942bac4c771c5c335e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha-1" version = "0.9.8" @@ -3120,6 +3888,12 @@ dependencies = [ "dirs", ] +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -3160,6 +3934,21 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "smol_str" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad6c857cbab2627dcf01ec85a623ca4e7dcb5691cbaa3d7fb7653671f0d09c9" +dependencies = [ + "serde", +] + +[[package]] +name = "snap" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" + [[package]] name = "socket2" version = "0.4.7" @@ -3205,6 +3994,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.6.0" @@ -3215,6 +4013,12 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -3268,6 +4072,15 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "sucds" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c1c7f814471a34d2355f9eb25ef3517ec491ac243612b1c83137739998c5444" +dependencies = [ + "anyhow", +] + [[package]] name = "syn" version = "1.0.107" @@ -3281,9 +4094,9 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "tap" @@ -3364,6 +4177,33 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +dependencies = [ + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +dependencies = [ + "time-core", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -3384,15 +4224,15 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.24.2" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", "bytes", @@ -3405,7 +4245,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -3468,13 +4308,30 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", +] + [[package]] name = "tonic" version = "0.8.3" @@ -3640,6 +4497,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "triehash" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1631b201eb031b563d2e85ca18ec8092508e262a3196ce9bd10a67ec87b9f5c" +dependencies = [ + "hash-db", + "rlp", +] + [[package]] name = "try-lock" version = "0.2.4" @@ -3666,9 +4533,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" @@ -3687,9 +4554,15 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.0" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode-width" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unicode-xid" @@ -3765,9 +4638,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3775,9 +4648,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -3790,9 +4663,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if", "js-sys", @@ -3802,9 +4675,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3812,9 +4685,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -3825,9 +4698,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasm-timer" @@ -3846,9 +4719,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", @@ -3875,9 +4748,9 @@ dependencies = [ [[package]] name = "which" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" dependencies = [ "either", "libc", @@ -3930,6 +4803,30 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" @@ -3983,13 +4880,14 @@ dependencies = [ [[package]] name = "ws_stream_wasm" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47ca1ab42f5afed7fc332b22b6e932ca5414b209465412c8cdf0ad23bc0de645" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" dependencies = [ "async_io_stream", "futures", "js-sys", + "log", "pharos", "rustc_version", "send_wrapper", diff --git a/Cargo.toml b/Cargo.toml index 8e774632..d4358311 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,14 +15,18 @@ clap = { version = "4", features = ["derive"] } dirs = "4.0" educe = { version = "0.4", features = ["Debug", "Default"] } ethereum-interfaces = { git = "https://github.com/ledgerwatch/interfaces" } -ethers = { git = "https://github.com/gakonst/ethers-rs.git", rev = "c60990d7b6e6b3034f1e50b27b495aeda30e35e8", features = ["ethers-solc"] } +ethers = { git = "https://github.com/gakonst/ethers-rs.git", rev = "c60990d7b6e6b3034f1e50b27b495aeda30e35e8", features = ["ethers-solc"] } expanded-pathbuf = "0.1" hex = { version = "0.4.3", default-features = false, features = ["std"] } jsonrpsee = { version = "0.16", features = ["server", "macros"] } +page_size = "0.5.0" parking_lot = "0.12" prost = "0.11" regex = "1" +reth-db = { git = "https://github.com/paradigmxyz/reth.git", rev = "314ea0883b1062375ad86577be1fccc39233739d" } +reth-libmdbx = { git = "https://github.com/paradigmxyz/reth.git", rev = "314ea0883b1062375ad86577be1fccc39233739d" } ron = "0.8" +rustc-hex = "^2.0.1" serde = "1" serde_json = "1" tokio = { version = "1.18", features = ["full"] } @@ -39,9 +43,9 @@ tempdir = "0.3.7" [build-dependencies] anyhow = "1" -ethers = { git = "https://github.com/gakonst/ethers-rs.git", rev = "c60990d7b6e6b3034f1e50b27b495aeda30e35e8", features = ["ethers-solc"] } -protobuf-src = "1.1.0" +ethers = { git = "https://github.com/gakonst/ethers-rs.git", rev = "c60990d7b6e6b3034f1e50b27b495aeda30e35e8", features = ["ethers-solc"] } prost-build = "0.11" +protobuf-src = "1.1.0" tonic-build = "0.8" [[bin]] diff --git a/Makefile b/Makefile index 6198dc88..c55baf61 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ format: lint: cargo fmt --all -- --check cargo clippy -- -D warnings -A clippy::derive_partial_eq_without_eq -D clippy::unwrap_used -D clippy::uninlined_format_args + cargo sort --check clean: cd thirdparty/account-abstraction && yarn clean && cd ../.. diff --git a/src/types/mod.rs b/src/types/mod.rs index cc4efcc8..e91060a0 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -1,2 +1,3 @@ pub mod reputation; pub mod user_operation; +pub mod utils; diff --git a/src/types/user_operation.rs b/src/types/user_operation.rs index 39a28181..7b835b59 100644 --- a/src/types/user_operation.rs +++ b/src/types/user_operation.rs @@ -1,12 +1,50 @@ use crate::contracts::gen::entry_point_api; -use ethers::abi::AbiEncode; +use ethers::abi::{AbiDecode, AbiEncode}; use ethers::prelude::{EthAbiCodec, EthAbiType}; use ethers::types::{Address, Bytes, TransactionReceipt, H256, U256}; use ethers::utils::keccak256; +use reth_db::table::{Compress, Decode, Decompress, Encode}; +use rustc_hex::FromHexError; use serde::{Deserialize, Serialize}; use std::ops::Deref; +use std::str::FromStr; -pub type UserOperationHash = H256; +#[derive( + Eq, Hash, PartialEq, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialOrd, Ord, +)] +pub struct UserOperationHash(pub H256); + +impl From for UserOperationHash { + fn from(value: H256) -> Self { + Self(value) + } +} + +impl From for H256 { + fn from(value: UserOperationHash) -> Self { + value.0 + } +} + +impl FromStr for UserOperationHash { + type Err = FromHexError; + fn from_str(s: &str) -> Result { + H256::from_str(s).map(|h| h.into()) + } +} + +impl Decode for UserOperationHash { + fn decode>(value: B) -> Result { + Ok(H256::from_slice(value.into().as_ref()).into()) + } +} + +impl Encode for UserOperationHash { + type Encoded = [u8; 32]; + fn encode(self) -> Self::Encoded { + *self.0.as_fixed_bytes() + } +} #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, EthAbiCodec, EthAbiType)] #[serde(rename_all = "camelCase")] @@ -69,6 +107,7 @@ impl UserOperation { ) .as_slice(), ) + .into() } #[cfg(test)] @@ -89,6 +128,19 @@ impl UserOperation { } } +impl Compress for UserOperation { + type Compressed = Bytes; + fn compress(self) -> Self::Compressed { + self.pack() + } +} + +impl Decompress for UserOperation { + fn decompress>(value: B) -> Result { + Self::decode(value.into()).map_err(|_e| reth_db::Error::DecodeError) + } +} + #[derive(Serialize, Deserialize)] pub struct UserOperationReceipt { pub user_op_hash: UserOperationHash, @@ -216,6 +268,7 @@ mod tests { ), H256::from_str("0x42e145138104ec4124367ea3f7994833071b2011927290f6844d593e05011279") .unwrap() + .into() ); assert_eq!( user_operations[1].hash( @@ -226,6 +279,7 @@ mod tests { ), H256::from_str("0x583c8fcba470fd9da514f9482ccd31c299b0161a36b365aab353a6bfebaa0bb2") .unwrap() + .into() ); } } diff --git a/src/types/utils.rs b/src/types/utils.rs new file mode 100644 index 00000000..a34b117f --- /dev/null +++ b/src/types/utils.rs @@ -0,0 +1,30 @@ +use ethers::types::Address; +use reth_db::table::{Decode, Encode}; + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] +pub struct WrapAddress(Address); + +impl Decode for WrapAddress { + fn decode>(value: B) -> Result { + Ok(Address::from_slice(value.into().as_ref()).into()) + } +} + +impl Encode for WrapAddress { + type Encoded = [u8; 20]; + fn encode(self) -> Self::Encoded { + *self.0.as_fixed_bytes() + } +} + +impl From
for WrapAddress { + fn from(value: Address) -> Self { + Self(value) + } +} + +impl From for Address { + fn from(value: WrapAddress) -> Self { + value.0 + } +} diff --git a/src/uopool/database.rs b/src/uopool/database.rs new file mode 100644 index 00000000..3b66667e --- /dev/null +++ b/src/uopool/database.rs @@ -0,0 +1,328 @@ +use std::path::PathBuf; + +use super::Mempool; +use crate::types::{ + user_operation::{UserOperation, UserOperationHash}, + utils::WrapAddress, +}; +use ethers::types::{Address, U256}; +use reth_db::{ + cursor::{DbCursorRO, DbDupCursorRO}, + database::{Database, DatabaseGAT}, + mdbx::{ + tx::{self, Tx}, + DatabaseFlags, Environment, EnvironmentFlags, EnvironmentKind, Geometry, Mode, PageSize, + SyncMode, RO, RW, + }, + table, + table::DupSort, + transaction::{DbTx, DbTxMut}, + Error, TableType, +}; + +table!( + /// UserOperation DB + ( UserOperationDB ) UserOperationHash | UserOperation + // Sender to UserOperationHash +); + +table!( + /// Benefit for merklization is that hashed addresses/keys are sorted. + ( SenderUserOperationDB ) WrapAddress | UserOperation +); + +/// Default tables that should be present inside database. +pub const TABLES: [(TableType, &str); 2] = [ + (TableType::Table, UserOperationDB::const_name()), + (TableType::DupSort, SenderUserOperationDB::const_name()), +]; + +impl DupSort for SenderUserOperationDB { + type SubKey = WrapAddress; +} + +#[derive(Debug)] +pub struct Env { + /// Libmdbx-sys environment. + pub inner: Environment, +} + +#[derive(Debug)] +pub struct UserOpDatabase { + _path: PathBuf, + env: Env, +} + +impl<'a, E: EnvironmentKind> DatabaseGAT<'a> for Env { + type TX = tx::Tx<'a, RO, E>; + type TXMut = tx::Tx<'a, RW, E>; +} + +impl Database for Env { + fn tx(&self) -> Result<>::TX, Error> { + Ok(Tx::new( + self.inner + .begin_ro_txn() + .map_err(|e| Error::InitTransaction(e.into()))?, + )) + } + + fn tx_mut(&self) -> Result<>::TXMut, Error> { + Ok(Tx::new( + self.inner + .begin_rw_txn() + .map_err(|e| Error::InitTransaction(e.into()))?, + )) + } +} + +#[derive(Debug, PartialEq, Eq)] +pub enum DBError { + DBInternalError(Error), + NotFound, +} + +impl From for DBError { + fn from(value: Error) -> Self { + DBError::DBInternalError(value) + } +} + +impl Mempool for UserOpDatabase { + type UserOperations = Vec; + type Error = DBError; + fn add( + &mut self, + user_operation: UserOperation, + entry_point: &Address, + chain_id: &U256, + ) -> Result { + let hash = user_operation.hash(entry_point, chain_id); + let tx = self.env.tx_mut()?; + tx.put::(hash, user_operation.clone())?; + tx.put::(user_operation.sender.into(), user_operation)?; + tx.commit()?; + Ok(hash) + } + + fn get( + &self, + user_operation_hash: &UserOperationHash, + ) -> Result, DBError> { + let tx = self.env.tx()?; + let res = tx.get::(*user_operation_hash)?; + tx.commit()?; + Ok(res) + } + + fn get_all_by_sender(&self, sender: &Address) -> Self::UserOperations { + let wrap_sender: WrapAddress = (*sender).into(); + self.env + .tx() + .and_then(|tx| { + let mut cursor = tx.cursor_dup_read::()?; + let res = cursor + .walk_dup(wrap_sender.clone(), Address::default().into())? + .map(|a| a.map(|(_, v)| v)) + .collect::, _>>()?; + tx.commit()?; + Ok(res) + }) + .unwrap_or_else(|_| vec![]) + } + + fn remove(&mut self, user_operation_hash: &UserOperationHash) -> Result<(), DBError> { + let tx = self.env.tx_mut()?; + if let Some(user_op) = tx.get::(*user_operation_hash)? { + tx.delete::(*user_operation_hash, None)?; + tx.delete::(user_op.sender.into(), Some(user_op))?; + tx.commit()?; + Ok(()) + } else { + Err(DBError::NotFound) + } + } + + #[cfg(debug_assertions)] + fn get_all(&self) -> Self::UserOperations { + self.env + .tx() + .and_then(|tx| { + let mut c = tx.cursor_read::()?; + let res = c + .walk(UserOperationHash::default())? + .map(|a| a.map(|(_, v)| v)) + .collect::, _>>()?; + tx.commit()?; + Ok(res) + }) + .unwrap_or_else(|_| vec![]) + } + + #[cfg(debug_assertions)] + fn clear(&mut self) { + self.env + .tx_mut() + .and_then(|tx| { + tx.clear::()?; + tx.clear::()?; + tx.commit() + }) + .expect("Clear database failed"); + } +} +fn default_page_size() -> usize { + let os_page_size = page_size::get(); + + // source: https://gitflic.ru/project/erthink/libmdbx/blob?file=mdbx.h#line-num-821 + let libmdbx_max_page_size = 0x10000; + + // May lead to errors if it's reduced further because of the potential size of the + // data. + let min_page_size = 4096; + + os_page_size.clamp(min_page_size, libmdbx_max_page_size) +} + +impl UserOpDatabase { + pub fn new(path: PathBuf) -> anyhow::Result { + let env = Environment::new() + .set_max_dbs(TABLES.len()) + .set_geometry(Geometry { + size: Some(0..(1024 * 1024 * 1024 * 1024 * 4)), // TODO: reevaluate (4 tb) + growth_step: Some(1024 * 1024 * 256), // TODO: reevaluate (256 mb) + shrink_threshold: None, + page_size: Some(PageSize::Set(default_page_size())), + }) + .set_flags(EnvironmentFlags { + mode: Mode::ReadWrite { + sync_mode: SyncMode::Durable, + }, + no_rdahead: true, // TODO: reevaluate + coalesce: true, + ..Default::default() + }) + .open(path.as_path()) + .map_err(|e| Error::DatabaseLocation(e.into()))?; + + Ok(Self { + _path: path, + env: Env { inner: env }, + }) + } + + /// Creates all the defined tables, if necessary. + pub fn create_tables(&self) -> Result<(), Error> { + let tx = self + .env + .inner + .begin_rw_txn() + .map_err(|e| Error::InitTransaction(e.into()))?; + + for (table_type, table) in TABLES { + let flags = match table_type { + TableType::Table => DatabaseFlags::default(), + TableType::DupSort => DatabaseFlags::DUP_SORT, + }; + + tx.create_db(Some(table), flags) + .map_err(|e| Error::TableCreation(e.into()))?; + } + + tx.commit().map_err(|e| Error::Commit(e.into()))?; + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use ethers::types::{H256, U256}; + use reth_db::mdbx::NoWriteMap; + use tempdir::TempDir; + + #[allow(clippy::unit_cmp)] + #[tokio::test] + async fn memory_mempool() { + let entry_point = Address::random(); + let chain_id = U256::from(5); + let senders = vec![Address::random(), Address::random(), Address::random()]; + + let dir = TempDir::new("test-userop-db").unwrap(); + let mut mempool: UserOpDatabase = UserOpDatabase::new(dir.into_path()).unwrap(); + mempool + .create_tables() + .expect("Create mdbx database tables failed"); + let mut user_operation: UserOperation; + let mut user_operation_hash: UserOperationHash = Default::default(); + + for i in 0..2 { + user_operation = UserOperation { + sender: senders[0], + nonce: U256::from(i), + ..UserOperation::random() + }; + user_operation_hash = mempool + .add(user_operation.clone(), &entry_point, &chain_id) + .unwrap(); + + assert_eq!( + mempool.get(&user_operation_hash).unwrap().unwrap(), + user_operation + ); + + user_operation = UserOperation { + sender: senders[1], + nonce: U256::from(i), + ..UserOperation::random() + }; + + user_operation_hash = mempool + .add(user_operation.clone(), &entry_point, &chain_id) + .unwrap(); + + assert_eq!( + mempool.get(&user_operation_hash).unwrap().unwrap(), + user_operation + ); + } + + for i in 0..3 { + user_operation = UserOperation { + sender: senders[2], + nonce: U256::from(i), + ..UserOperation::random() + }; + + user_operation_hash = mempool + .add(user_operation.clone(), &entry_point, &chain_id) + .unwrap(); + + assert_eq!( + mempool.get(&user_operation_hash).unwrap().unwrap(), + user_operation + ); + } + + assert_eq!(mempool.get_all().len(), 7); + assert_eq!(mempool.get_all_by_sender(&senders[0]).len(), 2); + assert_eq!(mempool.get_all_by_sender(&senders[1]).len(), 2); + assert_eq!(mempool.get_all_by_sender(&senders[2]).len(), 3); + + assert_eq!(mempool.remove(&user_operation_hash).unwrap(), ()); + assert_eq!( + mempool.remove(&H256::random().into()).unwrap_err(), + DBError::NotFound + ); + + assert_eq!(mempool.get_all().len(), 6); + assert_eq!(mempool.get_all_by_sender(&senders[0]).len(), 2); + assert_eq!(mempool.get_all_by_sender(&senders[2]).len(), 2); + + assert_eq!(mempool.clear(), ()); + + assert_eq!(mempool.get_all().len(), 0); + assert_eq!(mempool.get_all_by_sender(&senders[0]).len(), 0); + } +} diff --git a/src/uopool/memory_mempool.rs b/src/uopool/memory_mempool.rs index c05ad2cf..b8b894de 100644 --- a/src/uopool/memory_mempool.rs +++ b/src/uopool/memory_mempool.rs @@ -1,4 +1,3 @@ -use async_trait::async_trait; use educe::Educe; use ethers::types::{Address, U256}; use std::collections::{HashMap, HashSet}; @@ -14,16 +13,16 @@ pub struct MemoryMempool { user_operations_by_sender: HashMap>, // sender -> user_operations } -#[async_trait] impl Mempool for MemoryMempool { type UserOperations = Vec; + type Error = anyhow::Error; fn add( &mut self, user_operation: UserOperation, entry_point: &Address, chain_id: &U256, - ) -> UserOperationHash { + ) -> anyhow::Result { let hash = user_operation.hash(entry_point, chain_id); self.user_operations_by_sender @@ -32,15 +31,14 @@ impl Mempool for MemoryMempool { .insert(hash); self.user_operations.insert(hash, user_operation); - hash + Ok(hash) } - fn get(&self, user_operation_hash: &UserOperationHash) -> anyhow::Result { - return if let Some(user_operation) = self.user_operations.get(user_operation_hash) { - Ok(user_operation.clone()) - } else { - Err(anyhow::anyhow!("User operation not found")) - }; + fn get( + &self, + user_operation_hash: &UserOperationHash, + ) -> anyhow::Result> { + Ok(self.user_operations.get(user_operation_hash).cloned()) } fn get_all_by_sender(&self, sender: &Address) -> Self::UserOperations { @@ -114,9 +112,14 @@ mod tests { nonce: U256::from(i), ..UserOperation::random() }; - user_operation_hash = mempool.add(user_operation.clone(), &entry_point, &chain_id); + user_operation_hash = mempool + .add(user_operation.clone(), &entry_point, &chain_id) + .unwrap(); - assert_eq!(mempool.get(&user_operation_hash).unwrap(), user_operation); + assert_eq!( + mempool.get(&user_operation_hash).unwrap().unwrap(), + user_operation + ); user_operation = UserOperation { sender: senders[1], @@ -124,9 +127,14 @@ mod tests { ..UserOperation::random() }; - user_operation_hash = mempool.add(user_operation.clone(), &entry_point, &chain_id); + user_operation_hash = mempool + .add(user_operation.clone(), &entry_point, &chain_id) + .unwrap(); - assert_eq!(mempool.get(&user_operation_hash).unwrap(), user_operation); + assert_eq!( + mempool.get(&user_operation_hash).unwrap().unwrap(), + user_operation + ); } for i in 0..3 { @@ -136,9 +144,14 @@ mod tests { ..UserOperation::random() }; - user_operation_hash = mempool.add(user_operation.clone(), &entry_point, &chain_id); + user_operation_hash = mempool + .add(user_operation.clone(), &entry_point, &chain_id) + .unwrap(); - assert_eq!(mempool.get(&user_operation_hash).unwrap(), user_operation); + assert_eq!( + mempool.get(&user_operation_hash).unwrap().unwrap(), + user_operation + ); } assert_eq!(mempool.get_all().len(), 7); @@ -148,7 +161,10 @@ mod tests { assert_eq!(mempool.remove(&user_operation_hash).unwrap(), ()); assert_eq!( - mempool.remove(&H256::random()).unwrap_err().to_string(), + mempool + .remove(&H256::random().into()) + .unwrap_err() + .to_string(), anyhow::anyhow!("User operation not found").to_string() ); diff --git a/src/uopool/mod.rs b/src/uopool/mod.rs index 609eddb5..6a3f5b32 100644 --- a/src/uopool/mod.rs +++ b/src/uopool/mod.rs @@ -24,6 +24,7 @@ use jsonrpsee::tracing::info; use parking_lot::RwLock; use std::{collections::HashMap, fmt::Debug, net::SocketAddr, sync::Arc, time::Duration}; +pub mod database; pub mod memory_mempool; pub mod memory_reputation; pub mod server; @@ -31,7 +32,7 @@ pub mod services; pub type MempoolId = H256; -pub type MempoolBox = Box + Send + Sync>; +pub type MempoolBox = Box + Send + Sync>; pub type ReputationBox = Box + Send + Sync>; pub fn mempool_id(entry_point: Address, chain_id: U256) -> MempoolId { @@ -40,16 +41,19 @@ pub fn mempool_id(entry_point: Address, chain_id: U256) -> MempoolId { pub trait Mempool: Debug { type UserOperations: IntoIterator; - + type Error; fn add( &mut self, user_operation: UserOperation, entry_point: &Address, chain_id: &U256, - ) -> UserOperationHash; - fn get(&self, user_operation_hash: &UserOperationHash) -> anyhow::Result; + ) -> Result; + fn get( + &self, + user_operation_hash: &UserOperationHash, + ) -> Result, Self::Error>; fn get_all_by_sender(&self, sender: &Address) -> Self::UserOperations; - fn remove(&mut self, user_operation_hash: &UserOperationHash) -> anyhow::Result<()>; + fn remove(&mut self, user_operation_hash: &UserOperationHash) -> Result<(), Self::Error>; #[cfg(debug_assertions)] fn get_all(&self) -> Self::UserOperations; diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 3eb8bf40..2c923d12 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -108,7 +108,7 @@ pub async fn sign( key: Wallet, ) -> anyhow::Result<()> { let user_op_hash = user_op.hash(entry_point_address, chain_id); - let signature = key.sign_message(user_op_hash.as_bytes()).await?; + let signature = key.sign_message(user_op_hash.0.as_bytes()).await?; user_op.signature = Bytes::from(signature.to_vec()); Ok(()) }