diff --git a/Cargo.lock b/Cargo.lock index 2c35edb4d..3291c5dc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,7 +218,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -229,7 +229,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -291,12 +291,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base-x" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" - [[package]] name = "base58" version = "0.1.0" @@ -666,8 +660,8 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chainhook-sdk" -version = "0.12.1" -source = "git+https://github.com/hirosystems/chainhook.git?rev=570ceb7#570ceb7a6602fa5e18188fecb5bb28d64a53634f" +version = "0.12.5" +source = "git+https://github.com/hirosystems/chainhook.git?rev=ac59025#ac59025280d76180ca72a5aa1b9c4214573be64c" dependencies = [ "base58 0.2.0", "base64 0.21.7", @@ -693,15 +687,15 @@ dependencies = [ "serde-hex", "serde_derive", "serde_json", - "stacks-rpc-client 2.2.1 (git+https://github.com/hirosystems/clarinet.git?rev=32cc9aa8)", + "stacks-rpc-client 2.2.1 (git+https://github.com/hirosystems/clarinet.git?rev=1458e224)", "threadpool", "tokio", ] [[package]] name = "chainhook-types" -version = "1.3.1" -source = "git+https://github.com/hirosystems/chainhook.git?rev=570ceb7#570ceb7a6602fa5e18188fecb5bb28d64a53634f" +version = "1.3.3" +source = "git+https://github.com/hirosystems/chainhook.git?rev=ac59025#ac59025280d76180ca72a5aa1b9c4214573be64c" dependencies = [ "hex 0.4.3", "schemars", @@ -776,7 +770,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -788,7 +782,7 @@ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "clar2wasm" version = "0.1.0" -source = "git+https://github.com/stacks-network/clarity-wasm.git?rev=e7f63c2#e7f63c23d3bfce0d98edd0f9aeeff5a751bcfb1c" +source = "git+https://github.com/stacks-network/clarity-wasm.git?rev=b12002d#b12002d9576a9ebf90e5ddca3bf2fffb2bf12975" dependencies = [ "clap", "clarity", @@ -842,7 +836,6 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_yaml", "sha2 0.10.6", "signal-hook-registry", "similar", @@ -870,7 +863,7 @@ dependencies = [ "clarinet-files", "clarinet-utils", "clarity-repl 2.2.1", - "colored 2.0.4", + "colored 2.1.0", "libsecp256k1 0.7.1", "reqwest", "serde", @@ -905,11 +898,12 @@ dependencies = [ [[package]] name = "clarinet-sdk-wasm" -version = "2.2.1" +version = "2.3.0-rc3" dependencies = [ "clarinet-deployments", "clarinet-files", "clarity-repl 2.2.1", + "colored 2.1.0", "console_error_panic_hook", "gloo-utils", "js-sys", @@ -933,7 +927,7 @@ dependencies = [ [[package]] name = "clarity" version = "2.2.0" -source = "git+https://github.com/stacks-network/stacks-core.git?rev=345553357be556fe53474071d09cd453549ed02e#345553357be556fe53474071d09cd453549ed02e" +source = "git+https://github.com/stacks-network/stacks-core.git?rev=1e9df56b255247928679961d0a7c2541ad127f59#1e9df56b255247928679961d0a7c2541ad127f59" dependencies = [ "integer-sqrt", "lazy_static", @@ -948,7 +942,6 @@ dependencies = [ "sha2-asm", "slog", "stacks-common", - "time 0.2.27", "wasmtime", ] @@ -1044,14 +1037,14 @@ dependencies = [ [[package]] name = "clarity-repl" version = "2.2.1" -source = "git+https://github.com/hirosystems/clarinet.git?rev=32cc9aa8#32cc9aa83afb6d5f0ccbbdef0d34076d9bee9476" +source = "git+https://github.com/hirosystems/clarinet.git?rev=1458e224#1458e224d6aa8b53f49f50d880d6d0d078454438" dependencies = [ "ansi_term", "atty", "chrono", "clarity", "getrandom 0.2.8", - "hiro-system-kit 0.1.0 (git+https://github.com/hirosystems/clarinet.git?rev=32cc9aa8)", + "hiro-system-kit 0.1.0 (git+https://github.com/hirosystems/clarinet.git?rev=1458e224)", "integer-sqrt", "lazy_static", "regex", @@ -1112,11 +1105,10 @@ dependencies = [ [[package]] name = "colored" -version = "2.0.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", "windows-sys 0.48.0", ] @@ -1131,12 +1123,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "const_fn" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" - [[package]] name = "cookie" version = "0.17.0" @@ -1144,7 +1130,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" dependencies = [ "percent-encoding", - "time 0.3.17", + "time", "version_check", ] @@ -1205,7 +1191,7 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli 0.28.1", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "log", "regalloc2", "smallvec 1.10.0", @@ -1542,6 +1528,16 @@ dependencies = [ "uuid", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + [[package]] name = "devise" version = "0.4.1" @@ -1572,7 +1568,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -1655,12 +1651,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "dyn-clone" version = "1.0.10" @@ -2057,7 +2047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ "fallible-iterator 0.3.0", - "indexmap 2.0.0", + "indexmap 2.2.3", "stable_deref_trait", ] @@ -2092,7 +2082,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.0.0", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -2116,9 +2106,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", "allocator-api2", @@ -2131,7 +2121,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.14.3", ] [[package]] @@ -2216,7 +2206,7 @@ dependencies = [ [[package]] name = "hiro-system-kit" version = "0.1.0" -source = "git+https://github.com/hirosystems/clarinet.git?rev=32cc9aa8#32cc9aa83afb6d5f0ccbbdef0d34076d9bee9476" +source = "git+https://github.com/hirosystems/clarinet.git?rev=1458e224#1458e224d6aa8b53f49f50d880d6d0d078454438" dependencies = [ "ansi_term", "atty", @@ -2460,12 +2450,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "serde", ] @@ -2582,9 +2572,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -2846,7 +2836,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.14.3", ] [[package]] @@ -3130,6 +3120,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.45" @@ -3206,8 +3202,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "crc32fast", - "hashbrown 0.14.0", - "indexmap 2.0.0", + "hashbrown 0.14.3", + "indexmap 2.2.3", "memchr", ] @@ -3254,7 +3250,7 @@ dependencies = [ "rustfmt-wrapper", "serde", "sha2 0.10.6", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -3355,7 +3351,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -3430,6 +3426,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -3494,17 +3496,11 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" - [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -3517,7 +3513,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", "version_check", "yansi 1.0.0-rc.1", ] @@ -3554,9 +3550,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -3739,7 +3735,7 @@ checksum = "a930b010d9effee5834317bb7ff406b76af7724348fd572b38705b4bd099fa92" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -3918,7 +3914,7 @@ dependencies = [ "serde_json", "state", "tempfile", - "time 0.3.17", + "time", "tokio", "tokio-stream", "tokio-util", @@ -3939,7 +3935,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.39", + "syn 2.0.50", "unicode-xid", ] @@ -3965,7 +3961,7 @@ dependencies = [ "smallvec 1.10.0", "stable-pattern", "state", - "time 0.3.17", + "time", "tokio", "uncased", ] @@ -4003,15 +3999,6 @@ 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 = "rustfmt-wrapper" version = "0.2.1" @@ -4256,9 +4243,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -4276,9 +4263,9 @@ dependencies = [ [[package]] name = "serde-wasm-bindgen" -version = "0.6.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30c9933e5689bd420dc6c87b7a1835701810cbc10cd86a26e4da45b73e6b1d78" +checksum = "4c1432112bce8b966497ac46519535189a3250a3812cd27a999678a69756f79f" dependencies = [ "js-sys", "serde", @@ -4287,13 +4274,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -4309,11 +4296,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -4371,10 +4358,10 @@ dependencies = [ "chrono", "hex 0.4.3", "indexmap 1.9.2", - "indexmap 2.0.0", + "indexmap 2.2.3", "serde", "serde_json", - "time 0.3.17", + "time", ] [[package]] @@ -4389,21 +4376,6 @@ dependencies = [ "yaml-rust", ] -[[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.8.2" @@ -4569,7 +4541,7 @@ dependencies = [ "serde", "serde_json", "slog", - "time 0.3.17", + "time", ] [[package]] @@ -4593,7 +4565,7 @@ dependencies = [ "slog", "term", "thread_local", - "time 0.3.17", + "time", ] [[package]] @@ -4690,7 +4662,7 @@ dependencies = [ [[package]] name = "stacks-common" version = "0.0.2" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-next#345553357be556fe53474071d09cd453549ed02e" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-next#1e9df56b255247928679961d0a7c2541ad127f59" dependencies = [ "chrono", "curve25519-dalek", @@ -4712,7 +4684,7 @@ dependencies = [ "slog", "slog-json", "slog-term", - "time 0.2.27", + "time", "winapi", "wsts 6.1.0", ] @@ -4789,9 +4761,9 @@ dependencies = [ [[package]] name = "stacks-rpc-client" version = "2.2.1" -source = "git+https://github.com/hirosystems/clarinet.git?rev=32cc9aa8#32cc9aa83afb6d5f0ccbbdef0d34076d9bee9476" +source = "git+https://github.com/hirosystems/clarinet.git?rev=1458e224#1458e224d6aa8b53f49f50d880d6d0d078454438" dependencies = [ - "clarity-repl 2.2.1 (git+https://github.com/hirosystems/clarinet.git?rev=32cc9aa8)", + "clarity-repl 2.2.1 (git+https://github.com/hirosystems/clarinet.git?rev=1458e224)", "hmac 0.12.1", "libsecp256k1 0.7.1", "pbkdf2", @@ -4803,15 +4775,6 @@ dependencies = [ "tiny-hderive", ] -[[package]] -name = "standback" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" -dependencies = [ - "version_check", -] - [[package]] name = "state" version = "0.5.3" @@ -4827,55 +4790,6 @@ 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", - "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.107", -] - -[[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.107", -] - -[[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" @@ -4929,7 +4843,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -4957,9 +4871,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -5055,7 +4969,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -5079,71 +4993,37 @@ dependencies = [ [[package]] name = "time" -version = "0.2.27" +version = "0.3.34" 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.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ + "deranged", "itoa", "libc", + "num-conv", "num_threads", + "powerfmt", "serde", "time-core", - "time-macros 0.2.6", + "time-macros", ] [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +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.6" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "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.107", -] - [[package]] name = "tiny-hderive" version = "0.3.0" @@ -5199,7 +5079,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -5280,7 +5160,7 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.2.3", "toml_datetime", "winnow", ] @@ -5291,7 +5171,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", @@ -5390,7 +5270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" dependencies = [ "crossbeam-channel", - "time 0.3.17", + "time", "tracing-subscriber", ] @@ -5655,9 +5535,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -5665,24 +5545,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.107", + "syn 2.0.50", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -5692,9 +5572,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5702,22 +5582,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn 2.0.50", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "wasm-encoder" @@ -5758,7 +5638,7 @@ version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.2.3", "semver 1.0.16", ] @@ -5774,7 +5654,7 @@ dependencies = [ "bumpalo", "cfg-if", "fxprof-processed-profile", - "indexmap 2.0.0", + "indexmap 2.2.3", "libc", "log", "object 0.32.1", @@ -5837,7 +5717,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", "wasmtime-component-util", "wasmtime-wit-bindgen", "wit-parser", @@ -5899,7 +5779,7 @@ dependencies = [ "anyhow", "cranelift-entity", "gimli 0.28.1", - "indexmap 2.0.0", + "indexmap 2.2.3", "log", "object 0.32.1", "serde", @@ -5984,7 +5864,7 @@ dependencies = [ "anyhow", "cc", "cfg-if", - "indexmap 2.0.0", + "indexmap 2.2.3", "libc", "log", "mach", @@ -6025,7 +5905,7 @@ checksum = "f50f51f8d79bfd2aa8e9d9a0ae7c2d02b45fe412e62ff1b87c0c81b07c738231" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] @@ -6036,7 +5916,7 @@ checksum = "4b804dfd3d0c0d6d37aa21026fe7772ba1a769c89ee4f5c4f13b82d91d75216f" dependencies = [ "anyhow", "heck 0.4.1", - "indexmap 2.0.0", + "indexmap 2.2.3", "wit-parser", ] @@ -6282,7 +6162,7 @@ checksum = "15df6b7b28ce94b8be39d8df5cb21a08a4f3b9f33b631aedb4aa5776f785ead3" dependencies = [ "anyhow", "id-arena", - "indexmap 2.0.0", + "indexmap 2.2.3", "log", "semver 1.0.16", "serde", @@ -6299,7 +6179,7 @@ checksum = "6c7db3d3fe28c359e0cdb7f7ad83e3316bda0ba982b8cd1bf0fbe73ae4127e4b" dependencies = [ "aes-gcm", "bs58 0.5.0", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "hex 0.4.3", "num-traits", "p256k1", @@ -6321,7 +6201,7 @@ checksum = "c398736468f3322a43b6419be5315e68ae035e6565628603503c2a62ad726f36" dependencies = [ "aes-gcm", "bs58 0.5.0", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "hex 0.4.3", "num-traits", "p256k1", @@ -6382,7 +6262,7 @@ checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.50", ] [[package]] diff --git a/components/clarinet-cli/Cargo.toml b/components/clarinet-cli/Cargo.toml index acd2e9941..12bac050f 100644 --- a/components/clarinet-cli/Cargo.toml +++ b/components/clarinet-cli/Cargo.toml @@ -58,7 +58,6 @@ segment = { version = "0.1.2", optional = true } mac_address = { version = "1.1.2", optional = true } tower-lsp = { version = "0.19.0", optional = true } hex = "0.4.3" -serde_yaml = "0.8.23" num_cpus = "1.13.1" mio = "0.8" similar = "2.1.0" diff --git a/components/clarinet-cli/src/deployments/mod.rs b/components/clarinet-cli/src/deployments/mod.rs index a8ec499c7..4a08bdbf3 100644 --- a/components/clarinet-cli/src/deployments/mod.rs +++ b/components/clarinet-cli/src/deployments/mod.rs @@ -101,13 +101,6 @@ pub fn write_deployment( } } - let file = deployment.to_specification_file(); - - let content = match serde_yaml::to_string(&file) { - Ok(res) => res, - Err(err) => return Err(format!("failed serializing deployment\n{}", err)), - }; - - target_location.write_content(content.as_bytes())?; + target_location.write_content(&deployment.to_file_content()?)?; Ok(()) } diff --git a/components/clarinet-cli/src/deployments/types.rs b/components/clarinet-cli/src/deployments/types.rs index af4a9d1a7..055b1cf9d 100644 --- a/components/clarinet-cli/src/deployments/types.rs +++ b/components/clarinet-cli/src/deployments/types.rs @@ -29,15 +29,16 @@ impl DeploymentSynthesis { } } } - let file = deployment.to_specification_file(); - let content = match serde_yaml::to_string(&file) { + + let content = match deployment.to_file_content() { Ok(res) => res, Err(err) => panic!("unable to serialize deployment {}", err), }; + DeploymentSynthesis { total_cost, blocks_count, - content, + content: std::str::from_utf8(&content).unwrap().to_string(), } } } diff --git a/components/clarinet-cli/src/frontend/cli.rs b/components/clarinet-cli/src/frontend/cli.rs index a581f1517..a8f994cda 100644 --- a/components/clarinet-cli/src/frontend/cli.rs +++ b/components/clarinet-cli/src/frontend/cli.rs @@ -618,21 +618,16 @@ pub fn main() { } let write_plan = if default_deployment_path.exists() { - let existing_deployment = - match load_deployment(&manifest, &default_deployment_path) { - Ok(deployment) => deployment, - Err(message) => { - println!( - "{}", - format_err!(format!( - "unable to load {}\n{}", - default_deployment_path.to_string(), - message - )) - ); - process::exit(1); - } - }; + let existing_deployment = load_deployment(&manifest, &default_deployment_path) + .unwrap_or_else(|message| { + println!( + "{}", + format_err!(format!( + "unable to load {default_deployment_path}\n{message}", + )) + ); + process::exit(1); + }); should_existing_plan_be_replaced(&existing_deployment, &deployment) } else { true @@ -1300,15 +1295,18 @@ fn load_deployment_and_artifacts_or_exit( } } -pub fn should_existing_plan_be_replaced( +fn should_existing_plan_be_replaced( existing_plan: &DeploymentSpecification, new_plan: &DeploymentSpecification, ) -> bool { use similar::{ChangeTag, TextDiff}; - let existing_file = serde_yaml::to_string(&existing_plan.to_specification_file()).unwrap(); - - let new_file = serde_yaml::to_string(&new_plan.to_specification_file()).unwrap(); + let existing_file = existing_plan + .to_file_content() + .expect("unable to serialize deployment"); + let new_file = new_plan + .to_file_content() + .expect("unable to serialize deployment"); if existing_file == new_file { return false; @@ -1316,7 +1314,10 @@ pub fn should_existing_plan_be_replaced( println!("{}", blue!("A new deployment plan was computed and differs from the default deployment plan currently saved on disk:")); - let diffs = TextDiff::from_lines(&existing_file, &new_file); + let diffs = TextDiff::from_lines( + std::str::from_utf8(&existing_file).unwrap(), + std::str::from_utf8(&new_file).unwrap(), + ); for change in diffs.iter_all_changes() { let formatted_change = match change.tag() { @@ -1338,7 +1339,7 @@ pub fn should_existing_plan_be_replaced( !buffer.starts_with('n') } -pub fn load_deployment_if_exists( +fn load_deployment_if_exists( manifest: &ProjectManifest, network: &StacksNetwork, force_on_disk: bool, @@ -1357,13 +1358,12 @@ pub fn load_deployment_if_exists( Ok((deployment, _)) => { use similar::{ChangeTag, TextDiff}; - let current_version = match default_deployment_location.read_content_as_utf8() { + let current_version = match default_deployment_location.read_content() { Ok(content) => content, Err(message) => return Some(Err(message)), }; - let file = deployment.to_specification_file(); - let updated_version = match serde_yaml::to_string(&file) { + let updated_version = match deployment.to_file_content() { Ok(res) => res, Err(err) => { return Some(Err(format!("failed serializing deployment\n{}", err))) @@ -1377,7 +1377,10 @@ pub fn load_deployment_if_exists( if !force_computed { println!("{}", blue!("A new deployment plan was computed and differs from the default deployment plan currently saved on disk:")); - let diffs = TextDiff::from_lines(¤t_version, &updated_version); + let diffs = TextDiff::from_lines( + std::str::from_utf8(¤t_version).unwrap(), + std::str::from_utf8(&updated_version).unwrap(), + ); for change in diffs.iter_all_changes() { let formatted_change = match change.tag() { @@ -1399,13 +1402,13 @@ pub fn load_deployment_if_exists( Some(load_deployment(manifest, &default_deployment_location)) } else { default_deployment_location - .write_content(updated_version.as_bytes()) + .write_content(&updated_version) .ok()?; Some(Ok(deployment)) } } else { default_deployment_location - .write_content(updated_version.as_bytes()) + .write_content(&updated_version) .ok()?; Some(Ok(deployment)) } diff --git a/components/clarinet-deployments/src/deployment_plan_test.rs b/components/clarinet-deployments/src/deployment_plan_test.rs new file mode 100644 index 000000000..d94273790 --- /dev/null +++ b/components/clarinet-deployments/src/deployment_plan_test.rs @@ -0,0 +1,117 @@ +use std::collections::BTreeMap; + +use clarinet_files::{chainhook_types::StacksNetwork, FileLocation}; +use clarity_repl::clarity::{ + vm::types::{QualifiedContractIdentifier, StandardPrincipalData}, + ClarityName, ClarityVersion, ContractName, +}; + +use crate::types::*; + +fn get_test_txs() -> (TransactionSpecification, TransactionSpecification) { + let contract_id = + QualifiedContractIdentifier::parse("ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.test") + .unwrap(); + let tx_sender = StandardPrincipalData::from(contract_id.issuer.clone()); + + let contract_publish_tx = + TransactionSpecification::EmulatedContractPublish(EmulatedContractPublishSpecification { + contract_name: ContractName::try_from("test".to_string()).unwrap(), + emulated_sender: tx_sender.clone(), + location: FileLocation::from_path_string("/contracts/test.clar").unwrap(), + source: "(ok true)".to_string(), + clarity_version: ClarityVersion::Clarity2, + }); + + let contract_call_txs = + TransactionSpecification::EmulatedContractCall(EmulatedContractCallSpecification { + contract_id: QualifiedContractIdentifier::parse( + "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.test", + ) + .unwrap(), + emulated_sender: tx_sender.clone(), + method: ClarityName::try_from("test".to_string()).unwrap(), + parameters: vec![], + }); + + (contract_publish_tx, contract_call_txs) +} + +fn build_test_deployement_plan( + batches: Vec, +) -> DeploymentSpecification { + DeploymentSpecification { + id: 1, + name: "test".to_string(), + network: StacksNetwork::Simnet, + stacks_node: None, + bitcoin_node: None, + genesis: None, + contracts: BTreeMap::new(), + plan: TransactionPlanSpecification { batches }, + } +} + +#[test] +fn test_extract_no_contract_publish_txs() { + let (contract_publish_tx, contract_call_txs) = get_test_txs(); + + let plan = build_test_deployement_plan(vec![ + TransactionsBatchSpecification { + id: 0, + transactions: vec![contract_publish_tx.clone()], + epoch: Some(EpochSpec::Epoch2_4), + }, + TransactionsBatchSpecification { + id: 1, + transactions: vec![contract_call_txs.clone()], + epoch: Some(EpochSpec::Epoch2_4), + }, + ]); + + let (new_plan, custom_txs) = plan.extract_no_contract_publish_txs(); + + assert_eq!( + new_plan, + build_test_deployement_plan(vec![TransactionsBatchSpecification { + id: 0, + transactions: vec![contract_publish_tx.clone()], + epoch: Some(EpochSpec::Epoch2_4), + },]) + ); + + assert_eq!( + custom_txs, + vec![TransactionsBatchSpecification { + id: 1, + transactions: vec![contract_call_txs.clone()], + epoch: Some(EpochSpec::Epoch2_4), + }] + ); +} + +#[test] +fn test_merge_batches() { + let (contract_publish_tx, contract_call_txs) = get_test_txs(); + + let plan = build_test_deployement_plan(vec![ + TransactionsBatchSpecification { + id: 0, + transactions: vec![contract_publish_tx.clone()], + epoch: Some(EpochSpec::Epoch2_4), + }, + TransactionsBatchSpecification { + id: 1, + transactions: vec![contract_call_txs.clone()], + epoch: Some(EpochSpec::Epoch2_4), + }, + ]); + + let (mut new_plan, custom_txs) = plan.extract_no_contract_publish_txs(); + + assert_ne!(plan, new_plan); + + new_plan.merge_batches(custom_txs); + + assert_eq!(plan, new_plan); +} diff --git a/components/clarinet-deployments/src/lib.rs b/components/clarinet-deployments/src/lib.rs index 75a4db653..9215af06e 100644 --- a/components/clarinet-deployments/src/lib.rs +++ b/components/clarinet-deployments/src/lib.rs @@ -13,6 +13,9 @@ pub mod onchain; pub mod requirements; pub mod types; +#[cfg(test)] +mod deployment_plan_test; + use self::types::{ DeploymentSpecification, EmulatedContractPublishSpecification, GenesisSpecification, TransactionPlanSpecification, TransactionsBatchSpecification, WalletSpecification, @@ -564,9 +567,7 @@ pub async fn generate_default_deployment( contract_location.to_string() }) .collect(); - file_accessor - .read_contracts_content(contracts_location) - .await? + file_accessor.read_files(contracts_location).await? } }; diff --git a/components/clarinet-deployments/src/types.rs b/components/clarinet-deployments/src/types.rs index 5cf2cf183..5fed3eaf0 100644 --- a/components/clarinet-deployments/src/types.rs +++ b/components/clarinet-deployments/src/types.rs @@ -1,5 +1,5 @@ use clarinet_files::chainhook_types::StacksNetwork; -use clarinet_files::FileLocation; +use clarinet_files::{FileAccessor, FileLocation}; use clarity_repl::clarity::util::hash::{hex_bytes, to_hex}; use clarity_repl::clarity::vm::analysis::ContractAnalysis; use clarity_repl::clarity::vm::ast::ContractAST; @@ -817,6 +817,7 @@ impl EmulatedContractPublishSpecification { pub fn from_specifications( specs: &EmulatedContractPublishSpecificationFile, project_root_location: &FileLocation, + source: Option, ) -> Result { let contract_name = match ContractName::try_from(specs.contract_name.to_string()) { Ok(res) => res, @@ -860,7 +861,10 @@ impl EmulatedContractPublishSpecification { _ => Ok(DEFAULT_CLARITY_VERSION), }?; - let source = location.read_content_as_utf8()?; + let source = match source { + Some(source) => source, + None => location.read_content_as_utf8()?, + }; Ok(EmulatedContractPublishSpecification { contract_name, @@ -872,7 +876,7 @@ impl EmulatedContractPublishSpecification { } } -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub struct DeploymentSpecification { pub id: u32, pub name: String, @@ -995,6 +999,7 @@ impl DeploymentSpecification { &specification_file, &network, project_root_location, + None, )?; Ok(deployment_spec) @@ -1004,6 +1009,7 @@ impl DeploymentSpecification { specs: &DeploymentSpecificationFile, network: &StacksNetwork, project_root_location: &FileLocation, + contracts_sources: Option<&HashMap>, ) -> Result { let mut contracts = BTreeMap::new(); let (plan, genesis) = match network { @@ -1019,7 +1025,14 @@ impl DeploymentSpecification { TransactionSpecification::EmulatedContractCall(EmulatedContractCallSpecification::from_specifications(spec)?) } TransactionSpecificationFile::EmulatedContractPublish(spec) => { - let spec = EmulatedContractPublishSpecification::from_specifications(spec, project_root_location)?; + let source = contracts_sources.as_ref().map(|contracts_sources| + contracts_sources + .get(spec.path.as_ref().expect("missing path")) + .cloned() + .expect("missing contract source") + ); + + let spec = EmulatedContractPublishSpecification::from_specifications(spec, project_root_location, source)?; let contract_id = QualifiedContractIdentifier::new(spec.emulated_sender.clone(), spec.contract_name.clone()); contracts.insert(contract_id, (spec.source.clone(), spec.location.clone())); TransactionSpecification::EmulatedContractPublish(spec) @@ -1116,7 +1129,7 @@ impl DeploymentSpecification { }) } - pub fn to_specification_file(&self) -> DeploymentSpecificationFile { + fn to_specification_file(&self) -> DeploymentSpecificationFile { DeploymentSpecificationFile { id: Some(self.id), name: self.name.clone(), @@ -1133,6 +1146,65 @@ impl DeploymentSpecification { plan: Some(self.plan.to_specification_file()), } } + + pub fn to_file_content(&self) -> Result, String> { + serde_yaml::to_vec(&self.to_specification_file()) + .map_err(|err| format!("failed to serialize deployment\n{}", err)) + } + + pub fn sort_batches_by_epoch(&mut self) { + self.plan.batches.sort_by(|a, b| a.epoch.cmp(&b.epoch)); + for (i, batch) in self.plan.batches.iter_mut().enumerate() { + batch.id = i; + } + } + + pub fn extract_no_contract_publish_txs(&self) -> (Self, Vec) { + let mut deployment_only_contract_publish_txs = self.clone(); + let mut custom_txs_batches = vec![]; + + for batch in deployment_only_contract_publish_txs.plan.batches.iter_mut() { + let (ref contract_publish_txs, custom_txs): ( + Vec, + Vec, + ) = batch.transactions.clone().into_iter().partition(|tx| { + matches!(tx, TransactionSpecification::ContractPublish(_)) + || matches!(tx, TransactionSpecification::EmulatedContractPublish(_)) + }); + + batch.transactions = contract_publish_txs.clone(); + if !custom_txs.is_empty() { + custom_txs_batches.push(TransactionsBatchSpecification { + id: batch.id, + transactions: custom_txs, + epoch: batch.epoch, + }); + } + } + + deployment_only_contract_publish_txs + .plan + .batches + .retain(|b| !b.transactions.is_empty()); + + (deployment_only_contract_publish_txs, custom_txs_batches) + } + + pub fn merge_batches(&mut self, custom_batches: Vec) { + for custom_batch in custom_batches { + if let Some(batch) = self + .plan + .batches + .iter_mut() + .find(|b| b.id == custom_batch.id && b.epoch == custom_batch.epoch) + { + batch.transactions.extend(custom_batch.transactions); + } else { + self.plan.batches.push(custom_batch); + } + } + self.sort_batches_by_epoch(); + } } #[derive(Debug, PartialEq, Serialize, Deserialize)] @@ -1152,6 +1224,18 @@ pub struct DeploymentSpecificationFile { pub plan: Option, } +impl DeploymentSpecificationFile { + pub async fn from_file_accessor( + path: &FileLocation, + file_accesor: &dyn FileAccessor, + ) -> Result { + let spec_file_content = file_accesor.read_file(path.to_string()).await?; + + serde_yaml::from_str(&spec_file_content) + .map_err(|msg| format!("unable to read file {}", msg)) + } +} + #[derive(Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct GenesisSpecificationFile { diff --git a/components/clarinet-files/Cargo.toml b/components/clarinet-files/Cargo.toml index 13e61751a..96df79197 100644 --- a/components/clarinet-files/Cargo.toml +++ b/components/clarinet-files/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" serde = "1" serde_derive = "1" # chainhook-types = "1.2" -chainhook-types = { version = "1.2", git = "https://github.com/hirosystems/chainhook.git", rev="570ceb7" } +chainhook-types = { version = "1.2", git = "https://github.com/hirosystems/chainhook.git", rev="ac59025" } bip39 = { version = "1.0.1", default-features = false } libsecp256k1 = "0.7.0" toml = { version = "0.5.6", features = ["preserve_order"] } @@ -22,10 +22,10 @@ clarity-repl = { version = "2", path = "../clarity-repl", default-features = fal # wasm js-sys = { version = "0.3", optional = true } -serde-wasm-bindgen = { version = "0.6.0", optional = true } -wasm-bindgen = { version = "0.2", optional = true } -wasm-bindgen-futures = { version = "0.4", optional = true } -serde_json = "1.0.104" +serde-wasm-bindgen = { version = "0.6.4", optional = true } +wasm-bindgen = { version = "0.2.91", optional = true } +wasm-bindgen-futures = { version = "0.4.41", optional = true } +serde_json = "1.0.114" [features] default = ["cli"] diff --git a/components/clarinet-files/src/lib.rs b/components/clarinet-files/src/lib.rs index 31c95bf3b..7a114dae7 100644 --- a/components/clarinet-files/src/lib.rs +++ b/components/clarinet-files/src/lib.rs @@ -45,7 +45,7 @@ pub type FileAccessorResult = Pin>> pub trait FileAccessor { fn file_exists(&self, path: String) -> FileAccessorResult; fn read_file(&self, path: String) -> FileAccessorResult; - fn read_contracts_content( + fn read_files( &self, contracts_paths: Vec, ) -> FileAccessorResult>; diff --git a/components/clarinet-files/src/wasm_fs_accessor.rs b/components/clarinet-files/src/wasm_fs_accessor.rs index 1097aa9c3..c5ad445f4 100644 --- a/components/clarinet-files/src/wasm_fs_accessor.rs +++ b/components/clarinet-files/src/wasm_fs_accessor.rs @@ -77,7 +77,7 @@ impl FileAccessor for WASMFileSystemAccessor { }) } - fn read_contracts_content( + fn read_files( &self, contracts_paths: Vec, ) -> FileAccessorResult> { diff --git a/components/clarinet-sdk-wasm/Cargo.toml b/components/clarinet-sdk-wasm/Cargo.toml index b11d374d9..bc1fbfc95 100644 --- a/components/clarinet-sdk-wasm/Cargo.toml +++ b/components/clarinet-sdk-wasm/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "clarinet-sdk-wasm" -version = "2.2.1" +version = "2.3.0-rc3" license = "GPL-3.0" repository = "https://github.com/hirosystems/clarinet" description = "The core lib that powers @hirosystems/clarinet-sdk" @@ -17,10 +17,11 @@ gloo-utils = { version = "0.2", features = ["serde"] } js-sys = { version = "0.3", optional = true } serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0" -serde-wasm-bindgen = { version = "0.6.0", optional = true } -wasm-bindgen = { version = "0.2", optional = true } -wasm-bindgen-futures = { version = "0.4", optional = true } +serde-wasm-bindgen = { version = "0.6.4", optional = true } +wasm-bindgen = { version = "0.2.91", optional = true } +wasm-bindgen-futures = { version = "0.4.41", optional = true } web-sys = { version = "0.3", features = ["console"], optional = true } +colored = "2.1.0" clarinet-files = { path = "../clarinet-files", default-features = false } clarity-repl = { path = "../clarity-repl", default-features = false, optional = true } diff --git a/components/clarinet-sdk-wasm/src/core.rs b/components/clarinet-sdk-wasm/src/core.rs index e7bebb84c..880af7ed0 100644 --- a/components/clarinet-sdk-wasm/src/core.rs +++ b/components/clarinet-sdk-wasm/src/core.rs @@ -1,7 +1,10 @@ use clarinet_deployments::diagnostic_digest::DiagnosticsDigest; -use clarinet_deployments::types::{DeploymentGenerationArtifacts, DeploymentSpecification}; +use clarinet_deployments::types::{ + DeploymentGenerationArtifacts, DeploymentSpecification, DeploymentSpecificationFile, + TransactionSpecificationFile, +}; use clarinet_deployments::{ - generate_default_deployment, initiate_session_from_deployment, + generate_default_deployment, initiate_session_from_deployment, setup_session_with_deployment, update_session_with_contracts_executions, update_session_with_genesis_accounts, }; use clarinet_files::chainhook_types::StacksNetwork; @@ -18,6 +21,7 @@ use clarity_repl::repl::{ ClarityCodeSource, ClarityContract, ContractDeployer, Session, DEFAULT_CLARITY_VERSION, DEFAULT_EPOCH, }; +use colored::*; use gloo_utils::format::JsValueSerdeExt; use js_sys::Function as JsFunction; use serde::{Deserialize, Serialize}; @@ -253,6 +257,7 @@ pub struct SDK { current_test_name: String, } +#[allow(non_snake_case)] #[wasm_bindgen] impl SDK { #[wasm_bindgen(constructor)] @@ -284,32 +289,108 @@ impl SDK { } #[wasm_bindgen(js_name=initSession)] - pub async fn init_session( - &mut self, - root: String, - manifest_path: String, - ) -> Result<(), String> { - let mut root_path = PathBuf::new(); - root_path.push(root); - let project_root = FileLocation::FileSystem { path: root_path }; - let manifest_location = FileLocation::try_parse(&manifest_path, Some(&project_root)) + pub async fn init_session(&mut self, cwd: String, manifest_path: String) -> Result<(), String> { + let cwd_path = PathBuf::from(cwd); + let cwd_root = FileLocation::FileSystem { path: cwd_path }; + let manifest_location = FileLocation::try_parse(&manifest_path, Some(&cwd_root)) .ok_or("Failed to parse manifest location")?; + let project_root = manifest_location.get_parent_location()?; + let deployment_plan_location = + FileLocation::try_parse("deployments/default.simnet-plan.yaml", Some(&project_root)) + .ok_or("Failed to parse default deployment location")?; + let manifest = ProjectManifest::from_file_accessor(&manifest_location, &*self.file_accessor).await?; + let (mut default_deployment, default_artifacts) = generate_default_deployment( + &manifest, + &StacksNetwork::Simnet, + false, + Some(&*self.file_accessor), + Some(StacksEpochId::Epoch21), + ) + .await?; + let (deployment, artifacts) = match self.cache.get(&manifest_location) { Some(cache) => cache.clone(), None => { - let cache = generate_default_deployment( - &manifest, - &StacksNetwork::Simnet, - false, - Some(&*self.file_accessor), - Some(StacksEpochId::Epoch21), - ) - .await?; - self.cache.insert(manifest_location, cache.clone()); - cache + if self + .file_accessor + .file_exists(deployment_plan_location.to_string()) + .await? + { + let spec_file = DeploymentSpecificationFile::from_file_accessor( + &deployment_plan_location, + &*self.file_accessor, + ) + .await?; + + let contracts_paths = match spec_file.plan { + Some(ref plan) => plan + .batches + .iter() + .flat_map(|b| { + b.transactions + .iter() + .filter_map(|t| match t { + TransactionSpecificationFile::EmulatedContractPublish( + ref deploy, + ) => deploy.path.clone(), + _ => None, + }) + .collect::>() + }) + .collect::>(), + None => { + vec![] + } + }; + + let contracts_sources = self.file_accessor.read_files(contracts_paths).await?; + + let existing_deployment = DeploymentSpecification::from_specifications( + &spec_file, + &StacksNetwork::Simnet, + &project_root, + Some(&contracts_sources), + ) + .map_err(|e| e.to_string())?; + + let (deployment_with_only_contract_publish_txs, custom_batches) = + existing_deployment.extract_no_contract_publish_txs(); + + let (deployment, artifacts) = if deployment_with_only_contract_publish_txs + == default_deployment + { + log!("{}", "using existing deployment plan".yellow().bold()); + let artifacts = + setup_session_with_deployment(&manifest, &existing_deployment, None); + (existing_deployment, artifacts) + } else { + log!("{}", "using updated deployment plan".yellow().bold()); + default_deployment.merge_batches(custom_batches); + let deployment_file = default_deployment.to_file_content()?; + self.file_accessor + .write_file(deployment_plan_location.to_string(), &deployment_file) + .await?; + (default_deployment, default_artifacts) + }; + + let cache = (deployment, artifacts); + self.cache.insert(manifest_location, cache.clone()); + cache + } else { + log!("{}", "generated a new deployment plan".green().bold()); + let cache = (default_deployment.clone(), default_artifacts.clone()); + self.cache.insert(manifest_location, cache.clone()); + + let deployment_file = default_deployment.to_file_content()?; + self.file_accessor + .write_file(deployment_plan_location.to_string(), &deployment_file) + .await?; + + cache + } } }; diff --git a/components/clarinet-sdk/package-lock.json b/components/clarinet-sdk/package-lock.json index 8e1c56ddd..15597f479 100644 --- a/components/clarinet-sdk/package-lock.json +++ b/components/clarinet-sdk/package-lock.json @@ -1,15 +1,15 @@ { "name": "@hirosystems/clarinet-sdk", - "version": "1.3.0", + "version": "2.3.0-rc2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@hirosystems/clarinet-sdk", - "version": "1.3.0", + "version": "2.3.0-rc2", "license": "GPL-3.0", "dependencies": { - "@hirosystems/clarinet-sdk-wasm": "^2.2.0", + "@hirosystems/clarinet-sdk-wasm": "^2.3.0-rc3", "@stacks/transactions": "^6.12.0", "kolorist": "^1.8.0", "prompts": "^2.4.2", @@ -378,9 +378,9 @@ } }, "node_modules/@hirosystems/clarinet-sdk-wasm": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@hirosystems/clarinet-sdk-wasm/-/clarinet-sdk-wasm-2.2.0.tgz", - "integrity": "sha512-qWk8rod+1ZelOfjXTDJIKREk3eLOcGCfro4Xb9gaN/DQ9pEGZsOdtAeCRlKe7oNxjG+/rVto/+69yxMPR/Uz8Q==" + "version": "2.3.0-rc3", + "resolved": "https://registry.npmjs.org/@hirosystems/clarinet-sdk-wasm/-/clarinet-sdk-wasm-2.3.0-rc3.tgz", + "integrity": "sha512-HUhsdC1QlBpMfeD3ox/tXlCD8psx6v5cULhBMg1+y0W1kbOlA5lgSQW30GsDjtT30o4VYELmxCfQS4IzU5EsTQ==" }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -411,9 +411,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.4.tgz", + "integrity": "sha512-Oud2QPM5dHviZNn4y/WhhYKSXksv+1xLEIsNrAbGcFzUN3ubqWRFT5gwPchNc5NuzILOU4tPBDTZ4VwhL8Y7cw==", "devOptional": true, "peer": true, "dependencies": { @@ -426,9 +426,9 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "devOptional": true, "peer": true, "engines": { @@ -462,9 +462,9 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "version": "0.3.23", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.23.tgz", + "integrity": "sha512-9/4foRoUKp8s96tSkh8DlAAc5A0Ty8vLXld+l9gjKKY6ckwI8G15f0hskGmuLZu78ZlGa1vtsfOa+lnB4vG6Jg==", "devOptional": true, "peer": true, "dependencies": { @@ -505,9 +505,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.6.tgz", - "integrity": "sha512-MVNXSSYN6QXOulbHpLMKYi60ppyO13W9my1qogeiAqtjb2yR4LSmfU2+POvDkLzhjYLXz9Rf9+9a3zFHW1Lecg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.12.0.tgz", + "integrity": "sha512-+ac02NL/2TCKRrJu2wffk1kZ+RyqxVUlbjSagNgPm94frxtr+XDL12E5Ll1enWskLrtrZ2r8L3wED1orIibV/w==", "cpu": [ "arm" ], @@ -517,9 +517,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.6.tgz", - "integrity": "sha512-T14aNLpqJ5wzKNf5jEDpv5zgyIqcpn1MlwCrUXLrwoADr2RkWA0vOWP4XxbO9aiO3dvMCQICZdKeDrFl7UMClw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.12.0.tgz", + "integrity": "sha512-OBqcX2BMe6nvjQ0Nyp7cC90cnumt8PXmO7Dp3gfAju/6YwG0Tj74z1vKrfRz7qAv23nBcYM8BCbhrsWqO7PzQQ==", "cpu": [ "arm64" ], @@ -529,9 +529,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.6.tgz", - "integrity": "sha512-CqNNAyhRkTbo8VVZ5R85X73H3R5NX9ONnKbXuHisGWC0qRbTTxnF1U4V9NafzJbgGM0sHZpdO83pLPzq8uOZFw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.12.0.tgz", + "integrity": "sha512-X64tZd8dRE/QTrBIEs63kaOBG0b5GVEd3ccoLtyf6IdXtHdh8h+I56C2yC3PtC9Ucnv0CpNFJLqKFVgCYe0lOQ==", "cpu": [ "arm64" ], @@ -541,9 +541,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.6.tgz", - "integrity": "sha512-zRDtdJuRvA1dc9Mp6BWYqAsU5oeLixdfUvkTHuiYOHwqYuQ4YgSmi6+/lPvSsqc/I0Omw3DdICx4Tfacdzmhog==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.12.0.tgz", + "integrity": "sha512-cc71KUZoVbUJmGP2cOuiZ9HSOP14AzBAThn3OU+9LcA1+IUqswJyR1cAJj3Mg55HbjZP6OLAIscbQsQLrpgTOg==", "cpu": [ "x64" ], @@ -553,9 +553,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.6.tgz", - "integrity": "sha512-oNk8YXDDnNyG4qlNb6is1ojTOGL/tRhbbKeE/YuccItzerEZT68Z9gHrY3ROh7axDc974+zYAPxK5SH0j/G+QQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.12.0.tgz", + "integrity": "sha512-a6w/Y3hyyO6GlpKL2xJ4IOh/7d+APaqLYdMf86xnczU3nurFTaVN9s9jOXQg97BE4nYm/7Ga51rjec5nfRdrvA==", "cpu": [ "arm" ], @@ -565,9 +565,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.6.tgz", - "integrity": "sha512-Z3O60yxPtuCYobrtzjo0wlmvDdx2qZfeAWTyfOjEDqd08kthDKexLpV97KfAeUXPosENKd8uyJMRDfFMxcYkDQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.12.0.tgz", + "integrity": "sha512-0fZBq27b+D7Ar5CQMofVN8sggOVhEtzFUwOwPppQt0k+VR+7UHMZZY4y+64WJ06XOhBTKXtQB/Sv0NwQMXyNAA==", "cpu": [ "arm64" ], @@ -577,9 +577,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.6.tgz", - "integrity": "sha512-gpiG0qQJNdYEVad+1iAsGAbgAnZ8j07FapmnIAQgODKcOTjLEWM9sRb+MbQyVsYCnA0Im6M6QIq6ax7liws6eQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.12.0.tgz", + "integrity": "sha512-eTvzUS3hhhlgeAv6bfigekzWZjaEX9xP9HhxB0Dvrdbkk5w/b+1Sxct2ZuDxNJKzsRStSq1EaEkVSEe7A7ipgQ==", "cpu": [ "arm64" ], @@ -589,9 +589,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.6.tgz", - "integrity": "sha512-+uCOcvVmFUYvVDr27aiyun9WgZk0tXe7ThuzoUTAukZJOwS5MrGbmSlNOhx1j80GdpqbOty05XqSl5w4dQvcOA==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.12.0.tgz", + "integrity": "sha512-ix+qAB9qmrCRiaO71VFfY8rkiAZJL8zQRXveS27HS+pKdjwUfEhqo2+YF2oI+H/22Xsiski+qqwIBxVewLK7sw==", "cpu": [ "riscv64" ], @@ -601,9 +601,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.6.tgz", - "integrity": "sha512-HUNqM32dGzfBKuaDUBqFB7tP6VMN74eLZ33Q9Y1TBqRDn+qDonkAUyKWwF9BR9unV7QUzffLnz9GrnKvMqC/fw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.12.0.tgz", + "integrity": "sha512-TenQhZVOtw/3qKOPa7d+QgkeM6xY0LtwzR8OplmyL5LrgTWIXpTQg2Q2ycBf8jm+SFW2Wt/DTn1gf7nFp3ssVA==", "cpu": [ "x64" ], @@ -613,9 +613,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.6.tgz", - "integrity": "sha512-ch7M+9Tr5R4FK40FHQk8VnML0Szi2KRujUgHXd/HjuH9ifH72GUmw6lStZBo3c3GB82vHa0ZoUfjfcM7JiiMrQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.12.0.tgz", + "integrity": "sha512-LfFdRhNnW0zdMvdCb5FNuWlls2WbbSridJvxOvYWgSBOYZtgBfW9UGNJG//rwMqTX1xQE9BAodvMH9tAusKDUw==", "cpu": [ "x64" ], @@ -625,9 +625,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.6.tgz", - "integrity": "sha512-VD6qnR99dhmTQ1mJhIzXsRcTBvTjbfbGGwKAHcu+52cVl15AC/kplkhxzW/uT0Xl62Y/meBKDZvoJSJN+vTeGA==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.12.0.tgz", + "integrity": "sha512-JPDxovheWNp6d7AHCgsUlkuCKvtu3RB55iNEkaQcf0ttsDU/JZF+iQnYcQJSk/7PtT4mjjVG8N1kpwnI9SLYaw==", "cpu": [ "arm64" ], @@ -637,9 +637,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.6.tgz", - "integrity": "sha512-J9AFDq/xiRI58eR2NIDfyVmTYGyIZmRcvcAoJ48oDld/NTR8wyiPUu2X/v1navJ+N/FGg68LEbX3Ejd6l8B7MQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.12.0.tgz", + "integrity": "sha512-fjtuvMWRGJn1oZacG8IPnzIV6GF2/XG+h71FKn76OYFqySXInJtseAqdprVTDTyqPxQOG9Exak5/E9Z3+EJ8ZA==", "cpu": [ "ia32" ], @@ -649,9 +649,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.6.tgz", - "integrity": "sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.12.0.tgz", + "integrity": "sha512-ZYmr5mS2wd4Dew/JjT0Fqi2NPB/ZhZ2VvPp7SmvPZb4Y1CG/LRcS6tcRo2cYU7zLK5A7cdbhWnnWmUjoI4qapg==", "cpu": [ "x64" ], @@ -675,9 +675,9 @@ } }, "node_modules/@stacks/common/node_modules/@types/node": { - "version": "18.19.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.14.tgz", - "integrity": "sha512-EnQ4Us2rmOS64nHDWr0XqAD8DsO6f3XR6lf9UIIrZQpUzPVdN/oPuEzfDWNHSyXLvoGgjuEm/sPwFGSSs35Wtg==", + "version": "18.19.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.20.tgz", + "integrity": "sha512-SKXZvI375jkpvAj8o+5U2518XQv76mAsixqfXiVyWyXZbVWQK25RurFovYpVIxVzul0rZoH58V/3SkEnm7s3qA==", "dependencies": { "undici-types": "~5.26.4" } @@ -713,9 +713,9 @@ } }, "node_modules/@types/eslint": { - "version": "8.56.2", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", - "integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==", + "version": "8.56.4", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.4.tgz", + "integrity": "sha512-lG1GLUnL5vuRBGb3MgWUWLdGMH2Hps+pERuyQXCfWozuGKdnhf9Pbg4pkcrVUHjKrU7Rl+GCZ/299ObBXZFAxg==", "dev": true, "peer": true, "dependencies": { @@ -747,9 +747,9 @@ "peer": true }, "node_modules/@types/node": { - "version": "20.11.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", - "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", + "version": "20.11.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.22.tgz", + "integrity": "sha512-/G+IxWxma6V3E+pqK1tSl2Fo1kl41pK1yeCyDsgkF9WlVAme4j5ISYM2zR11bgLFJGLN5sVK40T4RJNuiZbEjA==", "dependencies": { "undici-types": "~5.26.4" } @@ -780,12 +780,12 @@ "dev": true }, "node_modules/@vitest/expect": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.2.2.tgz", - "integrity": "sha512-3jpcdPAD7LwHUUiT2pZTj2U82I2Tcgg2oVPvKxhn6mDI2On6tfvPQTjAI4628GUGDZrCm4Zna9iQHm5cEexOAg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.3.1.tgz", + "integrity": "sha512-xofQFwIzfdmLLlHa6ag0dPV8YsnKOCP1KdAeVVh34vSjN2dcUiXYCD9htu/9eM7t8Xln4v03U9HLxLpPlsXdZw==", "dependencies": { - "@vitest/spy": "1.2.2", - "@vitest/utils": "1.2.2", + "@vitest/spy": "1.3.1", + "@vitest/utils": "1.3.1", "chai": "^4.3.10" }, "funding": { @@ -793,11 +793,11 @@ } }, "node_modules/@vitest/runner": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.2.2.tgz", - "integrity": "sha512-JctG7QZ4LSDXr5CsUweFgcpEvrcxOV1Gft7uHrvkQ+fsAVylmWQvnaAr/HDp3LAH1fztGMQZugIheTWjaGzYIg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.3.1.tgz", + "integrity": "sha512-5FzF9c3jG/z5bgCnjr8j9LNq/9OxV2uEBAITOXfoe3rdZJTdO7jzThth7FXv/6b+kdY65tpRQB7WaKhNZwX+Kg==", "dependencies": { - "@vitest/utils": "1.2.2", + "@vitest/utils": "1.3.1", "p-limit": "^5.0.0", "pathe": "^1.1.1" }, @@ -806,9 +806,9 @@ } }, "node_modules/@vitest/snapshot": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.2.2.tgz", - "integrity": "sha512-SmGY4saEw1+bwE1th6S/cZmPxz/Q4JWsl7LvbQIky2tKE35US4gd0Mjzqfr84/4OD0tikGWaWdMja/nWL5NIPA==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.3.1.tgz", + "integrity": "sha512-EF++BZbt6RZmOlE3SuTPu/NfwBF6q4ABS37HHXzs2LUVPBLx2QoY/K0fKpRChSo8eLiuxcbCVfqKgx/dplCDuQ==", "dependencies": { "magic-string": "^0.30.5", "pathe": "^1.1.1", @@ -819,9 +819,9 @@ } }, "node_modules/@vitest/spy": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.2.2.tgz", - "integrity": "sha512-k9Gcahssw8d7X3pSLq3e3XEu/0L78mUkCjivUqCQeXJm9clfXR/Td8+AP+VC1O6fKPIDLcHDTAmBOINVuv6+7g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.3.1.tgz", + "integrity": "sha512-xAcW+S099ylC9VLU7eZfdT9myV67Nor9w9zhf0mGCYJSO+zM2839tOeROTdikOi/8Qeusffvxb/MyBSOja1Uig==", "dependencies": { "tinyspy": "^2.2.0" }, @@ -830,9 +830,9 @@ } }, "node_modules/@vitest/utils": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.2.2.tgz", - "integrity": "sha512-WKITBHLsBHlpjnDQahr+XK6RE7MiAsgrIkr0pGhQ9ygoxBfUeG0lUG5iLlzqjmKSlBv3+j5EGsriBzh+C3Tq9g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.3.1.tgz", + "integrity": "sha512-d3Waie/299qqRyHTm2DjADeTaNdNSVsnwHPWrs20JMpjh6eiVq7ggggweO8rc4arhf6rRkWuHKwvxGvejUXZZQ==", "dependencies": { "diff-sequences": "^29.6.3", "estree-walker": "^3.0.3", @@ -1141,9 +1141,9 @@ } }, "node_modules/browserslist": { - "version": "4.22.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz", - "integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==", + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz", + "integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==", "dev": true, "funding": [ { @@ -1161,8 +1161,8 @@ ], "peer": true, "dependencies": { - "caniuse-lite": "^1.0.30001580", - "electron-to-chromium": "^1.4.648", + "caniuse-lite": "^1.0.30001587", + "electron-to-chromium": "^1.4.668", "node-releases": "^2.0.14", "update-browserslist-db": "^1.0.13" }, @@ -1201,9 +1201,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001583", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001583.tgz", - "integrity": "sha512-acWTYaha8xfhA/Du/z4sNZjHUWjkiuoAi2LM+T/aL+kemKQgPT1xBb/YKjlQ0Qo8gvbHsGNplrEJ+9G3gL7i4Q==", + "version": "1.0.30001591", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz", + "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==", "dev": true, "funding": [ { @@ -1427,9 +1427,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.655", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.655.tgz", - "integrity": "sha512-2yszojF7vIZ68adIOvzV4bku8OZad9w5H9xF3ZAMZjPuOjBarlflUkjN6DggdV+L71WZuKUfKUhov/34+G5QHg==", + "version": "1.4.686", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.686.tgz", + "integrity": "sha512-3avY1B+vUzNxEgkBDpKOP8WarvUAEwpRaiCL0He5OKWEFxzaOFiq4WoZEZe7qh0ReS7DiWoHMnYoQCKxNZNzSg==", "dev": true, "peer": true }, @@ -1440,9 +1440,9 @@ "dev": true }, "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "version": "5.15.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.1.tgz", + "integrity": "sha512-3d3JRbwsCLJsYgvb6NuWEG44jjPSOMuS73L/6+7BZuoKm3W+qXnSoIYVHi8dG7Qcg4inAY4jbzkZ7MnskePeDg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -1497,9 +1497,9 @@ } }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", "engines": { "node": ">=6" } @@ -1807,6 +1807,11 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/js-tokens": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-8.0.3.tgz", + "integrity": "sha512-UfJMcSJc+SEXEl9lH/VLHSZbThQyLpw1vLO1Lb+j4RWDvG3N2f7yj3PVQA3cmkTBNldJ9eFnM+xEXxHIXrYiJw==" + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -1887,9 +1892,9 @@ } }, "node_modules/magic-string": { - "version": "0.30.6", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.6.tgz", - "integrity": "sha512-n62qCLbPjNjyo+owKtveQxZFZTBm+Ms6YoGD23Wew6Vw337PElFNifQpknPruVRQV57kVShPnLGo9vWxVhpPvA==", + "version": "0.30.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.7.tgz", + "integrity": "sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA==", "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, @@ -1974,9 +1979,9 @@ } }, "node_modules/mlly": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.5.0.tgz", - "integrity": "sha512-NPVQvAY1xr1QoVeG0cy8yUYC7FQcOx6evl/RjT1wL5FvzPnzOysoqB/jmx/DhssT2dYa8nxECLAaFI/+gVLhDQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.6.1.tgz", + "integrity": "sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA==", "dependencies": { "acorn": "^8.11.3", "pathe": "^1.1.2", @@ -2040,9 +2045,9 @@ "peer": true }, "node_modules/npm-run-path": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", - "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", "dependencies": { "path-key": "^4.0.0" }, @@ -2157,9 +2162,9 @@ } }, "node_modules/postcss": { - "version": "8.4.33", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", - "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", + "version": "8.4.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", + "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", "funding": [ { "type": "opencollective", @@ -2184,9 +2189,9 @@ } }, "node_modules/prettier": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", - "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -2286,9 +2291,9 @@ } }, "node_modules/rollup": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.6.tgz", - "integrity": "sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.12.0.tgz", + "integrity": "sha512-wz66wn4t1OHIJw3+XU7mJJQV/2NAfw5OAk6G6Hoo3zcvz/XOfQ52Vgi+AN4Uxoxi0KBBwk2g8zPrTDA4btSB/Q==", "dependencies": { "@types/estree": "1.0.5" }, @@ -2300,19 +2305,19 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.9.6", - "@rollup/rollup-android-arm64": "4.9.6", - "@rollup/rollup-darwin-arm64": "4.9.6", - "@rollup/rollup-darwin-x64": "4.9.6", - "@rollup/rollup-linux-arm-gnueabihf": "4.9.6", - "@rollup/rollup-linux-arm64-gnu": "4.9.6", - "@rollup/rollup-linux-arm64-musl": "4.9.6", - "@rollup/rollup-linux-riscv64-gnu": "4.9.6", - "@rollup/rollup-linux-x64-gnu": "4.9.6", - "@rollup/rollup-linux-x64-musl": "4.9.6", - "@rollup/rollup-win32-arm64-msvc": "4.9.6", - "@rollup/rollup-win32-ia32-msvc": "4.9.6", - "@rollup/rollup-win32-x64-msvc": "4.9.6", + "@rollup/rollup-android-arm-eabi": "4.12.0", + "@rollup/rollup-android-arm64": "4.12.0", + "@rollup/rollup-darwin-arm64": "4.12.0", + "@rollup/rollup-darwin-x64": "4.12.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.12.0", + "@rollup/rollup-linux-arm64-gnu": "4.12.0", + "@rollup/rollup-linux-arm64-musl": "4.12.0", + "@rollup/rollup-linux-riscv64-gnu": "4.12.0", + "@rollup/rollup-linux-x64-gnu": "4.12.0", + "@rollup/rollup-linux-x64-musl": "4.12.0", + "@rollup/rollup-win32-arm64-msvc": "4.12.0", + "@rollup/rollup-win32-ia32-msvc": "4.12.0", + "@rollup/rollup-win32-x64-msvc": "4.12.0", "fsevents": "~2.3.2" } }, @@ -2357,9 +2362,9 @@ } }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -2589,11 +2594,11 @@ } }, "node_modules/strip-literal": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", - "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.0.0.tgz", + "integrity": "sha512-f9vHgsCWBq2ugHAkGMiiYY+AYG0D/cbloKKg0nhaaaSNsujdGIpVXCNsrJpCKr5M0f4aI31mr13UjY6GAuXCKA==", "dependencies": { - "acorn": "^8.10.0" + "js-tokens": "^8.0.2" }, "funding": { "url": "https://github.com/sponsors/antfu" @@ -2621,9 +2626,9 @@ } }, "node_modules/terser": { - "version": "5.27.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.0.tgz", - "integrity": "sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==", + "version": "5.28.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.28.1.tgz", + "integrity": "sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA==", "devOptional": true, "peer": true, "dependencies": { @@ -2688,9 +2693,9 @@ } }, "node_modules/tinyspy": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.0.tgz", - "integrity": "sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", "engines": { "node": ">=14.0.0" } @@ -2754,9 +2759,9 @@ } }, "node_modules/ufo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz", - "integrity": "sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.4.0.tgz", + "integrity": "sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==" }, "node_modules/undici-types": { "version": "5.26.5", @@ -2805,12 +2810,12 @@ } }, "node_modules/vite": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz", - "integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.4.tgz", + "integrity": "sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==", "dependencies": { "esbuild": "^0.19.3", - "postcss": "^8.4.32", + "postcss": "^8.4.35", "rollup": "^4.2.0" }, "bin": { @@ -2859,9 +2864,9 @@ } }, "node_modules/vite-node": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.2.2.tgz", - "integrity": "sha512-1as4rDTgVWJO3n1uHmUYqq7nsFgINQ9u+mRcXpjeOMJUmviqNKjcZB7UfRZrlM7MjYXMKpuWp5oGkjaFLnjawg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.3.1.tgz", + "integrity": "sha512-azbRrqRxlWTJEVbzInZCTchx0X69M/XPTCz4H+TLvlTcR/xH/3hkRqhOakT41fMJCMzXTu4UvegkZiEoJAWvng==", "dependencies": { "cac": "^6.7.14", "debug": "^4.3.4", @@ -2880,17 +2885,16 @@ } }, "node_modules/vitest": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.2.2.tgz", - "integrity": "sha512-d5Ouvrnms3GD9USIK36KG8OZ5bEvKEkITFtnGv56HFaSlbItJuYr7hv2Lkn903+AvRAgSixiamozUVfORUekjw==", - "dependencies": { - "@vitest/expect": "1.2.2", - "@vitest/runner": "1.2.2", - "@vitest/snapshot": "1.2.2", - "@vitest/spy": "1.2.2", - "@vitest/utils": "1.2.2", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.3.1.tgz", + "integrity": "sha512-/1QJqXs8YbCrfv/GPQ05wAZf2eakUPLPa18vkJAKE7RXOKfVHqMZZ1WlTjiwl6Gcn65M5vpNUB6EFLnEdRdEXQ==", + "dependencies": { + "@vitest/expect": "1.3.1", + "@vitest/runner": "1.3.1", + "@vitest/snapshot": "1.3.1", + "@vitest/spy": "1.3.1", + "@vitest/utils": "1.3.1", "acorn-walk": "^8.3.2", - "cac": "^6.7.14", "chai": "^4.3.10", "debug": "^4.3.4", "execa": "^8.0.1", @@ -2899,11 +2903,11 @@ "pathe": "^1.1.1", "picocolors": "^1.0.0", "std-env": "^3.5.0", - "strip-literal": "^1.3.0", + "strip-literal": "^2.0.0", "tinybench": "^2.5.1", "tinypool": "^0.8.2", "vite": "^5.0.0", - "vite-node": "1.2.2", + "vite-node": "1.3.1", "why-is-node-running": "^2.2.2" }, "bin": { @@ -2918,8 +2922,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "^1.0.0", - "@vitest/ui": "^1.0.0", + "@vitest/browser": "1.3.1", + "@vitest/ui": "1.3.1", "happy-dom": "*", "jsdom": "*" }, @@ -2964,9 +2968,9 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/webpack": { - "version": "5.90.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.1.tgz", - "integrity": "sha512-SstPdlAC5IvgFnhiRok8hqJo/+ArAbNv7rhU4fnWGHNVfN59HSQFaxZDSAL3IFG2YmqxuRs+IU33milSxbPlog==", + "version": "5.90.3", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.3.tgz", + "integrity": "sha512-h6uDYlWCctQRuXBs1oYpVe6sFcWedl0dpcVaTf/YF67J9bKvwJajFulMVSYKHrksMB3I/pIagRzDxwxkebuzKA==", "dev": true, "peer": true, "dependencies": { diff --git a/components/clarinet-sdk/package.json b/components/clarinet-sdk/package.json index dcdd45bf1..6b584a2c9 100644 --- a/components/clarinet-sdk/package.json +++ b/components/clarinet-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@hirosystems/clarinet-sdk", - "version": "1.3.0", + "version": "2.3.0-rc3", "description": "A SDK to interact with Clarity Smart Contracts", "homepage": "https://docs.hiro.so/clarinet/feature-guides/clarinet-js-sdk", "repository": { @@ -58,7 +58,7 @@ "license": "GPL-3.0", "readme": "./README.md", "dependencies": { - "@hirosystems/clarinet-sdk-wasm": "^2.2.0", + "@hirosystems/clarinet-sdk-wasm": "^2.3.0-rc3", "@stacks/transactions": "^6.12.0", "kolorist": "^1.8.0", "prompts": "^2.4.2", diff --git a/components/clarinet-sdk/src/index.ts b/components/clarinet-sdk/src/index.ts index 82741a665..15e90774d 100644 --- a/components/clarinet-sdk/src/index.ts +++ b/components/clarinet-sdk/src/index.ts @@ -254,8 +254,8 @@ const getSessionProxy = () => ({ function memoizedInit() { let simnet: Simnet | null = null; - return async (manifestPath = "./Clarinet.toml") => { - if (!simnet) { + return async (manifestPath = "./Clarinet.toml", noCache = false) => { + if (noCache || !simnet) { const module = await wasmModule; simnet = new Proxy(new module.SDK(vfs), getSessionProxy()) as unknown as Simnet; } diff --git a/components/clarinet-sdk/tests/deployment-plan.test.ts b/components/clarinet-sdk/tests/deployment-plan.test.ts new file mode 100644 index 000000000..5591eb3bf --- /dev/null +++ b/components/clarinet-sdk/tests/deployment-plan.test.ts @@ -0,0 +1,72 @@ +import fs from "node:fs"; +import path from "node:path"; +import { describe, expect, it, beforeEach, afterEach, assert } from "vitest"; + +// test the built package and not the source code +// makes it simpler to handle wasm build +import { initSimnet } from "../dist/esm"; +import { Cl } from "@stacks/transactions"; + +const deploymentPlanPath = path.join( + process.cwd(), + "tests/fixtures/deployments/default.simnet-plan.yaml", +); + +const customDeploymentPlanPath = path.join( + process.cwd(), + "tests/fixtures/deployments/custom.simnet-plan.yaml", +); + +function deleteExistingDeploymentPlan() { + if (fs.existsSync(deploymentPlanPath)) { + fs.unlinkSync(deploymentPlanPath); + } +} + +afterEach(() => { + deleteExistingDeploymentPlan(); +}); + +describe("deployment plans test", async () => { + it("simnet deployment plan is created if it does not exist", async () => { + deleteExistingDeploymentPlan(); + + expect(fs.existsSync(deploymentPlanPath)).toBe(false); + + // load a new simnet with no cache + const simnet = await initSimnet("tests/fixtures/Clarinet.toml", true); + + expect(fs.existsSync(deploymentPlanPath)).toBe(true); + + // make sure the simnet is running + expect(simnet.blockHeight).toBe(1); + }); + + it("can use custom deployment plan", async () => { + fs.copyFileSync(customDeploymentPlanPath, deploymentPlanPath); + expect(fs.existsSync(deploymentPlanPath)).toBe(true); + const simnet = await initSimnet("tests/fixtures/Clarinet.toml", true); + + // test that all 3 contracts are deployed + const contracts = simnet.getContractsInterfaces(); + expect(contracts.size).toBe(3); + + // the additional custom tx should have been applied + const count = simnet.getDataVar("counter", "count"); + expect(count).toStrictEqual(Cl.uint(2)); + }); + + it("re-applies contract call tx when the deployment plan is updated", async () => { + fs.copyFileSync(customDeploymentPlanPath, deploymentPlanPath); + expect(fs.existsSync(deploymentPlanPath)).toBe(true); + const simnet = await initSimnet("tests/fixtures/LightManifest.toml", true); + + // only two contract should be deployed with the light manifest + const contracts = simnet.getContractsInterfaces(); + expect(contracts.size).toBe(2); + + // the additional custom tx should have been applied + const count = simnet.getDataVar("counter", "count"); + expect(count).toStrictEqual(Cl.uint(2)); + }); +}); diff --git a/components/clarinet-sdk/tests/fixtures/.gitignore b/components/clarinet-sdk/tests/fixtures/.gitignore index 20352ca30..5a6cb330e 100644 --- a/components/clarinet-sdk/tests/fixtures/.gitignore +++ b/components/clarinet-sdk/tests/fixtures/.gitignore @@ -2,3 +2,4 @@ **/settings/Testnet.toml .cache/** history.txt +**/deployments/default.simnet-plan.yaml diff --git a/components/clarinet-sdk/tests/fixtures/LightManifest.toml b/components/clarinet-sdk/tests/fixtures/LightManifest.toml new file mode 100644 index 000000000..e23987c18 --- /dev/null +++ b/components/clarinet-sdk/tests/fixtures/LightManifest.toml @@ -0,0 +1,19 @@ +# this manifest is a copy of Clarinet.toml without the multiplier-contract +# it's use to simulate a manifest update when testing deployment plan handling + +[project] +name = 'fixtures' +description = 'sample project to test clarinet-sdk' +telemetry = false +cache_dir = './.cache' +requirements = [] + +[contracts.multiplier-trait] +path = 'contracts/multiplier-trait.clar' +clarity_version = 2 +epoch = 2.4 + +[contracts.counter] +path = 'contracts/counter.clar' +clarity_version = 2 +epoch = 2.4 diff --git a/components/clarinet-sdk/tests/fixtures/deployments/custom.simnet-plan.yaml b/components/clarinet-sdk/tests/fixtures/deployments/custom.simnet-plan.yaml new file mode 100644 index 000000000..db68c0492 --- /dev/null +++ b/components/clarinet-sdk/tests/fixtures/deployments/custom.simnet-plan.yaml @@ -0,0 +1,58 @@ +--- +id: 0 +name: "Simulated deployment, used as a default for `clarinet console`, `clarinet test` and `clarinet check`" +network: simnet +genesis: + wallets: + - name: deployer + address: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM + balance: "100000000000000" + - name: faucet + address: STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6 + balance: "100000000000000" + - name: wallet_1 + address: ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 + balance: "100000000000000" + - name: wallet_2 + address: ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG + balance: "100000000000000" + contracts: + - costs + - pox + - pox-2 + - pox-3 + - pox-4 + - lockup + - costs-2 + - costs-3 + - cost-voting + - bns +plan: + batches: + - id: 0 + transactions: + - emulated-contract-publish: + contract-name: multiplier-trait + emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM + path: /Users/hugo/Sites/hiro/clarinet/components/clarinet-sdk/tests/fixtures/contracts/multiplier-trait.clar + clarity-version: 2 + - emulated-contract-publish: + contract-name: counter + emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM + path: /Users/hugo/Sites/hiro/clarinet/components/clarinet-sdk/tests/fixtures/contracts/counter.clar + clarity-version: 2 + - emulated-contract-publish: + contract-name: multiplier-contract + emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM + path: /Users/hugo/Sites/hiro/clarinet/components/clarinet-sdk/tests/fixtures/contracts/multiplier-contract.clar + clarity-version: 2 + epoch: "2.4" + - id: 1 + transactions: + - emulated-contract-call: + contract-id: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.counter + emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM + method: add + parameters: + - u2 + epoch: "3.0" diff --git a/components/clarinet-sdk/tests/index.test.ts b/components/clarinet-sdk/tests/simnet-usage.test.ts similarity index 80% rename from components/clarinet-sdk/tests/index.test.ts rename to components/clarinet-sdk/tests/simnet-usage.test.ts index a8ee24ec1..a8fd8b9c5 100644 --- a/components/clarinet-sdk/tests/index.test.ts +++ b/components/clarinet-sdk/tests/simnet-usage.test.ts @@ -1,10 +1,11 @@ +import fs from "node:fs"; +import path from "node:path"; import { Cl } from "@stacks/transactions"; -import { describe, expect, it, beforeEach, beforeAll } from "vitest"; +import { describe, expect, it, beforeEach, afterEach, assert } from "vitest"; // test the built package and not the source code // makes it simpler to handle wasm build -import { Simnet, initSimnet, tx } from "../"; -import path from "node:path"; +import { Simnet, initSimnet, tx } from "../dist/esm"; const deployerAddr = "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM"; const address1 = "ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5"; @@ -12,23 +13,40 @@ const address2 = "ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG"; let simnet: Simnet; +const deploymentPlanPath = path.join( + process.cwd(), + "tests/fixtures/deployments/default.simnet-plan.yaml", +); + +function deleteExistingDeploymentPlan() { + if (fs.existsSync(deploymentPlanPath)) { + fs.unlinkSync(deploymentPlanPath); + } +} + beforeEach(async () => { + deleteExistingDeploymentPlan(); simnet = await initSimnet("tests/fixtures/Clarinet.toml"); }); -describe("basic simnet interactions", async () => { - it("initialize simnet", async () => { +afterEach(() => { + deleteExistingDeploymentPlan(); +}); + +describe("basic simnet interactions", () => { + it("initialize simnet", () => { expect(simnet.blockHeight).toBe(1); }); - it("can mine empty blocks", async () => { + it("can mine empty blocks", () => { + const blockHeight = simnet.blockHeight; simnet.mineEmptyBlock(); - expect(simnet.blockHeight).toBe(2); + expect(simnet.blockHeight).toBe(blockHeight + 1); simnet.mineEmptyBlocks(4); - expect(simnet.blockHeight).toBe(6); + expect(simnet.blockHeight).toBe(blockHeight + 5); }); - it("exposes devnet stacks accounts", async () => { + it("exposes devnet stacks accounts", () => { const accounts = simnet.getAccounts(); expect(accounts).toHaveLength(4); @@ -36,13 +54,13 @@ describe("basic simnet interactions", async () => { expect(accounts.get("wallet_1")).toBe(address1); }); - it("expose assets maps", async () => { + it("expose assets maps", () => { const assets = simnet.getAssetsMap(); expect(assets.get("STX")).toHaveLength(4); expect(assets.get("STX")?.get(address1)).toBe(100000000000000n); }); - it("can get and set epoch", async () => { + it("can get and set epoch", () => { // should be 2.4 by default expect(simnet.currentEpoch).toBe("2.4"); @@ -57,7 +75,7 @@ describe("basic simnet interactions", async () => { }); }); -describe("simnet can run arbitrary snippets", async () => { +describe("simnet can run arbitrary snippets", () => { it("can run simple snippets", () => { const res = simnet.runSnippet("(+ 1 2)"); expect(res).toStrictEqual(Cl.int(3)); @@ -70,8 +88,8 @@ describe("simnet can run arbitrary snippets", async () => { }); }); -describe("simnet can call contracts function", async () => { - it("can call read only functions", async () => { +describe("simnet can call contracts function", () => { + it("can call read only functions", () => { const res = simnet.callReadOnlyFn("counter", "get-count", [], address1); expect(res).toHaveProperty("result"); @@ -79,7 +97,7 @@ describe("simnet can call contracts function", async () => { expect(res.result).toStrictEqual(Cl.ok(Cl.tuple({ count: Cl.uint(0) }))); }); - it("does not increase block height when calling read-only functions", async () => { + it("does not increase block height when calling read-only functions", () => { const initalBH = simnet.blockHeight; simnet.callReadOnlyFn("counter", "get-count", [], address1); @@ -87,7 +105,7 @@ describe("simnet can call contracts function", async () => { expect(simnet.blockHeight).toBe(initalBH); }); - it("can call public functions", async () => { + it("can call public functions", () => { const res = simnet.callPublicFn("counter", "increment", [], address1); expect(res).toHaveProperty("result"); @@ -100,7 +118,7 @@ describe("simnet can call contracts function", async () => { expect(printEvent.data.value).toStrictEqual(Cl.stringAscii("call increment")); }); - it("can call public functions with arguments", async () => { + it("can call public functions with arguments", () => { const res = simnet.callPublicFn("counter", "add", [Cl.uint(2)], address1); expect(res).toHaveProperty("result"); @@ -108,7 +126,7 @@ describe("simnet can call contracts function", async () => { expect(res.result).toStrictEqual(Cl.ok(Cl.bool(true))); }); - it("increases block height when calling public functions", async () => { + it("increases block height when calling public functions", () => { const initalBH = simnet.blockHeight; simnet.callPublicFn("counter", "increment", [], address1); @@ -116,7 +134,7 @@ describe("simnet can call contracts function", async () => { expect(simnet.blockHeight).toBe(initalBH + 2); }); - it("can call public functions in the same block", async () => { + it("can call public functions in the same block", () => { const initalBH = simnet.blockHeight; const res = simnet.mineBlock([ @@ -136,7 +154,7 @@ describe("simnet can call contracts function", async () => { expect(simnet.blockHeight).toStrictEqual(initalBH + 1); }); - it("can get updated assets map", async () => { + it("can get updated assets map", () => { simnet.callPublicFn("counter", "increment", [], address1); simnet.callPublicFn("counter", "increment", [], address1); @@ -147,30 +165,30 @@ describe("simnet can call contracts function", async () => { expect(STX.get(`${deployerAddr}.counter`)).toStrictEqual(2000000n); }); - it("can pass principals as arguments", async () => { + it("can pass principals as arguments", () => { const to = Cl.standardPrincipal(address2); const { result } = simnet.callPublicFn("counter", "transfer-100", [to], address1); expect(result).toStrictEqual(Cl.ok(Cl.bool(true))); }); - it("can pass traits as arguments", async () => { + it("can pass traits as arguments", () => { const trait = Cl.contractPrincipal(simnet.deployer, "multiplier-contract"); const { result } = simnet.callPublicFn("counter", "call-multiply", [trait], address1); expect(result).toStrictEqual(Cl.ok(Cl.uint(4))); }); }); -describe("simnet can read contracts data vars and maps", async () => { - it("can get data-vars", async () => { +describe("simnet can read contracts data vars and maps", () => { + it("can get data-vars", () => { const counter = simnet.getDataVar("counter", "count"); expect(counter).toStrictEqual(Cl.uint(0)); }); - it("can get block time", async () => { + it("can get block time", () => { const bt = simnet.getBlockTime(); expect(bt).toBeDefined(); }); - it("can get map entry", async () => { + it("can get map entry", () => { // add a participant in the map simnet.callPublicFn("counter", "increment", [], address1); @@ -179,8 +197,8 @@ describe("simnet can read contracts data vars and maps", async () => { }); }); -describe("simnet can get contracts info and deploy contracts", async () => { - it("can get contract interfaces", async () => { +describe("simnet can get contracts info and deploy contracts", () => { + it("can get contract interfaces", () => { const contractInterfaces = simnet.getContractsInterfaces(); expect(contractInterfaces).toHaveLength(3); @@ -191,7 +209,7 @@ describe("simnet can get contracts info and deploy contracts", async () => { expect(counterInterface?.maps).toHaveLength(1); }); - it("can get contract source", async () => { + it("can get contract source", () => { const counterSource = simnet.getContractSource(`${deployerAddr}.counter`); expect(counterSource?.startsWith("(define-data-var count")).toBe(true); @@ -202,7 +220,7 @@ describe("simnet can get contracts info and deploy contracts", async () => { expect(noSource).toBeUndefined(); }); - it("can get contract ast", async () => { + it("can get contract ast", () => { const counterAst = simnet.getContractAST(`${deployerAddr}.counter`); expect(counterAst).toBeDefined(); expect(counterAst.expressions).toHaveLength(10); @@ -211,7 +229,7 @@ describe("simnet can get contracts info and deploy contracts", async () => { expect(getWithShortAddr).toBeDefined(); }); - it("can deploy contracts as snippets", async () => { + it("can deploy contracts as snippets", () => { const res = simnet.deployContract("temp", "(+ 24 18)", null, deployerAddr); expect(res.result).toStrictEqual(Cl.int(42)); @@ -219,7 +237,7 @@ describe("simnet can get contracts info and deploy contracts", async () => { expect(contractInterfaces).toHaveLength(3); }); - it("can deploy contracts", async () => { + it("can deploy contracts", () => { const source = "(define-public (add (a uint) (b uint)) (ok (+ a b)))\n"; const deployRes = simnet.deployContract("op", source, null, deployerAddr); expect(deployRes.result).toStrictEqual(Cl.bool(true)); @@ -238,7 +256,7 @@ describe("simnet can get contracts info and deploy contracts", async () => { expect(opASt.expressions).toHaveLength(1); }); - it("can deploy contract with a given clarity_version", async () => { + it("can deploy contract with a given clarity_version", () => { const source = "(define-public (add (a uint) (b uint)) (ok (+ a b)))\n"; simnet.deployContract("contract1", source, { clarityVersion: 1 }, deployerAddr); @@ -260,7 +278,7 @@ describe("simnet can get contracts info and deploy contracts", async () => { }); describe("simnet can transfer stx", () => { - it("can transfer stx", async () => { + it("can transfer stx", () => { simnet.transferSTX(1000, address2, address1); const stxBalances = simnet.getAssetsMap().get("STX"); const stxAddress1 = stxBalances?.get(address1); @@ -270,8 +288,8 @@ describe("simnet can transfer stx", () => { }); }); -describe("simnet can get session reports", async () => { - it("can get line coverage", async () => { +describe("simnet can get session reports", () => { + it("can get line coverage", () => { simnet.callPublicFn("counter", "increment", [], address1); simnet.callPublicFn("counter", "increment", [], address1); @@ -280,7 +298,7 @@ describe("simnet can get session reports", async () => { expect(reports.coverage.endsWith("end_of_record\n")).toBe(true); }); - it("can get costs", async () => { + it("can get costs", () => { simnet.callPublicFn("counter", "increment", [], address1); const reports = simnet.collectReport(); @@ -298,8 +316,8 @@ describe("simnet can get session reports", async () => { describe("the sdk handles multiple manifests project", () => { it("handle invalid project", () => { - const filePath = path.join(process.cwd(), "tests/fixtures/contracts/invalid.clar"); - const expectedErr = `error: unexpected ')'\n--> ${filePath}:5:2\n)) ;; extra \`)\`\n`; + const manifestPath = path.join(process.cwd(), "tests/fixtures/contracts/invalid.clar"); + const expectedErr = `error: unexpected ')'\n--> ${manifestPath}:5:2\n)) ;; extra \`)\`\n`; expect(async () => { await initSimnet("tests/fixtures/InvalidManifest.toml"); diff --git a/components/clarinet-sdk/vitest.config.mjs b/components/clarinet-sdk/vitest.config.mjs index a709b88c9..78cb6766c 100644 --- a/components/clarinet-sdk/vitest.config.mjs +++ b/components/clarinet-sdk/vitest.config.mjs @@ -3,7 +3,13 @@ import { defineConfig } from "vite"; export default defineConfig({ test: { - singleThread: true, + // https://vitest.dev/guide/common-errors.html#failed-to-terminate-worker + pool: "forks", + poolOptions: { + threads: { + singleThread: true, + }, + }, include: ["./tests/**/*.test.ts", "./vitest-helpers/tests/**/*.test.ts"], }, }); diff --git a/components/clarity-lsp/Cargo.toml b/components/clarity-lsp/Cargo.toml index 067c45faf..b63e9c194 100644 --- a/components/clarity-lsp/Cargo.toml +++ b/components/clarity-lsp/Cargo.toml @@ -16,9 +16,9 @@ clarinet-deployments = { path = "../clarinet-deployments", default-features = fa # WASM console_error_panic_hook = { version = "0.1", optional = true } js-sys = { version = "0.3", optional = true } -serde-wasm-bindgen = { version = "0.6.0", optional = true } -wasm-bindgen = { version = "0.2", optional = true } -wasm-bindgen-futures = { version = "0.4", optional = true } +serde-wasm-bindgen = { version = "0.6.4", optional = true } +wasm-bindgen = { version = "0.2.91", optional = true } +wasm-bindgen-futures = { version = "0.4.41", optional = true } web-sys = { version = "0.3", features = ["console"], optional = true } [features] diff --git a/components/clarity-repl/Cargo.toml b/components/clarity-repl/Cargo.toml index 197ac1646..e6a62e4a2 100644 --- a/components/clarity-repl/Cargo.toml +++ b/components/clarity-repl/Cargo.toml @@ -33,9 +33,9 @@ integer-sqrt = "0.1.3" getrandom = { version = "0.2.3", features = ["js"] } atty = "0.2.14" # clarity-vm = "2" -clarity = { version = "2", default-features = false, optional = true, git = "https://github.com/stacks-network/stacks-core.git", rev ="345553357be556fe53474071d09cd453549ed02e", package = "clarity" } +clarity = { version = "2", default-features = false, optional = true, git = "https://github.com/stacks-network/stacks-core.git", rev ="1e9df56b255247928679961d0a7c2541ad127f59", package = "clarity" } # clarity = { version = "2", default-features = false, optional = true, path ="../../../clarity-wasm/stacks-core/clarity" } -clar2wasm = { git = "https://github.com/stacks-network/clarity-wasm.git", rev = "e7f63c2", optional = true } +clar2wasm = { git = "https://github.com/stacks-network/clarity-wasm.git", rev = "b12002d", optional = true } # clar2wasm = { path="../../../clarity-wasm/clar2wasm", optional = true } # DAP Debugger @@ -60,8 +60,8 @@ reqwest = { version = "0.11", default-features = false, features = [ wsts = { version = "7.0.0", default-features = false, optional = true } # WASM -wasm-bindgen = { version = "0.2", optional = true } -wasm-bindgen-futures = { version = "0.4", optional = true } +wasm-bindgen = { version = "0.2.91", optional = true } +wasm-bindgen-futures = { version = "0.4.41", optional = true } [lib] name = "clarity_repl" diff --git a/components/clarity-repl/src/repl/session.rs b/components/clarity-repl/src/repl/session.rs index 8e2a0338a..96418c205 100644 --- a/components/clarity-repl/src/repl/session.rs +++ b/components/clarity-repl/src/repl/session.rs @@ -4,7 +4,6 @@ use super::{ClarityCodeSource, ClarityContract, ClarityInterpreter, ContractDepl use crate::analysis::coverage::TestCoverageReport; use crate::repl::Settings; use crate::utils; -use ansi_term::Colour; use clarity::codec::StacksMessageCodec; use clarity::types::chainstate::StacksAddress; use clarity::types::StacksEpochId; @@ -22,6 +21,8 @@ use std::collections::{BTreeMap, HashMap}; use std::fmt; use std::num::ParseIntError; +#[cfg(feature = "cli")] +use ansi_term::Colour; #[cfg(feature = "cli")] use clarity::vm::analysis::ContractAnalysis; #[cfg(feature = "cli")] @@ -676,6 +677,7 @@ impl Session { keys } + #[cfg(feature = "cli")] fn display_help(&self, output: &mut Vec) { let help_colour = Colour::Yellow; output.push(format!( @@ -766,16 +768,14 @@ impl Session { )); } - #[cfg(not(feature = "wasm"))] + #[cfg(feature = "cli")] fn easter_egg(&self, _output: &mut [String]) { let result = hiro_system_kit::nestable_block_on(fetch_message()); let message = result.unwrap_or("You found it!".to_string()); println!("{}", message); } - #[cfg(feature = "wasm")] - fn easter_egg(&self, _output: &mut [String]) {} - + #[cfg(feature = "cli")] fn parse_and_advance_chain_tip(&mut self, output: &mut Vec, command: &str) { let args: Vec<_> = command.split(' ').collect(); @@ -803,6 +803,7 @@ impl Session { self.interpreter.advance_chain_tip(count) } + #[cfg(feature = "cli")] fn parse_and_set_tx_sender(&mut self, output: &mut Vec, command: &str) { let args: Vec<_> = command.split(' ').collect(); @@ -833,6 +834,7 @@ impl Session { self.interpreter.get_tx_sender().to_address() } + #[cfg(feature = "cli")] fn get_block_height(&mut self, output: &mut Vec) { let height = self.interpreter.get_block_height(); output.push(green!(format!("Current height: {}", height))); @@ -1072,6 +1074,7 @@ impl Session { } } + #[cfg(feature = "cli")] fn mint_stx(&mut self, output: &mut Vec, command: &str) { let args: Vec<_> = command.split(' ').collect(); @@ -1102,6 +1105,7 @@ impl Session { }; } + #[cfg(feature = "cli")] fn display_functions(&self, output: &mut Vec) { let help_colour = Colour::Yellow; let api_reference_index = self.get_api_reference_index(); @@ -1111,6 +1115,7 @@ impl Session { )); } + #[cfg(feature = "cli")] fn display_doc(&self, output: &mut Vec, command: &str) { let help_colour = Colour::Yellow; let keyword = { @@ -1137,6 +1142,7 @@ impl Session { Ok(output.join("\n")) } + #[cfg(feature = "cli")] fn keywords(&self, output: &mut Vec) { let help_colour = Colour::Yellow; let keywords = self.get_clarity_keywords(); diff --git a/components/clarity-vscode/client/src/customVFS.ts b/components/clarity-vscode/client/src/customVFS.ts index 597a873ca..0fbc7712d 100644 --- a/components/clarity-vscode/client/src/customVFS.ts +++ b/components/clarity-vscode/client/src/customVFS.ts @@ -2,7 +2,6 @@ import * as vscode from "vscode"; import { Uri } from "vscode"; import { LanguageClient } from "./types"; -import { fileArrayToString } from "./utils/files"; const { fs } = vscode.workspace; @@ -34,7 +33,7 @@ export function initVFS(client: LanguageClient) { client.onRequest("vfs/readFile", async (event: unknown) => { if (!isValidReadEvent(event)) throw new Error("invalid read event"); - return fileArrayToString(await fs.readFile(Uri.parse(event.path))); + return await fs.readFile(Uri.parse(event.path)); }); client.onRequest("vfs/readFiles", async (event: any) => { @@ -42,20 +41,15 @@ export function initVFS(client: LanguageClient) { const files = await Promise.all( event.paths.map(async (p) => { try { - const contract = await fs.readFile(Uri.parse(p)); + const contract = [p, await fs.readFile(Uri.parse(p))]; return contract; } catch (err) { console.warn(err); - return null; + return [p, null]; } }), ); - return Object.fromEntries( - files.reduce((acc, f, i) => { - if (f === null) return acc; - return acc.concat([[event.paths[i], fileArrayToString(f)]]); - }, [] as [string, string][]), - ); + return Object.fromEntries(files.filter(([, content]) => content !== null)); }); client.onRequest("vfs/writeFile", async (event: unknown) => { diff --git a/components/stacks-network/Cargo.toml b/components/stacks-network/Cargo.toml index bf6fa5cc9..a97942054 100644 --- a/components/stacks-network/Cargo.toml +++ b/components/stacks-network/Cargo.toml @@ -32,7 +32,7 @@ futures = "0.3.12" base58 = "0.2.0" tokio = { version = "1.35.1", features = ["full"] } -chainhook-sdk = { default-features = true, git = "https://github.com/hirosystems/chainhook.git", rev = "570ceb7" } +chainhook-sdk = { default-features = true, git = "https://github.com/hirosystems/chainhook.git", rev = "ac59025" } # chainhook-sdk = { version = "=0.11", default-features = true } stacks-rpc-client = { path = "../stacks-rpc-client" } clarinet-files = { path = "../clarinet-files", features = ["cli"] }