From 50c5471db59954236e13830e7b113b87b4158e96 Mon Sep 17 00:00:00 2001 From: Sophie Date: Wed, 13 Dec 2023 14:03:10 -0800 Subject: [PATCH 01/64] WIP Source maps --- forc-pkg/src/manifest.rs | 1 + forc-pkg/src/pkg.rs | 2 +- .../asm_generation/fuel/fuel_asm_builder.rs | 1 + sway-core/src/lib.rs | 56 ++++++++++--------- sway-core/src/source_map.rs | 8 +-- 5 files changed, 36 insertions(+), 32 deletions(-) diff --git a/forc-pkg/src/manifest.rs b/forc-pkg/src/manifest.rs index d4c35607a1d..a817e3b8678 100644 --- a/forc-pkg/src/manifest.rs +++ b/forc-pkg/src/manifest.rs @@ -1044,6 +1044,7 @@ pub fn find_dir_within(dir: &Path, pkg_name: &str) -> Option { find_within(dir, pkg_name).and_then(|path| path.parent().map(Path::to_path_buf)) } + #[cfg(test)] mod tests { use super::*; diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index 8d0bf1ebc04..48db30a8a71 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -102,7 +102,7 @@ pub struct BuiltPackage { pub program_abi: ProgramABI, pub storage_slots: Vec, pub warnings: Vec, - source_map: SourceMap, + pub source_map: SourceMap, pub tree_type: TreeType, pub bytecode: BuiltPackageBytecode, /// `Some` for contract member builds where tests were included. This is diff --git a/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs b/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs index e5a811c588e..3a7ff3f0e97 100644 --- a/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs +++ b/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs @@ -1326,6 +1326,7 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> { ret_type: &Type, ) -> Result<(), CompileError> { let owning_span = self.md_mgr.val_to_span(self.context, *instr_val); + println!("owning span: {:?}", owning_span); if ret_type.is_unit(self.context) { // Unit returns should always be zero, although because they can be omitted from // functions, the register is sometimes uninitialized. Manually return zero in this diff --git a/sway-core/src/lib.rs b/sway-core/src/lib.rs index 64d1288b3b6..2df3e6d64b7 100644 --- a/sway-core/src/lib.rs +++ b/sway-core/src/lib.rs @@ -765,7 +765,9 @@ pub(crate) fn compile_ast_to_ir_to_asm( // Initialize the pass manager and register known passes. let mut pass_mgr = PassManager::default(); register_known_passes(&mut pass_mgr); - let mut pass_group = create_o1_pass_group(); + + // TODO: Skip passes if debug mode + // let mut pass_group = create_o1_pass_group(); // Target specific transforms should be moved into something more configured. if build_config.build_target == BuildTarget::Fuel { @@ -773,36 +775,36 @@ pub(crate) fn compile_ast_to_ir_to_asm( // // Demote large by-value constants, arguments and return values to by-reference values // using temporaries. - pass_group.append_pass(CONSTDEMOTION_NAME); - pass_group.append_pass(ARGDEMOTION_NAME); - pass_group.append_pass(RETDEMOTION_NAME); - pass_group.append_pass(MISCDEMOTION_NAME); - - // Convert loads and stores to mem_copys where possible. - pass_group.append_pass(MEMCPYOPT_NAME); - - // Run a DCE and simplify-cfg to clean up any obsolete instructions. - pass_group.append_pass(DCE_NAME); - pass_group.append_pass(SIMPLIFYCFG_NAME); - pass_group.append_pass(SROA_NAME); - pass_group.append_pass(MEM2REG_NAME); - pass_group.append_pass(DCE_NAME); + // pass_group.append_pass(CONSTDEMOTION_NAME); + // pass_group.append_pass(ARGDEMOTION_NAME); + // pass_group.append_pass(RETDEMOTION_NAME); + // pass_group.append_pass(MISCDEMOTION_NAME); + + // // Convert loads and stores to mem_copys where possible. + // pass_group.append_pass(MEMCPYOPT_NAME); + + // // Run a DCE and simplify-cfg to clean up any obsolete instructions. + // pass_group.append_pass(DCE_NAME); + // pass_group.append_pass(SIMPLIFYCFG_NAME); + // pass_group.append_pass(SROA_NAME); + // pass_group.append_pass(MEM2REG_NAME); + // pass_group.append_pass(DCE_NAME); } - if build_config.print_ir { - pass_group.append_pass(MODULEPRINTER_NAME); - } + // if build_config.print_ir { + // pass_group.append_pass(MODULEPRINTER_NAME); + // } // Run the passes. - let res = if let Err(ir_error) = pass_mgr.run(&mut ir, &pass_group) { - Err(handler.emit_err(CompileError::InternalOwned( - ir_error.to_string(), - span::Span::dummy(), - ))) - } else { - Ok(()) - }; - res?; + // let res = if let Err(ir_error) = pass_mgr.run(&mut ir, &pass_group) { + // Err(handler.emit_err(CompileError::InternalOwned( + // ir_error.to_string(), + // span::Span::dummy(), + // ))) + // } else { + // Ok(()) + // }; + // res?; let final_asm = compile_ir_to_asm(handler, &ir, Some(build_config))?; diff --git a/sway-core/src/source_map.rs b/sway-core/src/source_map.rs index 4ad02a7e48a..64887122fbb 100644 --- a/sway-core/src/source_map.rs +++ b/sway-core/src/source_map.rs @@ -10,17 +10,17 @@ use sway_types::span::Span; /// Index of an interned path string #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] #[serde(transparent)] -pub struct PathIndex(usize); +pub struct PathIndex(pub usize); #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct SourceMap { /// Paths of dependencies in the `~/.forc` directory, with the prefix stripped. /// This makes inverse source mapping work on any machine with deps downloaded. - dependency_paths: Vec, + pub dependency_paths: Vec, /// Paths to source code files, defined separately to avoid repetition. - paths: Vec, + pub paths: Vec, /// Mapping from opcode index to source location - map: HashMap, + pub map: HashMap, } impl SourceMap { pub fn new() -> Self { From 932215031b949ac83b109482f9c68cc7efb69aeb Mon Sep 17 00:00:00 2001 From: Sophie Date: Mon, 18 Dec 2023 17:36:31 -0800 Subject: [PATCH 02/64] update deps --- Cargo.lock | 1069 +++++++++++++++++++++++-- forc-pkg/src/pkg.rs | 31 +- forc-plugins/forc-debug/Cargo.toml | 16 +- forc-plugins/forc-debug/src/lib.rs | 2 + forc-plugins/forc-debug/src/main.rs | 23 +- forc-plugins/forc-debug/src/server.rs | 244 ++++++ forc-plugins/forc-debug/src/types.rs | 1 + forc-test/src/lib.rs | 92 ++- 8 files changed, 1376 insertions(+), 102 deletions(-) create mode 100644 forc-plugins/forc-debug/src/server.rs create mode 100644 forc-plugins/forc-debug/src/types.rs diff --git a/Cargo.lock b/Cargo.lock index bcea0f55eae..1dc022f345d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,26 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher 0.2.5", +] + [[package]] name = "aes" version = "0.8.3" @@ -34,10 +54,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if 1.0.0", - "cipher", + "cipher 0.4.4", "cpufeatures", ] +[[package]] +name = "aes-gcm" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" +dependencies = [ + "aead", + "aes 0.6.0", + "cipher 0.2.5", + "ctr 0.6.0", + "ghash", + "subtle", +] + +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher 0.2.5", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher 0.2.5", + "opaque-debug", +] + [[package]] name = "ahash" version = "0.8.6" @@ -221,6 +275,150 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +dependencies = [ + "concurrent-queue", + "event-listener 4.0.0", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" +dependencies = [ + "async-lock 3.2.0", + "async-task", + "concurrent-queue", + "fastrand 2.0.1", + "futures-lite 2.1.0", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.1.1", + "async-executor", + "async-io 2.2.2", + "async-lock 3.2.0", + "blocking", + "futures-lite 2.1.0", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock 2.8.0", + "autocfg", + "cfg-if 1.0.0", + "concurrent-queue", + "futures-lite 1.13.0", + "log", + "parking", + "polling 2.8.0", + "rustix 0.37.27", + "slab", + "socket2 0.4.10", + "waker-fn", +] + +[[package]] +name = "async-io" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7" +dependencies = [ + "async-lock 3.2.0", + "cfg-if 1.0.0", + "concurrent-queue", + "futures-io", + "futures-lite 2.1.0", + "parking", + "polling 3.3.1", + "rustix 0.38.26", + "slab", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" +dependencies = [ + "event-listener 4.0.0", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-channel 1.9.0", + "async-global-executor", + "async-io 1.13.0", + "async-lock 2.8.0", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite 1.13.0", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d90cd0b264dfdd8eb5bad0a2c217c1f88fa96a8573f40e7b12de23fb468f46" + [[package]] name = "async-trait" version = "0.1.74" @@ -241,6 +439,12 @@ dependencies = [ "critical-section", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -279,7 +483,7 @@ dependencies = [ "async-trait", "axum-core", "bitflags 1.3.2", - "bytes", + "bytes 1.5.0", "futures-util", "http", "http-body", @@ -308,7 +512,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc" dependencies = [ "async-trait", - "bytes", + "bytes 1.5.0", "futures-util", "http", "http-body", @@ -499,6 +703,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blocking" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" +dependencies = [ + "async-channel 2.1.1", + "async-lock 3.2.0", + "async-task", + "fastrand 2.0.1", + "futures-io", + "futures-lite 2.1.0", + "piper", + "tracing", +] + [[package]] name = "brotli" version = "3.4.0" @@ -559,6 +779,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + [[package]] name = "bytes" version = "1.5.0" @@ -651,6 +877,15 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array", +] + [[package]] name = "cipher" version = "0.4.4" @@ -818,7 +1053,7 @@ dependencies = [ "hmac 0.12.1", "once_cell", "pbkdf2 0.12.2", - "rand", + "rand 0.8.5", "sha2 0.10.8", "thiserror", ] @@ -879,13 +1114,13 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baee326bc603965b0f26583e1ecd7c111c41b49bd92a344897476a352798869" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-core", "futures-util", "http", "mime", "mime_guess", - "rand", + "rand 0.8.5", "thiserror", ] @@ -910,6 +1145,15 @@ dependencies = [ "xdg", ] +[[package]] +name = "concurrent-queue" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "console" version = "0.15.7" @@ -928,6 +1172,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +[[package]] +name = "const_fn" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -946,6 +1196,23 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "cookie" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" +dependencies = [ + "aes-gcm", + "base64 0.13.1", + "hkdf 0.10.0", + "hmac 0.10.1", + "percent-encoding", + "rand 0.8.5", + "sha2 0.9.9", + "time 0.2.27", + "version_check", +] + [[package]] name = "cookie" version = "0.16.2" @@ -953,7 +1220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time", + "time 0.3.30", "version_check", ] @@ -963,14 +1230,14 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d606d0fba62e13cf04db20536c05cb7f13673c161cb47a47a82b9b9e7d3f1daa" dependencies = [ - "cookie", + "cookie 0.16.2", "idna 0.2.3", "log", "publicsuffix", "serde", "serde_derive", "serde_json", - "time", + "time 0.3.30", "url", ] @@ -1023,6 +1290,12 @@ dependencies = [ "libc", ] +[[package]] +name = "cpuid-bool" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" + [[package]] name = "crc32fast" version = "1.3.2" @@ -1130,7 +1403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "rand_core", + "rand_core 0.6.4", "subtle", "zeroize", ] @@ -1155,6 +1428,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "crypto-mac" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "csv" version = "1.3.0" @@ -1185,13 +1468,53 @@ dependencies = [ "sct 0.6.1", ] +[[package]] +name = "ctr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +dependencies = [ + "cipher 0.2.5", +] + [[package]] name = "ctr" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.4", +] + +[[package]] +name = "curl" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22" +dependencies = [ + "curl-sys", + "libc", + "openssl-probe", + "openssl-sys", + "schannel", + "socket2 0.4.10", + "winapi", +] + +[[package]] +name = "curl-sys" +version = "0.4.70+curl-8.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c0333d8849afe78a4c8102a429a446bfdd055832af071945520e835ae2d841e" +dependencies = [ + "cc", + "libc", + "libnghttp2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", + "windows-sys 0.48.0", ] [[package]] @@ -1206,7 +1529,7 @@ dependencies = [ "digest 0.10.7", "fiat-crypto", "platforms", - "rustc_version", + "rustc_version 0.4.0", "subtle", ] @@ -1261,6 +1584,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "dap" +version = "0.4.1-alpha1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c7fc89d334ab745ba679f94c7314c9b17ecdcd923c111df6206e9fd7729fa9" +dependencies = [ + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "darling" version = "0.13.4" @@ -1410,7 +1744,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version", + "rustc_version 0.4.0", "syn 1.0.109", ] @@ -1525,6 +1859,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "dissimilar" version = "1.0.7" @@ -1615,7 +1955,7 @@ dependencies = [ "generic-array", "group", "pkcs8", - "rand_core", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -1740,13 +2080,13 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ - "aes", - "ctr", + "aes 0.8.3", + "ctr 0.9.2", "digest 0.10.7", "hex", "hmac 0.12.1", "pbkdf2 0.11.0", - "rand", + "rand 0.8.5", "scrypt", "serde", "serde_json", @@ -1789,6 +2129,33 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" +dependencies = [ + "event-listener 4.0.0", + "pin-project-lite", +] + [[package]] name = "eventsource-client" version = "0.10.2" @@ -1835,6 +2202,15 @@ dependencies = [ "regex", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.0.1" @@ -1858,7 +2234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b93f7a0db71c99f68398f80653ed05afb0b00e062e1a20c7ff849c4edfabbbcc" dependencies = [ "cfg-if 1.0.0", - "rustix", + "rustix 0.38.26", "windows-sys 0.52.0", ] @@ -1868,7 +2244,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -1918,7 +2294,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand", + "rand 0.8.5", "rustc-hex", "static_assertions", ] @@ -1939,6 +2315,17 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flume" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bebadab126f8120d410b677ed95eee4ba6eb7c6dd8e34a5ec88a08050e26132" +dependencies = [ + "futures-core", + "futures-sink", + "spinning_top", +] + [[package]] name = "fnv" version = "1.0.7" @@ -2002,7 +2389,7 @@ dependencies = [ "fuels-core", "futures", "hex", - "rand", + "rand 0.8.5", "rpassword", "serde", "serde_json", @@ -2028,7 +2415,7 @@ dependencies = [ "futures", "hex", "libp2p-identity", - "rand", + "rand 0.8.5", "serde", "serde_json", "serde_yaml", @@ -2044,14 +2431,20 @@ version = "0.48.1" dependencies = [ "anyhow", "clap 3.2.25", + "dap", "escargot", + "forc-pkg", "fuel-core-client", "fuel-types", "fuel-vm", "portpicker", "rexpect", + "serde", "serde_json", "shellfish", + "surf", + "sway-core", + "sway-types", "thiserror", "tokio", ] @@ -2127,7 +2520,7 @@ dependencies = [ "petgraph", "regex", "reqwest", - "semver", + "semver 1.0.20", "serde", "serde_ignored", "serde_json", @@ -2154,7 +2547,7 @@ dependencies = [ "fuel-abi-types 0.2.1", "fuel-tx", "fuel-vm", - "rand", + "rand 0.8.5", "rayon", "sway-core", "sway-types", @@ -2224,7 +2617,7 @@ dependencies = [ "futures", "hex", "home", - "rand", + "rand 0.8.5", "rpassword", "serde_json", "termion", @@ -2456,7 +2849,7 @@ dependencies = [ "k256", "lazy_static", "p256", - "rand", + "rand 0.8.5", "secp256k1 0.26.0", "serde", "sha2 0.10.8", @@ -2515,7 +2908,7 @@ dependencies = [ "num-bigint", "pest", "pest_derive", - "rand", + "rand 0.8.5", "sha3", "snafu", ] @@ -2582,7 +2975,7 @@ dependencies = [ "fuel-types", "hashbrown 0.14.3", "itertools 0.10.5", - "rand", + "rand 0.8.5", "serde", "serde_json", "strum", @@ -2597,7 +2990,7 @@ checksum = "ee3eda536ec1c1c7b0e06bf4a2d7b22980a79108c66ab8f81661433b2211e21e" dependencies = [ "fuel-derive", "hex", - "rand", + "rand 0.8.5", "serde", ] @@ -2625,7 +3018,7 @@ dependencies = [ "paste", "percent-encoding", "primitive-types", - "rand", + "rand 0.8.5", "serde", "sha3", "static_assertions", @@ -2665,8 +3058,8 @@ dependencies = [ "fuel-vm", "fuels-core", "hex", - "rand", - "semver", + "rand 0.8.5", + "semver 1.0.20", "tai64", "thiserror", "tokio", @@ -2728,7 +3121,7 @@ dependencies = [ "itertools 0.12.0", "proc-macro2", "quote", - "rand", + "rand 0.8.5", "syn 2.0.39", ] @@ -2739,7 +3132,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d9fd3a7722685ba45a6794374f44530732f4f2f43f507eb1ec6fd0656abacf8" dependencies = [ "async-trait", - "bytes", + "bytes 1.5.0", "fuel-abi-types 0.3.0", "fuel-asm", "fuel-tx", @@ -2747,7 +3140,7 @@ dependencies = [ "fuels-accounts", "fuels-core", "itertools 0.12.0", - "rand", + "rand 0.8.5", "serde_json", "tokio", ] @@ -2769,7 +3162,7 @@ dependencies = [ "futures", "hex", "portpicker", - "rand", + "rand 0.8.5", "serde", "serde_json", "serde_with 3.4.0", @@ -2832,6 +3225,34 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-lite" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" +dependencies = [ + "fastrand 2.0.1", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.29" @@ -2925,6 +3346,16 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "ghash" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "gimli" version = "0.28.1" @@ -2997,6 +3428,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "graph-cycles" version = "0.1.0" @@ -3025,7 +3468,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -3035,7 +3478,7 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ - "bytes", + "bytes 1.5.0", "fnv", "futures-core", "futures-sink", @@ -3117,7 +3560,7 @@ checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" dependencies = [ "atomic-polyfill", "hash32", - "rustc_version", + "rustc_version 0.4.0", "serde", "spin 0.9.8", "stable_deref_trait", @@ -3162,6 +3605,16 @@ dependencies = [ "serde", ] +[[package]] +name = "hkdf" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" +dependencies = [ + "digest 0.9.0", + "hmac 0.10.1", +] + [[package]] name = "hkdf" version = "0.12.3" @@ -3177,7 +3630,17 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" dependencies = [ - "crypto-mac", + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac 0.10.0", "digest 0.9.0", ] @@ -3222,7 +3685,7 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ - "bytes", + "bytes 1.5.0", "fnv", "itoa", ] @@ -3233,17 +3696,53 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes", + "bytes 1.5.0", "http", "pin-project-lite", ] +[[package]] +name = "http-client" +version = "6.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1947510dc91e2bf586ea5ffb412caad7673264e14bb39fb9078da114a94ce1a5" +dependencies = [ + "async-std", + "async-trait", + "cfg-if 1.0.0", + "http-types", + "isahc", + "log", +] + [[package]] name = "http-range-header" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +[[package]] +name = "http-types" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad" +dependencies = [ + "anyhow", + "async-channel 1.9.0", + "async-std", + "base64 0.13.1", + "cookie 0.14.4", + "futures-lite 1.13.0", + "infer", + "pin-project-lite", + "rand 0.7.3", + "serde", + "serde_json", + "serde_qs", + "serde_urlencoded", + "url", +] + [[package]] name = "httparse" version = "1.8.0" @@ -3268,7 +3767,7 @@ version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-channel", "futures-core", "futures-util", @@ -3292,7 +3791,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0eb2cf73e96e9925f4bed948e763aa2901c2f1a3a5f713ee41917433ced6671" dependencies = [ - "bytes", + "bytes 1.5.0", "common-multipart-rfc7578", "futures-core", "http", @@ -3351,7 +3850,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes", + "bytes 1.5.0", "hyper", "native-tls", "tokio", @@ -3425,7 +3924,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" dependencies = [ "bitmaps", - "rand_core", + "rand_core 0.6.4", "rand_xoshiro", "sized-chunks", "typenum", @@ -3511,6 +4010,12 @@ dependencies = [ "serde", ] +[[package]] +name = "infer" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" + [[package]] name = "inotify" version = "0.9.6" @@ -3564,6 +4069,17 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.3", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "ipfs-api-backend-hyper" version = "0.6.0" @@ -3572,7 +4088,7 @@ checksum = "8a9d131b408b4caafe1e7c00d410a09ad3eb7e3ab68690cf668e86904b2176b4" dependencies = [ "async-trait", "base64 0.13.1", - "bytes", + "bytes 1.5.0", "futures", "http", "hyper", @@ -3588,7 +4104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b74065805db266ba2c6edbd670b23c4714824a955628472b2e46cc9f3a869cb" dependencies = [ "async-trait", - "bytes", + "bytes 1.5.0", "cfg-if 1.0.0", "common-multipart-rfc7578", "dirs 4.0.0", @@ -3620,10 +4136,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.3", - "rustix", + "rustix 0.38.26", "windows-sys 0.48.0", ] +[[package]] +name = "isahc" +version = "0.9.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2948a0ce43e2c2ef11d7edf6816508998d99e13badd1150be0914205df9388a" +dependencies = [ + "bytes 0.5.6", + "crossbeam-utils", + "curl", + "curl-sys", + "flume", + "futures-lite 1.13.0", + "http", + "log", + "once_cell", + "slab", + "sluice", + "tracing", + "tracing-futures", + "url", + "waker-fn", +] + [[package]] name = "itertools" version = "0.10.5" @@ -3709,6 +4248,15 @@ dependencies = [ "libc", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -3744,6 +4292,16 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libnghttp2-sys" +version = "0.1.8+1.55.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fae956c192dadcdb5dace96db71fa0b827333cce7c7b38dc71446f024d8a340" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "libp2p-identity" version = "0.2.8" @@ -3752,7 +4310,7 @@ checksum = "999ec70441b2fb35355076726a6bc466c932e9bdc66f6a11c6c0aa17c7ab9be0" dependencies = [ "asn1_der", "bs58", - "hkdf", + "hkdf 0.12.3", "libsecp256k1", "multihash 0.19.1", "quick-protobuf", @@ -3797,7 +4355,7 @@ dependencies = [ "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", - "rand", + "rand 0.8.5", "serde", "sha2 0.9.9", "typenum", @@ -3873,6 +4431,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "linux-raw-sys" version = "0.4.12" @@ -3894,6 +4458,9 @@ name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +dependencies = [ + "value-bag", +] [[package]] name = "logos" @@ -3986,7 +4553,7 @@ dependencies = [ "anyhow", "clap 3.2.25", "mdbook", - "semver", + "semver 1.0.20", "serde", "serde_json", ] @@ -4645,6 +5212,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.11.2" @@ -4832,7 +5405,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" dependencies = [ "phf_shared", - "rand", + "rand 0.8.5", ] [[package]] @@ -4890,6 +5463,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + [[package]] name = "pkcs8" version = "0.10.2" @@ -4923,7 +5507,7 @@ dependencies = [ "line-wrap", "quick-xml", "serde", - "time", + "time 0.3.30", ] [[package]] @@ -4954,13 +5538,54 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if 1.0.0", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "polling" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" +dependencies = [ + "cfg-if 1.0.0", + "concurrent-queue", + "pin-project-lite", + "rustix 0.38.26", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "polyval" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" +dependencies = [ + "cpuid-bool", + "opaque-debug", + "universal-hash", +] + [[package]] name = "portpicker" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be97d76faf1bfab666e1375477b23fde79eccf0276e9b63b92a39d676a889ba9" dependencies = [ - "rand", + "rand 0.8.5", ] [[package]] @@ -5244,6 +5869,19 @@ dependencies = [ "nibble_vec", ] +[[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", +] + [[package]] name = "rand" version = "0.8.5" @@ -5251,8 +5889,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[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", ] [[package]] @@ -5262,7 +5910,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[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", ] [[package]] @@ -5274,13 +5931,22 @@ dependencies = [ "getrandom 0.2.11", ] +[[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_xoshiro" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" dependencies = [ - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -5412,8 +6078,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "base64 0.21.5", - "bytes", - "cookie", + "bytes 1.5.0", + "cookie 0.16.2", "cookie_store", "encoding_rs", "futures-core", @@ -5458,7 +6124,7 @@ checksum = "73d84c8f9836efb0f5f5f8de4700a953c4e1f3119e5cfcb0aad8e5be73daf991" dependencies = [ "arrayref", "auto_impl", - "bytes", + "bytes 1.5.0", "hashbrown 0.13.2", "num_enum", "primitive-types", @@ -5473,7 +6139,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0353d456ef3e989dc9190f42c6020f09bc2025930c37895826029304413204b5" dependencies = [ - "bytes", + "bytes 1.5.0", "hashbrown 0.13.2", "num", "once_cell", @@ -5551,7 +6217,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ - "bytes", + "bytes 1.5.0", "rustc-hex", ] @@ -5640,13 +6306,36 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver 1.0.20", +] + +[[package]] +name = "rustix" +version = "0.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", ] [[package]] @@ -5658,7 +6347,7 @@ dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.12", "windows-sys 0.52.0", ] @@ -5778,7 +6467,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "cipher", + "cipher 0.4.4", ] [[package]] @@ -5892,7 +6581,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" dependencies = [ - "rand", + "rand 0.8.5", "secp256k1-sys 0.8.1", ] @@ -5946,6 +6635,15 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.20" @@ -5955,6 +6653,12 @@ dependencies = [ "serde", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.193" @@ -5995,6 +6699,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_qs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" +dependencies = [ + "percent-encoding", + "serde", + "thiserror", +] + [[package]] name = "serde_repr" version = "0.1.17" @@ -6051,7 +6766,7 @@ dependencies = [ "serde", "serde_json", "serde_with_macros 3.4.0", - "time", + "time 0.3.30", ] [[package]] @@ -6091,6 +6806,21 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "sha1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" + [[package]] name = "sha2" version = "0.9.9" @@ -6175,7 +6905,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -6219,6 +6949,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "sluice" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7400c0eff44aa2fcb5e31a5f24ba9716ed90138769e4977a2ba6014ae63eb5" +dependencies = [ + "async-channel 1.9.0", + "futures-core", + "futures-io", +] + [[package]] name = "smallvec" version = "1.11.2" @@ -6289,6 +7030,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spinning_top" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9eb1a2f4c41445a3a0ff9abc5221c5fcd28e1f13cd7c0397706f9ac938ddb0" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -6305,12 +7055,70 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version 0.2.3", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + [[package]] name = "str-buf" version = "1.0.6" @@ -6402,7 +7210,7 @@ dependencies = [ "byteorder", "crunchy", "lazy_static", - "rand", + "rand 0.8.5", "rustc-hex", ] @@ -6412,6 +7220,29 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "surf" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718b1ae6b50351982dedff021db0def601677f2120938b070eadb10ba4038dd7" +dependencies = [ + "async-std", + "async-trait", + "cfg-if 1.0.0", + "encoding_rs", + "futures-util", + "getrandom 0.2.11", + "http-client", + "http-types", + "log", + "mime_guess", + "once_cell", + "pin-project-lite", + "serde", + "serde_json", + "web-sys", +] + [[package]] name = "sway-ast" version = "0.48.1" @@ -6766,7 +7597,7 @@ dependencies = [ "logos", "regex", "rowan", - "semver", + "semver 1.0.20", "smallvec", "toml 0.5.11", "wasm-bindgen", @@ -6790,9 +7621,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if 1.0.0", - "fastrand", + "fastrand 2.0.1", "redox_syscall 0.4.1", - "rustix", + "rustix 0.38.26", "windows-sys 0.48.0", ] @@ -6844,7 +7675,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix", + "rustix 0.38.26", "windows-sys 0.48.0", ] @@ -6866,7 +7697,7 @@ version = "0.0.0" dependencies = [ "anyhow", "assert_matches", - "bytes", + "bytes 1.5.0", "clap 4.4.11", "colored", "filecheck", @@ -6881,7 +7712,7 @@ dependencies = [ "hex", "miden", "prettydiff 0.6.4", - "rand", + "rand 0.8.5", "regex", "revm", "serde_json", @@ -6980,6 +7811,21 @@ dependencies = [ "tikv-jemalloc-sys", ] +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros 0.1.1", + "version_check", + "winapi", +] + [[package]] name = "time" version = "0.3.30" @@ -6991,7 +7837,7 @@ dependencies = [ "powerfmt", "serde", "time-core", - "time-macros", + "time-macros 0.2.15", ] [[package]] @@ -7000,6 +7846,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + [[package]] name = "time-macros" version = "0.2.15" @@ -7009,6 +7865,19 @@ dependencies = [ "time-core", ] +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn 1.0.109", +] + [[package]] name = "tiny-bip39" version = "1.0.0" @@ -7019,7 +7888,7 @@ dependencies = [ "hmac 0.12.1", "once_cell", "pbkdf2 0.11.0", - "rand", + "rand 0.8.5", "rustc-hash", "sha2 0.10.8", "thiserror", @@ -7069,7 +7938,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", - "bytes", + "bytes 1.5.0", "libc", "mio", "num_cpus", @@ -7150,7 +8019,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-core", "futures-sink", "pin-project-lite", @@ -7241,7 +8110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ "bitflags 1.3.2", - "bytes", + "bytes 1.5.0", "futures-core", "futures-util", "http", @@ -7267,7 +8136,7 @@ checksum = "9b38fb0e6ce037835174256518aace3ca621c4f96383c56bb846cfc11b341910" dependencies = [ "async-trait", "auto_impl", - "bytes", + "bytes 1.5.0", "dashmap", "futures", "httparse", @@ -7332,6 +8201,16 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -7481,6 +8360,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "universal-hash" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "unreachable" version = "1.0.0" @@ -7566,6 +8455,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a72e1902dde2bd6441347de2b70b7f5d59bf157c6c62f0c44572607a1d55bbe" + [[package]] name = "vcpkg" version = "0.2.15" @@ -7596,6 +8491,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "waker-fn" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" + [[package]] name = "walkdir" version = "2.4.0" @@ -7730,7 +8631,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.26", "windows-sys 0.48.0", ] diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index dfde5e9254b..25718fc6891 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -169,6 +169,11 @@ pub enum Built { Workspace(BuiltWorkspace), } +pub struct BuiltWithPlan { + pub built: Built, + pub build_plan: BuildPlan, +} + /// The result of the `compile` function, i.e. compiling a single package. pub struct CompiledPackage { pub source_map: SourceMap, @@ -750,7 +755,7 @@ impl BuildPlan { /// Produce an iterator yielding all workspace member nodes in order of compilation. /// - /// In the case that this `BuildPlan` was constructed for a single package, + /// In the case that this [BuildPlan] was constructed for a single package, /// only that package's node will be yielded. pub fn member_nodes(&self) -> impl Iterator + '_ { self.compilation_order() @@ -759,6 +764,30 @@ impl BuildPlan { .filter(|&n| self.graph[n].source == source::Pinned::MEMBER) } + // /// Returns a [HashMap] of contract dependencies, indexed by the member node. + // /// + // /// In the case that this [BuildPlan] was constructed for a single package, + // /// only that package's node will be yielded. + // pub fn member_contract_dependencies( + // &self, + // ) -> HashMap>> { + // build_plan + // .member_nodes() + // .map(|member_node| { + // let graph = build_plan.graph(); + // let pinned_member = graph[member_node].clone(); + // let contract_dependencies = build_plan + // .contract_dependencies(member_node) + // .map(|contract_depency_node_ix| graph[contract_depency_node_ix].clone()) + // .filter_map(|pinned| built_members.get(&pinned)) + // .cloned() + // .collect(); + + // (pinned_member, contract_dependencies) + // }) + // .collect() + // } + /// Produce an iterator yielding all workspace member pinned pkgs in order of compilation. /// /// In the case that this `BuildPlan` was constructed for a single package, diff --git a/forc-plugins/forc-debug/Cargo.toml b/forc-plugins/forc-debug/Cargo.toml index ace71f2502a..ba0d7e8f7d9 100644 --- a/forc-plugins/forc-debug/Cargo.toml +++ b/forc-plugins/forc-debug/Cargo.toml @@ -9,14 +9,20 @@ license.workspace = true repository.workspace = true [dependencies] -clap = { version = "3.1", features = ["env", "derive"] } -fuel-core-client = { version = "0.21" } -fuel-types = { version = "0.43", features = ["serde"] } -fuel-vm = { version = "0.43", features = ["serde"] } +dap = "0.4.1-alpha1" +clap = { version = "3", features = ["env", "derive"] } +forc-pkg = { version = "0.48.1", path = "../../forc-pkg" } +fuel-core-client = { workspace = true } +fuel-types = { workspace = true, features = ["serde"] } +fuel-vm = { workspace = true, features = ["serde"] } +serde = "1.0" serde_json = "1.0" shellfish = { version = "0.6.0", features = ["rustyline", "async", "tokio"] } +surf = "2.3" +sway-core = { version = "0.48.1", path = "../../sway-core" } +sway-types = { version = "0.48.1", path = "../../sway-types" } thiserror = "1.0" -tokio = { version = "1.19", features = ["net", "io-util", "macros", "rt-multi-thread"] } +tokio = { version = "1.8", features = ["net", "io-util", "macros", "rt-multi-thread"] } [dev-dependencies] anyhow = "1.0" # Used by the examples only diff --git a/forc-plugins/forc-debug/src/lib.rs b/forc-plugins/forc-debug/src/lib.rs index 7ff2becbf13..e611ae3052c 100755 --- a/forc-plugins/forc-debug/src/lib.rs +++ b/forc-plugins/forc-debug/src/lib.rs @@ -1,4 +1,6 @@ pub mod names; +pub mod server; +pub mod types; // Re-exports pub use fuel_core_client::client::{schema::RunResult, FuelClient}; diff --git a/forc-plugins/forc-debug/src/main.rs b/forc-plugins/forc-debug/src/main.rs index 57b9335242e..e617659c9fd 100644 --- a/forc-plugins/forc-debug/src/main.rs +++ b/forc-plugins/forc-debug/src/main.rs @@ -1,22 +1,31 @@ use clap::Parser; -use forc_debug::names::register_name; -use shellfish::async_fn; -use shellfish::{Command as ShCommand, Shell}; -use std::error::Error; - -use forc_debug::{names, ContractId, FuelClient, RunResult, Transaction}; +use forc_debug::{ + names::{register_index, register_name}, + server::DapServer, + ContractId, FuelClient, RunResult, Transaction, +}; use fuel_vm::consts::{VM_MAX_RAM, VM_REGISTER_COUNT, WORD_SIZE}; +use shellfish::{async_fn, Command as ShCommand, Shell}; +use std::{fs, error::Error}; #[derive(Parser, Debug)] pub struct Opt { + /// The URL of the Fuel Client GraphQL API #[clap(default_value = "http://127.0.0.1:4000/graphql")] pub api_url: String, + /// Start the DAP server + #[clap(short, long)] + pub serve: bool, } #[tokio::main] async fn main() -> Result<(), Box> { let config = Opt::parse(); + if config.serve { + return DapServer::new().start(); + } + let mut shell = Shell::new_async( State { client: FuelClient::new(&config.api_url)?, @@ -211,7 +220,7 @@ async fn cmd_registers(state: &mut State, mut args: Vec) -> Result<(), B println!("Register index too large {}", v); return Ok(()); } - } else if let Some(index) = names::register_index(arg) { + } else if let Some(index) = register_index(arg) { let value = state .client .register(&state.session_id, index as u32) diff --git a/forc-plugins/forc-debug/src/server.rs b/forc-plugins/forc-debug/src/server.rs new file mode 100644 index 00000000000..0843f4cf8bd --- /dev/null +++ b/forc-plugins/forc-debug/src/server.rs @@ -0,0 +1,244 @@ +use dap::events::OutputEventBody; +use dap::responses::*; +use serde::{Deserialize, Serialize}; +use std::{ + collections::{HashMap, HashSet}, + fs, + io::{BufReader, BufWriter, Stdin, Stdout}, + path::PathBuf, + process, + sync::Arc, cmp::min, +}; +use sway_core::source_map::PathIndex; +use sway_types::{Span, span::Position}; +// use sway_core::source_map::SourceMap; +use thiserror::Error; + +use dap::prelude::*; + +use crate::types::DynResult; + +#[derive(Error, Debug)] +enum AdapterError { + #[error("Unhandled command")] + UnhandledCommandError, + + #[error("Missing command")] + MissingCommandError, +} + +pub struct DapServer { + server: Server, + source_map: SourceMap, +} + +type Line = i64; +type Instruction = u64; +type SourceMap = HashMap>; + +impl DapServer { + pub fn new() -> Self { + let output = BufWriter::new(std::io::stdout()); + let input = BufReader::new(std::io::stdin()); + let server = Server::new(input, output); + DapServer { + server, + source_map: Default::default(), + } + } + + pub fn start(&mut self) -> DynResult<()> { + loop { + match self.server.poll_request()? { + Some(req) => { + let rsp = self.handle(req)?; + self.server.respond(rsp)?; + } + None => return Err(Box::new(AdapterError::MissingCommandError)), + }; + } + } + + fn handle(&mut self, req: Request) -> DynResult { + self.log(format!("{:?}\n", req)); + + let rsp = match req.command { + Command::Attach(_) => { + self.log("attach!\n\n".into()); + // let compiled_program = args.additional_data. + let program = + "/Users/sophiedankel/Development/sway-playground/projects/swaypad/src/main.sw"; + let dir = PathBuf::from(program); + let manifest_file = forc_pkg::manifest::ManifestFile::from_dir(&dir)?; + let mut member_manifests = manifest_file.member_manifests()?; + let lock_path = manifest_file.lock_path()?; + let build_plan = forc_pkg::BuildPlan::from_lock_and_manifests( + &lock_path, + &member_manifests, + false, + false, + Default::default(), + )?; + + // self.log(format!("build plan!\n{:?}\n", build_plan)); + + // let compiled = forc_pkg::check(&plan, Default::default(), false, true, Default::default())?; + + let outputs = std::iter::once( + build_plan + .find_member_index( + &member_manifests.first_entry().unwrap().get().project.name, + ) + .unwrap(), + ) + .collect(); + + let built_packages = forc_pkg::build( + &build_plan, + Default::default(), + &Default::default(), + &outputs, + )?; + + // self.log(format!("built!\n{:?}\n", built_packages)); + + built_packages.iter().for_each(|built_package| { + let compiled_package = &built_package.1; + let source_map = &compiled_package.source_map; + let pretty = serde_json::to_string_pretty(source_map).unwrap(); + fs::write("/Users/sophiedankel/Development/sway-playground/projects/swaypad/src/tmp.txt", pretty).expect("Unable to write file"); + + let paths = &source_map.paths; + // Cache the source code for every path in the map, since we'll need it later. + let source_code = paths.iter().filter_map(|path_buf| { + if let Ok(source) = fs::read_to_string(path_buf) { + return Some((path_buf, source)); + } else { + None + } + }).collect::>(); + + source_map.map.iter().for_each(|(instruction, sm_span)| { + let path_buf: &PathBuf = paths.get(sm_span.path.0).unwrap(); + + if let Some(source_code) = source_code.get(path_buf) { + if let Some(start_pos) = Position::new(&source_code, sm_span.range.start) { + let (line, _) = start_pos.line_col(); + let (line, instruction) = (line as i64, *instruction as u64); + + self.source_map.entry(path_buf.clone()).and_modify(|new_map| { + + new_map.entry(line as i64).and_modify(|val| { + // Choose the first instruction that maps to this line + *val = min(instruction, *val); + }).or_insert(instruction); + }).or_insert(HashMap::from([(line, instruction)])); + + } else { + self.log(format!("Couldn't get position: {:?} in file: {:?}", sm_span.range.start, path_buf)); + } + } else { + self.log(format!("Couldn't read file: {:?}", path_buf)); + } + }); + + self.log("Writing source map!\n\n".into()); + let pretty = serde_json::to_string_pretty(&self.source_map.clone()).unwrap(); + fs::write("/Users/sophiedankel/Development/sway-playground/projects/swaypad/src/tmp2.txt", pretty).expect("Unable to write file"); + }); + // Run forc test + ResponseBody::Attach + } + Command::BreakpointLocations(_) => { + // Set the breakpoints in the VM + ResponseBody::BreakpointLocations(responses::BreakpointLocationsResponse { + breakpoints: vec![types::BreakpointLocation { + line: 2, + ..Default::default() + }], + }) + } + // Command::Completions(_) => todo!(), + // Command::ConfigurationDone => todo!(), + // Command::Continue(_) => todo!(), + // Command::DataBreakpointInfo(_) => todo!(), + // Command::Disassemble(_) => todo!(), + Command::Disconnect(_) => process::exit(0), + // Command::Evaluate(_) => todo!(), + // Command::ExceptionInfo(_) => todo!(), + // Command::Goto(_) => todo!(), + // Command::GotoTargets(_) => todo!(), + Command::Initialize(_) => ResponseBody::Initialize(types::Capabilities { + supports_function_breakpoints: Some(true), + supports_conditional_breakpoints: Some(true), + supports_hit_conditional_breakpoints: Some(true), + supports_goto_targets_request: Some(true), + supports_step_in_targets_request: Some(true), + support_suspend_debuggee: Some(true), + supports_data_breakpoints: Some(true), + supports_breakpoint_locations_request: Some(true), + ..Default::default() + }), + // Command::Launch(_) => todo!(), + // Command::LoadedSources => todo!(), + // Command::Modules(_) => todo!(), + // Command::Next(_) => todo!(), + // Command::Pause(_) => todo!(), + // Command::ReadMemory(_) => todo!(), + // Command::Restart(_) => todo!(), + // Command::RestartFrame(_) => todo!(), + // Command::ReverseContinue(_) => todo!(), + // Command::Scopes(_) => todo!(), + Command::SetBreakpoints(ref args) => { + let breakpoints = args + .breakpoints + .clone() + .unwrap_or_default() + .iter() + .map(|bp| { + let line = Some(bp.line); + types::Breakpoint { + verified: true, + line, + ..Default::default() + } + }) + .collect(); + ResponseBody::SetBreakpoints(responses::SetBreakpointsResponse { breakpoints }) + } + // Command::SetDataBreakpoints(_) => todo!(), + // Command::SetExceptionBreakpoints(_) => todo!(), + // Command::SetExpression(_) => todo!(), + // Command::SetFunctionBreakpoints(_) => todo!(), + // Command::SetInstructionBreakpoints(_) => todo!(), + // Command::SetVariable(_) => todo!(), + // Command::Source(_) => todo!(), + // Command::StackTrace(_) => todo!(), + // Command::StepBack(_) => todo!(), + // Command::StepIn(_) => todo!(), + // Command::StepInTargets(_) => todo!(), + // Command::StepOut(_) => todo!(), + // Command::Terminate(_) => todo!(), + // Command::TerminateThreads(_) => todo!(), + // Command::Threads => todo!(), + // Command::Variables(_) => todo!(), + // Command::WriteMemory(_) => todo!(), + // Command::Cancel(_) => todo!(), + _ => { + return Err(Box::new(AdapterError::UnhandledCommandError)); + } + }; + + self.log(format!("{:?}\n", rsp)); + + Ok(req.success(rsp)) + } + + /// Log a message to the client's debugger console output. + fn log(&mut self, output: String) { + let _ = self.server.send_event(Event::Output(OutputEventBody { + output, + ..Default::default() + })); + } +} diff --git a/forc-plugins/forc-debug/src/types.rs b/forc-plugins/forc-debug/src/types.rs new file mode 100644 index 00000000000..684ac5207bc --- /dev/null +++ b/forc-plugins/forc-debug/src/types.rs @@ -0,0 +1 @@ +pub type DynResult = std::result::Result>; diff --git a/forc-test/src/lib.rs b/forc-test/src/lib.rs index efe8b51815a..c6c06ed2390 100644 --- a/forc-test/src/lib.rs +++ b/forc-test/src/lib.rs @@ -11,7 +11,7 @@ use std::{collections::HashMap, fs, path::PathBuf, sync::Arc}; use sway_core::BuildTarget; use sway_types::Span; use tx::output::contract::Contract; -use tx::{Chargeable, Finalizable}; +use tx::{Chargeable, Finalizable, TransactionBuilder}; use vm::prelude::SecretKey; /// The result of a `forc test` invocation. @@ -651,10 +651,8 @@ pub fn build(opts: Opts) -> anyhow::Result { .filter_map(|pinned| built_members.get(&pinned)) .cloned() .collect(); + }); - (pinned_member, contract_dependencies) - }) - .collect(); BuiltTests::from_built(built, &member_contract_dependencies) } @@ -759,6 +757,90 @@ fn patch_test_bytecode(bytecode: &[u8], test_offset: u32) -> std::borrow::Cow<[u std::borrow::Cow::Owned(patched) } +pub struct TestResult { + state: vm::state::ProgramState, + duration: std::time::Duration, + receipts: Vec, +} + +struct TestExecutor { + interpreter: vm::prelude::Interpreter<_, _, vm::interpreter::NotSupportedEcal>, + transaction_builder: TransactionBuilder