diff --git a/Cargo.lock b/Cargo.lock index cbc3c655d..0798c7bb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -815,7 +815,7 @@ checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "clar2wasm" version = "0.1.0" -source = "git+https://github.com/stacks-network/clarity-wasm.git?branch=main#8ce55662ed0c8ebd467b19bad8e7047f21154986" +source = "git+https://github.com/stacks-network/clarity-wasm.git?branch=main#40e9008226ec0cfd510fe98a55dc5d298338f2ea" dependencies = [ "chrono", "clap", @@ -942,7 +942,7 @@ dependencies = [ [[package]] name = "clarity" version = "2.3.0" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#716041844d450d28526156d3d0462f5e8eea08e8" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#cbcc7bbac26fb945d44901fe5139cc7e379609c7" dependencies = [ "getrandom 0.2.8", "hashbrown 0.14.3", @@ -2864,7 +2864,7 @@ dependencies = [ [[package]] name = "libstackerdb" version = "0.0.1" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#716041844d450d28526156d3d0462f5e8eea08e8" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#cbcc7bbac26fb945d44901fe5139cc7e379609c7" dependencies = [ "clarity", "secp256k1 0.24.3", @@ -3582,7 +3582,7 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "pox-locking" version = "2.4.0" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#716041844d450d28526156d3d0462f5e8eea08e8" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#cbcc7bbac26fb945d44901fe5139cc7e379609c7" dependencies = [ "clarity", "slog", @@ -4853,7 +4853,7 @@ dependencies = [ [[package]] name = "stacks-common" version = "0.0.2" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#716041844d450d28526156d3d0462f5e8eea08e8" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#cbcc7bbac26fb945d44901fe5139cc7e379609c7" dependencies = [ "chrono", "curve25519-dalek 2.0.0", @@ -4953,7 +4953,7 @@ dependencies = [ [[package]] name = "stackslib" version = "0.0.1" -source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#716041844d450d28526156d3d0462f5e8eea08e8" +source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clarity-wasm-develop#cbcc7bbac26fb945d44901fe5139cc7e379609c7" dependencies = [ "chrono", "clar2wasm", diff --git a/components/clarinet-sdk/node/tests/fixtures/contracts/counter.clar b/components/clarinet-sdk/node/tests/fixtures/contracts/counter.clar index 5daee7327..c6679f4a1 100644 --- a/components/clarinet-sdk/node/tests/fixtures/contracts/counter.clar +++ b/components/clarinet-sdk/node/tests/fixtures/contracts/counter.clar @@ -1,3 +1,4 @@ +;; counter contract (define-data-var count uint u0) (define-map participants principal bool) diff --git a/components/clarinet-sdk/node/tests/simnet-usage.test.ts b/components/clarinet-sdk/node/tests/simnet-usage.test.ts index 736a5601a..cc966b26a 100644 --- a/components/clarinet-sdk/node/tests/simnet-usage.test.ts +++ b/components/clarinet-sdk/node/tests/simnet-usage.test.ts @@ -49,9 +49,9 @@ describe("basic simnet interactions", () => { }); it("can not mine empty stacks block in pre-3.0", () => { expect(() => simnet.mineEmptyStacksBlock()).toThrowError( - "use mineEmptyBurnBlock in epoch lower than 3.0" + "use mineEmptyBurnBlock in epoch lower than 3.0", ); - }) + }); it("exposes devnet stacks accounts", () => { const accounts = simnet.getAccounts(); @@ -101,8 +101,8 @@ describe("simnet epoch 3", () => { simnet.mineEmptyBurnBlocks(4); expect(simnet.burnBlockHeight).toBe(burnBlockHeight + 4); expect(simnet.stacksBlockHeight).toBe(blockHeight + 9); - }) -}) + }); +}); describe("simnet can run arbitrary snippets", () => { it("can run simple snippets", () => { const res = simnet.execute("(+ 1 2)"); @@ -292,7 +292,7 @@ describe("simnet can get contracts info and deploy contracts", () => { it("can get contract source", () => { const counterSource = simnet.getContractSource(`${deployerAddr}.counter`); - expect(counterSource?.startsWith("(define-data-var count")).toBe(true); + expect(counterSource?.startsWith(";; counter contract")).toBe(true); const counterSourceShortAddr = simnet.getContractSource("counter"); expect(counterSourceShortAddr).toBe(counterSource); @@ -311,6 +311,16 @@ describe("simnet can get contracts info and deploy contracts", () => { expect(getWithShortAddr).toBeDefined(); }); + it("can get commets in ast", () => { + const counterAst = simnet.getContractAST(`${deployerAddr}.counter`); + + expect(counterAst).toBeDefined(); + expect(counterAst.expressions).toHaveLength(11); + + // @ts-ignore + expect(counterAst.expressions[0].pre_comments[0][0]).toBe("counter contract"); + }); + it("can deploy contracts as snippets", () => { const res = simnet.deployContract("temp", "(+ 24 18)", null, deployerAddr); expect(res.result).toStrictEqual(Cl.int(42));