diff --git a/Cargo.lock b/Cargo.lock index 2dc2a46e..4b5f58fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,83 +3,604 @@ version = 3 [[package]] -name = "Inflector" -version = "0.11.4" +name = "addr2line" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "lazy_static", - "regex", + "gimli", ] [[package]] -name = "addr2line" -version = "0.21.0" +name = "adler" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "gimli", + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "alloy" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "096bfe5b4ae72138eab21ba5789e74e09f80461352b2261dfde69e7538f0b3f6" +dependencies = [ + "alloy-consensus", + "alloy-contract", + "alloy-core", + "alloy-eips", + "alloy-genesis", + "alloy-network", + "alloy-provider", + "alloy-pubsub", + "alloy-rpc-client", + "alloy-rpc-types", + "alloy-serde", + "alloy-signer", + "alloy-signer-local", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ipc", + "alloy-transport-ws", + "reqwest", +] + +[[package]] +name = "alloy-chains" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1752d7d62e2665da650a36d84abbf239f812534475d51f072a49a533513b7cdd" +dependencies = [ + "num_enum", + "strum", +] + +[[package]] +name = "alloy-consensus" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f63a6c9eb45684a5468536bc55379a2af0f45ffa5d756e4e4964532737e1836" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "serde", +] + +[[package]] +name = "alloy-contract" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c26b7d34cb76f826558e9409a010e25257f7bfb5aa5e3dd0042c564664ae159" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-network", + "alloy-primitives", + "alloy-provider", + "alloy-pubsub", + "alloy-rpc-types-eth", + "alloy-sol-types", + "alloy-transport", + "futures", + "futures-util", + "thiserror", +] + +[[package]] +name = "alloy-core" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5af3faff14c12c8b11037e0a093dd157c3702becb8435577a2408534d0758315" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-types", +] + +[[package]] +name = "alloy-dyn-abi" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6e6436a9530f25010d13653e206fab4c9feddacf21a54de8d7311b275bc56b" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-type-parser", + "alloy-sol-types", + "const-hex", + "itoa", + "serde", + "serde_json", + "winnow 0.6.6", +] + +[[package]] +name = "alloy-eips" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4b0fc6a572ef2eebda0a31a5e393d451abda703fec917c75d9615d8c978cf2" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "derive_more", + "once_cell", + "serde", + "sha2", +] + +[[package]] +name = "alloy-genesis" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48450f9c6f0821c1eee00ed912942492ed4f11dd69532825833de23ecc7a2256" +dependencies = [ + "alloy-primitives", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-json-abi" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaeaccd50238126e3a0ff9387c7c568837726ad4f4e399b528ca88104d6c25ef" +dependencies = [ + "alloy-primitives", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-rpc" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d484c2a934d0a4d86f8ad4db8113cb1d607707a6c54f6e78f4f1b4451b47aa70" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "alloy-network" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a20eba9bc551037f0626d6d29e191888638d979943fa4e842e9e6fc72bf0565" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "alloy-signer", + "alloy-sol-types", + "async-trait", + "auto_impl", + "futures-utils-wasm", + "thiserror", +] + +[[package]] +name = "alloy-primitives" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-provider" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad5d89acb7339fad13bc69e7b925232f242835bfd91c82fcb9326b36481bd0f0" +dependencies = [ + "alloy-chains", + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-network", + "alloy-primitives", + "alloy-pubsub", + "alloy-rpc-client", + "alloy-rpc-types-eth", + "alloy-rpc-types-trace", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ipc", + "alloy-transport-ws", + "async-stream", + "async-trait", + "auto_impl", + "dashmap", + "futures", + "futures-utils-wasm", + "lru", + "pin-project", + "reqwest", + "serde", + "serde_json", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "alloy-pubsub" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034258dfaa51c278e1f7fcc46e587d10079ec9372866fa48c5df9d908fc1f6b1" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-transport", + "bimap", + "futures", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower", + "tracing", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a43b18702501396fa9bcdeecd533bc85fac75150d308fc0f6800a01e6234a003" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83524c1f6162fcb5b0decf775498a125066c86dda6066ed609531b0e912f85a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + +[[package]] +name = "alloy-rpc-client" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ce003e8c74bbbc7d4235131c1d6b7eaf14a533ae850295b90d240340989cb" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-pubsub", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ipc", + "alloy-transport-ws", + "futures", + "pin-project", + "reqwest", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower", + "tracing", + "url", +] + +[[package]] +name = "alloy-rpc-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dfa1dd3e0bc3a3d89744fba8d1511216e83257160da2cd028a18b7d9c026030" +dependencies = [ + "alloy-rpc-types-engine", + "alloy-rpc-types-eth", + "alloy-rpc-types-trace", + "alloy-serde", +] + +[[package]] +name = "alloy-rpc-types-engine" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc40df2dda7561d1406d0bee1d19c8787483a2cf2ee8011c05909475e7bc102d" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-eth", + "alloy-serde", + "jsonwebtoken", + "rand", + "serde", + "thiserror", +] + +[[package]] +name = "alloy-rpc-types-eth" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd7aa9ff9e67f1ba7ee0dd8cebfc95831d1649b0e4eeefae940dc3681079fa" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "alloy-sol-types", + "itertools 0.13.0", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-rpc-types-trace" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "535d26db98ac320a0d1637faf3e210328c3df3b1998abd7e72343d3857058efe" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8913f9e825068d77c516188c221c44f78fd814fce8effe550a783295a2757d19" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-signer" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f740e13eb4c6a0e4d0e49738f1e86f31ad2d7ef93be499539f492805000f7237" +dependencies = [ + "alloy-primitives", + "async-trait", + "auto_impl", + "elliptic-curve", + "k256", + "thiserror", +] + +[[package]] +name = "alloy-signer-local" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87db68d926887393a1d0f9c43833b44446ea29d603291e7b20e5d115f31aa4e3" +dependencies = [ + "alloy-consensus", + "alloy-network", + "alloy-primitives", + "alloy-signer", + "async-trait", + "k256", + "rand", + "thiserror", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.60", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" +dependencies = [ + "alloy-json-abi", + "alloy-sol-macro-input", + "const-hex", + "heck 0.5.0", + "indexmap", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.60", + "syn-solidity", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" +dependencies = [ + "alloy-json-abi", + "const-hex", + "dunce", + "heck 0.5.0", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.60", + "syn-solidity", ] [[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aes" -version = "0.8.4" +name = "alloy-sol-type-parser" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +checksum = "baa2fbd22d353d8685bd9fee11ba2d8b5c3b1d11e56adb3265fcf1f32bfdf404" dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", + "winnow 0.6.6", ] [[package]] -name = "ahash" -version = "0.8.11" +name = "alloy-sol-types" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" dependencies = [ - "cfg-if", - "getrandom", - "once_cell", - "version_check", - "zerocopy", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-macro", + "const-hex", + "serde", ] [[package]] -name = "aho-corasick" -version = "1.1.3" +name = "alloy-transport" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "dd9773e4ec6832346171605c776315544bd06e40f803e7b5b7824b325d5442ca" dependencies = [ - "memchr", + "alloy-json-rpc", + "base64 0.22.1", + "futures-util", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "url", ] [[package]] -name = "alloc-no-stdlib" -version = "2.0.4" +name = "alloy-transport-http" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" +checksum = "ff8ef947b901c0d4e97370f9fa25844cf8b63b1a58fd4011ee82342dc8a9fc6b" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "reqwest", + "serde_json", + "tower", + "tracing", + "url", +] [[package]] -name = "alloc-stdlib" -version = "0.2.2" +name = "alloy-transport-ipc" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +checksum = "bb40ee66887a66d875a5bb5e01cee4c9a467c263ef28c865cd4b0ebf15f705af" dependencies = [ - "alloc-no-stdlib", + "alloy-json-rpc", + "alloy-pubsub", + "alloy-transport", + "bytes", + "futures", + "interprocess", + "pin-project", + "serde", + "serde_json", + "tempfile", + "tokio", + "tokio-util", + "tracing", ] [[package]] -name = "allocator-api2" -version = "0.2.18" +name = "alloy-transport-ws" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "3d92049d6642a18c9849ce7659430151e7c92b51552a0cabdc038c1af4cd7308" +dependencies = [ + "alloy-pubsub", + "alloy-transport", + "futures", + "http", + "rustls", + "serde_json", + "tokio", + "tokio-tungstenite", + "tracing", + "ws_stream_wasm", +] [[package]] name = "android-tzdata" @@ -154,6 +675,130 @@ dependencies = [ "num-traits", ] +[[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", + "num-traits", + "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 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", + "num-traits", + "paste", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "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", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[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]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "array-init-cursor" version = "0.2.0" @@ -176,15 +821,6 @@ dependencies = [ "serde", ] -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - [[package]] name = "async-stream" version = "0.3.5" @@ -226,7 +862,7 @@ checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ "futures", "pharos", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -284,15 +920,15 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" -version = "0.13.1" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.21.7" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -301,10 +937,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] -name = "bech32" -version = "0.9.1" +name = "bimap" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" [[package]] name = "bit-set" @@ -354,6 +990,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blst" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62dc83a094a71d43eeadd254b1ec2d24cb6a0bb6cadce00df51f0db594711a32" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + [[package]] name = "brotli" version = "3.5.0" @@ -375,16 +1023,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "sha2", - "tinyvec", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -433,56 +1071,17 @@ dependencies = [ ] [[package]] -name = "bzip2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" +name = "c-kzg" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +checksum = "cdf100c4cea8f207e883ff91ca886d621d8a166cb04971dfaa9bb8fd99ed95df" dependencies = [ + "blst", "cc", + "glob", + "hex", "libc", - "pkg-config", -] - -[[package]] -name = "camino" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver", "serde", - "serde_json", - "thiserror", ] [[package]] @@ -516,16 +1115,6 @@ dependencies = [ "windows-targets 0.52.5", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - [[package]] name = "clap_builder_cryo" version = "4.3.21-cryo" @@ -555,7 +1144,7 @@ version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd1cd2cebdb1ec98182edb745382a2b65d6bc254782de26316e4366d83d39988" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.60", @@ -563,61 +1152,9 @@ dependencies = [ [[package]] name = "clap_lex_cryo" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98979652585ac7c8d6267e363229b6a26bc4bf469c69e96442f85830ebc89f45" - -[[package]] -name = "coins-bip32" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" -dependencies = [ - "bs58", - "coins-core", - "digest", - "hmac", - "k256", - "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-bip39" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" -dependencies = [ - "bitvec", - "coins-bip32", - "hmac", - "once_cell", - "pbkdf2 0.12.2", - "rand", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-core" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" -dependencies = [ - "base64 0.21.7", - "bech32", - "bs58", - "digest", - "generic-array", - "hex", - "ripemd", - "serde", - "serde_derive", - "sha2", - "sha3", - "thiserror", -] +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98979652585ac7c8d6267e363229b6a26bc4bf469c69e96442f85830ebc89f45" [[package]] name = "color-print" @@ -701,10 +1238,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] -name = "constant_time_eq" -version = "0.1.5" +name = "convert_case" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "core-foundation" @@ -815,12 +1352,12 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" name = "cryo_cli" version = "0.3.2" dependencies = [ + "alloy", "anstyle", "clap_cryo", "color-print", "colored", "cryo_freeze", - "ethers", "eyre", "governor", "hex", @@ -836,15 +1373,14 @@ dependencies = [ name = "cryo_freeze" version = "0.3.2" dependencies = [ + "alloy", "async-trait", "chrono", "colored", "cryo_to_df", - "ethers", - "ethers-core", "futures", "governor", - "heck", + "heck 0.4.1", "indexmap", "indicatif", "lazy_static", @@ -857,6 +1393,7 @@ dependencies = [ "thiserror", "thousands", "tokio", + "url", ] [[package]] @@ -905,15 +1442,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - [[package]] name = "dashmap" version = "5.5.3" @@ -953,10 +1481,10 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.99.17" +name = "derivative" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", @@ -964,58 +1492,44 @@ dependencies = [ ] [[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "dirs" -version = "5.0.1" +name = "derive_more" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "dirs-sys", + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.4.0", + "syn 1.0.109", ] [[package]] -name = "dirs-next" -version = "2.0.0" +name = "digest" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "cfg-if", - "dirs-sys-next", + "generic-array", ] [[package]] -name = "dirs-sys" -version = "0.4.1" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", + "block-buffer", + "const-oid", + "crypto-common", + "subtle", ] [[package]] -name = "dirs-sys-next" -version = "0.1.2" +name = "doctest-file" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] +checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" [[package]] name = "dunce" @@ -1036,7 +1550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -1057,7 +1571,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", @@ -1068,394 +1582,38 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ena" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" -dependencies = [ - "log", -] - [[package]] name = "encode_unicode" version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enr" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" -dependencies = [ - "base64 0.21.7", - "bytes", - "hex", - "k256", - "log", - "rand", - "rlp", - "serde", - "sha3", - "zeroize", -] - -[[package]] -name = "enum_dispatch" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.60", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "eth-keystore" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" -dependencies = [ - "aes", - "ctr", - "digest", - "hex", - "hmac", - "pbkdf2 0.11.0", - "rand", - "scrypt", - "serde", - "serde_json", - "sha2", - "sha3", - "thiserror", - "uuid", -] - -[[package]] -name = "ethabi" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" -dependencies = [ - "ethereum-types", - "hex", - "once_cell", - "regex", - "serde", - "serde_json", - "sha3", - "thiserror", - "uint", -] - -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "primitive-types", - "scale-info", - "uint", -] - -[[package]] -name = "ethers" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" -dependencies = [ - "ethers-addressbook", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-middleware", - "ethers-providers", - "ethers-signers", - "ethers-solc", -] - -[[package]] -name = "ethers-addressbook" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" -dependencies = [ - "ethers-core", - "once_cell", - "serde", - "serde_json", -] - -[[package]] -name = "ethers-contract" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" -dependencies = [ - "const-hex", - "ethers-contract-abigen", - "ethers-contract-derive", - "ethers-core", - "ethers-providers", - "futures-util", - "once_cell", - "pin-project", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "ethers-contract-abigen" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b" -dependencies = [ - "Inflector", - "const-hex", - "dunce", - "ethers-core", - "ethers-etherscan", - "eyre", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "reqwest", - "serde", - "serde_json", - "syn 2.0.60", - "toml", - "walkdir", -] - -[[package]] -name = "ethers-contract-derive" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" -dependencies = [ - "Inflector", - "const-hex", - "ethers-contract-abigen", - "ethers-core", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.60", -] - -[[package]] -name = "ethers-core" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" -dependencies = [ - "arrayvec", - "bytes", - "cargo_metadata", - "chrono", - "const-hex", - "elliptic-curve", - "ethabi", - "generic-array", - "k256", - "num_enum", - "once_cell", - "open-fastrlp", - "rand", - "rlp", - "serde", - "serde_json", - "strum", - "syn 2.0.60", - "tempfile", - "thiserror", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "ethers-etherscan" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" -dependencies = [ - "chrono", - "ethers-core", - "reqwest", - "semver", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-middleware" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" -dependencies = [ - "async-trait", - "auto_impl", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-providers", - "ethers-signers", - "futures-channel", - "futures-locks", - "futures-util", - "instant", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "url", -] +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] -name = "ethers-providers" -version = "2.0.14" +name = "enum_dispatch" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" dependencies = [ - "async-trait", - "auto_impl", - "base64 0.21.7", - "bytes", - "const-hex", - "enr", - "ethers-core", - "futures-channel", - "futures-core", - "futures-timer", - "futures-util", - "hashers", - "http", - "instant", - "jsonwebtoken", "once_cell", - "pin-project", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-tungstenite", - "tracing", - "tracing-futures", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winapi", - "ws_stream_wasm", + "proc-macro2", + "quote", + "syn 2.0.60", ] [[package]] -name = "ethers-signers" -version = "2.0.14" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2" -dependencies = [ - "async-trait", - "coins-bip32", - "coins-bip39", - "const-hex", - "elliptic-curve", - "eth-keystore", - "ethers-core", - "rand", - "sha2", - "thiserror", - "tracing", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "ethers-solc" -version = "2.0.14" +name = "errno" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66244a771d9163282646dbeffe0e6eca4dda4146b6498644e678ac6089b11edd" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "cfg-if", - "const-hex", - "dirs", - "dunce", - "ethers-core", - "glob", - "home", - "md-5", - "num_cpus", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver", - "serde", - "serde_json", - "solang-parser", - "svm-rs", - "thiserror", - "tiny-keccak", - "tokio", - "tracing", - "walkdir", - "yansi", + "libc", + "windows-sys 0.52.0", ] [[package]] @@ -1492,6 +1650,17 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" +[[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" @@ -1514,12 +1683,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "flate2" version = "1.0.28" @@ -1545,6 +1708,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign_vec" version = "0.1.0" @@ -1560,16 +1738,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "funty" version = "2.0.0" @@ -1624,16 +1792,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" -[[package]] -name = "futures-locks" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" -dependencies = [ - "futures-channel", - "futures-task", -] - [[package]] name = "futures-macro" version = "0.3.30" @@ -1662,10 +1820,6 @@ name = "futures-timer" version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" -dependencies = [ - "gloo-timers", - "send_wrapper 0.4.0", -] [[package]] name = "futures-util" @@ -1686,13 +1840,10 @@ dependencies = [ ] [[package]] -name = "fxhash" -version = "0.2.1" +name = "futures-utils-wasm" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] +checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" [[package]] name = "generic-array" @@ -1730,18 +1881,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "governor" version = "0.6.3" @@ -1773,25 +1912,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "halfbrown" version = "0.2.5" @@ -1814,19 +1934,16 @@ dependencies = [ ] [[package]] -name = "hashers" -version = "1.0.1" +name = "heck" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" -dependencies = [ - "fxhash", -] +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -1839,6 +1956,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 = "hmac" @@ -1846,7 +1972,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -1860,9 +1986,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1871,12 +1997,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", + "futures-util", "http", + "http-body", "pin-project-lite", ] @@ -1886,48 +2024,59 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hyper" -version = "0.14.28" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", - "h2", "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] -name = "hyper-rustls" -version = "0.24.2" +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", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" dependencies = [ + "bytes", + "futures-channel", "futures-util", "http", + "http-body", "hyper", - "rustls", + "pin-project-lite", + "socket2", "tokio", - "tokio-rustls", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -1972,24 +2121,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -2037,21 +2168,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] -name = "inout" -version = "0.1.3" +name = "instant" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "generic-array", + "cfg-if", ] [[package]] -name = "instant" -version = "0.1.12" +name = "interprocess" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "67bafc2f5dbdad79a6d925649758d5472647b416028099f0b829d1b67fdd47d3" dependencies = [ - "cfg-if", + "doctest-file", + "futures-core", + "libc", + "recvmsg", + "tokio", + "widestring", + "windows-sys 0.52.0", ] [[package]] @@ -2073,9 +2210,18 @@ dependencies = [ [[package]] name = "itertools" -version = "0.11.0" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -2106,13 +2252,14 @@ dependencies = [ [[package]] name = "jsonwebtoken" -version = "8.3.0" +version = "9.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" dependencies = [ "base64 0.21.7", + "js-sys", "pem", - "ring 0.16.20", + "ring", "serde", "serde_json", "simple_asn1", @@ -2125,50 +2272,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2", - "signature", -] - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lalrpop" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca" -dependencies = [ - "ascii-canvas", - "bit-set", - "ena", - "itertools", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", - "walkdir", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", ] [[package]] -name = "lalrpop-util" -version = "0.20.2" +name = "keccak-asm" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" +checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" dependencies = [ - "regex-automata", + "digest 0.10.7", + "sha3-asm", ] [[package]] @@ -2253,16 +2370,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.5.0", - "libc", -] - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -2285,6 +2392,15 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown", +] + [[package]] name = "lz4" version = "1.24.0" @@ -2305,16 +2421,6 @@ dependencies = [ "libc", ] -[[package]] -name = "md-5" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" -dependencies = [ - "cfg-if", - "digest", -] - [[package]] name = "memchr" version = "2.7.2" @@ -2405,10 +2511,21 @@ dependencies = [ ] [[package]] -name = "new_debug_unreachable" -version = "1.0.6" +name = "native-tls" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] [[package]] name = "no-std-compat" @@ -2511,7 +2628,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.60", @@ -2539,35 +2655,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "open-fastrlp" -version = "0.1.4" +name = "openssl" +version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "arrayvec", - "auto_impl", - "bytes", - "ethereum-types", - "open-fastrlp-derive", + "bitflags 2.5.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", ] [[package]] -name = "open-fastrlp-derive" +name = "openssl-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "bytes", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] -name = "option-ext" -version = "0.2.0" +name = "openssl-probe" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] [[package]] name = "parity-scale-codec" @@ -2589,7 +2718,7 @@ version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate 2.0.0", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -2629,51 +2758,19 @@ dependencies = [ ] [[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - -[[package]] -name = "path-slash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest", - "hmac", - "password-hash", - "sha2", -] - -[[package]] -name = "pbkdf2" -version = "0.12.2" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest", - "hmac", -] +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pem" -version = "1.1.1" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.13.1", + "base64 0.22.1", + "serde", ] [[package]] @@ -2683,13 +2780,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] -name = "petgraph" -version = "0.6.4" +name = "pest" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" dependencies = [ - "fixedbitset", - "indexmap", + "memchr", + "thiserror", + "ucd-trie", ] [[package]] @@ -2699,58 +2797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ "futures", - "rustc_version", -] - -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_macros", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared 0.11.2", - "rand", -] - -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator", - "phf_shared 0.11.2", - "proc-macro2", - "quote", - "syn 2.0.60", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", + "rustc_version 0.4.0", ] [[package]] @@ -2856,7 +2903,7 @@ dependencies = [ "streaming-iterator", "strength_reduce", "version_check", - "zstd 0.13.1", + "zstd", ] [[package]] @@ -3048,7 +3095,7 @@ dependencies = [ "simdutf8", "snap", "streaming-decompression", - "zstd 0.13.1", + "zstd", ] [[package]] @@ -3184,12 +3231,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "prefix-hex" version = "0.7.1" @@ -3199,16 +3240,6 @@ dependencies = [ "hex", ] -[[package]] -name = "prettyplease" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" -dependencies = [ - "proc-macro2", - "syn 2.0.60", -] - [[package]] name = "primitive-types" version = "0.12.2" @@ -3217,38 +3248,40 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", "uint", ] [[package]] name = "proc-macro-crate" -version = "1.3.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" dependencies = [ - "once_cell", - "toml_edit 0.19.15", + "toml_edit", ] [[package]] -name = "proc-macro-crate" -version = "2.0.0" +name = "proc-macro-error" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ - "toml_edit 0.20.7", + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", ] [[package]] -name = "proc-macro-crate" -version = "3.1.0" +name = "proc-macro-error-attr" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "toml_edit 0.21.1", + "proc-macro2", + "quote", + "version_check", ] [[package]] @@ -3266,6 +3299,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", @@ -3273,6 +3308,8 @@ dependencies = [ "rand_chacha", "rand_xorshift", "regex-syntax", + "rusty-fork", + "tempfile", "unarray", ] @@ -3345,7 +3382,7 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "pyo3-build-config", "quote", @@ -3379,6 +3416,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" version = "1.0.36" @@ -3472,6 +3515,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" + [[package]] name = "redox_syscall" version = "0.4.1" @@ -3481,17 +3530,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "ref-cast" version = "1.0.22" @@ -3543,42 +3581,40 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.27" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bytes", - "encoding_rs", "futures-core", "futures-util", - "h2", "http", "http-body", + "http-body-util", "hyper", - "hyper-rustls", + "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", "mime", + "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", - "tokio-rustls", + "tokio-native-tls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", "winreg", ] @@ -3592,21 +3628,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", -] - [[package]] name = "ring" version = "0.17.8" @@ -3617,20 +3638,11 @@ dependencies = [ "cfg-if", "getrandom", "libc", - "spin 0.9.8", - "untrusted 0.9.0", + "spin", + "untrusted", "windows-sys 0.52.0", ] -[[package]] -name = "ripemd" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" -dependencies = [ - "digest", -] - [[package]] name = "rlp" version = "0.5.2" @@ -3638,21 +3650,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", - "rlp-derive", "rustc-hex", ] [[package]] -name = "rlp-derive" -version = "0.1.0" +name = "ruint" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "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 = "rustc-demangle" version = "0.1.23" @@ -3665,13 +3695,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.22", ] [[package]] @@ -3689,33 +3728,43 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.11" +version = "0.23.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" dependencies = [ - "log", - "ring 0.17.8", + "once_cell", + "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] @@ -3725,93 +3774,82 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] -name = "ryu" -version = "1.0.17" +name = "rusty-fork" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] [[package]] -name = "salsa20" -version = "0.10.2" +name = "ryu" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher", -] +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] -name = "same-file" -version = "1.0.6" +name = "schannel" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "winapi-util", + "windows-sys 0.52.0", ] [[package]] -name = "scale-info" -version = "2.11.2" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c453e59a955f81fb62ee5d596b450383d699f152d350e9d23a0db2adb78e4c0" -dependencies = [ - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", -] +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "scale-info-derive" -version = "2.11.2" +name = "sec1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18cf6c6447f813ef19eb450e985bcce6705f9ce7660db221b59093d15c79c4b7" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", ] [[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "scrypt" -version = "0.10.0" +name = "security-framework" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "hmac", - "pbkdf2 0.11.0", - "salsa20", - "sha2", + "bitflags 2.5.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", ] [[package]] -name = "sct" -version = "0.7.1" +name = "security-framework-sys" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "core-foundation-sys", + "libc", ] [[package]] -name = "sec1" -version = "0.7.3" +name = "semver" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", + "semver-parser", ] [[package]] @@ -3819,15 +3857,15 @@ name = "semver" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" -dependencies = [ - "serde", -] [[package]] -name = "send_wrapper" -version = "0.4.0" +name = "semver-parser" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] [[package]] name = "send_wrapper" @@ -3872,15 +3910,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3901,7 +3930,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -3912,17 +3941,17 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] -name = "sha3" -version = "0.10.8" +name = "sha3-asm" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" dependencies = [ - "digest", - "keccak", + "cc", + "cfg-if", ] [[package]] @@ -3931,7 +3960,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", + "digest 0.10.7", "rand_core", ] @@ -3971,12 +4000,6 @@ dependencies = [ "time", ] -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - [[package]] name = "slab" version = "0.4.9" @@ -4019,26 +4042,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "solang-parser" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" -dependencies = [ - "itertools", - "lalrpop", - "lalrpop-util", - "phf", - "thiserror", - "unicode-xid", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -4100,19 +4103,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", -] - [[package]] name = "strsim" version = "0.10.0" @@ -4134,7 +4124,7 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -4147,7 +4137,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -4160,26 +4150,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" -[[package]] -name = "svm-rs" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11297baafe5fa0c99d5722458eac6a5e25c01eb1b8e5cd137f54079093daa7a4" -dependencies = [ - "dirs", - "fs2", - "hex", - "once_cell", - "reqwest", - "semver", - "serde", - "serde_json", - "sha2", - "thiserror", - "url", - "zip", -] - [[package]] name = "syn" version = "1.0.109" @@ -4202,11 +4172,23 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn-solidity" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "sysinfo" @@ -4222,27 +4204,6 @@ dependencies = [ "windows", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tap" version = "1.0.1" @@ -4273,17 +4234,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - [[package]] name = "thiserror" version = "1.0.58" @@ -4310,6 +4260,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.3.36" @@ -4393,25 +4352,49 @@ dependencies = [ "syn 2.0.60", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +dependencies = [ + "futures-core", + "pin-project-lite", "tokio", + "tokio-util", ] [[package]] name = "tokio-tungstenite" -version = "0.20.1" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd" dependencies = [ "futures-util", "log", "rustls", + "rustls-pki-types", "tokio", "tokio-rustls", "tungstenite", @@ -4429,19 +4412,6 @@ dependencies = [ "futures-sink", "pin-project-lite", "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.12", ] [[package]] @@ -4449,20 +4419,6 @@ name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] [[package]] name = "toml_edit" @@ -4476,28 +4432,26 @@ dependencies = [ ] [[package]] -name = "toml_edit" -version = "0.21.1" +name = "tower" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", ] [[package]] -name = "toml_edit" -version = "0.22.12" +name = "tower-layer" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.6.6", -] +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" [[package]] name = "tower-service" @@ -4511,6 +4465,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4536,16 +4491,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -4554,9 +4499,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.20.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8" dependencies = [ "byteorder", "bytes", @@ -4566,9 +4511,9 @@ dependencies = [ "log", "rand", "rustls", + "rustls-pki-types", "sha1", "thiserror", - "url", "utf-8", ] @@ -4578,6 +4523,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" @@ -4623,24 +4574,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "unindent" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -4649,9 +4588,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -4671,14 +4610,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] -name = "uuid" -version = "0.8.2" +name = "valuable" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom", - "serde", -] +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-trait" @@ -4692,6 +4627,12 @@ dependencies = [ "ryu", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" @@ -4699,13 +4640,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "walkdir" -version = "2.5.0" +name = "wait-timeout" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" dependencies = [ - "same-file", - "winapi-util", + "libc", ] [[package]] @@ -4801,9 +4741,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.4" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "widestring" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -4821,15 +4770,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -5014,9 +4954,9 @@ dependencies = [ [[package]] name = "winreg" -version = "0.50.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", @@ -5033,8 +4973,8 @@ dependencies = [ "js-sys", "log", "pharos", - "rustc_version", - "send_wrapper 0.6.0", + "rustc_version 0.4.0", + "send_wrapper", "thiserror", "wasm-bindgen", "wasm-bindgen-futures", @@ -5056,12 +4996,6 @@ version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "zerocopy" version = "0.7.32" @@ -5087,34 +5021,19 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" - -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" dependencies = [ - "aes", - "byteorder", - "bzip2", - "constant_time_eq", - "crc32fast", - "crossbeam-utils", - "flate2", - "hmac", - "pbkdf2 0.11.0", - "sha1", - "time", - "zstd 0.11.2+zstd.1.5.2", + "zeroize_derive", ] [[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" +name = "zeroize_derive" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "zstd-safe 5.0.2+zstd.1.5.2", + "proc-macro2", + "quote", + "syn 2.0.60", ] [[package]] @@ -5123,17 +5042,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" dependencies = [ - "zstd-safe 7.1.0", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", + "zstd-safe", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 4871f8dc..9bba7aa9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,15 @@ cryo_cli = { version = "0.3.2", path = "./crates/cli" } cryo_freeze = { version = "0.3.2", path = "./crates/freeze" } cryo_to_df = { version = "0.3.2", path = "./crates/to_df" } +alloy = { version = "0.1", features = [ + "full", + "rpc-types-trace", + "provider-ws", + "provider-ipc", + "provider-debug-api", + "provider-trace-api", + "transport-ipc-mock", +] } anstyle = "1.0.4" async-trait = "0.1.74" chrono = { version = "0.4.31", features = ["serde"] } @@ -29,8 +38,6 @@ clap_cryo = { version = "4.3.21-cryo", features = [ ] } colored = "2.0.4" color-print = "0.3.5" -ethers = { version = "2.0.10", features = ["rustls", "ws", "ipc"] } -ethers-core = "2.0.10" eyre = "0.6.8" futures = "0.3.29" governor = "0.6.0" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 7eb4fccb..49cb9a0d 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -18,12 +18,12 @@ path = "src/main.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +alloy = { workspace = true } anstyle = { workspace = true } clap_cryo = { workspace = true } color-print = { workspace = true } colored = { workspace = true } cryo_freeze = { workspace = true } -ethers = { workspace = true } eyre = { workspace = true } governor = { workspace = true } hex = { workspace = true } diff --git a/crates/cli/src/parse/blocks.rs b/crates/cli/src/parse/blocks.rs index 80fe1a67..2a9b0bba 100644 --- a/crates/cli/src/parse/blocks.rs +++ b/crates/cli/src/parse/blocks.rs @@ -168,6 +168,7 @@ async fn parse_block_inputs( } } +#[derive(Clone, Debug)] enum RangePosition { First, Last, @@ -322,12 +323,12 @@ async fn parse_block_number( source: Arc, ) -> Result { match (block_ref, range_position) { - ("latest", _) => source.get_block_number().await.map(|n| n.as_u64()).map_err(|_e| { + ("latest", _) => source.get_block_number().await.map_err(|_e| { ParseError::ParseError("Error retrieving latest block number".to_string()) }), ("", RangePosition::First) => Ok(0), ("", RangePosition::Last) => { - source.get_block_number().await.map(|n| n.as_u64()).map_err(|_e| { + source.get_block_number().await.map_err(|_e| { ParseError::ParseError("Error retrieving last block number".to_string()) }) } @@ -366,7 +367,7 @@ async fn apply_reorg_buffer( 0 => Ok(block_chunks), reorg_filter => { let latest_block = match source.get_block_number().await { - Ok(result) => result.as_u64(), + Ok(result) => result, Err(_e) => { return Err(ParseError::ParseError("reorg buffer parse error".to_string())) } @@ -387,24 +388,28 @@ pub(crate) async fn get_latest_block_number(source: Arc) -> Result { WithoutMock((&'a str, BlockChunk)), // Token | Expected WithMock((&'a str, BlockChunk, u64)), // Token | Expected | Mock Block Response } - async fn block_token_test_helper(tests: Vec<(BlockTokenTest<'_>, bool)>) { - let (provider, mock) = Provider::mocked(); + async fn block_token_test_helper(tests: Vec<(BlockTokenTest<'_>, bool)>, mock_ipc_path: PathBuf) { + let ipc = IpcConnect::new(mock_ipc_path); + let provider = ProviderBuilder::new().on_ipc(ipc).await.unwrap().boxed(); let source = Source { - provider: provider.into(), + provider, semaphore: Arc::new(None), rate_limiter: Arc::new(None), chain_id: 1, @@ -416,8 +421,7 @@ mod tests { let source = Arc::new(source); for (test, res) in tests { match test { - BlockTokenTest::WithMock((token, expected, latest)) => { - mock.push(U64::from(latest)).unwrap(); + BlockTokenTest::WithMock((token, expected, _latest)) => { assert_eq!( block_token_test_executor(token, expected, source.clone()).await, res @@ -458,15 +462,17 @@ mod tests { } } + #[derive(Clone, Debug)] enum BlockInputTest<'a> { WithoutMock((&'a String, Vec)), // Token | Expected WithMock((&'a String, Vec, u64)), // Token | Expected | Mock Block Response } - async fn block_input_test_helper(tests: Vec<(BlockInputTest<'_>, bool)>) { - let (provider, mock) = Provider::mocked(); + async fn block_input_test_helper(tests: Vec<(BlockInputTest<'_>, bool)>, mock_ipc_path: PathBuf) { + let ipc = IpcConnect::new(mock_ipc_path); + let provider = ProviderBuilder::new().on_ipc(ipc).await.unwrap().boxed(); let source = Arc::new(Source { - provider: provider.into(), + provider, chain_id: 1, rpc_url: "".to_string(), inner_request_size: 1, @@ -477,8 +483,7 @@ mod tests { }); for (test, res) in tests { match test { - BlockInputTest::WithMock((inputs, expected, latest)) => { - mock.push(U64::from(latest)).unwrap(); + BlockInputTest::WithMock((inputs, expected, _latest)) => { assert_eq!( block_input_test_executor(inputs, expected, source.clone()).await, res @@ -531,15 +536,20 @@ mod tests { true } + #[derive(Clone, Debug)] enum BlockNumberTest<'a> { WithoutMock((&'a str, RangePosition, u64)), WithMock((&'a str, RangePosition, u64, u64)), } - async fn block_number_test_helper(tests: Vec<(BlockNumberTest<'_>, bool)>) { - let (provider, mock) = Provider::mocked(); + async fn block_number_test_helper(tests: Vec<(BlockNumberTest<'_>, bool)>, mock_ipc_path: PathBuf) { + let provider = ProviderBuilder::new() + .on_ipc(IpcConnect::new(mock_ipc_path)) + .await + .unwrap() + .boxed(); let source = Source { - provider: provider.into(), + provider, semaphore: Arc::new(None), rate_limiter: Arc::new(None), chain_id: 1, @@ -551,8 +561,7 @@ mod tests { let source = Arc::new(source); for (test, res) in tests { match test { - BlockNumberTest::WithMock((block_ref, range_position, expected, latest)) => { - mock.push(U64::from(latest)).unwrap(); + BlockNumberTest::WithMock((block_ref, range_position, expected, _latest)) => { assert_eq!( block_number_test_executor( block_ref, @@ -604,7 +613,16 @@ mod tests { // Number type (BlockTokenTest::WithoutMock((r"1", BlockChunk::Numbers(vec![1]))), true), /* Single block */ ]; - block_token_test_helper(tests).await; + let mut mock_server = MockIpcServer::new(); + let mock_ipc_path = mock_server.path().clone(); + for (test,_) in tests.clone().into_iter() { + match test { + BlockTokenTest::WithoutMock(_) => {} + BlockTokenTest::WithMock((_, _, mock_response)) => mock_server.add_reply(mock_response) + } + } + mock_server.spawn().await; + block_token_test_helper(tests, mock_ipc_path).await; } #[tokio::test] @@ -648,7 +666,16 @@ mod tests { true, ), // Multi input complex ]; - block_input_test_helper(tests).await; + let mut mock_server = MockIpcServer::new(); + let mock_ipc_path = mock_server.path().clone(); + for (test, _) in tests.clone() { + match test { + BlockInputTest::WithMock((_, _, expected)) => mock_server.add_reply(expected), + BlockInputTest::WithoutMock(_) => {} + } + } + mock_server.spawn().await; + block_input_test_helper(tests, mock_ipc_path).await; } #[tokio::test] @@ -666,6 +693,15 @@ mod tests { (BlockNumberTest::WithoutMock((r"1m", RangePosition::None, 1000000)), true), // m (BlockNumberTest::WithoutMock((r"1k", RangePosition::None, 1000)), true), // k ]; - block_number_test_helper(tests).await; + let mut mock_server = MockIpcServer::new(); + let mock_ipc_path = mock_server.path().clone(); + for (test, _) in tests.clone() { + match test { + BlockNumberTest::WithMock((_, _, _, expected)) => mock_server.add_reply(expected), + BlockNumberTest::WithoutMock(_) => {} + } + } + mock_server.spawn().await; + block_number_test_helper(tests, mock_ipc_path).await; } } diff --git a/crates/cli/src/parse/partitions.rs b/crates/cli/src/parse/partitions.rs index bada931d..0816435e 100644 --- a/crates/cli/src/parse/partitions.rs +++ b/crates/cli/src/parse/partitions.rs @@ -8,7 +8,6 @@ use cryo_freeze::{ AddressChunk, CallDataChunk, Datatype, Dim, ParseError, Partition, PartitionLabels, SlotChunk, Source, Table, TimeDimension, TopicChunk, TransactionChunk, }; -use ethers::prelude::*; use rand::{seq::SliceRandom, thread_rng}; use std::{collections::HashMap, str::FromStr, sync::Arc}; diff --git a/crates/cli/src/parse/source.rs b/crates/cli/src/parse/source.rs index 90cff194..ef789a36 100644 --- a/crates/cli/src/parse/source.rs +++ b/crates/cli/src/parse/source.rs @@ -1,8 +1,8 @@ use std::env; use crate::args::Args; -use cryo_freeze::{sources::ProviderWrapper, ParseError, Source, SourceLabels}; -use ethers::prelude::*; +use alloy::{providers::{IpcConnect, Provider, ProviderBuilder, RootProvider, WsConnect}, transports::{http::reqwest::Url, BoxTransport}}; +use cryo_freeze::{ParseError, Source, SourceLabels}; use governor::{Quota, RateLimiter}; use polars::prelude::*; use std::num::NonZeroU32; @@ -10,27 +10,21 @@ use std::num::NonZeroU32; pub(crate) async fn parse_source(args: &Args) -> Result { // parse network info let rpc_url = parse_rpc_url(args)?; - let (provider, chain_id): (ProviderWrapper, u64) = if rpc_url.starts_with("http") { - let provider = Provider::>::new_client( - &rpc_url, - args.max_retries, - args.initial_backoff, - ) - .map_err(|_e| ParseError::ParseError("could not connect to provider".to_string()))?; - let chain_id = provider.get_chainid().await.map_err(ParseError::ProviderError)?.as_u64(); - (provider.into(), chain_id) + let (provider, chain_id): (RootProvider, u64) = if rpc_url.starts_with("http") { + let url: Url = rpc_url.clone().parse().map_err(ParseError::ParseUrlError)?; + let provider = ProviderBuilder::new().on_http(url); + let chain_id = provider.get_chain_id().await.map_err(ParseError::ProviderError)?; + (provider.boxed(), chain_id) } else if rpc_url.starts_with("ws") { - let provider = Provider::::connect(&rpc_url).await.map_err(|_| { - ParseError::ParseError("could not instantiate HTTP Provider".to_string()) - })?; - let chain_id = provider.get_chainid().await.map_err(ParseError::ProviderError)?.as_u64(); - (provider.into(), chain_id) + let ws = WsConnect::new(rpc_url.clone()); + let provider = ProviderBuilder::new().on_ws(ws).await.map_err(ParseError::ProviderError)?; + let chain_id = provider.get_chain_id().await.map_err(ParseError::ProviderError)?; + (provider.boxed(), chain_id) } else if rpc_url.ends_with(".ipc") { - let provider: Provider = Provider::connect_ipc(&rpc_url).await.map_err(|_| { - ParseError::ParseError("could not instantiate HTTP Provider".to_string()) - })?; - let chain_id = provider.get_chainid().await.map_err(ParseError::ProviderError)?.as_u64(); - (provider.into(), chain_id) + let ipc = IpcConnect::new(rpc_url.clone()); + let provider = ProviderBuilder::new().on_ipc(ipc).await.map_err(ParseError::ProviderError)?; + let chain_id = provider.get_chain_id().await.map_err(ParseError::ProviderError)?; + (provider.boxed(), chain_id) } else { return Err(ParseError::ParseError(format!("invalid rpc url: {}", rpc_url))); }; diff --git a/crates/cli/src/parse/timestamps.rs b/crates/cli/src/parse/timestamps.rs index e6e26b47..d7f5506e 100644 --- a/crates/cli/src/parse/timestamps.rs +++ b/crates/cli/src/parse/timestamps.rs @@ -1,3 +1,4 @@ +use alloy::rpc::types::BlockTransactionsKind; use cryo_freeze::{BlockChunk, ParseError, Source}; use polars::prelude::*; @@ -277,7 +278,7 @@ async fn timestamp_to_block_number(timestamp: u64, source: Arc) -> Resul let mut r = latest_block_number; let mut mid = (l + r) / 2; let mut block = source - .get_block(mid) + .get_block(mid, BlockTransactionsKind::Hashes) .await .map_err(|_e| ParseError::ParseError("Error fetching block for timestamp".to_string()))? .unwrap(); @@ -285,15 +286,15 @@ async fn timestamp_to_block_number(timestamp: u64, source: Arc) -> Resul while l <= r { mid = (l + r) / 2; block = source - .get_block(mid) + .get_block(mid, BlockTransactionsKind::Hashes) .await .map_err(|_e| ParseError::ParseError("Error fetching block for timestamp".to_string()))? .unwrap(); #[allow(clippy::comparison_chain)] - if block.timestamp == timestamp.into() { + if block.header.timestamp == timestamp { return Ok(mid); - } else if block.timestamp < timestamp.into() { + } else if block.header.timestamp < timestamp { l = mid + 1; } else { r = mid - 1; @@ -301,7 +302,7 @@ async fn timestamp_to_block_number(timestamp: u64, source: Arc) -> Resul } // If timestamp is between two different blocks, return the lower block. - if mid > 0 && block.timestamp > ethers::types::U256::from(timestamp) { + if mid > 0 && block.header.timestamp > timestamp { Ok(mid - 1) } else { Ok(mid) @@ -311,44 +312,40 @@ async fn timestamp_to_block_number(timestamp: u64, source: Arc) -> Resul async fn get_latest_timestamp(source: Arc) -> Result { let latest_block_number = get_latest_block_number(source.clone()).await?; let latest_block = source - .get_block(latest_block_number) + .get_block(latest_block_number, BlockTransactionsKind::Hashes) .await .map_err(|_e| ParseError::ParseError("Error fetching latest block".to_string()))? .unwrap(); - Ok(latest_block.timestamp.as_u64()) + Ok(latest_block.header.timestamp) } #[cfg(test)] mod tests { use std::num::NonZeroU32; + use alloy::providers::ProviderBuilder; use governor::{Quota, RateLimiter}; use super::*; use cryo_freeze::SourceLabels; - use ethers::prelude::*; async fn setup_source() -> Source { let rpc_url = match crate::parse::source::parse_rpc_url(&Args::default()) { Ok(url) => url, Err(_) => std::process::exit(0), }; - let max_retry = 5; - let initial_backoff = 500; + // let max_retry = 5; + // let initial_backoff = 500; let max_concurrent_requests = 100; - let provider = - Provider::>::new_client(&rpc_url, max_retry, initial_backoff) - .map_err(|_e| ParseError::ParseError("could not connect to provider".to_string())) - .unwrap(); - + let provider = ProviderBuilder::new().on_http(rpc_url.parse().unwrap()).boxed(); let quota = Quota::per_second(NonZeroU32::new(15).unwrap()) .allow_burst(NonZeroU32::new(1).unwrap()); let rate_limiter = Some(RateLimiter::direct(quota)); let semaphore = tokio::sync::Semaphore::new(max_concurrent_requests as usize); Source { - provider: provider.into(), + provider, semaphore: Arc::new(Some(semaphore)), rate_limiter: Arc::new(rate_limiter), chain_id: 1, @@ -373,8 +370,8 @@ mod tests { let source = setup_source().await; let source = Arc::new(source); let latest_block_number = get_latest_block_number(source.clone()).await.unwrap(); - let latest_block = source.get_block(latest_block_number).await.unwrap().unwrap(); - let latest_timestamp = latest_block.timestamp.as_u64(); + let latest_block = source.get_block(latest_block_number, BlockTransactionsKind::Hashes).await.unwrap().unwrap(); + let latest_timestamp = latest_block.header.timestamp; assert_eq!( timestamp_to_block_number(latest_timestamp, source).await.unwrap(), diff --git a/crates/freeze/Cargo.toml b/crates/freeze/Cargo.toml index 9c8e5e18..be04ad9c 100644 --- a/crates/freeze/Cargo.toml +++ b/crates/freeze/Cargo.toml @@ -11,12 +11,11 @@ repository.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +alloy = { workspace = true } async-trait = { workspace = true } chrono = { workspace = true } colored = { workspace = true } cryo_to_df = { workspace = true } -ethers = { workspace = true } -ethers-core = { workspace = true } futures = { workspace = true } governor = { workspace = true } heck = { workspace = true } @@ -32,3 +31,4 @@ serde_json = { workspace = true } thiserror = { workspace = true } thousands = { workspace = true } tokio = { workspace = true } +url = "2.5.2" diff --git a/crates/freeze/src/datasets/address_appearances.rs b/crates/freeze/src/datasets/address_appearances.rs index 4e76b614..b7e66b49 100644 --- a/crates/freeze/src/datasets/address_appearances.rs +++ b/crates/freeze/src/datasets/address_appearances.rs @@ -1,5 +1,7 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::{Address, TxHash}, rpc::types::{ + eth::{Block, Log}, trace::parity::{Action, LocalizedTransactionTrace, TraceOutput}, BlockTransactionsKind, Filter, FilterBlockOption +}, sol_types::SolEvent}; use polars::prelude::*; use std::collections::HashMap; @@ -34,7 +36,7 @@ impl Dataset for AddressAppearances { } } -type BlockLogsTraces = (Block, Vec, Vec); +type BlockLogsTraces = (Block, Vec, Vec); #[async_trait::async_trait] impl CollectByBlock for AddressAppearances { @@ -42,17 +44,17 @@ impl CollectByBlock for AddressAppearances { async fn extract(request: Params, source: Arc, _: Arc) -> R { let block_number = request.ethers_block_number()?; - let block = source.get_block(request.block_number()?).await?; + let block = source.get_block(request.block_number()?, BlockTransactionsKind::Hashes).await?; let block = block.ok_or(CollectError::CollectError("block not found".to_string()))?; let filter = Filter { block_option: FilterBlockOption::Range { - from_block: Some(block_number), - to_block: Some(block_number), + from_block: Some(block_number.into()), + to_block: Some(block_number.into()), }, ..Default::default() }; let logs = source.get_logs(&filter).await?; - let traces = source.trace_block(request.block_number()?.into()).await?; + let traces = source.trace_block(request.block_number()?).await?; Ok((block, logs, traces)) } @@ -69,16 +71,15 @@ impl CollectByTransaction for AddressAppearances { async fn extract(request: Params, source: Arc, _: Arc) -> R { let tx_hash = request.ethers_transaction_hash()?; - let tx_data = source.get_transaction(tx_hash).await?.ok_or_else(|| { + let tx_data = source.get_transaction_by_hash(tx_hash).await?.ok_or_else(|| { CollectError::CollectError("could not find transaction data".to_string()) })?; let block_number = tx_data .block_number - .ok_or_else(|| CollectError::CollectError("block not found".to_string()))? - .as_u64(); + .ok_or_else(|| CollectError::CollectError("block not found".to_string()))?; let block = source - .get_block(block_number) + .get_block(block_number, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("could not get block".to_string()))?; @@ -87,7 +88,9 @@ impl CollectByTransaction for AddressAppearances { .get_transaction_receipt(tx_hash) .await? .ok_or(CollectError::CollectError("could not get tx receipt".to_string()))? - .logs; + .inner + .logs() + .to_vec(); // traces let traces = source.trace_transaction(request.ethers_transaction_hash()?).await?; @@ -102,11 +105,11 @@ impl CollectByTransaction for AddressAppearances { } fn name(log: &Log) -> Option<&'static str> { - let event = log.topics[0]; - if event == *EVENT_ERC20_TRANSFER { - if log.data.len() > 0 { + let event = log.topic0().unwrap(); + if event == *ERC20::Transfer::SIGNATURE_HASH { + if log.data().data.len() > 0 { Some("erc20_transfer") - } else if log.topics.len() == 4 { + } else if log.topics().len() == 4 { Some("erc721_transfer") } else { None @@ -119,26 +122,26 @@ fn name(log: &Log) -> Option<&'static str> { impl AddressAppearances { fn process_first_transaction( &mut self, - block_author: H160, - trace: &Trace, + block_author: Address, + trace: &LocalizedTransactionTrace, schema: &Table, - tx_hash: H256, - logs_by_tx: &HashMap>, + tx_hash: TxHash, + logs_by_tx: &HashMap>, ) { - let block_number = trace.block_number as u32; - let block_hash = trace.block_hash.as_bytes().to_vec(); + let block_number = trace.block_number.unwrap() as u32; + let block_hash = trace.block_hash.unwrap().to_vec(); self.process_address(block_author, "miner_fee", block_number, &block_hash, tx_hash, schema); if let Some(logs) = logs_by_tx.get(&tx_hash) { for log in logs.iter() { - if log.topics.len() >= 3 { + if log.topics().len() >= 3 { if let Some(name) = name(log) { let mut from: [u8; 20] = [0; 20]; - from.copy_from_slice(&log.topics[1].to_fixed_bytes()[12..32]); + from.copy_from_slice(&log.topics()[1][12..32]); let name = &(name.to_string() + "_from"); self.process_address( - H160(from), + Address::from_slice(&from), name, block_number, &block_hash, @@ -147,10 +150,10 @@ impl AddressAppearances { ); let mut to: [u8; 20] = [0; 20]; - to.copy_from_slice(&log.topics[1].to_fixed_bytes()[12..32]); + to.copy_from_slice(&log.topics()[1][12..32]); let name = &(name.to_string() + "_to"); self.process_address( - H160(to), + Address::from_slice(&to), name, block_number, &block_hash, @@ -162,7 +165,7 @@ impl AddressAppearances { } } - match &trace.action { + match &trace.trace.action { Action::Call(action) => { self.process_address( action.from, @@ -194,7 +197,7 @@ impl AddressAppearances { _ => {} } - if let Some(Res::Create(result)) = &trace.result { + if let Some(TraceOutput::Create(result)) = &trace.trace.result { self.process_address( result.address, "tx_to", @@ -206,10 +209,10 @@ impl AddressAppearances { } } - fn process_trace(&mut self, trace: &Trace, schema: &Table, tx_hash: H256) { - let block_number = trace.block_number as u32; - let block_hash = trace.block_hash.as_bytes().to_vec(); - match &trace.action { + fn process_trace(&mut self, trace: &LocalizedTransactionTrace, schema: &Table, tx_hash: TxHash) { + let block_number = trace.block_number.unwrap() as u32; + let block_hash = trace.block_hash.unwrap().to_vec(); + match &trace.trace.action { Action::Call(action) => { self.process_address( action.from, @@ -238,7 +241,7 @@ impl AddressAppearances { schema, ); } - Action::Suicide(action) => { + Action::Selfdestruct(action) => { self.process_address( action.address, "suicide", @@ -268,7 +271,7 @@ impl AddressAppearances { } } - if let Some(Res::Create(result)) = &trace.result { + if let Some(TraceOutput::Create(result)) = &trace.trace.result { self.process_address( result.address, "create", @@ -282,19 +285,19 @@ impl AddressAppearances { fn process_address( &mut self, - address: H160, + address: Address, relationship: &str, block_number: u32, block_hash: &[u8], - transaction_hash: H256, + transaction_hash: TxHash, schema: &Table, ) { self.n_rows += 1; - store!(schema, self, address, address.as_bytes().to_vec()); + store!(schema, self, address, address.to_vec()); store!(schema, self, relationship, relationship.to_string()); store!(schema, self, block_number, block_number); store!(schema, self, block_hash, block_hash.to_vec()); - store!(schema, self, transaction_hash, transaction_hash.as_bytes().to_vec()); + store!(schema, self, transaction_hash, transaction_hash.to_vec()); } } @@ -304,19 +307,19 @@ fn process_appearances( schema: &Table, ) -> R<()> { let (block, logs, traces) = traces; - let mut logs_by_tx: HashMap> = HashMap::new(); + let mut logs_by_tx: HashMap> = HashMap::new(); for log in logs.into_iter() { if let Some(tx_hash) = log.transaction_hash { logs_by_tx.entry(tx_hash).or_default().push(log); } } - let (_block_number, block_author) = match (block.number, block.author) { - (Some(number), Some(author)) => (number.as_u64(), author), + let (_block_number, block_author) = match (block.header.number, block.header.miner) { + (Some(number), author) => (number, author), _ => return Ok(()), }; - let mut current_tx_hash = H256([0; 32]); + let mut current_tx_hash = TxHash::ZERO; for trace in traces.iter() { if let (Some(tx_hash), Some(_tx_pos)) = (trace.transaction_hash, trace.transaction_position) { diff --git a/crates/freeze/src/datasets/balance_diffs.rs b/crates/freeze/src/datasets/balance_diffs.rs index 231a7071..8526611a 100644 --- a/crates/freeze/src/datasets/balance_diffs.rs +++ b/crates/freeze/src/datasets/balance_diffs.rs @@ -1,5 +1,10 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, U256}, + rpc::types::trace::parity::{ + ChangedType, Delta, TraceResults, + }, +}; use polars::prelude::*; /// columns for transactions @@ -19,7 +24,7 @@ pub struct BalanceDiffs { #[async_trait::async_trait] impl Dataset for BalanceDiffs {} -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for BalanceDiffs { @@ -29,7 +34,9 @@ impl CollectByBlock for BalanceDiffs { let schema = query.schemas.get(&Datatype::BalanceDiffs).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); - source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (bn, txs, traces) = source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + let trace_resuls = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_resuls)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -58,7 +65,7 @@ pub(crate) fn process_balance_diffs( let schema = schemas.get(&Datatype::BalanceDiffs).ok_or(err("schema not provided"))?; let (block_number, txs, traces) = response; for (index, (trace, tx)) in traces.iter().zip(txs).enumerate() { - if let Some(ethers::types::StateDiff(state_diffs)) = &trace.state_diff { + if let Some(state_diffs) = &trace.state_diff { for (addr, diff) in state_diffs.iter() { process_balance_diff(addr, &diff.balance, block_number, tx, index, columns, schema); } @@ -68,8 +75,8 @@ pub(crate) fn process_balance_diffs( } pub(crate) fn process_balance_diff( - addr: &H160, - diff: &Diff, + addr: &Address, + diff: &Delta, block_number: &Option, transaction_hash: &Option>, transaction_index: usize, @@ -77,16 +84,16 @@ pub(crate) fn process_balance_diff( schema: &Table, ) { let (from, to) = match diff { - Diff::Same => return, - Diff::Born(value) => (U256::zero(), *value), - Diff::Died(value) => (*value, U256::zero()), - Diff::Changed(ChangedType { from, to }) => (*from, *to), + Delta::Unchanged => return, + Delta::Added(value) => (U256::ZERO, *value), + Delta::Removed(value) => (*value, U256::ZERO), + Delta::Changed(ChangedType { from, to }) => (*from, *to), }; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); + store!(schema, columns, address, addr.to_vec()); store!(schema, columns, from_value, from); store!(schema, columns, to_value, to); } diff --git a/crates/freeze/src/datasets/balance_reads.rs b/crates/freeze/src/datasets/balance_reads.rs index a8128628..bd1c38ac 100644 --- a/crates/freeze/src/datasets/balance_reads.rs +++ b/crates/freeze/src/datasets/balance_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::{Address, U256}, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::BTreeMap; @@ -19,7 +19,7 @@ pub struct BalanceReads { #[async_trait::async_trait] impl Dataset for BalanceReads {} -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); #[async_trait::async_trait] impl CollectByBlock for BalanceReads { @@ -70,7 +70,7 @@ pub(crate) fn process_balance_reads( } pub(crate) fn process_balance_read( - addr: &H160, + addr: &Address, account_state: &AccountState, block_number: &Option, transaction_hash: &Option>, @@ -83,7 +83,7 @@ pub(crate) fn process_balance_read( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); + store!(schema, columns, address, addr.to_vec()); store!(schema, columns, balance, *balance); } } diff --git a/crates/freeze/src/datasets/balances.rs b/crates/freeze/src/datasets/balances.rs index 4a2d36a6..2c79cc9c 100644 --- a/crates/freeze/src/datasets/balances.rs +++ b/crates/freeze/src/datasets/balances.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::{Address, U256}; use polars::prelude::*; /// columns for balances @@ -37,7 +37,7 @@ impl CollectByBlock for Balances { async fn extract(request: Params, source: Arc, _: Arc) -> R { let address = request.address()?; let block_number = request.block_number()? as u32; - let balance = source.get_balance(H160::from_slice(&address), block_number.into()).await?; + let balance = source.get_balance(Address::from_slice(&address), block_number.into()).await?; Ok((block_number, None, address, balance)) } diff --git a/crates/freeze/src/datasets/blocks.rs b/crates/freeze/src/datasets/blocks.rs index 5b12e58b..74322ddf 100644 --- a/crates/freeze/src/datasets/blocks.rs +++ b/crates/freeze/src/datasets/blocks.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::U256, rpc::types::{Block, BlockTransactionsKind}}; use polars::prelude::*; /// columns for transactions @@ -48,11 +48,11 @@ impl Dataset for Blocks { #[async_trait::async_trait] impl CollectByBlock for Blocks { - type Response = Block; + type Response = Block; async fn extract(request: Params, source: Arc, _: Arc) -> R { let block = source - .get_block(request.block_number()?) + .get_block(request.block_number()?, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; Ok(block) @@ -66,15 +66,15 @@ impl CollectByBlock for Blocks { #[async_trait::async_trait] impl CollectByTransaction for Blocks { - type Response = Block; + type Response = Block; async fn extract(request: Params, source: Arc, _: Arc) -> R { let transaction = source - .get_transaction(request.ethers_transaction_hash()?) + .get_transaction_by_hash(request.ethers_transaction_hash()?) .await? .ok_or(CollectError::CollectError("transaction not found".to_string()))?; let block = source - .get_block_by_hash(transaction.block_hash.ok_or(err("no block block_hash found"))?) + .get_block_by_hash(transaction.block_hash.ok_or(err("no block block_hash found"))?, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; Ok(block) @@ -90,25 +90,25 @@ impl CollectByTransaction for Blocks { pub(crate) fn process_block(block: Block, columns: &mut Blocks, schema: &Table) -> R<()> { columns.n_rows += 1; - store!(schema, columns, block_hash, block.hash.map(|x| x.0.to_vec())); - store!(schema, columns, parent_hash, block.parent_hash.0.to_vec()); - store!(schema, columns, uncles_hash, block.uncles_hash.0.to_vec()); - store!(schema, columns, author, block.author.map(|x| x.0.to_vec())); - store!(schema, columns, state_root, block.state_root.0.to_vec()); - store!(schema, columns, transactions_root, block.transactions_root.0.to_vec()); - store!(schema, columns, receipts_root, block.receipts_root.0.to_vec()); - store!(schema, columns, block_number, block.number.map(|x| x.as_u32())); - store!(schema, columns, gas_used, block.gas_used.as_u64()); - store!(schema, columns, gas_limit, block.gas_limit.as_u64()); - store!(schema, columns, extra_data, block.extra_data.to_vec()); - store!(schema, columns, logs_bloom, block.logs_bloom.map(|x| x.0.to_vec())); - store!(schema, columns, timestamp, block.timestamp.as_u32()); - store!(schema, columns, difficulty, block.difficulty.as_u64()); - store!(schema, columns, total_difficulty, block.total_difficulty); - store!(schema, columns, base_fee_per_gas, block.base_fee_per_gas.map(|x| x.as_u64())); - store!(schema, columns, size, block.size.map(|x| x.as_u32())); - store!(schema, columns, mix_hash, block.mix_hash.map(|x| x.0.to_vec())); - store!(schema, columns, nonce, block.nonce.map(|x| x.0.to_vec())); - store!(schema, columns, withdrawals_root, block.withdrawals_root.map(|x| x.0.to_vec())); + store!(schema, columns, block_hash, block.header.hash.map(|x| x.0.to_vec())); + store!(schema, columns, parent_hash, block.header.parent_hash.0.to_vec()); + store!(schema, columns, uncles_hash, block.header.uncles_hash.0.to_vec()); + store!(schema, columns, author, Some(block.header.miner.0.to_vec())); + store!(schema, columns, state_root, block.header.state_root.0.to_vec()); + store!(schema, columns, transactions_root, block.header.transactions_root.0.to_vec()); + store!(schema, columns, receipts_root, block.header.receipts_root.0.to_vec()); + store!(schema, columns, block_number, block.header.number.map(|x| x as u32)); + store!(schema, columns, gas_used, block.header.gas_used as u64); + store!(schema, columns, gas_limit, block.header.gas_limit as u64); + store!(schema, columns, extra_data, block.header.extra_data.to_vec()); + store!(schema, columns, logs_bloom, Some(block.header.logs_bloom.to_vec())); + store!(schema, columns, timestamp, block.header.timestamp as u32); + store!(schema, columns, difficulty, block.header.difficulty.wrapping_to::()); + store!(schema, columns, total_difficulty, block.header.total_difficulty); + store!(schema, columns, base_fee_per_gas, block.header.base_fee_per_gas.map(|x| x as u64)); + store!(schema, columns, size, block.size.map(|x| x.wrapping_to::())); + store!(schema, columns, mix_hash, block.header.mix_hash.map(|x| x.to_vec())); + store!(schema, columns, nonce, block.header.nonce.map(|x| x.0.to_vec())); + store!(schema, columns, withdrawals_root, block.header.withdrawals_root.map(|x| x.0.to_vec())); Ok(()) } diff --git a/crates/freeze/src/datasets/code_diffs.rs b/crates/freeze/src/datasets/code_diffs.rs index 2d2a2623..f8893b37 100644 --- a/crates/freeze/src/datasets/code_diffs.rs +++ b/crates/freeze/src/datasets/code_diffs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, Bytes}, + rpc::types::trace::parity::{ChangedType, Delta, TraceResults}, +}; use polars::prelude::*; /// columns for transactions @@ -19,7 +22,7 @@ pub struct CodeDiffs { #[async_trait::async_trait] impl Dataset for CodeDiffs {} -type BlockTxTraces = (Option, Vec>>, Vec); +type BlockTxTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for CodeDiffs { @@ -28,7 +31,10 @@ impl CollectByBlock for CodeDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get(&Datatype::CodeDiffs).ok_or(err("schema not provided"))?; let include_txs = schema.has_column("transaction_hash"); - source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (bn, txs, traces) = + source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + let trace_results = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -57,7 +63,7 @@ pub(crate) fn process_code_diffs( let schema = schemas.get(&Datatype::CodeDiffs).ok_or(err("schema not provided"))?; let (block_number, txs, traces) = response; for (index, (trace, tx)) in traces.iter().zip(txs).enumerate() { - if let Some(ethers::types::StateDiff(state_diffs)) = &trace.state_diff { + if let Some(state_diffs) = &trace.state_diff { for (addr, diff) in state_diffs.iter() { process_code_diff(addr, &diff.code, block_number, tx, index, columns, schema); } @@ -67,8 +73,8 @@ pub(crate) fn process_code_diffs( } pub(crate) fn process_code_diff( - addr: &H160, - diff: &Diff, + addr: &Address, + diff: &Delta, block_number: &Option, transaction_hash: &Option>, transaction_index: usize, @@ -77,21 +83,21 @@ pub(crate) fn process_code_diff( ) { // this code will skip self-destructs and EOAs let (from, to) = match diff { - Diff::Same => return, - Diff::Born(value) => { + Delta::Unchanged => return, + Delta::Added(value) => { if value.is_empty() { return }; (Vec::new(), value.to_vec()) } - Diff::Died(value) => (value.to_vec(), Vec::new()), - Diff::Changed(ChangedType { from, to }) => (from.to_vec(), to.to_vec()), + Delta::Removed(value) => (value.to_vec(), Vec::new()), + Delta::Changed(ChangedType { from, to }) => (from.to_vec(), to.to_vec()), }; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); + store!(schema, columns, address, addr.to_vec()); store!(schema, columns, from_value, from); store!(schema, columns, to_value, to); } diff --git a/crates/freeze/src/datasets/code_reads.rs b/crates/freeze/src/datasets/code_reads.rs index 0b0aca30..1127e5cb 100644 --- a/crates/freeze/src/datasets/code_reads.rs +++ b/crates/freeze/src/datasets/code_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::BTreeMap; @@ -19,7 +19,7 @@ pub struct CodeReads { #[async_trait::async_trait] impl Dataset for CodeReads {} -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); #[async_trait::async_trait] impl CollectByBlock for CodeReads { @@ -68,7 +68,7 @@ pub(crate) fn process_code_reads( } pub(crate) fn process_code_read( - addr: &H160, + addr: &Address, account_state: &AccountState, block_number: &Option, transaction_hash: &Option>, @@ -81,7 +81,7 @@ pub(crate) fn process_code_read( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, contract_address, addr.as_bytes().to_vec()); - store!(schema, columns, code, code.as_bytes().to_vec()); + store!(schema, columns, contract_address, addr.to_vec()); + store!(schema, columns, code, code.to_vec()); } } diff --git a/crates/freeze/src/datasets/codes.rs b/crates/freeze/src/datasets/codes.rs index 1b1b6bf1..16bc5dca 100644 --- a/crates/freeze/src/datasets/codes.rs +++ b/crates/freeze/src/datasets/codes.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::Address; use polars::prelude::*; /// columns for balances @@ -41,7 +41,7 @@ impl CollectByBlock for Codes { async fn extract(request: Params, source: Arc, _: Arc) -> R { let address = request.address()?; let block_number = request.block_number()? as u32; - let output = source.get_code(H160::from_slice(&address), block_number.into()).await?; + let output = source.get_code(Address::from_slice(&address), block_number.into()).await?; Ok((block_number, None, address, output.to_vec())) } diff --git a/crates/freeze/src/datasets/contracts.rs b/crates/freeze/src/datasets/contracts.rs index 9c682dca..7df089a2 100644 --- a/crates/freeze/src/datasets/contracts.rs +++ b/crates/freeze/src/datasets/contracts.rs @@ -1,7 +1,9 @@ use super::traces; use crate::*; -use ethers::prelude::*; -use ethers_core::utils::keccak256; +use alloy::{ + primitives::{keccak256, Address}, + rpc::types::trace::parity::{Action, LocalizedTransactionTrace, TraceOutput}, +}; use polars::prelude::*; /// columns for transactions @@ -34,7 +36,7 @@ impl Dataset for Contracts { #[async_trait::async_trait] impl CollectByBlock for Contracts { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { source.trace_block(request.ethers_block_number()?).await @@ -49,7 +51,7 @@ impl CollectByBlock for Contracts { #[async_trait::async_trait] impl CollectByTransaction for Contracts { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { source.trace_transaction(request.ethers_transaction_hash()?).await @@ -64,39 +66,40 @@ impl CollectByTransaction for Contracts { /// process block into columns pub(crate) fn process_contracts( - traces: &[Trace], + traces: &[LocalizedTransactionTrace], columns: &mut Contracts, schemas: &Schemas, ) -> R<()> { let schema = schemas.get(&Datatype::Contracts).ok_or(err("schema not provided"))?; - let mut deployer = H160([0; 20]); + let mut deployer = Address::ZERO; let mut create_index = 0; for trace in traces.iter() { - if trace.trace_address.is_empty() { - deployer = match &trace.action { + if trace.trace.trace_address.is_empty() { + deployer = match &trace.trace.action { Action::Call(call) => call.from, Action::Create(create) => create.from, - Action::Suicide(suicide) => suicide.refund_address, + Action::Selfdestruct(suicide) => suicide.refund_address, Action::Reward(reward) => reward.author, }; }; - if let (Action::Create(create), Some(Res::Create(result))) = (&trace.action, &trace.result) + if let (Action::Create(create), Some(TraceOutput::Create(result))) = + (&trace.trace.action, &trace.trace.result) { columns.n_rows += 1; - store!(schema, columns, block_number, trace.block_number as u32); - store!(schema, columns, block_hash, trace.block_hash.as_bytes().to_vec()); + store!(schema, columns, block_number, trace.block_number.unwrap() as u32); + store!(schema, columns, block_hash, trace.block_hash.unwrap().to_vec()); store!(schema, columns, create_index, create_index); create_index += 1; let tx = trace.transaction_hash; - store!(schema, columns, transaction_hash, tx.map(|x| x.as_bytes().to_vec())); - store!(schema, columns, contract_address, result.address.as_bytes().into()); - store!(schema, columns, deployer, deployer.as_bytes().into()); - store!(schema, columns, factory, create.from.as_bytes().into()); + store!(schema, columns, transaction_hash, tx.map(|x| x.to_vec())); + store!(schema, columns, contract_address, result.address.to_vec()); + store!(schema, columns, deployer, deployer.to_vec()); + store!(schema, columns, factory, create.from.to_vec()); store!(schema, columns, init_code, create.init.to_vec()); store!(schema, columns, code, result.code.to_vec()); - store!(schema, columns, init_code_hash, keccak256(result.code.clone()).into()); - store!(schema, columns, code_hash, keccak256(create.init.clone()).into()); + store!(schema, columns, init_code_hash, keccak256(result.code.clone()).to_vec()); + store!(schema, columns, code_hash, keccak256(create.init.clone()).to_vec()); store!(schema, columns, n_init_code_bytes, create.init.len() as u32); store!(schema, columns, n_code_bytes, result.code.len() as u32); } diff --git a/crates/freeze/src/datasets/erc20_approvals.rs b/crates/freeze/src/datasets/erc20_approvals.rs index f8219f06..acba313a 100644 --- a/crates/freeze/src/datasets/erc20_approvals.rs +++ b/crates/freeze/src/datasets/erc20_approvals.rs @@ -1,5 +1,9 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{B256, U256}, + rpc::types::{Filter, Log, Topic}, + sol_types::SolEvent, +}; use polars::prelude::*; /// columns for transactions @@ -54,21 +58,24 @@ impl CollectByBlock for Erc20Approvals { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let mut topics = [Some(ValueOrArray::Value(Some(*EVENT_ERC20_TRANSFER))), None, None, None]; + let mut topics: [Topic; 4] = Default::default(); + topics[0] = ERC20::Approval::SIGNATURE_HASH.into(); if let Some(from_address) = &request.from_address { - let mut v = vec![0u8; 12]; - v.append(&mut from_address.to_owned()); - topics[1] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); + let v = B256::from_slice(from_address); + topics[1] = v.into(); } if let Some(to_address) = &request.to_address { - let mut v = vec![0u8; 12]; - v.append(&mut to_address.to_owned()); - topics[2] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); + let v = B256::from_slice(to_address); + topics[2] = v.into(); } let filter = Filter { topics, ..request.ethers_log_filter()? }; + let logs = source.get_logs(&filter).await?; - Ok(logs.into_iter().filter(|x| x.topics.len() == 3 && x.data.len() == 32).collect()) + Ok(logs + .into_iter() + .filter(|x| x.topics().len() == 3 && x.data().data.len() == 32) + .collect()) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -88,7 +95,9 @@ impl CollectByTransaction for Erc20Approvals { } fn is_erc20_approval(log: &Log) -> bool { - log.topics.len() == 3 && log.data.len() == 32 && log.topics[0] == *EVENT_ERC20_APPROVAL + log.topics().len() == 3 && + log.data().data.len() == 32 && + log.topics()[0] == ERC20::Approval::SIGNATURE_HASH } fn process_erc20_approval(logs: Vec, columns: &mut Erc20Approvals, schema: &Table) -> R<()> { @@ -97,15 +106,20 @@ fn process_erc20_approval(logs: Vec, columns: &mut Erc20Approvals, schema: (log.block_number, log.transaction_hash, log.transaction_index, log.log_index) { columns.n_rows += 1; - store!(schema, columns, block_number, bn.as_u32()); - store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.as_bytes().to_vec())); - store!(schema, columns, transaction_index, ti.as_u32()); - store!(schema, columns, log_index, li.as_u32()); - store!(schema, columns, transaction_hash, tx.as_bytes().to_vec()); - store!(schema, columns, erc20, log.address.as_bytes().to_vec()); - store!(schema, columns, from_address, log.topics[1].as_bytes()[12..].to_vec()); - store!(schema, columns, to_address, log.topics[2].as_bytes()[12..].to_vec()); - store!(schema, columns, value, log.data.to_vec().as_slice().into()); + store!(schema, columns, block_number, bn as u32); + store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.to_vec())); + store!(schema, columns, transaction_index, ti as u32); + store!(schema, columns, log_index, li as u32); + store!(schema, columns, transaction_hash, tx.to_vec()); + store!(schema, columns, erc20, log.address().to_vec()); + store!(schema, columns, from_address, log.topics()[1][12..].to_vec()); + store!(schema, columns, to_address, log.topics()[2][12..].to_vec()); + store!( + schema, + columns, + value, + U256::from_be_slice(log.data().data.to_vec().as_slice()) + ); } } Ok(()) diff --git a/crates/freeze/src/datasets/erc20_balances.rs b/crates/freeze/src/datasets/erc20_balances.rs index a4cf5930..70fd4f86 100644 --- a/crates/freeze/src/datasets/erc20_balances.rs +++ b/crates/freeze/src/datasets/erc20_balances.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::U256, sol_types::SolCall}; use polars::prelude::*; /// columns for transactions @@ -30,14 +30,14 @@ impl CollectByBlock for Erc20Balances { type Response = (u32, Vec, Vec, Option); async fn extract(request: Params, source: Arc, _: Arc) -> R { - let signature = FUNCTION_ERC20_BALANCE_OF.clone(); - let mut call_data = signature.clone(); + let signature = ERC20::balanceOfCall::SELECTOR; + let mut call_data = signature.clone().to_vec(); call_data.extend(vec![0; 12]); call_data.extend(request.address()?); let block_number = request.ethers_block_number()?; let contract = request.ethers_contract()?; let balance = source.call2(contract, call_data, block_number).await.ok(); - let balance = balance.map(|x| x.to_vec().as_slice().into()); + let balance = balance.map(|x| U256::from_be_slice(x.as_ref())); Ok((request.block_number()? as u32, request.contract()?, request.address()?, balance)) } diff --git a/crates/freeze/src/datasets/erc20_metadata.rs b/crates/freeze/src/datasets/erc20_metadata.rs index cc6f154d..ec254c92 100644 --- a/crates/freeze/src/datasets/erc20_metadata.rs +++ b/crates/freeze/src/datasets/erc20_metadata.rs @@ -1,4 +1,5 @@ use crate::*; +use alloy::sol_types::SolCall; use polars::prelude::*; /// columns for transactions @@ -47,7 +48,7 @@ impl CollectByBlock for Erc20Metadata { let address = request.ethers_address()?; // name - let call_data = FUNCTION_ERC20_NAME.clone(); + let call_data = ERC20::nameCall::SELECTOR.to_vec(); let name = match source.call2(address, call_data, block_number).await { Ok(output) => { String::from_utf8(output.to_vec()).ok().map(|s| remove_control_characters(&s)) @@ -56,7 +57,7 @@ impl CollectByBlock for Erc20Metadata { }; // symbol - let call_data = FUNCTION_ERC20_SYMBOL.clone(); + let call_data = ERC20::symbolCall::SELECTOR.to_vec(); let symbol = match source.call2(address, call_data, block_number).await { Ok(output) => { String::from_utf8(output.to_vec()).ok().map(|s| remove_control_characters(&s)) @@ -65,7 +66,7 @@ impl CollectByBlock for Erc20Metadata { }; // decimals - let call_data = FUNCTION_ERC20_DECIMALS.clone(); + let call_data = ERC20::decimalsCall::SELECTOR.to_vec(); let decimals = match source.call2(address, call_data, block_number).await { Ok(output) => bytes_to_u32(output).ok(), Err(_) => None, diff --git a/crates/freeze/src/datasets/erc20_supplies.rs b/crates/freeze/src/datasets/erc20_supplies.rs index 4d46366d..d02f1cab 100644 --- a/crates/freeze/src/datasets/erc20_supplies.rs +++ b/crates/freeze/src/datasets/erc20_supplies.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::U256, sol_types::SolCall}; use polars::prelude::*; /// columns for transactions @@ -37,13 +37,13 @@ impl CollectByBlock for Erc20Supplies { type Response = (u32, Vec, Option); async fn extract(request: Params, source: Arc, _: Arc) -> R { - let signature: Vec = FUNCTION_ERC20_TOTAL_SUPPLY.clone(); + let signature: Vec = ERC20::totalSupplyCall::SELECTOR.to_vec(); let mut call_data = signature.clone(); call_data.extend(request.address()?); let block_number = request.ethers_block_number()?; let contract = request.ethers_address()?; let output = source.call2(contract, call_data, block_number).await.ok(); - let output = output.map(|x| x.to_vec().as_slice().into()); + let output = output.map(|x| U256::from_be_slice(x.as_ref())); Ok((request.block_number()? as u32, request.address()?, output)) } diff --git a/crates/freeze/src/datasets/erc20_transfers.rs b/crates/freeze/src/datasets/erc20_transfers.rs index be23086c..a2304981 100644 --- a/crates/freeze/src/datasets/erc20_transfers.rs +++ b/crates/freeze/src/datasets/erc20_transfers.rs @@ -1,5 +1,7 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{B256, U256}, rpc::types::{Filter, Log, Topic}, sol_types::SolEvent +}; use polars::prelude::*; /// columns for transactions @@ -54,21 +56,20 @@ impl CollectByBlock for Erc20Transfers { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let mut topics = [Some(ValueOrArray::Value(Some(*EVENT_ERC20_TRANSFER))), None, None, None]; + let mut topics: [Topic; 4] = Default::default(); + topics[0] = ERC20::Transfer::SIGNATURE_HASH.into(); if let Some(from_address) = &request.from_address { - let mut v = vec![0u8; 12]; - v.append(&mut from_address.to_owned()); - topics[1] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); + let v = B256::from_slice(from_address); + topics[1] = v.into(); } if let Some(to_address) = &request.to_address { - let mut v = vec![0u8; 12]; - v.append(&mut to_address.to_owned()); - topics[2] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); + let v = B256::from_slice(to_address); + topics[2] = v.into(); } let filter = Filter { topics, ..request.ethers_log_filter()? }; let logs = source.get_logs(&filter).await?; - Ok(logs.into_iter().filter(|x| x.topics.len() == 3 && x.data.len() == 32).collect()) + Ok(logs.into_iter().filter(|x| x.topics().len() == 3 && x.data().data.len() == 32).collect()) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -93,7 +94,7 @@ impl CollectByTransaction for Erc20Transfers { } fn is_erc20_transfer(log: &Log) -> bool { - log.topics.len() == 3 && log.data.len() == 32 && log.topics[0] == *EVENT_ERC20_TRANSFER + log.topics().len() == 3 && log.data().data.len() == 32 && log.topics()[0] == ERC20::Approval::SIGNATURE_HASH } /// process block into columns @@ -103,15 +104,15 @@ fn process_erc20_transfers(logs: Vec, columns: &mut Erc20Transfers, schema: (log.block_number, log.transaction_hash, log.transaction_index, log.log_index) { columns.n_rows += 1; - store!(schema, columns, block_number, bn.as_u32()); - store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.as_bytes().to_vec())); - store!(schema, columns, transaction_index, ti.as_u32()); - store!(schema, columns, log_index, li.as_u32()); - store!(schema, columns, transaction_hash, tx.as_bytes().to_vec()); - store!(schema, columns, erc20, log.address.as_bytes().to_vec()); - store!(schema, columns, from_address, log.topics[1].as_bytes()[12..].to_vec()); - store!(schema, columns, to_address, log.topics[2].as_bytes()[12..].to_vec()); - store!(schema, columns, value, log.data.to_vec().as_slice().into()); + store!(schema, columns, block_number, bn as u32); + store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.to_vec())); + store!(schema, columns, transaction_index, ti as u32); + store!(schema, columns, log_index, li as u32); + store!(schema, columns, transaction_hash, tx.to_vec()); + store!(schema, columns, erc20, log.address().to_vec()); + store!(schema, columns, from_address, log.topics()[1][12..].to_vec()); + store!(schema, columns, to_address, log.topics()[2][12..].to_vec()); + store!(schema, columns, value, U256::from_be_slice(log.data().data.to_vec().as_slice())); } } Ok(()) diff --git a/crates/freeze/src/datasets/erc721_metadata.rs b/crates/freeze/src/datasets/erc721_metadata.rs index 16dbf552..734f2d70 100644 --- a/crates/freeze/src/datasets/erc721_metadata.rs +++ b/crates/freeze/src/datasets/erc721_metadata.rs @@ -1,5 +1,6 @@ use super::erc20_metadata::remove_control_characters; use crate::*; +use alloy::sol_types::SolCall; use polars::prelude::*; /// columns for transactions @@ -37,7 +38,7 @@ impl CollectByBlock for Erc721Metadata { let address = request.ethers_address()?; // name - let call_data = FUNCTION_ERC20_NAME.clone(); + let call_data = ERC721::nameCall::SELECTOR.to_vec(); let name = match source.call2(address, call_data, block_number).await { Ok(output) => { String::from_utf8(output.to_vec()).ok().map(|s| remove_control_characters(&s)) @@ -46,7 +47,7 @@ impl CollectByBlock for Erc721Metadata { }; // symbol - let call_data = FUNCTION_ERC20_SYMBOL.clone(); + let call_data = ERC721::symbolCall::SELECTOR.to_vec(); let symbol = match source.call2(address, call_data, block_number).await { Ok(output) => { String::from_utf8(output.to_vec()).ok().map(|s| remove_control_characters(&s)) diff --git a/crates/freeze/src/datasets/erc721_transfers.rs b/crates/freeze/src/datasets/erc721_transfers.rs index e6c3fc22..065dc176 100644 --- a/crates/freeze/src/datasets/erc721_transfers.rs +++ b/crates/freeze/src/datasets/erc721_transfers.rs @@ -1,5 +1,9 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{B256, U256}, + rpc::types::{Filter, Log, Topic}, + sol_types::SolEvent, +}; use polars::prelude::*; /// columns for transactions @@ -54,22 +58,20 @@ impl CollectByBlock for Erc721Transfers { type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let mut topics = - [Some(ValueOrArray::Value(Some(*EVENT_ERC721_TRANSFER))), None, None, None]; + let mut topics: [Topic; 4] = Default::default(); + topics[0] = ERC721::Transfer::SIGNATURE_HASH.into(); if let Some(from_address) = &request.from_address { - let mut v = vec![0u8; 12]; - v.append(&mut from_address.to_owned()); - topics[1] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); - } + let v = B256::from_slice(from_address); + topics[1] = v.into(); + }; if let Some(to_address) = &request.to_address { - let mut v = vec![0u8; 12]; - v.append(&mut to_address.to_owned()); - topics[2] = Some(ValueOrArray::Value(Some(H256::from_slice(&v[..])))); - } + let v = B256::from_slice(to_address); + topics[2] = v.into(); + }; let filter = Filter { topics, ..request.ethers_log_filter()? }; let logs = source.get_logs(&filter).await?; - Ok(logs.into_iter().filter(|x| x.topics.len() == 4 && x.data.len() == 0).collect()) + Ok(logs.into_iter().filter(|x| x.topics().len() == 4 && x.data().data.len() == 0).collect()) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -94,7 +96,9 @@ impl CollectByTransaction for Erc721Transfers { } fn is_erc721_transfer(log: &Log) -> bool { - log.topics.len() == 4 && log.data.len() == 0 && log.topics[0] == *EVENT_ERC721_TRANSFER + log.topics().len() == 4 && + log.data().data.len() == 0 && + log.topics()[0] == ERC721::Transfer::SIGNATURE_HASH } /// process block into columns @@ -108,15 +112,15 @@ fn process_erc721_transfers( (log.block_number, log.transaction_hash, log.transaction_index, log.log_index) { columns.n_rows += 1; - store!(schema, columns, block_number, bn.as_u32()); - store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.as_bytes().to_vec())); - store!(schema, columns, transaction_index, ti.as_u32()); - store!(schema, columns, log_index, li.as_u32()); - store!(schema, columns, transaction_hash, tx.as_bytes().to_vec()); - store!(schema, columns, erc20, log.address.as_bytes().to_vec()); - store!(schema, columns, from_address, log.topics[1].as_bytes()[12..].to_vec()); - store!(schema, columns, to_address, log.topics[2].as_bytes()[12..].to_vec()); - store!(schema, columns, token_id, log.topics[3].as_bytes().into()); + store!(schema, columns, block_number, bn as u32); + store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.to_vec())); + store!(schema, columns, transaction_index, ti as u32); + store!(schema, columns, log_index, li as u32); + store!(schema, columns, transaction_hash, tx.to_vec()); + store!(schema, columns, erc20, log.address().to_vec()); + store!(schema, columns, from_address, log.topics()[1][12..].to_vec()); + store!(schema, columns, to_address, log.topics()[2][12..].to_vec()); + store!(schema, columns, token_id, log.topics()[3].into()); } } Ok(()) diff --git a/crates/freeze/src/datasets/eth_calls.rs b/crates/freeze/src/datasets/eth_calls.rs index 4a58be3a..b75b6963 100644 --- a/crates/freeze/src/datasets/eth_calls.rs +++ b/crates/freeze/src/datasets/eth_calls.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::{keccak256, TxKind}, rpc::types::{TransactionInput, TransactionRequest}}; use polars::prelude::*; /// columns for transactions @@ -47,12 +47,12 @@ impl CollectByBlock for EthCalls { async fn extract(request: Params, source: Arc, _: Arc) -> R { let transaction = TransactionRequest { - to: Some(request.ethers_contract()?.into()), - data: Some(request.call_data()?.into()), + to: Some(TxKind::Call(request.ethers_contract()?)), + input: TransactionInput::new(request.call_data()?.into()), ..Default::default() }; let number = request.block_number()?; - let output = source.call(transaction, number.into()).await.ok().map(|x| x.to_vec()); + let output = source.call(transaction, number).await.ok().map(|x| x.to_vec()); Ok((number as u32, request.contract()?, request.call_data()?, output)) } @@ -73,12 +73,12 @@ fn process_eth_call(response: EthCallsResponse, columns: &mut EthCalls, schema: store!(schema, columns, block_number, block_number); store!(schema, columns, contract_address, contract_address); store!(schema, columns, call_data, call_data.clone()); - store!(schema, columns, call_data_hash, ethers_core::utils::keccak256(call_data).into()); + store!(schema, columns, call_data_hash, keccak256(call_data).to_vec()); store!(schema, columns, output_data, output_data.clone()); store!( schema, columns, output_data_hash, - output_data.map(|data| ethers_core::utils::keccak256(data).into()) + output_data.map(|data| keccak256(data).to_vec()) ); } diff --git a/crates/freeze/src/datasets/geth_balance_diffs.rs b/crates/freeze/src/datasets/geth_balance_diffs.rs index ef872405..a7197150 100644 --- a/crates/freeze/src/datasets/geth_balance_diffs.rs +++ b/crates/freeze/src/datasets/geth_balance_diffs.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::U256; use polars::prelude::*; /// columns for transactions diff --git a/crates/freeze/src/datasets/geth_calls.rs b/crates/freeze/src/datasets/geth_calls.rs index a0dc80c0..07d3b519 100644 --- a/crates/freeze/src/datasets/geth_calls.rs +++ b/crates/freeze/src/datasets/geth_calls.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::U256, rpc::types::trace::geth::CallFrame}; use polars::prelude::*; /// columns for geth traces @@ -83,8 +83,8 @@ fn process_trace( ) -> R<()> { columns.n_rows += 1; store!(schema, columns, typ, trace.typ); - store!(schema, columns, from_address, trace.from.as_bytes().to_vec()); - store!(schema, columns, to_address, noa_to_vec_u8(trace.to)?); + store!(schema, columns, from_address, trace.from.to_vec()); + store!(schema, columns, to_address, trace.to.map(|x| x.to_vec())); store!(schema, columns, value, trace.value); store!(schema, columns, gas, trace.gas); store!(schema, columns, gas_used, trace.gas_used); @@ -101,21 +101,11 @@ fn process_trace( trace_address.iter().map(|&n| n.to_string()).collect::>().join(" ") ); - if let Some(subcalls) = trace.calls { - for (s, subcall) in subcalls.into_iter().enumerate() { - let mut sub_trace_address = trace_address.clone(); - sub_trace_address.push(s as u32); - process_trace(subcall, columns, schema, block_number, tx, tx_index, sub_trace_address)? - } + for (s, subcall) in trace.calls.into_iter().enumerate() { + let mut sub_trace_address = trace_address.clone(); + sub_trace_address.push(s as u32); + process_trace(subcall, columns, schema, block_number, tx, tx_index, sub_trace_address)? } Ok(()) -} - -fn noa_to_vec_u8(value: Option) -> R>> { - match value { - Some(NameOrAddress::Address(address)) => Ok(Some(address.as_bytes().to_vec())), - Some(NameOrAddress::Name(_)) => Err(err("block name string not allowed")), - None => Ok(None), - } -} +} \ No newline at end of file diff --git a/crates/freeze/src/datasets/geth_nonce_diffs.rs b/crates/freeze/src/datasets/geth_nonce_diffs.rs index 027e32b5..47a86b02 100644 --- a/crates/freeze/src/datasets/geth_nonce_diffs.rs +++ b/crates/freeze/src/datasets/geth_nonce_diffs.rs @@ -1,5 +1,4 @@ use crate::*; -use ethers::prelude::*; use polars::prelude::*; /// columns for transactions @@ -11,8 +10,8 @@ pub struct GethNonceDiffs { pub(crate) transaction_index: Vec>, pub(crate) transaction_hash: Vec>>, pub(crate) address: Vec>, - pub(crate) from_value: Vec, - pub(crate) to_value: Vec, + pub(crate) from_value: Vec, + pub(crate) to_value: Vec, pub(crate) chain_id: Vec, } diff --git a/crates/freeze/src/datasets/geth_opcodes.rs b/crates/freeze/src/datasets/geth_opcodes.rs index 1f71831a..0171062f 100644 --- a/crates/freeze/src/datasets/geth_opcodes.rs +++ b/crates/freeze/src/datasets/geth_opcodes.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::rpc::types::trace::geth::{DefaultFrame, GethDebugTracingOptions, GethDefaultTracingOptions}; use polars::prelude::*; /// columns for geth traces @@ -40,13 +40,24 @@ impl CollectByBlock for GethOpcodes { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get_schema(&Datatype::GethOpcodes)?; - let options = GethDebugTracingOptions { + // let options = GethDebugTracingOptions { + // disable_storage: Some(!schema.has_column("storage")), + // disable_stack: Some(!schema.has_column("stack")), + // enable_memory: Some(schema.has_column("memory")), + // enable_return_data: Some(schema.has_column("return_data")), + // ..Default::default() + // }; + let config = GethDefaultTracingOptions { disable_storage: Some(!schema.has_column("storage")), disable_stack: Some(!schema.has_column("stack")), enable_memory: Some(schema.has_column("memory")), enable_return_data: Some(schema.has_column("return_data")), ..Default::default() }; + let options = GethDebugTracingOptions { + config, + ..Default::default() + }; let include_transaction = schema.has_column("block_number"); let block_number = request.block_number()? as u32; source.geth_debug_trace_block_opcodes(block_number, include_transaction, options).await @@ -63,14 +74,18 @@ impl CollectByTransaction for GethOpcodes { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get_schema(&Datatype::GethOpcodes)?; - let options = GethDebugTracingOptions { + let include_block_number = schema.has_column("block_number"); + let config = GethDefaultTracingOptions { disable_storage: Some(!schema.has_column("storage")), disable_stack: Some(!schema.has_column("stack")), enable_memory: Some(schema.has_column("memory")), enable_return_data: Some(schema.has_column("return_data")), ..Default::default() }; - let include_block_number = schema.has_column("block_number"); + let options = GethDebugTracingOptions { + config, + ..Default::default() + }; source .geth_debug_trace_transaction_opcodes( request.transaction_hash()?, diff --git a/crates/freeze/src/datasets/logs.rs b/crates/freeze/src/datasets/logs.rs index ca34c540..4599b685 100644 --- a/crates/freeze/src/datasets/logs.rs +++ b/crates/freeze/src/datasets/logs.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{dyn_abi::{DynSolValue, DynSolType, EventExt}, rpc::types::Log}; use polars::prelude::*; /// columns for transactions @@ -19,7 +19,7 @@ pub struct Logs { topic3: Vec>>, data: Vec>, n_data_bytes: Vec, - event_cols: indexmap::IndexMap>, + event_cols: indexmap::IndexMap>, chain_id: Vec, } @@ -91,17 +91,41 @@ impl CollectByTransaction for Logs { /// process block into columns fn process_logs(logs: Vec, columns: &mut Logs, schema: &Table) -> R<()> { - let decode_keys = match &schema.log_decoder { - None => None, + // let decode_keys = match &schema.log_decoder { + // None => None, + // Some(decoder) => { + // let keys = decoder + // .event + // .inputs + // .clone() + // .into_iter() + // .map(|i| i.name) + // .collect::>(); + // Some(keys) + // } + // }; + let (indexed_keys, body_keys) = match &schema.log_decoder { + None => (None, None), Some(decoder) => { - let keys = decoder + let indexed: Vec = decoder .event .inputs .clone() .into_iter() - .map(|i| i.name) - .collect::>(); - Some(keys) + .filter_map(|x| if x.indexed {Some(x.name)} else {None}) + .collect(); + let body: Vec = decoder + .event + .inputs + .clone() + .into_iter() + .filter_map(|x| if x.indexed { + None + } else { + Some(x.name) + }) + .collect(); + (Some(indexed), Some(body)) } }; @@ -110,13 +134,19 @@ fn process_logs(logs: Vec, columns: &mut Logs, schema: &Table) -> R<()> { (log.block_number, log.transaction_hash, log.transaction_index, log.log_index) { // decode event - if let (Some(decoder), Some(decode_keys)) = (&schema.log_decoder, &decode_keys) { - match decoder.event.parse_log(log.clone().into()) { + if let (Some(decoder), Some(indexed_keys), Some(body_keys)) = (&schema.log_decoder, &indexed_keys, &body_keys) { + match decoder.event.decode_log(&log.inner.data, true) { Ok(log) => { - for param in log.params { - if decode_keys.contains(param.name.as_str()) { - columns.event_cols.entry(param.name).or_default().push(param.value); - } + // for param in log.indexed { + // if decode_keys.contains(param.name.as_str()) { + // columns.event_cols.entry(param.name).or_default().push(param.value); + // } + // } + for (idx, indexed_param) in log.indexed.into_iter().enumerate() { + columns.event_cols.entry(indexed_keys[idx].clone()).or_default().push(indexed_param); + } + for (idx, body_param) in log.body.into_iter().enumerate() { + columns.event_cols.entry(body_keys[idx].clone()).or_default().push(body_param); } } Err(_) => continue, @@ -124,19 +154,19 @@ fn process_logs(logs: Vec, columns: &mut Logs, schema: &Table) -> R<()> { }; columns.n_rows += 1; - store!(schema, columns, block_number, bn.as_u32()); - store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.as_bytes().to_vec())); - store!(schema, columns, transaction_index, ti.as_u32()); - store!(schema, columns, log_index, li.as_u32()); - store!(schema, columns, transaction_hash, tx.as_bytes().to_vec()); - store!(schema, columns, address, log.address.as_bytes().to_vec()); - store!(schema, columns, data, log.data.to_vec()); - store!(schema, columns, n_data_bytes, log.data.len() as u32); + store!(schema, columns, block_number, bn as u32); + store!(schema, columns, block_hash, log.block_hash.map(|bh| bh.to_vec())); + store!(schema, columns, transaction_index, ti as u32); + store!(schema, columns, log_index, li as u32); + store!(schema, columns, transaction_hash, tx.to_vec()); + store!(schema, columns, address, log.address().to_vec()); + store!(schema, columns, data, log.data().data.to_vec()); + store!(schema, columns, n_data_bytes, log.data().data.len() as u32); // topics for i in 0..4 { - let topic = if i < log.topics.len() { - Some(log.topics[i].as_bytes().to_vec()) + let topic = if i < log.topics().len() { + Some(log.topics()[i].to_vec()) } else { None }; diff --git a/crates/freeze/src/datasets/native_transfers.rs b/crates/freeze/src/datasets/native_transfers.rs index c8fde7e3..9bb164a8 100644 --- a/crates/freeze/src/datasets/native_transfers.rs +++ b/crates/freeze/src/datasets/native_transfers.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::U256, rpc::types::trace::parity::{Action, LocalizedTransactionTrace, TraceOutput}}; use polars::prelude::*; /// columns for transactions @@ -27,10 +27,10 @@ impl Dataset for NativeTransfers { #[async_trait::async_trait] impl CollectByBlock for NativeTransfers { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let traces = source.trace_block(request.block_number()?.into()).await?; + let traces = source.trace_block(request.block_number()?).await?; Ok(filter_traces_by_from_to_addresses(traces, &request.from_address, &request.to_address)) } @@ -43,7 +43,7 @@ impl CollectByBlock for NativeTransfers { #[async_trait::async_trait] impl CollectByTransaction for NativeTransfers { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { let traces = source.trace_transaction(request.ethers_transaction_hash()?).await?; @@ -59,48 +59,48 @@ impl CollectByTransaction for NativeTransfers { /// process block into columns pub(crate) fn process_native_transfers( - traces: &[Trace], + traces: &[LocalizedTransactionTrace], columns: &mut NativeTransfers, schemas: &Schemas, ) -> R<()> { let schema = schemas.get(&Datatype::NativeTransfers).ok_or(err("schema not provided"))?; for (transfer_index, trace) in traces.iter().enumerate() { columns.n_rows += 1; - store!(schema, columns, block_number, trace.block_number as u32); + store!(schema, columns, block_number, trace.block_number.unwrap_or(0) as u32); store!(schema, columns, transaction_index, trace.transaction_position.map(|x| x as u32)); - store!(schema, columns, block_hash, trace.block_hash.as_bytes().to_vec()); + store!(schema, columns, block_hash, trace.block_hash.unwrap().to_vec()); store!(schema, columns, transfer_index, transfer_index as u32); store!( schema, columns, transaction_hash, - trace.transaction_hash.map(|x| x.as_bytes().to_vec()) + trace.transaction_hash.map(|x| x.to_vec()) ); - match &trace.action { + match &trace.trace.action { Action::Call(action) => { - store!(schema, columns, from_address, action.from.as_bytes().to_vec()); - store!(schema, columns, to_address, action.to.as_bytes().to_vec()); + store!(schema, columns, from_address, action.from.to_vec()); + store!(schema, columns, to_address, action.to.to_vec()); store!(schema, columns, value, action.value); } Action::Create(action) => { - store!(schema, columns, from_address, action.from.as_bytes().to_vec()); - match &trace.result.as_ref() { - Some(Res::Create(res)) => { - store!(schema, columns, to_address, res.address.0.into()) + store!(schema, columns, from_address, action.from.to_vec()); + match &trace.trace.result.as_ref() { + Some(TraceOutput::Create(res)) => { + store!(schema, columns, to_address, res.address.0.to_vec()) } _ => store!(schema, columns, to_address, vec![0; 32]), } store!(schema, columns, value, action.value); } - Action::Suicide(action) => { - store!(schema, columns, from_address, action.address.as_bytes().to_vec()); - store!(schema, columns, to_address, action.refund_address.as_bytes().to_vec()); + Action::Selfdestruct(action) => { + store!(schema, columns, from_address, action.address.to_vec()); + store!(schema, columns, to_address, action.refund_address.to_vec()); store!(schema, columns, value, action.balance); } Action::Reward(action) => { store!(schema, columns, from_address, vec![0; 20]); - store!(schema, columns, to_address, action.author.as_bytes().to_vec()); + store!(schema, columns, to_address, action.author.to_vec()); store!(schema, columns, value, action.value); } } diff --git a/crates/freeze/src/datasets/nonce_diffs.rs b/crates/freeze/src/datasets/nonce_diffs.rs index ac863f21..c17e7f7b 100644 --- a/crates/freeze/src/datasets/nonce_diffs.rs +++ b/crates/freeze/src/datasets/nonce_diffs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, U64}, + rpc::types::trace::parity::{ChangedType, Delta, TraceResults}, +}; use polars::prelude::*; /// columns for transactions @@ -19,7 +22,7 @@ pub struct NonceDiffs { #[async_trait::async_trait] impl Dataset for NonceDiffs {} -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for NonceDiffs { @@ -28,7 +31,9 @@ impl CollectByBlock for NonceDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get_schema(&Datatype::NonceDiffs)?; let include_txs = schema.has_column("transaction_hash"); - source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (block_number, txs, traces) = + source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + Ok((block_number, txs, traces.into_iter().map(|t| t.full_trace).collect())) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -57,7 +62,7 @@ pub(crate) fn process_nonce_diffs( let schema = schemas.get(&Datatype::NonceDiffs).ok_or(err("schema not provided"))?; let (block_number, txs, traces) = response; for (index, (trace, tx)) in traces.iter().zip(txs).enumerate() { - if let Some(ethers::types::StateDiff(state_diffs)) = &trace.state_diff { + if let Some(state_diffs) = &trace.state_diff { for (addr, diff) in state_diffs.iter() { process_nonce_diff(addr, &diff.nonce, block_number, tx, index, columns, schema); } @@ -67,8 +72,8 @@ pub(crate) fn process_nonce_diffs( } pub(crate) fn process_nonce_diff( - addr: &H160, - diff: &Diff, + addr: &Address, + diff: &Delta, block_number: &Option, transaction_hash: &Option>, transaction_index: usize, @@ -76,16 +81,16 @@ pub(crate) fn process_nonce_diff( schema: &Table, ) { let (from, to) = match diff { - Diff::Same => return, - Diff::Born(value) => (U256::zero(), *value), - Diff::Died(value) => (*value, U256::zero()), - Diff::Changed(ChangedType { from, to }) => (*from, *to), + Delta::Unchanged => return, + Delta::Added(value) => (U64::ZERO, *value), + Delta::Removed(value) => (*value, U64::ZERO), + Delta::Changed(ChangedType { from, to }) => (*from, *to), }; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); - store!(schema, columns, from_value, from.as_u64()); - store!(schema, columns, to_value, to.as_u64()); + store!(schema, columns, address, addr.to_vec()); + store!(schema, columns, from_value, from.wrapping_to::()); + store!(schema, columns, to_value, to.wrapping_to::()); } diff --git a/crates/freeze/src/datasets/nonce_reads.rs b/crates/freeze/src/datasets/nonce_reads.rs index fdc8d895..052c2eba 100644 --- a/crates/freeze/src/datasets/nonce_reads.rs +++ b/crates/freeze/src/datasets/nonce_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::BTreeMap; @@ -19,7 +19,7 @@ pub struct NonceReads { #[async_trait::async_trait] impl Dataset for NonceReads {} -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); #[async_trait::async_trait] impl CollectByBlock for NonceReads { @@ -68,7 +68,7 @@ pub(crate) fn process_nonce_reads( } pub(crate) fn process_nonce_read( - addr: &H160, + addr: &Address, account_state: &AccountState, block_number: &Option, transaction_hash: &Option>, @@ -81,7 +81,7 @@ pub(crate) fn process_nonce_read( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, addr.as_bytes().to_vec()); - store!(schema, columns, nonce, nonce.as_u64()); + store!(schema, columns, address, addr.to_vec()); + store!(schema, columns, nonce, *nonce); } } diff --git a/crates/freeze/src/datasets/nonces.rs b/crates/freeze/src/datasets/nonces.rs index 2948d1b0..9a40c595 100644 --- a/crates/freeze/src/datasets/nonces.rs +++ b/crates/freeze/src/datasets/nonces.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::Address; use polars::prelude::*; /// columns for balances @@ -38,8 +38,8 @@ impl CollectByBlock for Nonces { let address = request.address()?; let block_number = request.block_number()? as u32; let output = - source.get_transaction_count(H160::from_slice(&address), block_number.into()).await?; - Ok((block_number, None, address, output.as_u64())) + source.get_transaction_count(Address::from_slice(&address), block_number.into()).await?; + Ok((block_number, None, address, output)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { diff --git a/crates/freeze/src/datasets/slots.rs b/crates/freeze/src/datasets/slots.rs index 1641e442..14f292aa 100644 --- a/crates/freeze/src/datasets/slots.rs +++ b/crates/freeze/src/datasets/slots.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::{Address, U256}; use polars::prelude::*; /// columns for balances @@ -49,12 +49,12 @@ impl CollectByBlock for Slots { let slot = request.slot()?; let output = source .get_storage_at( - H160::from_slice(&address), - H256::from_slice(&slot), + Address::from_slice(&address), + U256::from_be_slice(&slot), block_number.into(), ) .await?; - Ok((block_number, None, address, slot, output.as_bytes().to_vec())) + Ok((block_number, None, address, slot, output.to_vec_u8())) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { diff --git a/crates/freeze/src/datasets/storage_diffs.rs b/crates/freeze/src/datasets/storage_diffs.rs index 3f1cb180..0c5b2fe0 100644 --- a/crates/freeze/src/datasets/storage_diffs.rs +++ b/crates/freeze/src/datasets/storage_diffs.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::{Address, B256}, rpc::types::trace::parity::{ChangedType, Delta, TraceResults}}; use polars::prelude::*; /// columns for transactions @@ -24,7 +24,7 @@ impl Dataset for StorageDiffs { } } -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for StorageDiffs { @@ -33,7 +33,9 @@ impl CollectByBlock for StorageDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let schema = query.schemas.get_schema(&Datatype::StorageDiffs)?; let include_txs = schema.has_column("transaction_hash"); - source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (bn, txs, traces) = source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + let trace_results: Vec = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -62,7 +64,7 @@ pub(crate) fn process_storage_diffs( let schema = schemas.get(&Datatype::StorageDiffs).ok_or(err("schema not provided"))?; let (block_number, txs, traces) = response; for (index, (trace, tx)) in traces.iter().zip(txs).enumerate() { - if let Some(ethers::types::StateDiff(state_diffs)) = &trace.state_diff { + if let Some(state_diffs) = &trace.state_diff { for (addr, diff) in state_diffs.iter() { process_storage_diff(addr, &diff.storage, block_number, tx, index, columns, schema); } @@ -72,8 +74,8 @@ pub(crate) fn process_storage_diffs( } pub(crate) fn process_storage_diff( - addr: &H160, - diff: &std::collections::BTreeMap>, + addr: &Address, + diff: &std::collections::BTreeMap>, block_number: &Option, transaction_hash: &Option>, transaction_index: usize, @@ -82,18 +84,18 @@ pub(crate) fn process_storage_diff( ) { for (s, sub_diff) in diff.iter() { let (from, to) = match sub_diff { - Diff::Same => continue, - Diff::Born(value) => (H256::zero(), *value), - Diff::Died(value) => (*value, H256::zero()), - Diff::Changed(ChangedType { from, to }) => (*from, *to), + Delta::Unchanged => continue, + Delta::Added(value) => (B256::ZERO, *value), + Delta::Removed(value) => (*value, B256::ZERO), + Delta::Changed(ChangedType { from, to }) => (*from, *to), }; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(transaction_index as u32)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, slot, s.as_bytes().to_vec()); - store!(schema, columns, address, addr.as_bytes().to_vec()); - store!(schema, columns, from_value, from.as_bytes().to_vec()); - store!(schema, columns, to_value, to.as_bytes().to_vec()); + store!(schema, columns, slot, s.to_vec()); + store!(schema, columns, address, addr.to_vec()); + store!(schema, columns, from_value, from.to_vec()); + store!(schema, columns, to_value, to.to_vec()); } } diff --git a/crates/freeze/src/datasets/storage_reads.rs b/crates/freeze/src/datasets/storage_reads.rs index 874919a9..d2769565 100644 --- a/crates/freeze/src/datasets/storage_reads.rs +++ b/crates/freeze/src/datasets/storage_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::BTreeMap; @@ -24,7 +24,7 @@ impl Dataset for StorageReads { } } -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); #[async_trait::async_trait] impl CollectByBlock for StorageReads { @@ -75,7 +75,7 @@ pub(crate) fn process_storage_reads( } pub(crate) fn process_storage_read( - addr: &H160, + addr: &Address, account_state: &AccountState, block_number: &Option, transaction_hash: &Option>, @@ -83,15 +83,13 @@ pub(crate) fn process_storage_read( columns: &mut StorageReads, schema: &Table, ) { - if let Some(storage) = &account_state.storage { - for (slot, value) in storage.iter() { - columns.n_rows += 1; - store!(schema, columns, block_number, *block_number); - store!(schema, columns, transaction_index, Some(transaction_index as u32)); - store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, contract_address, addr.as_bytes().to_vec()); - store!(schema, columns, slot, slot.as_bytes().to_vec()); - store!(schema, columns, value, value.as_bytes().to_vec()); - } + for (slot, value) in account_state.storage.iter() { + columns.n_rows += 1; + store!(schema, columns, block_number, *block_number); + store!(schema, columns, transaction_index, Some(transaction_index as u32)); + store!(schema, columns, transaction_hash, transaction_hash.clone()); + store!(schema, columns, contract_address, addr.to_vec()); + store!(schema, columns, slot, slot.to_vec()); + store!(schema, columns, value, value.to_vec()); } } diff --git a/crates/freeze/src/datasets/trace_calls.rs b/crates/freeze/src/datasets/trace_calls.rs index 5af951e2..686e9f6b 100644 --- a/crates/freeze/src/datasets/trace_calls.rs +++ b/crates/freeze/src/datasets/trace_calls.rs @@ -1,6 +1,6 @@ use super::traces; use crate::*; -use ethers::prelude::*; +use alloy::rpc::types::trace::parity::{Action, TraceOutput, TraceType, TransactionTrace}; use polars::prelude::*; /// columns for transactions @@ -58,8 +58,7 @@ impl CollectByBlock for TraceCalls { Some(request.ethers_block_number()?), ) .await? - .trace - .ok_or(CollectError::CollectError("traces missing".to_string()))?; + .trace; Ok((request.block_number()? as u32, request.contract()?, request.call_data()?, traces)) } @@ -85,7 +84,7 @@ fn process_transaction_traces( process_action(&trace.action, columns, schema); process_result(&trace.result, columns, schema); - store!(schema, columns, action_type, traces::action_type_to_string(&trace.action_type)); + store!(schema, columns, action_type, traces::action_type_to_string(&trace.action.kind())); store!( schema, columns, @@ -104,10 +103,10 @@ fn process_transaction_traces( fn process_action(action: &Action, columns: &mut TraceCalls, schema: &Table) { match action { Action::Call(action) => { - store!(schema, columns, action_from, Some(action.from.as_bytes().to_vec())); - store!(schema, columns, action_to, Some(action.to.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.from.to_vec())); + store!(schema, columns, action_to, Some(action.to.to_vec())); store!(schema, columns, action_value, action.value.to_string()); - store!(schema, columns, action_gas, Some(action.gas.as_u32())); + store!(schema, columns, action_gas, Some(action.gas.wrapping_to::())); store!(schema, columns, action_input, Some(action.input.to_vec())); store!( schema, @@ -119,18 +118,18 @@ fn process_action(action: &Action, columns: &mut TraceCalls, schema: &Table) { store!(schema, columns, action_reward_type, None); } Action::Create(action) => { - store!(schema, columns, action_from, Some(action.from.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.from.to_vec())); store!(schema, columns, action_to, None); store!(schema, columns, action_value, action.value.to_string()); - store!(schema, columns, action_gas, Some(action.gas.as_u32())); + store!(schema, columns, action_gas, Some(action.gas.wrapping_to::())); store!(schema, columns, action_input, None); store!(schema, columns, action_call_type, None); store!(schema, columns, action_init, Some(action.init.to_vec())); store!(schema, columns, action_reward_type, None); } - Action::Suicide(action) => { - store!(schema, columns, action_from, Some(action.address.as_bytes().to_vec())); - store!(schema, columns, action_to, Some(action.refund_address.as_bytes().to_vec())); + Action::Selfdestruct(action) => { + store!(schema, columns, action_from, Some(action.address.to_vec())); + store!(schema, columns, action_to, Some(action.refund_address.to_vec())); store!(schema, columns, action_value, action.balance.to_string()); store!(schema, columns, action_gas, None); store!(schema, columns, action_input, None); @@ -139,7 +138,7 @@ fn process_action(action: &Action, columns: &mut TraceCalls, schema: &Table) { store!(schema, columns, action_reward_type, None); } Action::Reward(action) => { - store!(schema, columns, action_from, Some(action.author.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.author.to_vec())); store!(schema, columns, action_to, None); store!(schema, columns, action_value, action.value.to_string()); store!(schema, columns, action_gas, None); @@ -156,21 +155,21 @@ fn process_action(action: &Action, columns: &mut TraceCalls, schema: &Table) { } } -fn process_result(result: &Option, columns: &mut TraceCalls, schema: &Table) { +fn process_result(result: &Option, columns: &mut TraceCalls, schema: &Table) { match result { - Some(Res::Call(result)) => { - store!(schema, columns, result_gas_used, Some(result.gas_used.as_u32())); + Some(TraceOutput::Call(result)) => { + store!(schema, columns, result_gas_used, Some(result.gas_used.wrapping_to::())); store!(schema, columns, result_output, Some(result.output.to_vec())); store!(schema, columns, result_code, None); store!(schema, columns, result_address, None); } - Some(Res::Create(result)) => { - store!(schema, columns, result_gas_used, Some(result.gas_used.as_u32())); + Some(TraceOutput::Create(result)) => { + store!(schema, columns, result_gas_used, Some(result.gas_used.wrapping_to::())); store!(schema, columns, result_output, None); store!(schema, columns, result_code, Some(result.code.to_vec())); - store!(schema, columns, result_address, Some(result.address.as_bytes().to_vec())); + store!(schema, columns, result_address, Some(result.address.to_vec())); } - Some(Res::None) | None => { + None => { store!(schema, columns, result_gas_used, None); store!(schema, columns, result_output, None); store!(schema, columns, result_code, None); diff --git a/crates/freeze/src/datasets/traces.rs b/crates/freeze/src/datasets/traces.rs index 2ce7dd42..3e04b423 100644 --- a/crates/freeze/src/datasets/traces.rs +++ b/crates/freeze/src/datasets/traces.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::parity::{Action, ActionType, CallType, LocalizedTransactionTrace, RewardType, TraceOutput}}; use polars::prelude::*; /// columns for transactions @@ -39,10 +39,10 @@ impl Dataset for Traces { #[async_trait::async_trait] impl CollectByBlock for Traces { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - let traces = source.trace_block(request.block_number()?.into()).await?; + let traces = source.trace_block(request.block_number()?).await?; Ok(filter_traces_by_from_to_addresses(traces, &request.from_address, &request.to_address)) } @@ -55,7 +55,7 @@ impl CollectByBlock for Traces { #[async_trait::async_trait] impl CollectByTransaction for Traces { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { let traces = source.trace_transaction(request.ethers_transaction_hash()?).await?; @@ -70,34 +70,34 @@ impl CollectByTransaction for Traces { } pub(crate) fn filter_traces_by_from_to_addresses( - traces: Vec, + traces: Vec, from_address: &Option>, to_address: &Option>, -) -> Vec { +) -> Vec { // filter by from_address - let from_filter: Box bool + Send> = if let Some(from_address) = from_address { + let from_filter: Box bool + Send> = if let Some(from_address) = from_address { Box::new(move |trace| { - let from = match &trace.action { + let from = match &trace.trace.action { Action::Call(action) => action.from, Action::Create(action) => action.from, - Action::Suicide(action) => action.address, + Action::Selfdestruct(action) => action.address, _ => return false, }; - from.as_bytes() == from_address + from == Address::from_slice(from_address) }) } else { Box::new(|_| true) }; // filter by to_address - let to_filter: Box bool + Send> = if let Some(to_address) = to_address { + let to_filter: Box bool + Send> = if let Some(to_address) = to_address { Box::new(move |trace| { - let to = match &trace.action { + let to = match &trace.trace.action { Action::Call(action) => action.to, - Action::Suicide(action) => action.refund_address, + Action::Selfdestruct(action) => action.refund_address, Action::Reward(action) => action.author, _ => return false, }; - to.as_bytes() == to_address + to == Address::from_slice(to_address) }) } else { Box::new(|_| true) @@ -106,30 +106,30 @@ pub(crate) fn filter_traces_by_from_to_addresses( } /// process block into columns -pub(crate) fn process_traces(traces: &[Trace], columns: &mut Traces, schemas: &Schemas) -> R<()> { +pub(crate) fn process_traces(traces: &[LocalizedTransactionTrace], columns: &mut Traces, schemas: &Schemas) -> R<()> { let schema = schemas.get(&Datatype::Traces).ok_or(err("schema not provided"))?; for trace in traces.iter() { columns.n_rows += 1; - process_action(&trace.action, columns, schema); - process_result(&trace.result, columns, schema); - store!(schema, columns, action_type, action_type_to_string(&trace.action_type)); + process_action(&trace.trace.action, columns, schema); + process_result(&trace.trace.result, columns, schema); + store!(schema, columns, action_type, action_type_to_string(&trace.trace.action.kind())); store!( schema, columns, trace_address, - trace.trace_address.iter().map(|n| n.to_string()).collect::>().join("_") + trace.trace.trace_address.iter().map(|n| n.to_string()).collect::>().join("_") ); - store!(schema, columns, subtraces, trace.subtraces as u32); + store!(schema, columns, subtraces, trace.trace.subtraces as u32); store!(schema, columns, transaction_index, trace.transaction_position.map(|x| x as u32)); store!( schema, columns, transaction_hash, - trace.transaction_hash.map(|x| x.as_bytes().to_vec()) + trace.transaction_hash.map(|x| x.to_vec()) ); - store!(schema, columns, block_number, trace.block_number as u32); - store!(schema, columns, block_hash, trace.block_hash.as_bytes().to_vec()); - store!(schema, columns, error, trace.error.clone()); + store!(schema, columns, block_number, trace.block_number.unwrap() as u32); + store!(schema, columns, block_hash, trace.block_hash.unwrap().to_vec()); + store!(schema, columns, error, trace.trace.error.clone()); } Ok(()) } @@ -137,10 +137,10 @@ pub(crate) fn process_traces(traces: &[Trace], columns: &mut Traces, schemas: &S fn process_action(action: &Action, columns: &mut Traces, schema: &Table) { match action { Action::Call(action) => { - store!(schema, columns, action_from, Some(action.from.as_bytes().to_vec())); - store!(schema, columns, action_to, Some(action.to.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.from.to_vec())); + store!(schema, columns, action_to, Some(action.to.to_vec())); store!(schema, columns, action_value, action.value.to_string()); - store!(schema, columns, action_gas, Some(action.gas.as_u32())); + store!(schema, columns, action_gas, Some(action.gas.wrapping_to::())); store!(schema, columns, action_input, Some(action.input.to_vec())); store!( schema, @@ -152,18 +152,18 @@ fn process_action(action: &Action, columns: &mut Traces, schema: &Table) { store!(schema, columns, action_reward_type, None); } Action::Create(action) => { - store!(schema, columns, action_from, Some(action.from.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.from.to_vec())); store!(schema, columns, action_to, None); store!(schema, columns, action_value, action.value.to_string()); - store!(schema, columns, action_gas, Some(action.gas.as_u32())); + store!(schema, columns, action_gas, Some(action.gas.wrapping_to::())); store!(schema, columns, action_input, None); store!(schema, columns, action_call_type, None); store!(schema, columns, action_init, Some(action.init.to_vec())); store!(schema, columns, action_reward_type, None); } - Action::Suicide(action) => { - store!(schema, columns, action_from, Some(action.address.as_bytes().to_vec())); - store!(schema, columns, action_to, Some(action.refund_address.as_bytes().to_vec())); + Action::Selfdestruct(action) => { + store!(schema, columns, action_from, Some(action.address.to_vec())); + store!(schema, columns, action_to, Some(action.refund_address.to_vec())); store!(schema, columns, action_value, action.balance.to_string()); store!(schema, columns, action_gas, None); store!(schema, columns, action_input, None); @@ -172,7 +172,7 @@ fn process_action(action: &Action, columns: &mut Traces, schema: &Table) { store!(schema, columns, action_reward_type, None); } Action::Reward(action) => { - store!(schema, columns, action_from, Some(action.author.as_bytes().to_vec())); + store!(schema, columns, action_from, Some(action.author.to_vec())); store!(schema, columns, action_to, None); store!(schema, columns, action_value, action.value.to_string()); store!(schema, columns, action_gas, None); @@ -189,21 +189,21 @@ fn process_action(action: &Action, columns: &mut Traces, schema: &Table) { } } -fn process_result(result: &Option, columns: &mut Traces, schema: &Table) { +fn process_result(result: &Option, columns: &mut Traces, schema: &Table) { match result { - Some(Res::Call(result)) => { - store!(schema, columns, result_gas_used, Some(result.gas_used.as_u32())); + Some(TraceOutput::Call(result)) => { + store!(schema, columns, result_gas_used, Some(result.gas_used.wrapping_to::())); store!(schema, columns, result_output, Some(result.output.to_vec())); store!(schema, columns, result_code, None); store!(schema, columns, result_address, None); } - Some(Res::Create(result)) => { - store!(schema, columns, result_gas_used, Some(result.gas_used.as_u32())); + Some(TraceOutput::Create(result)) => { + store!(schema, columns, result_gas_used, Some(result.gas_used.wrapping_to::())); store!(schema, columns, result_output, None); store!(schema, columns, result_code, Some(result.code.to_vec())); - store!(schema, columns, result_address, Some(result.address.as_bytes().to_vec())); + store!(schema, columns, result_address, Some(result.address.to_vec())); } - Some(Res::None) | None => { + None => { store!(schema, columns, result_gas_used, None); store!(schema, columns, result_output, None); store!(schema, columns, result_code, None); @@ -216,8 +216,9 @@ pub(crate) fn reward_type_to_string(reward_type: &RewardType) -> String { match reward_type { RewardType::Block => "reward".to_string(), RewardType::Uncle => "uncle".to_string(), - RewardType::EmptyStep => "empty_step".to_string(), - RewardType::External => "external".to_string(), + // below arms not exist in alloy + // RewardType::EmptyStep => "empty_step".to_string(), + // RewardType::External => "external".to_string(), } } @@ -226,7 +227,7 @@ pub(crate) fn action_type_to_string(action_type: &ActionType) -> String { ActionType::Call => "call".to_string(), ActionType::Create => "create".to_string(), ActionType::Reward => "reward".to_string(), - ActionType::Suicide => "suicide".to_string(), + ActionType::Selfdestruct => "suicide".to_string(), } } @@ -237,24 +238,25 @@ pub(crate) fn action_call_type_to_string(action_call_type: &CallType) -> String CallType::CallCode => "call_code".to_string(), CallType::DelegateCall => "delegate_call".to_string(), CallType::StaticCall => "static_call".to_string(), + CallType::AuthCall => "auth_call".to_string(), } } /// filter out error traces -pub(crate) fn filter_failed_traces(traces: Vec) -> Vec { +pub(crate) fn filter_failed_traces(traces: Vec) -> Vec { let mut error_address: Option> = None; - let mut filtered: Vec = Vec::new(); + let mut filtered: Vec = Vec::new(); for trace in traces.into_iter() { // restart for each transaction - if trace.trace_address.is_empty() { + if trace.trace.trace_address.is_empty() { error_address = None; }; // if in an error, check if next trace is still in error if let Some(ref e_address) = error_address { - if trace.trace_address.len() >= e_address.len() && - trace.trace_address[0..e_address.len()] == e_address[..] + if trace.trace.trace_address.len() >= e_address.len() && + trace.trace.trace_address[0..e_address.len()] == e_address[..] { continue } else { @@ -263,8 +265,8 @@ pub(crate) fn filter_failed_traces(traces: Vec) -> Vec { } // check if current trace is start of an error - match trace.error { - Some(_) => error_address = Some(trace.trace_address), + match trace.trace.error { + Some(_) => error_address = Some(trace.trace.trace_address), None => filtered.push(trace), } } diff --git a/crates/freeze/src/datasets/transactions.rs b/crates/freeze/src/datasets/transactions.rs index cdb933b2..dff04d34 100644 --- a/crates/freeze/src/datasets/transactions.rs +++ b/crates/freeze/src/datasets/transactions.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, U256}, + rpc::types::{Block, BlockTransactions, BlockTransactionsKind, Transaction, TransactionReceipt}, +}; use polars::prelude::*; /// columns for transactions @@ -25,13 +28,14 @@ pub struct Transactions { n_input_bytes: Vec, n_input_zero_bytes: Vec, n_input_nonzero_bytes: Vec, - n_rlp_bytes: Vec, + // not support by alloy + // n_rlp_bytes: Vec, block_hash: Vec>, chain_id: Vec, timestamp: Vec, - r: Vec>, - s: Vec>, - v: Vec, + r: Vec>>, + s: Vec>>, + v: Vec>, } #[async_trait::async_trait] @@ -74,11 +78,11 @@ pub type TransactionAndReceipt = (Transaction, Option); #[async_trait::async_trait] impl CollectByBlock for Transactions { - type Response = (Block, Vec, bool); + type Response = (Block, Vec, bool); async fn extract(request: Params, source: Arc, query: Arc) -> R { let block = source - .get_block_with_txs(request.block_number()?) + .get_block(request.block_number()?, BlockTransactionsKind::Full) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; let schema = query.schemas.get_schema(&Datatype::Transactions)?; @@ -87,19 +91,29 @@ impl CollectByBlock for Transactions { // filter by from_address let from_filter: Box bool + Send> = if let Some(from_address) = &request.from_address { - Box::new(move |tx| tx.from.as_bytes() == from_address) + Box::new(move |tx| tx.from == Address::from_slice(from_address)) } else { Box::new(|_| true) }; // filter by to_address let to_filter: Box bool + Send> = if let Some(to_address) = &request.to_address { - Box::new(move |tx| tx.to.as_ref().map_or(false, |x| x.as_bytes() == to_address)) + Box::new(move |tx| { + tx.to.as_ref().map_or(false, |x| *x == Address::from_slice(to_address)) + }) } else { Box::new(|_| true) }; - let transactions = - block.transactions.clone().into_iter().filter(from_filter).filter(to_filter).collect(); + let transactions: Vec = block + .transactions + .clone() + .as_transactions() + .unwrap() + .to_vec() + .into_iter() + .filter(from_filter) + .filter(to_filter) + .collect(); // 2. collect receipts if necessary // if transactions are filtered fetch by set of transaction hashes, else fetch all receipts @@ -108,7 +122,7 @@ impl CollectByBlock for Transactions { if schema.has_column("gas_used") | schema.has_column("success") { // receipts required let receipts = if request.from_address.is_some() || request.to_address.is_some() { - source.get_tx_receipts(&transactions).await? + source.get_tx_receipts(BlockTransactions::Full(transactions.clone())).await? } else { source.get_tx_receipts_in_block(&block).await? }; @@ -131,7 +145,7 @@ impl CollectByBlock for Transactions { columns, schema, exclude_failed, - block.timestamp.as_u32(), + block.header.timestamp as u32, )?; } Ok(()) @@ -146,7 +160,7 @@ impl CollectByTransaction for Transactions { let tx_hash = request.ethers_transaction_hash()?; let schema = query.schemas.get_schema(&Datatype::Transactions)?; let transaction = source - .get_transaction(tx_hash) + .get_transaction_by_hash(tx_hash) .await? .ok_or(CollectError::CollectError("transaction not found".to_string()))?; let receipt = if schema.has_column("gas_used") { @@ -160,11 +174,11 @@ impl CollectByTransaction for Transactions { .ok_or(CollectError::CollectError("no block number for tx".to_string()))?; let block = source - .get_block(block_number.as_u64()) + .get_block(block_number, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; - let timestamp = block.timestamp.as_u32(); + let timestamp = block.header.timestamp as u32; Ok(((transaction, receipt), query.exclude_failed, timestamp)) } @@ -196,15 +210,15 @@ pub(crate) fn process_transaction( }; columns.n_rows += 1; - store!(schema, columns, block_number, tx.block_number.map(|x| x.as_u32())); - store!(schema, columns, transaction_index, tx.transaction_index.map(|x| x.as_u64())); - store!(schema, columns, transaction_hash, tx.hash.as_bytes().to_vec()); - store!(schema, columns, from_address, tx.from.as_bytes().to_vec()); - store!(schema, columns, to_address, tx.to.map(|x| x.as_bytes().to_vec())); - store!(schema, columns, nonce, tx.nonce.as_u64()); + store!(schema, columns, block_number, tx.block_number.map(|x| x as u32)); + store!(schema, columns, transaction_index, tx.transaction_index); + store!(schema, columns, transaction_hash, tx.hash.to_vec()); + store!(schema, columns, from_address, tx.from.to_vec()); + store!(schema, columns, to_address, tx.to.map(|x| x.to_vec())); + store!(schema, columns, nonce, tx.nonce); store!(schema, columns, value, tx.value); store!(schema, columns, input, tx.input.to_vec()); - store!(schema, columns, gas_limit, tx.gas.as_u64()); + store!(schema, columns, gas_limit, tx.gas as u64); store!(schema, columns, success, success); if schema.has_column("n_input_bytes") | schema.has_column("n_input_zero_bytes") | @@ -216,35 +230,36 @@ pub(crate) fn process_transaction( store!(schema, columns, n_input_zero_bytes, n_input_zero_bytes); store!(schema, columns, n_input_nonzero_bytes, n_input_bytes - n_input_zero_bytes); } - store!(schema, columns, n_rlp_bytes, tx.rlp().len() as u32); - store!(schema, columns, gas_used, receipt.and_then(|r| r.gas_used.map(|x| x.as_u64()))); - store!(schema, columns, gas_price, tx.gas_price.map(|gas_price| gas_price.as_u64())); - store!(schema, columns, transaction_type, tx.transaction_type.map(|value| value.as_u32())); - store!(schema, columns, max_fee_per_gas, tx.max_fee_per_gas.map(|value| value.as_u64())); + // alloy has not implemented rlp method in transaction + // store!(schema, columns, n_rlp_bytes, tx.rlp().len() as u32); + store!(schema, columns, gas_used, receipt.map(|r| r.gas_used as u64)); + store!(schema, columns, gas_price, tx.gas_price.map(|gas_price| gas_price as u64)); + store!(schema, columns, transaction_type, tx.transaction_type.map(|value| value as u32)); + store!(schema, columns, max_fee_per_gas, tx.max_fee_per_gas.map(|value| value as u64)); store!( schema, columns, max_priority_fee_per_gas, - tx.max_priority_fee_per_gas.map(|value| value.as_u64()) + tx.max_priority_fee_per_gas.map(|value| value as u64) ); store!(schema, columns, timestamp, timestamp); - store!(schema, columns, block_hash, tx.block_hash.unwrap_or_default().as_bytes().to_vec()); + store!(schema, columns, block_hash, tx.block_hash.unwrap_or_default().to_vec()); - store!(schema, columns, v, tx.v.as_u64()); - store!(schema, columns, r, tx.r.to_vec_u8()); - store!(schema, columns, s, tx.s.to_vec_u8()); + store!(schema, columns, v, tx.signature.map(|x| x.v.wrapping_to::())); + store!(schema, columns, r, tx.signature.map(|x| x.r.to_vec_u8())); + store!(schema, columns, s, tx.signature.map(|x| x.s.to_vec_u8())); Ok(()) } fn tx_success(tx: &Transaction, receipt: &Option) -> R { - if let Some(status) = receipt.as_ref().and_then(|x| x.status) { - Ok(status.as_u64() == 1) + if let Some(r) = receipt { + Ok(r.status()) } else if let (Some(1), Some(true)) = - (tx.chain_id.map(|x| x.as_u64()), tx.block_number.map(|x| x.as_u64() < 4370000)) + (tx.chain_id, tx.block_number.map(|x| x < 4370000)) { - if let Some(gas_used) = receipt.as_ref().and_then(|x| x.gas_used.map(|x| x.as_u64())) { - Ok(gas_used == 0) + if let Some(r) = receipt { + Ok(r.gas_used == 0) } else { return Err(err("could not determine status of transaction")) } diff --git a/crates/freeze/src/datasets/vm_traces.rs b/crates/freeze/src/datasets/vm_traces.rs index b06b4658..c0cc7b37 100644 --- a/crates/freeze/src/datasets/vm_traces.rs +++ b/crates/freeze/src/datasets/vm_traces.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::rpc::types::trace::parity::{TraceResults, VmTrace}; use polars::prelude::*; /// columns for transactions @@ -17,7 +17,7 @@ pub struct VmTraces { mem_data: Vec>>, storage_key: Vec>>, storage_val: Vec>>, - op: Vec, + op: Vec>, n_rows: usize, chain_id: Vec, } @@ -39,10 +39,12 @@ impl Dataset for VmTraces { #[async_trait::async_trait] impl CollectByBlock for VmTraces { - type Response = (Option, Option>, Vec); + type Response = (Option, Option>, Vec); async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.trace_block_vm_traces(request.block_number()? as u32).await + let (bn, txs, traces) = source.trace_block_vm_traces(request.block_number()? as u32).await?; + let trace_results = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -52,7 +54,7 @@ impl CollectByBlock for VmTraces { #[async_trait::async_trait] impl CollectByTransaction for VmTraces { - type Response = (Option, Option>, Vec); + type Response = (Option, Option>, Vec); async fn extract(request: Params, source: Arc, _: Arc) -> R { source.trace_transaction_vm_traces(request.transaction_hash()?).await @@ -64,7 +66,7 @@ impl CollectByTransaction for VmTraces { } fn process_vm_traces( - response: (Option, Option>, Vec), + response: (Option, Option>, Vec), columns: &mut VmTraces, schemas: &Schemas, ) -> R<()> { @@ -79,7 +81,7 @@ fn process_vm_traces( } fn add_ops( - vm_trace: VMTrace, + vm_trace: VmTrace, schema: &Table, columns: &mut VmTraces, number: Option, @@ -120,12 +122,7 @@ fn add_ops( store!(schema, columns, storage_key, None); store!(schema, columns, storage_val, None); } - if schema.has_column("op") { - match opcode.op { - ExecutedInstruction::Known(op) => store!(schema, columns, op, op.to_string()), - ExecutedInstruction::Unknown(op) => store!(schema, columns, op, op), - } - }; + store!(schema, columns, op, opcode.op); if let Some(sub) = opcode.sub { add_ops(sub, schema, columns, number, tx_hash.clone(), tx_pos) diff --git a/crates/freeze/src/multi_datasets/blocks_and_transactions.rs b/crates/freeze/src/multi_datasets/blocks_and_transactions.rs index 12012599..4825e650 100644 --- a/crates/freeze/src/multi_datasets/blocks_and_transactions.rs +++ b/crates/freeze/src/multi_datasets/blocks_and_transactions.rs @@ -1,4 +1,5 @@ use crate::{datasets::transactions, types::collection::*, Datatype, *}; +use alloy::rpc::types::BlockTransactionsKind; use polars::prelude::*; use std::collections::HashMap; @@ -48,9 +49,9 @@ impl CollectByTransaction for BlocksAndTransactions { async fn extract(request: Params, source: Arc, query: Arc) -> R { let ((tx, receipt), exclude_failed, timestamp) = ::extract(request, source.clone(), query).await?; - let block_number = tx.block_number.ok_or(err("no block number for tx"))?.as_u64(); + let block_number = tx.block_number.ok_or(err("no block number for tx"))?; let block = source - .get_block(block_number) + .get_block(block_number, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("block not found".to_string()))?; Ok((block, ((tx, receipt), exclude_failed, timestamp))) diff --git a/crates/freeze/src/multi_datasets/call_trace_derivatives.rs b/crates/freeze/src/multi_datasets/call_trace_derivatives.rs index 90148f27..53ad5c66 100644 --- a/crates/freeze/src/multi_datasets/call_trace_derivatives.rs +++ b/crates/freeze/src/multi_datasets/call_trace_derivatives.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::rpc::types::trace::parity::LocalizedTransactionTrace; use polars::prelude::*; use std::collections::HashMap; @@ -34,10 +34,10 @@ impl ToDataFrames for CallTraceDerivatives { #[async_trait::async_trait] impl CollectByBlock for CallTraceDerivatives { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { - source.trace_block(request.block_number()?.into()).await + source.trace_block(request.block_number()?).await } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { @@ -49,7 +49,7 @@ impl CollectByBlock for CallTraceDerivatives { #[async_trait::async_trait] impl CollectByTransaction for CallTraceDerivatives { - type Response = Vec; + type Response = Vec; async fn extract(request: Params, source: Arc, _: Arc) -> R { source.trace_transaction(request.ethers_transaction_hash()?).await @@ -63,7 +63,7 @@ impl CollectByTransaction for CallTraceDerivatives { } fn process_call_trace_derivatives( - response: Vec, + response: Vec, columns: &mut CallTraceDerivatives, schemas: &HashMap, ) -> R<()> { diff --git a/crates/freeze/src/multi_datasets/geth_state_diffs.rs b/crates/freeze/src/multi_datasets/geth_state_diffs.rs index fc1c04af..cc40dab7 100644 --- a/crates/freeze/src/multi_datasets/geth_state_diffs.rs +++ b/crates/freeze/src/multi_datasets/geth_state_diffs.rs @@ -1,5 +1,8 @@ use crate::*; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, Bytes, B256, U256}, + rpc::types::trace::geth::{AccountState, DiffMode}, +}; use polars::prelude::*; use std::collections::{BTreeMap, HashMap, HashSet}; @@ -46,7 +49,7 @@ impl ToDataFrames for GethStateDiffs { } } -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); #[async_trait::async_trait] impl CollectByBlock for GethStateDiffs { @@ -146,34 +149,34 @@ pub(crate) fn process_geth_diffs( } fn add_balances( - address: &H160, + address: &Address, pre: Option, post: Option, columns: &mut GethBalanceDiffs, schema: &Table, index: &(Option, u32, Option>), ) -> R<()> { - let (from_value, to_value) = parse_pre_post(pre, post, U256::zero); + let (from_value, to_value) = parse_pre_post(pre, post, U256::ZERO); let (block_number, transaction_index, transaction_hash) = index; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(*transaction_index as u64)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, address.as_bytes().to_vec()); + store!(schema, columns, address, address.to_vec()); store!(schema, columns, from_value, from_value); store!(schema, columns, to_value, to_value); Ok(()) } fn add_codes( - address: &H160, - pre: &Option, - post: &Option, + address: &Address, + pre: &Option, + post: &Option, columns: &mut GethCodeDiffs, schema: &Table, index: &(Option, u32, Option>), ) -> R<()> { - let blank = String::new(); + let blank = Bytes::new(); let (from_value, to_value) = match (pre, post) { (Some(pre), Some(post)) => (pre, post), (Some(pre), None) => (pre, &blank), @@ -185,57 +188,40 @@ fn add_codes( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(*transaction_index as u64)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, address.as_bytes().to_vec()); - let from_value = if !from_value.is_empty() { - prefix_hex::decode(from_value).map_err(|_| err("could not decode from code contents"))? - } else { - vec![] - }; - let to_value = if !to_value.is_empty() { - prefix_hex::decode(to_value).map_err(|_| err("could not decode to code contents"))? - } else { - vec![] - }; - store!(schema, columns, from_value, from_value); - store!(schema, columns, to_value, to_value); + store!(schema, columns, address, address.to_vec()); + store!(schema, columns, from_value, from_value.to_vec()); + store!(schema, columns, to_value, to_value.to_vec()); Ok(()) } fn add_nonces( - address: &H160, - pre: Option, - post: Option, + address: &Address, + pre: Option, + post: Option, columns: &mut GethNonceDiffs, schema: &Table, index: &(Option, u32, Option>), ) -> R<()> { - let (from_value, to_value) = parse_pre_post(pre, post, U256::zero); + let (from_value, to_value) = parse_pre_post(pre, post, 0_u64); let (block_number, transaction_index, transaction_hash) = index; columns.n_rows += 1; store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(*transaction_index as u64)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, address.as_bytes().to_vec()); + store!(schema, columns, address, address.to_vec()); store!(schema, columns, from_value, from_value); store!(schema, columns, to_value, to_value); Ok(()) } fn add_storages( - address: &H160, - pre: &Option>, - post: &Option>, + address: &Address, + pre: &BTreeMap, + post: &BTreeMap, columns: &mut GethStorageDiffs, schema: &Table, index: &(Option, u32, Option>), ) -> R<()> { - let blank = BTreeMap::new(); - let (pre, post) = match (pre, post) { - (Some(pre), Some(post)) => (pre, post), - (Some(pre), None) => (pre, &blank), - (None, Some(post)) => (&blank, post), - (None, None) => (&blank, &blank), - }; let (block_number, transaction_index, transaction_hash) = index; let slots: Vec<_> = pre .clone() @@ -244,7 +230,7 @@ fn add_storages( .collect::>() .into_iter() .collect(); - let blank = H256::zero(); + let blank = B256::ZERO; for slot in slots.into_iter() { let (from, to) = match (pre.get(&slot), post.get(&slot)) { (Some(pre), Some(post)) => (pre, post), @@ -256,19 +242,21 @@ fn add_storages( store!(schema, columns, block_number, *block_number); store!(schema, columns, transaction_index, Some(*transaction_index as u64)); store!(schema, columns, transaction_hash, transaction_hash.clone()); - store!(schema, columns, address, address.as_bytes().to_vec()); - store!(schema, columns, slot, slot.as_bytes().to_vec()); - store!(schema, columns, from_value, from.as_bytes().to_vec()); - store!(schema, columns, to_value, to.as_bytes().to_vec()); + store!(schema, columns, address, address.to_vec()); + store!(schema, columns, slot, slot.to_vec()); + store!(schema, columns, from_value, from.to_vec()); + store!(schema, columns, to_value, to.to_vec()); } Ok(()) } -fn parse_pre_post(pre: Option, post: Option, new: fn() -> T) -> (T, T) { +fn parse_pre_post(pre: Option, post: Option, new: T) -> (T, T) +where T: Copy + Clone +{ match (pre, post) { (Some(pre), Some(post)) => (pre, post), - (Some(pre), None) => (pre, new()), - (None, Some(post)) => (new(), post), - (None, None) => (new(), new()), + (Some(pre), None) => (pre, new), + (None, Some(post)) => (new, post), + (None, None) => (new, new), } } diff --git a/crates/freeze/src/multi_datasets/state_diffs.rs b/crates/freeze/src/multi_datasets/state_diffs.rs index 31cff4fe..44294a0f 100644 --- a/crates/freeze/src/multi_datasets/state_diffs.rs +++ b/crates/freeze/src/multi_datasets/state_diffs.rs @@ -1,4 +1,5 @@ use crate::*; +use alloy::rpc::types::trace::parity::TraceResults; use polars::prelude::*; use std::collections::HashMap; @@ -11,7 +12,7 @@ pub struct StateDiffs( storage_diffs::StorageDiffs, ); -type BlockTxsTraces = (Option, Vec>>, Vec); +type BlockTxsTraces = (Option, Vec>>, Vec); impl ToDataFrames for StateDiffs { fn create_dfs( @@ -35,7 +36,9 @@ impl CollectByBlock for StateDiffs { async fn extract(request: Params, source: Arc, query: Arc) -> R { let include_txs = query.schemas.values().any(|x| x.has_column("transaction_hash")); - source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await + let (bn, txs, traces) = source.trace_block_state_diffs(request.block_number()? as u32, include_txs).await?; + let trace_results = traces.into_iter().map(|t| t.full_trace).collect(); + Ok((bn, txs, trace_results)) } fn transform(response: Self::Response, columns: &mut Self, query: &Arc) -> R<()> { diff --git a/crates/freeze/src/multi_datasets/state_reads.rs b/crates/freeze/src/multi_datasets/state_reads.rs index f046d7b4..0fa8ae4b 100644 --- a/crates/freeze/src/multi_datasets/state_reads.rs +++ b/crates/freeze/src/multi_datasets/state_reads.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::{primitives::Address, rpc::types::trace::geth::AccountState}; use polars::prelude::*; use std::collections::{BTreeMap, HashMap}; @@ -12,7 +12,7 @@ pub struct StateReads( storage_reads::StorageReads, ); -type BlockTxsTraces = (Option, Vec>>, Vec>); +type BlockTxsTraces = (Option, Vec>>, Vec>); impl ToDataFrames for StateReads { fn create_dfs( diff --git a/crates/freeze/src/types/chunks/number_chunk.rs b/crates/freeze/src/types/chunks/number_chunk.rs index b557e4c4..7e54bac2 100644 --- a/crates/freeze/src/types/chunks/number_chunk.rs +++ b/crates/freeze/src/types/chunks/number_chunk.rs @@ -1,6 +1,6 @@ use super::chunk_ops::ChunkData; use crate::ChunkError; -use ethers::types::FilterBlockOption; +use alloy::rpc::types::FilterBlockOption; /// Chunk of blocks #[derive(Debug, Clone)] diff --git a/crates/freeze/src/types/columns.rs b/crates/freeze/src/types/columns.rs index 5270616c..8d8baa61 100644 --- a/crates/freeze/src/types/columns.rs +++ b/crates/freeze/src/types/columns.rs @@ -52,10 +52,7 @@ pub trait ColumnData: Default + crate::Dataset { /// input arg aliases fn base_arg_aliases() -> HashMap { - match Self::arg_aliases() { - Some(x) => x, - None => HashMap::new(), - } + Self::arg_aliases().unwrap_or_default() } } diff --git a/crates/freeze/src/types/conversions.rs b/crates/freeze/src/types/conversions.rs index ce8d39f5..106cc47a 100644 --- a/crates/freeze/src/types/conversions.rs +++ b/crates/freeze/src/types/conversions.rs @@ -1,6 +1,6 @@ use crate::CollectError; /// conversion operations -use ethers::prelude::*; +use alloy::primitives::{Bytes, U256, I256}; use prefix_hex; /// convert Bytes to u32 @@ -21,11 +21,7 @@ pub trait ToVecU8 { impl ToVecU8 for U256 { fn to_vec_u8(&self) -> Vec { - let mut vec = Vec::new(); - for &number in self.0.iter().rev() { - vec.extend_from_slice(&number.to_be_bytes()); - } - vec + self.to_be_bytes_vec() } } @@ -45,9 +41,7 @@ impl ToVecU8 for Vec { fn to_vec_u8(&self) -> Vec { let mut vec = Vec::new(); for value in self { - for &number in value.0.iter().rev() { - vec.extend_from_slice(&number.to_be_bytes()); - } + vec.extend_from_slice(&value.to_be_bytes_vec()) } vec } diff --git a/crates/freeze/src/types/dataframes/creation.rs b/crates/freeze/src/types/dataframes/creation.rs index b4dd01d4..860d5b4c 100644 --- a/crates/freeze/src/types/dataframes/creation.rs +++ b/crates/freeze/src/types/dataframes/creation.rs @@ -74,7 +74,7 @@ macro_rules! with_series_u256 { let name = $name.to_string() + U256Type::U32.suffix().as_str(); let name = name.as_str(); - let converted: Vec = $value.iter().map(|v| v.as_u32()).collect(); + let converted: Vec = $value.iter().map(|v| v.wrapping_to::()).collect(); $all_series.push(Series::new(name, converted)); } @@ -83,7 +83,7 @@ macro_rules! with_series_u256 { let name = $name.to_string() + U256Type::U64.suffix().as_str(); let name = name.as_str(); - let converted: Vec = $value.iter().map(|v| v.as_u64()).collect(); + let converted: Vec = $value.iter().map(|v| v.wrapping_to::()).collect(); $all_series.push(Series::new(name, converted)); } @@ -154,7 +154,7 @@ macro_rules! with_series_option_u256 { let name = name.as_str(); let converted: Vec> = - $value.iter().map(|v| v.map(|x| x.as_u32())).collect(); + $value.iter().map(|v| v.map(|x| x.wrapping_to::())).collect(); $all_series.push(Series::new(name, converted)); } @@ -164,7 +164,7 @@ macro_rules! with_series_option_u256 { let name = name.as_str(); let converted: Vec> = - $value.iter().map(|v| v.map(|x| x.as_u64())).collect(); + $value.iter().map(|v| v.map(|x| x.wrapping_to::())).collect(); $all_series.push(Series::new(name, converted)); } diff --git a/crates/freeze/src/types/dataframes/u256s.rs b/crates/freeze/src/types/dataframes/u256s.rs index ea3a353a..f8be46a8 100644 --- a/crates/freeze/src/types/dataframes/u256s.rs +++ b/crates/freeze/src/types/dataframes/u256s.rs @@ -1,5 +1,5 @@ use crate::*; -use ethers::prelude::*; +use alloy::primitives::{U256, I256}; use polars::prelude::*; /// Converts a Vec of U256-like data into a polars Series @@ -46,11 +46,11 @@ impl ToU256Series for Vec { Ok(Series::new(name, converted)) } U256Type::U32 => { - let converted: Vec = self.iter().map(|v| v.as_u32()).collect(); + let converted: Vec = self.iter().map(|v| v.wrapping_to::()).collect(); Ok(Series::new(name, converted)) } U256Type::U64 => { - let converted: Vec = self.iter().map(|v| v.as_u64()).collect(); + let converted: Vec = self.iter().map(|v| v.wrapping_to::()).collect(); Ok(Series::new(name, converted)) } U256Type::Decimal128 => { @@ -100,12 +100,12 @@ impl ToU256Series for Vec> { } U256Type::U32 => { let converted: Vec> = - self.iter().map(|v| v.map(|x| x.as_u32())).collect(); + self.iter().map(|v| v.map(|x| x.wrapping_to::())).collect(); Ok(Series::new(name, converted)) } U256Type::U64 => { let converted: Vec> = - self.iter().map(|v| v.map(|x| x.as_u64())).collect(); + self.iter().map(|v| v.map(|x| x.wrapping_to::())).collect(); Ok(Series::new(name, converted)) } U256Type::Decimal128 => { diff --git a/crates/freeze/src/types/decoders/log_decoder.rs b/crates/freeze/src/types/decoders/log_decoder.rs index 5f7c87aa..e3d4d7cf 100644 --- a/crates/freeze/src/types/decoders/log_decoder.rs +++ b/crates/freeze/src/types/decoders/log_decoder.rs @@ -1,8 +1,12 @@ use crate::{err, CollectError, ColumnEncoding, ToU256Series, U256Type}; -use ethers::prelude::*; -use ethers_core::abi::{AbiEncode, EventParam, HumanReadableParser, ParamType, RawLog, Token}; +use alloy::{ + dyn_abi::{DynSolValue, EventExt}, + hex::ToHexExt, + json_abi::Event, + primitives::{I256, U256}, + rpc::types::Log, +}; use polars::prelude::*; -use std::collections::HashSet; /// container for log decoding context #[derive(Clone, Debug, PartialEq)] @@ -11,7 +15,7 @@ pub struct LogDecoder { /// uint256 amount) pub raw: String, /// decoded abi type of event signature string - pub event: abi::Event, + pub event: Event, } impl LogDecoder { @@ -19,7 +23,7 @@ impl LogDecoder { /// ex: LogDecoder::new("event Transfer(address indexed from, address indexed to, uint256 /// amount)".to_string()) pub fn new(event_signature: String) -> Result { - match HumanReadableParser::parse_event(event_signature.as_str()) { + match Event::parse(&event_signature) { Ok(event) => Ok(Self { event, raw: event_signature.clone() }), Err(e) => { let err = format!("incorrectly formatted event {} (expect something like event Transfer(address indexed from, address indexed to, uint256 amount) err: {}", event_signature, e); @@ -37,23 +41,40 @@ impl LogDecoder { /// converts from a log type to an abi token type /// this function assumes all logs are of the same type and skips fields if they don't match the /// passed event definition - pub fn parse_log_from_event(&self, logs: Vec) -> indexmap::IndexMap> { - let mut map: indexmap::IndexMap> = indexmap::IndexMap::new(); - let known_keys = - self.event.inputs.clone().into_iter().map(|i| i.name).collect::>(); + pub fn parse_log_from_event( + &self, + logs: Vec, + ) -> indexmap::IndexMap> { + let mut map: indexmap::IndexMap> = indexmap::IndexMap::new(); + let indexed_keys: Vec = self + .event + .inputs + .clone() + .into_iter() + .filter_map(|x| if x.indexed {Some(x.name)} else {None}) + .collect(); + let body_keys: Vec = self + .event + .inputs + .clone() + .into_iter() + .filter_map(|x| if x.indexed {None} else {Some(x.name)}) + .collect(); for log in logs { - match self.event.parse_log(RawLog::from(log)) { - Ok(log) => { - for param in log.params { - if known_keys.contains(param.name.as_str()) { - let tokens = map.entry(param.name).or_default(); - tokens.push(param.value); + match self + .event + .decode_log_parts(log.topics().to_vec(), log.data().data.as_ref(), true) { + Ok(decoded) => { + for (idx, param) in decoded.indexed.into_iter().enumerate() { + map.entry(indexed_keys[idx].clone()).or_default().push(param); + } + for (idx, param) in decoded.body.into_iter().enumerate() { + map.entry(body_keys[idx].clone()).or_default().push(param); } } + Err(e) => eprintln!("error parsing log: {:?}", e), } - Err(e) => eprintln!("error parsing log: {:?}", e), - } } map } @@ -62,7 +83,7 @@ impl LogDecoder { pub fn make_series( &self, name: String, - data: Vec, + data: Vec, chunk_len: usize, u256_types: &[U256Type], column_encoding: &ColumnEncoding, @@ -70,7 +91,6 @@ impl LogDecoder { // This is a smooth brain way of doing this, but I can't think of a better way right now let mut ints: Vec = vec![]; let mut uints: Vec = vec![]; - let mut str_ints: Vec = vec![]; let mut u256s: Vec = vec![]; let mut i256s: Vec = vec![]; let mut bytes: Vec> = vec![]; @@ -79,68 +99,39 @@ impl LogDecoder { let mut strings: Vec = vec![]; // TODO: support array & tuple types - let param = self - .event - .inputs - .clone() - .into_iter() - .filter(|i| i.name == name) - .collect::>(); - let param = param.first(); - for token in data { match token { - Token::Address(a) => match column_encoding { - ColumnEncoding::Binary => bytes.push(a.to_fixed_bytes().into()), + DynSolValue::Address(a) => match column_encoding { + ColumnEncoding::Binary => bytes.push(a.to_vec()), ColumnEncoding::Hex => hexes.push(format!("{:?}", a)), }, - Token::FixedBytes(b) => match column_encoding { - ColumnEncoding::Binary => bytes.push(b), + DynSolValue::FixedBytes(b, _) => match column_encoding { + ColumnEncoding::Binary => bytes.push(b.to_vec()), ColumnEncoding::Hex => hexes.push(b.encode_hex()), }, - Token::Bytes(b) => match column_encoding { + DynSolValue::Bytes(b) => match column_encoding { ColumnEncoding::Binary => bytes.push(b), ColumnEncoding::Hex => hexes.push(b.encode_hex()), }, - Token::Uint(i) => match param { - Some(param) => match param.kind.clone() { - ParamType::Uint(size) => { - if size <= 64 { - uints.push(i.as_u64()) - } else { - u256s.push(i) - } - } - _ => str_ints.push(i.to_string()), - }, - None => match i.try_into() { - Ok(i) => ints.push(i), - Err(_) => str_ints.push(i.to_string()), - }, - }, - Token::Int(i) => { - let i = I256::from_raw(i); - match param { - Some(param) => match param.kind.clone() { - ParamType::Int(size) => { - if size <= 64 { - ints.push(i.as_i64()) - } else { - i256s.push(i) - } - } - _ => str_ints.push(i.to_string()), - }, - None => match i.try_into() { - Ok(i) => ints.push(i), - Err(_) => str_ints.push(i.to_string()), - }, + DynSolValue::Uint(i, size) => { + if size <= 64 { + uints.push(i.wrapping_to::()) + } else { + u256s.push(i) + } + } + DynSolValue::Int(i, size) => { + if size <= 64 { + ints.push(i.unchecked_into()); + } else { + i256s.push(i); } } - Token::Bool(b) => bools.push(b), - Token::String(s) => strings.push(s), - Token::Array(_) | Token::FixedArray(_) => {} - Token::Tuple(_) => {} + DynSolValue::Bool(b) => bools.push(b), + DynSolValue::String(s) => strings.push(s), + DynSolValue::Array(_) | DynSolValue::FixedArray(_) => {} + DynSolValue::Tuple(_) => {} + DynSolValue::Function(_) => {} } } let mixed_length_err = format!("could not parse column {}, mixed type", name); @@ -173,8 +164,6 @@ impl LogDecoder { Ok(series_vec) } else if !uints.is_empty() { Ok(vec![Series::new(name.as_str(), uints)]) - } else if !str_ints.is_empty() { - Ok(vec![Series::new(name.as_str(), str_ints)]) } else if !bytes.is_empty() { if bytes.len() != chunk_len { return Err(err(mixed_length_err)) diff --git a/crates/freeze/src/types/errors.rs b/crates/freeze/src/types/errors.rs index ebd9071b..fe3bae20 100644 --- a/crates/freeze/src/types/errors.rs +++ b/crates/freeze/src/types/errors.rs @@ -1,5 +1,5 @@ +use alloy::transports::{RpcError, TransportErrorKind}; /// error specifications -use ethers::prelude::*; use polars::prelude::*; use thiserror::Error; @@ -60,7 +60,7 @@ pub enum CollectError { /// Error related to provider operations #[error("Failed to get block: {0}")] - ProviderError(#[source] ProviderError), + ProviderError(#[source] RpcError), /// Error related to tokio task #[error("Task failed: {0}")] @@ -96,7 +96,7 @@ pub enum ParseError { /// Error related to provider operations #[error("Failed to get block: {0}")] - ProviderError(#[source] ProviderError), + ProviderError(#[source] RpcError), /// Parse int error #[error("Parsing error")] @@ -105,6 +105,10 @@ pub enum ParseError { /// MESC error #[error("MESC error: {:?}", .0)] MescError(mesc::MescError), + + /// Parse url error + #[error("Parsing url error: {0}")] + ParseUrlError(url::ParseError), } impl From for ParseError { diff --git a/crates/freeze/src/types/rpc_params.rs b/crates/freeze/src/types/rpc_params.rs index 2832b4c3..fc58f5b0 100644 --- a/crates/freeze/src/types/rpc_params.rs +++ b/crates/freeze/src/types/rpc_params.rs @@ -1,5 +1,8 @@ use crate::{err, CollectError}; -use ethers::prelude::*; +use alloy::{ + primitives::{Address, BlockNumber, B256}, + rpc::types::{Filter, FilterBlockOption}, +}; /// represents parameters for a single rpc call #[derive(Default, Clone, Debug)] @@ -74,22 +77,22 @@ impl Params { /// ethers block number pub fn ethers_block_number(&self) -> Result { - Ok(self.block_number()?.into()) + self.block_number() } /// ethers transaction - pub fn ethers_transaction_hash(&self) -> Result { - Ok(H256::from_slice(&self.transaction_hash()?)) + pub fn ethers_transaction_hash(&self) -> Result { + Ok(B256::from_slice(&self.transaction_hash()?)) } /// ethers address - pub fn ethers_address(&self) -> Result { - Ok(H160::from_slice(&self.address()?)) + pub fn ethers_address(&self) -> Result { + Ok(Address::from_slice(&self.address()?)) } /// ethers contract - pub fn ethers_contract(&self) -> Result { - Ok(H160::from_slice(&self.contract()?)) + pub fn ethers_contract(&self) -> Result { + Ok(Address::from_slice(&self.contract()?)) } /// log filter @@ -97,16 +100,33 @@ impl Params { let (start, end) = self.block_range()?; let block_option = FilterBlockOption::Range { from_block: Some(start.into()), to_block: Some(end.into()) }; - let filter = Filter { - block_option, - address: self.address.clone().map(|x| ValueOrArray::Value(H160::from_slice(&x))), - topics: [ - self.topic0.clone().map(|x| ValueOrArray::Value(Some(H256::from_slice(&x)))), - self.topic1.clone().map(|x| ValueOrArray::Value(Some(H256::from_slice(&x)))), - self.topic2.clone().map(|x| ValueOrArray::Value(Some(H256::from_slice(&x)))), - self.topic3.clone().map(|x| ValueOrArray::Value(Some(H256::from_slice(&x)))), - ], - }; + // let filter = Filter { + // block_option, + // address: self.address.clone().map(|x| ValueOrArray::Value(Address::from_slice(&x))), + // topics: [ + // self.topic0.clone().map(|x| ValueOrArray::Value(Some(B256::from_slice(&x)))), + // self.topic1.clone().map(|x| ValueOrArray::Value(Some(B256::from_slice(&x)))), + // self.topic2.clone().map(|x| ValueOrArray::Value(Some(B256::from_slice(&x)))), + // self.topic3.clone().map(|x| ValueOrArray::Value(Some(B2::from_slice(&x)))), + // ], + // }; + let mut filter = Filter::new(); + filter.block_option = block_option; + if self.address.is_some() { + filter = filter.address(Address::from_slice(&self.address.clone().unwrap())); + } + if self.topic0.is_some() { + filter = filter.event_signature(B256::from_slice(&self.topic0.clone().unwrap())); + } + if self.topic1.is_some() { + filter = filter.topic1(B256::from_slice(&self.topic1.clone().unwrap())); + } + if self.topic2.is_some() { + filter = filter.topic2(B256::from_slice(&self.topic2.clone().unwrap())); + } + if self.topic3.is_some() { + filter = filter.topic3(B256::from_slice(&self.topic3.clone().unwrap())); + } Ok(filter) } } diff --git a/crates/freeze/src/types/signatures.rs b/crates/freeze/src/types/signatures.rs index b41280ec..c5f4e73b 100644 --- a/crates/freeze/src/types/signatures.rs +++ b/crates/freeze/src/types/signatures.rs @@ -1,37 +1,62 @@ -use ethers::prelude::*; +use alloy::sol; + +sol! { + contract ERC20 { + function name() external pure returns (string memory); + function symbol() external pure returns (string memory); + function decimals() external pure returns (uint8); + function totalSupply() external view returns (uint); + function balanceOf(address owner) external view returns (uint); + function allowance(address owner, address spender) external view returns (uint); + + event Approval(address indexed owner, address indexed spender, uint value); + event Transfer(address indexed from, address indexed to, uint value); + } +} + +sol! { + contract ERC721 { + event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); + event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); + event ApprovalForAll(address indexed owner, address indexed operator, bool approved); + function name() external view returns (string memory); + function symbol() external view returns (string memory); + function tokenURI(uint256 tokenId) external view returns (string memory); + } +} -lazy_static::lazy_static! { +// lazy_static::lazy_static! { - /// function signature of FUNCTION_ERC20_NAME - pub static ref FUNCTION_ERC20_NAME: Vec = prefix_hex::decode("0x06fdde03").expect("Decoding failed"); +// /// function signature of FUNCTION_ERC20_NAME +// pub static ref FUNCTION_ERC20_NAME: Vec = prefix_hex::decode("0x06fdde03").expect("Decoding failed"); - /// function signature of FUNCTION_ERC20_SYMBOL - pub static ref FUNCTION_ERC20_SYMBOL: Vec = prefix_hex::decode("0x95d89b41").expect("Decoding failed"); +// /// function signature of FUNCTION_ERC20_SYMBOL +// pub static ref FUNCTION_ERC20_SYMBOL: Vec = prefix_hex::decode("0x95d89b41").expect("Decoding failed"); - /// function signature of FUNCTION_ERC20_DECIMALS - pub static ref FUNCTION_ERC20_DECIMALS: Vec = prefix_hex::decode("0x313ce567").expect("Decoding failed"); +// /// function signature of FUNCTION_ERC20_DECIMALS +// pub static ref FUNCTION_ERC20_DECIMALS: Vec = prefix_hex::decode("0x313ce567").expect("Decoding failed"); - /// function signature of FUNCTION_ERC20_BALANCE_OF - pub static ref FUNCTION_ERC20_BALANCE_OF: Vec = prefix_hex::decode("0x70a08231").expect("Decoding failed"); +// /// function signature of FUNCTION_ERC20_BALANCE_OF +// pub static ref FUNCTION_ERC20_BALANCE_OF: Vec = prefix_hex::decode("0x70a08231").expect("Decoding failed"); - /// function signature of FUNCTION_ERC20_TOTAL_SUPPLY - pub static ref FUNCTION_ERC20_TOTAL_SUPPLY: Vec = prefix_hex::decode("0x18160ddd").expect("Decoding failed"); +// /// function signature of FUNCTION_ERC20_TOTAL_SUPPLY +// pub static ref FUNCTION_ERC20_TOTAL_SUPPLY: Vec = prefix_hex::decode("0x18160ddd").expect("Decoding failed"); - /// event hash of EVENT_ERC20_TRANSFER - pub static ref EVENT_ERC20_TRANSFER: H256 = H256( - prefix_hex::decode("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") - .expect("Decoding failed"), - ); +// /// event hash of EVENT_ERC20_TRANSFER +// pub static ref EVENT_ERC20_TRANSFER: H256 = H256( +// prefix_hex::decode("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") +// .expect("Decoding failed"), +// ); - /// event hash of EVENT_ERC20_APPROVAL - pub static ref EVENT_ERC20_APPROVAL: H256 = H256( - prefix_hex::decode("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925") - .expect("Decoding failed"), - ); +// /// event hash of EVENT_ERC20_APPROVAL +// pub static ref EVENT_ERC20_APPROVAL: H256 = H256( +// prefix_hex::decode("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925") +// .expect("Decoding failed"), +// ); - /// event hash of EVENT_ERC721_TRANSFER - pub static ref EVENT_ERC721_TRANSFER: H256 = H256( - prefix_hex::decode("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") - .expect("Decoding failed"), - ); -} +// /// event hash of EVENT_ERC721_TRANSFER +// pub static ref EVENT_ERC721_TRANSFER: H256 = H256( +// prefix_hex::decode("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") +// .expect("Decoding failed"), +// ); +// } diff --git a/crates/freeze/src/types/sources.rs b/crates/freeze/src/types/sources.rs index 4c5107bf..c9a4aae6 100644 --- a/crates/freeze/src/types/sources.rs +++ b/crates/freeze/src/types/sources.rs @@ -1,6 +1,32 @@ use std::sync::Arc; -use ethers::prelude::*; +use alloy::{ + eips::BlockNumberOrTag, + primitives::{Address, BlockNumber, Bytes, TxHash, B256, U256}, + providers::{ + ext::{DebugApi, TraceApi}, + Provider, ProviderBuilder, RootProvider, + }, + rpc::types::{ + trace::{ + common::TraceResult, + geth::{ + AccountState, CallConfig, CallFrame, DefaultFrame, DiffMode, + GethDebugBuiltInTracerType, GethDebugTracerType, GethDebugTracingOptions, + GethTrace, PreStateConfig, PreStateFrame, + }, + parity::{ + LocalizedTransactionTrace, TraceResults, TraceResultsWithTransactionHash, TraceType, + }, + }, + Block, BlockTransactions, BlockTransactionsKind, Filter, Log, Transaction, + TransactionInput, TransactionReceipt, TransactionRequest, + }, + transports::{ + http::reqwest::Url, + BoxTransport, RpcError, TransportErrorKind, + }, +}; use governor::{ clock::DefaultClock, middleware::NoOpMiddleware, @@ -20,7 +46,7 @@ pub type RateLimiter = governor::RateLimiter, /// chain_id of network pub chain_id: u64, /// number of blocks per log request @@ -37,55 +63,6 @@ pub struct Source { pub labels: SourceLabels, } -/// A non-generic wrapper over different provider types for use as a trait object -#[derive(Clone, Debug)] -pub enum ProviderWrapper { - /// mock provider - MockProvider(Arc>), - /// http client - RetryClientHttp(Arc>>), - /// websocket client - WsClient(Arc>), - /// ipc client - IpcClient(Arc>), -} - -impl From> for ProviderWrapper { - fn from(value: Provider) -> ProviderWrapper { - ProviderWrapper::MockProvider(Arc::new(value)) - } -} - -impl From>> for ProviderWrapper { - fn from(value: Provider>) -> ProviderWrapper { - ProviderWrapper::RetryClientHttp(Arc::new(value)) - } -} - -impl From> for ProviderWrapper { - fn from(value: Provider) -> ProviderWrapper { - ProviderWrapper::WsClient(Arc::new(value)) - } -} - -impl From> for ProviderWrapper { - fn from(value: Provider) -> ProviderWrapper { - ProviderWrapper::IpcClient(Arc::new(value)) - } -} - -/// extract the provider from a source and run specified method -#[macro_export] -macro_rules! source_provider { - ($source:expr, $method:ident($($arg:expr),*)) => { - match &$source.provider { - ProviderWrapper::MockProvider(provider) => provider.$method($($arg),*), - ProviderWrapper::RetryClientHttp(provider) => provider.$method($($arg),*), - ProviderWrapper::WsClient(provider) => provider.$method($($arg),*), - ProviderWrapper::IpcClient(provider) => provider.$method($($arg),*), - } - }; -} impl Source { /// Returns all receipts for a block. @@ -95,31 +72,32 @@ impl Source { block: &Block, ) -> Result> { let block_number = - block.number.ok_or(CollectError::CollectError("no block number".to_string()))?.as_u64(); - if let Ok(receipts) = self.get_block_receipts(block_number).await { + block.header.number.ok_or(CollectError::CollectError("no block number".to_string()))?; + if let Ok(Some(receipts)) = self.get_block_receipts(block_number).await { return Ok(receipts); } - self.get_tx_receipts(&block.transactions).await + self.get_tx_receipts(block.transactions.clone()).await } /// Returns all receipts for vector of transactions using `eth_getTransactionReceipt` pub async fn get_tx_receipts( &self, - transactions: &Vec, + transactions: BlockTransactions, ) -> Result> { let mut tasks = Vec::new(); - for tx in transactions { + for tx in transactions.as_transactions().unwrap() { let tx_hash = tx.hash; let source = self.clone(); - let task = task::spawn(async move { - match source.get_transaction_receipt(tx_hash).await? { - Some(receipt) => Ok(receipt), - None => { - Err(CollectError::CollectError("could not find tx receipt".to_string())) + let task: task::JoinHandle> = + task::spawn(async move { + match source.get_transaction_receipt(tx_hash).await? { + Some(receipt) => Ok(receipt), + None => { + Err(CollectError::CollectError("could not find tx receipt".to_string())) + } } - } - }); + }); tasks.push(task); } let mut receipts = Vec::new(); @@ -144,31 +122,21 @@ const DEFAULT_MAX_CONCURRENT_REQUESTS: u64 = 100; impl Source { /// initialize source pub async fn init(rpc_url: Option) -> Result { - let rpc_url = parse_rpc_url(rpc_url); - let provider = Provider::>::new_client( - &rpc_url, - DEFAULT_MAX_RETRIES, - DEFAULT_INTIAL_BACKOFF, - ) - .map_err(|_| CollectError::RPCError("could not connect to provider".to_string()))?; + let rpc_url: String = parse_rpc_url(rpc_url); + let parsed_rpc_url: Url = rpc_url.parse().expect("rpc url is not valid"); + let provider = ProviderBuilder::new().on_http(parsed_rpc_url.clone()); let chain_id = provider - .get_chainid() + .get_chain_id() .await - .map_err(|_| CollectError::RPCError("could not get chain_id".to_string()))? - .as_u64(); + .map_err(|_| CollectError::RPCError("could not get chain_id".to_string()))?; let rate_limiter = None; let semaphore = None; - let provider = Provider::>::new_client( - &rpc_url, - DEFAULT_MAX_RETRIES, - DEFAULT_INTIAL_BACKOFF, - ) - .map_err(|_| CollectError::RPCError("could not connect to provider".to_string()))?; + let provider = ProviderBuilder::new().on_http(parsed_rpc_url); let source = Source { - provider: ProviderWrapper::RetryClientHttp(Arc::new(provider)), + provider: provider.boxed(), chain_id, inner_request_size: DEFAULT_INNER_REQUEST_SIZE, max_concurrent_chunks: Some(DEFAULT_MAX_CONCURRENT_CHUNKS), @@ -251,7 +219,7 @@ pub struct SourceLabels { #[derive(Debug)] pub struct Fetcher

{ /// provider data source - pub provider: Provider

, + pub provider: RootProvider

, /// semaphore for controlling concurrency pub semaphore: Option, /// rate limiter for controlling request rate @@ -265,19 +233,17 @@ impl Source { /// Returns an array (possibly empty) of logs that match the filter pub async fn get_logs(&self, filter: &Filter) -> Result> { let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, get_logs(filter)).await) + Self::map_err(self.provider.get_logs(filter).await) } /// Replays all transactions in a block returning the requested traces for each transaction pub async fn trace_replay_block_transactions( &self, - block: BlockNumber, + block: BlockNumberOrTag, trace_types: Vec, - ) -> Result> { + ) -> Result> { let _permit = self.permit_request().await; - Self::map_err( - source_provider!(self, trace_replay_block_transactions(block, trace_types)).await, - ) + Self::map_err(self.provider.trace_replay_block_transactions(block, &trace_types).await) } /// Get state diff traces of block @@ -285,23 +251,25 @@ impl Source { &self, block: u32, include_transaction_hashes: bool, - ) -> Result<(Option, Vec>>, Vec)> { + ) -> Result<(Option, Vec>>, Vec)> { // get traces let result = self .trace_replay_block_transactions( - block.into(), - vec![ethers::types::TraceType::StateDiff], + BlockNumberOrTag::Number(block as u64), + vec![TraceType::StateDiff], ) .await?; // get transactions let txs = if include_transaction_hashes { - self.get_block(block as u64) + self.get_block(block as u64, BlockTransactionsKind::Hashes) .await? .ok_or(CollectError::CollectError("could not find block".to_string()))? .transactions + .as_transactions() + .unwrap() .iter() - .map(|tx| Some(tx.0.to_vec())) + .map(|tx| Some(tx.hash.to_vec())) .collect() } else { vec![None; result.len()] @@ -314,9 +282,12 @@ impl Source { pub async fn trace_block_vm_traces( &self, block: u32, - ) -> Result<(Option, Option>, Vec)> { + ) -> Result<(Option, Option>, Vec)> { let result = self - .trace_replay_block_transactions(block.into(), vec![ethers::types::TraceType::VmTrace]) + .trace_replay_block_transactions( + BlockNumberOrTag::Number(block as u64), + vec![TraceType::VmTrace], + ) .await; Ok((Some(block), None, result?)) } @@ -326,20 +297,20 @@ impl Source { &self, tx_hash: TxHash, trace_types: Vec, - ) -> Result { + ) -> Result { let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, trace_replay_transaction(tx_hash, trace_types)).await) + Self::map_err(self.provider.trace_replay_transaction(tx_hash, &trace_types).await) } /// Get state diff traces of transaction pub async fn trace_transaction_state_diffs( &self, transaction_hash: Vec, - ) -> Result<(Option, Vec>>, Vec)> { + ) -> Result<(Option, Vec>>, Vec)> { let result = self .trace_replay_transaction( - H256::from_slice(&transaction_hash), - vec![ethers::types::TraceType::StateDiff], + B256::from_slice(&transaction_hash), + vec![TraceType::StateDiff], ) .await; Ok((None, vec![Some(transaction_hash)], vec![result?])) @@ -349,20 +320,17 @@ impl Source { pub async fn trace_transaction_vm_traces( &self, transaction_hash: Vec, - ) -> Result<(Option, Option>, Vec)> { + ) -> Result<(Option, Option>, Vec)> { let result = self - .trace_replay_transaction( - H256::from_slice(&transaction_hash), - vec![ethers::types::TraceType::VmTrace], - ) + .trace_replay_transaction(B256::from_slice(&transaction_hash), vec![TraceType::VmTrace]) .await; Ok((None, Some(transaction_hash), vec![result?])) } /// Gets the transaction with transaction_hash - pub async fn get_transaction(&self, tx_hash: TxHash) -> Result> { + pub async fn get_transaction_by_hash(&self, tx_hash: TxHash) -> Result> { let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, get_transaction(tx_hash)).await) + Self::map_err(self.provider.get_transaction_by_hash(tx_hash).await) } /// Gets the transaction receipt with transaction_hash @@ -371,48 +339,57 @@ impl Source { tx_hash: TxHash, ) -> Result> { let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, get_transaction_receipt(tx_hash)).await) + Self::map_err(self.provider.get_transaction_receipt(tx_hash).await) } /// Gets the block at `block_num` (transaction hashes only) - pub async fn get_block(&self, block_num: u64) -> Result>> { + pub async fn get_block( + &self, + block_num: u64, + kind: BlockTransactionsKind, + ) -> Result> { let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, get_block(block_num)).await) + Self::map_err(self.provider.get_block(block_num.into(), kind).await) } /// Gets the block at `block_num` (transaction hashes only) - pub async fn get_block_by_hash(&self, block_hash: H256) -> Result>> { - let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, get_block(BlockId::Hash(block_hash))).await) - } - - /// Gets the block at `block_num` (full transactions included) - pub async fn get_block_with_txs(&self, block_num: u64) -> Result>> { + pub async fn get_block_by_hash( + &self, + block_hash: B256, + kind: BlockTransactionsKind, + ) -> Result> { let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, get_block_with_txs(block_num)).await) + Self::map_err(self.provider.get_block(block_hash.into(), kind).await) } /// Returns all receipts for a block. /// Note that this uses the `eth_getBlockReceipts` method which is not supported by all nodes. /// Consider using `FetcherExt::get_tx_receipts_in_block` which takes a block, and falls back to /// `eth_getTransactionReceipt` if `eth_getBlockReceipts` is not supported. - pub async fn get_block_receipts(&self, block_num: u64) -> Result> { + pub async fn get_block_receipts( + &self, + block_num: u64, + ) -> Result>> { let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, get_block_receipts(block_num)).await) + Self::map_err(self.provider.get_block_receipts(block_num.into()).await) } /// Returns traces created at given block - pub async fn trace_block(&self, block_num: BlockNumber) -> Result> { + pub async fn trace_block( + &self, + block_num: BlockNumber, + ) -> Result> { let _permit = self.permit_request().await; - Self::map_err(source_provider!(self, trace_block(block_num)).await) + Self::map_err(self.provider.trace_block(block_num.into()).await) } /// Returns all traces of a given transaction - pub async fn trace_transaction(&self, tx_hash: TxHash) -> Result> { + pub async fn trace_transaction( + &self, + tx_hash: TxHash, + ) -> Result> { let _permit = self.permit_request().await; - source_provider!(self, trace_transaction(tx_hash)) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.trace_transaction(tx_hash).await) } /// Deprecated @@ -422,10 +399,7 @@ impl Source { block_number: BlockNumber, ) -> Result { let _permit = self.permit_request().await; - let tx: ethers::core::types::transaction::eip2718::TypedTransaction = transaction.into(); - source_provider!(self, call(&tx, Some(block_number.into()))) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.call(&transaction).block(block_number.into()).await) } /// Returns traces for given call data @@ -434,116 +408,121 @@ impl Source { transaction: TransactionRequest, trace_type: Vec, block_number: Option, - ) -> Result { + ) -> Result { let _permit = self.permit_request().await; - source_provider!(self, trace_call(transaction, trace_type, block_number)) - .await - .map_err(CollectError::ProviderError) + if let Some(bn) = block_number { + return Self::map_err( + self.provider.trace_call(&transaction, &trace_type).block_id(bn.into()).await, + ); + } + Self::map_err(self.provider.trace_call(&transaction, &trace_type).await) } /// Get nonce of address pub async fn get_transaction_count( &self, - address: H160, + address: Address, block_number: BlockNumber, - ) -> Result { + ) -> Result { let _permit = self.permit_request().await; - source_provider!(self, get_transaction_count(address, Some(block_number.into()))) - .await - .map_err(CollectError::ProviderError) + Self::map_err( + self.provider.get_transaction_count(address).block_id(block_number.into()).await, + ) } /// Get code at address - pub async fn get_balance(&self, address: H160, block_number: BlockNumber) -> Result { + pub async fn get_balance(&self, address: Address, block_number: BlockNumber) -> Result { let _permit = self.permit_request().await; - source_provider!(self, get_balance(address, Some(block_number.into()))) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.get_balance(address).block_id(block_number.into()).await) } /// Get code at address - pub async fn get_code(&self, address: H160, block_number: BlockNumber) -> Result { + pub async fn get_code(&self, address: Address, block_number: BlockNumber) -> Result { let _permit = self.permit_request().await; - source_provider!(self, get_code(address, Some(block_number.into()))) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.get_code_at(address).block_id(block_number.into()).await) } /// Get stored data at given location pub async fn get_storage_at( &self, - address: H160, - slot: H256, + address: Address, + slot: U256, block_number: BlockNumber, - ) -> Result { + ) -> Result { let _permit = self.permit_request().await; - source_provider!(self, get_storage_at(address, slot, Some(block_number.into()))) - .await - .map_err(CollectError::ProviderError) + Self::map_err( + self.provider.get_storage_at(address, slot).block_id(block_number.into()).await, + ) } /// Get the block number - pub async fn get_block_number(&self) -> Result { - Self::map_err(source_provider!(self, get_block_number()).await) + pub async fn get_block_number(&self) -> Result { + Self::map_err(self.provider.get_block_number().await) } // extra helpers below /// block number of transaction pub async fn get_transaction_block_number(&self, transaction_hash: Vec) -> Result { - let block = self.get_transaction(H256::from_slice(&transaction_hash)).await?; + let block = self.get_transaction_by_hash(B256::from_slice(&transaction_hash)).await?; let block = block.ok_or(CollectError::CollectError("could not get block".to_string()))?; Ok(block .block_number .ok_or(CollectError::CollectError("could not get block number".to_string()))? - .as_u32()) + as u32) } /// block number of transaction pub async fn get_transaction_logs(&self, transaction_hash: Vec) -> Result> { Ok(self - .get_transaction_receipt(H256::from_slice(&transaction_hash)) + .get_transaction_receipt(B256::from_slice(&transaction_hash)) .await? .ok_or(CollectError::CollectError("transaction receipt not found".to_string()))? - .logs) + .inner + .logs() + .to_vec()) } /// Return output data of a contract call pub async fn call2( &self, - address: H160, + address: Address, call_data: Vec, block_number: BlockNumber, ) -> Result { let transaction = TransactionRequest { to: Some(address.into()), - data: Some(call_data.into()), + input: TransactionInput::new(call_data.into()), ..Default::default() }; let _permit = self.permit_request().await; - let tx: ethers::core::types::transaction::eip2718::TypedTransaction = transaction.into(); - source_provider!(self, call(&tx, Some(block_number.into()))) - .await - .map_err(CollectError::ProviderError) + Self::map_err(self.provider.call(&transaction).block(block_number.into()).await) } /// Return output data of a contract call pub async fn trace_call2( &self, - address: H160, + address: Address, call_data: Vec, trace_type: Vec, block_number: Option, - ) -> Result { + ) -> Result { let transaction = TransactionRequest { to: Some(address.into()), - data: Some(call_data.into()), + input: TransactionInput::new(call_data.into()), ..Default::default() }; let _permit = self.permit_request().await; - source_provider!(self, trace_call(transaction, trace_type, block_number)) - .await - .map_err(CollectError::ProviderError) + if block_number.is_some() { + Self::map_err( + self.provider + .trace_call(&transaction, &trace_type) + .block_id(block_number.unwrap().into()) + .await, + ) + } else { + Self::map_err(self.provider.trace_call(&transaction, &trace_type).await) + } } /// get geth debug block traces @@ -552,19 +531,28 @@ impl Source { block_number: u32, options: GethDebugTracingOptions, include_transaction_hashes: bool, - ) -> Result<(Option, Vec>>, Vec)> { + ) -> Result<(Option, Vec>>, Vec>)> { let traces = { let _permit = self.permit_request().await; - source_provider!(self, debug_trace_block_by_number(Some(block_number.into()), options)) - .await - .map_err(CollectError::ProviderError)? + Self::map_err( + self.provider + .debug_trace_block_by_number( + BlockNumberOrTag::Number(block_number.into()), + options, + ) + .await, + )? }; let txs = if include_transaction_hashes { - match self.get_block(block_number as u64).await? { - Some(block) => { - block.transactions.iter().map(|x| Some(x.as_bytes().to_vec())).collect() - } + match self.get_block(block_number as u64, BlockTransactionsKind::Hashes).await? { + Some(block) => block + .transactions + .as_hashes() + .unwrap() + .iter() + .map(|x| Some(x.to_vec())) + .collect(), None => { return Err(CollectError::CollectError( "could not get block for txs".to_string(), @@ -593,8 +581,21 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Unknown(value) => calls.push(value), - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::JS(value) => calls.push(value), + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))) + } } } Ok((block, txs, calls)) @@ -613,8 +614,21 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::Default(frame)) => calls.push(frame), - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::Default(frame) => calls.push(frame), + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "inalid trace result in tx {:?}: {}", + tx_hash, error + ))); + } } } Ok((block, txs, calls)) @@ -634,11 +648,27 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::FourByteTracer(FourByteFrame(frame))) => { - calls.push(frame) + // GethTrace::Known(GethTraceFrame::FourByteTracer(FourByteFrame(frame))) => { + // calls.push(frame) + // } + // GethTrace::Known(GethTraceFrame::NoopTracer(_)) => {} + // _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::FourByteTracer(frame) => calls.push(frame.0), + GethTrace::NoopTracer(_) => {} + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))); } - GethTrace::Known(GethTraceFrame::NoopTracer(_)) => {} - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } Ok((block, txs, calls)) @@ -649,7 +679,7 @@ impl Source { &self, block_number: u32, include_transaction_hashes: bool, - ) -> Result<(Option, Vec>>, Vec>)> { + ) -> Result<(Option, Vec>>, Vec>)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer); let options = GethDebugTracingOptions { tracer: Some(tracer), ..Default::default() }; let (block, txs, traces) = @@ -658,10 +688,25 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Default( - PreStateMode(frame), - ))) => calls.push(frame), - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + // GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Default( + // PreStateMode(frame), + // ))) => calls.push(frame), + // _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::PreStateTracer(PreStateFrame::Default(frame)) => calls.push(frame.0), + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))); + } } } Ok((block, txs, calls)) @@ -674,22 +719,37 @@ impl Source { include_transaction_hashes: bool, ) -> Result<(Option, Vec>>, Vec)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::CallTracer); - let config = GethDebugTracerConfig::BuiltInTracer( - GethDebugBuiltInTracerConfig::CallTracer(CallConfig { ..Default::default() }), - ); - let options = GethDebugTracingOptions { - tracer: Some(tracer), - tracer_config: Some(config), - ..Default::default() - }; + // let config = GethDebugTracerConfig::BuiltInTracer( + // GethDebugBuiltInTracerConfig::CallTracer(CallConfig { ..Default::default() }), + // ); + let options = GethDebugTracingOptions::default() + .with_tracer(tracer) + .with_call_config(CallConfig::default()); let (block, txs, traces) = self.geth_debug_trace_block(block_number, options, include_transaction_hashes).await?; let mut calls = Vec::new(); for trace in traces.into_iter() { + // match trace { + // GethTrace::Known(GethTraceFrame::CallTracer(call_frame)) => + // calls.push(call_frame), _ => return + // Err(CollectError::CollectError("invalid trace result".to_string())), } match trace { - GethTrace::Known(GethTraceFrame::CallTracer(call_frame)) => calls.push(call_frame), - _ => return Err(CollectError::CollectError("invalid trace result".to_string())), + TraceResult::Success { result, tx_hash } => match result { + GethTrace::CallTracer(frame) => calls.push(frame), + _ => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))) + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))); + } } } Ok((block, txs, calls)) @@ -702,30 +762,37 @@ impl Source { include_transaction_hashes: bool, ) -> Result<(Option, Vec>>, Vec)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer); - let config = GethDebugTracerConfig::BuiltInTracer( - GethDebugBuiltInTracerConfig::PreStateTracer(PreStateConfig { diff_mode: Some(true) }), - ); - let options = GethDebugTracingOptions { - tracer: Some(tracer), - tracer_config: Some(config), - ..Default::default() - }; + // let config = GethDebugTracerConfig::BuiltInTracer( + // GethDebugBuiltInTracerConfig::PreStateTracer(PreStateConfig { diff_mode: Some(true) + // }), + let options = GethDebugTracingOptions::default() + .with_prestate_config(PreStateConfig { diff_mode: Some(true) }) + .with_tracer(tracer); let (block, txs, traces) = self.geth_debug_trace_block(block_number, options, include_transaction_hashes).await?; let mut diffs = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Diff(diff))) => { - diffs.push(diff) - } - GethTrace::Unknown(ethers::utils::__serde_json::Value::Object(map)) => { - let diff = parse_geth_diff_object(map)?; - diffs.push(diff) - } - _ => { - println!("{:?}", trace); - return Err(CollectError::CollectError("invalid trace result".to_string())); + TraceResult::Success { result, tx_hash } => match result { + GethTrace::PreStateTracer(PreStateFrame::Diff(diff)) => diffs.push(diff), + GethTrace::JS(serde_json::Value::Object(map)) => { + let diff = parse_geth_diff_object(map)?; + diffs.push(diff); + } + _ => { + println!("{:?}", result); + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}", + tx_hash + ))); + } + }, + TraceResult::Error { error, tx_hash } => { + return Err(CollectError::CollectError(format!( + "invalid trace result in tx {:?}: {}", + tx_hash, error + ))); } } } @@ -739,19 +806,20 @@ impl Source { options: GethDebugTracingOptions, include_block_number: bool, ) -> Result<(Option, Vec>>, Vec)> { - let ethers_tx = H256::from_slice(&transaction_hash); + let ethers_tx = B256::from_slice(&transaction_hash); let trace = { let _permit = self.permit_request().await; - source_provider!(self, debug_trace_transaction(ethers_tx, options)) + self.provider + .debug_trace_transaction(ethers_tx, options) .await .map_err(CollectError::ProviderError)? }; let traces = vec![trace]; let block_number = if include_block_number { - match self.get_transaction(ethers_tx).await? { - Some(tx) => tx.block_number.map(|x| x.as_u32()), + match self.get_transaction_by_hash(ethers_tx).await? { + Some(tx) => tx.block_number.map(|x| x as u32), None => { return Err(CollectError::CollectError( "could not get block for txs".to_string(), @@ -781,7 +849,7 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Unknown(value) => calls.push(value), + GethTrace::JS(value) => calls.push(value), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -802,7 +870,7 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::Default(frame)) => calls.push(frame), + GethTrace::Default(frame) => calls.push(frame), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -824,9 +892,7 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::FourByteTracer(FourByteFrame(frame))) => { - calls.push(frame) - } + GethTrace::FourByteTracer(frame) => calls.push(frame.0), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -838,7 +904,7 @@ impl Source { &self, transaction_hash: Vec, include_block_number: bool, - ) -> Result<(Option, Vec>>, Vec>)> { + ) -> Result<(Option, Vec>>, Vec>)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer); let options = GethDebugTracingOptions { tracer: Some(tracer), ..Default::default() }; let (block, txs, traces) = self @@ -848,9 +914,7 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Default( - PreStateMode(frame), - ))) => calls.push(frame), + GethTrace::PreStateTracer(PreStateFrame::Default(frame)) => calls.push(frame.0), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -864,14 +928,12 @@ impl Source { include_block_number: bool, ) -> Result<(Option, Vec>>, Vec)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::CallTracer); - let config = GethDebugTracerConfig::BuiltInTracer( - GethDebugBuiltInTracerConfig::CallTracer(CallConfig { ..Default::default() }), - ); - let options = GethDebugTracingOptions { - tracer: Some(tracer), - tracer_config: Some(config), - ..Default::default() - }; + // let config = GethDebugTracerConfig::BuiltInTracer( + // GethDebugBuiltInTracerConfig::CallTracer(CallConfig { ..Default::default() }), + // ); + let options = GethDebugTracingOptions::default() + .with_tracer(tracer) + .with_call_config(CallConfig::default()); let (block, txs, traces) = self .geth_debug_trace_transaction(transaction_hash, options, include_block_number) .await?; @@ -879,7 +941,9 @@ impl Source { let mut calls = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::CallTracer(call_frame)) => calls.push(call_frame), + // GethTrace::Known(GethTraceFrame::CallTracer(call_frame)) => + // calls.push(call_frame), + GethTrace::CallTracer(frame) => calls.push(frame), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -893,14 +957,12 @@ impl Source { include_transaction_hashes: bool, ) -> Result<(Option, Vec>>, Vec)> { let tracer = GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer); - let config = GethDebugTracerConfig::BuiltInTracer( - GethDebugBuiltInTracerConfig::PreStateTracer(PreStateConfig { diff_mode: Some(true) }), - ); - let options = GethDebugTracingOptions { - tracer: Some(tracer), - tracer_config: Some(config), - ..Default::default() - }; + // let config = GethDebugTracerConfig::BuiltInTracer( + // GethDebugBuiltInTracerConfig::PreStateTracer(PreStateConfig { diff_mode: Some(true) + // }), ); + let options = GethDebugTracingOptions::default() + .with_tracer(tracer) + .with_prestate_config(PreStateConfig { diff_mode: Some(true) }); let (block, txs, traces) = self .geth_debug_trace_transaction(transaction_hash, options, include_transaction_hashes) .await?; @@ -908,9 +970,10 @@ impl Source { let mut diffs = Vec::new(); for trace in traces.into_iter() { match trace { - GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Diff(diff))) => { - diffs.push(diff) - } + // GethTrace::Known(GethTraceFrame::PreStateTracer(PreStateFrame::Diff(diff))) => { + // diffs.push(diff) + // } + GethTrace::PreStateTracer(PreStateFrame::Diff(diff)) => diffs.push(diff), _ => return Err(CollectError::CollectError("invalid trace result".to_string())), } } @@ -930,7 +993,7 @@ impl Source { permit } - fn map_err(res: ::core::result::Result) -> Result { + fn map_err(res: ::core::result::Result>) -> Result { res.map_err(CollectError::ProviderError) } } @@ -938,12 +1001,10 @@ impl Source { use crate::err; use std::collections::BTreeMap; -fn parse_geth_diff_object( - map: ethers::utils::__serde_json::Map, -) -> Result { - let pre: BTreeMap = serde_json::from_value(map["pre"].clone()) +fn parse_geth_diff_object(map: serde_json::Map) -> Result { + let pre: BTreeMap = serde_json::from_value(map["pre"].clone()) .map_err(|_| err("cannot deserialize pre diff"))?; - let post: BTreeMap = serde_json::from_value(map["post"].clone()) + let post: BTreeMap = serde_json::from_value(map["post"].clone()) .map_err(|_| err("cannot deserialize pre diff"))?; Ok(DiffMode { pre, post }) diff --git a/crates/to_df/src/lib.rs b/crates/to_df/src/lib.rs index 97f10c2b..6ab93323 100644 --- a/crates/to_df/src/lib.rs +++ b/crates/to_df/src/lib.rs @@ -98,47 +98,47 @@ pub fn to_df(attrs: TokenStream, input: TokenStream) -> TokenStream { } } - use ethers_core::abi::ParamType; - // Write columns even if there are no values decoded - indicates empty dataframe let chunk_len = self.n_rows; if self.event_cols.is_empty() { for param in decoder.event.inputs.iter() { let name = "event__".to_string() + param.name.as_str(); let name = name.as_str(); - match param.kind { - ParamType::Address => { + let ty = DynSolType::parse(¶m.ty).unwrap(); + match ty { + DynSolType::Address => { match schema.binary_type { ColumnEncoding::Binary => cols.push(Series::new(name, Vec::>::new())), ColumnEncoding::Hex => cols.push(Series::new(name, Vec::::new())), } }, - ParamType::Bytes => { + DynSolType::Bytes => { match schema.binary_type { ColumnEncoding::Binary => cols.push(Series::new(name, Vec::>::new())), ColumnEncoding::Hex => cols.push(Series::new(name, Vec::::new())), } }, - ParamType::Int(bits) => { + DynSolType::Int(bits) => { if bits <= 64 { cols.push(Series::new(name, Vec::::new())) } else { create_empty_u256_columns(&mut cols, name, &u256_types, &schema.binary_type) } }, - ParamType::Uint(bits) => { + DynSolType::Uint(bits) => { if bits <= 64 { cols.push(Series::new(name, Vec::::new())) } else { create_empty_u256_columns(&mut cols, name, &u256_types, &schema.binary_type) } }, - ParamType::Bool => cols.push(Series::new(name, Vec::::new())), - ParamType::String => cols.push(Series::new(name, Vec::::new())), - ParamType::Array(_) => return Err(err("could not generate Array column")), - ParamType::FixedBytes(_) => return Err(err("could not generate FixedBytes column")), - ParamType::FixedArray(_, _) => return Err(err("could not generate FixedArray column")), - ParamType::Tuple(_) => return Err(err("could not generate Tuple column")), + DynSolType::Bool => cols.push(Series::new(name, Vec::::new())), + DynSolType::String => cols.push(Series::new(name, Vec::::new())), + DynSolType::Array(_) => return Err(err("could not generate Array column")), + DynSolType::FixedBytes(_) => return Err(err("could not generate FixedBytes column")), + DynSolType::FixedArray(_, _) => return Err(err("could not generate FixedArray column")), + DynSolType::Tuple(_) => return Err(err("could not generate Tuple column")), + DynSolType::Function => return Err(err("could not generate Function column")), _ => (), } }