diff --git a/Cargo.lock b/Cargo.lock index c0d85cee..93e37519 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,9 +46,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ba1c79677c9ce51c8d45e20845b05e6fb070ea2c863fba03ad6af2c778474bd" +checksum = "b2683873c2744f6cd72d0db51bb74fee9ed310e0476a140bdc19e82b407d8a0a" dependencies = [ "alloy-consensus", "alloy-contract", @@ -81,12 +81,12 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da374e868f54c7f4ad2ad56829827badca388efd645f8cf5fccc61c2b5343504" +checksum = "c28ddd17ffb7e4d66ef3a84e7b179072a9320cdc4b26c7f6f44cbf1081631b36" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.3", "alloy-rlp", "alloy-serde", "c-kzg", @@ -95,14 +95,15 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc6957ff706f9e5f6fd42f52a93e4bce476b726c92d077b348de28c4a76730c" +checksum = "a69257e2ffe1a9f15f20a89cd54d1ca758468c5b3e87979191b8b5fc24d39b37" dependencies = [ "alloy-dyn-abi", - "alloy-json-abi", + "alloy-json-abi 0.8.3", "alloy-network", - "alloy-primitives", + "alloy-network-primitives", + "alloy-primitives 0.8.3", "alloy-provider", "alloy-pubsub", "alloy-rpc-types-eth", @@ -115,25 +116,25 @@ dependencies = [ [[package]] name = "alloy-core" -version = "0.7.7" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529fc6310dc1126c8de51c376cbc59c79c7f662bd742be7dc67055d5421a81b4" +checksum = "88b095eb0533144b4497e84a9cc3e44a5c2e3754a3983c0376a55a2f9183a53e" dependencies = [ "alloy-dyn-abi", - "alloy-json-abi", - "alloy-primitives", + "alloy-json-abi 0.8.3", + "alloy-primitives 0.8.3", "alloy-sol-types", ] [[package]] name = "alloy-dyn-abi" -version = "0.7.7" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413902aa18a97569e60f679c23f46a18db1656d87ab4d4e49d0e1e52042f66df" +checksum = "4004925bff5ba0a11739ae84dbb6601a981ea692f3bd45b626935ee90a6b8471" dependencies = [ - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-type-parser", + "alloy-json-abi 0.8.3", + "alloy-primitives 0.8.3", + "alloy-sol-type-parser 0.8.3", "alloy-sol-types", "const-hex", "itoa", @@ -142,17 +143,42 @@ dependencies = [ "winnow 0.6.18", ] +[[package]] +name = "alloy-eip2930" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" +dependencies = [ + "alloy-primitives 0.8.3", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eip7702" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d319bb544ca6caeab58c39cea8921c55d924d4f68f2c60f24f914673f9a74a" +dependencies = [ + "alloy-primitives 0.8.3", + "alloy-rlp", + "k256", + "serde", +] + [[package]] name = "alloy-eips" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76ecab54890cdea1e4808fc0891c7e6cfcf71fe1a9fe26810c7280ef768f4ed" +checksum = "2f6c5c0a383f14519531cf58d8440e74f10b938e289f803af870be6f79223110" dependencies = [ - "alloy-primitives", + "alloy-eip2930", + "alloy-eip7702", + "alloy-primitives 0.8.3", "alloy-rlp", "alloy-serde", "c-kzg", - "derive_more", + "derive_more 1.0.0", "once_cell", "serde", "sha2", @@ -160,11 +186,11 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca15afde1b6d15e3fc1c97421262b1bbb37aee45752e3c8b6d6f13f776554ff" +checksum = "7db0ddc76399bb1a4010f630767f027cafe65ab406cfee8e6040128cd65e8325" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.3", "alloy-serde", "serde", ] @@ -175,19 +201,32 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc05b04ac331a9f07e3a4036ef7926e49a8bf84a99a1ccfc7e2ab55a5fcbb372" dependencies = [ - "alloy-primitives", - "alloy-sol-type-parser", + "alloy-primitives 0.7.7", + "alloy-sol-type-parser 0.7.7", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-abi" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9996daf962fd0a90d3c93b388033228865953b92de7bb1959b891d78750a4091" +dependencies = [ + "alloy-primitives 0.8.3", + "alloy-sol-type-parser 0.8.3", "serde", "serde_json", ] [[package]] name = "alloy-json-rpc" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d6f34930b7e3e2744bcc79056c217f00cb2abb33bc5d4ff88da7623c5bb078b" +checksum = "7111af869909275cffc5c84d16b6c892d6d512773e40cbe83187d0b9c5235e91" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.3", + "alloy-sol-types", "serde", "serde_json", "thiserror", @@ -196,14 +235,15 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f6895fc31b48fa12306ef9b4f78b7764f8bd6d7d91cdb0a40e233704a0f23f" +checksum = "342028392a2d5050b7b93dd32a0715d3b3b9ce30072ecb69a35dd4895c005495" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-json-rpc", - "alloy-primitives", + "alloy-network-primitives", + "alloy-primitives 0.8.3", "alloy-rpc-types-eth", "alloy-serde", "alloy-signer", @@ -214,6 +254,18 @@ dependencies = [ "thiserror", ] +[[package]] +name = "alloy-network-primitives" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e66d78c049dcadd065a926a9f2d9a9b2b10981a7889449e694fac7bccd2c6f" +dependencies = [ + "alloy-eips", + "alloy-primitives 0.8.3", + "alloy-serde", + "serde", +] + [[package]] name = "alloy-primitives" version = "0.7.7" @@ -224,7 +276,29 @@ dependencies = [ "bytes", "cfg-if", "const-hex", - "derive_more", + "derive_more 0.99.18", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-primitives" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411aff151f2a73124ee473708e82ed51b2535f68928b6a1caa8bc1246ae6f7cd" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more 1.0.0", "hex-literal", "itoa", "k256", @@ -238,16 +312,17 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c538bfa893d07e27cb4f3c1ab5f451592b7c526d511d62b576a2ce59e146e4a" +checksum = "79f14ccc2a3c575cb17b1b4af8c772cf9b5b93b7ce7047d6640e53954abb558d" dependencies = [ "alloy-chains", "alloy-consensus", "alloy-eips", "alloy-json-rpc", "alloy-network", - "alloy-primitives", + "alloy-network-primitives", + "alloy-primitives 0.8.3", "alloy-pubsub", "alloy-rpc-client", "alloy-rpc-types-eth", @@ -267,6 +342,7 @@ dependencies = [ "reqwest 0.12.7", "serde", "serde_json", + "thiserror", "tokio", "tracing", "url", @@ -274,12 +350,12 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a7341322d9bc0e49f6e9fd9f2eb8e30f73806f2dd12cbb3d6bab2694c921f87" +checksum = "34b9f5e85120aab30b8da23354592f7bd2b208d33d3204ffa1d44ac2e3dd5691" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.8.3", "alloy-transport", "bimap", "futures", @@ -287,7 +363,7 @@ dependencies = [ "serde_json", "tokio", "tokio-stream", - "tower", + "tower 0.5.1", "tracing", ] @@ -315,12 +391,12 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba31bae67773fd5a60020bea900231f8396202b7feca4d0c70c6b59308ab4a8" +checksum = "4dc79aeca84abb122a2fffbc1c91fdf958dca5c95be3875977bc99672bde0027" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.8.3", "alloy-pubsub", "alloy-transport", "alloy-transport-http", @@ -333,66 +409,65 @@ dependencies = [ "serde_json", "tokio", "tokio-stream", - "tower", + "tower 0.5.1", "tracing", "url", ] [[package]] name = "alloy-rpc-types" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "184a7a42c7ba9141cc9e76368356168c282c3bc3d9e5d78f3556bdfe39343447" +checksum = "22045187a5ebf5b2af3f8b6831b66735b6556c5750ec5790aeeb45935260c1c2" dependencies = [ "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "alloy-serde", + "serde", ] [[package]] name = "alloy-rpc-types-engine" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e765962e3b82fd6f276a0873b5bd897e5d75a25f78fa9a6a21bd350d8e98a4e" +checksum = "1c031a91e94a39f928244bc837c953817be5b8cc61759e1a9123b3abd17560dd" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.3", "alloy-rlp", - "alloy-rpc-types-eth", - "alloy-serde", - "jsonwebtoken", - "rand", - "serde", - "thiserror", + "derive_more 1.0.0", ] [[package]] name = "alloy-rpc-types-eth" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4123ee21f99ba4bd31bfa36ba89112a18a500f8b452f02b35708b1b951e2b9" +checksum = "238f494727ff861a803bd73b1274ef788a615bf8f8c4bfada4e6df42afa275d2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-network-primitives", + "alloy-primitives 0.8.3", "alloy-rlp", "alloy-serde", "alloy-sol-types", + "cfg-if", + "derive_more 1.0.0", + "hashbrown", "itertools 0.13.0", "serde", "serde_json", - "thiserror", ] [[package]] name = "alloy-rpc-types-trace" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567933b1d95fd42cb70b75126e32afec2e5e2c3c16e7100a3f83dc1c80f4dc0e" +checksum = "64ca08b0ccc0861055ceb83a1db009c4c8a7f52a259e7cda7ca6ca36ec2b5ce8" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.3", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -402,22 +477,22 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9416c52959e66ead795a11f4a86c248410e9e368a0765710e57055b8a1774dd6" +checksum = "6b95b6f024a558593dd3b8628af03f7df2ca50e4c56839293ad0a7546e471db0" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.3", "serde", "serde_json", ] [[package]] name = "alloy-signer" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b33753c09fa1ad85e5b092b8dc2372f1e337a42e84b9b4cff9fede75ba4adb32" +checksum = "da64740ff0518606c514eb0e03dd0a1daa8ff94d6d491a626fd8e50efd6c4f18" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.3", "async-trait", "auto_impl", "elliptic-curve", @@ -427,13 +502,13 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dfc9c26fe6c6f1bad818c9a976de9044dd12e1f75f1f156a801ee3e8148c1b6" +checksum = "99e250010dce0e3caf6a6033e809718e5921391d937d1cbbcffe52653b37cc63" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives", + "alloy-primitives 0.8.3", "alloy-signer", "async-trait", "k256", @@ -443,13 +518,13 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.7" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b40397ddcdcc266f59f959770f601ce1280e699a91fc1862f29cef91707cd09" +checksum = "0458ccb02a564228fcd76efb8eb5a520521a8347becde37b402afec9a1b83859" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", "syn 2.0.77", @@ -457,16 +532,16 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.7.7" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" +checksum = "2bc65475025fc1e84bf86fc840f04f63fcccdcf3cf12053c99918e4054dfbc69" dependencies = [ - "alloy-json-abi", + "alloy-json-abi 0.8.3", "alloy-sol-macro-input", "const-hex", "heck", "indexmap", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", "syn 2.0.77", @@ -476,11 +551,11 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.7.7" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" +checksum = "6ed10f0715a0b69fde3236ff3b9ae5f6f7c97db5a387747100070d3016b9266b" dependencies = [ - "alloy-json-abi", + "alloy-json-abi 0.8.3", "const-hex", "dunce", "heck", @@ -501,14 +576,24 @@ dependencies = [ "winnow 0.6.18", ] +[[package]] +name = "alloy-sol-type-parser" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3edae8ea1de519ccba896b6834dec874230f72fe695ff3c9c118e90ec7cff783" +dependencies = [ + "serde", + "winnow 0.6.18", +] + [[package]] name = "alloy-sol-types" -version = "0.7.7" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" +checksum = "1eb88e4da0a1b697ed6a9f811fdba223cf4d5c21410804fd1707836af73a462b" dependencies = [ - "alloy-json-abi", - "alloy-primitives", + "alloy-json-abi 0.8.3", + "alloy-primitives 0.8.3", "alloy-sol-macro", "const-hex", "serde", @@ -516,9 +601,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b51a291f949f755e6165c3ed562883175c97423703703355f4faa4b7d0a57c" +checksum = "3c7a669caa427abe8802184c8776f5103302f9337bb30a5b36bdebc332946c14" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -528,31 +613,31 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tower", + "tower 0.5.1", "tracing", "url", ] [[package]] name = "alloy-transport-http" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d65871f9f1cafe1ed25cde2f1303be83e6473e995a2d56c275ae4fcce6119c" +checksum = "4433ffa97aab6ae643de81c7bde9a2f043496f27368a607405a5c78a610caf74" dependencies = [ "alloy-json-rpc", "alloy-transport", "reqwest 0.12.7", "serde_json", - "tower", + "tower 0.5.1", "tracing", "url", ] [[package]] name = "alloy-transport-ipc" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7fbc8b6282ce41b01cbddef7bffb133fe6e1bf65dcd39770d45a905c051179" +checksum = "9aa02db8751f9c0c37caf8c38ad3eb7aa1cfb09cfea3451a13aacaf06846c7a5" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -569,9 +654,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.1.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec83fd052684556c78c54df111433493267234d82321c2236560c752f595f20" +checksum = "b0a5c4a0929479bcb85a2df628c01173618a71c807b2f499939a236dbde5d008" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -1382,11 +1467,12 @@ dependencies = [ [[package]] name = "dashmap" -version = "5.5.3" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" dependencies = [ "cfg-if", + "crossbeam-utils", "hashbrown", "lock_api", "once_cell", @@ -1473,6 +1559,27 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", + "unicode-xid", +] + [[package]] name = "digest" version = "0.9.0" @@ -1807,10 +1914,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -1892,6 +1997,7 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", + "serde", ] [[package]] @@ -1937,7 +2043,7 @@ name = "heimdall-cli" version = "0.8.4" dependencies = [ "alloy", - "alloy-json-abi", + "alloy-json-abi 0.8.3", "async-trait", "clap", "colored", @@ -1961,7 +2067,7 @@ version = "0.8.4" dependencies = [ "alloy", "alloy-dyn-abi", - "alloy-json-abi", + "alloy-json-abi 0.8.3", "async-openai", "async-recursion", "async-trait", @@ -2007,7 +2113,7 @@ dependencies = [ name = "heimdall-core" version = "0.8.4" dependencies = [ - "alloy-json-abi", + "alloy-json-abi 0.7.7", "async-convert", "async-recursion", "clap", @@ -2043,7 +2149,7 @@ version = "0.8.4" dependencies = [ "alloy", "alloy-dyn-abi", - "alloy-json-abi", + "alloy-json-abi 0.8.3", "clap", "derive_builder", "eyre", @@ -2063,7 +2169,7 @@ version = "0.8.4" dependencies = [ "alloy", "alloy-dyn-abi", - "alloy-json-abi", + "alloy-json-abi 0.8.3", "clap", "derive_builder", "eyre", @@ -2408,7 +2514,7 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", + "tower 0.4.13", "tower-service", "tracing", ] @@ -2581,21 +2687,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonwebtoken" -version = "9.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" -dependencies = [ - "base64 0.21.7", - "js-sys", - "pem", - "ring", - "serde", - "serde_json", - "simple_asn1", -] - [[package]] name = "k256" version = "0.13.3" @@ -2981,16 +3072,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "pem" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" -dependencies = [ - "base64 0.22.1", - "serde", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -3146,27 +3227,25 @@ dependencies = [ ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn 2.0.77", ] [[package]] @@ -3929,18 +4008,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "simple_asn1" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint", - "num-traits", - "thiserror", - "time", -] - [[package]] name = "slab" version = "0.4.9" @@ -4052,9 +4119,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.7" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c837dc8852cb7074e46b444afb81783140dab12c58867b49fb3898fbafedf7ea" +checksum = "4b95156f8b577cb59dc0b1df15c6f29a10afc5f8a7ac9786b0b5c68c19149278" dependencies = [ "paste", "proc-macro2", @@ -4412,7 +4479,20 @@ dependencies = [ "tokio", "tower-layer", "tower-service", - "tracing", +] + +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", ] [[package]] @@ -4433,7 +4513,6 @@ 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", @@ -4629,6 +4708,12 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "unicode-xid" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" + [[package]] name = "untrusted" version = "0.9.0" diff --git a/Cargo.toml b/Cargo.toml index 1b0e2b07..7e96d2fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ debug = true version = "0.8.4" edition = "2021" license = "MIT" -rust-version = "1.75" +rust-version = "1.79" homepage = "https://heimdall.rs" repository = "https://github.com/Jon-Becker/heimdall-rs" keywords = ["ethereum", "web3", "decompiler", "evm", "crypto"] diff --git a/crates/cache/src/lib.rs b/crates/cache/src/lib.rs index a564499c..3eca410d 100644 --- a/crates/cache/src/lib.rs +++ b/crates/cache/src/lib.rs @@ -215,7 +215,8 @@ pub fn delete_cache(key: &str) -> Result<(), Error> { #[allow(deprecated)] pub fn read_cache(key: &str) -> Result, Error> where - T: 'static + DeserializeOwned, { + T: 'static + DeserializeOwned, +{ let home = home_dir().ok_or(Error::Generic( "failed to get home directory. does your os support `std::env::home_dir()`?".to_string(), ))?; @@ -238,8 +239,8 @@ where .map_err(|e| Error::Generic(format!("failed to deserialize cache object: {:?}", e)))?; // check if the cache has expired, if so, delete it and return None - if cache.expiry < - std::time::SystemTime::now() + if cache.expiry + < std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .map_err(|e| Error::Generic(format!("failed to get current time: {:?}", e)))? .as_secs() @@ -266,7 +267,8 @@ where #[allow(deprecated)] pub fn store_cache(key: &str, value: T, expiry: Option) -> Result<(), Error> where - T: Serialize, { + T: Serialize, +{ let home = home_dir().ok_or(Error::Generic( "failed to get home directory. does your os support `std::env::home_dir()`?".to_string(), ))?; @@ -278,8 +280,8 @@ where std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .map_err(|e| Error::Generic(format!("failed to get current time: {:?}", e)))? - .as_secs() + - 60 * 60 * 24 * 90, + .as_secs() + + 60 * 60 * 24 * 90, ); let cache = Cache { value, expiry }; @@ -304,7 +306,8 @@ pub async fn with_cache(key: &str, func: F) -> eyre::Result where T: 'static + Serialize + DeserializeOwned + Send + Sync, F: FnOnce() -> Fut + Send, - Fut: std::future::Future> + Send, { + Fut: std::future::Future> + Send, +{ // Try to read from cache match read_cache::(key) { Ok(Some(cached_value)) => { diff --git a/crates/cfg/Cargo.toml b/crates/cfg/Cargo.toml index df7097f9..d4773955 100644 --- a/crates/cfg/Cargo.toml +++ b/crates/cfg/Cargo.toml @@ -25,7 +25,7 @@ eyre = "0.6.12" futures = "0.3.30" lazy_static = "1.4.0" petgraph = "0.6.2" -alloy = { version = "0.1.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } +alloy = { version = "0.3.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } heimdall-disassembler.workspace = true heimdall-vm.workspace = true diff --git a/crates/cfg/src/core/graph.rs b/crates/cfg/src/core/graph.rs index 702d31a4..165e8814 100644 --- a/crates/cfg/src/core/graph.rs +++ b/crates/cfg/src/core/graph.rs @@ -61,8 +61,8 @@ pub fn build_cfg( .first() .ok_or_eyre("failed to get first operation")? .last_instruction - .opcode == - JUMPDEST, + .opcode + == JUMPDEST, )?; } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index e02e382d..41a867f7 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -25,8 +25,8 @@ thiserror = "1.0.50" tracing = "0.1.40" tracing-subscriber = "0.3.18" eyre = "0.6.12" -alloy-json-abi = "0.7.6" -alloy = { version = "0.1.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } +alloy-json-abi = "0.8.3" +alloy = { version = "0.3.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } async-trait = "0.1.51" [[bin]] diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index d7852d1f..d073b34b 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -35,10 +35,10 @@ backoff = { version = "0.4.0", features = ["tokio"] } thiserror = "1.0.50" tracing = "0.1.40" eyre = "0.6.12" -alloy-json-abi = "0.7.6" +alloy-json-abi = "0.8.3" futures = "0.3.17" -alloy = { version = "0.1.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } +alloy = { version = "0.3.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } bytes = "1.6.1" -alloy-dyn-abi = "0.7.7" +alloy-dyn-abi = "0.8.3" tokio-retry = "0.3.0" hashbrown = "0.14.5" diff --git a/crates/common/src/ether/signatures.rs b/crates/common/src/ether/signatures.rs index f93e21d2..69823bd1 100644 --- a/crates/common/src/ether/signatures.rs +++ b/crates/common/src/ether/signatures.rs @@ -286,8 +286,8 @@ pub fn score_signature(signature: &str, num_words: Option) -> u32 { // prioritize signatures with less numbers score -= (signature.split('(').next().unwrap_or("").matches(|c: char| c.is_numeric()).count() - as u32) * - 3; + as u32) + * 3; // prioritize signatures with parameters let num_params = signature.matches(',').count() + 1; @@ -295,9 +295,9 @@ pub fn score_signature(signature: &str, num_words: Option) -> u32 { // count the number of parameters in the signature, if enabled if let Some(num_words) = num_words { - let num_dyn_params = signature.matches("bytes").count() + - signature.matches("string").count() + - signature.matches('[').count(); + let num_dyn_params = signature.matches("bytes").count() + + signature.matches("string").count() + + signature.matches('[').count(); let num_static_params = num_params - num_dyn_params; // reduce the score if the signature has less static parameters than there are words in the diff --git a/crates/common/src/ether/tokenize.rs b/crates/common/src/ether/tokenize.rs index e2d3f37c..6a81820b 100644 --- a/crates/common/src/ether/tokenize.rs +++ b/crates/common/src/ether/tokenize.rs @@ -130,17 +130,17 @@ pub fn tokenize(s: &str) -> Token { let mut op = ch.to_string(); iter.next(); if let Some(&next_ch) = iter.peek() { - if (ch == '=' && (next_ch == '=' || next_ch == '>')) || - (ch == '&' && next_ch == '&') || - (ch == '|' && next_ch == '|') || - (ch == '<' && next_ch == '=') || - (ch == '>' && next_ch == '=') || - (ch == '!' && next_ch == '=') || - (ch == '+' && next_ch == '+') || - (ch == '-' && next_ch == '-') || - (ch == '*' && next_ch == '*') || - (ch == '>' && next_ch == '>') || - (ch == '<' && next_ch == '<') + if (ch == '=' && (next_ch == '=' || next_ch == '>')) + || (ch == '&' && next_ch == '&') + || (ch == '|' && next_ch == '|') + || (ch == '<' && next_ch == '=') + || (ch == '>' && next_ch == '=') + || (ch == '!' && next_ch == '=') + || (ch == '+' && next_ch == '+') + || (ch == '-' && next_ch == '-') + || (ch == '*' && next_ch == '*') + || (ch == '>' && next_ch == '>') + || (ch == '<' && next_ch == '<') { op.push(next_ch); iter.next(); @@ -188,9 +188,9 @@ fn parse_literal(iter: &mut std::iter::Peekable) -> String { } // literal validation - if literal.starts_with("0x") && - literal.len() > 2 && - literal[2..].chars().all(|c| c.is_ascii_hexdigit()) + if literal.starts_with("0x") + && literal.len() > 2 + && literal[2..].chars().all(|c| c.is_ascii_hexdigit()) { return literal; } diff --git a/crates/common/src/ether/types.rs b/crates/common/src/ether/types.rs index 1def056f..233cb7ce 100644 --- a/crates/common/src/ether/types.rs +++ b/crates/common/src/ether/types.rs @@ -3,7 +3,7 @@ use alloy_json_abi::Param; use serde_json::{Map, Number, Value}; use std::collections::VecDeque; -use crate::utils::{hex::ToLowerHex, strings::find_balanced_encapsulator}; +use crate::utils::strings::find_balanced_encapsulator; use eyre::Result; #[derive(Debug, Clone, PartialEq)] @@ -261,14 +261,14 @@ pub trait DynSolValueExt { impl DynSolValueExt for DynSolValue { fn serialize(&self) -> Value { match self { - DynSolValue::Address(addr) => Value::String(addr.to_lower_hex()), + DynSolValue::Address(addr) => Value::String(addr.to_string()), DynSolValue::Bool(b) => Value::Bool(*b), DynSolValue::String(s) => Value::String(s.to_owned()), DynSolValue::Bytes(b) => { Value::Array(b.iter().map(|b| Value::Number(Number::from(*b))).collect()) } - DynSolValue::Uint(u, _) => Value::String(u.to_lower_hex()), - DynSolValue::Int(i, _) => Value::String(i.to_lower_hex()), + DynSolValue::Uint(u, _) => Value::String(u.to_string()), + DynSolValue::Int(i, _) => Value::String(i.to_string()), DynSolValue::FixedBytes(b, _) => { Value::Array(b.iter().map(|b| Value::Number(Number::from(*b))).collect()) } diff --git a/crates/common/src/utils/io/logging.rs b/crates/common/src/utils/io/logging.rs index 65ee33fc..c5eb07c3 100644 --- a/crates/common/src/utils/io/logging.rs +++ b/crates/common/src/utils/io/logging.rs @@ -246,6 +246,7 @@ impl TraceFactory { self.add("call", parent_index, instruction, vec![title, returns]) } + #[allow(clippy::too_many_arguments)] pub fn add_call_with_extra( &mut self, parent_index: u32, diff --git a/crates/common/src/utils/io/types.rs b/crates/common/src/utils/io/types.rs index de0d44e0..80f69ef2 100644 --- a/crates/common/src/utils/io/types.rs +++ b/crates/common/src/utils/io/types.rs @@ -11,7 +11,7 @@ pub fn display(inputs: Vec, prefix: &str) -> Vec { for input in inputs { match input { DynSolValue::Address(val) => { - output.push(format!("{prefix}{} {}", "address".blue(), val.to_lower_hex())) + output.push(format!("{prefix}{} {}", "address".blue(), val)) } DynSolValue::Int(val, _) => { output.push(format!("{prefix}{} {}", "int ".blue(), val)) @@ -28,7 +28,7 @@ pub fn display(inputs: Vec, prefix: &str) -> Vec { } } DynSolValue::FixedBytes(val, _) => { - output.push(format!("{prefix}{} {}", "bytes ".blue(), val.to_lower_hex())); + output.push(format!("{prefix}{} {}", "bytes ".blue(), val)); } DynSolValue::Bytes(val) => { // chunk val into 32-byte chunks @@ -85,14 +85,14 @@ pub trait Parameterize { impl Parameterize for DynSolValue { fn parameterize(&self) -> String { match self { - DynSolValue::Address(val) => format!("address: {}", val.to_lower_hex()), + DynSolValue::Address(val) => format!("address: {}", val), DynSolValue::Int(val, _) => format!("int: {}", val), DynSolValue::Uint(val, _) => format!("uint: {}", val), DynSolValue::String(val) => format!("string: {}", val), DynSolValue::Bool(val) => format!("bool: {}", val), DynSolValue::Bytes(val) => format!("bytes: 0x{}", val.to_lower_hex()), DynSolValue::FixedBytes(val, size) => { - format!("bytes{}: 0x{}", size, &val.to_lower_hex()[(64 - size * 2) + 2..]) + format!("bytes{}: 0x{}", size, &val.to_string()[(64 - size * 2) + 2..]) } DynSolValue::Array(val) => { // get type of array diff --git a/crates/common/src/utils/strings.rs b/crates/common/src/utils/strings.rs index d9327a9e..4e663775 100644 --- a/crates/common/src/utils/strings.rs +++ b/crates/common/src/utils/strings.rs @@ -330,8 +330,8 @@ pub fn tokenize(s: &str) -> Vec { // Check if current character and last character form a compound operator (like "==", // ">=", "&&", "||") if let Some(last) = last_char { - if compound_operator_first_chars.contains(&last) && - (c == '=' || c == '&' || c == '|') + if compound_operator_first_chars.contains(&last) + && (c == '=' || c == '&' || c == '|') { // Remove the last character as a single token tokens.pop(); diff --git a/crates/common/src/utils/sync.rs b/crates/common/src/utils/sync.rs index 1e9bdb94..151f8a36 100644 --- a/crates/common/src/utils/sync.rs +++ b/crates/common/src/utils/sync.rs @@ -1,6 +1,7 @@ /// Take in a non-async function and await it. This functions should be blocking. pub fn blocking_await(f: F) -> T where - F: FnOnce() -> T, { + F: FnOnce() -> T, +{ tokio::task::block_in_place(f) } diff --git a/crates/common/src/utils/version.rs b/crates/common/src/utils/version.rs index 6ab9fe75..a72e42fd 100644 --- a/crates/common/src/utils/version.rs +++ b/crates/common/src/utils/version.rs @@ -93,46 +93,46 @@ impl Display for Version { impl Version { /// greater than pub fn gt(&self, other: &Version) -> bool { - self.major > other.major || - (self.major == other.major && self.minor > other.minor) || - (self.major == other.major && self.minor == other.minor && self.patch > other.patch) + self.major > other.major + || (self.major == other.major && self.minor > other.minor) + || (self.major == other.major && self.minor == other.minor && self.patch > other.patch) } /// greater than or equal to pub fn gte(&self, other: &Version) -> bool { - self.major > other.major || - (self.major == other.major && self.minor > other.minor) || - (self.major == other.major && self.minor == other.minor && self.patch >= other.patch) + self.major > other.major + || (self.major == other.major && self.minor > other.minor) + || (self.major == other.major && self.minor == other.minor && self.patch >= other.patch) } /// less than pub fn lt(&self, other: &Version) -> bool { - self.major < other.major || - (self.major == other.major && self.minor < other.minor) || - (self.major == other.major && self.minor == other.minor && self.patch < other.patch) + self.major < other.major + || (self.major == other.major && self.minor < other.minor) + || (self.major == other.major && self.minor == other.minor && self.patch < other.patch) } /// less than or equal to pub fn lte(&self, other: &Version) -> bool { - self.major < other.major || - (self.major == other.major && self.minor < other.minor) || - (self.major == other.major && self.minor == other.minor && self.patch <= other.patch) + self.major < other.major + || (self.major == other.major && self.minor < other.minor) + || (self.major == other.major && self.minor == other.minor && self.patch <= other.patch) } - /// equal to + #[allow(clippy::should_implement_trait)] pub fn eq(&self, other: &Version) -> bool { - self.major == other.major && - self.minor == other.minor && - self.patch == other.patch && - self.channel == other.channel + self.major == other.major + && self.minor == other.minor + && self.patch == other.patch + && self.channel == other.channel } /// not equal to pub fn ne(&self, other: &Version) -> bool { - self.major != other.major || - self.minor != other.minor || - self.patch != other.patch || - self.channel != other.channel + self.major != other.major + || self.minor != other.minor + || self.patch != other.patch + || self.channel != other.channel } /// if the version is a nightly version diff --git a/crates/decode/Cargo.toml b/crates/decode/Cargo.toml index 16c5ecd0..cfba4936 100644 --- a/crates/decode/Cargo.toml +++ b/crates/decode/Cargo.toml @@ -23,8 +23,8 @@ derive_builder = "0.12.0" tracing = "0.1.40" eyre = "0.6.12" heimdall-vm.workspace = true -alloy-dyn-abi = "0.7.7" -alloy-json-abi = "0.7.6" -alloy = { version = "0.1.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } +alloy-dyn-abi = "0.8.3" +alloy-json-abi = "0.8.3" +alloy = { version = "0.3.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } serde_json = "1.0" hashbrown = "0.14.5" diff --git a/crates/decode/src/utils/abi.rs b/crates/decode/src/utils/abi.rs index 76e064b0..c1f44cc7 100644 --- a/crates/decode/src/utils/abi.rs +++ b/crates/decode/src/utils/abi.rs @@ -185,8 +185,8 @@ fn try_decode_dynamic_parameter_bytes( // (5) we've covered all words from `data_start_word_offset` to `data_end_word_offset`, // so add them to `word_coverages`. coverages.extend( - (word_offset.try_into().unwrap_or(usize::MAX).. - data_end_word_offset.try_into().unwrap_or(usize::MAX)) + (word_offset.try_into().unwrap_or(usize::MAX) + ..data_end_word_offset.try_into().unwrap_or(usize::MAX)) .collect::>(), ); @@ -195,6 +195,7 @@ fn try_decode_dynamic_parameter_bytes( } /// Handle ABI-encoded bytes +#[allow(clippy::too_many_arguments)] fn try_decode_dynamic_parameter_array( parameter_index: usize, calldata_words: &[Vec], @@ -210,8 +211,8 @@ fn try_decode_dynamic_parameter_array( // (1) join all words from `data_start_word_offset` to `data_end_word_offset`. This is where // the encoded data may be stored. - let data_words = &calldata_words[data_start_word_offset.try_into().unwrap_or(usize::MAX).. - data_end_word_offset.try_into().unwrap_or(usize::MAX)]; + let data_words = &calldata_words[data_start_word_offset.try_into().unwrap_or(usize::MAX) + ..data_end_word_offset.try_into().unwrap_or(usize::MAX)]; trace!("potential array items: {:#?}", data_words); // (2) first, check if this is a `string` type, since some string encodings may appear to be @@ -233,8 +234,8 @@ fn try_decode_dynamic_parameter_array( // `word_coverages` with the indices of all words from `data_start_word_offset` to // `data_end_word_offset`, since we've now covered all words in the ABI-encoded type. coverages.extend( - (word_offset.try_into().unwrap_or(usize::MAX).. - data_end_word_offset.try_into().unwrap_or(usize::MAX)) + (word_offset.try_into().unwrap_or(usize::MAX) + ..data_end_word_offset.try_into().unwrap_or(usize::MAX)) .collect::>(), ); @@ -259,6 +260,7 @@ fn try_decode_dynamic_parameter_array( } /// Determine if the given word is an abi-encoded string. +#[allow(clippy::too_many_arguments)] fn try_decode_dynamic_parameter_string( data_words: &[Vec], parameter_index: usize, @@ -294,8 +296,8 @@ fn try_decode_dynamic_parameter_string( trace!( "with data: {:#?}", encode_hex( - &calldata_words[data_start_word_offset.try_into().unwrap_or(usize::MAX).. - data_end_word_offset.try_into().unwrap_or(usize::MAX)] + &calldata_words[data_start_word_offset.try_into().unwrap_or(usize::MAX) + ..data_end_word_offset.try_into().unwrap_or(usize::MAX)] .concat() ) ); @@ -319,8 +321,8 @@ fn try_decode_dynamic_parameter_string( // (5) we've covered all words from `data_start_word_offset` to `data_end_word_offset`, // so add them to `word_coverages`. coverages.extend( - (word_offset.try_into().unwrap_or(usize::MAX).. - data_end_word_offset.try_into().unwrap_or(usize::MAX)) + (word_offset.try_into().unwrap_or(usize::MAX) + ..data_end_word_offset.try_into().unwrap_or(usize::MAX)) .collect::>(), ); diff --git a/crates/decode/src/utils/constructor.rs b/crates/decode/src/utils/constructor.rs index 836ba2f9..881968b3 100644 --- a/crates/decode/src/utils/constructor.rs +++ b/crates/decode/src/utils/constructor.rs @@ -42,16 +42,16 @@ pub fn parse_deployment_bytecode(input: Vec) -> Result { let constructor_offset = 0; let metadata_length = u32::from_str_radix( - &input[(contract_offset + contract_length - 4) as usize.. - (contract_offset + contract_length) as usize], + &input[(contract_offset + contract_length - 4) as usize + ..(contract_offset + contract_length) as usize], 16, - )? * 2 + - 4; + )? * 2 + + 4; let constructor = &input[constructor_offset as usize..contract_offset as usize]; let contract = &input[contract_offset as usize..(contract_offset + contract_length) as usize]; - let metadata = &input[(contract_offset + contract_length - metadata_length) as usize.. - (contract_offset + contract_length) as usize]; + let metadata = &input[(contract_offset + contract_length - metadata_length) as usize + ..(contract_offset + contract_length) as usize]; let arguments = &input[(contract_offset + contract_length) as usize..]; Ok(Constructor { diff --git a/crates/decompile/Cargo.toml b/crates/decompile/Cargo.toml index 00f8dcb9..e5b2d504 100644 --- a/crates/decompile/Cargo.toml +++ b/crates/decompile/Cargo.toml @@ -21,7 +21,7 @@ heimdall-decoder = { workspace = true } thiserror = "1.0.50" clap = { workspace = true, features = ["derive"] } derive_builder = "0.12.0" -alloy-json-abi = "0.7.6" +alloy-json-abi = "0.8.3" tracing = "0.1.40" eyre = "0.6.12" futures = "0.3.30" @@ -29,8 +29,8 @@ lazy_static = "1.4.0" fancy-regex = "0.11.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -alloy-dyn-abi = "0.7.7" -alloy = { version = "0.1.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } +alloy-dyn-abi = "0.8.3" +alloy = { version = "0.3.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } hashbrown = "0.14.5" heimdall-disassembler.workspace = true diff --git a/crates/decompile/src/core/analyze.rs b/crates/decompile/src/core/analyze.rs index 65b407a1..9e70150b 100644 --- a/crates/decompile/src/core/analyze.rs +++ b/crates/decompile/src/core/analyze.rs @@ -156,8 +156,8 @@ impl Analyzer { } // check if the ending brackets are needed - if analyzer_state.jumped_conditional.is_some() && - analyzer_state.conditional_stack.contains( + if analyzer_state.jumped_conditional.is_some() + && analyzer_state.conditional_stack.contains( analyzer_state .jumped_conditional .as_ref() @@ -166,8 +166,8 @@ impl Analyzer { { // remove the conditional for (i, conditional) in analyzer_state.conditional_stack.iter().enumerate() { - if conditional == - analyzer_state.jumped_conditional.as_ref().expect( + if conditional + == analyzer_state.jumped_conditional.as_ref().expect( "impossible case: should have short-circuited in previous conditional", ) { diff --git a/crates/decompile/src/core/out/source.rs b/crates/decompile/src/core/out/source.rs index cc915795..5f81a0a4 100644 --- a/crates/decompile/src/core/out/source.rs +++ b/crates/decompile/src/core/out/source.rs @@ -67,9 +67,9 @@ pub fn build_source( functions .iter() .filter(|f| { - !f.fallback && - (analyzer_type == AnalyzerType::Yul || - (f.maybe_getter_for.is_none() && !f.is_constant())) + !f.fallback + && (analyzer_type == AnalyzerType::Yul + || (f.maybe_getter_for.is_none() && !f.is_constant())) }) .for_each(|f| { let mut function_source = Vec::new(); diff --git a/crates/decompile/src/core/postprocess.rs b/crates/decompile/src/core/postprocess.rs index 6219dd26..fff35e49 100644 --- a/crates/decompile/src/core/postprocess.rs +++ b/crates/decompile/src/core/postprocess.rs @@ -130,8 +130,8 @@ impl PostprocessOrchestrator { // Note: this can't be done with a postprocessor because it needs all lines if !function.payable && (function.pure || function.view) && function.arguments.is_empty() { // check for RLP encoding. very naive check, but it works for now - if function.logic.iter().any(|line| line.contains("0x0100 *")) && - function.logic.iter().any(|line| line.contains("0x01) &")) + if function.logic.iter().any(|line| line.contains("0x0100 *")) + && function.logic.iter().any(|line| line.contains("0x01) &")) { // find any storage accesses let joined = function.logic.join(" "); diff --git a/crates/decompile/src/utils/heuristics/arguments.rs b/crates/decompile/src/utils/heuristics/arguments.rs index 4f14fe25..fce28e2c 100644 --- a/crates/decompile/src/utils/heuristics/arguments.rs +++ b/crates/decompile/src/utils/heuristics/arguments.rs @@ -28,8 +28,8 @@ pub fn argument_heuristic( // calculate the argument index, with the 4byte signature padding removed // for example, CALLDATALOAD(4) -> (4-4)/32 = 0 // CALLDATALOAD(36) -> (36-4)/32 = 1 - let arg_index = (state.last_instruction.inputs[0].saturating_sub(U256::from(4)) / - U256::from(32)) + let arg_index = (state.last_instruction.inputs[0].saturating_sub(U256::from(4)) + / U256::from(32)) .try_into() .unwrap_or(usize::MAX); diff --git a/crates/decompile/src/utils/heuristics/modifiers.rs b/crates/decompile/src/utils/heuristics/modifiers.rs index 074ff11f..a66c7b50 100644 --- a/crates/decompile/src/utils/heuristics/modifiers.rs +++ b/crates/decompile/src/utils/heuristics/modifiers.rs @@ -38,9 +38,9 @@ pub fn modifier_heuristic( // if the instruction is a JUMPI with non-zero CALLVALUE requirement, the function is // non-payable exactly: ISZERO(CALLVALUE()) - if function.payable && - state.last_instruction.opcode == JUMPI && - state.last_instruction.input_operations[1] == w_iszero!(w_callvalue!()) + if function.payable + && state.last_instruction.opcode == JUMPI + && state.last_instruction.input_operations[1] == w_iszero!(w_callvalue!()) { debug!( "conditional at instruction {} indicates a non-payable function", diff --git a/crates/decompile/src/utils/heuristics/solidity.rs b/crates/decompile/src/utils/heuristics/solidity.rs index 3641d78a..f3a70e59 100644 --- a/crates/decompile/src/utils/heuristics/solidity.rs +++ b/crates/decompile/src/utils/heuristics/solidity.rs @@ -95,10 +95,10 @@ pub fn solidity_heuristic( // perform a series of checks to determine if the condition // is added by the compiler and can be ignored - if (conditional.contains("msg.data.length") && conditional.contains("0x04")) || - VARIABLE_SIZE_CHECK_REGEX.is_match(&conditional).unwrap_or(false) || - (conditional.replace('!', "") == "success") || - (conditional == "!msg.value") + if (conditional.contains("msg.data.length") && conditional.contains("0x04")) + || VARIABLE_SIZE_CHECK_REGEX.is_match(&conditional).unwrap_or(false) + || (conditional.replace('!', "") == "success") + || (conditional == "!msg.value") { return Ok(()); } diff --git a/crates/decompile/src/utils/heuristics/yul.rs b/crates/decompile/src/utils/heuristics/yul.rs index cdbbeeb8..18805609 100644 --- a/crates/decompile/src/utils/heuristics/yul.rs +++ b/crates/decompile/src/utils/heuristics/yul.rs @@ -76,8 +76,8 @@ pub fn yul_heuristic( // CALLDATACOPY, CODECOPY, EXTCODECOPY, RETURNDATACOPY, TSTORE, // SSTORE, RETURN, SELFDESTRUCT, LOG0, LOG1, LOG2, LOG3, LOG4 // we simply want to add the operation to the function's logic - 0x37 | 0x39 | 0x3c | 0x3e | 0x55 | 0x5d | 0xf0 | 0xf1 | 0xf2 | 0xf4 | 0xf5 | 0xfa | - 0xff | 0xA0 | 0xA1 | 0xA2 | 0xA3 | 0xA4 => { + 0x37 | 0x39 | 0x3c | 0x3e | 0x55 | 0x5d | 0xf0 | 0xf1 | 0xf2 | 0xf4 | 0xf5 | 0xfa + | 0xff | 0xA0 | 0xA1 | 0xA2 | 0xA3 | 0xA4 => { function.logic.push(format!( "{}({})", opcode_name(instruction.opcode).to_lowercase(), diff --git a/crates/decompile/src/utils/postprocessors/memory.rs b/crates/decompile/src/utils/postprocessors/memory.rs index 052133fc..538ebfad 100644 --- a/crates/decompile/src/utils/postprocessors/memory.rs +++ b/crates/decompile/src/utils/postprocessors/memory.rs @@ -52,9 +52,9 @@ pub fn memory_postprocessor( // infer the type from args and vars in the expression for (var, var_type) in state.memory_type_map.iter() { - if line.contains(var) && - !state.memory_type_map.contains_key(&var_name) && - !var_type.is_empty() + if line.contains(var) + && !state.memory_type_map.contains_key(&var_name) + && !var_type.is_empty() { *line = format!("{var_type} {line}"); state.memory_type_map.insert(var_name.to_string(), var_type.to_string()); @@ -78,8 +78,8 @@ pub fn memory_postprocessor( } // we can do some type inference here - if ["+", "-", "/", "*", "int", ">=", "<="].iter().any(|op| line.contains(op)) || - assignment[1].replace(';', "").parse::().is_ok() + if ["+", "-", "/", "*", "int", ">=", "<="].iter().any(|op| line.contains(op)) + || assignment[1].replace(';', "").parse::().is_ok() { *line = format!("uint256 {line}"); state.memory_type_map.insert(var_name.to_string(), "uint256".to_string()); diff --git a/crates/decompile/src/utils/postprocessors/storage.rs b/crates/decompile/src/utils/postprocessors/storage.rs index d5620a36..74ec98e1 100644 --- a/crates/decompile/src/utils/postprocessors/storage.rs +++ b/crates/decompile/src/utils/postprocessors/storage.rs @@ -64,8 +64,8 @@ pub fn storage_postprocessor( } // if there is an assignment to a memory variable, save it to variable_map - if (line.trim().starts_with("store_") || line.trim().starts_with("storage_map_")) && - line.contains(" = ") + if (line.trim().starts_with("store_") || line.trim().starts_with("storage_map_")) + && line.contains(" = ") { let assignment: Vec = line.split(" = ").collect::>().iter().map(|x| x.to_string()).collect(); diff --git a/crates/decompile/src/utils/postprocessors/transient.rs b/crates/decompile/src/utils/postprocessors/transient.rs index 93f7e28f..eb9ebe76 100644 --- a/crates/decompile/src/utils/postprocessors/transient.rs +++ b/crates/decompile/src/utils/postprocessors/transient.rs @@ -64,8 +64,8 @@ pub fn transient_postprocessor( } // if there is an assignment to a memory variable, save it to variable_map - if (line.trim().starts_with("tstore_") || line.trim().starts_with("transient_map_")) && - line.contains(" = ") + if (line.trim().starts_with("tstore_") || line.trim().starts_with("transient_map_")) + && line.contains(" = ") { let assignment: Vec = line.split(" = ").collect::>().iter().map(|x| x.to_string()).collect(); diff --git a/crates/decompile/src/utils/postprocessors/variable.rs b/crates/decompile/src/utils/postprocessors/variable.rs index 97f88da8..01dca862 100644 --- a/crates/decompile/src/utils/postprocessors/variable.rs +++ b/crates/decompile/src/utils/postprocessors/variable.rs @@ -12,8 +12,8 @@ pub fn variable_postprocessor( .chain(state.transient_map.iter()) .for_each(|(variable, expr)| { // skip exprs that are already variables - if !expr.contains(' ') && - ["store", "tstore", "transient", "storage", "var"] + if !expr.contains(' ') + && ["store", "tstore", "transient", "storage", "var"] .iter() .any(|x| expr.starts_with(x)) { diff --git a/crates/dump/Cargo.toml b/crates/dump/Cargo.toml index d641fbe8..05baf904 100644 --- a/crates/dump/Cargo.toml +++ b/crates/dump/Cargo.toml @@ -24,5 +24,5 @@ tracing = "0.1.40" eyre = "0.6.12" tokio = { version = "1", features = ["full"] } futures = "0.3.30" -alloy = { version = "0.1.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } +alloy = { version = "0.3.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } hashbrown = "0.14.5" diff --git a/crates/inspect/Cargo.toml b/crates/inspect/Cargo.toml index a17511a3..4d08a49a 100644 --- a/crates/inspect/Cargo.toml +++ b/crates/inspect/Cargo.toml @@ -28,6 +28,6 @@ async-convert = "1.0.0" futures = "0.3.28" async-recursion = "1.0.5" tokio = { version = "1", features = ["full"] } -alloy = { version = "0.1.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } +alloy = { version = "0.3.3", features = ["full", "rpc-types-debug", "rpc-types-trace"] } serde_json = "1.0" hashbrown = "0.14.5" diff --git a/crates/inspect/src/interfaces/traces.rs b/crates/inspect/src/interfaces/traces.rs index ba73353e..372cfa74 100644 --- a/crates/inspect/src/interfaces/traces.rs +++ b/crates/inspect/src/interfaces/traces.rs @@ -225,7 +225,7 @@ impl TryFrom for DecodedCall { from: value.from, to: value.to, value: value.value, - gas: value.gas, + gas: alloy::primitives::U64::from(value.gas), input: value.input, call_type: value.call_type, resolved_function, @@ -256,7 +256,7 @@ impl TryFrom for DecodedCallResult { let decoded_outputs = result.decoded.decoded_inputs.unwrap_or_default(); Ok(Self { - gas_used: value.gas_used, + gas_used: alloy::primitives::U64::from(value.gas_used), output: value.output, decoded_outputs_serializeable: decoded_outputs.iter().map(|v| v.serialize()).collect(), decoded_outputs, diff --git a/crates/vm/Cargo.toml b/crates/vm/Cargo.toml index 6ffae2c1..8e79365f 100644 --- a/crates/vm/Cargo.toml +++ b/crates/vm/Cargo.toml @@ -36,7 +36,7 @@ thiserror = "1.0.50" tracing = "0.1.40" eyre = "0.6.12" heimdall-common.workspace = true -alloy = { version = "0.1.3", features = [ +alloy = { version = "0.3.3", features = [ "full", "rpc-types-debug", "rpc-types-trace", diff --git a/crates/vm/src/core/types.rs b/crates/vm/src/core/types.rs index 2d67566c..531b909f 100644 --- a/crates/vm/src/core/types.rs +++ b/crates/vm/src/core/types.rs @@ -189,8 +189,8 @@ pub fn get_padding(bytes: &[u8]) -> Padding { // we can avoid doing a full check if any of the following are true: // there are no null bytes OR // neither first nor last byte is a null byte, it is not padded - if null_byte_indices.is_empty() || - null_byte_indices[0] != 0 && null_byte_indices[null_byte_indices.len() - 1] != size - 1 + if null_byte_indices.is_empty() + || null_byte_indices[0] != 0 && null_byte_indices[null_byte_indices.len() - 1] != size - 1 { return Padding::None; } diff --git a/crates/vm/src/core/vm.rs b/crates/vm/src/core/vm.rs index 6a2f5770..31367d47 100644 --- a/crates/vm/src/core/vm.rs +++ b/crates/vm/src/core/vm.rs @@ -303,8 +303,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -321,8 +321,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -339,8 +339,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -360,8 +360,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&numerator.operation.opcode) && - (0x5f..=0x7f).contains(&denominator.operation.opcode) + if (0x5f..=0x7f).contains(&numerator.operation.opcode) + && (0x5f..=0x7f).contains(&denominator.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -381,8 +381,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&numerator.operation.opcode) && - (0x5f..=0x7f).contains(&denominator.operation.opcode) + if (0x5f..=0x7f).contains(&numerator.operation.opcode) + && (0x5f..=0x7f).contains(&denominator.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result.into_raw())]) @@ -403,8 +403,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&modulus.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&modulus.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -424,8 +424,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&modulus.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&modulus.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result.into_raw())]) @@ -447,8 +447,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -469,8 +469,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -487,8 +487,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&exponent.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&exponent.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -591,8 +591,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -609,8 +609,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -627,8 +627,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -677,8 +677,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -697,8 +697,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result)]) } @@ -721,8 +721,8 @@ impl VM { // if both inputs are PUSH instructions, simplify the operation let mut simplified_operation = operation; - if (0x5f..=0x7f).contains(&a.operation.opcode) && - (0x5f..=0x7f).contains(&b.operation.opcode) + if (0x5f..=0x7f).contains(&a.operation.opcode) + && (0x5f..=0x7f).contains(&b.operation.opcode) { simplified_operation = WrappedOpcode::new(0x7f, vec![WrappedInput::Raw(result.into_raw())]) @@ -748,7 +748,7 @@ impl VM { let gas_cost = 6 * minimum_word_size + self.memory.expansion_cost(offset, size); self.consume_gas(gas_cost); - self.stack.push(U256::try_from(result)?, operation); + self.stack.push(U256::from_be_bytes(result.0), operation); } // ADDRESS @@ -1121,12 +1121,13 @@ impl VM { let pc: u128 = pc.try_into()?; // Check if JUMPDEST is valid and throw with 790 if not (invalid jump destination) - if (pc <= - self.bytecode + if (pc + <= self + .bytecode .len() .try_into() - .expect("impossible case: bytecode is larger than u128::MAX")) && - (self.bytecode[pc as usize] != 0x5b) + .expect("impossible case: bytecode is larger than u128::MAX")) + && (self.bytecode[pc as usize] != 0x5b) { self.exit(790, Vec::new()); return Ok(Instruction { @@ -1153,12 +1154,13 @@ impl VM { if !condition.eq(&U256::from(0u8)) { // Check if JUMPDEST is valid and throw with 790 if not (invalid jump // destination) - if (pc <= - self.bytecode + if (pc + <= self + .bytecode .len() .try_into() - .expect("impossible case: bytecode is larger than u128::MAX")) && - (self.bytecode[pc as usize] != 0x5b) + .expect("impossible case: bytecode is larger than u128::MAX")) + && (self.bytecode[pc as usize] != 0x5b) { self.exit(790, Vec::new()); return Ok(Instruction { @@ -1299,9 +1301,9 @@ impl VM { let data = self.memory.read(offset, size); // consume dynamic gas - let gas_cost = (375 * (topic_count as u128)) + - 8 * (size as u128) + - self.memory.expansion_cost(offset, size); + let gas_cost = (375 * (topic_count as u128)) + + 8 * (size as u128) + + self.memory.expansion_cost(offset, size); self.consume_gas(gas_cost); // no need for a panic check because the length of events should never be larger @@ -1494,9 +1496,9 @@ impl VM { let mut vm_clone = self.clone(); for _ in 0..n { - if vm_clone.bytecode.len() < vm_clone.instruction as usize || - vm_clone.exitcode != 255 || - !vm_clone.returndata.is_empty() + if vm_clone.bytecode.len() < vm_clone.instruction as usize + || vm_clone.exitcode != 255 + || !vm_clone.returndata.is_empty() { break; } diff --git a/crates/vm/src/ext/exec/util.rs b/crates/vm/src/ext/exec/util.rs index 38e86a41..9be91e11 100644 --- a/crates/vm/src/ext/exec/util.rs +++ b/crates/vm/src/ext/exec/util.rs @@ -69,11 +69,13 @@ pub fn jump_stack_depth_less_than_max_stack_depth( /// If the stack contains more than 16 of the same item (with the same sources), it is considered a /// loop. pub fn stack_contains_too_many_of_the_same_item(stack: &Stack) -> bool { - if stack.size() > 16 && stack.stack.iter().any(|frame| { - let solidified_frame_source = frame.operation.solidify(); - stack.stack.iter().filter(|f| f.operation.solidify() == solidified_frame_source).count() >= - 16 - }) { + if stack.size() > 16 + && stack.stack.iter().any(|frame| { + let solidified_frame_source = frame.operation.solidify(); + stack.stack.iter().filter(|f| f.operation.solidify() == solidified_frame_source).count() + >= 16 + }) + { trace!("jump matches loop-detection heuristic: 'stack_contains_too_many_of_the_same_item'",); return true; } diff --git a/crates/vm/src/ext/lexers/solidity.rs b/crates/vm/src/ext/lexers/solidity.rs index 8bdd7d41..c009270c 100644 --- a/crates/vm/src/ext/lexers/solidity.rs +++ b/crates/vm/src/ext/lexers/solidity.rs @@ -219,8 +219,8 @@ impl WrappedOpcode { .push_str(format!("arg{}", (slot - 4) / 32).as_str()); } Err(_) => { - if solidified_slot.contains("0x04 + ") || - solidified_slot.contains("+ 0x04") + if solidified_slot.contains("0x04 + ") + || solidified_slot.contains("+ 0x04") { solidified_wrapped_opcode.push_str( solidified_slot diff --git a/crates/vm/src/ext/range_map.rs b/crates/vm/src/ext/range_map.rs index 834dc737..872a8fea 100644 --- a/crates/vm/src/ext/range_map.rs +++ b/crates/vm/src/ext/range_map.rs @@ -107,12 +107,12 @@ impl RangeMap { } fn range_collides(incoming: &Range, incumbent: &Range) -> bool { - !(incoming.start <= incumbent.start && - incoming.end < incumbent.end && - incoming.end < incumbent.start || - incoming.start > incumbent.start && - incoming.end >= incumbent.end && - incoming.start > incumbent.end) + !(incoming.start <= incumbent.start + && incoming.end < incumbent.end + && incoming.end < incumbent.start + || incoming.start > incumbent.start + && incoming.end >= incumbent.end + && incoming.start > incumbent.end) } } diff --git a/crates/vm/src/ext/selectors.rs b/crates/vm/src/ext/selectors.rs index 1b8cd239..b1b9f3d4 100644 --- a/crates/vm/src/ext/selectors.rs +++ b/crates/vm/src/ext/selectors.rs @@ -113,10 +113,10 @@ pub fn resolve_entry_point(vm: &mut VM, selector: &str) -> u128 { let jump_condition = call.last_instruction.input_operations[1].solidify(); let jump_taken = call.last_instruction.inputs[1].try_into().unwrap_or(1); - if jump_condition.contains(selector) && - jump_condition.contains("msg.data[0]") && - jump_condition.contains(" == ") && - jump_taken == 1 + if jump_condition.contains(selector) + && jump_condition.contains("msg.data[0]") + && jump_condition.contains(" == ") + && jump_taken == 1 { return call.last_instruction.inputs[0].try_into().unwrap_or(0); } else if jump_taken == 1 { @@ -142,7 +142,8 @@ pub fn resolve_entry_point(vm: &mut VM, selector: &str) -> u128 { /// Resolve a list of selectors to their function signatures. pub async fn resolve_selectors(selectors: Vec) -> HashMap> where - T: ResolveSelector + Send + Clone + 'static, { + T: ResolveSelector + Send + Clone + 'static, +{ // short-circuit if there are no selectors if selectors.is_empty() { return HashMap::new(); diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..87493917 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.79.0" +components = ["rustfmt", "clippy"]