From da041d513db70661904e09c55cdc471168ec3df6 Mon Sep 17 00:00:00 2001 From: rakita Date: Sun, 4 Sep 2022 21:25:13 +0200 Subject: [PATCH] revme some cleanup (#202) --- Cargo.lock | 543 ++--------------------- bins/revme/Cargo.toml | 4 +- bins/revme/README.md | 43 +- bins/revme/src/cmd.rs | 8 +- bins/revme/src/debugger/cmd.rs | 56 --- bins/revme/src/debugger/ctrl/cli.rs | 268 ----------- bins/revme/src/debugger/ctrl/ctrl.rs | 267 ----------- bins/revme/src/debugger/ctrl/history.rs | 97 ---- bins/revme/src/debugger/ctrl/mod.rs | 5 - bins/revme/src/debugger/mod.rs | 6 - bins/revme/src/debugger/runner.rs | 0 bins/revme/src/debugger/state_machine.rs | 16 - bins/revme/src/main.rs | 1 - bins/revme/src/statetest/runner.rs | 2 +- 14 files changed, 43 insertions(+), 1273 deletions(-) delete mode 100644 bins/revme/src/debugger/cmd.rs delete mode 100644 bins/revme/src/debugger/ctrl/cli.rs delete mode 100644 bins/revme/src/debugger/ctrl/ctrl.rs delete mode 100644 bins/revme/src/debugger/ctrl/history.rs delete mode 100644 bins/revme/src/debugger/ctrl/mod.rs delete mode 100644 bins/revme/src/debugger/mod.rs delete mode 100644 bins/revme/src/debugger/runner.rs delete mode 100644 bins/revme/src/debugger/state_machine.rs diff --git a/Cargo.lock b/Cargo.lock index c4371ab513..806507f293 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,20 +8,11 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.7", + "getrandom", "once_cell", "version_check", ] -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - [[package]] name = "ansi_term" version = "0.12.1" @@ -31,12 +22,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "anyhow" -version = "1.0.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c91f1f46651137be86f3a2b9a8359f9ab421d04d941c62b5982e1ca21113adf9" - [[package]] name = "arrayref" version = "0.3.6" @@ -151,7 +136,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55f9480d25c1283e8806b280f65e885b4fb840e8e8d72b784401233c9bd83202" dependencies = [ - "getrandom 0.2.7", + "getrandom", "js-sys", "primitive-types 0.11.1", "rustc-hex", @@ -190,12 +175,6 @@ version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -227,6 +206,7 @@ dependencies = [ "libc", "once_cell", "terminal_size", + "unicode-width", "winapi", ] @@ -280,7 +260,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f2b443d17d49dad5ef0ede301c3179cc923b8822f3393b4d2c28c269dd4a122" dependencies = [ "generic-array", - "rand_core 0.6.3", + "rand_core", "subtle", "zeroize", ] @@ -295,15 +275,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "csscolorparser" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2fb3bd93ef32553e3d5b9f8020028f41ac64ff8a230033d5d548b8222d21fbe" -dependencies = [ - "phf", -] - [[package]] name = "der" version = "0.6.0" @@ -346,27 +317,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" -dependencies = [ - "cfg-if 0.1.10", - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "ecdsa" version = "0.14.3" @@ -392,7 +342,7 @@ dependencies = [ "ff", "generic-array", "group", - "rand_core 0.6.3", + "rand_core", "sec1", "subtle", "zeroize", @@ -410,7 +360,7 @@ version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -470,21 +420,10 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df689201f395c6b90dfe87127685f8dbfc083a5e779e613575d8bd7314300c3e" dependencies = [ - "rand_core 0.6.3", + "rand_core", "subtle", ] -[[package]] -name = "filedescriptor" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7199d965852c3bac31f779ef99cbb4537f80e952e2d6aa0ffeb30cce00f4f46e" -dependencies = [ - "libc", - "thiserror", - "winapi", -] - [[package]] name = "fixed-hash" version = "0.7.0" @@ -492,7 +431,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ "byteorder", - "rand 0.8.5", + "rand", "rustc-hex", "static_assertions", ] @@ -645,27 +584,16 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] @@ -676,7 +604,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7391856def869c1c81063a03457c676fbcd419709c3dfb33d8d319de484b154d" dependencies = [ "ff", - "rand_core 0.6.3", + "rand_core", "subtle", ] @@ -917,14 +845,13 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.16.2" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" +checksum = "fcc42b206e70d86ec03285b123e65a5458c92027d1fb2ae3555878b8113b3ddf" dependencies = [ "console", - "lazy_static", "number_prefix", - "regex", + "unicode-width", ] [[package]] @@ -933,7 +860,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -978,10 +905,10 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2573d3fd3e4cc741affc9b5ce1a8ce36cf29f09f80f36da4309d0ae6d7854" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", - "sha2 0.10.3", + "sha2", "sha3 0.10.2", ] @@ -1022,7 +949,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1037,21 +964,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memmem" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64a92489e2744ce060c349162be1c5f33c6969234104dbd99ddb5feb08b8c15" - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "mime" version = "0.3.16" @@ -1066,7 +978,7 @@ checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys", ] @@ -1088,29 +1000,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nix" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", - "memoffset", -] - -[[package]] -name = "nom" -version = "5.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" -dependencies = [ - "memchr", - "version_check", -] - [[package]] name = "num" version = "0.4.0" @@ -1145,17 +1034,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "num-integer" version = "0.1.45" @@ -1254,7 +1132,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -1292,15 +1170,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "ordered-float" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" -dependencies = [ - "num-traits", -] - [[package]] name = "parity-scale-codec" version = "2.3.1" @@ -1369,7 +1238,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -1382,104 +1251,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pest" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69486e2b8c2d2aeb9762db7b4e00b0331156393555cff467f4163ff06821eef8" -dependencies = [ - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13570633aff33c6d22ce47dd566b10a3b9122c2fe9d8e7501895905be532b91" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c567e5702efdc79fb18859ea74c3eb36e14c43da7b8c1f098a4ed6514ec7a0" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb32be5ee3bbdafa8c7a18b0a8a8d962b66cfa2ceee4037f49267a50ee821fe" -dependencies = [ - "once_cell", - "pest", - "sha-1 0.10.0", -] - -[[package]] -name = "phf" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" -dependencies = [ - "phf_macros", - "phf_shared", - "proc-macro-hack", -] - -[[package]] -name = "phf_codegen" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" -dependencies = [ - "phf_generator", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" -dependencies = [ - "phf_shared", - "rand 0.7.3", -] - -[[package]] -name = "phf_macros" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" -dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "phf_shared" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" -dependencies = [ - "siphasher", -] - [[package]] name = "pin-project" version = "1.0.11" @@ -1593,12 +1364,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - [[package]] name = "proc-macro2" version = "1.0.42" @@ -1629,20 +1394,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", -] - [[package]] name = "rand" version = "0.8.5" @@ -1650,18 +1401,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -1671,16 +1412,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -1689,25 +1421,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.7", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -1719,34 +1433,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.7", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - [[package]] name = "remove_dir_all" version = "0.5.3" @@ -1837,7 +1523,7 @@ dependencies = [ "primitive-types 0.11.1", "ripemd", "secp256k1 0.24.0", - "sha2 0.10.3", + "sha2", "sha3 0.10.2", "substrate-bn", ] @@ -1860,7 +1546,6 @@ dependencies = [ "serde_json", "sha3 0.10.2", "structopt", - "termwiz", "thiserror", "triehash", "walkdir", @@ -1872,7 +1557,7 @@ version = "0.2.0" dependencies = [ "bn-rs", "bytes", - "getrandom 0.2.7", + "getrandom", "hex", "js-sys", "primitive-types 0.11.1", @@ -1922,7 +1607,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.12", + "semver", ] [[package]] @@ -2028,30 +1713,12 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] - [[package]] name = "semver" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" version = "1.0.144" @@ -2102,7 +1769,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug", @@ -2114,31 +1781,18 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.3", ] -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "sha2" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899bf02746a2c92bf1053d9327dadb252b01af1f81f90cdb902411f518bc7215" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.3", ] @@ -2165,16 +1819,6 @@ dependencies = [ "keccak", ] -[[package]] -name = "signal-hook" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" -dependencies = [ - "libc", - "signal-hook-registry", -] - [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -2191,15 +1835,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" dependencies = [ "digest 0.10.3", - "rand_core 0.6.3", + "rand_core", ] -[[package]] -name = "siphasher" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" - [[package]] name = "slab" version = "0.4.7" @@ -2236,7 +1874,7 @@ dependencies = [ "futures", "httparse", "log", - "rand 0.8.5", + "rand", "sha-1 0.9.8", ] @@ -2291,7 +1929,7 @@ dependencies = [ "byteorder", "crunchy", "lazy_static", - "rand 0.8.5", + "rand", "rustc-hex", ] @@ -2324,7 +1962,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", @@ -2342,65 +1980,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "terminfo" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76971977e6121664ec1b960d1313aacfa75642adc93b9d4d53b247bd4cb1747e" -dependencies = [ - "dirs", - "fnv", - "nom", - "phf", - "phf_codegen", -] - -[[package]] -name = "termios" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b" -dependencies = [ - "libc", -] - -[[package]] -name = "termwiz" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b5d95fe2dbccda80669b3e52d78d4c3572573675134538793b4e0bb771648dc" -dependencies = [ - "anyhow", - "base64", - "bitflags", - "cfg-if 1.0.0", - "filedescriptor", - "hex", - "lazy_static", - "libc", - "log", - "memmem", - "nix", - "num-derive", - "num-traits", - "ordered-float", - "pest", - "pest_derive", - "regex", - "semver 0.11.0", - "sha2 0.9.9", - "signal-hook", - "terminfo", - "termios", - "thiserror", - "ucd-trie", - "unicode-segmentation", - "vtparse", - "wezterm-bidi", - "wezterm-color-types", - "winapi", -] - [[package]] name = "textwrap" version = "0.11.0" @@ -2557,7 +2136,7 @@ version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-core", ] @@ -2593,12 +2172,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" -[[package]] -name = "ucd-trie" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c" - [[package]] name = "uint" version = "0.9.3" @@ -2656,12 +2229,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf8parse" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" - [[package]] name = "vcpkg" version = "0.2.15" @@ -2680,15 +2247,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "vtparse" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36ce903972602c84dd48f488cdce39edcba03a93b7ca67b146ae862568f48c5c" -dependencies = [ - "utf8parse", -] - [[package]] name = "walkdir" version = "2.3.2" @@ -2710,12 +2268,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2728,7 +2280,7 @@ version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -2753,7 +2305,7 @@ version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -2846,25 +2398,6 @@ dependencies = [ "url", ] -[[package]] -name = "wezterm-bidi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d75b2f860b26dd450c2a89c5a8c726a661716969c828a2eac671f8d6e44d673" -dependencies = [ - "log", -] - -[[package]] -name = "wezterm-color-types" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dfd66088741fbe014e04553f5496a2eef034ab0f718c61b8129b9048f8df815" -dependencies = [ - "csscolorparser", - "lazy_static", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/bins/revme/Cargo.toml b/bins/revme/Cargo.toml index 52aa8c5ef2..84c3aa3f5b 100644 --- a/bins/revme/Cargo.toml +++ b/bins/revme/Cargo.toml @@ -14,10 +14,9 @@ bytes = "1.1" hash-db = "0.15" hashbrown = "0.12" hex = "0.4" -indicatif = "0.16" +indicatif = "0.17" plain_hasher = "0.2" primitive-types = { version = "0.11", features = ["rlp", "serde"] } - revm = { path = "../../crates/revm", version = "1.3", default-features = false, features = ["web3db","std","secp256k1"] } rlp = { version = "0.5", default-features = false } serde = "1.0" @@ -25,7 +24,6 @@ serde_derive = "1.0" serde_json = "1.0" sha3 = { version = "0.10", default-features = false } structopt = "0.3" -termwiz = "0.16" # used for debugger ctrl thiserror = "1.0" triehash = "0.8" walkdir = "2.3" diff --git a/bins/revme/README.md b/bins/revme/README.md index b9f5b3f06f..2878c99085 100644 --- a/bins/revme/README.md +++ b/bins/revme/README.md @@ -1,43 +1,4 @@ # Rust EVM executor or short REVME -It is still work in progress and it is published for only reason to take cargo name. - -This is binary crate that executed evm multiple ways. Currently there are three parts: -* statetest: takes path to folder where ethereum statetest json can be found. It recursively searches for all json files and execute them. This is how i run all https://github.com/ethereum/tests to check if revm is compliant. Example `revme statests test/GenericEvmTest/` -* debug (WIP): - * (WIP) Interactive debugger with ability to change any parameter of EVM in runtime, specify breakpoints and do everything what you expect from debugger. - * (WIP) Allow inserting accounts,balances,storages. - * Specify web3 interface to bind database, for example use infura with option `--web infura_link`. - * (WIP) revert opcode implemented in EVM we can enable `rewind` of contract call so that you can go to start of contract call and start debugging again. We could even add `rewind opcode` besically rewind call and rerun it until program counter matches. - * (TODO) Specify EVM environment from file or from cli. -* run (TODO): Intention is to be able to specify contract bytes and input and run it. It is useful for testing and benchmarks - - -It is still WIP,but debugger can be very interesting, it gives you ability to step, modify stack/memory, set breakpoints and do everything what you would expect from standard debugger, with addition of rewinding step and contract calls. You can connect to exteranl web3 supported API and fetch for example live state from mainnet via infura, or you can set data local manupulation, either way this should be useful. - -This binary will be console based and interaction will be done via console inputs, this is great showcase this is first step. - -Example of commands WIP: -* `help` :) -* `step` -* `continue` -* `exit` -* `stepin` -* `stepout` -* `breakpoint ` -* `rewind` - * `rewind call` - * `rewind opcode` -* `print` - * `print all` - * `print stack` - * `print opcode` - * `...` -* `state` -* `state ` -* `account
` -* `account
balance ` -* `account
nonce ` -* `storage ` -* `storage set ` -* `...` \ No newline at end of file +This is binary crate that executed evm multiple ways. Currently it is used trun ethereum tests: +* statetest: takes path to folder where ethereum statetest json can be found. It recursively searches for all json files and execute them. This is how i run all https://github.com/ethereum/tests to check if revm is compliant. Example `revme statests test/GenericEvmTest/` \ No newline at end of file diff --git a/bins/revme/src/cmd.rs b/bins/revme/src/cmd.rs index 45db929711..8c833c78cc 100644 --- a/bins/revme/src/cmd.rs +++ b/bins/revme/src/cmd.rs @@ -1,13 +1,11 @@ +use crate::{runner, statetest}; use structopt::{clap::AppSettings, StructOpt}; -use crate::{debugger, runner, statetest}; - #[derive(StructOpt, Debug)] #[structopt(setting = AppSettings::InferSubcommands)] #[allow(clippy::large_enum_variant)] pub enum MainCmd { Statetest(statetest::Cmd), - Debug(debugger::Cmd), Run(runner::Cmd), } @@ -25,10 +23,6 @@ impl MainCmd { pub fn run(&self) -> Result<(), Error> { match self { Self::Statetest(cmd) => cmd.run().map_err(Error::Statetest), - Self::Debug(cmd) => { - cmd.run(); - Ok(()) - } _ => Ok(()), } } diff --git a/bins/revme/src/debugger/cmd.rs b/bins/revme/src/debugger/cmd.rs deleted file mode 100644 index 816219f001..0000000000 --- a/bins/revme/src/debugger/cmd.rs +++ /dev/null @@ -1,56 +0,0 @@ -use std::{fs::OpenOptions, path::PathBuf}; - -use revm::{db::Web3DB, Env, EVM}; -use structopt::StructOpt; - -use crate::cli_env::CliEnv; - -use super::ctrl::Controller; - -#[derive(StructOpt, Debug)] -pub struct Cmd { - /// specify web3 interface that we will fetch data from - #[structopt(long)] - web3: String, - #[structopt(long)] - block: Option, - /// File where CLI history is going to be saved. if not set history will not be flushed to file. - #[structopt(long, parse(from_os_str))] - history: Option, - #[structopt(flatten)] - env: CliEnv, -} - -impl Cmd { - pub fn run(&self) { - //https://mainnet.infura.io/v3/0954246eab5544e89ac236b668980810 - let db = Web3DB::new(&self.web3, self.block).unwrap(); - - let mut revm = EVM::new(); - revm.database(db); - revm.env.cfg.perf_all_precompiles_have_balance = true; - let env: Env = self.env.clone().into(); - revm.env.block = env.block; - revm.env.tx = env.tx; - // https://etherscan.io/tx/0x868942b2ba5dcb1e8fbb016d59b1ec1a3acab132d55a48212ba36d91f0c1bae6 - // revm.env.tx.caller = H160::from_str("0xee0235eb8602dac2830a878593c29a954aa617a0").unwrap(); - // revm.env.tx.value = U256::from(100000000); - // revm.env.tx.transact_to = - // TransactTo::Call(H160::from_str("0x7a250d5630b4cf539739df2c5dacb4c659f2488d").unwrap()); - // revm.env.tx.data = hex::decode("7ff36ab50000000000000000000000000000000000000000000000bf09b200842a36c90d0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000ee0235eb8602dac2830a878593c29a954aa617a00000000000000000000000000000000000000000000000000000000061aab4dd0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ca7b3ba66556c4da2e2a9afef9c64f909a59430a").unwrap().into(); - - // touch history file - if let Some(ref history) = self.history { - match OpenOptions::new().create(true).write(true).open(history) { - Ok(_) => (), - Err(e) => panic!("History file ({:?}) coudn't be touched", e), - } - } - - //let input: Bytes = hex::decode(&args[1]).unwrap().into(); - println!( - "STATE OUT:{:?}", - revm.inspect(Controller::new(self.history.clone())) - ); - } -} diff --git a/bins/revme/src/debugger/ctrl/cli.rs b/bins/revme/src/debugger/ctrl/cli.rs deleted file mode 100644 index 254d9d9d32..0000000000 --- a/bins/revme/src/debugger/ctrl/cli.rs +++ /dev/null @@ -1,268 +0,0 @@ -use std::{path::PathBuf, str::FromStr}; - -use primitive_types::{H160, U256}; -use termwiz::{ - cell::AttributeChange, - color::{AnsiColor, ColorAttribute, RgbColor}, - lineedit::*, -}; - -use super::{ - ctrl::{Ctrl, CtrlPrint}, - history::CliHistory, -}; - -pub struct CtrlCli { - history: CliHistory, -} - -const N: usize = usize::MAX; - -const CTREE: &[&[(usize, &str)]] = &[ - &[ - (N, "exit"), //0 - (N, "step"), //1 - (N, "continue"), //2 - (1, "account"), //3 - (2, "breakpoint"), //4 - (N, "restart"), //5 - (N, "help"), //6 - (3, "print"), //7 - (4, "stack"), //8 - ], - /*1*/ &[(N, "original"), (N, "0x00000000000000000000")], - /*2*/ &[(N, "0x00000000000000000000")], - /*3*/ &[(N, "all"), (N, "stack"), (N, "opcode"), (N, "memory")], - /*4*/ &[(N, "pop"), (2, "push")], -]; - -pub fn parse_u256(str: &str) -> Option { - if str.len() > 2 && &str[..2] == "0x" { - U256::from_str(&str[2..]).ok() - } else { - U256::from_dec_str(str).ok() - } -} - -pub fn parse_address(addr: &str, info: &str) -> Option { - if addr.len() < 40 { - println!("Error: :{} not big enough. Expect 20bytes hex ", &info); - return None; - } - let addr = if &addr[0..2] == "0x" { - &addr[2..] - } else { - addr - }; - let addr = match hex::decode(addr) { - Ok(hex) => H160::from_slice(&hex), - Err(_) => { - println!("Error: {} not in hex format", &info); - - return None; - } - }; - Some(addr) -} - -impl CtrlCli { - pub fn ctrl(&self, line: &str) -> Option { - let words: Vec<&str> = line.split_whitespace().collect(); - let len = words.len(); - match len { - 0 => None, - 1 => { - let w1 = words[0]; - let exit = CTREE[0][0].1; - let step = CTREE[0][1].1; - let continu = CTREE[0][2].1; - let restart = CTREE[0][5].1; - let help = CTREE[0][6].1; - if w1 == exit { - Some(Ctrl::Exit) - } else if w1 == step { - Some(Ctrl::Step) - } else if w1 == continu { - Some(Ctrl::Continue) - } else if w1 == restart { - Some(Ctrl::Restart) - } else if w1 == help { - Some(Ctrl::Help) - } else { - None - } - } - 2 => { - let w1 = words[0]; - let w2 = words[1]; - let (_, account) = CTREE[0][3]; - let (printn, print) = CTREE[0][7]; - let stack = CTREE[0][8]; - if w1 == account { - if let Some(address) = parse_address(w2, "Account address not valid") { - return Some(Ctrl::AccountPrint(address)); - } - None - } else if w1 == print { - let all = CTREE[printn][0].1; - let stack = CTREE[printn][1].1; - let opcode = CTREE[printn][2].1; - let memory = CTREE[printn][3].1; - if w2 == all { - return Some(Ctrl::Print(CtrlPrint::All)); - } else if w2 == stack { - return Some(Ctrl::Print(CtrlPrint::Stack)); - } else if w2 == opcode { - return Some(Ctrl::Print(CtrlPrint::Opcode)); - } else if w2 == memory { - return Some(Ctrl::Print(CtrlPrint::Memory)); - } - None - } else if w1 == stack.1 { - let pop = CTREE[stack.0][0].1; - if w2 == pop { - return Some(Ctrl::StackPop); - } - None - } else { - None - } - } - 3 => { - let w1 = words[0]; - let w2 = words[1]; - let w3 = words[2]; - //account - let account = CTREE[0][3].1; - let stack = CTREE[0][8]; - - if w1 == account { - let original = CTREE[1][0].1; - let address = parse_address(w3, "Account address not valid")?; - if w2 == original { - return Some(Ctrl::AccountPrintOriginal(address)); - } - } else if w1 == stack.1 { - let pop = CTREE[stack.0][1].1; - if w2 == pop { - if let Some(stack_item) = parse_u256(w3) { - return Some(Ctrl::StackPush(stack_item)); - } else { - println!("stack values not valid"); - } - } - } - None - } - _ => None, - } - } - pub fn new(history_file: Option) -> Self { - Self { - history: CliHistory::new(history_file), - } - } -} - -impl LineEditorHost for CtrlCli { - // Render the prompt with a darkslateblue background color if - // the terminal supports true color, otherwise render it with - // a navy blue ansi color. - fn render_prompt(&self, prompt: &str) -> Vec { - vec![ - OutputElement::Attribute(AttributeChange::Background( - ColorAttribute::TrueColorWithPaletteFallback( - RgbColor::from_named("darkslateblue").unwrap(), - AnsiColor::Navy.into(), - ), - )), - OutputElement::Text(prompt.to_owned()), - ] - } - - fn history(&mut self) -> &mut dyn History { - &mut self.history - } - - /// Demo of the completion API for words starting with "h" or "he" - fn complete(&self, line: &str, cursor_position: usize) -> Vec { - let mut candidates = vec![]; - if let Some((range, word)) = word_at_cursor(line, cursor_position) { - //let words = &["hello", "help", "he-man"]; - let mut id = 0; - let mut has_word = false; - for word in line[..range.start].split_ascii_whitespace() { - if let Some(ctree) = CTREE.get(id) { - for (ctree_id, ctree_word) in ctree.iter() { - if word == *ctree_word { - has_word = true; - id = *ctree_id; - break; - } - } - - if !has_word { - break; - } - } else { - break; - } - } - if let Some(&words) = CTREE.get(id) { - for (_, w) in words { - if w.starts_with(word) { - candidates.push(CompletionCandidate { - range: range.clone(), - text: w.to_string(), - }); - } - } - } - } - candidates - } -} - -/// This is a conceptually simple function that computes the bounds -/// of the whitespace delimited word at the specified cursor position -/// in the supplied line string. -/// It returns the range and the corresponding slice out of the line. -/// This function is sufficient for example purposes; in a real application -/// the equivalent function would need to be aware of quoting and other -/// application specific context. -fn word_at_cursor(line: &str, cursor_position: usize) -> Option<(std::ops::Range, &str)> { - let char_indices: Vec<(usize, char)> = line.char_indices().collect(); - if char_indices.is_empty() { - return None; - } - let char_position = char_indices - .iter() - .position(|(idx, _)| *idx == cursor_position) - .unwrap_or(char_indices.len()); - - // Look back until we find whitespace - let mut start_position = char_position; - while start_position > 0 - && start_position <= char_indices.len() - && !char_indices[start_position - 1].1.is_whitespace() - { - start_position -= 1; - } - - // Look forwards until we find whitespace - let mut end_position = char_position; - while end_position < char_indices.len() && !char_indices[end_position].1.is_whitespace() { - end_position += 1; - } - - if end_position > start_position { - let range = char_indices[start_position].0 - ..char_indices - .get(end_position) - .map(|c| c.0 + 1) - .unwrap_or(line.len()); - Some((range.clone(), &line[range])) - } else { - None - } -} diff --git a/bins/revme/src/debugger/ctrl/ctrl.rs b/bins/revme/src/debugger/ctrl/ctrl.rs deleted file mode 100644 index cedf2ac6e8..0000000000 --- a/bins/revme/src/debugger/ctrl/ctrl.rs +++ /dev/null @@ -1,267 +0,0 @@ -use std::path::PathBuf; - -use bytes::Bytes; - -use primitive_types::{H160, U256}; -use revm::{CallInputs, CreateInputs, Database, EVMData, Gas, Inspector, Return, OPCODE_JUMPMAP}; - -use termwiz::lineedit::*; - -use super::cli::CtrlCli; - -#[derive(Debug)] -pub enum Ctrl { - Exit, - None, - Step, - //StepIn, - //StepOut, - Continue, - Restart, - Help, - //Breakpoint(H160, usize), - AccountPrint(H160), - AccountPrintOriginal(H160), - Print(CtrlPrint), - StackPop, - StackPush(U256), - // RewindCall, - // RewindOpcode, - // Stack, - // StackSet, - // Memory, - // MemorySet, - // Account, - // AccountSetBalance, - // AccountSetNonce, - // Storage, - // StorageSet -} - -#[derive(Debug)] -pub enum CtrlPrint { - All, - Stack, - Opcode, - Memory, -} - -impl Ctrl { - fn next(state: StateMachine, history_path: &Option) -> Self { - match state { - StateMachine::TriggerBreakpoint | StateMachine::TriggerStep => { - Self::parse_cli(history_path) - } - StateMachine::StepOut => { - //if it is step_out we skip any command and want to return - Ctrl::None - } - _ => Ctrl::None, - } - } - - pub fn parse_cli(history_path: &Option) -> Ctrl { - let mut terminal = line_editor_terminal().unwrap(); - let mut editor = LineEditor::new(&mut terminal); - - let mut host = CtrlCli::new(history_path.clone()); - let out = loop { - if let Some(line) = editor.read_line(&mut host).unwrap() { - if line == "exit" { - break Ctrl::Exit; - } - - host.history().add(&line); - if let Some(ctrl) = host.ctrl(&line) { - return ctrl; - } - } - }; - out - } -} - -#[derive(Clone, Copy, Debug)] -pub enum StateMachine { - Exit, - TriggerStep, - TriggerBreakpoint, - StepOut, -} - -pub struct Controller { - state_interp: StateMachine, - history_path: Option, - //call_stack: Vec<>, -} - -impl Controller { - pub fn new(history_path: Option) -> Self { - Self { - state_interp: StateMachine::TriggerStep, - history_path, - } - } -} - -/// -impl Inspector for Controller { - fn step( - &mut self, - interp: &mut revm::Interpreter, - data: &mut EVMData<'_, DB>, - _is_static: bool, - ) -> Return { - loop { - match Ctrl::next(self.state_interp, &self.history_path) { - Ctrl::Help => { - println!( - "available controls: \nstep\nexit\nprint all\nstack pop\nstack push 10\n" - ) - } - Ctrl::Exit => { - self.state_interp = StateMachine::Exit; - break; - } - Ctrl::Step => { - self.state_interp = StateMachine::TriggerStep; - break; - } - //Ctrl::StepIn => {} - //Ctrl::StepOut => { - // self.state_interp = StateMachine::StepOut; - //} - Ctrl::Print(print) => match print { - CtrlPrint::All => { - let opcode = interp - .contract - .bytecode - .bytecode() - .get(interp.program_counter()) - .cloned() - .unwrap(); - let gas_spend = interp.gas().spend(); - let gas_remaining = interp.gas().remaining(); - println!( - "call_depth:{} PC:{} Opcode: {:#x} {:?} gas(spend,remaining):({},{})\n\ - Stack:{}", - data.journaled_state.depth(), - interp.program_counter(), - opcode, - OPCODE_JUMPMAP[opcode as usize].unwrap_or("Invalid"), - gas_spend, - gas_remaining, - interp.stack(), - ); - } - CtrlPrint::Opcode => { - let opcode = *interp - .contract - .bytecode - .bytecode() - .get(interp.program_counter()) - .unwrap(); - println!( - "PC:{} OpCode: {:#x} {:?}", - interp.program_counter(), - opcode, - OPCODE_JUMPMAP[opcode as usize] - ) - } - CtrlPrint::Stack => { - println!("PC:{} stack:{}", interp.program_counter(), interp.stack()) - } - CtrlPrint::Memory => { - println!("memory:{}", hex::encode(interp.memory.data())) - } - }, - Ctrl::Continue => { - self.state_interp = StateMachine::TriggerBreakpoint; - break; - } - Ctrl::Restart => { - //data.subroutine.checkpoint_revert(checkpoint) - println!("t:{:?}", StateMachine::StepOut); - } - //Ctrl::Breakpoint(add, pc) => println!( - // "Setting breakpoint for contract {} on program counter:{}", - // add, pc - //), - Ctrl::AccountPrint(address) => { - println!("print:{:?}", data.journaled_state.state().get(&address)) - } - Ctrl::AccountPrintOriginal(_address) => (), - Ctrl::StackPop => { - println!("pop:{:?}", interp.stack.pop()); - } - Ctrl::StackPush(value) => match interp.stack.push(value) { - Ok(()) => println!("stack:{}", interp.stack()), - Err(e) => println!("push error:{:?}", e), - }, - Ctrl::None => break, - } - } - Return::Continue - } - - fn step_end( - &mut self, - _interp: &mut revm::Interpreter, - _data: &mut EVMData<'_, DB>, - _is_static: bool, - _eval: revm::Return, - ) -> Return { - Return::Continue - } - - fn call( - &mut self, - _data: &mut revm::EVMData<'_, DB>, - _inputs: &mut CallInputs, - _is_static: bool, - ) -> (Return, Gas, Bytes) { - (Return::Continue, Gas::new(0), Bytes::new()) - } - - fn call_end( - &mut self, - _data: &mut EVMData<'_, DB>, - _inputs: &CallInputs, - remaining_gas: Gas, - ret: Return, - out: Bytes, - _is_static: bool, - ) -> (Return, Gas, Bytes) { - if let StateMachine::StepOut = self.state_interp { - self.state_interp = StateMachine::TriggerStep - } - - (ret, remaining_gas, out) - } - - fn create( - &mut self, - _data: &mut revm::EVMData<'_, DB>, - _inputs: &mut CreateInputs, - ) -> (Return, Option, Gas, Bytes) { - (Return::Continue, None, Gas::new(0), Bytes::new()) - } - - fn create_end( - &mut self, - _data: &mut EVMData<'_, DB>, - _inputs: &CreateInputs, - ret: Return, - address: Option, - remaining_gas: Gas, - out: Bytes, - ) -> (Return, Option, Gas, Bytes) { - if let StateMachine::StepOut = self.state_interp { - self.state_interp = StateMachine::TriggerStep - } - - (ret, address, remaining_gas, out) - } - - fn selfdestruct(&mut self) {} -} diff --git a/bins/revme/src/debugger/ctrl/history.rs b/bins/revme/src/debugger/ctrl/history.rs deleted file mode 100644 index b7ba77099e..0000000000 --- a/bins/revme/src/debugger/ctrl/history.rs +++ /dev/null @@ -1,97 +0,0 @@ -use std::{borrow::Cow, collections::VecDeque, path::PathBuf}; - -use hashbrown::HashMap; -use std::{ - fs::{File, OpenOptions}, - io::{prelude::*, BufReader}, -}; -use termwiz::lineedit::{History, HistoryIndex, SearchDirection, SearchResult, SearchStyle}; - -pub struct CliHistory { - entries: VecDeque, - file_name: Option, -} - -impl CliHistory { - pub fn new(file_name: Option) -> Self { - if let Some(ref file) = file_name { - let mut lines: HashMap = HashMap::new(); - - let file = File::open(file).unwrap(); - let reader = BufReader::new(file); - let mut num = 0; - for line in reader.lines().map(|l| l.unwrap()) { - if lines.try_insert(line, num).is_ok() { - num += 1; - } - } - let mut entries = VecDeque::with_capacity(lines.len()); - entries.resize(lines.len(), String::new()); - for (key, val) in lines { - *entries.get_mut(val).unwrap() = key; - } - Self { entries, file_name } - } else { - Self { - entries: VecDeque::new(), - file_name: None, - } - } - } -} - -impl History for CliHistory { - fn get(&self, idx: HistoryIndex) -> Option> { - self.entries.get(idx).map(|s| Cow::Borrowed(s.as_str())) - } - - fn last(&self) -> Option { - if self.entries.is_empty() { - None - } else { - Some(self.entries.len() - 1) - } - } - - fn add(&mut self, line: &str) { - if self.entries.back().map(String::as_str) == Some(line) { - return; - } - self.entries.push_back(line.to_owned()); - if let Some(ref file_name) = self.file_name { - let mut file = OpenOptions::new() - .write(true) - .append(true) - .open(file_name) - .unwrap(); - - if let Err(e) = writeln!(file, "{}", line) { - eprintln!("Couldn't write to history file: {e}"); - } - } - } - - fn search( - &self, - idx: HistoryIndex, - style: SearchStyle, - direction: SearchDirection, - pattern: &str, - ) -> Option { - let mut idx = idx; - - loop { - let line = self.entries.get(idx)?; - - if let Some(cursor) = style.match_against(pattern, line) { - return Some(SearchResult { - line: Cow::Borrowed(line.as_str()), - idx, - cursor, - }); - } - - idx = direction.next(idx)?; - } - } -} diff --git a/bins/revme/src/debugger/ctrl/mod.rs b/bins/revme/src/debugger/ctrl/mod.rs deleted file mode 100644 index 954b2bb11d..0000000000 --- a/bins/revme/src/debugger/ctrl/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod cli; -mod ctrl; -mod history; - -pub use ctrl::Controller; diff --git a/bins/revme/src/debugger/mod.rs b/bins/revme/src/debugger/mod.rs deleted file mode 100644 index c6669fa693..0000000000 --- a/bins/revme/src/debugger/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -mod cmd; -#[allow(clippy::module_inception)] //TODO make it better -mod ctrl; - -pub use cmd::Cmd; -pub use ctrl::Controller; diff --git a/bins/revme/src/debugger/runner.rs b/bins/revme/src/debugger/runner.rs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/bins/revme/src/debugger/state_machine.rs b/bins/revme/src/debugger/state_machine.rs deleted file mode 100644 index 52d12770d5..0000000000 --- a/bins/revme/src/debugger/state_machine.rs +++ /dev/null @@ -1,16 +0,0 @@ - -pub enum StateMachine { - Init, -} - - - -impl StateMachine { - pub fn new() -> Self { - Self::Init - } - - pub fn eval(&mut self) { - - } -} \ No newline at end of file diff --git a/bins/revme/src/main.rs b/bins/revme/src/main.rs index 292aed344c..70a2999c67 100644 --- a/bins/revme/src/main.rs +++ b/bins/revme/src/main.rs @@ -1,5 +1,4 @@ mod cmd; -mod debugger; mod exec; mod runner; mod statetest; diff --git a/bins/revme/src/statetest/runner.rs b/bins/revme/src/statetest/runner.rs index 805500cde4..69ec674ec5 100644 --- a/bins/revme/src/statetest/runner.rs +++ b/bins/revme/src/statetest/runner.rs @@ -324,7 +324,7 @@ pub fn run(test_files: Vec) -> Result<(), TestError> { for handler in joins { handler.join().map_err(|_| TestError::SystemError)??; } - console_bar.finish_at_current_pos(); + console_bar.finish(); println!("Finished execution. Time:{:?}", elapsed.lock().unwrap()); Ok(()) }