From e8546e9c4fcebf8db83db11da460f3a11fd73f1f Mon Sep 17 00:00:00 2001 From: Gilad Chase Date: Tue, 17 Sep 2024 17:19:35 +0300 Subject: [PATCH] feat(base_layer): start migrating ethers->alloy Minimal logic changes, strictly migration. Refactors of existing code are added on a separate commit on top of this one, to separate the migration from the refactor. *Notable changes* - Errors: * `ProviderError` on `ethers` was only the node_url parse error, which isn't needed for `on_http` since it already expects a `Url` argument. * `AbiError` and `BadContract` type errors are both sub-variants of the `Contract` variant, that is, both errors types are variants of `alloy_contract::Error`. - API: * Return type of the call API now only implements `IntoFuture`, rather than `Future` like on `ethers`, hence manually calling `into_future()` is required before passing it to `tokio`. * `call()` in alloy returns a dynamic type, which is alloy [discourages](https://docs.rs/alloy-dyn-abi/latest/alloy_dyn_abi/) when types are known at compilation-time. Therefore using `call_raw`, which returns `Bytes`, and casting statically. commit-id:b8b28c1a --- Cargo.lock | 1112 +++++++++++++++-- Cargo.toml | 9 + crates/papyrus_base_layer/Cargo.toml | 10 +- .../papyrus_base_layer/src/base_layer_test.rs | 3 + .../src/ethereum_base_layer_contract.rs | 54 +- 5 files changed, 1048 insertions(+), 140 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0e0d983530..3d8a8a2580 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -91,6 +91,415 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alloy-chains" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68b94c159bcc2ca5f758b8663d7b00fc7c5e40569984595ddf2221b0f7f7f6e" +dependencies = [ + "num_enum", + "strum 0.26.2", +] + +[[package]] +name = "alloy-consensus" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28ddd17ffb7e4d66ef3a84e7b179072a9320cdc4b26c7f6f44cbf1081631b36" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "serde", +] + +[[package]] +name = "alloy-contract" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69257e2ffe1a9f15f20a89cd54d1ca758468c5b3e87979191b8b5fc24d39b37" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-network", + "alloy-network-primitives", + "alloy-primitives", + "alloy-provider", + "alloy-rpc-types-eth", + "alloy-sol-types", + "alloy-transport", + "futures", + "futures-util", + "thiserror", +] + +[[package]] +name = "alloy-dyn-abi" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4004925bff5ba0a11739ae84dbb6601a981ea692f3bd45b626935ee90a6b8471" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-type-parser", + "alloy-sol-types", + "const-hex", + "itoa", + "serde", + "serde_json", + "winnow 0.6.8", +] + +[[package]] +name = "alloy-eip2930" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eip7702" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d319bb544ca6caeab58c39cea8921c55d924d4f68f2c60f24f914673f9a74a" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eips" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f6c5c0a383f14519531cf58d8440e74f10b938e289f803af870be6f79223110" +dependencies = [ + "alloy-eip2930", + "alloy-eip7702", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "derive_more 1.0.0", + "once_cell", + "serde", + "sha2", +] + +[[package]] +name = "alloy-json-abi" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9996daf962fd0a90d3c93b388033228865953b92de7bb1959b891d78750a4091" +dependencies = [ + "alloy-primitives", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-rpc" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7111af869909275cffc5c84d16b6c892d6d512773e40cbe83187d0b9c5235e91" +dependencies = [ + "alloy-primitives", + "alloy-sol-types", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "alloy-network" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "342028392a2d5050b7b93dd32a0715d3b3b9ce30072ecb69a35dd4895c005495" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "alloy-signer", + "alloy-sol-types", + "async-trait", + "auto_impl", + "futures-utils-wasm", + "thiserror", +] + +[[package]] +name = "alloy-network-primitives" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e66d78c049dcadd065a926a9f2d9a9b2b10981a7889449e694fac7bccd2c6f" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-primitives" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411aff151f2a73124ee473708e82ed51b2535f68928b6a1caa8bc1246ae6f7cd" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more 1.0.0", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand 0.8.5", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-provider" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79f14ccc2a3c575cb17b1b4af8c772cf9b5b93b7ce7047d6640e53954abb558d" +dependencies = [ + "alloy-chains", + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-network", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rpc-client", + "alloy-rpc-types-eth", + "alloy-transport", + "alloy-transport-http", + "async-stream", + "async-trait", + "auto_impl", + "dashmap", + "futures", + "futures-utils-wasm", + "lru", + "pin-project", + "reqwest 0.12.5", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.61", +] + +[[package]] +name = "alloy-rpc-client" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dc79aeca84abb122a2fffbc1c91fdf958dca5c95be3875977bc99672bde0027" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "alloy-transport-http", + "futures", + "pin-project", + "reqwest 0.12.5", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower 0.5.1", + "tracing", + "url", +] + +[[package]] +name = "alloy-rpc-types-eth" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "238f494727ff861a803bd73b1274ef788a615bf8f8c4bfada4e6df42afa275d2" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "alloy-sol-types", + "cfg-if", + "derive_more 1.0.0", + "hashbrown 0.14.5", + "itertools 0.13.0", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-serde" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b95b6f024a558593dd3b8628af03f7df2ca50e4c56839293ad0a7546e471db0" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-signer" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da64740ff0518606c514eb0e03dd0a1daa8ff94d6d491a626fd8e50efd6c4f18" +dependencies = [ + "alloy-primitives", + "async-trait", + "auto_impl", + "elliptic-curve", + "k256", + "thiserror", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0458ccb02a564228fcd76efb8eb5a520521a8347becde37b402afec9a1b83859" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.61", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc65475025fc1e84bf86fc840f04f63fcccdcf3cf12053c99918e4054dfbc69" +dependencies = [ + "alloy-sol-macro-input", + "const-hex", + "heck 0.5.0", + "indexmap 2.2.6", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.61", + "syn-solidity", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed10f0715a0b69fde3236ff3b9ae5f6f7c97db5a387747100070d3016b9266b" +dependencies = [ + "const-hex", + "dunce", + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.61", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-type-parser" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3edae8ea1de519ccba896b6834dec874230f72fe695ff3c9c118e90ec7cff783" +dependencies = [ + "serde", + "winnow 0.6.8", +] + +[[package]] +name = "alloy-sol-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1eb88e4da0a1b697ed6a9f811fdba223cf4d5c21410804fd1707836af73a462b" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-macro", + "const-hex", + "serde", +] + +[[package]] +name = "alloy-transport" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7a669caa427abe8802184c8776f5103302f9337bb30a5b36bdebc332946c14" +dependencies = [ + "alloy-json-rpc", + "base64 0.22.1", + "futures-util", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower 0.5.1", + "tracing", + "url", +] + +[[package]] +name = "alloy-transport-http" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4433ffa97aab6ae643de81c7bde9a2f043496f27368a607405a5c78a610caf74" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "reqwest 0.12.5", + "serde_json", + "tower 0.5.1", + "tracing", + "url", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -193,10 +602,10 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" dependencies = [ - "ark-ff", + "ark-ff 0.4.2", "ark-poly", - "ark-serialize", - "ark-std", + "ark-serialize 0.4.2", + "ark-std 0.4.0", "derivative", "hashbrown 0.13.2", "itertools 0.10.5", @@ -204,26 +613,54 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint 0.4.5", + "num-traits 0.2.19", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", "derivative", "digest 0.10.7", "itertools 0.10.5", "num-bigint 0.4.5", "num-traits 0.2.19", "paste", - "rustc_version", + "rustc_version 0.4.0", "zeroize", ] +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "ark-ff-asm" version = "0.4.2" @@ -234,6 +671,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint 0.4.5", + "num-traits 0.2.19", + "quote", + "syn 1.0.109", +] + [[package]] name = "ark-ff-macros" version = "0.4.2" @@ -253,9 +702,9 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", "derivative", "hashbrown 0.13.2", ] @@ -267,8 +716,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c02e954eaeb4ddb29613fee20840c2bbc85ca4396d53e33837e11905363c5f2" dependencies = [ "ark-ec", - "ark-ff", - "ark-std", + "ark-ff 0.4.2", + "ark-std 0.4.0", ] [[package]] @@ -278,8 +727,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3975a01b0a6e3eae0f72ec7ca8598a6620fc72fa5981f6f5cca33b7cd788f633" dependencies = [ "ark-ec", - "ark-ff", - "ark-std", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", ] [[package]] @@ -289,7 +748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ "ark-serialize-derive", - "ark-std", + "ark-std 0.4.0", "digest 0.10.7", "num-bigint 0.4.5", ] @@ -305,6 +764,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits 0.2.19", + "rand 0.8.5", +] + [[package]] name = "ark-std" version = "0.4.0" @@ -657,7 +1126,7 @@ checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ "futures", "pharos", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -698,7 +1167,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" dependencies = [ - "http", + "http 0.2.12", "log", "url", ] @@ -740,9 +1209,9 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "itoa", "matchit", "memchr", @@ -754,9 +1223,9 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "tokio", - "tower", + "tower 0.4.13", "tower-layer", "tower-service", ] @@ -770,8 +1239,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -989,7 +1458,7 @@ version = "0.0.0" dependencies = [ "anyhow", "ark-ec", - "ark-ff", + "ark-ff 0.4.2", "ark-secp256k1", "ark-secp256r1", "assert_matches", @@ -1001,7 +1470,7 @@ dependencies = [ "cairo-native", "cairo-vm", "criterion", - "derive_more", + "derive_more 0.99.17", "glob", "indexmap 2.2.6", "itertools 0.12.1", @@ -1018,7 +1487,7 @@ dependencies = [ "rand 0.8.5", "regex", "rstest", - "semver", + "semver 1.0.23", "serde", "serde_json", "sha2", @@ -1048,6 +1517,18 @@ dependencies = [ "piper", ] +[[package]] +name = "blst" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + [[package]] name = "bs58" version = "0.5.1" @@ -1132,6 +1613,21 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "c-kzg" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0307f72feab3300336fb803a57134159f6e20139af1357f36c54cb90d8e8928" +dependencies = [ + "blst", + "cc", + "glob", + "hex", + "libc", + "once_cell", + "serde", +] + [[package]] name = "cached" version = "0.44.0" @@ -1204,7 +1700,7 @@ dependencies = [ "indoc 2.0.5", "rayon", "rust-analyzer-salsa", - "semver", + "semver 1.0.23", "smol_str", "thiserror", ] @@ -1267,7 +1763,7 @@ dependencies = [ "cairo-lang-utils", "path-clean", "rust-analyzer-salsa", - "semver", + "semver 1.0.23", "serde", "smol_str", ] @@ -1387,7 +1883,7 @@ version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528a247ac59cb35b2f99d64605a81de815fa5fb0b0e7f7ece1d4e7fcf267d4ea" dependencies = [ - "ark-ff", + "ark-ff 0.4.2", "ark-secp256k1", "ark-secp256r1", "cairo-lang-casm", @@ -1815,7 +2311,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver", + "semver 1.0.23", "serde", "serde_json", "thiserror", @@ -2080,7 +2576,7 @@ version = "0.0.0" dependencies = [ "clap", "criterion", - "derive_more", + "derive_more 0.99.17", "ethnum", "futures", "indexmap 2.2.6", @@ -2408,7 +2904,7 @@ dependencies = [ "digest 0.10.7", "fiat-crypto", "platforms", - "rustc_version", + "rustc_version 0.4.0", "subtle", "zeroize", ] @@ -2635,10 +3131,31 @@ dependencies = [ "convert_case 0.4.0", "proc-macro2", "quote", - "rustc_version", + "rustc_version 0.4.0", "syn 1.0.109", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.61", + "unicode-xid", +] + [[package]] name = "deunicode" version = "1.6.0" @@ -3122,7 +3639,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "syn 2.0.61", @@ -3184,8 +3701,8 @@ checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" dependencies = [ "chrono", "ethers-core", - "reqwest", - "semver", + "reqwest 0.11.27", + "semver 1.0.23", "serde", "serde_json", "thiserror", @@ -3209,7 +3726,7 @@ dependencies = [ "futures-locks", "futures-util", "instant", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror", @@ -3236,12 +3753,12 @@ dependencies = [ "futures-timer", "futures-util", "hashers", - "http", + "http 0.2.12", "instant", "jsonwebtoken", "once_cell", "pin-project", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror", @@ -3294,7 +3811,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver", + "semver 1.0.23", "serde", "serde_json", "solang-parser", @@ -3407,6 +3924,17 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "ff" version = "0.13.0" @@ -3712,6 +4240,12 @@ dependencies = [ "slab", ] +[[package]] +name = "futures-utils-wasm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" + [[package]] name = "fxhash" version = "0.2.1" @@ -3812,7 +4346,7 @@ dependencies = [ "futures-core", "futures-sink", "gloo-utils", - "http", + "http 0.2.12", "js-sys", "pin-project", "serde", @@ -3871,14 +4405,14 @@ dependencies = [ "flume", "futures", "gumdrop", - "http", + "http 0.2.12", "itertools 0.11.0", "lazy_static", "log", "num-format", "rand 0.8.5", "regex", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "simplelog", @@ -3932,7 +4466,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", "indexmap 2.2.6", "slab", "tokio", @@ -4018,6 +4552,15 @@ 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.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hex_fmt" @@ -4120,6 +4663,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -4127,7 +4681,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -4160,8 +4737,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -4173,6 +4750,25 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -4180,8 +4776,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "log", "rustls 0.21.12", "rustls-native-certs", @@ -4196,10 +4792,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.28", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.4.1", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.4.1", + "pin-project-lite", + "socket2 0.5.7", + "tokio", + "tower 0.4.13", + "tower-service", + "tracing", ] [[package]] @@ -4324,8 +4956,8 @@ dependencies = [ "attohttpc", "bytes", "futures", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "log", "rand 0.8.5", "tokio", @@ -4509,7 +5141,7 @@ dependencies = [ "socket2 0.5.7", "widestring", "windows-sys 0.48.0", - "winreg", + "winreg 0.50.0", ] [[package]] @@ -4631,7 +5263,7 @@ dependencies = [ "futures-channel", "futures-util", "gloo-net", - "http", + "http 0.2.12", "jsonrpsee-core", "pin-project", "rustls-native-certs", @@ -4657,7 +5289,7 @@ dependencies = [ "beef", "futures-timer", "futures-util", - "hyper", + "hyper 0.14.28", "jsonrpsee-types", "parking_lot", "rand 0.8.5", @@ -4678,7 +5310,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f80c17f62c7653ce767e3d7288b793dfec920f97067ceb189ebdd3570f2bc20" dependencies = [ "async-trait", - "hyper", + "hyper 0.14.28", "hyper-rustls", "jsonrpsee-core", "jsonrpsee-types", @@ -4686,7 +5318,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tower", + "tower 0.4.13", "tracing", "url", ] @@ -4711,8 +5343,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82c39a00449c9ef3f50b84fc00fc4acba20ef8f559f07902244abf4c15c5ab9c" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "jsonrpsee-core", "jsonrpsee-types", "route-recognizer", @@ -4723,7 +5355,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "tower", + "tower 0.4.13", "tracing", ] @@ -4758,7 +5390,7 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bca9cb3933ccae417eb6b08c3448eb1cb46e39834e5b503e395e5e5bd08546c0" dependencies = [ - "http", + "http 0.2.12", "jsonrpsee-client-transport", "jsonrpsee-core", "jsonrpsee-types", @@ -4787,7 +5419,7 @@ dependencies = [ "parking_lot", "percent-encoding", "regex", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "time", @@ -4832,6 +5464,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + [[package]] name = "kv-log-macro" version = "1.0.7" @@ -4939,7 +5581,7 @@ checksum = "3f0bee397dc9a7003e7bd34fffc1dc2d4c4fdc96530a0c439a5f98c9402bc7bf" dependencies = [ "bitflags 2.5.0", "byteorder", - "derive_more", + "derive_more 0.99.17", "indexmap 1.9.3", "libc", "lifetimed-bytes", @@ -5443,7 +6085,7 @@ dependencies = [ "lazy_static", "libc", "regex-lite", - "semver", + "semver 1.0.23", ] [[package]] @@ -5640,7 +6282,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" dependencies = [ "base64 0.21.7", - "hyper", + "hyper 0.14.28", "indexmap 1.9.3", "ipnet", "metrics 0.21.1", @@ -5797,7 +6439,7 @@ dependencies = [ "assert-json-diff", "colored", "futures-core", - "hyper", + "hyper 0.14.28", "log", "rand 0.8.5", "regex", @@ -6438,12 +7080,20 @@ dependencies = [ name = "papyrus_base_layer" version = "0.0.0" dependencies = [ + "alloy-contract", + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-json-rpc", + "alloy-primitives", + "alloy-provider", + "alloy-sol-types", + "alloy-transport", + "alloy-transport-http", "async-trait", "ethers", "ethers-core", "papyrus_config", "pretty_assertions", - "rustc-hex", "serde", "serde_json", "starknet-types-core", @@ -6577,7 +7227,7 @@ dependencies = [ "once_cell", "pretty_assertions", "rand 0.8.5", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "tokio", @@ -6588,8 +7238,8 @@ name = "papyrus_monitoring_gateway" version = "0.0.0" dependencies = [ "axum", - "http-body", - "hyper", + "http-body 0.4.6", + "hyper 0.14.28", "metrics 0.21.1", "metrics-exporter-prometheus", "metrics-process", @@ -6602,7 +7252,7 @@ dependencies = [ "starknet_client", "thiserror", "tokio", - "tower", + "tower 0.4.13", "tracing", "validator", ] @@ -6616,7 +7266,7 @@ dependencies = [ "bytes", "deadqueue", "defaultmap", - "derive_more", + "derive_more 0.99.17", "futures", "lazy_static", "libp2p", @@ -6668,7 +7318,7 @@ dependencies = [ "papyrus_sync", "papyrus_test_utils", "pretty_assertions", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "starknet_api", @@ -6758,13 +7408,13 @@ dependencies = [ "cairo-lang-casm", "cairo-lang-starknet-classes", "camelpaste", - "derive_more", + "derive_more 0.99.17", "enum-iterator", "ethers", "flate2", "futures-util", "hex", - "hyper", + "hyper 0.14.28", "indexmap 2.2.6", "insta", "itertools 0.12.1", @@ -6785,7 +7435,7 @@ dependencies = [ "rand 0.8.5", "rand_chacha 0.3.1", "regex", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "starknet-core", @@ -6795,7 +7445,7 @@ dependencies = [ "strum 0.25.0", "strum_macros 0.25.3", "tokio", - "tower", + "tower 0.4.13", "tracing", "validator", ] @@ -6874,7 +7524,7 @@ dependencies = [ "papyrus_storage", "papyrus_test_utils", "pretty_assertions", - "reqwest", + "reqwest 0.11.27", "serde", "simple_logger", "starknet-types-core", @@ -6900,7 +7550,7 @@ dependencies = [ "prometheus-parse", "rand 0.8.5", "rand_chacha 0.3.1", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "starknet-types-core", @@ -7053,6 +7703,17 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pest" +version = "2.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + [[package]] name = "petgraph" version = "0.6.5" @@ -7070,7 +7731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ "futures", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -7424,6 +8085,28 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.61", +] + [[package]] name = "proc-macro2" version = "1.0.82" @@ -7497,6 +8180,8 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ + "bit-set", + "bit-vec", "bitflags 2.5.0", "lazy_static", "num-traits 0.2.19", @@ -7504,6 +8189,8 @@ dependencies = [ "rand_chacha 0.3.1", "rand_xorshift 0.3.0", "regex-syntax 0.8.3", + "rusty-fork", + "tempfile", "unarray", ] @@ -8096,11 +8783,11 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-rustls", - "hyper-tls", + "hyper-tls 0.5.0", "ipnet", "js-sys", "log", @@ -8110,11 +8797,11 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls 0.21.12", - "rustls-pemfile", + "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-native-tls", @@ -8126,7 +8813,46 @@ dependencies = [ "wasm-bindgen-futures", "web-sys", "webpki-roots 0.25.4", - "winreg", + "winreg 0.50.0", +] + +[[package]] +name = "reqwest" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", + "hyper-tls 0.6.0", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 2.1.3", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.52.0", ] [[package]] @@ -8234,7 +8960,7 @@ dependencies = [ "futures", "futures-timer", "rstest_macros", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -8246,7 +8972,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "rustc_version", + "rustc_version 0.4.0", "syn 1.0.109", "unicode-ident", ] @@ -8267,6 +8993,36 @@ dependencies = [ "tokio", ] +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint 0.4.5", + "num-traits 0.2.19", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand 0.8.5", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + [[package]] name = "rust-analyzer-salsa" version = "0.17.0-pre.6" @@ -8324,13 +9080,22 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver 1.0.23", ] [[package]] @@ -8403,7 +9168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 1.0.4", "schannel", "security-framework", ] @@ -8417,6 +9182,16 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pemfile" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +dependencies = [ + "base64 0.22.1", + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.8.0" @@ -8450,6 +9225,18 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "rw-stream-sink" version = "0.4.0" @@ -8492,7 +9279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" dependencies = [ "cfg-if", - "derive_more", + "derive_more 0.99.17", "parity-scale-codec", "scale-info-derive", ] @@ -8608,6 +9395,15 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.23" @@ -8617,6 +9413,15 @@ dependencies = [ "serde", ] +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "send_wrapper" version = "0.4.0" @@ -8797,6 +9602,16 @@ dependencies = [ "keccak", ] +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -8947,7 +9762,7 @@ dependencies = [ "curve25519-dalek", "rand_core 0.6.4", "ring 0.17.8", - "rustc_version", + "rustc_version 0.4.0", "sha2", "subtle", ] @@ -8981,7 +9796,7 @@ dependencies = [ "base64 0.13.1", "bytes", "futures", - "http", + "http 0.2.12", "httparse", "log", "rand 0.8.5", @@ -9148,7 +9963,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abf1b44ec5b18d87c1ae5f54590ca9d0699ef4dd5b2ffa66fc97f24613ec585" dependencies = [ - "ark-ff", + "ark-ff 0.4.2", "bigdecimal", "crypto-bigint", "getrandom", @@ -9178,7 +9993,7 @@ dependencies = [ "assert_matches", "bitvec", "cairo-lang-starknet-classes", - "derive_more", + "derive_more 0.99.17", "hex", "indexmap 2.2.6", "itertools 0.12.1", @@ -9234,7 +10049,7 @@ dependencies = [ "async-trait", "cairo-lang-starknet-classes", "enum-iterator", - "http", + "http 0.2.12", "indexmap 2.2.6", "mockall", "mockito 0.31.1", @@ -9245,7 +10060,7 @@ dependencies = [ "pretty_assertions", "rand 0.8.5", "rand_chacha 0.3.1", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "serde_repr", @@ -9313,7 +10128,7 @@ dependencies = [ "blockifier", "cairo-lang-sierra-to-casm", "cairo-lang-starknet-classes", - "hyper", + "hyper 0.14.28", "mempool_test_utils", "mockall", "mockito 1.4.0", @@ -9321,7 +10136,7 @@ dependencies = [ "papyrus_config", "papyrus_rpc", "pretty_assertions", - "reqwest", + "reqwest 0.11.27", "rstest", "serde", "serde_json", @@ -9380,7 +10195,7 @@ version = "0.0.0" dependencies = [ "assert_matches", "async-trait", - "derive_more", + "derive_more 0.99.17", "itertools 0.12.1", "mempool_test_utils", "pretty_assertions", @@ -9399,7 +10214,7 @@ dependencies = [ "assert_matches", "async-trait", "bincode 1.3.3", - "hyper", + "hyper 0.14.28", "papyrus_config", "pretty_assertions", "rstest", @@ -9425,7 +10240,7 @@ dependencies = [ "papyrus_rpc", "papyrus_storage", "pretty_assertions", - "reqwest", + "reqwest 0.11.27", "rstest", "serde_json", "starknet-types-core", @@ -9508,7 +10323,7 @@ name = "starknet_patricia" version = "0.0.0" dependencies = [ "async-recursion", - "derive_more", + "derive_more 0.99.17", "ethnum", "hex", "pretty_assertions", @@ -9658,8 +10473,8 @@ dependencies = [ "fs2", "hex", "once_cell", - "reqwest", - "semver", + "reqwest 0.11.27", + "semver 1.0.23", "serde", "serde_json", "sha2", @@ -9690,12 +10505,30 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn-solidity" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b95156f8b577cb59dc0b1df15c6f29a10afc5f8a7ac9786b0b5c68c19149278" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.61", +] + [[package]] name = "sync_wrapper" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "synstructure" version = "0.12.6" @@ -9885,7 +10718,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "reqwest", + "reqwest 0.11.27", "syn 2.0.61", "sysinfo", "users", @@ -9942,6 +10775,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "tikv-jemalloc-sys" version = "0.5.4+5.3.0-patched" @@ -10099,6 +10941,7 @@ dependencies = [ "futures-core", "pin-project-lite", "tokio", + "tokio-util", ] [[package]] @@ -10220,17 +11063,31 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -10363,7 +11220,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 0.2.12", "httparse", "log", "rand 0.8.5", @@ -10386,6 +11243,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + [[package]] name = "uint" version = "0.9.5" @@ -10641,6 +11504,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "waker-fn" version = "1.1.1" @@ -11036,6 +11908,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "workspace_tests" version = "0.0.0" @@ -11055,7 +11937,7 @@ dependencies = [ "js-sys", "log", "pharos", - "rustc_version", + "rustc_version 0.4.0", "send_wrapper 0.6.0", "thiserror", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 82bd195ac5..186760adc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,15 @@ license-file = "LICENSE" [workspace.dependencies] # fixating the version of parity-scale-codec and parity-scale-codec-derive due to an error in udeps. # TODO: Remove this once udeps is fixed. +alloy-contract = "0.3.5" +alloy-dyn-abi = "0.8.3" +alloy-json-abi = "0.8.3" +alloy-json-rpc = "0.3.5" +alloy-primitives = "0.8.3" +alloy-provider = "0.3.5" +alloy-sol-types = "0.8.3" +alloy-transport = "0.3.5" +alloy-transport-http = "0.3.5" anyhow = "1.0.44" ark-ec = "0.4.2" ark-ff = "0.4.0-alpha.7" diff --git a/crates/papyrus_base_layer/Cargo.toml b/crates/papyrus_base_layer/Cargo.toml index 426f6a3e7a..ca06b1bb9f 100644 --- a/crates/papyrus_base_layer/Cargo.toml +++ b/crates/papyrus_base_layer/Cargo.toml @@ -6,10 +6,18 @@ repository.workspace = true license-file.workspace = true [dependencies] +alloy-contract.workspace = true +alloy-dyn-abi.workspace = true +alloy-json-abi.workspace = true +alloy-json-rpc.workspace = true +alloy-primitives.workspace = true +alloy-provider.workspace = true +alloy-sol-types.workspace = true +alloy-transport.workspace = true +alloy-transport-http.workspace = true async-trait.workspace = true ethers.workspace = true papyrus_config.workspace = true -rustc-hex.workspace = true serde.workspace = true serde_json.workspace = true starknet_api.workspace = true diff --git a/crates/papyrus_base_layer/src/base_layer_test.rs b/crates/papyrus_base_layer/src/base_layer_test.rs index bd61e08dfd..2388adbcbc 100644 --- a/crates/papyrus_base_layer/src/base_layer_test.rs +++ b/crates/papyrus_base_layer/src/base_layer_test.rs @@ -24,6 +24,9 @@ const MINIMAL_GANACHE_VERSION: u8 = 7; // 30 300 0x300 // The blockchain is at Ethereum block number 31. // Note: Requires Ganache@7.4.3 installed. +// TODO: `Ganache` and `ethers` have both been deprecated. Also, `ethers`s' replacement, `alloy`, +// no longer supports `Ganache`. Once we decide on a Ganache replacement, fix this test and fully +// remove `ethers`. fn get_test_ethereum_node() -> (TestEthereumNodeHandle, EthereumContractAddress) { const SN_CONTRACT_ADDR: &str = "0xe2aF2c1AE11fE13aFDb7598D0836398108a4db0A"; // Verify correct Ganache version. diff --git a/crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs b/crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs index ed902849ee..3b6c028f8a 100644 --- a/crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs +++ b/crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs @@ -1,18 +1,21 @@ use std::collections::BTreeMap; -use std::sync::Arc; +use std::future::IntoFuture; +use alloy_contract::{ContractInstance, Interface}; +use alloy_dyn_abi::SolType; +use alloy_json_abi::JsonAbi; +use alloy_primitives::Address; +use alloy_provider::network::Ethereum; +use alloy_provider::{Provider, ProviderBuilder, RootProvider}; +use alloy_sol_types::sol_data; +use alloy_transport::TransportErrorKind; +use alloy_transport_http::{Client, Http}; use async_trait::async_trait; -use ethers::abi::{Abi, AbiEncode}; -use ethers::contract::Contract; -use ethers::prelude::{AbiError, Address, ContractError, Http, Middleware, Provider}; -use ethers::providers::ProviderError; -use ethers::types::{I256, U256}; use papyrus_config::dumping::{ser_param, ser_required_param, SerializeConfig}; use papyrus_config::{ParamPath, ParamPrivacyInput, SerializationType, SerializedParam}; use serde::{Deserialize, Serialize}; use starknet_api::block::{BlockHash, BlockNumber}; use starknet_api::hash::StarkHash; -use starknet_api::StarknetApiError; use url::ParseError; use crate::BaseLayerContract; @@ -20,19 +23,17 @@ use crate::BaseLayerContract; #[derive(thiserror::Error, Debug)] pub enum EthereumBaseLayerError { #[error(transparent)] - FromHex(#[from] rustc_hex::FromHexError), - #[error(transparent)] - Abi(#[from] AbiError), + FromHex(#[from] alloy_primitives::hex::FromHexError), #[error(transparent)] Url(#[from] ParseError), #[error(transparent)] Serde(#[from] serde_json::Error), #[error(transparent)] - Provider(#[from] ProviderError), + Contract(#[from] alloy_contract::Error), #[error(transparent)] - BadContract(#[from] ContractError>), + TypeError(#[from] alloy_sol_types::Error), #[error(transparent)] - StarknetApi(#[from] StarknetApiError), + RpcError(#[from] alloy_json_rpc::RpcError), } #[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] @@ -71,16 +72,18 @@ impl Default for EthereumBaseLayerConfig { } pub struct EthereumBaseLayerContract { - contract: Contract>, + contract: ContractInstance, RootProvider>, Ethereum>, } impl EthereumBaseLayerContract { pub fn new(config: EthereumBaseLayerConfig) -> Result { let address = config.starknet_contract_address.parse::
()?; - let client: Provider = Provider::::try_from(config.node_url)?; + let client = ProviderBuilder::new().on_http(config.node_url.parse()?); + // The solidity contract was pre-compiled, and only the relevant functions were kept. - let abi: Abi = serde_json::from_str::(include_str!("core_contract_latest_block.abi"))?; - Ok(Self { contract: Contract::new(address, abi, Arc::new(client)) }) + let abi: JsonAbi = + serde_json::from_str::(include_str!("core_contract_latest_block.abi"))?; + Ok(Self { contract: ContractInstance::new(address, client, Interface::new(abi)) }) } } @@ -94,7 +97,7 @@ impl BaseLayerContract for EthereumBaseLayerContract { ) -> Result, Self::Error> { let ethereum_block_number = self .contract - .client() + .provider() .get_block_number() .await? .checked_sub(min_confirmations.unwrap_or(0).into()); @@ -103,16 +106,19 @@ impl BaseLayerContract for EthereumBaseLayerContract { }; let call_state_block_number = - self.contract.method::<_, I256>("stateBlockNumber", ())?.block(ethereum_block_number); + self.contract.function("stateBlockNumber", &[])?.block(ethereum_block_number.into()); let call_state_block_hash = - self.contract.method::<_, U256>("stateBlockHash", ())?.block(ethereum_block_number); - let (state_block_number, state_block_hash) = - tokio::try_join!(call_state_block_number.call(), call_state_block_hash.call())?; + self.contract.function("stateBlockHash", &[])?.block(ethereum_block_number.into()); + + let (state_block_number, state_block_hash) = tokio::try_join!( + call_state_block_number.call_raw().into_future(), + call_state_block_hash.call_raw().into_future() + )?; Ok(Some(( - BlockNumber(state_block_number.as_u64()), + BlockNumber(sol_data::Uint::<64>::abi_decode(&state_block_number, true)?), // TODO: use safe conversion. - BlockHash(StarkHash::from_hex_unchecked(state_block_hash.encode_hex().as_str())), + BlockHash(StarkHash::from_hex_unchecked(&state_block_hash.to_string())), ))) } }