From c22f9de669f41c0f3c5738326e5235e5ad03af98 Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Thu, 26 Sep 2024 11:18:58 +0200 Subject: [PATCH 1/2] bump bitcoin dep and related, bump version to 0.3.0 --- Cargo-recent.lock | 247 +++++++++++++++++++++++++------------- Cargo.toml | 14 +-- jets-bench/src/input.rs | 24 ++-- simpcli/Cargo.toml | 4 +- simplicity-sys/Cargo.toml | 4 +- src/policy/satisfy.rs | 4 +- src/policy/serialize.rs | 2 +- 7 files changed, 191 insertions(+), 108 deletions(-) diff --git a/Cargo-recent.lock b/Cargo-recent.lock index 0d0d2d19..c1f18104 100644 --- a/Cargo-recent.lock +++ b/Cargo-recent.lock @@ -2,6 +2,22 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "base58ck" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +dependencies = [ + "bitcoin-internals", + "bitcoin_hashes", +] + [[package]] name = "base64" version = "0.21.7" @@ -10,20 +26,23 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bech32" -version = "0.10.0-beta" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "bitcoin" -version = "0.31.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd00f3c09b5f21fb357abe32d29946eb8bb7a0862bae62c0b5e4a692acbbe73c" +checksum = "ea507acc1cd80fc084ace38544bbcf7ced7c2aa65b653b102de0ce718df668f6" dependencies = [ + "base58ck", "bech32", "bitcoin-internals", + "bitcoin-io", + "bitcoin-units", "bitcoin_hashes", - "hex-conservative", + "hex-conservative 0.2.1", "hex_lit", "secp256k1", "serde", @@ -31,13 +50,19 @@ dependencies = [ [[package]] name = "bitcoin-internals" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" +checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" dependencies = [ "serde", ] +[[package]] +name = "bitcoin-io" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" + [[package]] name = "bitcoin-private" version = "0.1.0" @@ -45,13 +70,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" [[package]] -name = "bitcoin_hashes" -version = "0.13.0" +name = "bitcoin-units" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" dependencies = [ "bitcoin-internals", - "hex-conservative", + "serde", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +dependencies = [ + "bitcoin-io", + "hex-conservative 0.2.1", "serde", ] @@ -69,9 +104,12 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.90" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -81,10 +119,11 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "elements" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6b8388053196e6b2702a45418078a654680ce9e1fd91799f51f67a40118ff5" +checksum = "739a0201c8b2d1e35e6509872ddb8250dd37b38d2a462b9cea05988bf9630196" dependencies = [ + "bech32", "bitcoin", "secp256k1-zkp", "serde", @@ -93,9 +132,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -106,9 +145,18 @@ dependencies = [ [[package]] name = "hex-conservative" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + +[[package]] +name = "hex-conservative" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +dependencies = [ + "arrayvec", +] [[package]] name = "hex_lit" @@ -118,9 +166,9 @@ checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" [[package]] name = "honggfuzz" -version = "0.5.55" +version = "0.5.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "848e9c511092e0daa0a35a63e8e6e475a3e8f870741448b9f6028d69b142f18e" +checksum = "7c76b6234c13c9ea73946d1379d33186151148e0da231506b964b44f3d023505" dependencies = [ "lazy_static", "memmap2", @@ -129,55 +177,60 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.5.10" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" dependencies = [ "libc", ] [[package]] name = "miniscript" -version = "11.0.0" +version = "12.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86a23dd3ad145a980e231185d114399f25a0a307d2cd918010ddda6334323df9" +checksum = "add2d4aee30e4291ce5cffa3a322e441ff4d4bc57b38c8d9bf0e94faa50ab626" dependencies = [ "bech32", "bitcoin", - "bitcoin-internals", ] [[package]] @@ -188,24 +241,27 @@ checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -242,33 +298,33 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.29" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "santiago" @@ -281,9 +337,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.28.2" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ "bitcoin_hashes", "rand", @@ -293,18 +349,18 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.9.2" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" dependencies = [ "cc", ] [[package]] name = "secp256k1-zkp" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4e48ef9c98bfbcb98bd15693ffa19676cb3e29426b75eda8b73c05cdd7959f8" +checksum = "52a44aed3002b5ae975f8624c5df3a949cfbf00479e18778b6058fcd213b76e3" dependencies = [ "bitcoin-private", "rand", @@ -315,9 +371,9 @@ dependencies = [ [[package]] name = "secp256k1-zkp-sys" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ead52f43074bae2ddbd1e0e66e6b170135e76117f5ea9916f33d7bd0b36e29" +checksum = "8c6eea7919e0cab992510edfbf40bd9342c0a3c2bb910f2c51355c2cb2d69839" dependencies = [ "cc", "secp256k1-sys", @@ -325,24 +381,24 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -351,18 +407,19 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "simpcli" -version = "0.1.0" +version = "0.3.0" dependencies = [ "base64", "simplicity-lang", @@ -378,14 +435,14 @@ dependencies = [ [[package]] name = "simplicity-lang" -version = "0.2.0" +version = "0.3.0" dependencies = [ "bitcoin", "bitcoin_hashes", "byteorder", "elements", "getrandom", - "hex-conservative", + "hex-conservative 0.1.2", "miniscript", "santiago", "serde", @@ -394,7 +451,7 @@ dependencies = [ [[package]] name = "simplicity-sys" -version = "0.2.0" +version = "0.3.0" dependencies = [ "bitcoin_hashes", "cc", @@ -402,9 +459,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "6e2415488199887523e74fd9a5f7be804dfd42d868ae0eca382e3917094d210e" dependencies = [ "proc-macro2", "quote", @@ -413,9 +470,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "wasi" @@ -425,19 +482,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", @@ -450,9 +508,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -460,9 +518,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", @@ -473,6 +531,27 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index c1bbdfd0..0b137c9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simplicity-lang" -version = "0.2.0" +version = "0.3.0" authors = ["Andrew Poelstra "] license = "CC0-1.0" homepage = "https://github.com/BlockstreamResearch/rust-simplicity/" @@ -21,21 +21,21 @@ name = "simplicity" path = "src/lib.rs" [dependencies] -bitcoin = { version = "0.31.0", optional = true } -bitcoin-miniscript = { package = "miniscript", version = "11.0.0" } +bitcoin = { version = "0.32.0", optional = true } +bitcoin-miniscript = { package = "miniscript", version = "12.0.0" } byteorder = "1.3" -elements = { version = "0.24.0", optional = true } -hashes = { package = "bitcoin_hashes", version = "0.13" } +elements = { version = "0.25.0", optional = true } +hashes = { package = "bitcoin_hashes", version = "0.14" } hex = { package = "hex-conservative", version = "0.1.1" } santiago = "1.3" -simplicity-sys = { version = "0.2.0", path = "./simplicity-sys" } +simplicity-sys = { version = "0.3.0", path = "./simplicity-sys" } serde = { version = "1.0.103", features = ["derive"], optional = true } [target.wasm32-unknown-unknown.dependencies] getrandom = { version = "0.2", features = ["js"] } [dev-dependencies] -simplicity-sys = { version = "0.2.0", path = "./simplicity-sys", features = [ +simplicity-sys = { version = "0.3.0", path = "./simplicity-sys", features = [ "test-utils", ] } diff --git a/jets-bench/src/input.rs b/jets-bench/src/input.rs index b5bd2fb6..504537f6 100644 --- a/jets-bench/src/input.rs +++ b/jets-bench/src/input.rs @@ -6,6 +6,7 @@ use rand::rngs::ThreadRng; use rand::{Rng, RngCore}; use simplicity::ffi::c_jets::frame_ffi::c_writeBit; use simplicity::ffi::CFrameItem; +use simplicity::hashes::Hash; use simplicity::jet::Elements; use simplicity::types::{self, CompleteBound}; use simplicity::Value; @@ -352,7 +353,11 @@ impl FlatValue { // We can assert this because in our sampling code jets should never // fail. In the benchmarking code they might. - assert!(jet.c_jet_ptr()(&mut dst_write_frame, src_read_frame, Elements::c_jet_env(&env))); + assert!(jet.c_jet_ptr()( + &mut dst_write_frame, + src_read_frame, + Elements::c_jet_env(&env) + )); // The write frame winds up as an array of usizes with all bytes in // reverse order. (The bytes of the usizes are in reverse order due // to endianness, but also the usizes themselves are in reverse @@ -378,7 +383,7 @@ impl FlatValue { ret.inner[..dest_bits / 8].reverse(); } else { ret.inner[..(dest_bits + 7) / 8].reverse(); - ret.len_bits += 8 - dest_bits % 8; // correct for "correction" by left_shift + ret.len_bits += 8 - dest_bits % 8; // correct for "correction" by left_shift ret.left_shift(8 - dest_bits % 8); } } @@ -1043,7 +1048,6 @@ impl InputSample for Ge { let x2 = x.call_jet(Elements::FeSquare, 256); let x3 = FlatValue::product(&[x.clone(), x2]).call_jet(Elements::FeMultiply, 256); - let mut seven = FlatValue::zero_n_bits(256); seven.inner[31] = 7; let x3_7 = FlatValue::product(&[x3, seven]).call_jet(Elements::FeAdd, 256); @@ -1062,10 +1066,7 @@ impl InputSample for Ge { // Valid fes but off-curve point, OR invalid fes in some way. // Either way we just sample fes and don't try to make them fit the curve. let dist = dist - 1; - FlatValue::product(&[ - Fe.sample(dist, 256), - Fe.sample(dist, 256), - ]) + FlatValue::product(&[Fe.sample(dist, 256), Fe.sample(dist, 256)]) } } } @@ -1297,7 +1298,7 @@ impl InputSample for CheckSigSignature { let msg = [0xab; 64]; let hashed_msg = tagged_hash(b"Simplicity-Draft\x1fSignature", msg); - let hashed_msg = bitcoin::secp256k1::Message::from(hashed_msg); + let hashed_msg = bitcoin::secp256k1::Message::from_digest(hashed_msg.to_byte_array()); let sig = secp_ctx.sign_schnorr(&hashed_msg, &keypair); let mut ret = FlatValue::zero_n_bits(1024); @@ -1350,15 +1351,18 @@ mod tests { #[test] fn sample_ge_buffer() { - use simplicity::jet::Jet; use crate::{EnvSampling, JetBuffer, JetParams}; + use simplicity::jet::Jet; let env = EnvSampling::null().env(); let jet = Elements::PointVerify1; let src_ty = jet.source_ty().to_final(); let tgt_ty = jet.target_ty().to_final(); - let params = JetParams::for_sample(0, &GenericProduct(GenericProduct(GenericProduct(Scalar, Point), Scalar), Point)); + let params = JetParams::for_sample( + 0, + &GenericProduct(GenericProduct(GenericProduct(Scalar, Point), Scalar), Point), + ); let mut buffer = JetBuffer::new(&src_ty, &tgt_ty, ¶ms); let (src, mut dst) = buffer.write(&src_ty, ¶ms, &mut rand::thread_rng()); diff --git a/simpcli/Cargo.toml b/simpcli/Cargo.toml index bd9cb60c..59493422 100644 --- a/simpcli/Cargo.toml +++ b/simpcli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simpcli" -version = "0.1.0" +version = "0.3.0" edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -8,7 +8,7 @@ edition = "2018" [dependencies] base64 = "0.21" # todo add lexopt for command line parsing -simplicity-lang = { version = "0.2", path = "..", features = [ "serde", "elements" ] } +simplicity-lang = { version = "0.3", path = "..", features = [ "serde", "elements" ] } [[bin]] name = "simpcli" diff --git a/simplicity-sys/Cargo.toml b/simplicity-sys/Cargo.toml index e9f8cb5e..2920aed3 100644 --- a/simplicity-sys/Cargo.toml +++ b/simplicity-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simplicity-sys" -version = "0.2.0" +version = "0.3.0" license = "CC0-1.0" homepage = "https://github.com/BlockstreamResearch/rust-simplicity/" repository = "https://github.com/BlockstreamResearch/rust-simplicity/" @@ -13,7 +13,7 @@ rust-version = "1.63.0" cc = "1.0.83" [dependencies] -hashes = { package = "bitcoin_hashes", version = "0.13" } +hashes = { package = "bitcoin_hashes", version = "0.14" } [features] test-utils = [] diff --git a/src/policy/satisfy.rs b/src/policy/satisfy.rs index 53c4aed6..54cdcc64 100644 --- a/src/policy/satisfy.rs +++ b/src/policy/satisfy.rs @@ -296,7 +296,7 @@ mod tests { let xonly = keypair.x_only_public_key().0; let sighash = env.c_tx_env().sighash_all(); - let msg = secp256k1_zkp::Message::from(sighash); + let msg = secp256k1_zkp::Message::from_digest(sighash.to_byte_array()); let sig = elements::SchnorrSig { sig: keypair.sign_schnorr(msg), hash_ty: elements::SchnorrSighashType::All, @@ -379,7 +379,7 @@ mod tests { assert_eq!(1, witness.len()); let sighash = env.c_tx_env().sighash_all(); - let message = secp256k1_zkp::Message::from(sighash); + let message = secp256k1_zkp::Message::from_digest(sighash.to_byte_array()); let signature_bytes = witness[0] .iter_padded() .try_collect_bytes() diff --git a/src/policy/serialize.rs b/src/policy/serialize.rs index b324c772..1deceff0 100644 --- a/src/policy/serialize.rs +++ b/src/policy/serialize.rs @@ -314,7 +314,7 @@ mod tests { let sighash = env.c_tx_env().sighash_all(); let secp = secp256k1_zkp::Secp256k1::new(); let keypair = secp256k1_zkp::Keypair::new(&secp, &mut secp256k1_zkp::rand::rngs::OsRng); - let message = secp256k1_zkp::Message::from(sighash); + let message = secp256k1_zkp::Message::from_digest(sighash.to_byte_array()); let signature = keypair.sign_schnorr(message); let (xonly, _) = keypair.x_only_public_key(); From 92e09720deb24b52c80ed397678c9b7b17df0728 Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Thu, 26 Sep 2024 11:55:16 +0200 Subject: [PATCH 2/2] ci: avoid fail fast in toolchains tests --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b1a27ccf..3ca7b951 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,6 +48,7 @@ jobs: name: Tests runs-on: ubuntu-latest strategy: + fail-fast: false matrix: rust: - stable