diff --git a/Cargo.lock b/Cargo.lock index cf9af79a..8c41685c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,9 +69,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "api_derive" @@ -112,7 +112,7 @@ version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9834fcc22e0874394a010230586367d4a3e9f11b560f469262678547e1d2575e" dependencies = [ - "bstr 1.2.0", + "bstr 1.3.0", "doc-comment", "predicates", "predicates-core", @@ -122,9 +122,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.64" +version = "0.1.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" +checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc" dependencies = [ "proc-macro2", "quote", @@ -267,9 +267,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f0778972c64420fdedc63f09919c8a88bda7b25135357fd25a5d9f3257e832" +checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" dependencies = [ "memchr", "once_cell", @@ -381,9 +381,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.4" +version = "4.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5" dependencies = [ "bitflags", "clap_derive", @@ -396,9 +396,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.1.0" +version = "4.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +checksum = "44bec8e5c9d09e439c4335b1af0abaab56dcf3b94999a936e1bb47b9134288f0" dependencies = [ "heck", "proc-macro-error", @@ -409,13 +409,24 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" dependencies = [ "os_str_bytes", ] +[[package]] +name = "clipboard-win" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" +dependencies = [ + "error-code", + "str-buf", + "winapi", +] + [[package]] name = "cmake" version = "0.1.49" @@ -460,7 +471,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.17", + "time 0.3.20", "version_check", ] @@ -476,7 +487,7 @@ dependencies = [ "publicsuffix", "serde", "serde_json", - "time 0.3.17", + "time 0.3.20", "url", ] @@ -531,9 +542,9 @@ checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ "cfg-if", ] @@ -614,9 +625,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc831ee6a32dd495436e317595e639a587aa9907bef96fe6e6abc290ab6204e9" +checksum = "9a140f260e6f3f79013b8bfc65e7ce630c9ab4388c6a89c71e07226f49487b72" dependencies = [ "cc", "cxxbridge-flags", @@ -626,9 +637,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94331d54f1b1a8895cd81049f7eaaaef9d05a7dcb4d1fd08bf3ff0806246789d" +checksum = "da6383f459341ea689374bf0a42979739dc421874f112ff26f829b8040b8e613" dependencies = [ "cc", "codespan-reporting", @@ -641,15 +652,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48dcd35ba14ca9b40d6e4b4b39961f23d835dbb8eed74565ded361d93e1feb8a" +checksum = "90201c1a650e95ccff1c8c0bb5a343213bdd317c6e600a93075bca2eff54ec97" [[package]] name = "cxxbridge-macro" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bbeb29798b407ccd82a3324ade1a7286e0d29851475990b612670f6f5124d2" +checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56" dependencies = [ "proc-macro2", "quote", @@ -698,7 +709,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" dependencies = [ "libc", - "redox_users", + "redox_users 0.3.5", + "winapi", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users 0.4.3", "winapi", ] @@ -758,6 +790,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + [[package]] name = "errno" version = "0.2.8" @@ -779,6 +817,16 @@ dependencies = [ "libc", ] +[[package]] +name = "error-code" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" +dependencies = [ + "libc", + "str-buf", +] + [[package]] name = "extfmt" version = "0.1.1" @@ -809,13 +857,24 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] +[[package]] +name = "fd-lock" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ef1a30ae415c3a691a4f41afddc2dbcd6d70baf338368d85ebc1e8ed92cedb9" +dependencies = [ + "cfg-if", + "rustix", + "windows-sys 0.45.0", +] + [[package]] name = "float-cmp" version = "0.9.0" @@ -978,15 +1037,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "h2" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" dependencies = [ "bytes", "fnv", @@ -1034,6 +1093,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hex" version = "0.3.2" @@ -1097,9 +1162,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -1250,9 +1315,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" dependencies = [ "libc", "windows-sys 0.45.0", @@ -1266,14 +1331,14 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -1287,15 +1352,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" dependencies = [ "libc", ] @@ -1449,14 +1514,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -1477,6 +1542,27 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "nix" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags", + "cfg-if", + "libc", +] + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -1597,9 +1683,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -1826,9 +1912,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -1877,6 +1963,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + [[package]] name = "rand" version = "0.7.3" @@ -1974,6 +2070,17 @@ dependencies = [ "rust-argon2", ] +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom 0.2.8", + "redox_syscall 0.2.16", + "thiserror", +] + [[package]] name = "regex" version = "1.7.1" @@ -1997,15 +2104,6 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "reqwest" version = "0.11.14" @@ -2071,23 +2169,46 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.36.7" +version = "0.36.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" +checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.42.0", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustyline" +version = "10.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1e83c32c3f3c33b08496e0d1df9ea8c64d39adb8eb36a1ebb1440c690697aef" +dependencies = [ + "bitflags", + "cfg-if", + "clipboard-win", + "dirs-next", + "fd-lock", + "libc", + "log", + "memchr", + "nix", + "radix_trie", + "scopeguard", + "unicode-segmentation", + "unicode-width", + "utf8parse", + "winapi", ] [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "salsa20" @@ -2115,9 +2236,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "scrypt" @@ -2185,9 +2306,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" dependencies = [ "indexmap", "itoa", @@ -2197,9 +2318,9 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" +checksum = "395627de918015623b32e7669714206363a7fc00382bf477e72c1f7533e8eafc" dependencies = [ "proc-macro2", "quote", @@ -2255,9 +2376,9 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" +checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" dependencies = [ "libc", "signal-hook-registry", @@ -2276,9 +2397,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] @@ -2322,9 +2443,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -2337,9 +2458,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", @@ -2360,7 +2481,7 @@ version = "0.66.0" source = "git+https://github.com/tonlabs/TON-Solidity-Compiler.git?tag=0.66.0#0436b43674dad4e61e7ccb910df169735f324eae" dependencies = [ "atty", - "clap 4.1.4", + "clap 4.1.8", "cmake", "dunce", "failure", @@ -2371,9 +2492,15 @@ dependencies = [ "ton_abi", "ton_block", "ton_types", - "tvm_linker", + "tvm_linker 0.18.4", ] +[[package]] +name = "str-buf" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" + [[package]] name = "string-error" version = "0.1.0" @@ -2409,9 +2536,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -2432,16 +2559,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" dependencies = [ "cfg-if", "fastrand", - "libc", "redox_syscall 0.2.16", - "remove_dir_all", - "winapi", + "rustix", + "windows-sys 0.42.0", ] [[package]] @@ -2481,18 +2607,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ "proc-macro2", "quote", @@ -2512,9 +2638,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.17" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ "itoa", "serde", @@ -2530,9 +2656,9 @@ checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" dependencies = [ "time-core", ] @@ -2573,9 +2699,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.25.0" +version = "1.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" dependencies = [ "autocfg", "bytes", @@ -2588,7 +2714,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -2604,9 +2730,9 @@ dependencies = [ [[package]] name = "tokio-native-tls" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", @@ -2625,9 +2751,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" dependencies = [ "futures-core", "pin-project-lite", @@ -2650,9 +2776,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ "bytes", "futures-core", @@ -2910,7 +3036,7 @@ dependencies = [ [[package]] name = "tonos-cli" -version = "0.32.0" +version = "0.32.1" dependencies = [ "assert_cmd", "async-trait", @@ -2931,6 +3057,7 @@ dependencies = [ "qr2term", "regex", "reqwest", + "rustyline", "serde", "serde_derive", "serde_json", @@ -2949,6 +3076,7 @@ dependencies = [ "ton_sdk", "ton_types", "ton_vm", + "tvm_linker 0.19.4", "url", ] @@ -3033,6 +3161,35 @@ dependencies = [ "ton_vm", ] +[[package]] +name = "tvm_linker" +version = "0.19.4" +source = "git+https://github.com/tonlabs/TVM-linker.git?tag=0.19.4#e7f756d76887485befa1ac67faa28c2c9b6ce9a6" +dependencies = [ + "base64 0.13.1", + "clap 2.34.0", + "crc 3.0.1", + "ed25519", + "ed25519-dalek", + "failure", + "hex 0.4.3", + "lazy_static", + "log", + "num", + "num-traits", + "rand 0.8.5", + "regex", + "serde", + "serde_json", + "sha2 0.10.6", + "simplelog 0.5.3", + "ton_abi", + "ton_block", + "ton_labs_assembler", + "ton_types", + "ton_vm", +] + [[package]] name = "typenum" version = "1.16.0" @@ -3047,9 +3204,9 @@ checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-normalization" @@ -3060,6 +3217,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-width" version = "0.1.10" @@ -3410,9 +3573,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.6+zstd.1.5.2" +version = "2.0.7+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a3f9792c0c3dc6c165840a75f47ae1f4da402c2d006881129579f6597e801b" +checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5" dependencies = [ "cc", "libc", diff --git a/Cargo.toml b/Cargo.toml index f6995d60..f3aa4bdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ license = 'Apache-2.0' name = 'tonos-cli' readme = 'README.md' repository = 'https://github.com/tonlabs/tonos-cli' -version = '0.32.0' +version = '0.32.1' default-run = 'tonos-cli' [features] @@ -39,6 +39,7 @@ num-traits = '0.2' qr2term = '0.2' regex = '1.5' reqwest = '0.11' +rustyline = '10.1.1' serde_derive = '1.0' serde_json = '1.0' sha2 = '0.10' @@ -57,6 +58,7 @@ ton_labs_assembler = { git = 'https://github.com/tonlabs/ton-labs-assembler.git' ton_sdk = { git = 'https://github.com/tonlabs/TON-SDK.git', tag = '1.40.0' } ton_types = { git = 'https://github.com/tonlabs/ton-labs-types.git', tag = '1.12.6' } ton_vm = { git = 'https://github.com/tonlabs/ton-labs-vm.git', tag = '1.8.96' } +tvm_linker = { git = 'https://github.com/tonlabs/TVM-linker.git', tag = '0.19.4' } sold = { git = 'https://github.com/tonlabs/TON-Solidity-Compiler.git', tag = '0.66.0', optional = true } [dev-dependencies] diff --git a/src/debug.rs b/src/debug.rs index e704983b..b1d8da55 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -14,6 +14,7 @@ use crate::{contract_data_from_matches_or_config_alias, FullConfig, print_args, unpack_alternative_params}; use clap::{ArgMatches, SubCommand, Arg, App}; use crate::config::Config; +use crate::debugger::debug_callback; use crate::helpers::{load_ton_address, create_client, load_abi, now_ms, construct_account_from_tvc, query_account_field, query_with_limit, create_client_verbose, abi_from_matches_or_config, load_debug_info, wc_from_matches_or_config, @@ -291,6 +292,10 @@ pub fn create_debug_command<'a, 'b>() -> App<'a, 'b> { .takes_value(true) .conflicts_with_all(&["CONFIG_PATH", "DEFAULT_CONFIG"]); + let interactive_arg = Arg::with_name("INTERACTIVE") + .help("Interactive mode") + .long("--interactive"); + SubCommand::with_name("debug") .about("Debug commands.") .subcommand(SubCommand::with_name("transaction") @@ -305,7 +310,8 @@ pub fn create_debug_command<'a, 'b>() -> App<'a, 'b> { .arg(tx_id_arg.clone()) .arg(dump_config_arg.clone()) .arg(dump_contract_arg.clone()) - .arg(config_boc_arg.clone())) + .arg(config_boc_arg.clone()) + .arg(interactive_arg.clone())) .subcommand(SubCommand::with_name("account") .about("Loads list of the last transactions for the specified account. User should choose which one to debug.") .arg(default_config_arg.clone()) @@ -1190,7 +1196,9 @@ fn generate_callback(matches: Option<&ArgMatches<'_>>, config: &Config) -> Optio }, _ => None }; - Some(if matches.is_present("FULL_TRACE") { + Some(if matches.is_present("INTERACTIVE") { + Arc::new(move |engine, info| debug_callback(engine, info, &debug_info)) + } else if matches.is_present("FULL_TRACE") { Arc::new(move |_, info| trace_callback(info, &debug_info)) } else { Arc::new(move |_, info| trace_callback_minimal(info, &debug_info)) diff --git a/src/debugger.rs b/src/debugger.rs new file mode 100644 index 00000000..ae839f7c --- /dev/null +++ b/src/debugger.rs @@ -0,0 +1,316 @@ +/* + * Copyright 2023 TON DEV SOLUTIONS LTD. + * + * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use + * this file except in compliance with the License. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific TON DEV software governing permissions and + * limitations under the License. + */ + +use std::{collections::HashSet, sync::Arc}; + +use ton_labs_assembler::DbgInfo; +use ton_types::{UInt256, SliceData}; +use ton_utils::disasm::loader::{Loader, print_code_ex}; +use ton_vm::{stack::savelist::SaveList, executor::{Engine, EngineTraceInfo, EngineTraceInfoType}}; + +fn help() { + println!("h or ? for help"); + println!("q quit the debugger"); + println!("s step one instruction"); + println!("b loc set a breakpoint at loc = hash:offset"); + println!("c continue execution until a breakpoint"); + println!("p gas print gas"); + println!("p sN print stack slot N"); + println!("p sN.. print stack slots from s0 to sN"); + println!("p cN print control register"); + println!("p cc print current continuation register"); + println!("p print all stack and registers"); + println!(" repeat last command"); +} + +#[derive(Eq, PartialEq, Hash)] +struct Breakpoint { + cell_hash: UInt256, + offset: usize, +} + +impl Breakpoint { + fn new(cell_hash: UInt256, offset: usize) -> Self { + Self { cell_hash, offset } + } +} + +#[derive(PartialEq)] +enum Next { + Start, + Step, + Continue, + Quit, +} + +struct DebugState { + editor: rustyline::Editor<()>, + next: Next, + last: Option, + breakpoints: HashSet, +} + +lazy_static::lazy_static!( + static ref DEBUG_STATE: Arc>> = + Arc::new(std::sync::Mutex::new(None)); +); + +#[derive(Clone)] +enum Command { + Help, + Quit, + Step, + Continue, + Breakpoint(UInt256, usize), + PrintGas, + PrintStack(std::ops::Range), + PrintRegister(usize), + PrintCC, + PrintAll, +} + +fn parse_line(state: &mut DebugState, line: String) -> Result { + let lower = line.to_lowercase(); + let split = lower.split_whitespace().collect::>(); + if split.len() == 0 { + if let Some(cmd) = &state.last { + return Ok(cmd.clone()) + } else { + return Err("there's no last command".to_string()) + } + } else if split.len() == 1 { + let word = split[0]; + if word == "h" || word == "?" { + return Ok(Command::Help) + } else if word == "q" { + return Ok(Command::Quit) + } else if word == "s" { + return Ok(Command::Step) + } else if word == "c" { + return Ok(Command::Continue) + } else if word == "p" { + return Ok(Command::PrintAll) + } + } else if split.len() == 2 { + let word1 = split[0]; + let word2 = split[1]; + if word1 == "p" { + if word2 == "gas" { + return Ok(Command::PrintGas) + } else if word2 == "cc" { + return Ok(Command::PrintCC); + } else if word2.starts_with("c") { + let num = word2[1..].parse::() + .map_err(|e| format!("{}", e))?; + return Ok(Command::PrintRegister(num as usize)) + } else if word2.starts_with("s") { + if word2.ends_with("..") { + let num = word2[1..word2.len() - 2].parse::() + .map_err(|e| format!("{}", e))?; + return Ok(Command::PrintStack(0..num as usize + 1)) + } else { + let num = word2[1..].parse::() + .map_err(|e| format!("{}", e))?; + return Ok(Command::PrintStack(num as usize..num as usize + 1)) + } + } + } else if word1 == "b" { + let (s1, s2) = word2.split_once(":") + .ok_or(format!("bad parameter {}", word2))?; + let cell_hash = hex::decode(s1) + .map_err(|e| format!("{}", e))?; + let cell_hash = UInt256::from_raw(cell_hash, 256); + let offset = hex::decode(s2) + .map_err(|e| format!("{}", e))?; + if offset.len() != 1 { + return Err(format!("failed to parse offset {}", s2)) + } + return Ok(Command::Breakpoint(cell_hash, offset[0] as usize)) + } + } + Err("unknown command".to_string()) +} + +fn print_cc(info: &EngineTraceInfo) { + let cc = info.cmd_code.cell().clone(); + let mut loader = Loader::new(false); + match loader.load(&mut SliceData::load_cell(cc).unwrap(), false) { + Err(_) => println!("failed to disasm"), + Ok(code) => { + let disasm = print_code_ex(&code, "", false); + print!("{}", disasm); + } + } +} + +fn execute_line(state: &mut DebugState, engine: &Engine, info: &EngineTraceInfo) { + loop { + match state.editor.readline("(dbg) ") { + Ok(line) => { + let cmd = parse_line(state, line.clone()); + if let Ok(cmd) = &cmd { + state.editor.add_history_entry(line.as_str()); + state.last = Some(cmd.clone()); + } + match cmd { + Ok(Command::Help) => help(), + Ok(Command::Quit) => { + state.next = Next::Quit; + break + } + Ok(Command::Step) => { + state.next = Next::Step; + break + } + Ok(Command::Continue) => { + state.next = Next::Continue; + break + } + Ok(Command::PrintGas) => { + let gas = engine.get_gas(); + println!(" used remaining credit limit"); + println!("{: >8} {: >8} {: >8} {: >8}", + gas.get_gas_used(), + gas.get_gas_remaining(), + gas.get_gas_credit(), + gas.get_gas_limit(), + ) + } + Ok(Command::PrintStack(range)) => { + let depth = engine.stack().depth(); + if depth < range.end { + println!("invalid stack range (stack depth is {})", depth) + } else { + for i in range { + println!("s{}: {}", i, engine.stack().get(i)); + } + } + } + Ok(Command::PrintRegister(reg)) => { + match engine.ctrl(reg) { + Ok(item) => println!("{}", item), + Err(e) => println!("{}", e) + } + } + Ok(Command::PrintCC) => { + print_cc(info) + } + Ok(Command::PrintAll) => { + let depth = engine.stack().depth(); + for i in 0..depth { + println!("s{}: {}", i, engine.stack().get(i)) + } + for reg in SaveList::REGS { + match engine.ctrl(reg) { + Ok(item) => println!("c{}: {}", reg, item), + Err(e) => println!("c{}: {}", reg, e) + } + } + println!("cc:"); + print_cc(info) + } + Ok(Command::Breakpoint(cell_hash, offset)) => { + state.breakpoints.insert(Breakpoint::new(cell_hash, offset)); + println!("Breakpoint added"); + } + Err(e) => println!("{}", e), + } + } + Err(e) => { + println!("{}", e); + state.next = Next::Quit; + break; + } + } + } +} + +const INST_WIDTH: usize = 32; +const SOURCE_POS_WIDTH: usize = 24; + +pub fn debug_callback(engine: &Engine, info: &EngineTraceInfo, debug_info: &Option) { + let mut state = DEBUG_STATE.lock().unwrap(); + if info.info_type == EngineTraceInfoType::Start { + println!("Interactive debugger"); + println!("For help, type h or ?"); + *state = Some(DebugState { + editor: rustyline::Editor::<()>::new().unwrap(), + next: Next::Start, + last: None, + breakpoints: HashSet::new(), + }); + execute_line(state.as_mut().unwrap(), engine, info); + return + } + let state = state.as_mut().unwrap(); + if state.next == Next::Quit { + return + } + if info.info_type == EngineTraceInfoType::Implicit { + println!("{}", info.cmd_str); + return + } + if info.info_type == EngineTraceInfoType::Exception { + execute_line(state, engine, info); + return + } + let cell_hash = info.cmd_code.cell().repr_hash(); + let offset = info.cmd_code.pos(); + println!("{: String { + assert!(len > 0); + if s.len() > len { + format!("{}…", &s[..len - 1]) + } else { + s + } +} + +fn get_position(info: &EngineTraceInfo, debug_info: &Option) -> String { + if let Some(debug_info) = debug_info { + let cell_hash = info.cmd_code.cell().repr_hash(); + let offset = info.cmd_code.pos(); + match debug_info.get(&cell_hash) { + Some(offset_map) => match offset_map.get(&offset) { + Some(pos) => format!("{}:{} ", pos.filename, pos.line), + None => String::new() + }, + None => String::new() + } + } else { + String::new() + } +} diff --git a/src/main.rs b/src/main.rs index c02d2a8a..d674119f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,6 +33,7 @@ mod sendfile; mod voting; mod replay; mod debug; +mod debugger; mod run; mod message; #[cfg(feature = "sold")]