diff --git a/CHANGELOG.md b/CHANGELOG.md index 82217f01..d40815d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,50 @@ # Unreleased +# 0.8.0 - 2026-09-23 + +## Breaking Changes + +* Rename the source-level `TemplateProgram` to `TemplateAst`. + `TemplateProgram` now represents the intermediate compiled program returned by `ast::Program::compile`. + Replace `str::WitnessName` with `TemplateProgramWitness`, using separate constructors for witnesses and parameters. + `Arguments`, `WitnessValues`, `WitnessTypes` and `Parameters` now use `TemplateProgramWitness` keys. + Import `WitnessNameToValueMap` for value-map methods and replace `Arguments::from(map)` and `WitnessValues::from(map)` with `from_map`. [#388](https://github.com/BlockstreamResearch/SimplicityHL/pull/388) +* String-wrapper `as_inner()` methods now return `&Arc`. + Use `as_str()` for `&str`. + `UnresolvedValues` now uses `Identifier` keys. [#388](https://github.com/BlockstreamResearch/SimplicityHL/pull/388) +* Change `ast::Program::analyze` to accept `&mut DiagnosticManager` and return `Option`. + Analysis failures are recorded in the supplied manager. [#418](https://github.com/BlockstreamResearch/SimplicityHL/pull/418) +* Remove `UIntType::try_from` conversions from `&ResolvedType` and `&StructuralType`. [#407](https://github.com/BlockstreamResearch/SimplicityHL/pull/407) +* Upgrade the re-exported `simplicity` crate to `simplicity-lang` 0.9.0 and `elements` to 0.27.0. + Downstream callers must update to the new hash and witness APIs. + Hash constructors use `from_byte_array` instead of `from_slice` or `all_zeros`, hex decoding uses `hex::decode_to_vec`, and transaction witnesses use `elements::Witness`. + `Final::two_two_n` is now fallible, with `two_two_n_fixed` for constant sizes. + Custom `CoreConstructible` implementations must provide `arrow()` and `jet()`. + See the [rust-simplicity release notes](https://github.com/BlockstreamResearch/rust-simplicity/blob/simplicity-lang-0.9.0/CHANGELOG.md) for further upstream API changes. +* Compiler directives restricted to 0.7, such as `simc "0.7"`, reject this release. + Update the declared range after checking compatibility with 0.8.0. + ## Added -* Add the uninhabited type `TypeInner::Never` with `ResolvedType::never` and `ResolvedType::is_never`. It has no values and no structural type; it will be used for error recovery during analysis. [#418](https://github.com/BlockstreamResearch/SimplicityHL/pull/418) +* Add `as_str()` to string wrappers and `TemplateProgramWitness` for borrowing the inner `&str`. [#388](https://github.com/BlockstreamResearch/SimplicityHL/pull/388) +* Add the uninhabited type `TypeInner::Never` with `ResolvedType::never` and `ResolvedType::is_never`. + It has no values and no structural type. [#417](https://github.com/BlockstreamResearch/SimplicityHL/pull/417) +* Add `DiagnosticManager::presentation_order()` for callers that need diagnostics in the same order as rendered output. + `diagnostics()` retains insertion order. [#413](https://github.com/BlockstreamResearch/SimplicityHL/pull/413) ## Changed -* Report all errors in tuple, array and list elements, call arguments, match arms, enum payloads. [#420](https://github.com/BlockstreamResearch/SimplicityHL/pull/420) +* Report all errors in tuple, array and list elements, call arguments, match arms and enum payloads. [#420](https://github.com/BlockstreamResearch/SimplicityHL/pull/420) +* Replace the deprecated relative-distance timelock jet in the last-will example with explicit transaction-version and input-sequence checks. + Clarify that its 25,920-block delay is about 18 days on Liquid. [#395](https://github.com/BlockstreamResearch/SimplicityHL/pull/395) * Deduplicate identical compiler diagnostics and present multi-file diagnostics in deterministic dependency and source order. [#413](https://github.com/BlockstreamResearch/SimplicityHL/pull/413) +* Parse nested block bodies in linear time instead of exponential time. [#410](https://github.com/BlockstreamResearch/SimplicityHL/pull/410) + +## Fixed + +* Correct the `gej_ge_add_ex` documentation to describe the ratio of the result's z-coordinate to the input's z-coordinate. [#419](https://github.com/BlockstreamResearch/SimplicityHL/pull/419) +* Restore analysis scopes after errors in blocks, functions, match arms and modules. [#406](https://github.com/BlockstreamResearch/SimplicityHL/pull/406) +* Make each `use` declaration atomic so a failed import cannot leave partially imported names or visibility changes. [#416](https://github.com/BlockstreamResearch/SimplicityHL/pull/416) # 0.7.2 - 2026-08-25 diff --git a/Cargo.lock b/Cargo.lock index 3c072982..6c876cb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,12 +103,11 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "base58ck" -version = "0.1.0" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +checksum = "365c0acd5b2e8dd0111a46c4faea83fb3cfb6e39a49a7c73a06e090db7b2eff0" dependencies = [ - "bitcoin-internals", - "bitcoin_hashes", + "bitcoin_hashes 0.14.101", ] [[package]] @@ -131,32 +130,46 @@ checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "bitcoin" -version = "0.32.3" +version = "0.32.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0032b0e8ead7074cda7fc4f034409607e3f03a6f71d66ade8a307f79b4d99e73" +checksum = "bb0ce8bd5baaa0d303a19915a6d93afed161f528654e42da2a7a97d05c59499a" dependencies = [ "base58ck", "bech32", - "bitcoin-internals", + "bitcoin-consensus-encoding", "bitcoin-io", "bitcoin-units", - "bitcoin_hashes", - "hex-conservative", + "bitcoin_hashes 0.14.101", + "hex-conservative 0.2.3", "hex_lit", "secp256k1", ] +[[package]] +name = "bitcoin-consensus-encoding" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6712f9c6fd6785b3b270884e57c441c403dc5d7e19ca45368c97c7a1de3000ec" +dependencies = [ + "bitcoin-internals", + "hex-conservative 1.3.0", + "serde", +] + [[package]] name = "bitcoin-internals" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" +checksum = "d573f4cf32996a8dce612e4348cece65a241f1882ed594047c9ba348e8869fa5" [[package]] name = "bitcoin-io" -version = "0.1.2" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" +checksum = "bb5de036369d1ac59d3c1819ebc4d850f89466f5401c571a285b6ed564a4cb78" +dependencies = [ + "bitcoin-consensus-encoding", +] [[package]] name = "bitcoin-private" @@ -166,21 +179,32 @@ checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" [[package]] name = "bitcoin-units" -version = "0.1.2" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" +checksum = "9cb95693f371d089a4b5b6fc41c6f3ea6e01ee8c15388335dfac8ea685173b51" dependencies = [ - "bitcoin-internals", + "bitcoin-consensus-encoding", ] [[package]] name = "bitcoin_hashes" -version = "0.14.0" +version = "0.14.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +checksum = "bca4c7abb40c8817d77403c880988cfd484f23ab2365726afb2f798363e2c4a2" dependencies = [ "bitcoin-io", - "hex-conservative", + "hex-conservative 0.2.3", +] + +[[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", + "hex-conservative 1.3.0", ] [[package]] @@ -289,12 +313,16 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[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", + "bitcoin_hashes 1.2.0", + "hex-conservative 1.3.0", "secp256k1-zkp", ] @@ -355,9 +383,18 @@ dependencies = [ [[package]] name = "hex-conservative" -version = "0.2.1" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3fef046dca3ca91ee1408a8c1b80ab777e80a4d308d1bf4e7adb3fcb047e08" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hex-conservative" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +checksum = "271e0d19bcb473b6675739a2b536076b24a082316cb5199ad918edce10c599e8" dependencies = [ "arrayvec", ] @@ -468,9 +505,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] @@ -487,9 +524,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -553,7 +590,7 @@ version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ - "bitcoin_hashes", + "bitcoin_hashes 0.14.101", "rand", "secp256k1-sys", ] @@ -597,22 +634,32 @@ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 3.0.6", ] [[package]] @@ -634,34 +681,34 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simplicity-lang" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13ed081e3046d66c146d7201bcbf3b655ca3436cb83f6efc26d7895bd2b79d06" +checksum = "cff7b10251528d46d9cf60238267911984fedbb0948cccea98dd74fc6bf9f729" dependencies = [ "bitcoin", - "bitcoin_hashes", + "bitcoin_hashes 1.2.0", "byteorder", "elements", "getrandom", "ghost-cell", - "hex-conservative", + "hex-conservative 1.3.0", "miniscript", "simplicity-sys", ] [[package]] name = "simplicity-sys" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d1ec5477c7650b8ef511aa56dccb28f2e8cdb6e87f260ecffdaf0ebfef2d3b" +checksum = "955935733b2735665b4735d9b1361eade6be4c7aea6bca2640345e4c81756f58" dependencies = [ - "bitcoin_hashes", + "bitcoin_hashes 1.2.0", "cc", ] [[package]] name = "simplicityhl" -version = "0.7.2" +version = "0.8.0" dependencies = [ "arbitrary", "ariadne", @@ -731,6 +778,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "unicode-ident" version = "1.0.11" diff --git a/Cargo.toml b/Cargo.toml index b539a862..a145888a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simplicityhl" -version = "0.7.2" +version = "0.8.0" authors = ["sanket1729 "] license = "MIT OR Apache-2.0" homepage = "https://github.com/BlockstreamResearch/SimplicityHL" @@ -11,8 +11,9 @@ rust-version = "1.79.0" default-run = "simc" [package.metadata.rbmt.lint] -# Existing transitive split: derive_arbitrary uses syn 1 while serde/wasm tooling uses syn 2. -allowed_duplicates = ["syn"] +# Bitcoin still uses older hash/hex crates than Elements and Simplicity. +# derive_arbitrary, wasm tooling and serde use different syn majors. +allowed_duplicates = ["bitcoin_hashes", "hex-conservative", "syn"] [lib] name = "simplicityhl" @@ -38,7 +39,7 @@ fmt = [] base64 = "0.21.2" serde = { version = "1.0.188", features = ["derive"], optional = true } serde_json = { version = "1.0.105", optional = true } -simplicity-lang = { version = "0.8.0" } +simplicity-lang = { version = "0.9.0" } miniscript = "12.3.1" either = "1.12.0" itertools = "0.13.0" diff --git a/bitcoind-tests/Cargo.lock b/bitcoind-tests/Cargo.lock index f78e963e..32b3c289 100644 --- a/bitcoind-tests/Cargo.lock +++ b/bitcoind-tests/Cargo.lock @@ -100,12 +100,11 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "base58ck" -version = "0.1.0" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +checksum = "365c0acd5b2e8dd0111a46c4faea83fb3cfb6e39a49a7c73a06e090db7b2eff0" dependencies = [ - "bitcoin-internals", - "bitcoin_hashes", + "bitcoin_hashes 0.14.101", ] [[package]] @@ -128,36 +127,47 @@ checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "bitcoin" -version = "0.32.7" +version = "0.32.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda569d741b895131a88ee5589a467e73e9c4718e958ac9308e4f7dc44b6945" +checksum = "bb0ce8bd5baaa0d303a19915a6d93afed161f528654e42da2a7a97d05c59499a" dependencies = [ "base58ck", "bech32", - "bitcoin-internals", + "bitcoin-consensus-encoding", "bitcoin-io", "bitcoin-units", - "bitcoin_hashes", - "hex-conservative", + "bitcoin_hashes 0.14.101", + "hex-conservative 0.2.3", "hex_lit", "secp256k1", "serde", ] [[package]] -name = "bitcoin-internals" -version = "0.3.0" +name = "bitcoin-consensus-encoding" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" +checksum = "6712f9c6fd6785b3b270884e57c441c403dc5d7e19ca45368c97c7a1de3000ec" dependencies = [ + "bitcoin-internals", + "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-io" -version = "0.1.2" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" +checksum = "bb5de036369d1ac59d3c1819ebc4d850f89466f5401c571a285b6ed564a4cb78" +dependencies = [ + "bitcoin-consensus-encoding", +] [[package]] name = "bitcoin-private" @@ -167,25 +177,36 @@ checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" [[package]] name = "bitcoin-units" -version = "0.1.2" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" +checksum = "9cb95693f371d089a4b5b6fc41c6f3ea6e01ee8c15388335dfac8ea685173b51" dependencies = [ - "bitcoin-internals", + "bitcoin-consensus-encoding", "serde", ] [[package]] name = "bitcoin_hashes" -version = "0.14.0" +version = "0.14.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +checksum = "bca4c7abb40c8817d77403c880988cfd484f23ab2365726afb2f798363e2c4a2" dependencies = [ "bitcoin-io", - "hex-conservative", + "hex-conservative 0.2.3", "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", + "hex-conservative 1.3.0", +] + [[package]] name = "bitcoincore-rpc" version = "0.19.0" @@ -322,12 +343,16 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elements" -version = "0.25.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739a0201c8b2d1e35e6509872ddb8250dd37b38d2a462b9cea05988bf9630196" +checksum = "34e00f7ddcd826d2f4c9bd72d79a6b6991a0ac4286e7e2b2ff8eecd130549073" dependencies = [ "bech32", "bitcoin", + "bitcoin-consensus-encoding", + "bitcoin-internals", + "bitcoin_hashes 1.2.0", + "hex-conservative 1.3.0", "secp256k1-zkp", ] @@ -426,9 +451,18 @@ checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "hex-conservative" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +checksum = "db3fef046dca3ca91ee1408a8c1b80ab777e80a4d308d1bf4e7adb3fcb047e08" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hex-conservative" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271e0d19bcb473b6675739a2b536076b24a082316cb5199ad918edce10c599e8" dependencies = [ "arrayvec", ] @@ -578,9 +612,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] @@ -597,9 +631,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -686,7 +720,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ - "bitcoin_hashes", + "bitcoin_hashes 0.14.101", "rand", "secp256k1-sys", "serde", @@ -731,22 +765,32 @@ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.6", ] [[package]] @@ -768,34 +812,34 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simplicity-lang" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13ed081e3046d66c146d7201bcbf3b655ca3436cb83f6efc26d7895bd2b79d06" +checksum = "cff7b10251528d46d9cf60238267911984fedbb0948cccea98dd74fc6bf9f729" dependencies = [ "bitcoin", - "bitcoin_hashes", + "bitcoin_hashes 1.2.0", "byteorder", "elements", "getrandom", "ghost-cell", - "hex-conservative", + "hex-conservative 1.3.0", "miniscript", "simplicity-sys", ] [[package]] name = "simplicity-sys" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d1ec5477c7650b8ef511aa56dccb28f2e8cdb6e87f260ecffdaf0ebfef2d3b" +checksum = "955935733b2735665b4735d9b1361eade6be4c7aea6bca2640345e4c81756f58" dependencies = [ - "bitcoin_hashes", + "bitcoin_hashes 1.2.0", "cc", ] [[package]] name = "simplicityhl" -version = "0.7.2" +version = "0.8.0" dependencies = [ "ariadne", "base64 0.21.2", @@ -841,6 +885,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.4.0" @@ -905,7 +960,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.29", "wasm-bindgen-shared", ] @@ -927,7 +982,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/bitcoind-tests/tests/common/daemon.rs b/bitcoind-tests/tests/common/daemon.rs index f71bc781..7eb3c9a5 100644 --- a/bitcoind-tests/tests/common/daemon.rs +++ b/bitcoind-tests/tests/common/daemon.rs @@ -1,7 +1,6 @@ use std::str::FromStr; use elements::encode::{deserialize, serialize_hex}; -use elements::hex::FromHex; use elementsd::bitcoincore_rpc::jsonrpc::serde_json::Value; use elementsd::bitcoind::bitcoincore_rpc::RpcApi; use elementsd::ElementsD; @@ -77,7 +76,7 @@ impl Call for ElementsD { .unwrap() .to_string(); - let tx_bytes = Vec::::from_hex(&tx_hex).unwrap(); + let tx_bytes = elements::hex::decode_to_vec(&tx_hex).unwrap(); deserialize(&tx_bytes).unwrap() } diff --git a/bitcoind-tests/tests/common/test.rs b/bitcoind-tests/tests/common/test.rs index b2ba0856..076f4b1c 100644 --- a/bitcoind-tests/tests/common/test.rs +++ b/bitcoind-tests/tests/common/test.rs @@ -1,6 +1,5 @@ use std::str::FromStr; -use elements::hashes::Hash; use elements::pset::PartiallySignedTransaction as Psbt; use elements::{confidential, secp256k1_zkp as secp256k1}; use elementsd::ElementsD; @@ -212,12 +211,12 @@ impl<'a> TestCase<'a> { .satisfy(witness_values) .expect("program should be satisfiable"); let (program_bytes, witness_bytes) = satisfied_program.redeem().to_vec_with_witness(); - psbt.inputs_mut()[0].final_script_witness = Some(vec![ + psbt.inputs_mut()[0].final_script_witness = Some(elements::Witness::from(vec![ witness_bytes, program_bytes, script_ver.0.into_bytes(), control_block.serialize(), - ]); + ])); let tx = psbt .extract_tx() .expect("transaction should be extractable"); diff --git a/bitcoind-tests/tests/spend_utxo.rs b/bitcoind-tests/tests/spend_utxo.rs index 01d91833..d0b6c797 100644 --- a/bitcoind-tests/tests/spend_utxo.rs +++ b/bitcoind-tests/tests/spend_utxo.rs @@ -1,12 +1,10 @@ use std::collections::HashMap; -use elements::hashes::Hash; use elements::secp256k1_zkp as secp256k1; -use secp256k1::hashes::{sha256, HashEngine}; -use simplicityhl::str::WitnessName; +use secp256k1::hashes::{sha256, Hash, HashEngine}; use simplicityhl::types::TypeConstructible; use simplicityhl::value::ValueConstructible; -use simplicityhl::{elements, ResolvedType, Value}; +use simplicityhl::{elements, ResolvedType, TemplateProgramWitness, Value, WitnessNameToValueMap}; mod common; use common::daemon::{self, Call}; @@ -53,12 +51,12 @@ fn hodl_vault(sighash_all: [u8; 32]) -> simplicityhl::WitnessValues { let mut witness_values = HashMap::new(); let oracle_height = 1000; witness_values.insert( - WitnessName::from_str_unchecked("ORACLE_HEIGHT"), + TemplateProgramWitness::witness_from_str("ORACLE_HEIGHT"), Value::u32(oracle_height), ); let oracle_price = 100_000; witness_values.insert( - WitnessName::from_str_unchecked("ORACLE_PRICE"), + TemplateProgramWitness::witness_from_str("ORACLE_PRICE"), Value::u32(oracle_price), ); let mut hasher = sha256::HashEngine::default(); @@ -66,26 +64,26 @@ fn hodl_vault(sighash_all: [u8; 32]) -> simplicityhl::WitnessValues { hasher.input(&oracle_price.to_be_bytes()); let oracle_hash = sha256::Hash::from_engine(hasher).to_byte_array(); witness_values.insert( - WitnessName::from_str_unchecked("ORACLE_SIG"), + TemplateProgramWitness::witness_from_str("ORACLE_SIG"), Value::byte_array(util::sign_schnorr(1, oracle_hash)), ); witness_values.insert( - WitnessName::from_str_unchecked("OWNER_SIG"), + TemplateProgramWitness::witness_from_str("OWNER_SIG"), Value::byte_array(util::sign_schnorr(2, sighash_all)), ); - simplicityhl::WitnessValues::from(witness_values) + simplicityhl::WitnessValues::from_map(witness_values) } fn p2pk_args() -> simplicityhl::Arguments { - simplicityhl::Arguments::from(HashMap::from([( - WitnessName::from_str_unchecked("ALICE_PUBLIC_KEY"), + simplicityhl::Arguments::from_map(HashMap::from([( + TemplateProgramWitness::parameter_from_str("ALICE_PUBLIC_KEY"), Value::u256(util::xonly_public_key(1)), )])) } fn p2pk(sighash_all: [u8; 32]) -> simplicityhl::WitnessValues { - simplicityhl::WitnessValues::from(HashMap::from([( - WitnessName::from_str_unchecked("ALICE_SIGNATURE"), + simplicityhl::WitnessValues::from_map(HashMap::from([( + TemplateProgramWitness::witness_from_str("ALICE_SIGNATURE"), Value::byte_array(util::sign_schnorr(1, sighash_all)), )])) } @@ -93,14 +91,14 @@ fn p2pk(sighash_all: [u8; 32]) -> simplicityhl::WitnessValues { fn p2pkh(sighash_all: [u8; 32]) -> simplicityhl::WitnessValues { let mut witness_values = HashMap::new(); witness_values.insert( - WitnessName::from_str_unchecked("PK"), + TemplateProgramWitness::witness_from_str("PK"), Value::u256(util::xonly_public_key(1)), ); witness_values.insert( - WitnessName::from_str_unchecked("SIG"), + TemplateProgramWitness::witness_from_str("SIG"), Value::byte_array(util::sign_schnorr(1, sighash_all)), ); - simplicityhl::WitnessValues::from(witness_values) + simplicityhl::WitnessValues::from_map(witness_values) } fn p2ms(sighash_all: [u8; 32]) -> simplicityhl::WitnessValues { @@ -110,6 +108,9 @@ fn p2ms(sighash_all: [u8; 32]) -> simplicityhl::WitnessValues { let sig3 = Value::some(Value::byte_array(util::sign_schnorr(3, sighash_all))); let ty = sig1.ty().clone(); let maybe_sigs = Value::array([sig1, sig2, sig3], ty); - witness_values.insert(WitnessName::from_str_unchecked("MAYBE_SIGS"), maybe_sigs); - simplicityhl::WitnessValues::from(witness_values) + witness_values.insert( + TemplateProgramWitness::witness_from_str("MAYBE_SIGS"), + maybe_sigs, + ); + simplicityhl::WitnessValues::from_map(witness_values) } diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index a178bdce..694b4ae7 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -6,6 +6,10 @@ rust-version = "1.79.0" description = "Generator of Rust code as interface between SimplicityHL and Rust." publish = false +[package.metadata.rbmt.lint] +# Bitcoin/Elements use different hash and hex majors, serde/wasm use different syn majors. +allowed_duplicates = ["bitcoin_hashes", "hex-conservative", "syn"] + [dependencies] simplicityhl = { path = ".." , features = ["docs"]} diff --git a/external-jet-lib-example/Cargo.toml b/external-jet-lib-example/Cargo.toml index 790f703b..42bc09e7 100644 --- a/external-jet-lib-example/Cargo.toml +++ b/external-jet-lib-example/Cargo.toml @@ -4,6 +4,10 @@ version = "0.1.0" edition = "2021" rust-version = "1.79.0" +[package.metadata.rbmt.lint] +# Bitcoin/Elements use different hash and hex majors, serde/wasm use different syn majors. +allowed_duplicates = ["bitcoin_hashes", "hex-conservative", "syn"] + [[bin]] name = "external-lib-consumer" path = "src/main.rs" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index afb7c543..2dfce727 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,8 +10,9 @@ authors = ["Generated by fuzz/generate-files.sh"] cargo-fuzz = true [package.metadata.rbmt.lint] -# Existing transitive split: derive_arbitrary uses syn 1 while serde/wasm tooling uses syn 2. -allowed_duplicates = ["syn"] +# Bitcoin still uses older hash/hex crates than Elements and Simplicity. +# derive_arbitrary, wasm tooling and serde use different syn majors. +allowed_duplicates = ["bitcoin_hashes", "hex-conservative", "syn"] [dependencies] libfuzzer-sys = "0.4" diff --git a/fuzz/generate-files.sh b/fuzz/generate-files.sh index e1554b2f..18e06883 100755 --- a/fuzz/generate-files.sh +++ b/fuzz/generate-files.sh @@ -22,8 +22,9 @@ authors = ["Generated by fuzz/generate-files.sh"] cargo-fuzz = true [package.metadata.rbmt.lint] -# Existing transitive split: derive_arbitrary uses syn 1 while serde/wasm tooling uses syn 2. -allowed_duplicates = ["syn"] +# Bitcoin still uses older hash/hex crates than Elements and Simplicity. +# derive_arbitrary, wasm tooling and serde use different syn majors. +allowed_duplicates = ["bitcoin_hashes", "hex-conservative", "syn"] [dependencies] libfuzzer-sys = "0.4" @@ -121,4 +122,3 @@ $(for name in $(cargo fuzz list); do echo " $name,"; done) - run: find executed_* -type f -exec cat {} + | sort > executed - run: cargo fuzz list | sort | diff - executed EOF - diff --git a/src/compile/mod.rs b/src/compile/mod.rs index 02ac4468..03f1edde 100644 --- a/src/compile/mod.rs +++ b/src/compile/mod.rs @@ -5,7 +5,7 @@ mod builtins; use std::sync::Arc; use either::Either; -use simplicity::node::{CoreConstructible as _, JetConstructible as _}; +use simplicity::node::CoreConstructible as _; use simplicity::{types, Cmr, FailEntropy}; use self::builtins::array_fold; diff --git a/src/debug.rs b/src/debug.rs index 610e0b15..a93b8720 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::sync::Arc; use either::Either; -use hashes::{sha256, Hash, HashEngine}; +use hashes::{sha256, HashEngine}; use simplicity::{hashes, Cmr}; use crate::error::Span; diff --git a/src/dummy_env.rs b/src/dummy_env.rs index e0f62bc6..a2f4643c 100644 --- a/src/dummy_env.rs +++ b/src/dummy_env.rs @@ -3,11 +3,10 @@ use std::sync::Arc; use elements::{confidential, taproot::ControlBlock, AssetIssuance}; -use hashes::Hash; +use simplicity::elements; use simplicity::elements::{AssetId, TxOut}; use simplicity::jet::elements::{ElementsEnv, ElementsUtxo}; use simplicity::Cmr; -use simplicity::{elements, hashes}; /// Return a dummy Elements environment. pub fn dummy() -> ElementsEnv> { @@ -69,7 +68,7 @@ pub fn dummy_with_tx(tx: elements::Transaction) -> ElementsEnv ElementsEnv> { let mut tx = PartiallySignedTransaction::new_v2(); - let outpoint = OutPoint::new(Txid::from_slice(&[2; 32]).unwrap(), 33); + let outpoint = OutPoint::new(Txid::from_byte_array([2; 32]), 33); tx.add_input(Input::from_prevout(outpoint)); ElementsEnv::new( @@ -445,7 +444,7 @@ mod tests { Cmr::from_byte_array([0; 32]), ControlBlock::from_slice(&[0xc0; 33]).unwrap(), None, - BlockHash::all_zeros(), + BlockHash::from_byte_array([0; 32]), ) } diff --git a/src/types/inner.rs b/src/types/inner.rs index 19fd6611..08393338 100644 --- a/src/types/inner.rs +++ b/src/types/inner.rs @@ -225,7 +225,7 @@ impl FromStr for UIntType { /// declaration order. /// /// An enum with `n` variants is represented as a balanced sum of its `n` -/// variant payload types (see [`BTreeSlice`] for the tree shape), so a value +/// variant payload types (see [`BTreeSlice`](crate::array::BTreeSlice) for the tree shape), so a value /// of the type is exactly one of the `n` variants: an undeclared variant is /// unrepresentable. A variant's position among the declared variants /// determines its leaf in the sum; there is no separate discriminant. diff --git a/src/types/structural.rs b/src/types/structural.rs index 14c98e2c..f676b7c3 100644 --- a/src/types/structural.rs +++ b/src/types/structural.rs @@ -58,15 +58,15 @@ impl fmt::Display for StructuralType { impl From for StructuralType { fn from(value: UIntType) -> Self { let inner = match value { - UIntType::U1 => Final::two_two_n(0), - UIntType::U2 => Final::two_two_n(1), - UIntType::U4 => Final::two_two_n(2), - UIntType::U8 => Final::two_two_n(3), - UIntType::U16 => Final::two_two_n(4), - UIntType::U32 => Final::two_two_n(5), - UIntType::U64 => Final::two_two_n(6), - UIntType::U128 => Final::two_two_n(7), - UIntType::U256 => Final::two_two_n(8), + UIntType::U1 => Final::two_two_n_fixed::<0>(), + UIntType::U2 => Final::two_two_n_fixed::<1>(), + UIntType::U4 => Final::two_two_n_fixed::<2>(), + UIntType::U8 => Final::two_two_n_fixed::<3>(), + UIntType::U16 => Final::two_two_n_fixed::<4>(), + UIntType::U32 => Final::two_two_n_fixed::<5>(), + UIntType::U64 => Final::two_two_n_fixed::<6>(), + UIntType::U128 => Final::two_two_n_fixed::<7>(), + UIntType::U256 => Final::two_two_n_fixed::<8>(), }; Self(inner) }