diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6a67f92..072dd91 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ concurrency: env: CARGO_TERM_COLOR: always - SIMPLEX_VERSION: 0.0.12 + SIMPLEX_VERSION: 0.2.0 jobs: lint: @@ -52,6 +52,11 @@ jobs: run: | simplex build + - name: Check contracts formatting + shell: bash + run: | + simplex fmt --check + - name: Check formatting run: | cargo fmt --all --check diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3045107..610a52e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ concurrency: env: CARGO_TERM_COLOR: always RUST_BACKTRACE: full - SIMPLEX_VERSION: 0.0.12 + SIMPLEX_VERSION: 0.2.0 jobs: simplex-tests: @@ -64,4 +64,4 @@ jobs: env: SIMPLEX_TEST_VERBOSE: ${{ runner.debug == '1' && '-v' || '' }} run: | - simplex test --test-threads 4 "${SIMPLEX_TEST_VERBOSE}" -- --release + simplex test --test-threads 2 "${SIMPLEX_TEST_VERBOSE}" -- --release diff --git a/CHANGELOG.md b/CHANGELOG.md index 287b248..f33290d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +- Bumped Simplex to 0.2.0. +- Aligned existing testing API with changes in Simplex. + ## [0.2.0] ### Breaking changes diff --git a/Cargo.lock b/Cargo.lock index f188c5c..e2e789a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -133,7 +133,7 @@ version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "365c0acd5b2e8dd0111a46c4faea83fb3cfb6e39a49a7c73a06e090db7b2eff0" dependencies = [ - "bitcoin_hashes", + "bitcoin_hashes 0.14.101", ] [[package]] @@ -156,17 +156,36 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "bip39" -version = "2.2.2" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" +checksum = "4559bb9225f8401dcea601cf8dc9ed81ea0dadd9cf7755fdefdd93ef7961e19e" dependencies = [ - "bitcoin_hashes", - "rand", - "rand_core", + "bitcoin_hashes 0.14.101", + "rand 0.8.8", + "rand_core 0.6.4", "serde", "unicode-normalization", ] +[[package]] +name = "bit-set" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5727b15fa97d4f4fee0a3b7c3d550ed0269f54329207b86388de918604e31269" +dependencies = [ + "borsh", + "serde", +] + [[package]] name = "bitcoin" version = "0.32.102" @@ -176,9 +195,10 @@ dependencies = [ "base58ck", "base64 0.21.7", "bech32", + "bitcoin-consensus-encoding", "bitcoin-io", "bitcoin-units", - "bitcoin_hashes", + "bitcoin_hashes 0.14.101", "hex-conservative 0.2.3", "hex_lit", "secp256k1", @@ -191,11 +211,17 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9daa31138eb443d5751b207f3f64154e2bb09cd59960562ccc7a7112be38147f" dependencies = [ - "bitcoin-internals", + "bitcoin-internals 0.7.0", "hex-conservative 1.3.0", "serde", ] +[[package]] +name = "bitcoin-internals" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d573f4cf32996a8dce612e4348cece65a241f1882ed594047c9ba348e8869fa5" + [[package]] name = "bitcoin-internals" version = "0.7.0" @@ -238,6 +264,18 @@ dependencies = [ "serde", ] +[[package]] +name = "bitcoin_hashes" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5304e53726dbe5f93141535e102ed97b5bf4714fbecefdda8f9fb98d7fdaff0e" +dependencies = [ + "bitcoin-consensus-encoding", + "bitcoin-internals 0.6.0", + "hex-conservative 1.3.0", + "serde", +] + [[package]] name = "bitcoincore-rpc" version = "0.19.0" @@ -301,11 +339,35 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.10.4" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "borsh" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" +dependencies = [ + "borsh-derive", + "bytes", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "12cdfe656708a01f89b451a7d36466e6fe6c414de0aa18fc54f864f6f9ca9f56" dependencies = [ - "generic-array", + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.9", ] [[package]] @@ -336,6 +398,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + [[package]] name = "cc" version = "1.9.0" @@ -354,6 +422,23 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures", + "rand_core 0.10.1", +] + [[package]] name = "chumsky" version = "0.11.2" @@ -404,12 +489,24 @@ dependencies = [ "cc", ] +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + [[package]] name = "colorchoice" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + [[package]] name = "const_format" version = "0.2.36" @@ -431,11 +528,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + [[package]] name = "cpufeatures" -version = "0.2.17" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" dependencies = [ "libc", ] @@ -473,23 +576,32 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-common" -version = "0.1.7" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ - "generic-array", - "typenum", + "hybrid-array", +] + +[[package]] +name = "ctutils" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574" +dependencies = [ + "cmov", ] [[package]] name = "digest" -version = "0.10.7" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ "block-buffer", + "const-oid", "crypto-common", - "subtle", + "ctutils", ] [[package]] @@ -540,12 +652,16 @@ dependencies = [ [[package]] name = "elements" -version = "0.25.3" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c63a04238f4b7f3564fe9705921452c2900efd00982545e5c634fac9024fe2" +checksum = "34e00f7ddcd826d2f4c9bd72d79a6b6991a0ac4286e7e2b2ff8eecd130549073" dependencies = [ "bech32", "bitcoin", + "bitcoin-consensus-encoding", + "bitcoin-internals 0.6.0", + "bitcoin_hashes 1.2.0", + "hex-conservative 1.3.0", "secp256k1-zkp", "serde", "serde_json", @@ -553,9 +669,9 @@ dependencies = [ [[package]] name = "elements-miniscript" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571fa105690f83c7833df2109eb2e14ca0e62d633d2624ffcb166ff18a3da870" +checksum = "0c18e931c81e6e7e58d63b6fea1c57f5534717f0e6721741c4fce72a6c547e19" dependencies = [ "bitcoin", "elements", @@ -598,11 +714,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand", + "rand 0.8.8", "rustc-hex", "static_assertions", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foldhash" version = "0.1.5" @@ -645,16 +767,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "getrandom" version = "0.2.17" @@ -677,6 +789,7 @@ dependencies = [ "cfg-if", "libc", "r-efi", + "rand_core 0.10.1", ] [[package]] @@ -685,12 +798,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8449d342b1c67f49169e92e71deb7b9b27f30062301a16dbc27a4cc8d2351b7" -[[package]] -name = "glob" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" - [[package]] name = "globset" version = "0.4.20" @@ -764,9 +871,9 @@ checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" [[package]] name = "hmac" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" dependencies = [ "digest", ] @@ -780,6 +887,15 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + [[package]] name = "ignore" version = "0.4.33" @@ -1093,12 +1209,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.37" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +checksum = "2bfe0f4c752e450fc2faf62654f1c134747922825d5b04ca717b8874f41a40c0" dependencies = [ "proc-macro2", - "syn 2.0.119", + "syn 3.0.9", ] [[package]] @@ -1130,6 +1246,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.13.2", + "chacha20", + "core_detect", + "num-traits", + "rand 0.10.3", + "rand_xorshift", + "regex-syntax 0.8.11", + "rusty-fork", + "tempfile", + "unarray", +] + [[package]] name = "psm" version = "0.1.32" @@ -1140,6 +1276,12 @@ dependencies = [ "cc", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" version = "1.0.47" @@ -1169,7 +1311,18 @@ checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" dependencies = [ "libc", "rand_chacha", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", ] [[package]] @@ -1179,7 +1332,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -1191,6 +1344,21 @@ dependencies = [ "getrandom 0.2.17", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_xorshift" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" +dependencies = [ + "rand_core 0.10.1", +] + [[package]] name = "regex-automata" version = "0.3.9" @@ -1313,6 +1481,18 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "same-file" version = "1.0.6" @@ -1328,8 +1508,8 @@ version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ - "bitcoin_hashes", - "rand", + "bitcoin_hashes 0.14.101", + "rand 0.8.8", "secp256k1-sys", "serde", ] @@ -1350,7 +1530,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "403f6ab6ef5189ded7d11cb384a96a9f871001e50b391a8fcbb310c9ebc2099b" dependencies = [ "bitcoin-private", - "rand", + "rand 0.8.8", "secp256k1", "secp256k1-zkp-sys", "serde", @@ -1426,9 +1606,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.9" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" dependencies = [ "cfg-if", "cpufeatures", @@ -1443,36 +1623,34 @@ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" [[package]] name = "simplicity-lang" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13ed081e3046d66c146d7201bcbf3b655ca3436cb83f6efc26d7895bd2b79d06" +version = "0.9.0" +source = "git+https://github.com/BlockstreamResearch/rust-simplicity.git?rev=2c5a066#2c5a066cc8f40cbadcefaa604742cbae99bd2557" dependencies = [ "bitcoin", - "bitcoin_hashes", + "bitcoin_hashes 1.2.0", "byteorder", "elements", "getrandom 0.2.17", "ghost-cell", - "hex-conservative 0.2.3", + "hex-conservative 1.3.0", "miniscript", "simplicity-sys", ] [[package]] name = "simplicity-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d1ec5477c7650b8ef511aa56dccb28f2e8cdb6e87f260ecffdaf0ebfef2d3b" +version = "0.8.0" +source = "git+https://github.com/BlockstreamResearch/rust-simplicity.git?rev=2c5a066#2c5a066cc8f40cbadcefaa604742cbae99bd2557" dependencies = [ - "bitcoin_hashes", + "bitcoin_hashes 1.2.0", "cc", ] [[package]] name = "simplicityhl" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae77168fa3367d234b11bb3999cbd6e04d7180db0b9e11f83de259528e3b23d1" +checksum = "9e110f12190a4df92970b50d701f7da979638a60c5bf8294d55e4a55aceebf3e" dependencies = [ "ariadne", "base64 0.21.7", @@ -1496,7 +1674,7 @@ dependencies = [ "num-bigint", "num-traits", "primitive-types", - "rand", + "rand 0.8.8", "secp256k1-zkp", "smplx-std", ] @@ -1509,11 +1687,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smplx-build" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e9561b9da1d788d3e777f8a59b085dd13a6fbace5b109f2b0576069f9f36ff" +version = "0.2.0" +source = "git+https://github.com/BlockstreamResearch/smplx?branch=fix%2Fbump-simplicity-lang#08da700f347486578deafb7306a36986da7fa742" dependencies = [ - "glob", "globwalk", "pathdiff", "prettyplease", @@ -1522,7 +1698,7 @@ dependencies = [ "serde", "serde_json", "simplicityhl", - "syn 2.0.119", + "syn 3.0.9", "thiserror", "toml", "toml_edit", @@ -1530,20 +1706,18 @@ dependencies = [ [[package]] name = "smplx-macros" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f802ff11501371c4c822f0ecdbf7e9e65180ccbbb43b55f252c9a00cb849d24" +version = "0.2.0" +source = "git+https://github.com/BlockstreamResearch/smplx?branch=fix%2Fbump-simplicity-lang#08da700f347486578deafb7306a36986da7fa742" dependencies = [ "smplx-build", "smplx-test", - "syn 2.0.119", + "syn 3.0.9", ] [[package]] name = "smplx-regtest" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881db46f30a472018c26c5f245637a722ccba36a873b845d5e6376e7bd5e1106" +version = "0.2.0" +source = "git+https://github.com/BlockstreamResearch/smplx?branch=fix%2Fbump-simplicity-lang#08da700f347486578deafb7306a36986da7fa742" dependencies = [ "electrsd", "hex", @@ -1557,12 +1731,10 @@ dependencies = [ [[package]] name = "smplx-sdk" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98b85112288eccd99ba34bd852681d78c3581a52709eab0ce52a073b9d961d8e" +version = "0.2.0" +source = "git+https://github.com/BlockstreamResearch/smplx?branch=fix%2Fbump-simplicity-lang#08da700f347486578deafb7306a36986da7fa742" dependencies = [ "bip39", - "bitcoin_hashes", "bitcoincore-rpc", "dyn-clone", "elements-miniscript", @@ -1570,18 +1742,18 @@ dependencies = [ "minreq 3.0.0", "serde", "serde_json", - "sha2", "simplicityhl", "thiserror", ] [[package]] name = "smplx-std" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05855ac57a1b5f737a4bc244ebf5924453957a2066a0bb0fd8df033498386ba" +version = "0.2.0" +source = "git+https://github.com/BlockstreamResearch/smplx?branch=fix%2Fbump-simplicity-lang#08da700f347486578deafb7306a36986da7fa742" dependencies = [ "either", + "rand 0.10.3", + "rand_core 0.10.1", "serde", "simplicityhl", "smplx-macros", @@ -1591,18 +1763,19 @@ dependencies = [ [[package]] name = "smplx-test" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a66ea20c2701a90faf10f9a18176058dd7a82222797d5ed6da9c83f0f1ca032" +version = "0.2.0" +source = "git+https://github.com/BlockstreamResearch/smplx?branch=fix%2Fbump-simplicity-lang#08da700f347486578deafb7306a36986da7fa742" dependencies = [ "electrsd", "proc-macro2", + "proptest", "quote", + "rand 0.10.3", "serde", "simplicityhl", "smplx-regtest", "smplx-sdk", - "syn 2.0.119", + "syn 3.0.9", "thiserror", "toml", ] @@ -1707,26 +1880,17 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "toml" -version = "0.9.12+spec-1.1.0" +version = "1.1.8+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" dependencies = [ "indexmap", "serde_core", "serde_spanned", - "toml_datetime 0.7.5+spec-1.1.0", + "toml_datetime", "toml_parser", "toml_writer", - "winnow 0.7.15", -] - -[[package]] -name = "toml_datetime" -version = "0.7.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", + "winnow", ] [[package]] @@ -1745,10 +1909,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" dependencies = [ "indexmap", - "toml_datetime 1.1.2+spec-1.1.0", + "toml_datetime", "toml_parser", "toml_writer", - "winnow 1.0.4", + "winnow", ] [[package]] @@ -1757,7 +1921,7 @@ version = "1.1.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" dependencies = [ - "winnow 1.0.4", + "winnow", ] [[package]] @@ -1784,6 +1948,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.27" @@ -1830,10 +2000,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] -name = "version_check" -version = "0.9.5" +name = "wait-timeout" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] [[package]] name = "walkdir" @@ -2023,12 +2196,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" - [[package]] name = "winnow" version = "1.0.4" diff --git a/Cargo.toml b/Cargo.toml index 36dee43..083ed8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,10 @@ keywords = ["simplicity", "liquid", "elements", "smart-contracts"] categories = ["cryptography::cryptocurrencies"] [dependencies] -smplx-std = { version = "0.0.12" } +# TODO: Replace this with a new Simplex version that includes the fix from simplicity-lang +# (For now, we must use a patched smplx dependency because of a breaking change in `ExecutionError` +# where the fix is represented). +smplx-std = { git = "https://github.com/BlockstreamResearch/smplx", branch = "fix/bump-simplicity-lang", features = ["test"] } [dev-dependencies] anyhow = { version = "1.0.101" } @@ -20,3 +23,7 @@ primitive-types = { version = "0.14" } num-bigint = { version = "0.5.1" } num-traits = { version = "0.2.19" } secp256k1-zkp = { version = "0.11.0", features = ["rand"] } + +# TODO: Remove this patch only when SimplicityHL uses a simplicity-lang release with the pruning fix. +[patch.crates-io] +simplicity-lang = { git = "https://github.com/BlockstreamResearch/rust-simplicity.git", rev = "2c5a066" } \ No newline at end of file diff --git a/README.md b/README.md index 63ec08a..9c764da 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ simplex install https://github.com/BlockstreamResearch/simplicityhl-std ``` > [!NOTE] -> The library works with Simplex versions 0.0.11 and 0.0.12. +> The library contracts work with Simplex version 0.0.7 or higher. ## Documentation diff --git a/Simplex.toml b/Simplex.toml index c522f64..555b27b 100644 --- a/Simplex.toml +++ b/Simplex.toml @@ -6,7 +6,7 @@ # out_dir = "./src/artifacts" # [dependencies] -# some_dep = { git = "", path = "" } +# some_dep = { git = "", path = "", = "", package = "" } # [regtest] # mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean" @@ -25,6 +25,11 @@ # url = "" # network = "" +# [test.fuzz] +# cases = 10 +# seed = 12345 +# network = "" + # [test.rpc] # url = "" # username = "" diff --git a/simf/tests/mock.simf b/simf/tests/mock.simf index e71fdf5..f328e4d 100644 --- a/simf/tests/mock.simf +++ b/simf/tests/mock.simf @@ -1 +1 @@ -fn main() {} \ No newline at end of file +fn main() {} diff --git a/simf/tests/utxo/getters/amount.simf b/simf/tests/utxo/getters/amount.simf index 08b6b0a..9e543c5 100644 --- a/simf/tests/utxo/getters/amount.simf +++ b/simf/tests/utxo/getters/amount.simf @@ -36,7 +36,7 @@ fn main() { confidential_amount ): Confidential1 = get_confidential_amount(index, is_input_index); - assert_eq_1(parity_bit,expected_parity); + assert_eq_1(parity_bit, expected_parity); assert_eq_256(confidential_amount, expected_confidential_amount); }, false => (), @@ -56,7 +56,7 @@ fn main() { confidential_amount ): Confidential1 = get_confidential_input_amount(index); - assert_eq_1(parity_bit,expected_parity); + assert_eq_1(parity_bit, expected_parity); assert_eq_256(confidential_amount, expected_confidential_amount); }, false => (), @@ -76,7 +76,7 @@ fn main() { confidential_amount ): Confidential1 = get_confidential_output_amount(index); - assert_eq_1(parity_bit,expected_parity); + assert_eq_1(parity_bit, expected_parity); assert_eq_256(confidential_amount, expected_confidential_amount); }, false => (), @@ -96,7 +96,7 @@ fn main() { confidential_amount ): Confidential1 = get_confidential_current_amount(); - assert_eq_1(parity_bit,expected_parity); + assert_eq_1(parity_bit, expected_parity); assert_eq_256(confidential_amount, expected_confidential_amount); }, false => (), diff --git a/tests/stdlib/common/core.rs b/tests/stdlib/common/core.rs index f2ed63c..495a3ea 100644 --- a/tests/stdlib/common/core.rs +++ b/tests/stdlib/common/core.rs @@ -3,14 +3,17 @@ #![allow(dead_code)] use secp256k1_zkp::Secp256k1; -use simplex::program::{Program, WitnessTrait}; + +use simplex::program::Program; use simplex::signer::Signer; +use simplex::simplicityhl::WitnessValues; use simplex::simplicityhl::elements::bitcoin::PublicKey; use simplex::simplicityhl::elements::{AssetId, Script, Txid}; use simplex::transaction::partial_input::IssuanceInput; use simplex::transaction::{ - FinalTransaction, PartialInput, PartialOutput, ProgramInput, RequiredSignature, UTXO, + FinalTransaction, NativeSignature, PartialInput, PartialOutput, ProgramInput, UTXO, }; + use simplicityhl_std::artifacts::tests::mock::derived_mock::MockWitness; use crate::common::utxo_helper::{DEFAULT_SEND_AMOUNT, search_utxo_by_txid}; @@ -91,14 +94,18 @@ pub fn send_issued( let funding = signer .get_utxos_asset(context.get_network().policy_asset())? .into_iter() - .max_by_key(UTXO::amount) + .map(|utxo| Ok((utxo.amount()?, utxo))) + .collect::>>()? + .into_iter() + .max_by_key(|(amount, _)| *amount) + .map(|(_, utxo)| utxo) .ok_or_else(|| anyhow::anyhow!("no policy asset UTXO to attach the issuance to"))?; let mut ft = FinalTransaction::new(); let issued = ft.add_issuance_input( PartialInput::new(funding), IssuanceInput::new_issuance(amount_to_send, 0, rand::random()), - RequiredSignature::NativeEcdsa, + Some(NativeSignature::Ecdsa), ); ft.add_output(PartialOutput::new( to.clone(), @@ -121,7 +128,7 @@ pub fn construct_final_tx( program_for_test: Option, ) -> anyhow::Result where - W: WitnessTrait + 'static, + W: Into + 'static, { let signer = context.get_default_signer(); let network = context.get_network(); @@ -136,8 +143,8 @@ where ft.add_program_input( PartialInput::new(program_utxo.clone()), - ProgramInput::new(Box::new(program.as_ref().clone()), Box::new(witness)), - RequiredSignature::None, + ProgramInput::new(Box::new(program.as_ref().clone()), witness.into()), + None, ); if data.unwrap_or_default().is_empty() { @@ -146,7 +153,7 @@ where &program_utxo, signer.get_blinding_public_key(), policy_asset, - ); + )?; } if txids.len() > 1 { @@ -156,9 +163,12 @@ where for txid in &txids[1..last] { let utxo = search_utxo_by_txid(txid, &unblinded_utxos)?; - ft.add_input(PartialInput::new(utxo.clone()), RequiredSignature::None); + ft.add_input( + PartialInput::new(utxo.clone()), + Some(NativeSignature::Ecdsa), + ); - (ft, _) = add_mirror_output(ft, &utxo, signer.get_blinding_public_key(), policy_asset); + (ft, _) = add_mirror_output(ft, &utxo, signer.get_blinding_public_key(), policy_asset)?; } let last_utxo = match program_for_test { @@ -168,8 +178,8 @@ where ft.add_program_input( PartialInput::new(last_utxo.clone()), - ProgramInput::new(Box::new(program_for_test.clone()), Box::new(MockWitness {})), - RequiredSignature::None, + ProgramInput::new(Box::new(program_for_test.clone()), MockWitness {}), + None, ); last_utxo @@ -179,7 +189,7 @@ where ft.add_input( PartialInput::new(last_utxo.clone()), - RequiredSignature::None, + Some(NativeSignature::Ecdsa), ); last_utxo @@ -191,7 +201,7 @@ where &last_utxo, signer.get_blinding_public_key(), policy_asset, - ); + )?; } if let Some(leftover_asset) = leftover_asset { @@ -245,13 +255,13 @@ fn add_mirror_output( utxo: &UTXO, binding_key: PublicKey, policy_asset: AssetId, -) -> (FinalTransaction, Option) { +) -> anyhow::Result<(FinalTransaction, Option)> { let mut output = PartialOutput::new( // scripts in input and output on the same index should be different for the test tweak_script(&utxo.txout.script_pubkey), // amounts in input and output on the same index should be different for the test - utxo.amount() - 1, - utxo.asset(), + utxo.amount()? - 1, + utxo.asset()?, ); if utxo.txout.value.is_confidential() { @@ -260,12 +270,12 @@ fn add_mirror_output( ft.add_output(output); - let leftover_asset = match utxo.asset() == policy_asset { + let leftover_asset = match utxo.asset()? == policy_asset { true => None, - false => Some(utxo.asset()), + false => Some(utxo.asset()?), }; - (ft, leftover_asset) + Ok((ft, leftover_asset)) } /// Change the lowest bit of the last byte (used for test purposes). @@ -288,7 +298,7 @@ pub fn spend( program_for_test: Option, ) -> anyhow::Result where - W: WitnessTrait + 'static, + W: Into + 'static, { let ft = construct_final_tx(context, program, witness, data, txids, program_for_test)?; @@ -323,7 +333,7 @@ pub fn run( expect: Expect, ) -> anyhow::Result<()> where - W: WitnessTrait + 'static, + W: Into + 'static, { fund(context, &program, DEFAULT_SEND_AMOUNT)?; let result = spend(context, &program, witness, None, Vec::new(), None); @@ -341,7 +351,7 @@ pub fn run_with_op_return( data: &[u8], ) -> anyhow::Result<()> where - W: WitnessTrait + 'static, + W: Into + 'static, { fund(context, &program, DEFAULT_SEND_AMOUNT)?; let result = spend(context, &program, witness, Some(data), Vec::new(), None); @@ -359,7 +369,7 @@ pub fn run_with_inputs_outputs( program_for_test: Option, ) -> anyhow::Result<()> where - W: WitnessTrait + 'static, + W: Into + 'static, { let result = spend(context, &program, witness, None, txids, program_for_test); diff --git a/tests/stdlib/common/uint.rs b/tests/stdlib/common/uint.rs index 1169c33..ab997d1 100644 --- a/tests/stdlib/common/uint.rs +++ b/tests/stdlib/common/uint.rs @@ -8,7 +8,8 @@ use std::ops::{Add, Div, Mul, Sub}; use rand::Rng; use rand::distributions::uniform::SampleUniform; -use simplex::program::{Program, WitnessTrait}; +use simplex::program::Program; +use simplex::simplicityhl::WitnessValues; use crate::common::u256_wrapper::U256Wrapper; @@ -47,7 +48,7 @@ pub trait TestUint: + Div { type Program: AsRef; - type Witness: WitnessTrait + 'static; + type Witness: Into + 'static; const ZERO: Self; const ONE: Self; diff --git a/tests/stdlib/common/utxo_helper.rs b/tests/stdlib/common/utxo_helper.rs index 90cad21..3baa243 100644 --- a/tests/stdlib/common/utxo_helper.rs +++ b/tests/stdlib/common/utxo_helper.rs @@ -1,6 +1,5 @@ use primitive_types::U256; use rand::Rng; -use secp256k1_zkp::hashes::Hash; use simplex::program::Program; use simplex::simplicityhl::elements::AssetId; @@ -184,7 +183,7 @@ pub fn create_utxos_with_new_asset( } } - Ok((new_asset.unwrap().into_inner().0, txids)) + Ok((new_asset.unwrap().to_byte_array(), txids)) } fn get_asset_id_amount_from_conf_utxo(conf_utxo: UTXO) -> anyhow::Result { diff --git a/tests/stdlib/utxo/asserts/asset_id.rs b/tests/stdlib/utxo/asserts/asset_id.rs index 6408829..2ed19c4 100644 --- a/tests/stdlib/utxo/asserts/asset_id.rs +++ b/tests/stdlib/utxo/asserts/asset_id.rs @@ -186,7 +186,7 @@ fn assert_false_explicit_asset_id_for_input(context: simplex::TestContext) -> an case(Explicit) .index(index) .index_type(IndexType::Input) - .expect(context.get_network().policy_asset().into_inner().0) + .expect(context.get_network().policy_asset().to_byte_array()) .expecting(&context, Expect::AssertFailed, txids) } @@ -224,7 +224,7 @@ fn assert_false_explicit_asset_id_for_output(context: simplex::TestContext) -> a case(Explicit) .index(index) .index_type(IndexType::Output) - .expect(context.get_network().policy_asset().into_inner().0) + .expect(context.get_network().policy_asset().to_byte_array()) .expecting(&context, Expect::AssertFailed, txids) } @@ -321,7 +321,7 @@ fn assert_false_explicit_input_asset_id(context: simplex::TestContext) -> anyhow case(ExplicitInput) .index(index) - .expect(context.get_network().policy_asset().into_inner().0) + .expect(context.get_network().policy_asset().to_byte_array()) .expecting(&context, Expect::AssertFailed, txids) } @@ -376,7 +376,7 @@ fn assert_false_explicit_output_asset_id(context: simplex::TestContext) -> anyho case(ExplicitOutput) .index(index) - .expect(context.get_network().policy_asset().into_inner().0) + .expect(context.get_network().policy_asset().to_byte_array()) .expecting(&context, Expect::AssertFailed, txids) } @@ -434,7 +434,7 @@ fn assert_false_explicit_current_asset_id(context: simplex::TestContext) -> anyh case(CurrentExplicit) .index(index) - .expect(context.get_network().policy_asset().into_inner().0) + .expect(context.get_network().policy_asset().to_byte_array()) .expecting(&context, Expect::AssertFailed, txids) } diff --git a/tests/stdlib/utxo/asserts/asset_id_with_amount.rs b/tests/stdlib/utxo/asserts/asset_id_with_amount.rs index de17bc4..f9331ee 100644 --- a/tests/stdlib/utxo/asserts/asset_id_with_amount.rs +++ b/tests/stdlib/utxo/asserts/asset_id_with_amount.rs @@ -210,7 +210,7 @@ fn assert_false_explicit_asset_id_with_amount_for_input( .index(index) .index_type(IndexType::Input) .expect( - context.get_network().policy_asset().into_inner().0, + context.get_network().policy_asset().to_byte_array(), real_amount, ) .expecting(&context, Expect::AssertFailed, txids) @@ -281,7 +281,7 @@ fn assert_false_explicit_asset_id_with_amount_for_output( .index(index) .index_type(IndexType::Output) .expect( - context.get_network().policy_asset().into_inner().0, + context.get_network().policy_asset().to_byte_array(), real_amount, ) .expecting(&context, Expect::AssertFailed, txids) @@ -432,7 +432,7 @@ fn assert_false_explicit_input_asset_id_with_amount( case(ExplicitInput) .index(index) .expect( - context.get_network().policy_asset().into_inner().0, + context.get_network().policy_asset().to_byte_array(), real_amount, ) .expecting(&context, Expect::AssertFailed, txids) @@ -533,7 +533,7 @@ fn assert_false_explicit_output_asset_id_with_amount( case(ExplicitOutput) .index(index) .expect( - context.get_network().policy_asset().into_inner().0, + context.get_network().policy_asset().to_byte_array(), real_amount, ) .expecting(&context, Expect::AssertFailed, txids) @@ -631,7 +631,7 @@ fn assert_false_explicit_current_asset_id_with_amount( case(CurrentExplicit) .index(index) .expect( - context.get_network().policy_asset().into_inner().0, + context.get_network().policy_asset().to_byte_array(), real_amount, ) .expecting(&context, Expect::AssertFailed, txids)