diff --git a/offchain/Cargo.lock b/offchain/Cargo.lock index d3e9827..2349a75 100644 --- a/offchain/Cargo.lock +++ b/offchain/Cargo.lock @@ -70,9 +70,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.15" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6259a506ab13e1d658796c31e6e39d2e2ee89243bcc505ddc613b35732e0a430" +checksum = "788bb18e8f61d5d9340b52143f27771daf7e1dccbaf2741621d2493f9debf52e" dependencies = [ "alloy-rlp", "bytes", @@ -81,7 +81,6 @@ dependencies = [ "derive_more", "foldhash", "hashbrown", - "hex-literal", "indexmap", "itoa", "k256", @@ -115,7 +114,7 @@ checksum = "5a833d97bf8a5f0f878daf2c8451fff7de7f9de38baa5a45d936ec718d81255a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -265,13 +264,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -303,7 +302,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -380,9 +379,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" [[package]] name = "bitvec" @@ -524,9 +523,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.5" +version = "1.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" +checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" dependencies = [ "jobserver", "libc", @@ -775,7 +774,7 @@ checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -795,7 +794,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "unicode-xid", ] @@ -870,7 +869,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -962,7 +961,7 @@ checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1117,7 +1116,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.91", + "syn 2.0.96", "toml", "walkdir", ] @@ -1135,7 +1134,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1161,7 +1160,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.91", + "syn 2.0.96", "tempfile", "thiserror 1.0.69", "tiny-keccak", @@ -1478,7 +1477,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1560,9 +1559,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "gloo-timers" @@ -1642,12 +1641,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - [[package]] name = "hmac" version = "0.12.1" @@ -1853,7 +1846,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1912,7 +1905,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1990,9 +1983,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -2102,15 +2095,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "libc", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "litemap" @@ -2290,7 +2283,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -2469,7 +2462,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 2.0.9", + "thiserror 2.0.11", "ucd-trie", ] @@ -2495,35 +2488,35 @@ dependencies = [ [[package]] name = "phf" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ "phf_macros", - "phf_shared 0.11.2", + "phf_shared 0.11.3", ] [[package]] name = "phf_generator" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ - "phf_shared 0.11.2", + "phf_shared 0.11.3", "rand", ] [[package]] name = "phf_macros" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" dependencies = [ "phf_generator", - "phf_shared 0.11.2", + "phf_shared 0.11.3", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -2532,43 +2525,43 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] name = "phf_shared" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "siphasher", + "siphasher 1.0.1", ] [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -2615,12 +2608,12 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac" dependencies = [ "proc-macro2", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -2648,9 +2641,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -2663,7 +2656,7 @@ checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.6.0", + "bitflags 2.7.0", "lazy_static", "num-traits", "rand", @@ -2683,9 +2676,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -2761,7 +2754,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", ] [[package]] @@ -3008,7 +3001,7 @@ name = "revm-state" version = "1.0.0" source = "git+https://github.com/bluealloy/revm.git?rev=03ea24bd9550e93b08f343e0b410725557c1adb4#03ea24bd9550e93b08f343e0b410725557c1adb4" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "revm-bytecode", "revm-primitives", "revm-specification", @@ -3155,11 +3148,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.42" +version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" +checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "errno", "libc", "linux-raw-sys", @@ -3199,9 +3192,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "rusty-fork" @@ -3260,7 +3253,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3365,29 +3358,29 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] name = "serde_json" -version = "1.0.134" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "itoa", "memchr", @@ -3476,13 +3469,13 @@ dependencies = [ [[package]] name = "simple_asn1" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb" dependencies = [ "num-bigint", "num-traits", - "thiserror 1.0.69", + "thiserror 2.0.11", "time", ] @@ -3492,6 +3485,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.9" @@ -3597,7 +3596,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3652,9 +3651,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.91" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", @@ -3675,7 +3674,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3707,12 +3706,13 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", + "getrandom", "once_cell", "rustix", "windows-sys 0.59.0", @@ -3740,11 +3740,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.9" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ - "thiserror-impl 2.0.9", + "thiserror-impl 2.0.11", ] [[package]] @@ -3755,18 +3755,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] name = "thiserror-impl" -version = "2.0.9" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3845,9 +3845,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.42.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", @@ -3955,7 +3955,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -4144,34 +4144,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.49" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", @@ -4182,9 +4183,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4192,28 +4193,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -4406,9 +4410,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" dependencies = [ "memchr", ] @@ -4489,7 +4493,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "synstructure", ] @@ -4511,7 +4515,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -4531,7 +4535,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "synstructure", ] @@ -4552,7 +4556,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -4574,7 +4578,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] diff --git a/offchain/src/compiler/mod.rs b/offchain/src/compiler/mod.rs index 851c0bc..c705e00 100644 --- a/offchain/src/compiler/mod.rs +++ b/offchain/src/compiler/mod.rs @@ -1 +1,2 @@ pub mod ast; +pub mod push3_describtor; diff --git a/offchain/src/compiler/push3_describtor.rs b/offchain/src/compiler/push3_describtor.rs new file mode 100644 index 0000000..51197fb --- /dev/null +++ b/offchain/src/compiler/push3_describtor.rs @@ -0,0 +1,67 @@ +//! src/compiler/push3_descriptor.rs +//! +//! A small module of helper functions to construct or interpret the 256-bit descriptors +//! used by our on-chain `Push3Interpreter`. Each descriptor encodes a tag, an offset, +//! a length, and any leftover bits (e.g., immediate data). + +use ethers::types::U256; + +/// The 256-bit descriptor layout is as follows: +/// [ 8 bits: tag | 32 bits: offset | 32 bits: length | 184 bits: leftover ] +/// +/// We'll define small helper functions to build or parse these. +/// Our `make_sublist_descriptor` is an example for tag=3 (SUBLIST). + +/// Tag constants, if you want them: +pub const TAG_SUBLIST: u8 = 3; +pub const TAG_INT_LITERAL: u8 = 2; +pub const TAG_INSTRUCTION: u8 = 1; +pub const TAG_NONE: u8 = 0; + +/// A small helper to shift the tag into the top 8 bits. +#[inline] +fn tag_bits(tag: u8) -> U256 { + U256::from(tag) << 248 +} + +/// Build a descriptor for a SUBLIST with the given offset and length (in bytes), +/// leftover=0. +/// +/// # Example +/// ``` +/// let desc = make_sublist_descriptor(0, code_bytes.len() as u32); +/// // pass `desc` into the interpreter's exec stack +/// ``` +pub fn make_sublist_descriptor(offset: u32, length: u32) -> U256 { + tag_bits(TAG_SUBLIST as u8) + | (U256::from(offset) << 216) + | (U256::from(length) << 184) + | U256::zero() // leftover +} + +/// Possibly you want a more general helper that builds any descriptor: +/// If you have other uses for leftover bits, you can pass that in: +pub fn make_descriptor(tag: u8, offset: u32, length: u32, leftover: U256) -> U256 { + tag_bits(tag) + | (U256::from(offset) << 216) + | (U256::from(length) << 184) + | leftover +} + +/// If you want to parse a descriptor, you can define getTag, getOffset, getLength, etc: +pub fn get_tag(desc: U256) -> u8 { + // top 8 bits => shift right 248 + (desc >> 248).as_u32() as u8 +} + +pub fn get_offset(desc: U256) -> u32 { + ((desc >> 216) & U256::from(u32::MAX)).as_u32() +} + +pub fn get_length(desc: U256) -> u32 { + ((desc >> 184) & U256::from(u32::MAX)).as_u32() +} + +pub fn get_low_184(desc: U256) -> U256 { + desc & ((U256::from(1u64) << 184) - 1) +} diff --git a/offchain/src/evm_integration/revm_runner.rs b/offchain/src/evm_integration/revm_runner.rs deleted file mode 100644 index e69de29..0000000 diff --git a/offchain/src/main.rs b/offchain/src/main.rs index d931b73..90e1460 100644 --- a/offchain/src/main.rs +++ b/offchain/src/main.rs @@ -1,8 +1,11 @@ // src/main.rs mod compiler; +mod runner; use std::env; + +// We’ll use your existing AST definitions for parsing use compiler::ast::{ parse_string_to_sexpr, sexpr_to_untyped, @@ -10,22 +13,28 @@ use compiler::ast::{ UntypedAst, // The untyped AST enum }; +use runner::revm_runner::{EvmRunner, Push3InterpreterOutputs}; // <--- We import our EvmRunner + use anyhow::{anyhow, bail, Result}; use hex; -use database::CacheDB; -use revm::{ - context::Context, - context_interface::result::{ExecutionResult, Output}, - database_interface::EmptyDB, - handler::EthHandler, - primitives::{Bytes, TxKind}, - EvmCommit, MainEvm, -}; -use ethers::abi::{encode, Token}; -use ethers::abi::{ParamType, decode}; -use ethers::types::U256; -use serde::Deserialize; // <--- NEW: for deserializing from JSON +use serde::Deserialize; // For JSON artifact loading +// If you still need these (not strictly required anymore): +// use database::CacheDB; +// use revm::{ +// context::Context, +// context_interface::result::{ExecutionResult, Output}, +// database_interface::EmptyDB, +// handler::EthHandler, +// primitives::{Bytes, TxKind}, +// EvmCommit, MainEvm, +// }; +use ethers::abi::{decode, ParamType}; +use ethers::types::U256; + +// ---------------------------------------------------------------------- +// JSON artifact struct, as before +// ---------------------------------------------------------------------- #[derive(Debug, Deserialize)] struct BytecodeObject { object: String, @@ -36,9 +45,12 @@ struct MyContractArtifact { bytecode: BytecodeObject, } +// ---------------------------------------------------------------------- +// MAIN +// ---------------------------------------------------------------------- fn main() -> Result<()> { - // 1) Read CLI arguments - let args: Vec = std::env::args().collect(); + // 1) Read CLI arguments for the Push3 program + let args: Vec = env::args().collect(); if args.len() < 2 { eprintln!("Usage: cargo run -- ''"); eprintln!("Example: cargo run -- '((3 5 +) DUP MUL)'"); @@ -54,7 +66,7 @@ fn main() -> Result<()> { let ast: UntypedAst = sexpr_to_untyped(&sexpr) .map_err(|e| anyhow!("Error converting to UntypedAst: {}", e))?; - // 4) Convert UntypedAst => Push3 bytecode + // 4) Convert UntypedAst => Push3 bytecode (for debugging, so we can see it) let bytecode = ast.to_bytecode(); // 5) Print the resulting AST and bytecode (in hex) @@ -62,137 +74,49 @@ fn main() -> Result<()> { println!("Bytecode (hex): 0x{}", hex::encode(&bytecode)); // ---------------------------------------------------------------------- - // NEW: Read the contract creation code (bytecode) from a JSON artifact + // Load the creation code (bytecode) from a JSON artifact // ---------------------------------------------------------------------- - // Example JSON (Forge artifact) might look like: - // { - // "bytecode": "60808060...0033" <--- entire creation code - // ... other fields ... - // } - - // Path to your JSON artifact. Adjust as needed: let creation_hex_filename = "../onchain/out/Push3Interpreter.sol/Push3Interpreter.json"; - - // Read and parse the JSON artifact let creation_json = std::fs::read_to_string(creation_hex_filename) .map_err(|e| anyhow!("Failed to read JSON file {}: {}", creation_hex_filename, e))?; let contract_artifact: MyContractArtifact = serde_json::from_str(&creation_json) .map_err(|e| anyhow!("Failed to parse JSON artifact: {}", e))?; - - // Extract the "bytecode" field from the JSON + let raw_hex = &contract_artifact.bytecode.object; let stripped_hex = raw_hex.trim_start_matches("0x"); - // ---------------------------------------------------------------------- - // The rest of the deployment+call logic remains mostly unchanged - // ---------------------------------------------------------------------- - - // 2) Convert hex string to raw bytes. let creation_bytes = match hex::decode(stripped_hex) { Ok(bytes) => bytes, Err(e) => bail!("Invalid hex for creation code: {e}"), }; - // 3) Build a new EVM instance with a "Create" transaction: - let mut evm = MainEvm::new( - // a) Prepare context with a chained transaction - Context::builder() - .modify_tx_chained(|tx| { - tx.transact_to = TxKind::Create; - tx.data = Bytes::from(creation_bytes.clone()); - }) - // b) Provide an in-memory DB for ephemeral state - .with_db(CacheDB::::default()), - // c) The "EthHandler" for block/tx environment logic - EthHandler::default(), + println!( + "Loaded creation code ({} bytes) from {}", + creation_bytes.len(), + creation_hex_filename ); - println!("Deploying contract with creation code size: {} bytes", creation_bytes.len()); + // ---------------------------------------------------------------------- + // 6) Deploy the interpreter in an ephemeral EVM using `EvmRunner` + // ---------------------------------------------------------------------- + let mut runner = EvmRunner::new(creation_bytes)?; + println!("Interpreter deployed successfully in ephemeral EVM at: 0x{:x}", runner.interpreter_addr); - // 4) Execute the CREATE transaction - let creation_result = evm.exec_commit()?; - // => an ExecutionResult + // ---------------------------------------------------------------------- + // 7) Evaluate the AST in our EVM + // ---------------------------------------------------------------------- + // We'll call `runner.run_ast(&ast)`, which: + // - Converts AST => push3 code, + // - Builds a sublist descriptor in the exec stack, + // - Calls `runInterpreter`, + // - Returns final stacks in a `Push3InterpreterOutputs`. + let outputs = runner.run_ast(&ast)?; + println!("Ran the AST successfully!"); - // 5) Check success - let ExecutionResult::Success { - output: Output::Create(_, Some(deployed_addr)), - .. - } = creation_result - else { - bail!("Deployment failed or didn't return an address: {creation_result:#?}"); - }; + // 8) Print the final stacks + println!("Final CODE stack: {:?}", outputs.final_code_stack); + println!("Final EXEC stack: {:?}", outputs.final_exec_stack); + println!("Final INT stack: {:?}", outputs.final_int_stack); - println!("Deployed contract at: 0x{:x}", deployed_addr); - - // 1) Prepare the function selector for runInterpreter - let func_selector = ðers::utils::id("runInterpreter(bytes,uint256[],uint256[],int256[])")[0..4]; - - // 2) Convert your compiled “Push3” bytecode into the `bytes` argument - let code_arg = Token::Bytes(bytecode.clone()); - - // 3) Build a “SUBLIST descriptor” for the entire bytecode. - let tag_bits = U256::from(3u64) << 248; // CodeTag.SUBLIST = 3 - let offset_bits = U256::from(0u64) << 216; // offset=0 - let length_bits = U256::from(bytecode.len() as u64) << 184; // length = bytecode.len() - let low_184 = U256::zero(); - - let sublist_descriptor = tag_bits | offset_bits | length_bits | low_184; - - // Now we put that descriptor as the one and only item in `initExecStack`. - let init_exec_stack = Token::Array(vec![ - Token::Uint(sublist_descriptor) - ]); - - // For the other two arrays (codeStack, intStack), we’ll just leave them empty: - let empty_uint256_array = Token::Array(vec![]); // codeStack - let empty_int256_array = Token::Array(vec![]); // intStack - - // 4) Encode all arguments in the correct order: - let encoded_args = encode(&[ - code_arg, - empty_uint256_array.clone(), // initCodeStack - init_exec_stack, // initExecStack - empty_uint256_array.clone(), // initIntStack - ]); - - // 5) Concatenate selector + encoded arguments to form the full call data - let mut call_data = Vec::from(func_selector); - call_data.extend_from_slice(&encoded_args); - - // 6) Modify the transaction to call `runInterpreter` with the encoded data - evm.context.modify_tx(|tx| { - tx.transact_to = TxKind::Call(deployed_addr); - tx.data = Bytes::from(call_data); - tx.nonce += 1; // increment nonce to avoid reuse - }); - - // 7) Execute the call. - let call_result = evm.transact()?; - match &call_result.result { - ExecutionResult::Success { - output: Output::Call(return_data), - .. - } => { - println!("Call succeeded, returned data: 0x{}", hex::encode(return_data)); - - // Decode (uint256[], uint256[], int256[]) - let param_types = &[ - ParamType::Array(Box::new(ParamType::Uint(256))), // finalCodeStack - ParamType::Array(Box::new(ParamType::Uint(256))), // finalExecStack - ParamType::Array(Box::new(ParamType::Int(256))), // finalIntStack - ]; - - let decoded = decode(param_types, return_data) - .map_err(|e| anyhow!("Failed to decode return data: {e}"))?; - - println!("Decoded return: {:?}", decoded); - } - ExecutionResult::Revert { gas_used, output } => { - bail!("Call reverted: gas used = {gas_used:?}, output = {:?}", output); - } - other => { - bail!("Call failed: {other:?}"); - } - } Ok(()) } diff --git a/offchain/src/evm_integration/mod.rs b/offchain/src/runner/mod.rs similarity index 100% rename from offchain/src/evm_integration/mod.rs rename to offchain/src/runner/mod.rs diff --git a/offchain/src/runner/revm_runner.rs b/offchain/src/runner/revm_runner.rs new file mode 100644 index 0000000..fe97a21 --- /dev/null +++ b/offchain/src/runner/revm_runner.rs @@ -0,0 +1,232 @@ +//! src/evm_integration/revm_runner.rs +//! +//! This module provides a thin wrapper around REVM to deploy a Push3Interpreter +//! contract, then call its `runInterpreter(...)` function with flexible inputs/outputs, +//! using the same style (Context::builder(), .modify_tx_chained, etc.) you had in your main. + +use anyhow::{anyhow, bail, Result}; +use ethers::abi::{encode, decode, Token, ParamType}; +use ethers::types::U256; +use ethers::utils; +use database::CacheDB; +use revm::{ + context::Context, + context::{BlockEnv, TxEnv, CfgEnv}, + context_interface::result::{ExecutionResult, Output}, + database_interface::EmptyDB, + handler::EthHandler, + primitives::{Bytes, TxKind}, // 4 generics + EvmCommit, + MainEvm, +}; + +// We import your AST definitions so we can call `ast.to_bytecode()`. +use crate::compiler::ast::{UntypedAst, Push3Ast}; + +// If you have a descriptor helper (like make_sublist_descriptor), bring it in: +use crate::compiler::push3_describtor::make_sublist_descriptor; + +/// The input parameters for `runInterpreter(...)`: four fields (code, codeStack, execStack, intStack). +pub struct Push3InterpreterInputs { + pub code: Vec, + pub init_code_stack: Vec, + pub init_exec_stack: Vec, + pub init_int_stack: Vec, +} + +/// The outputs from `runInterpreter(...)`: three arrays for code/exec/int stacks. +pub struct Push3InterpreterOutputs { + pub final_code_stack: Vec, + pub final_exec_stack: Vec, + pub final_int_stack: Vec, +} + +/// A thin wrapper around REVM, parameterized by the 4 generics (DB, BLOCK, TX, CFG). +/// - We store the ephemeral EVM instance, +/// - We store the deployed address of your `Push3Interpreter`, +/// - We provide `run_interpreter` and `run_ast`. +pub struct EvmRunner { + /// The 4-parameter MainEvm: + /// DB = CacheDB, + /// BLOCK = BlockEnv, + /// TX = TxEnv, + /// CFG = CfgEnv + pub evm: MainEvm, BlockEnv, TxEnv, CfgEnv>, + + /// The address where Push3Interpreter was deployed. + pub interpreter_addr: revm::primitives::Address, +} + +impl EvmRunner { + /// Deploy a new ephemeral EVM with a "Create" transaction for the given `creation_code`. + /// + /// This matches your older style of: + /// `MainEvm::new(Context::builder()... .with_db(...), EthHandler::default())` + pub fn new(creation_code: Vec) -> Result { + // 1) Create the EVM using your old style: `Context::builder()...` + // Then pass to MainEvm::new(...). + // The difference is that we explicitly say MainEvm. + let mut evm = MainEvm::new( + // a) Prepare context with a chained transaction to CREATE + Context::builder() + .modify_tx_chained(|tx| { + tx.transact_to = TxKind::Create; + tx.data = Bytes::from(creation_code.clone()); + }) + // b) Provide ephemeral DB + .with_db(CacheDB::::default()), + // c) The EthHandler for block/tx environment logic + EthHandler::default(), + ); + + // 2) Execute the CREATE transaction + let creation_result = evm.exec_commit()?; + let ExecutionResult::Success { + output: Output::Create(_, Some(deployed_addr)), + .. + } = creation_result + else { + bail!("Interpreter deployment failed or no address returned: {creation_result:#?}"); + }; + + // 3) Return the EvmRunner + Ok(Self { + evm, + interpreter_addr: deployed_addr, + }) + } + + /// Call `runInterpreter(bytes,uint256[],uint256[],int256[])` on the deployed contract, + /// returning the final code/exec/int stacks. + pub fn run_interpreter( + &mut self, + inputs: &Push3InterpreterInputs + ) -> Result { + // 1) Build function selector + let func_selector = &utils::id("runInterpreter(bytes,uint256[],uint256[],int256[])")[0..4]; + + // 2) Convert each field to `ethers::abi::Token` + let code_token = Token::Bytes(inputs.code.clone()); + let init_code_stack = Token::Array( + inputs.init_code_stack + .iter() + .map(|&u| Token::Uint(u)) + .collect() + ); + let init_exec_stack = Token::Array( + inputs.init_exec_stack + .iter() + .map(|&u| Token::Uint(u)) + .collect() + ); + let init_int_stack = Token::Array( + inputs.init_int_stack + .iter() + .map(|&val_i128| { + // store i128 as a U256. If you need negative values, do a two’s complement approach. + let as_u128 = val_i128 as u128; + Token::Int(U256::from(as_u128)) + }) + .collect() + ); + + // 3) Encode + let encoded_args = encode(&[ + code_token, + init_code_stack, + init_exec_stack, + init_int_stack, + ]); + + // 4) Build final call data + let mut call_data = Vec::from(func_selector); + call_data.extend_from_slice(&encoded_args); + + // 5) Modify the transaction to CALL the deployed interpreter + self.evm.context.modify_tx(|tx| { + tx.transact_to = TxKind::Call(self.interpreter_addr); + tx.data = Bytes::from(call_data); + tx.nonce += 1; // increment nonce to avoid reuse + }); + + // 6) Execute the call + let call_result = self.evm.transact()?; + match &call_result.result { + ExecutionResult::Success { + output: Output::Call(return_data), + .. + } => { + // 7) Decode (uint256[], uint256[], int256[]) + let param_types = &[ + ParamType::Array(Box::new(ParamType::Uint(256))), // finalCodeStack + ParamType::Array(Box::new(ParamType::Uint(256))), // finalExecStack + ParamType::Array(Box::new(ParamType::Int(256))), // finalIntStack + ]; + let decoded = decode(param_types, return_data) + .map_err(|e| anyhow!("Failed to decode return data: {e}"))?; + + // parse each array + let final_code_stack = match &decoded[0] { + Token::Array(arr) => arr.iter().filter_map(|t| { + if let Token::Uint(u) = t { Some(*u) } else { None } + }).collect(), + _ => Vec::new(), + }; + let final_exec_stack = match &decoded[1] { + Token::Array(arr) => arr.iter().filter_map(|t| { + if let Token::Uint(u) = t { Some(*u) } else { None } + }).collect(), + _ => Vec::new(), + }; + let final_int_stack = match &decoded[2] { + Token::Array(arr) => arr.iter().filter_map(|t| { + if let Token::Int(u256_val) = t { + // read only the lower 128 bits => ignoring sign extension + let lo = u256_val.low_u128(); + Some(lo as i128) + } else { + None + } + }).collect(), + _ => Vec::new(), + }; + + Ok(Push3InterpreterOutputs { + final_code_stack, + final_exec_stack, + final_int_stack, + }) + } + ExecutionResult::Revert { gas_used, output } => { + bail!("Call reverted: gas used={gas_used:?}, output={output:?}") + } + other => { + bail!("Call failed: {other:?}") + } + } + } + + /// A convenience method to run an `UntypedAst`: + /// - Convert AST => push3 code, + /// - Build a sublist descriptor in the exec stack, + /// - Call `run_interpreter`. + pub fn run_ast(&mut self, ast: &UntypedAst) -> Result { + // 1) Convert AST => push3 bytecode + let code_bytes = ast.to_bytecode(); + let code_len = code_bytes.len() as u32; + + // 2) Build a sublist descriptor + let descriptor = make_sublist_descriptor(0, code_len); + + // 3) Put code in `code` and sublist descriptor in `execStack` + let inputs = Push3InterpreterInputs { + code: code_bytes, + init_code_stack: Vec::new(), + init_exec_stack: vec![descriptor], + init_int_stack: Vec::new(), + }; + + // 4) Run interpreter + self.run_interpreter(&inputs) + } +}