diff --git a/Cargo.lock b/Cargo.lock index 1f19083f..cef152bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,12 +82,6 @@ version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" -[[package]] -name = "arraydeque" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" - [[package]] name = "async-trait" version = "0.1.89" @@ -133,9 +127,9 @@ dependencies = [ [[package]] name = "base16ct" -version = "0.2.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +checksum = "fd307490d624467aa6f74b0eabb77633d1f758a7b25f12bceb0b22e08d9726f6" [[package]] name = "base64ct" @@ -143,12 +137,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" -[[package]] -name = "binascii" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" - [[package]] name = "bitflags" version = "1.3.2" @@ -157,9 +145,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" [[package]] name = "bitvec" @@ -182,11 +170,20 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + [[package]] name = "blst" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fd49896f12ac9b6dcd7a5998466b9b58263a695a3dd1ecc1aaca2e12a90b080" +checksum = "c20659f9bbee16cbbd2f7393e40ab6309f5a98f76a2eb57a995ec508b72387fe" dependencies = [ "cc", "glob", @@ -200,6 +197,12 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" + [[package]] name = "bytes" version = "1.10.1" @@ -223,81 +226,54 @@ checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "chia-bls" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38840e8c8c5c6eb61304d85102230e74c2015c2bfb945292777f83f48915544c" -dependencies = [ - "blst", - "chia-sha2 0.28.2", - "chia-traits 0.28.2", - "hex", - "hkdf", - "linked-hash-map", - "sha2", - "thiserror 1.0.69", -] - -[[package]] -name = "chia-bls" -version = "0.30.0" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a74b1699d07115c71c081826608e3fb73f2aed94f9060fa09d074a95cfc93ab" +checksum = "a70dfe8540688eaed5bdecffd51c26df489b8bc610890b613b81461411f90cc9" dependencies = [ "blst", - "chia-sha2 0.30.0", - "chia-traits 0.30.0", + "chia-sha2 0.38.2", + "chia-traits", "hex", "hkdf", "linked-hash-map", - "sha2", + "sha2 0.10.9", "thiserror 1.0.69", ] [[package]] name = "chia-sha2" -version = "0.28.2" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f03c71bc63599a711caad15dafca1d2a948c26b4c8a021709a338149632769" +checksum = "5a57be484b5abb4481a3ea8b2e6fc0404f41222e0cfb35b81269c2404b64107a" dependencies = [ - "sha2", + "sha2 0.10.9", ] [[package]] name = "chia-sha2" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4114775b95f24b296047dc9c91e43834aa651c7c25bb2bbae05d23d79c9c777b" -dependencies = [ - "sha2", -] - -[[package]] -name = "chia-traits" -version = "0.28.2" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52463c56cdf35aac55ecb35ffc0a615f0780f33f144503957e83f5b1ad92da3c" +checksum = "0c1656e0ccea48df1e8ff87ff6859f15d83a6d8b8aa5972ab6b8b4bf727ebb2d" dependencies = [ - "chia-sha2 0.28.2", - "chia_streamable_macro 0.28.2", - "thiserror 1.0.69", + "sha2 0.10.9", ] [[package]] name = "chia-traits" -version = "0.30.0" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143545b13658929fce2e770a499fd4755f04a4d5f6459dc76a79068ae192a8c5" +checksum = "b13ea36e3ae5ede1d015d873fdfa91ea4d7a8790c6859c78b6b74065c7ddbbbd" dependencies = [ - "chia-sha2 0.30.0", - "chia_streamable_macro 0.30.0", + "chia-sha2 0.38.2", + "chia_streamable_macro", "thiserror 1.0.69", ] [[package]] name = "chia_streamable_macro" -version = "0.28.2" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b807a9c04440d3f30b5534b84b462b996b34eee7fe0b7f8737ae6dfc6b9d4" +checksum = "4450a65b83cd89f8ccad2b4d5f8dc23e89ab0b6ae86d8c535ffde9fdc9d9c6c5" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -305,48 +281,6 @@ dependencies = [ "syn", ] -[[package]] -name = "chia_streamable_macro" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bd4fbc3f05375c267ee4cb2a4a1bf8125fa0d817e57d7b141993c35994c751" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "chialisp" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa5f2217b8d1a7575ca7889a2f655294c02607cabfe9029e2ed8de13104edeca" -dependencies = [ - "binascii", - "chia-bls 0.30.0", - "clvmr", - "do-notation", - "getrandom 0.2.16", - "hashlink", - "hex", - "indoc", - "js-sys", - "lazy_static", - "num", - "num-bigint", - "num-traits", - "pyo3-build-config", - "regex", - "serde", - "serde_json", - "sha2", - "tempfile", - "unicode-segmentation", - "wasm-bindgen", - "yaml-rust2", -] - [[package]] name = "clap" version = "4.5.45" @@ -389,22 +323,22 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "clvm-traits" -version = "0.28.1" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e74489df9233fdf7605d79032fe18f808ff33d7e69a9932db4c96ffd0e50e9" +checksum = "b7ea3eeec6cc601989e4b59e4a447d9b73698808e99dc9836651d3d33dab9d72" dependencies = [ "clvmr", "num-bigint", - "thiserror 1.0.69", + "thiserror 2.0.14", ] [[package]] name = "clvm-utils" -version = "0.28.1" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce13549ac22902a1db76fe63e1a6417072f5242a8298fe5dcecc88f5cd13c997" +checksum = "106dd1d7de565c567c0b168b0e60c5c9203252ada4800caf26d7e98c19cc0bc0" dependencies = [ - "chia-sha2 0.28.2", + "chia-sha2 0.51.0", "clvm-traits", "clvmr", "hex", @@ -413,18 +347,20 @@ dependencies = [ [[package]] name = "clvmr" -version = "0.16.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf14f44f7c6b1d7972753cdd66f6afae38b117b752e6d1256b6f532dc3a0d304" +checksum = "9e13f0990d3f7f4e88d8f8a49a0082ecdd42de4f2e5206d571c02fac9519c649" dependencies = [ + "bitflags 2.13.2", "bitvec", "bumpalo", - "chia-bls 0.28.2", - "chia-sha2 0.28.2", + "chia-bls", + "chia-sha2 0.38.2", "hex", "hex-literal", "k256", "lazy_static", + "malachite-bigint", "num-bigint", "num-integer", "num-traits", @@ -432,9 +368,15 @@ dependencies = [ "rand", "sha1", "sha3", - "thiserror 1.0.69", + "thiserror 2.0.14", ] +[[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.4" @@ -462,9 +404,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.6" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" [[package]] name = "countme" @@ -472,6 +414,12 @@ version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" +[[package]] +name = "cpubits" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b85f9c39137c3a891689859392b1bd49812121d0d61c9caf00d46ed5ce06ae" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -481,14 +429,27 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + [[package]] name = "crypto-bigint" -version = "0.5.5" +version = "0.7.0-rc.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +checksum = "96dacf199529fb801ae62a9aafdc01b189e9504c0d1ee1512a4c16bcd8666a93" dependencies = [ - "generic-array", - "rand_core", + "cpubits", + "ctutils", + "getrandom 0.4.3", + "hybrid-array", + "num-traits", + "rand_core 0.10.1", "subtle", "zeroize", ] @@ -503,6 +464,27 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "getrandom 0.4.3", + "hybrid-array", + "rand_core 0.10.1", +] + +[[package]] +name = "ctutils" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574" +dependencies = [ + "cmov", + "subtle", +] + [[package]] name = "dashmap" version = "5.5.3" @@ -518,9 +500,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.10" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +checksum = "a878c850e9e421b20262e9b41f9c860e4785fa07541c266b62ff9d1ef998a80a" dependencies = [ "const-oid", "pem-rfc7468", @@ -554,12 +536,23 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", + "block-buffer 0.10.4", + "crypto-common 0.1.6", "subtle", ] +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.1", + "const-oid", + "crypto-common 0.2.2", + "ctutils", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -577,24 +570,19 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" -[[package]] -name = "do-notation" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e16a80c1dda2cf52fa07106427d3d798b6331dca8155fcb8c39f7fc78f6dd2" - [[package]] name = "ecdsa" -version = "0.16.9" +version = "0.17.0-rc.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +checksum = "91bbdd377139884fafcad8dc43a760a3e1e681aa26db910257fa6535b70e1829" dependencies = [ "der", - "digest", + "digest 0.11.3", "elliptic-curve", "rfc6979", "signature", "spki", + "zeroize", ] [[package]] @@ -605,33 +593,26 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "elliptic-curve" -version = "0.13.8" +version = "0.14.0-rc.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +checksum = "bde7860544606d222fd6bd6d9f9a0773321bf78072a637e1d560a058c0031978" dependencies = [ "base16ct", "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", + "crypto-common 0.2.2", + "digest 0.11.3", + "hybrid-array", + "once_cell", "pem-rfc7468", "pkcs8", - "rand_core", + "rand_core 0.10.1", + "rustcrypto-ff", + "rustcrypto-group", "sec1", "subtle", "zeroize", ] -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - [[package]] name = "env_filter" version = "0.1.3" @@ -661,16 +642,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" -[[package]] -name = "errno" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - [[package]] name = "expect-test" version = "1.5.1" @@ -681,27 +652,11 @@ dependencies = [ "once_cell", ] -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "ff" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" -dependencies = [ - "rand_core", - "subtle", -] - [[package]] name = "foldhash" -version = "0.1.5" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "form_urlencoded" @@ -809,32 +764,30 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", - "zeroize", ] [[package]] name = "getrandom" -version = "0.2.16" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", - "js-sys", "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "wasm-bindgen", + "r-efi 5.3.0", + "wasip2", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "r-efi 6.0.0", + "rand_core 0.10.1", ] [[package]] @@ -849,17 +802,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - [[package]] name = "hashbrown" version = "0.14.5" @@ -868,28 +810,13 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hashbrown" -version = "0.15.5" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ "foldhash", ] -[[package]] -name = "hashbrown" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" - -[[package]] -name = "hashlink" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" -dependencies = [ - "hashbrown 0.15.5", -] - [[package]] name = "heck" version = "0.5.0" @@ -920,7 +847,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ - "hmac", + "hmac 0.12.1", ] [[package]] @@ -929,7 +856,16 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest 0.11.3", ] [[package]] @@ -938,6 +874,17 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "hybrid-array" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3944cf8cf766b40e2a1a333ee5e9b563f854d5fa49d6a8ca2764e97c6eddb214" +dependencies = [ + "subtle", + "typenum", + "zeroize", +] + [[package]] name = "icu_collections" version = "2.0.0" @@ -1077,22 +1024,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", - "hashbrown 0.16.0", + "hashbrown 0.16.1", ] -[[package]] -name = "indoc" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" - [[package]] name = "io-uring" version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.13.2", "cfg-if", "libc", ] @@ -1142,27 +1083,16 @@ dependencies = [ "syn", ] -[[package]] -name = "js-sys" -version = "0.3.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6247da8b8658ad4e73a186e747fcc5fc2a29f979d6fe6269127fdb5fd08298d0" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - [[package]] name = "k256" -version = "0.13.4" +version = "0.14.0-rc.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +checksum = "83da23da11f0b5db6f23d9280a84b3a33a746aa43ebb9270d6b445991da9cee3" dependencies = [ - "cfg-if", + "cpubits", "ecdsa", "elliptic-curve", - "once_cell", - "sha2", + "sha2 0.11.0", "signature", ] @@ -1172,7 +1102,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] @@ -1187,6 +1117,12 @@ version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + [[package]] name = "libyml" version = "0.0.5" @@ -1203,12 +1139,6 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" -[[package]] -name = "linux-raw-sys" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" - [[package]] name = "litemap" version = "0.8.0" @@ -1244,6 +1174,43 @@ dependencies = [ "url", ] +[[package]] +name = "malachite-base" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f44099731f17094b07825c88ccb5fbd1bfa1f82fafff7daa33e8b8652db16e" +dependencies = [ + "hashbrown 0.16.1", + "itertools", + "libm", + "ryu", +] + +[[package]] +name = "malachite-bigint" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc58206ba15e9c406e20c95c5f86efa07b12f94080945908e910b3a0faa23fef" +dependencies = [ + "malachite-base", + "malachite-nz", + "num-integer", + "num-traits", + "paste", +] + +[[package]] +name = "malachite-nz" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a137660cdba20f136c8a223125f08088adb4e0b72fbb8466f08c43e31cc0427d" +dependencies = [ + "itertools", + "libm", + "malachite-base", + "wide", +] + [[package]] name = "memchr" version = "2.7.5" @@ -1266,24 +1233,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", - "wasi 0.11.1+wasi-snapshot-preview1", + "wasi", "windows-sys 0.59.0", ] -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - [[package]] name = "num-bigint" version = "0.4.6" @@ -1292,16 +1245,6 @@ checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", - "serde", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", ] [[package]] @@ -1324,28 +1267,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1388,14 +1309,15 @@ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "p256" -version = "0.13.2" +version = "0.14.0-rc.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +checksum = "018bfbb86e05fd70a83e985921241035ee09fcd369c4a2c3680b389a01d2ad28" dependencies = [ "ecdsa", "elliptic-curve", + "primefield", "primeorder", - "sha2", + "sha2 0.11.0", ] [[package]] @@ -1429,9 +1351,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pem-rfc7468" -version = "0.7.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" dependencies = [ "base64ct", ] @@ -1476,9 +1398,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7" dependencies = [ "der", "spki", @@ -1517,11 +1439,25 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "primefield" +version = "0.14.0-rc.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93401c13cc7ff24684571cfca9d3cf9ebabfaf3d4b7b9963ade41ec54da196b5" +dependencies = [ + "crypto-bigint", + "crypto-common 0.2.2", + "rand_core 0.10.1", + "rustcrypto-ff", + "subtle", + "zeroize", +] + [[package]] name = "primeorder" -version = "0.13.6" +version = "0.14.0-rc.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +checksum = "a0c5c8a39bcd764bfedf456e8d55e115fe86dda3e0f555371849f2a41cbc9706" dependencies = [ "elliptic-curve", ] @@ -1554,16 +1490,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "pyo3-build-config" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99636d423fa2ca130fa5acde3059308006d46f98caac629418e53f7ebb1e9999" -dependencies = [ - "once_cell", - "target-lexicon", -] - [[package]] name = "quote" version = "1.0.40" @@ -1579,6 +1505,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "radium" version = "0.7.0" @@ -1587,41 +1519,46 @@ checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] name = "rand" -version = "0.8.5" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ - "libc", "rand_chacha", - "rand_core", + "rand_core 0.9.5", ] [[package]] name = "rand_chacha" -version = "0.3.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.5", ] [[package]] name = "rand_core" -version = "0.6.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "redox_syscall" version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.13.2", ] [[package]] @@ -1661,11 +1598,11 @@ checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" [[package]] name = "rfc6979" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +checksum = "5236ce872cac07e0fb3969b0cbf468c7d2f37d432f1b627dcb7b8d34563fb0c3" dependencies = [ - "hmac", + "hmac 0.13.0", "subtle", ] @@ -1712,7 +1649,7 @@ dependencies = [ [[package]] name = "rue-ast" -version = "0.10.0" +version = "0.11.0" dependencies = [ "num-traits", "paste", @@ -1721,16 +1658,16 @@ dependencies = [ [[package]] name = "rue-cli" -version = "0.10.0" +version = "0.11.0" dependencies = [ "anyhow", - "chialisp", "clap", "clvm-utils", "clvmr", "colored", "glob", "hex", + "rue-clvm", "rue-compiler", "rue-diagnostic", "rue-formatter", @@ -1740,9 +1677,19 @@ dependencies = [ "walkdir", ] +[[package]] +name = "rue-clvm" +version = "0.11.0" +dependencies = [ + "clvmr", + "hex", + "num-bigint", + "thiserror 2.0.14", +] + [[package]] name = "rue-compiler" -version = "0.10.0" +version = "0.11.0" dependencies = [ "clvmr", "expect-test", @@ -1767,14 +1714,14 @@ dependencies = [ [[package]] name = "rue-diagnostic" -version = "0.10.0" +version = "0.11.0" dependencies = [ "thiserror 2.0.14", ] [[package]] name = "rue-formatter" -version = "0.10.0" +version = "0.11.0" dependencies = [ "expect-test", "rowan", @@ -1788,7 +1735,7 @@ dependencies = [ [[package]] name = "rue-hir" -version = "0.10.0" +version = "0.11.0" dependencies = [ "derive_more", "expect-test", @@ -1805,16 +1752,15 @@ dependencies = [ [[package]] name = "rue-lexer" -version = "0.10.0" +version = "0.11.0" dependencies = [ "expect-test", ] [[package]] name = "rue-lir" -version = "0.10.0" +version = "0.11.0" dependencies = [ - "chialisp", "clvm-traits", "clvmr", "colored", @@ -1822,14 +1768,15 @@ dependencies = [ "id-arena", "num-bigint", "num-integer", - "sha2", + "rue-clvm", + "sha2 0.10.9", "sha3", "thiserror 2.0.14", ] [[package]] name = "rue-lsp" -version = "0.10.0" +version = "0.11.0" dependencies = [ "indexmap", "rowan", @@ -1846,7 +1793,7 @@ dependencies = [ [[package]] name = "rue-options" -version = "0.10.0" +version = "0.11.0" dependencies = [ "serde", "thiserror 2.0.14", @@ -1855,7 +1802,7 @@ dependencies = [ [[package]] name = "rue-parser" -version = "0.10.0" +version = "0.11.0" dependencies = [ "derive_more", "expect-test", @@ -1870,13 +1817,13 @@ dependencies = [ [[package]] name = "rue-tests" -version = "0.10.0" +version = "0.11.0" dependencies = [ "anyhow", - "chialisp", "clvmr", "env_logger", "indexmap", + "rue-clvm", "rue-compiler", "rue-diagnostic", "rue-formatter", @@ -1888,7 +1835,7 @@ dependencies = [ [[package]] name = "rue-types" -version = "0.10.0" +version = "0.11.0" dependencies = [ "clvmr", "derive_more", @@ -1903,11 +1850,11 @@ dependencies = [ [[package]] name = "rue-wasm" -version = "0.10.0" +version = "0.11.0" dependencies = [ - "chialisp", "clvmr", "console_error_panic_hook", + "rue-clvm", "rue-compiler", "rue-diagnostic", "rue-options", @@ -1936,16 +1883,24 @@ dependencies = [ ] [[package]] -name = "rustix" -version = "1.0.8" +name = "rustcrypto-ff" +version = "0.14.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" +checksum = "fd2a8adb347447693cd2ba0d218c4b66c62da9b0a5672b17b981e4291ec65ff6" dependencies = [ - "bitflags 2.9.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.60.2", + "rand_core 0.10.1", + "subtle", +] + +[[package]] +name = "rustcrypto-group" +version = "0.14.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "369f9b61aa45933c062c9f6b5c3c50ab710687eca83dd3802653b140b43f85ed" +dependencies = [ + "rand_core 0.10.1", + "rustcrypto-ff", + "subtle", ] [[package]] @@ -1956,9 +1911,18 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "safe_arch" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "42c6efa15875e6ecb39ca61fb0b0c1a40b84fac5a5ffe71eef7d1000c8eb3f5f" +dependencies = [ + "bytemuck", +] [[package]] name = "same-file" @@ -1977,14 +1941,14 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sec1" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +checksum = "d56d437c2f19203ce5f7122e507831de96f3d2d4d3be5af44a0b0a09d8a80e4d" dependencies = [ "base16ct", + "ctutils", "der", - "generic-array", - "pkcs8", + "hybrid-array", "subtle", "zeroize", ] @@ -2085,8 +2049,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", ] [[package]] @@ -2096,8 +2060,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest 0.11.3", ] [[package]] @@ -2106,7 +2081,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] @@ -2127,12 +2102,12 @@ dependencies = [ [[package]] name = "signature" -version = "2.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5" dependencies = [ - "digest", - "rand_core", + "digest 0.11.3", + "rand_core 0.10.1", ] [[package]] @@ -2159,9 +2134,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +checksum = "7ef958a98b9d5da290cfc78946e9f3e61e1e62a18db0d92cac0b83cc161491a9" dependencies = [ "base64ct", "der", @@ -2213,25 +2188,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "target-lexicon" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" - -[[package]] -name = "tempfile" -version = "3.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" -dependencies = [ - "fastrand", - "getrandom 0.3.3", - "once_cell", - "rustix", - "windows-sys 0.60.2", -] - [[package]] name = "text-size" version = "1.1.1" @@ -2511,12 +2467,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - [[package]] name = "unicode-xid" version = "0.2.6" @@ -2570,12 +2520,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" +name = "wasip2" +version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ - "wit-bindgen-rt", + "wit-bindgen", ] [[package]] @@ -2587,8 +2537,6 @@ dependencies = [ "cfg-if", "once_cell", "rustversion", - "serde", - "serde_json", "wasm-bindgen-macro", "wasm-bindgen-shared", ] @@ -2639,6 +2587,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wide" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d920ac99c3c8edce110cb8d07dbb324d6d026011dce85b1e9355b70f0adacc4f" +dependencies = [ + "bytemuck", + "safe_arch", +] + [[package]] name = "winapi-util" version = "0.1.11" @@ -2820,13 +2778,10 @@ dependencies = [ ] [[package]] -name = "wit-bindgen-rt" -version = "0.39.0" +name = "wit-bindgen" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.9.1", -] +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "writeable" @@ -2843,17 +2798,6 @@ dependencies = [ "tap", ] -[[package]] -name = "yaml-rust2" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ce2a4ff45552406d02501cea6c18d8a7e50228e7736a872951fe2fe75c91be7" -dependencies = [ - "arraydeque", - "encoding_rs", - "hashlink", -] - [[package]] name = "yoke" version = "0.8.0" diff --git a/Cargo.toml b/Cargo.toml index d8995ae9..feb4299d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,20 +43,21 @@ case_sensitive_file_extension_comparisons = "allow" wildcard_imports = "allow" [workspace.dependencies] -rue-lexer = { path = "crates/rue-lexer", version = "0.10.0" } -rue-parser = { path = "crates/rue-parser", version = "0.10.0" } -rue-diagnostic = { path = "crates/rue-diagnostic", version = "0.10.0" } -rue-ast = { path = "crates/rue-ast", version = "0.10.0" } -rue-formatter = { path = "crates/rue-formatter", version = "0.10.0" } -rue-compiler = { path = "crates/rue-compiler", version = "0.10.0" } -rue-options = { path = "crates/rue-options", version = "0.10.0" } -rue-lir = { path = "crates/rue-lir", version = "0.10.0" } -rue-hir = { path = "crates/rue-hir", version = "0.10.0" } -rue-types = { path = "crates/rue-types", version = "0.10.0" } +rue-lexer = { path = "crates/rue-lexer", version = "0.11.0" } +rue-parser = { path = "crates/rue-parser", version = "0.11.0" } +rue-diagnostic = { path = "crates/rue-diagnostic", version = "0.11.0" } +rue-ast = { path = "crates/rue-ast", version = "0.11.0" } +rue-formatter = { path = "crates/rue-formatter", version = "0.11.0" } +rue-compiler = { path = "crates/rue-compiler", version = "0.11.0" } +rue-options = { path = "crates/rue-options", version = "0.11.0" } +rue-lir = { path = "crates/rue-lir", version = "0.11.0" } +rue-hir = { path = "crates/rue-hir", version = "0.11.0" } +rue-types = { path = "crates/rue-types", version = "0.11.0" } +rue-clvm = { path = "crates/rue-clvm", version = "0.11.0" } anyhow = "1.0.98" -clvm-traits = "0.28.1" -clvm-utils = "0.28.1" -clvmr = "0.16.0" +clvm-traits = "0.51.0" +clvm-utils = "0.51.0" +clvmr = "0.21.0" derive_more = "2.0.1" expect-test = "1.5.1" id-arena = "2.2.1" @@ -86,6 +87,5 @@ tokio = "1.47.1" tower-lsp = "0.20.0" colored = "3.0.0" send_wrapper = "0.6.0" -chialisp = "0.4.1" toml = "0.9.8" include_dir = "0.7.4" diff --git a/crates/rue-ast/Cargo.toml b/crates/rue-ast/Cargo.toml index 6a7b7aff..aafaa70b 100644 --- a/crates/rue-ast/Cargo.toml +++ b/crates/rue-ast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-ast" -version = "0.10.0" +version = "0.11.0" edition = "2024" license = "Apache-2.0" description = "An implementation of the Abstract Syntax Tree for the Rue compiler." diff --git a/crates/rue-cli/Cargo.toml b/crates/rue-cli/Cargo.toml index 0d188ce7..78608f0c 100644 --- a/crates/rue-cli/Cargo.toml +++ b/crates/rue-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-cli" -version = "0.10.0" +version = "0.11.0" edition = "2024" license = "Apache-2.0" description = "A CLI tool for invoking the Rue compiler." @@ -26,7 +26,7 @@ rue-diagnostic = { workspace = true } rue-lir = { workspace = true } clvmr = { workspace = true } clvm-utils = { workspace = true } -chialisp = { workspace = true } +rue-clvm = { workspace = true } clap = { workspace = true, features = ["derive"] } anyhow = { workspace = true } hex = { workspace = true } diff --git a/crates/rue-cli/src/main.rs b/crates/rue-cli/src/main.rs index 19ef0435..ed92a38e 100644 --- a/crates/rue-cli/src/main.rs +++ b/crates/rue-cli/src/main.rs @@ -6,19 +6,19 @@ use std::{ }; use anyhow::Result; -use chialisp::classic::clvm_tools::binutils::{assemble, disassemble}; use clap::Parser; use clvm_utils::tree_hash; use clvmr::{ - Allocator, ENABLE_KECCAK_OPS_OUTSIDE_GUARD, MEMPOOL_MODE, NodePtr, SExp, + Allocator, NodePtr, SExp, error::EvalErr, run_program, serde::{node_from_bytes, node_to_bytes}, }; use colored::Colorize; +use rue_clvm::{assemble, disassemble_program, disassemble_value}; use rue_compiler::{Compiler, FileTree, normalize_path}; use rue_diagnostic::{DiagnosticSeverity, SourceKind}; -use rue_lir::DebugDialect; +use rue_lir::{CLVM_FLAGS, DebugDialect}; use rue_options::{Manifest, find_project}; mod fmt; @@ -371,7 +371,7 @@ fn build(args: BuildArgs) -> Result<()> { } if !args.hex && !args.hash { - println!("{}", disassemble(&allocator, program, None)); + println!("{}", disassemble_program(&allocator, program)); } } @@ -437,7 +437,7 @@ fn test(args: TestArgs) -> Result<()> { match run_program( &mut allocator, - &DebugDialect::new(ENABLE_KECCAK_OPS_OUTSIDE_GUARD | MEMPOOL_MODE, true), + &DebugDialect::new(CLVM_FLAGS, true), test.ptr, NodePtr::NIL, u64::MAX, @@ -458,7 +458,7 @@ fn test(args: TestArgs) -> Result<()> { "{}", format!( "Test failed due to raise: {}", - disassemble(&allocator, error, None) + disassemble_value(&allocator, error) ) .red() .bold() @@ -506,14 +506,14 @@ fn debug(args: DebugArgs) -> Result<()> { let output = run_program( &mut allocator, - &DebugDialect::new(ENABLE_KECCAK_OPS_OUTSIDE_GUARD | MEMPOOL_MODE, true), + &DebugDialect::new(CLVM_FLAGS, true), program, solution, u64::MAX, )? .1; - let output = disassemble(&allocator, output, None); + let output = disassemble_value(&allocator, output); println!("{output}"); diff --git a/crates/rue-clvm/Cargo.toml b/crates/rue-clvm/Cargo.toml new file mode 100644 index 00000000..fb3d21a0 --- /dev/null +++ b/crates/rue-clvm/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "rue-clvm" +version = "0.11.0" +edition = "2024" +license = "Apache-2.0" +description = "Converts CLVM values to and from their textual representation." +authors = ["Brandon Haggstrom "] +homepage = "https://github.com/xch-dev/rue" +repository = "https://github.com/xch-dev/rue" +readme = { workspace = true } +keywords = { workspace = true } +categories = { workspace = true } + +[lints] +workspace = true + +[dependencies] +clvmr = { workspace = true } +num-bigint = { workspace = true } +hex = { workspace = true } +thiserror = { workspace = true } diff --git a/crates/rue-clvm/src/assemble.rs b/crates/rue-clvm/src/assemble.rs new file mode 100644 index 00000000..473a2c23 --- /dev/null +++ b/crates/rue-clvm/src/assemble.rs @@ -0,0 +1,330 @@ +use clvmr::{Allocator, NodePtr, error::EvalErr}; +use num_bigint::BigInt; +use thiserror::Error; + +use crate::operator_atom; + +#[derive(Debug, Error)] +pub enum AssembleError { + #[error("unterminated string starting at {0}")] + UnterminatedString(usize), + + #[error("missing `)` for list starting at {0}")] + UnclosedList(usize), + + #[error("unexpected `{1}` at {0}")] + Unexpected(usize, char), + + #[error("expected a value after `.` at {0}")] + MissingTail(usize), + + #[error("expected `)` after the tail of the list at {0}")] + ExpectedListEnd(usize), + + #[error("invalid number `{1}` at {0}")] + InvalidNumber(usize, String), + + #[error("invalid hex `{1}` at {0}")] + InvalidHex(usize, String), + + #[error(transparent)] + Eval(#[from] EvalErr), +} + +/// Parses the textual representation of a CLVM program or value. +/// +/// The text must contain at most one value, optionally surrounded by whitespace and `;` +/// comments. Empty text is parsed as nil. +pub fn assemble(allocator: &mut Allocator, text: &str) -> Result { + let mut reader = Reader { + allocator, + text: text.as_bytes(), + pos: 0, + }; + + reader.skip_whitespace(); + + if reader.peek().is_none() { + return Ok(NodePtr::NIL); + } + + let node = reader.read_value()?; + + reader.skip_whitespace(); + + if let Some(byte) = reader.peek() { + return Err(AssembleError::Unexpected(reader.pos, byte as char)); + } + + Ok(node) +} + +struct Reader<'a> { + allocator: &'a mut Allocator, + text: &'a [u8], + pos: usize, +} + +impl Reader<'_> { + fn peek(&self) -> Option { + self.text.get(self.pos).copied() + } + + fn skip_whitespace(&mut self) { + while let Some(byte) = self.peek() { + if byte == b';' { + while self.peek().is_some_and(|byte| !is_eol(byte)) { + self.pos += 1; + } + } else if is_space(byte) { + self.pos += 1; + } else { + break; + } + } + } + + /// Reads a value, which must start at the current position. + fn read_value(&mut self) -> Result { + match self.peek() { + Some(b'(') => self.read_list(), + Some(b'"' | b'\'') => self.read_string(), + Some(byte @ b')') => Err(AssembleError::Unexpected(self.pos, byte as char)), + _ => self.read_atom(), + } + } + + fn read_list(&mut self) -> Result { + let start = self.pos; + self.pos += 1; + + let mut items = Vec::new(); + + let tail = loop { + self.skip_whitespace(); + + match self.peek() { + None => return Err(AssembleError::UnclosedList(start)), + Some(b')') => { + self.pos += 1; + break NodePtr::NIL; + } + Some(b'.') if self.is_delimiter(self.pos + 1) => { + let dot = self.pos; + + if items.is_empty() { + return Err(AssembleError::Unexpected(dot, '.')); + } + + self.pos += 1; + self.skip_whitespace(); + + if matches!(self.peek(), None | Some(b')')) { + return Err(AssembleError::MissingTail(dot)); + } + + let tail = self.read_value()?; + self.skip_whitespace(); + + match self.peek() { + Some(b')') => self.pos += 1, + None => return Err(AssembleError::UnclosedList(start)), + Some(_) => return Err(AssembleError::ExpectedListEnd(self.pos)), + } + + break tail; + } + Some(_) => items.push(self.read_value()?), + } + }; + + let mut list = tail; + for item in items.into_iter().rev() { + list = self.allocator.new_pair(item, list)?; + } + Ok(list) + } + + /// Reads a quoted string. A backslash includes the next character literally. + fn read_string(&mut self) -> Result { + let start = self.pos; + let quote = self.text[start]; + self.pos += 1; + + let mut bytes = Vec::new(); + + loop { + let Some(byte) = self.peek() else { + return Err(AssembleError::UnterminatedString(start)); + }; + self.pos += 1; + + if byte == quote { + break; + } + + if byte == b'\\' { + let Some(escaped) = self.peek() else { + return Err(AssembleError::UnterminatedString(start)); + }; + self.pos += 1; + bytes.push(escaped); + } else { + bytes.push(byte); + } + } + + Ok(self.allocator.new_atom(&bytes)?) + } + + fn read_atom(&mut self) -> Result { + let start = self.pos; + + while !self.is_delimiter(self.pos) { + self.pos += 1; + } + + // Tokens only end at ASCII bytes, so they are always valid UTF-8. + let token = std::str::from_utf8(&self.text[start..self.pos]).expect("valid UTF-8"); + let atom = atom_from_token(start, token)?; + Ok(self.allocator.new_atom(&atom)?) + } + + fn is_delimiter(&self, pos: usize) -> bool { + self.text + .get(pos) + .is_none_or(|&byte| matches!(byte, b'(' | b')' | b';') || is_space(byte)) + } +} + +fn atom_from_token(pos: usize, token: &str) -> Result, AssembleError> { + if let Some(digits) = token + .strip_prefix("0x") + .or_else(|| token.strip_prefix("0X")) + { + let padded = if digits.len() % 2 == 1 { + format!("0{digits}") + } else { + digits.to_string() + }; + return hex::decode(padded).map_err(|_| AssembleError::InvalidHex(pos, token.to_string())); + } + + let unsigned = token.strip_prefix(['-', '+']).unwrap_or(token); + + if unsigned.starts_with(|char: char| char.is_ascii_digit()) { + if !unsigned.bytes().all(|byte| byte.is_ascii_digit()) { + return Err(AssembleError::InvalidNumber(pos, token.to_string())); + } + let number: BigInt = token.parse().expect("valid integer"); + return Ok(int_atom(&number)); + } + + Ok(match operator_atom(token) { + Some(atom) => atom.to_vec(), + None => token.as_bytes().to_vec(), + }) +} + +/// Encodes an integer as its minimal signed representation, where zero is nil. +fn int_atom(number: &BigInt) -> Vec { + if number.sign() == num_bigint::Sign::NoSign { + Vec::new() + } else { + number.to_signed_bytes_be() + } +} + +fn is_eol(byte: u8) -> bool { + byte == b'\r' || byte == b'\n' +} + +fn is_space(byte: u8) -> bool { + byte == b' ' || byte == b'\t' || is_eol(byte) +} + +#[cfg(test)] +mod tests { + use clvmr::SExp; + + use crate::disassemble_value; + + use super::*; + + fn atom(text: &str) -> Vec { + let mut a = Allocator::new(); + let node = assemble(&mut a, text).unwrap(); + assert!(matches!(a.sexp(node), SExp::Atom), "{text} is not an atom"); + a.atom(node).as_ref().to_vec() + } + + fn value(text: &str) -> String { + let mut a = Allocator::new(); + let node = assemble(&mut a, text).unwrap(); + disassemble_value(&a, node) + } + + #[test] + fn test_atoms() { + assert_eq!(atom(""), b""); + assert_eq!(atom(" ; comment"), b""); + assert_eq!(atom("()"), b""); + assert_eq!(atom("0"), b""); + assert_eq!(atom("-0"), b""); + assert_eq!(atom("+5"), [0x05]); + assert_eq!(atom("1"), [0x01]); + assert_eq!(atom("128"), [0x00, 0x80]); + assert_eq!(atom("-1"), [0xff]); + assert_eq!(atom("-129"), [0xff, 0x7f]); + assert_eq!(atom("0x"), b""); + assert_eq!(atom("0x00"), [0x00]); + assert_eq!(atom("0xabc"), [0x0a, 0xbc]); + assert_eq!(atom("0XAB"), [0xab]); + assert_eq!(atom("hello"), b"hello"); + assert_eq!(atom("-"), [0x11]); + assert_eq!(atom("q"), [0x01]); + assert_eq!(atom("#a"), b"#a"); + assert_eq!(atom("secp256k1_verify"), [0x13, 0xd6, 0x1f, 0x00]); + assert_eq!(atom("\"a b\""), b"a b"); + assert_eq!(atom("'say \"hi\"'"), b"say \"hi\""); + assert_eq!(atom(r#""a\"b\\c\n""#), b"a\"b\\cn"); + assert_eq!(atom(" ; comment\n 5 ; another\n"), [0x05]); + } + + #[test] + fn test_lists() { + assert_eq!(value("(a (q . 1) ; comment\n 1)"), "(2 (1 . 1) 1)"); + assert_eq!(value("(1 2 . 3)"), "(1 2 . 3)"); + assert_eq!(value("(1 . (2 . ()))"), "(1 2)"); + assert_eq!(value("(\"abc\"\"def\")"), "(\"abc\" \"def\")"); + assert_eq!(value("(a;comment\nb)"), "(2 98)"); + assert_eq!(value("(.50 . .xy)"), "(\".50\" . \".xy\")"); + } + + #[test] + fn test_errors() { + let mut a = Allocator::new(); + + for text in [ + "(", + "(1 2", + "(1 . 2 3)", + "(1 .", + "(1 . )", + "(1 . 2", + "(. 1)", + ")", + "1 2", + "(1) )", + "\"abc", + "(\"abc", + "'a\\", + "1abc", + "-1x", + "1_000", + "0xzz", + ] { + assert!(assemble(&mut a, text).is_err(), "{text} should fail"); + } + } +} diff --git a/crates/rue-clvm/src/disassemble.rs b/crates/rue-clvm/src/disassemble.rs new file mode 100644 index 00000000..6de0bae0 --- /dev/null +++ b/crates/rue-clvm/src/disassemble.rs @@ -0,0 +1,210 @@ +use clvmr::{Allocator, NodePtr, SExp}; +use num_bigint::BigInt; + +use crate::operator_name; + +/// The largest atom that is written as a decimal integer. Larger atoms are usually hashes or +/// keys rather than numbers, so they are written as hex instead. +const MAX_DECIMAL_LEN: usize = 8; + +/// The shortest atom that is written as a string. Shorter atoms are usually small integers. +const MIN_STRING_LEN: usize = 3; + +type WriteFn = fn(&Allocator, NodePtr, &mut String); + +/// Converts a CLVM program to its textual representation. +/// +/// The first item of every list is written as an operator keyword where possible. This includes +/// quoted values, since programs often quote code to run later. +pub fn disassemble_program(allocator: &Allocator, node: NodePtr) -> String { + let mut output = String::new(); + write_program(allocator, node, &mut output); + output +} + +/// Converts a CLVM value to its textual representation, without any operator keywords. +pub fn disassemble_value(allocator: &Allocator, node: NodePtr) -> String { + let mut output = String::new(); + write_value(allocator, node, &mut output); + output +} + +fn write_program(allocator: &Allocator, node: NodePtr, output: &mut String) { + let SExp::Pair(operator, args) = allocator.sexp(node) else { + write_atom(allocator.atom(node).as_ref(), output); + return; + }; + + let name = match allocator.sexp(operator) { + SExp::Atom => operator_name(allocator.atom(operator).as_ref()), + SExp::Pair(..) => None, + }; + + output.push('('); + + match name { + Some(name) => output.push_str(name), + None => write_program(allocator, operator, output), + } + + write_rest(allocator, args, write_program, output); +} + +fn write_value(allocator: &Allocator, node: NodePtr, output: &mut String) { + let SExp::Pair(first, rest) = allocator.sexp(node) else { + write_atom(allocator.atom(node).as_ref(), output); + return; + }; + + output.push('('); + write_value(allocator, first, output); + write_rest(allocator, rest, write_value, output); +} + +/// Writes the items after the first in a list, then the closing parenthesis. +fn write_rest(allocator: &Allocator, mut rest: NodePtr, write_item: WriteFn, output: &mut String) { + loop { + match allocator.sexp(rest) { + SExp::Pair(item, next) => { + output.push(' '); + write_item(allocator, item, output); + rest = next; + } + SExp::Atom => { + if !allocator.atom(rest).as_ref().is_empty() { + output.push_str(" . "); + write_item(allocator, rest, output); + } + break; + } + } + } + + output.push(')'); +} + +fn write_atom(atom: &[u8], output: &mut String) { + if atom.is_empty() { + output.push_str("()"); + } else if atom.len() >= MIN_STRING_LEN && is_printable(atom) { + output.push('"'); + for &byte in atom { + if byte == b'"' || byte == b'\\' { + output.push('\\'); + } + output.push(byte as char); + } + output.push('"'); + } else if atom.len() <= MAX_DECIMAL_LEN && is_canonical_int(atom) { + output.push_str(&BigInt::from_signed_bytes_be(atom).to_string()); + } else { + output.push_str("0x"); + output.push_str(&hex::encode(atom)); + } +} + +fn is_printable(atom: &[u8]) -> bool { + atom.iter() + .all(|&byte| byte == b' ' || byte.is_ascii_graphic()) +} + +/// Whether an atom is the minimal encoding of a signed integer. Zero is encoded as nil, so a +/// lone zero byte is not canonical. +fn is_canonical_int(atom: &[u8]) -> bool { + match atom { + [] | [0x00] => false, + [0x00, second, ..] => second & 0x80 != 0, + [0xff, second, ..] => second & 0x80 == 0, + _ => true, + } +} + +#[cfg(test)] +mod tests { + use crate::assemble; + + use super::*; + + #[test] + fn test_atoms() { + let mut a = Allocator::new(); + + let cases: &[(&[u8], &str)] = &[ + (&[], "()"), + (&[0x01], "1"), + (&[0x7f], "127"), + (&[0x80], "-128"), + (&[0xff], "-1"), + (&[0x00], "0x00"), + (&[0x00, 0x80], "128"), + (&[0x00, 0x7f], "0x007f"), + (&[0xff, 0x7f], "-129"), + (&[0xff, 0x80], "0xff80"), + (&[0x0f, 0x42, 0x40], "1000000"), + ( + &[0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff], + "9223372036854775807", + ), + ( + &[0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], + "0x008000000000000000", + ), + (b"hi", "26729"), + (b"abc", "\"abc\""), + (b"a\"b", "\"a\\\"b\""), + (b"a\\b", "\"a\\\\b\""), + (b"a\nb", "6359650"), + (&[0x00, 0x0a, 0x62], "0x000a62"), + (&[0x13, 0xd6, 0x1f, 0x00], "332799744"), + ]; + + for (atom, expected) in cases { + let node = a.new_atom(atom).unwrap(); + assert_eq!(disassemble_value(&a, node), *expected); + assert_eq!(disassemble_program(&a, node), *expected); + } + } + + #[test] + fn test_program() { + let mut a = Allocator::new(); + + let cases = [ + ("(2 (1 . 1) 1)", "(a (q . 1) 1)"), + ("(2 (1 2 3) 1)", "(a (q 2 3) 1)"), + ("(1 (2 3) . 4)", "(q (a 3) . 4)"), + ( + "(3 (9 2 5) (1 . 100) (1 . 200))", + "(i (= 2 5) (q . 100) (q . 200))", + ), + ("(64 2 3)", "(64 2 3)"), + ("((4 2 3) 2)", "((c 2 3) 2)"), + ("(\"debug_print\" 2)", "(\"debug_print\" 2)"), + ]; + + for (input, expected) in cases { + let node = assemble(&mut a, input).unwrap(); + assert_eq!(disassemble_program(&a, node), expected); + } + } + + #[test] + fn test_value() { + let mut a = Allocator::new(); + let node = assemble(&mut a, "(2 (1 . 1) 3 . 4)").unwrap(); + assert_eq!(disassemble_value(&a, node), "(2 (1 . 1) 3 . 4)"); + } + + #[test] + fn test_long_list() { + let mut a = Allocator::new(); + let mut list = NodePtr::NIL; + for _ in 0..100_000 { + let item = a.new_small_number(2).unwrap(); + list = a.new_pair(item, list).unwrap(); + } + let output = disassemble_program(&a, list); + assert!(output.starts_with("(a 2 2")); + assert!(output.ends_with(" 2)")); + } +} diff --git a/crates/rue-clvm/src/lib.rs b/crates/rue-clvm/src/lib.rs new file mode 100644 index 00000000..d23b6dd9 --- /dev/null +++ b/crates/rue-clvm/src/lib.rs @@ -0,0 +1,7 @@ +mod assemble; +mod disassemble; +mod operators; + +pub use assemble::*; +pub use disassemble::*; +pub use operators::*; diff --git a/crates/rue-clvm/src/operators.rs b/crates/rue-clvm/src/operators.rs new file mode 100644 index 00000000..75e8a52c --- /dev/null +++ b/crates/rue-clvm/src/operators.rs @@ -0,0 +1,66 @@ +/// The atom and name of every CLVM operator that has a textual keyword. +pub const OPERATORS: &[(&[u8], &str)] = &[ + (&[0x01], "q"), + (&[0x02], "a"), + (&[0x03], "i"), + (&[0x04], "c"), + (&[0x05], "f"), + (&[0x06], "r"), + (&[0x07], "l"), + (&[0x08], "x"), + (&[0x09], "="), + (&[0x0a], ">s"), + (&[0x0b], "sha256"), + (&[0x0c], "substr"), + (&[0x0d], "strlen"), + (&[0x0e], "concat"), + (&[0x10], "+"), + (&[0x11], "-"), + (&[0x12], "*"), + (&[0x13], "/"), + (&[0x14], "divmod"), + (&[0x15], ">"), + (&[0x16], "ash"), + (&[0x17], "lsh"), + (&[0x18], "logand"), + (&[0x19], "logior"), + (&[0x1a], "logxor"), + (&[0x1b], "lognot"), + (&[0x1d], "point_add"), + (&[0x1e], "pubkey_for_exp"), + (&[0x20], "not"), + (&[0x21], "any"), + (&[0x22], "all"), + (&[0x24], "softfork"), + (&[0x30], "coinid"), + (&[0x31], "g1_subtract"), + (&[0x32], "g1_multiply"), + (&[0x33], "g1_negate"), + (&[0x34], "g2_add"), + (&[0x35], "g2_subtract"), + (&[0x36], "g2_multiply"), + (&[0x37], "g2_negate"), + (&[0x38], "g1_map"), + (&[0x39], "g2_map"), + (&[0x3a], "bls_pairing_identity"), + (&[0x3b], "bls_verify"), + (&[0x3c], "modpow"), + (&[0x3d], "%"), + (&[0x3e], "keccak256"), + (&[0x13, 0xd6, 0x1f, 0x00], "secp256k1_verify"), + (&[0x1c, 0x3a, 0x8f, 0x00], "secp256r1_verify"), +]; + +pub fn operator_name(atom: &[u8]) -> Option<&'static str> { + OPERATORS + .iter() + .find(|(value, _)| *value == atom) + .map(|(_, name)| *name) +} + +pub fn operator_atom(name: &str) -> Option<&'static [u8]> { + OPERATORS + .iter() + .find(|(_, value)| *value == name) + .map(|(atom, _)| *atom) +} diff --git a/crates/rue-clvm/tests/roundtrip.rs b/crates/rue-clvm/tests/roundtrip.rs new file mode 100644 index 00000000..d533b90f --- /dev/null +++ b/crates/rue-clvm/tests/roundtrip.rs @@ -0,0 +1,102 @@ +//! Checks that every value can be written as text and parsed back to the same value. + +use clvmr::{Allocator, NodePtr, serde::node_to_bytes}; +use rue_clvm::{OPERATORS, assemble, disassemble_program, disassemble_value}; + +/// A small deterministic PRNG, so that failures are reproducible. +struct Rng(u64); + +impl Rng { + fn next(&mut self) -> u64 { + self.0 ^= self.0 << 13; + self.0 ^= self.0 >> 7; + self.0 ^= self.0 << 17; + self.0 + } + + fn below(&mut self, n: usize) -> usize { + (self.next() % n as u64) as usize + } + + fn pick<'a, T>(&mut self, items: &'a [T]) -> &'a T { + &items[self.below(items.len())] + } +} + +const INTERESTING_ATOMS: &[&[u8]] = &[ + &[], + &[0x00], + &[0x7f], + &[0x80], + &[0xff], + &[0x00, 0x00], + &[0x00, 0x7f], + &[0x00, 0x80], + &[0xff, 0x7f], + &[0xff, 0x80], + &[0x0f, 0x42, 0x40], + &[0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], + &[0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], + &[0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], + b"0x12", + b"123", + b"-12", + b"abc", + b"a b", + b"a\"b", + b"a'b", + b"a\\b", + b"a;b", + b"(a)", + b"a\nb", + b"\xe2\x9c\x93ok", +]; + +fn random_atom(rng: &mut Rng) -> Vec { + match rng.below(4) { + 0 => rng.pick(INTERESTING_ATOMS).to_vec(), + 1 => rng.pick(OPERATORS).0.to_vec(), + 2 => { + let len = rng.below(12); + (0..len).map(|_| rng.next() as u8).collect() + } + _ => { + let len = rng.below(8); + (0..len) + .map(|_| *rng.pick(b"ab0x9 \"'\\();.#-\t~")) + .collect() + } + } +} + +fn random_node(rng: &mut Rng, allocator: &mut Allocator, depth: usize) -> NodePtr { + if depth == 0 || rng.below(3) == 0 { + let atom = random_atom(rng); + return allocator.new_atom(&atom).unwrap(); + } + + let first = random_node(rng, allocator, depth - 1); + let rest = random_node(rng, allocator, depth - 1); + allocator.new_pair(first, rest).unwrap() +} + +#[test] +fn test_roundtrip() { + let mut rng = Rng(0x2545_f491_4f6c_dd1d); + + for _ in 0..100_000 { + let mut allocator = Allocator::new(); + let node = random_node(&mut rng, &mut allocator, 6); + let expected = node_to_bytes(&allocator, node).unwrap(); + + for text in [ + disassemble_program(&allocator, node), + disassemble_value(&allocator, node), + ] { + let mut allocator = Allocator::new(); + let parsed = assemble(&mut allocator, &text).unwrap(); + let actual = node_to_bytes(&allocator, parsed).unwrap(); + assert_eq!(actual, expected, "round trip of {text}"); + } + } +} diff --git a/crates/rue-compiler/Cargo.toml b/crates/rue-compiler/Cargo.toml index cb41f9df..2e12b7c9 100644 --- a/crates/rue-compiler/Cargo.toml +++ b/crates/rue-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-compiler" -version = "0.10.0" +version = "0.11.0" edition = "2024" license = "Apache-2.0" description = "A compiler for the Rue programming language." diff --git a/crates/rue-compiler/src/const_eval.rs b/crates/rue-compiler/src/const_eval.rs index 77cbe241..af0a0e3b 100644 --- a/crates/rue-compiler/src/const_eval.rs +++ b/crates/rue-compiler/src/const_eval.rs @@ -1,10 +1,7 @@ use std::path::PathBuf; use clvmr::error::EvalErr; -use clvmr::{ - Allocator, ChiaDialect, ENABLE_KECCAK_OPS_OUTSIDE_GUARD, MEMPOOL_MODE, NodePtr, SExp, - run_program, -}; +use clvmr::{Allocator, ChiaDialect, NodePtr, SExp, run_program}; use id_arena::Arena; use indexmap::IndexMap; use rue_diagnostic::DiagnosticKind; @@ -12,7 +9,7 @@ use rue_hir::{ DependencyGraph, Environment, FunctionKind, FunctionSymbol, Hir, HirId, Lowerer, LoweringMode, Symbol, }; -use rue_lir::{CodegenOptions, codegen, optimize}; +use rue_lir::{CLVM_FLAGS, CodegenOptions, codegen, optimize}; use rue_options::CompilerOptions; use crate::Compiler; @@ -127,7 +124,7 @@ fn evaluate_const_expr(ctx: &mut Compiler, value: HirId) -> Result, lir: LirId, expect: Expect) { let mut allocator = Allocator::new(); let ptr = codegen(arena, &mut allocator, lir, CodegenOptions::default()).unwrap(); - let result = disassemble(&allocator, ptr, None); + let result = disassemble_program(&allocator, ptr); expect.assert_eq(&result); } @@ -480,7 +480,7 @@ mod tests { }, ) .unwrap(); - let result = disassemble(&allocator, ptr, None); + let result = disassemble_program(&allocator, ptr); expect.assert_eq(&result); } @@ -952,14 +952,14 @@ mod tests { check( &arena, k1_verify, - expect!["(0x13d61f00 (q . 1) (q . 2) (q . 3))"], + expect!["(secp256k1_verify (q . 1) (q . 2) (q . 3))"], ); let r1_verify = arena.alloc(Lir::R1Verify(pubkey, message, signature)); check( &arena, r1_verify, - expect!["(0x1c3a8f00 (q . 1) (q . 2) (q . 3))"], + expect!["(secp256r1_verify (q . 1) (q . 2) (q . 3))"], ); } } diff --git a/crates/rue-lir/src/debug_dialect.rs b/crates/rue-lir/src/debug_dialect.rs index 69e23258..c390a7b1 100644 --- a/crates/rue-lir/src/debug_dialect.rs +++ b/crates/rue-lir/src/debug_dialect.rs @@ -1,17 +1,23 @@ use std::cell::RefCell; -use chialisp::classic::clvm_tools::binutils::disassemble; use clvm_traits::{FromClvm, destructure_tuple, match_tuple}; use clvmr::{ - Allocator, ChiaDialect, NodePtr, + Allocator, ChiaDialect, ClvmFlags, MEMPOOL_MODE, NodePtr, dialect::{Dialect, OperatorSet}, error::EvalErr, reduction::Reduction, }; use colored::Colorize; +use rue_clvm::disassemble_value; use crate::ClvmOp; +/// The flags used to run Rue programs. These match mempool mode, with keccak256 enabled, and +/// with modpow left enabled (`DISABLE_OP` turns it off in newer versions of mempool mode). +pub const CLVM_FLAGS: ClvmFlags = MEMPOOL_MODE + .union(ClvmFlags::ENABLE_KECCAK_OPS_OUTSIDE_GUARD) + .difference(ClvmFlags::DISABLE_OP); + #[derive(Debug, Clone)] pub struct PrintMessage { pub srcloc: String, @@ -20,13 +26,13 @@ pub struct PrintMessage { #[derive(Debug, Clone)] pub struct DebugDialect { - flags: u32, + flags: ClvmFlags, stdout: bool, log: RefCell>, } impl DebugDialect { - pub fn new(flags: u32, stdout: bool) -> Self { + pub fn new(flags: ClvmFlags, stdout: bool) -> Self { Self { flags, stdout, @@ -60,6 +66,14 @@ impl Dialect for DebugDialect { self.inner().softfork_extension(ext) } + fn flags(&self) -> ClvmFlags { + self.flags + } + + fn gc_candidate(&self, allocator: &Allocator, op: NodePtr) -> bool { + self.inner().gc_candidate(allocator, op) + } + fn op( &self, allocator: &mut Allocator, @@ -75,7 +89,7 @@ impl Dialect for DebugDialect { return Err(EvalErr::InvalidNilTerminator(args)); }; - let message = disassemble(allocator, value, None); + let message = disassemble_value(allocator, value); if self.stdout { eprintln!("{}: {}", srcloc.cyan().bold(), message); diff --git a/crates/rue-lsp/Cargo.toml b/crates/rue-lsp/Cargo.toml index d881eb8b..8735bfb3 100644 --- a/crates/rue-lsp/Cargo.toml +++ b/crates/rue-lsp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-lsp" -version = "0.10.0" +version = "0.11.0" edition = "2024" license = "Apache-2.0" description = "A language server protocol (LSP) implementation for the Rue programming language." diff --git a/crates/rue-options/Cargo.toml b/crates/rue-options/Cargo.toml index ef2db25c..99d8f3b3 100644 --- a/crates/rue-options/Cargo.toml +++ b/crates/rue-options/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-options" -version = "0.10.0" +version = "0.11.0" edition = "2024" license = "Apache-2.0" description = "Provides a way to configure the Rue compiler." diff --git a/crates/rue-parser/Cargo.toml b/crates/rue-parser/Cargo.toml index 16fe0226..45d0516f 100644 --- a/crates/rue-parser/Cargo.toml +++ b/crates/rue-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-parser" -version = "0.10.0" +version = "0.11.0" edition = "2024" license = "Apache-2.0" description = "A parser for the Rue programming language." diff --git a/crates/rue-tests/Cargo.toml b/crates/rue-tests/Cargo.toml index 628ab23f..cadfb8df 100644 --- a/crates/rue-tests/Cargo.toml +++ b/crates/rue-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-tests" -version = "0.10.0" +version = "0.11.0" edition = "2024" publish = false license = "Apache-2.0" @@ -22,7 +22,7 @@ rue-diagnostic = { workspace = true } rue-lir = { workspace = true } rue-formatter = { workspace = true } clvmr = { workspace = true } -chialisp = { workspace = true } +rue-clvm = { workspace = true } anyhow = { workspace = true } serde = { workspace = true } serde_yml = { workspace = true } diff --git a/crates/rue-tests/src/main.rs b/crates/rue-tests/src/main.rs index 6b9f92c7..3f6acb67 100644 --- a/crates/rue-tests/src/main.rs +++ b/crates/rue-tests/src/main.rs @@ -6,18 +6,15 @@ use std::path::Path; use std::process; use anyhow::Result; -use chialisp::classic::clvm_tools::binutils::{assemble, disassemble}; use clvmr::error::EvalErr; -use clvmr::{ - Allocator, ChiaDialect, ENABLE_KECCAK_OPS_OUTSIDE_GUARD, MEMPOOL_MODE, NodePtr, run_program, - serde::node_to_bytes, -}; +use clvmr::{Allocator, ChiaDialect, NodePtr, run_program, serde::node_to_bytes}; use indexmap::IndexMap; +use rue_clvm::{assemble, disassemble_program, disassemble_value}; use rue_compiler::normalize_path; use rue_compiler::{Compiler, FileTree}; use rue_diagnostic::DiagnosticSeverity; use rue_formatter::{FormatError, FormatOptions, format_source}; -use rue_lir::DebugDialect; +use rue_lir::{CLVM_FLAGS, DebugDialect}; use rue_options::CompilerOptions; use serde::{Deserialize, Serialize}; @@ -442,18 +439,18 @@ fn handle_test_case( let env = assemble(allocator, test_case.solution.as_deref().unwrap_or("()"))?; - test_case.program = Some(disassemble(allocator, ptr, None)); - test_case.debug_program = Some(disassemble(allocator, debug_ptr, None)); + test_case.program = Some(disassemble_program(allocator, ptr)); + test_case.debug_program = Some(disassemble_program(allocator, debug_ptr)); let response = run_program( allocator, - &ChiaDialect::new(ENABLE_KECCAK_OPS_OUTSIDE_GUARD | MEMPOOL_MODE), + &ChiaDialect::new(CLVM_FLAGS), ptr, env, 100_000_000, ); - let debug_dialect = DebugDialect::new(ENABLE_KECCAK_OPS_OUTSIDE_GUARD | MEMPOOL_MODE, false); + let debug_dialect = DebugDialect::new(CLVM_FLAGS, false); let debug_response = run_program(allocator, &debug_dialect, debug_ptr, env, 100_000_000); let print_messages = debug_dialect.log(); @@ -467,14 +464,14 @@ fn handle_test_case( match response { Ok(output) => { - test_case.output = Some(disassemble(allocator, output.1, None)); + test_case.output = Some(disassemble_value(allocator, output.1)); test_case.runtime_cost = Some(output.0); test_case.total_cost = Some(output.0 + bytes as u64 * 12_000); test_case.clvm_error = None; } Err(error) => { test_case.clvm_error = Some(match error { - EvalErr::Raise(ptr) => format!("clvm raise {}", disassemble(allocator, ptr, None)), + EvalErr::Raise(ptr) => format!("clvm raise {}", disassemble_value(allocator, ptr)), _ => error.to_string(), }); test_case.runtime_cost = None; @@ -485,12 +482,12 @@ fn handle_test_case( match debug_response { Ok(output) => { - test_case.debug_output = Some(disassemble(allocator, output.1, None)); + test_case.debug_output = Some(disassemble_value(allocator, output.1)); test_case.debug_clvm_error = None; } Err(error) => { test_case.debug_clvm_error = Some(match error { - EvalErr::Raise(ptr) => format!("clvm raise {}", disassemble(allocator, ptr, None)), + EvalErr::Raise(ptr) => format!("clvm raise {}", disassemble_value(allocator, ptr)), _ => error.to_string(), }); test_case.debug_output = None; diff --git a/crates/rue-types/Cargo.toml b/crates/rue-types/Cargo.toml index 6490241c..645e2c0a 100644 --- a/crates/rue-types/Cargo.toml +++ b/crates/rue-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-types" -version = "0.10.0" +version = "0.11.0" edition = "2024" license = "Apache-2.0" description = "A type system for the Rue programming language." diff --git a/examples/fizz_buzz.yaml b/examples/fizz_buzz.yaml index 21790948..680e9cf4 100644 --- a/examples/fizz_buzz.yaml +++ b/examples/fizz_buzz.yaml @@ -1,7 +1,7 @@ program: (a (q 2 10 (c 2 (c (q . 1) 5))) (c (c (q 2 (i (> () 3) (q 14 (q . 45) (a 4 (c 2 (- () 3)))) (q 2 (i (> (q . 10) 3) (q 2 6 3) (q 14 (a 4 (c 2 (/ 3 (q . 10)))) (a 6 (% 3 (q . 10))))) 1)) 1) (c (q 4 (a 30 (c (c 4 22) 5)) (a (i (= 5 7) (q) (q 2 10 (c 2 (c (+ 5 (q . 1)) 7)))) 1)) (c (q 16 1 (q . 48)) (q 2 (i (a (i (% 3 (q . 3)) (q) (q 2 (i (% 3 (q . 5)) (q) (q 1 . 1)) 1)) 1) (q 1 . "FizzBuzz") (q 2 (i (% 3 (q . 3)) (q 2 (i (% 3 (q . 5)) (q 2 4 1) (q 1 . "Buzz")) 1) (q 1 . "Fizz")) 1)) 1)))) 1)) debug_program: (a (q 2 10 (c (c 4 (c 10 (c 22 30))) (c (q . 1) 5))) (c (c (q 2 (i (> () 3) (q 14 (q . 45) (a 4 (c (c 4 6) (- () 3)))) (q 2 (i (> (q . 10) 3) (q 2 6 3) (q 14 (a 4 (c (c 4 6) (/ 3 (q . 10)))) (a 6 (% 3 (q . 10))))) 1)) 1) (c (q 2 (q 4 (a 61 (c (c 9 45) 11)) 2) (c (a (i (= 5 7) (q) (q 2 10 (c (c 4 (c 10 (c 22 30))) (c (+ 5 (q . 1)) 7)))) 1) 1)) (c (q 16 (q . 48) 1) (q 2 (i (a (i (= (% 3 (q . 3)) ()) (q 2 (i (= (% 3 (q . 5)) ()) (q 1 . 1) (q)) 1) (q)) 1) (q 1 . "FizzBuzz") (q 2 (i (= (% 3 (q . 3)) ()) (q 1 . "Fizz") (q 2 (i (= (% 3 (q . 5)) ()) (q 1 . "Buzz") (q 2 4 (c (c 4 6) 3))) 1)) 1)) 1)))) 1)) solution: (15) -output: (g1_subtract 50 "Fizz" 52 "Buzz" "Fizz" 55 56 "Fizz" "Buzz" 12593 "Fizz" 12595 12596 "FizzBuzz") +output: (49 50 "Fizz" 52 "Buzz" "Fizz" 55 56 "Fizz" "Buzz" 12593 "Fizz" 12595 12596 "FizzBuzz") runtime_cost: 129500 byte_cost: 5004000 total_cost: 5133500 diff --git a/examples/puzzles/cat.yaml b/examples/puzzles/cat.yaml index 7fc76668..2bb644d7 100644 --- a/examples/puzzles/cat.yaml +++ b/examples/puzzles/cat.yaml @@ -1,7 +1,7 @@ program: (a (q 2 (q 2 (q 2 (q 4 (c (q . 70) (c 27 ())) (a (i 57 (q 2 (i (= (a 39 (c 39 89)) 95) (q 2 -9 (c -9 (c (a 89 (c (c (c (a 39 (c 39 -65)) 19) (c 27 3071)) (c 13 (c 767 (c 24575 (c 2 (c -71 ()))))))) 2))) (q 8)) 1) (q 2 (i (all 13 (not 24575)) (q . 2) (q 8)) 1)) 1)) (c (c (c (q . 60) (c (concat (q . -53) (a 19 (c 19 (c 767 (c 6143 ()))))) ())) (c (c (q . 61) (c (sha256 (coinid 5119 (sha256 (q . 2) (sha256 (q . 258)) (sha256 (q . 2) (sha256 (q . 2) (sha256 (q . 257)) 17) (sha256 (q . 2) (a 91 (c 91 (c 41 (c (sha256 (q . 1) 89) (c 11263 ()))))) (sha256 (q . 1))))) 23551) (q . -53) (a 19 (c 19 (c 13 (c (+ 6143 (- 11775 20) 12287) ()))))) ())) 8)) 1)) (c (c (a 21 (c (c 21 45) (c (a 47 95) (c 4 ())))) (a (i -65 (q 2 (i (= 1279 (coinid 319 (sha256 (q . 2) (sha256 (q . 258)) (sha256 (q . 2) (sha256 (q . 2) (sha256 (q . 257)) 8) (sha256 (q . 2) (a 45 (c 45 (c 20 (c (sha256 (q . 1) 44) (c 703 ()))))) (sha256 (q . 1))))) 1471)) (q 1 . 1) (q)) 1) (q)) 1)) 1)) (c (c (c 5 (c (sha256 (q . 1) 5) (c 11 ()))) (coinid 639 1407 2943)) 1)) (c (c (q 2 (i (l 3) (q 11 (q . 2) (a 2 (c 2 5)) (a 2 (c 2 7))) (q 11 (q . 1) 3)) 1) (c (q 2 (i 5 (q 2 (i (a (i (= 17 (q . 51)) (q 2 (i 41 (q) (q 1 . 1)) 1) (q)) 1) (q 2 (q . 2) (c (a 4 (c 2 (c 13 (c 11 (c -71 (c 377 ())))))) 1)) (q 2 (q 4 (c 10 8) (c (+ 20 14) 28)) (c (c (a 4 (c 2 (c 13 7))) (a (i (= 17 (q . 51)) (q 4 (c (q . 51) (c (sha256 (q . 2) (sha256 (q . 258)) (sha256 (q . 2) (sha256 (q . 2) (sha256 (q . 257)) 19) (sha256 (q . 2) (a 6 (c 6 (c 43 (c (sha256 (q . 1) 91) (c 41 ()))))) (sha256 (q . 1))))) 57)) 89) (q 2 (i (a (i (= 17 (q . 60)) (q 2 (i (all (= (strlen 41) (q . 33)) (= (substr 41 () (q . 1)) (q . -53))) (q 1 . 1) (q)) 1) (q)) 1) (q 8) (q 4 9 ())) 1)) 1)) 1))) 1) (q 4 () (c () 15))) 1) (c (q 2 (i 3 (q 11 (q . 2) (sha256 (q . 260)) (sha256 (q . 2) (sha256 (q . 2) (sha256 (q . 257)) 5) (sha256 (q . 2) (a 2 (c 2 7)) (sha256 (q . 1))))) (q 11 (q . 257))) 1) (q 2 (i 5 (q 4 9 (a 2 (c 2 (c 13 7)))) (q . 7)) 1)))) 1)) -debug_program: (a (q 2 (q 2 (q 2 (q 2 (q 2 (q 2 (q 4 (c (q . 70) (c 351 ())) 2) (c (a (i (not (not (l (r (r 39))))) (q 2 (i (= (a 287 (c 287 (f (r (r 39))))) 383) (q 2 (q 2 1727 (c 1727 (c 2 5))) (c (a (f (r (r 39))) (c -9 (c 87 (c 3071 (c 0x017fff (c 2 (c (f (r (r (r 39)))) ()))))))) 1)) (q 8 (q . "assertion failed at cat.rue:150:9"))) 1) (q 2 (i (all 87 (= 0x017fff ())) (q . 2) (q 8 (q . "assertion failed at cat.rue:168:9"))) 1)) 1) 1)) (c (c (c (q . 60) (c (concat (q . -53) (a -113 (c -113 (c 3071 (c 24575 ()))))) ())) (c (c (q . 61) (c (sha256 (concat (concat 91 (q . -53)) (a -113 (c -113 (c 87 (c 2 ())))))) ())) (f 19))) 1)) (c (+ (+ 12287 2) 24575) 1)) (c (- (f (r (r 1535))) (f (r 4))) 1)) (c (c (a 25 (c (c 25 (c 37 (c 45 (c 93 125)))) (c (a 47 95) (c 4 ())))) (c (a (i (l -65) (q 2 (i (= (f 767) (coinid (f -65) (a 45 (c (c 37 (c 93 125)) (c (f 4) (c (f (r 4)) (c (sha256 (concat (q . 1) (f (r (r 4))))) (c (f (r -65)) ())))))) (f (r (r -65))))) (q 1 . 1) (q)) 1) (q)) 1) (c (coinid (f 1535) (a 45 (c (c 37 (c 93 125)) (c (f 4) (c (f (r 4)) (c (sha256 (concat (q . 1) (f (r (r 4))))) (c (f (r 1535)) ())))))) (f (r (r 1535)))) (c (c 14 4) (c 10 767))))) 1)) (c (c (c 5 (c (sha256 (concat (q . 1) 5)) (c 11 ()))) (c (coinid (f 383) (f (r 383)) (f (r (r 383)))) (a 8 (c 8 23)))) 1)) (c (c (c (q 2 (i (not (l 3)) (q 11 (concat (q . 1) 3)) (q 11 (concat (concat (q . 2) (a 2 (c 2 (f 3)))) (a 2 (c 2 (r 3)))))) 1) (q 2 (i (not (l 5)) (q 4 () (c () 15)) (q 2 (i (a (i (= (f (f 5)) (q . 51)) (q 2 (i (= (f (r (f 5))) ()) (q 1 . 1) (q)) 1) (q)) 1) (q 2 (q 4 (f 2) (c (f (r 2)) (r (r 2)))) (c (a 4 (c (c 4 (c 10 (c 22 (c 46 62)))) (c (r 5) (c 11 (c (f (r (r (r (f 5))))) (c (f (r (r (r (r (f 5)))))) ())))))) 1)) (q 2 (q 4 (c (f 6) (f 4)) (c (+ (f (r 4)) (r 6)) (r (r 4)))) (c (c (a 4 (c (c 4 (c 10 (c 22 (c 46 62)))) (c (r 5) (c 11 15)))) (a (i (= (f (f 5)) (q . 51)) (q 2 (q 4 2 (f (r (r (f 11))))) (c (c (q . 51) (c (a 22 (c (c 10 (c 46 62)) (c (f 11) (c (f (r 11)) (c (sha256 (concat (q . 1) (f (r (r 11))))) (c (f (r (f 5))) ())))))) (c (f (r (r (f 5)))) (r (r (r (f 5))))))) 1)) (q 2 (i (a (i (= (f (f 5)) (q . 60)) (q 2 (i (all (= (strlen (f (r (f 5)))) (q . 33)) (= (substr (f (r (f 5))) () (q . 1)) (q . -53))) (q 1 . 1) (q)) 1) (q)) 1) (q 8 (q . "raise called at cat.rue:235:13") (q . "Created coin announcements must not have the ring morph byte")) (q 4 (f 5) ())) 1)) 1)) 1))) 1)) 1)) (c (c (q 2 (i (not (l 3)) (q 11 (concat (q . 1) (q . 1))) (q 2 6 (c (f 3) (a 4 (c (c 4 6) (r 3)))))) 1) (q 2 (i (l 5) (q 4 (f 5) (a 2 (c 2 (c (r 5) 7)))) (q . 7)) 1)) (c (q 2 14 (c 5 (a 4 (c (c 4 10) 7)))) (c (q 11 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 4)))) (sha256 (concat (concat (q . 2) (sha256 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 1)))) 2))) (sha256 (concat (concat (q . 2) 3) (sha256 (concat (q . 1) ())))))))) (q 11 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 2)))) (sha256 (concat (concat (q . 2) (sha256 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 1)))) 2))) (sha256 (concat (concat (q . 2) 3) (sha256 (concat (q . 1) ())))))))))))) 1)) +debug_program: (a (q 2 (q 2 (q 2 (q 2 (q 2 (q 2 (q 4 (c (q . 70) (c 351 ())) 2) (c (a (i (not (not (l (r (r 39))))) (q 2 (i (= (a 287 (c 287 (f (r (r 39))))) 383) (q 2 (q 2 1727 (c 1727 (c 2 5))) (c (a (f (r (r 39))) (c -9 (c 87 (c 3071 (c 98303 (c 2 (c (f (r (r (r 39)))) ()))))))) 1)) (q 8 (q . "assertion failed at cat.rue:150:9"))) 1) (q 2 (i (all 87 (= 98303 ())) (q . 2) (q 8 (q . "assertion failed at cat.rue:168:9"))) 1)) 1) 1)) (c (c (c (q . 60) (c (concat (q . -53) (a -113 (c -113 (c 3071 (c 24575 ()))))) ())) (c (c (q . 61) (c (sha256 (concat (concat 91 (q . -53)) (a -113 (c -113 (c 87 (c 2 ())))))) ())) (f 19))) 1)) (c (+ (+ 12287 2) 24575) 1)) (c (- (f (r (r 1535))) (f (r 4))) 1)) (c (c (a 25 (c (c 25 (c 37 (c 45 (c 93 125)))) (c (a 47 95) (c 4 ())))) (c (a (i (l -65) (q 2 (i (= (f 767) (coinid (f -65) (a 45 (c (c 37 (c 93 125)) (c (f 4) (c (f (r 4)) (c (sha256 (concat (q . 1) (f (r (r 4))))) (c (f (r -65)) ())))))) (f (r (r -65))))) (q 1 . 1) (q)) 1) (q)) 1) (c (coinid (f 1535) (a 45 (c (c 37 (c 93 125)) (c (f 4) (c (f (r 4)) (c (sha256 (concat (q . 1) (f (r (r 4))))) (c (f (r 1535)) ())))))) (f (r (r 1535)))) (c (c 14 4) (c 10 767))))) 1)) (c (c (c 5 (c (sha256 (concat (q . 1) 5)) (c 11 ()))) (c (coinid (f 383) (f (r 383)) (f (r (r 383)))) (a 8 (c 8 23)))) 1)) (c (c (c (q 2 (i (not (l 3)) (q 11 (concat (q . 1) 3)) (q 11 (concat (concat (q . 2) (a 2 (c 2 (f 3)))) (a 2 (c 2 (r 3)))))) 1) (q 2 (i (not (l 5)) (q 4 () (c () 15)) (q 2 (i (a (i (= (f (f 5)) (q . 51)) (q 2 (i (= (f (r (f 5))) ()) (q 1 . 1) (q)) 1) (q)) 1) (q 2 (q 4 (f 2) (c (f (r 2)) (r (r 2)))) (c (a 4 (c (c 4 (c 10 (c 22 (c 46 62)))) (c (r 5) (c 11 (c (f (r (r (r (f 5))))) (c (f (r (r (r (r (f 5)))))) ())))))) 1)) (q 2 (q 4 (c (f 6) (f 4)) (c (+ (f (r 4)) (r 6)) (r (r 4)))) (c (c (a 4 (c (c 4 (c 10 (c 22 (c 46 62)))) (c (r 5) (c 11 15)))) (a (i (= (f (f 5)) (q . 51)) (q 2 (q 4 2 (f (r (r (f 11))))) (c (c (q . 51) (c (a 22 (c (c 10 (c 46 62)) (c (f 11) (c (f (r 11)) (c (sha256 (concat (q . 1) (f (r (r 11))))) (c (f (r (f 5))) ())))))) (c (f (r (r (f 5)))) (r (r (r (f 5))))))) 1)) (q 2 (i (a (i (= (f (f 5)) (q . 60)) (q 2 (i (all (= (strlen (f (r (f 5)))) (q . 33)) (= (substr (f (r (f 5))) () (q . 1)) (q . -53))) (q 1 . 1) (q)) 1) (q)) 1) (q 8 (q . "raise called at cat.rue:235:13") (q . "Created coin announcements must not have the ring morph byte")) (q 4 (f 5) ())) 1)) 1)) 1))) 1)) 1)) (c (c (q 2 (i (not (l 3)) (q 11 (concat (q . 1) (q . 1))) (q 2 6 (c (f 3) (a 4 (c (c 4 6) (r 3)))))) 1) (q 2 (i (l 5) (q 4 (f 5) (a 2 (c 2 (c (r 5) 7)))) (q . 7)) 1)) (c (q 2 14 (c 5 (a 4 (c (c 4 10) 7)))) (c (q 11 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 4)))) (sha256 (concat (concat (q . 2) (sha256 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 1)))) 2))) (sha256 (concat (concat (q . 2) 3) (sha256 (concat (q . 1) ())))))))) (q 11 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 2)))) (sha256 (concat (concat (q . 2) (sha256 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 1)))) 2))) (sha256 (concat (concat (q . 2) 3) (sha256 (concat (q . 1) ())))))))))))) 1)) solution: (0x00f43ce9fcc63d5019e209c103e6b0aaf56bbe7fc7fafae5af7f5ee6887a8719 0xd622c62a7292ffee5cf2537a90360ca0b7337b76d7014ec042930c0a87592213 (q (g1_negate () -113 (a (q 2 (i 47 (q 8) (q 2 (i (= 45 2) () (q 8)) 1)) 1) (c (q . 0x895eb35a355941ba7f6a8679a73bb9b8b62cae2b04ef5351eda42583c0f2d861) 1)) ()) (g1_negate 0xb8705f94744e7fc30300ac9b12d306b283f5a702937ee99beabf665be6023001 1 (0xb8705f94744e7fc30300ac9b12d306b283f5a702937ee99beabf665be6023001))) () () 0x615236766bed52d7abaa41d270407f3ec852981852334b213bd8515924459a5d (0x895eb35a355941ba7f6a8679a73bb9b8b62cae2b04ef5351eda42583c0f2d861 0x1ecb863db5d2ae6c71e9a8b0741acb3e034e8164b8ca0e564d5fad8b9dc875d5 1) (0x895eb35a355941ba7f6a8679a73bb9b8b62cae2b04ef5351eda42583c0f2d861 0x130deb20b44082a68293974f8cab9c51e21f9a9f3005000168eb77e49e0fc378 1) () ()) -output: ((70 0x615236766bed52d7abaa41d270407f3ec852981852334b213bd8515924459a5d) (modpow 0xcb7f53b5de05b4afe58ab663b952aa785fd9ad911564709bd8eacbf4c58ba1e589) (% 0x389f1ea7b9fab7a9294104eb3a181d662f2dbe9c43fbe52802ba9b7eef357e77) (g1_negate 0xc9644528436f44cd9b33282684b4964f55d5551cb3a970ab9cf8f536e0d72ad1 1 (0xb8705f94744e7fc30300ac9b12d306b283f5a702937ee99beabf665be6023001))) +output: ((70 0x615236766bed52d7abaa41d270407f3ec852981852334b213bd8515924459a5d) (60 0xcb7f53b5de05b4afe58ab663b952aa785fd9ad911564709bd8eacbf4c58ba1e589) (61 0x389f1ea7b9fab7a9294104eb3a181d662f2dbe9c43fbe52802ba9b7eef357e77) (51 0xc9644528436f44cd9b33282684b4964f55d5551cb3a970ab9cf8f536e0d72ad1 1 (0xb8705f94744e7fc30300ac9b12d306b283f5a702937ee99beabf665be6023001))) runtime_cost: 297861 byte_cost: 17472000 total_cost: 17769861 diff --git a/examples/puzzles/p2_delegated_conditions.yaml b/examples/puzzles/p2_delegated_conditions.yaml index 7200a516..2d92f372 100644 --- a/examples/puzzles/p2_delegated_conditions.yaml +++ b/examples/puzzles/p2_delegated_conditions.yaml @@ -1,7 +1,7 @@ program: (a (q 4 (c (q . 50) (c 5 (c (a 2 (c 2 11)) ()))) 11) (c (q 2 (i (l 3) (q 11 (q . 2) (a 2 (c 2 5)) (a 2 (c 2 7))) (q 11 (q . 1) 3)) 1) 1)) debug_program: (a (q 2 (q 4 2 23) (c (c (q . 50) (c 5 (c (a 2 (c 2 11)) ()))) 1)) (c (q 2 (i (not (l 3)) (q 11 (concat (q . 1) 3)) (q 11 (concat (concat (q . 2) (a 2 (c 2 (f 3)))) (a 2 (c 2 (r 3)))))) 1) 1)) solution: (0xc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ((51 0x00f43ce9fcc63d5019e209c103e6b0aaf56bbe7fc7fafae5af7f5ee6887a8719 120))) -output: ((g1_multiply 0xc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0x51af4b357617eaefc71b95840c48183e0d7193cdc540a5c568c4be8d7f2eac55) (g1_negate 0x00f43ce9fcc63d5019e209c103e6b0aaf56bbe7fc7fafae5af7f5ee6887a8719 120)) +output: ((50 0xc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0x51af4b357617eaefc71b95840c48183e0d7193cdc540a5c568c4be8d7f2eac55) (51 0x00f43ce9fcc63d5019e209c103e6b0aaf56bbe7fc7fafae5af7f5ee6887a8719 120)) runtime_cost: 13347 byte_cost: 1428000 total_cost: 1441347 diff --git a/examples/puzzles/royalty_split.yaml b/examples/puzzles/royalty_split.yaml index eba267fc..7669cde7 100644 --- a/examples/puzzles/royalty_split.yaml +++ b/examples/puzzles/royalty_split.yaml @@ -1,7 +1,7 @@ program: (a (q 4 (q 60 ()) (c (c (q . 73) (c 11 ())) (a 4 (c 2 (c (c 5 23) (c 11 (c () 11))))))) (c (c (q 2 (i 9 (q 2 6 (c 2 (c 9 (c (c (/ (* 11 81) 13) 31) (c 11 (c 13 23)))))) (q 2 (i (= 13 23) (q) (q 8)) 1)) 1) (q 4 (c (q . 51) (c 17 (c (i 13 19 27) (c (c 17 ()) ())))) (a 4 (c 2 (c (c 13 47) (c 23 (c (+ 63 41) (- 27 19)))))))) 1)) debug_program: (a (q 4 (c (q . 60) (c () ())) (c (c (q . 73) (c 11 ())) (a 4 (c (c 4 (c 10 14)) (c (c 5 23) (c 11 (c () 11))))))) (c (c (q 2 (i (not (l 9)) (q 2 (i (= 13 23) (q) (q 8 (q . "raise called at royalty_split.rue:32:9") (q . "Share sum doesn't match total"))) 1) (q 2 14 (c (c 4 (c 10 14)) (c 9 (c (c (a 10 (c 11 (c (f (r (f 9))) 13))) 31) (c 11 (c 13 23))))))) 1) (c (q 19 (* 2 5) 7) (q 2 (q 4 2 (a 9 (c (c 9 (c 21 29)) (c (c (r 11) 95) (c 47 (c (+ 127 (f (r (f 11)))) (- 55 39))))))) (c (c (q . 51) (c (f (f 5)) (c (i (not (l (r 5))) 27 19) (c (c (f (f 5)) ()) ())))) 1)))) 1)) solution: (((0x3816a97150946c7745457f45a4fed6c16890637847b2df95f383e439758732d7 80) (0x09731fc56bff8031dc9a16f60dcb6f6462960cd76d4b5233dd5bc21697d7fca7 20)) 1000 100) -output: ((modpow ()) (73 1000) (g1_negate 0x3816a97150946c7745457f45a4fed6c16890637847b2df95f383e439758732d7 800 (0x3816a97150946c7745457f45a4fed6c16890637847b2df95f383e439758732d7)) (g1_negate 0x09731fc56bff8031dc9a16f60dcb6f6462960cd76d4b5233dd5bc21697d7fca7 200 (0x09731fc56bff8031dc9a16f60dcb6f6462960cd76d4b5233dd5bc21697d7fca7))) +output: ((60 ()) (73 1000) (51 0x3816a97150946c7745457f45a4fed6c16890637847b2df95f383e439758732d7 800 (0x3816a97150946c7745457f45a4fed6c16890637847b2df95f383e439758732d7)) (51 0x09731fc56bff8031dc9a16f60dcb6f6462960cd76d4b5233dd5bc21697d7fca7 200 (0x09731fc56bff8031dc9a16f60dcb6f6462960cd76d4b5233dd5bc21697d7fca7))) runtime_cost: 14926 byte_cost: 3420000 total_cost: 3434926 diff --git a/examples/puzzles/singleton.yaml b/examples/puzzles/singleton.yaml index e7db8641..9d6ef7da 100644 --- a/examples/puzzles/singleton.yaml +++ b/examples/puzzles/singleton.yaml @@ -1,7 +1,7 @@ program: (a (q 2 (q 2 (i (all (logand 95 (q . 1)) (any 4 (= 6 43))) (q 4 (c (q . 73) (c 95 ())) (c (c (q . 71) (c 6 ())) (a 9 (c 5 (c 11 (c (a 23 -65) ())))))) (q 8)) 1) (c (a (i 119 (q 4 (q . 1) (coinid 39 (sha256 (q . 2) (sha256 (q . 258)) (sha256 (q . 2) (sha256 (q . 2) (sha256 (q . 257)) 9) (sha256 (q . 2) (a 14 (c 14 (c (a 10 (c 10 5)) (c 87 ())))) (sha256 (q . 1))))) -73)) (q 4 () (coinid 39 29 87))) 1) 1)) (c (c (q 2 (i 11 (q 2 (i (a (i (= 35 (q . 51)) (q 2 (i (logand -77 (q . 1)) (q 1 . 1) (q)) 1) (q)) 1) (q 2 (i 15 (q 8) (q 2 (q 2 (i (= 359 (q . -113)) (q . 2) (q 4 (c (q . 51) (c (sha256 (q . 2) (sha256 (q . 258)) (sha256 (q . 2) (sha256 (q . 2) (sha256 (q . 257)) 19) (sha256 (q . 2) (a 29 (c 29 (c (a 21 (c 21 11)) (c -89 ())))) (sha256 (q . 1))))) -25)) 2)) 1) (c (a 4 (c 2 (c 5 (c 27 (q . 1))))) 1))) 1) (q 4 19 (a 4 (c 2 (c 5 (c 27 ())))))) 1) (q 2 (i 15 (q) (q 8)) 1)) 1) (c (q 2 (i (l 3) (q 11 (q . 2) (a 2 (c 2 5)) (a 2 (c 2 7))) (q 11 (q . 1) 3)) 1) (q 2 (i 3 (q 11 (q . 2) (sha256 (q . 260)) (sha256 (q . 2) (sha256 (q . 2) (sha256 (q . 257)) 5) (sha256 (q . 2) (a 2 (c 2 7)) (sha256 (q . 1))))) (q 11 (q . 257))) 1))) 1)) debug_program: (a (q 2 (q 2 (q 2 (i (all 13 2) (q 2 (q 4 4 (c 10 14)) (c (c (c (q . 73) (c -65 ())) (c (c (q . 71) (c (r 9) ())) (a 35 (c (c (c 35 51) (c 43 (c 91 (c -69 -5)))) (c 23 (c (a 47 383) ())))))) 1)) (q 8 (q . "assertion failed at singleton.rue:58:5"))) 1) (c (any (f 4) (= (r 4) (f (r 11)))) 1)) (c (c (a (i (r (r 23)) (q 4 (q . 1) (coinid (f 23) (a 22 (c (c 10 (c 46 62)) (c (f 5) (c (a 12 (c 12 5)) (c (f (r 23)) ()))))) (f (r (r 23))))) (q 4 () (coinid (f 23) (r (r 5)) (f (r 23))))) 1) (= (% 47 (q . 2)) (q . 1))) 1)) (c (c (c (q 2 (i (not (l 11)) (q 2 (i 15 (q) (q 8 (q . "assertion failed at singleton.rue:79:9"))) 1) (q 2 (i (a (i (= (f (f 11)) (q . 51)) (q 2 (i (= (% (f (r (r (f 11)))) (q . 2)) (q . 1)) (q 1 . 1) (q)) 1) (q)) 1) (q 2 (i (not 15) (q 2 (q 2 (i (= (f (r (r (f 23)))) (- () (q . 113))) (q . 2) (q 2 (q 4 2 5) (c (c (q . 51) (c (a 45 (c (c 21 (c 93 125)) (c (f 11) (c (a 25 (c 25 11)) (c (f (r (f 23))) ()))))) (c (f (r (r (f 23)))) (r (r (r (f 23))))))) 1))) 1) (c (a 8 (c (c (c 8 12) (c 10 (c 22 (c 46 62)))) (c 5 (c (r 11) (q . 1))))) 1)) (q 8 (q . "assertion failed at singleton.rue:86:9"))) 1) (q 4 (f 11) (a 8 (c (c (c 8 12) (c 10 (c 22 (c 46 62)))) (c 5 (c (r 11) ())))))) 1)) 1) (q 2 (i (not (l 3)) (q 11 (concat (q . 1) 3)) (q 11 (concat (concat (q . 2) (a 2 (c 2 (f 3)))) (a 2 (c 2 (r 3)))))) 1)) (c (q 2 (i (not (l 3)) (q 11 (concat (q . 1) (q . 1))) (q 2 6 (c (f 3) (a 4 (c (c 4 6) (r 3)))))) 1) (c (q 2 14 (c 5 (a 4 (c (c 4 10) 7)))) (c (q 11 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 4)))) (sha256 (concat (concat (q . 2) (sha256 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 1)))) 2))) (sha256 (concat (concat (q . 2) 3) (sha256 (concat (q . 1) ())))))))) (q 11 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 2)))) (sha256 (concat (concat (q . 2) (sha256 (concat (concat (q . 2) (sha256 (concat (q . 1) (q . 1)))) 2))) (sha256 (concat (concat (q . 2) 3) (sha256 (concat (q . 1) ())))))))))))) 1)) solution: ((0x7faa3253bfddd1e0decb0906b2dc6247bbc4cf608f58345d173adb63e8b47c9f 0x1dee7745609c0ebcf4e1cfe01f2b2e7f4deb122eb735217e7af08029ba322b13 . 0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9) (a (q 2 (q 2 62 (c 2 (c 5 (c (a 47 95) (c () (c (c (c 11 (c 23 ())) (q ())) (q ()))))))) (c (q ((a . 51) 4 1 . 1) (a 2 (i 5 (q 2 26 (c 2 (c 13 (c (sha256 18 (sha256 44 20) (sha256 18 (sha256 18 (sha256 44 60) 9) (sha256 18 11 (sha256 44 ())))) ())))) (q . 11)) 1) (sha256 18 (sha256 44 16) (sha256 18 (sha256 18 (sha256 44 60) 5) (sha256 18 (a 26 (c 2 (c 7 (c (sha256 44 44) ())))) (sha256 44 ())))) (a (i (l 5) (q 11 (q . 2) (a 46 (c 2 (c 9 ()))) (a 46 (c 2 (c 13 ())))) (q 11 (q . 1) 5)) 1) 2 (i 11 (q 2 (i (= 35 24) (q 2 (i (logand -77 44) (q 2 (i (not 23) (q 2 62 (c 2 (c 5 (c 27 (c 51 (c 47 (c 95 ()))))))) (q 8)) 1) (q 4 19 (a 62 (c 2 (c 5 (c 27 (c 23 (c 47 (c 95 ()))))))))) 1) (q 2 (i (= 35 (q . -24)) (q 2 62 (c 2 (c 5 (c 27 (c 23 (c (a (i (all (= (a 46 (c 2 (c 83 ()))) 335) (not 95)) (q 2 83 (c -113 (c 335 (c -77 ())))) (q 8)) 1) (c 44 ()))))))) (q 4 19 (a 62 (c 2 (c 5 (c 27 (c 23 (c 47 (c 95 ()))))))))) 1)) 1) (q 4 (c 24 (c (a 22 (c 2 (c 5 (c 39 (c (sha256 44 335) (c (a 46 (c 2 (c -113 ()))) (c (sha256 44 5) ()))))))) 55)) -81)) 1) 1)) (c (q . 0xa04d9f57764f54a43e4030befb4d80026e870519aaa66334aef8304f5d0393c2) (c (q (117 "https://chia-monster.ggames.mobi/chia-monster/images/warriors/females/legendary_warrior_v2.jpg") (104 . 0x9beb5d62e9708e3178414dcf7340bc3547fb6fdeadcf93a397d87dbb432bd923) (28021 "https://chia-monster.ggames.mobi/api/cmt/meta/warrior/6f1cb204-b594-4516-af4c-f9f55e30fd39.json") (27765 "https://chia-monster.ggames.mobi/chia-monster/license.txt") (29550 . 1) (29556 . 1) (28008 . 0x347340029cb9234e7a43d75d4c5649136ac11a97cd75c1137da2444868cab52b) (27752 . 0x724672b619bcbb77d46cba416327376944366d6c71e87abe49be19abbca0444f)) (c (q . 0xfe8a4b4e27a2e29a4d3fc7ce9d527adbcaccbab6ada3903ccf3ba9a769d2d78b) (c (q 2 (q 2 (q 2 38 (c 2 (c 5 (c 23 (c 11 (c (a 47 95) ())))))) (c (q ((-21172 2 . 51) (keccak256 . 4) -10 . 1) ((q . 2) (a (i 5 (q 2 42 (c 2 (c 13 (c (sha256 50 (sha256 60 52) (sha256 50 (sha256 50 (sha256 60 34) 9) (sha256 50 11 (sha256 60 ())))) ())))) (q . 11)) 1) 4 (c 56 (c (a 54 (c 2 (c 5 (c 39 (c (a 46 (c 2 (c (a (i -81 (q . -81) (q . 11)) 1) ()))) (c (sha256 60 79) (c (sha256 60 5) ()))))))) 55)) 367) ((a 62 (c 2 (c 5 (c 11 (c 23 (c 47 (c 47 (q () ())))))))) 11 50 (sha256 60 40) (sha256 50 (sha256 50 (sha256 60 34) 5) (sha256 50 (a 42 (c 2 (c 7 (c (sha256 60 60) ())))) (sha256 60 ())))) (a (i (l 5) (q 11 (q . 2) (a 46 (c 2 (c 9 ()))) (a 46 (c 2 (c 13 ())))) (q 11 (q . 1) 5)) 1) 2 (i 95 (q 2 (i (= 287 56) (q 2 (i (= (logand 1439) 60) (q 2 (i (not -65) (q 2 62 (c 2 (c 5 (c 11 (c 23 (c 47 (c -33 (c 415 (c 383 ()))))))))) (q 8)) 1) (q 4 -97 (a 62 (c 2 (c 5 (c 11 (c 23 (c 47 (c -33 (c -65 (c 383 ()))))))))))) 1) (q 2 (i (= 287 44) (q 2 (i (not 383) (q 4 (c 36 (c (concat 16 (a 46 (c 2 (c 415 ())))) ())) (a 62 (c 2 (c 5 (c 11 (c 23 (c 47 (c -33 (c -65 (c (a 11 (c 23 (c 47 (c 415 ())))) ())))))))))) (q 8)) 1) (q 2 (i (= 287 36) (q 2 (i (not (a (i (= (q . 34) (strlen 671)) (q 2 (i (= (substr 671 () (q . 2)) 16) (q 1 . 1) ()) 1) ()) 1)) (q 4 -97 (a 62 (c 2 (c 5 (c 11 (c 23 (c 47 (c -33 (c -65 (c 383 ())))))))))) (q 8)) 1) (q 4 -97 (a 62 (c 2 (c 5 (c 11 (c 23 (c 47 (c -33 (c -65 (c 383 ()))))))))))) 1)) 1)) 1) (q 2 58 (c 2 (c 5 (c 11 (c -65 (c (a (i 383 (q . 383) (q 2 11 (c 23 (c 47 (q ()))))) 1) ()))))))) 1) 1)) (c (q . 0xc5abea79afaa001b5427dfa0c8cf42ca6f38f5841b78f9b3c252733eb2de2726) (c (q) (c (q 2 (q 2 (q 2 (i -65 (q 4 319 (c () (c (a (i (all 319 (not (= 319 47))) (q 4 (c 16 (c (sha256 (a 46 (c 2 (c 9 (c 1471 (c (a 62 (c 2 (c (c 9 (c 319 29)) ()))) ()))))) 21) ())) (a 22 (c 2 (c 11 (c 23 (c 703 (c 21 ()))))))) (q 2 22 (c 2 (c 11 (c 23 (c 703 (c 21 ()))))))) 1) ()))) (q 4 47 (q () ()))) 1) (c (q ((63 . 2) 4 1 . 1) (10000 2 2 (i 5 (q 2 58 (c 2 (c 13 (c (sha256 42 (sha256 44 20) (sha256 42 (sha256 42 (sha256 44 60) 9) (sha256 42 11 (sha256 44 ())))) ())))) (q . 11)) 1) (a (i 23 (q 4 (c 16 (c (sha256 -89 (a 62 (c 2 (c (c 47 (c (c 5 (c (f (divmod (* 71 11) 18)) (c (c 5 ()) ()))) ())) ())))) ())) (a 22 (c 2 (c 5 (c 11 (c 55 (c 47 ()))))))) ()) 1) (sha256 42 (sha256 44 24) (sha256 42 (sha256 42 (sha256 44 60) 5) (sha256 42 (a 58 (c 2 (c 7 (c (sha256 44 44) ())))) (sha256 44 ())))) 2 (i (l 5) (q 11 (q . 2) (a 62 (c 2 (c 9 ()))) (a 62 (c 2 (c 13 ())))) (q 11 (q . 1) 5)) 1) 1)) (c (q 0x7faa3253bfddd1e0decb0906b2dc6247bbc4cf608f58345d173adb63e8b47c9f 0x1dee7745609c0ebcf4e1cfe01f2b2e7f4deb122eb735217e7af08029ba322b13 . 0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9) (c (q . 0x15865265653a7cb6f807a227aa9ad05498babe13ec906155b2676d5f92f84d40) (c (q) 1)))) (c (q 2 (q 2 (q 2 (i 11 (q 2 (i (= 5 (point_add 11 (pubkey_for_exp (sha256 11 (a 6 (c 2 (c 23 ()))))))) (q 2 23 47) (q 8)) 1) (q 4 (c 4 (c 5 (c (a 6 (c 2 (c 23 ()))) ()))) (a 23 47))) 1) (c (q 50 2 (i (l 5) (q 11 (q . 2) (a 6 (c 2 (c 9 ()))) (a 6 (c 2 (c 13 ())))) (q 11 (q . 1) 5)) 1) 1)) (c (q . 0xafa76c68cfb723922e67dbfa6bda38fd64609b41d2a4498df49a6c839ed8b2d1c042f5961a2ab9b318cc64aef72364a5) 1)) 1))))) 1))))) (0xdebedabb069cb2564157ff1ca5aa80b3cb3d7eb930f52ff1a40b8b78c84f4125 0x9fc9c96a5f2417e8617ea847651ceaf4789e6528a55101457d120c630a8ac030 1) 1 (((() (q (g1_negate 0x291c295548f95c2462caa05165f67e9f6d806153856edcbb84290162e7f810c5 1 (0x291c295548f95c2462caa05165f67e9f6d806153856edcbb84290162e7f810c5)) (-10 () () ())) ())))) -output: ((73 1) (71 0x82acf3e76d5657e98438ad4dc0fcaf84f8e194d78313206ead021e2d5afe5e3a) (g1_multiply 0xafa76c68cfb723922e67dbfa6bda38fd64609b41d2a4498df49a6c839ed8b2d1c042f5961a2ab9b318cc64aef72364a5 0x8f25313e125d83841401ae4bf3831b674256c0fa77c8b30f12dd5a7bce846e75) (keccak256 0xad4c53b883241fddfd1c01b608bd4b6633e3fefd950e27c194aab24e6eb0a49bebd2) (g1_negate 0x899b958268f46b62cc8d2148fef14ce74e8220c507ee9a06a78924fb9efc4d75 1 (0x291c295548f95c2462caa05165f67e9f6d806153856edcbb84290162e7f810c5))) +output: ((73 1) (71 0x82acf3e76d5657e98438ad4dc0fcaf84f8e194d78313206ead021e2d5afe5e3a) (50 0xafa76c68cfb723922e67dbfa6bda38fd64609b41d2a4498df49a6c839ed8b2d1c042f5961a2ab9b318cc64aef72364a5 0x8f25313e125d83841401ae4bf3831b674256c0fa77c8b30f12dd5a7bce846e75) (62 0xad4c53b883241fddfd1c01b608bd4b6633e3fefd950e27c194aab24e6eb0a49bebd2) (51 0x899b958268f46b62cc8d2148fef14ce74e8220c507ee9a06a78924fb9efc4d75 1 (0x291c295548f95c2462caa05165f67e9f6d806153856edcbb84290162e7f810c5))) runtime_cost: 1370969 byte_cost: 9900000 total_cost: 11270969 diff --git a/tests/builtins.yaml b/tests/builtins.yaml index 6043fa29..9c81d7dd 100644 --- a/tests/builtins.yaml +++ b/tests/builtins.yaml @@ -49,8 +49,8 @@ tests: byte_cost: 10596000 total_cost: 44812780 - name: verifications - program: (i (bls_pairing_identity (q . 0x8b202593319bce41b090f3309986de59861ab1e2ff32aef871d83f9aac232c7253c01f1f649c6f69879c441286319de4) (q . 0x942adad4dbeadcfd75aaa11940a5e5e16a8d8e91742029a3944610635ccc0572eceeb1c89d8a0e904c5d30b9497e700312dee7b833535effef24953dbf8f8aa770e2f1a8e01d3b6f6844e01a635ed95664babe9d62a2572651d0258461c8ba00) (q . 0xb7f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb) (q . 0x80c37921e62092ef55f85f9eccb21bd80cfaafc0bce9cbdd6999b1a8cabadc8f23720f0261efafaf53cbcc74580b9432007b66d824668900a94934f184bc41bf9ccf9ec141c6f7da610aa7296cd0a181ae8fe176b607aa4c367f15ee0cb985d7)) (all (bls_verify (q . 0x80c37921e62092ef55f85f9eccb21bd80cfaafc0bce9cbdd6999b1a8cabadc8f23720f0261efafaf53cbcc74580b9432007b66d824668900a94934f184bc41bf9ccf9ec141c6f7da610aa7296cd0a181ae8fe176b607aa4c367f15ee0cb985d7) (q . 0x8b202593319bce41b090f3309986de59861ab1e2ff32aef871d83f9aac232c7253c01f1f649c6f69879c441286319de4) (q . 0x39cb1950dba19a7bee9924b5bd2b29f190ffe4ef)) (0x13d61f00 (q . 0x02390b19842e100324163334b16947f66125b76d4fa4a11b9ccdde9b7398e64076) (q . 0x85932e4d075615be881398cc765f9f78204033f0ef5f832ac37e732f5f0cbda2) (q . 0x481477e62a1d02268127ae89cc58929e09ad5d30229721965ae35965d098a5f630205a7e69f4cb8084f16c7407ed7312994ffbf87ba5eb1aee16682dd324943e)) (0x1c3a8f00 (q . 0x033e1a1b2ccbc35883c60fdfc3f4a02175096ade6271fe85517ca5772594bbd0dc) (q . 0x85932e4d075615be881398cc765f9f78204033f0ef5f832ac37e732f5f0cbda2) (q . 0xeae2f488080919bd0a7069c24cdd9c6ce2db423861b0c9d4236cdadbd0005f6d8f3709e6eb19249fd9c8bea664aba35218e67ea4b0f2239488dc3147f336e1e6))) ()) - debug_program: (i (q . 1) (i (q . 1) (i (q . 1) (i (q . 1) () (0x1c3a8f00 (q . 0x033e1a1b2ccbc35883c60fdfc3f4a02175096ade6271fe85517ca5772594bbd0dc) (q . 0x85932e4d075615be881398cc765f9f78204033f0ef5f832ac37e732f5f0cbda2) (q . 0xeae2f488080919bd0a7069c24cdd9c6ce2db423861b0c9d4236cdadbd0005f6d8f3709e6eb19249fd9c8bea664aba35218e67ea4b0f2239488dc3147f336e1e6))) (0x13d61f00 (q . 0x02390b19842e100324163334b16947f66125b76d4fa4a11b9ccdde9b7398e64076) (q . 0x85932e4d075615be881398cc765f9f78204033f0ef5f832ac37e732f5f0cbda2) (q . 0x481477e62a1d02268127ae89cc58929e09ad5d30229721965ae35965d098a5f630205a7e69f4cb8084f16c7407ed7312994ffbf87ba5eb1aee16682dd324943e))) (bls_verify (q . 0x80c37921e62092ef55f85f9eccb21bd80cfaafc0bce9cbdd6999b1a8cabadc8f23720f0261efafaf53cbcc74580b9432007b66d824668900a94934f184bc41bf9ccf9ec141c6f7da610aa7296cd0a181ae8fe176b607aa4c367f15ee0cb985d7) (q . 0x8b202593319bce41b090f3309986de59861ab1e2ff32aef871d83f9aac232c7253c01f1f649c6f69879c441286319de4) (q . 0x39cb1950dba19a7bee9924b5bd2b29f190ffe4ef))) (bls_pairing_identity (q . 0x8b202593319bce41b090f3309986de59861ab1e2ff32aef871d83f9aac232c7253c01f1f649c6f69879c441286319de4) (q . 0x942adad4dbeadcfd75aaa11940a5e5e16a8d8e91742029a3944610635ccc0572eceeb1c89d8a0e904c5d30b9497e700312dee7b833535effef24953dbf8f8aa770e2f1a8e01d3b6f6844e01a635ed95664babe9d62a2572651d0258461c8ba00) (q . 0xb7f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb) (q . 0x80c37921e62092ef55f85f9eccb21bd80cfaafc0bce9cbdd6999b1a8cabadc8f23720f0261efafaf53cbcc74580b9432007b66d824668900a94934f184bc41bf9ccf9ec141c6f7da610aa7296cd0a181ae8fe176b607aa4c367f15ee0cb985d7))) + program: (i (bls_pairing_identity (q . 0x8b202593319bce41b090f3309986de59861ab1e2ff32aef871d83f9aac232c7253c01f1f649c6f69879c441286319de4) (q . 0x942adad4dbeadcfd75aaa11940a5e5e16a8d8e91742029a3944610635ccc0572eceeb1c89d8a0e904c5d30b9497e700312dee7b833535effef24953dbf8f8aa770e2f1a8e01d3b6f6844e01a635ed95664babe9d62a2572651d0258461c8ba00) (q . 0xb7f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb) (q . 0x80c37921e62092ef55f85f9eccb21bd80cfaafc0bce9cbdd6999b1a8cabadc8f23720f0261efafaf53cbcc74580b9432007b66d824668900a94934f184bc41bf9ccf9ec141c6f7da610aa7296cd0a181ae8fe176b607aa4c367f15ee0cb985d7)) (all (bls_verify (q . 0x80c37921e62092ef55f85f9eccb21bd80cfaafc0bce9cbdd6999b1a8cabadc8f23720f0261efafaf53cbcc74580b9432007b66d824668900a94934f184bc41bf9ccf9ec141c6f7da610aa7296cd0a181ae8fe176b607aa4c367f15ee0cb985d7) (q . 0x8b202593319bce41b090f3309986de59861ab1e2ff32aef871d83f9aac232c7253c01f1f649c6f69879c441286319de4) (q . 0x39cb1950dba19a7bee9924b5bd2b29f190ffe4ef)) (secp256k1_verify (q . 0x02390b19842e100324163334b16947f66125b76d4fa4a11b9ccdde9b7398e64076) (q . 0x85932e4d075615be881398cc765f9f78204033f0ef5f832ac37e732f5f0cbda2) (q . 0x481477e62a1d02268127ae89cc58929e09ad5d30229721965ae35965d098a5f630205a7e69f4cb8084f16c7407ed7312994ffbf87ba5eb1aee16682dd324943e)) (secp256r1_verify (q . 0x033e1a1b2ccbc35883c60fdfc3f4a02175096ade6271fe85517ca5772594bbd0dc) (q . 0x85932e4d075615be881398cc765f9f78204033f0ef5f832ac37e732f5f0cbda2) (q . 0xeae2f488080919bd0a7069c24cdd9c6ce2db423861b0c9d4236cdadbd0005f6d8f3709e6eb19249fd9c8bea664aba35218e67ea4b0f2239488dc3147f336e1e6))) ()) + debug_program: (i (q . 1) (i (q . 1) (i (q . 1) (i (q . 1) () (secp256r1_verify (q . 0x033e1a1b2ccbc35883c60fdfc3f4a02175096ade6271fe85517ca5772594bbd0dc) (q . 0x85932e4d075615be881398cc765f9f78204033f0ef5f832ac37e732f5f0cbda2) (q . 0xeae2f488080919bd0a7069c24cdd9c6ce2db423861b0c9d4236cdadbd0005f6d8f3709e6eb19249fd9c8bea664aba35218e67ea4b0f2239488dc3147f336e1e6))) (secp256k1_verify (q . 0x02390b19842e100324163334b16947f66125b76d4fa4a11b9ccdde9b7398e64076) (q . 0x85932e4d075615be881398cc765f9f78204033f0ef5f832ac37e732f5f0cbda2) (q . 0x481477e62a1d02268127ae89cc58929e09ad5d30229721965ae35965d098a5f630205a7e69f4cb8084f16c7407ed7312994ffbf87ba5eb1aee16682dd324943e))) (bls_verify (q . 0x80c37921e62092ef55f85f9eccb21bd80cfaafc0bce9cbdd6999b1a8cabadc8f23720f0261efafaf53cbcc74580b9432007b66d824668900a94934f184bc41bf9ccf9ec141c6f7da610aa7296cd0a181ae8fe176b607aa4c367f15ee0cb985d7) (q . 0x8b202593319bce41b090f3309986de59861ab1e2ff32aef871d83f9aac232c7253c01f1f649c6f69879c441286319de4) (q . 0x39cb1950dba19a7bee9924b5bd2b29f190ffe4ef))) (bls_pairing_identity (q . 0x8b202593319bce41b090f3309986de59861ab1e2ff32aef871d83f9aac232c7253c01f1f649c6f69879c441286319de4) (q . 0x942adad4dbeadcfd75aaa11940a5e5e16a8d8e91742029a3944610635ccc0572eceeb1c89d8a0e904c5d30b9497e700312dee7b833535effef24953dbf8f8aa770e2f1a8e01d3b6f6844e01a635ed95664babe9d62a2572651d0258461c8ba00) (q . 0xb7f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb) (q . 0x80c37921e62092ef55f85f9eccb21bd80cfaafc0bce9cbdd6999b1a8cabadc8f23720f0261efafaf53cbcc74580b9432007b66d824668900a94934f184bc41bf9ccf9ec141c6f7da610aa7296cd0a181ae8fe176b607aa4c367f15ee0cb985d7))) output: () runtime_cost: 12751695 byte_cost: 9600000 diff --git a/tests/expressions/const_expr.yaml b/tests/expressions/const_expr.yaml index 6be08d41..d496f058 100644 --- a/tests/expressions/const_expr.yaml +++ b/tests/expressions/const_expr.yaml @@ -23,14 +23,14 @@ tests: - name: pair program: (q 1 . 2) debug_program: (c (q . 1) (q . 2)) - output: (q . 2) + output: (1 . 2) runtime_cost: 20 byte_cost: 60000 total_cost: 60020 - name: list program: (q 1 2 3) debug_program: (c (q . 1) (c (q . 2) (c (q . 3) ()))) - output: (q 2 3) + output: (1 2 3) runtime_cost: 20 byte_cost: 108000 total_cost: 108020 diff --git a/tests/expressions/lists.yaml b/tests/expressions/lists.yaml index 7ad41bbd..515466c6 100644 --- a/tests/expressions/lists.yaml +++ b/tests/expressions/lists.yaml @@ -2,14 +2,14 @@ tests: - name: list program: (q 1 2 3) debug_program: (c (q . 1) (c (q . 2) (c (q . 3) ()))) - output: (q 2 3) + output: (1 2 3) runtime_cost: 20 byte_cost: 108000 total_cost: 108020 - name: list_spread program: (q 1 2 3) debug_program: (c (q . 1) (c (q . 2) (c (q . 3) ()))) - output: (q 2 3) + output: (1 2 3) runtime_cost: 20 byte_cost: 108000 total_cost: 108020 @@ -44,14 +44,14 @@ tests: - name: pair_list program: (q 1 2 3) debug_program: (c (q . 1) (c (q . 2) (c (q . 3) ()))) - output: (q 2 3) + output: (1 2 3) runtime_cost: 20 byte_cost: 108000 total_cost: 108020 - name: list_spread_pair program: (q 1 2 3) debug_program: (c (q . 1) (c (q . 2) (c (q . 3) ()))) - output: (q 2 3) + output: (1 2 3) runtime_cost: 20 byte_cost: 108000 total_cost: 108020 diff --git a/tests/literals.yaml b/tests/literals.yaml index fcfd1c9a..c4129b48 100644 --- a/tests/literals.yaml +++ b/tests/literals.yaml @@ -1,15 +1,15 @@ tests: - name: number - program: (q . 0x00a410) - debug_program: (q . 0x00a410) - output: '0x00a410' + program: (q . 42000) + debug_program: (q . 42000) + output: '42000' runtime_cost: 20 byte_cost: 72000 total_cost: 72020 - name: hex - program: (q . 0xcafef00d) - debug_program: (q . 0xcafef00d) - output: '0xcafef00d' + program: (q . -889262067) + debug_program: (q . -889262067) + output: '-889262067' runtime_cost: 20 byte_cost: 84000 total_cost: 84020 diff --git a/tests/std.yaml b/tests/std.yaml index 2af2f4fa..2fca3280 100644 --- a/tests/std.yaml +++ b/tests/std.yaml @@ -7,7 +7,7 @@ tests: byte_cost: 19380000 total_cost: 19501231 - name: hashing - program: (a (q 2 (i (= (a 2 (c 2 (q . "hello"))) (q . 0xcceeb7a985ecc3dabcb4c8f666cd637f16f008e3c963db6aa6f83a7b288c54ef)) (q 2 (i (= (a 2 (c 2 (q . "hello"))) (sha256 (q . 0x0168656c6c6f))) (q 2 (i (= (sha256 (q . 0x0168656c6c6f)) (sha256 (q . 0x0168656c6c6f))) (q) (q 8)) 1) (q 8)) 1) (q 8)) 1) (c (q 2 (i (l 3) (q 11 (q . 2) (a 2 (c 2 5)) (a 2 (c 2 7))) (q 11 (q . 1) 3)) 1) ())) + program: (a (q 2 (i (= (a 2 (c 2 (q . "hello"))) (q . 0xcceeb7a985ecc3dabcb4c8f666cd637f16f008e3c963db6aa6f83a7b288c54ef)) (q 2 (i (= (a 2 (c 2 (q . "hello"))) (sha256 (q . 1547889831023))) (q 2 (i (= (sha256 (q . 1547889831023)) (sha256 (q . 1547889831023))) (q) (q 8)) 1) (q 8)) 1) (q 8)) 1) (c (q 2 (i (l 3) (q 11 (q . 2) (a 2 (c 2 5)) (a 2 (c 2 7))) (q 11 (q . 1) 3)) 1) ())) debug_program: (a (q 2 (i (= (a 2 (c 2 (q . "hello"))) (q . 0xcceeb7a985ecc3dabcb4c8f666cd637f16f008e3c963db6aa6f83a7b288c54ef)) (q 2 (i (= (a 2 (c 2 (q . "hello"))) (sha256 (concat (q . 1) (q . "hello")))) (q 2 (i (= (sha256 (concat (q . 1) (q . "hello"))) (sha256 (concat (q . 1) (q . "hello")))) (q) (q 8 (q . "assertion failed at std.rue:58:5"))) 1) (q 8 (q . "assertion failed at std.rue:57:5"))) 1) (q 8 (q . "assertion failed at std.rue:56:5"))) 1) (c (q 2 (i (not (l 3)) (q 11 (concat (q . 1) 3)) (q 11 (concat (concat (q . 2) (a 2 (c 2 (f 3)))) (a 2 (c 2 (r 3)))))) 1) ())) output: () runtime_cost: 5767 diff --git a/tests/stress/many_params_non_overflow.yaml b/tests/stress/many_params_non_overflow.yaml index 852d6cc5..5e8fdcae 100644 --- a/tests/stress/many_params_non_overflow.yaml +++ b/tests/stress/many_params_non_overflow.yaml @@ -1,9 +1,9 @@ tests: - name: closure - program: (q 2 (i (> (+ 2 5 11 23 47 95 -65 383 767 1535 3071 6143 12287 24575 -16385 0x017fff 0x02ffff 0x05ffff 0x0bffff 0x17ffff 0x2fffff 0x5fffff 0xbfffff 0x017fffff 0x02ffffff 0x05ffffff) ()) (q) (q 8)) 1) - debug_program: (a (q 4 (q . 2) (c (c (q . 1) 2) (c (q . 1) ()))) (c (q 2 (i (> (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ 2 5) 11) 23) 47) 95) -65) 383) 767) 1535) 3071) 6143) 12287) 24575) -16385) 0x017fff) 0x02ffff) 0x05ffff) 0x0bffff) 0x17ffff) 0x2fffff) 0x5fffff) 0xbfffff) 0x017fffff) 0x02ffffff) 0x05ffffff) ()) (q) (q 8 (q . "assertion failed at many_params_non_overflow.rue:95:5"))) 1) ())) - output: (a (i (> (+ 2 5 11 23 47 95 -65 383 767 1535 3071 6143 12287 24575 -16385 0x017fff 0x02ffff 0x05ffff 0x0bffff 0x17ffff 0x2fffff 0x5fffff 0xbfffff 0x017fffff 0x02ffffff 0x05ffffff) ()) (q) (q 8)) 1) - debug_output: (a (q 2 (i (> (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ 2 5) 11) 23) 47) 95) -65) 383) 767) 1535) 3071) 6143) 12287) 24575) -16385) 0x017fff) 0x02ffff) 0x05ffff) 0x0bffff) 0x17ffff) 0x2fffff) 0x5fffff) 0xbfffff) 0x017fffff) 0x02ffffff) 0x05ffffff) ()) (q) (q 8 (q . "assertion failed at many_params_non_overflow.rue:95:5"))) 1) 1) + program: (q 2 (i (> (+ 2 5 11 23 47 95 -65 383 767 1535 3071 6143 12287 24575 -16385 98303 196607 393215 786431 1572863 3145727 6291455 -4194305 25165823 50331647 100663295) ()) (q) (q 8)) 1) + debug_program: (a (q 4 (q . 2) (c (c (q . 1) 2) (c (q . 1) ()))) (c (q 2 (i (> (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ 2 5) 11) 23) 47) 95) -65) 383) 767) 1535) 3071) 6143) 12287) 24575) -16385) 98303) 196607) 393215) 786431) 1572863) 3145727) 6291455) -4194305) 25165823) 50331647) 100663295) ()) (q) (q 8 (q . "assertion failed at many_params_non_overflow.rue:95:5"))) 1) ())) + output: (2 (3 (21 (16 2 5 11 23 47 95 -65 383 767 1535 3071 6143 12287 24575 -16385 98303 196607 393215 786431 1572863 3145727 6291455 -4194305 25165823 50331647 100663295) ()) (1) (1 8)) 1) + debug_output: (2 (1 2 (3 (21 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 (16 2 5) 11) 23) 47) 95) -65) 383) 767) 1535) 3071) 6143) 12287) 24575) -16385) 98303) 196607) 393215) 786431) 1572863) 3145727) 6291455) -4194305) 25165823) 50331647) 100663295) ()) (1) (1 8 (1 . "assertion failed at many_params_non_overflow.rue:95:5"))) 1) 1) runtime_cost: 20 byte_cost: 1632000 total_cost: 1632020 @@ -16,7 +16,7 @@ tests: total_cost: 468942 - name: call_extern program: (i () (a (i (> (q . 351) ()) (q) (q 8)) 1) ()) - debug_program: (a (q 3 (q . 1) () (a 2 (c (q . 1) (c (q . 2) (c (q . 3) (c (q . 4) (c (q . 5) (c (q . 6) (c (q . 7) (c (q . 8) (c (q . 9) (c (q . 10) (c (q . 11) (c (q . 12) (c (q . 13) (c (q . 14) (c (q . 15) (c (q . 16) (c (q . 17) (c (q . 18) (c (q . 19) (c (q . 20) (c (q . 21) (c (q . 22) (c (q . 23) (c (q . 24) (c (q . 25) (c (q . 26) ())))))))))))))))))))))))))))) (c (q 2 (i (> (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ 2 5) 11) 23) 47) 95) -65) 383) 767) 1535) 3071) 6143) 12287) 24575) -16385) 0x017fff) 0x02ffff) 0x05ffff) 0x0bffff) 0x17ffff) 0x2fffff) 0x5fffff) 0xbfffff) 0x017fffff) 0x02ffffff) 0x05ffffff) ()) (q) (q 8 (q . "assertion failed at many_params_non_overflow.rue:153:5"))) 1) ())) + debug_program: (a (q 3 (q . 1) () (a 2 (c (q . 1) (c (q . 2) (c (q . 3) (c (q . 4) (c (q . 5) (c (q . 6) (c (q . 7) (c (q . 8) (c (q . 9) (c (q . 10) (c (q . 11) (c (q . 12) (c (q . 13) (c (q . 14) (c (q . 15) (c (q . 16) (c (q . 17) (c (q . 18) (c (q . 19) (c (q . 20) (c (q . 21) (c (q . 22) (c (q . 23) (c (q . 24) (c (q . 25) (c (q . 26) ())))))))))))))))))))))))))))) (c (q 2 (i (> (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ (+ 2 5) 11) 23) 47) 95) -65) 383) 767) 1535) 3071) 6143) 12287) 24575) -16385) 98303) 196607) 393215) 786431) 1572863) 3145727) 6291455) -4194305) 25165823) 50331647) 100663295) ()) (q) (q 8 (q . "assertion failed at many_params_non_overflow.rue:153:5"))) 1) ())) output: () runtime_cost: 942 byte_cost: 468000 diff --git a/tests/symbols/closures.yaml b/tests/symbols/closures.yaml index 573f91e2..a1eb8cb9 100644 --- a/tests/symbols/closures.yaml +++ b/tests/symbols/closures.yaml @@ -2,38 +2,38 @@ tests: - name: no_captures program: (q 1 . 42) debug_program: (c (q . 2) (c (c (q . 1) (q 1 . 42)) (c () ()))) - output: (q . 42) - debug_output: (a (q 1 . 42) ()) + output: (1 . 42) + debug_output: (2 (1 1 . 42) ()) runtime_cost: 20 byte_cost: 60000 total_cost: 60020 - name: one_capture program: (a (q 4 (q . 2) (c (c (q . 1) (q 16 2 2)) (c (c (q . 4) (c (c (q . 1) 2) (c () ()))) ()))) (c (q . 42) 1)) debug_program: (a (q 4 (q . 2) (c (c (q . 1) (q 16 2 2)) (c (c (q . 4) (c (c (q . 1) 2) (c () ()))) ()))) (c (q . 42) 1)) - output: (a (q 16 2 2) (c (q . 42) ())) + output: (2 (1 16 2 2) (4 (1 . 42) ())) runtime_cost: 914 byte_cost: 972000 total_cost: 972914 - name: one_inline_capture program: (q 1 . 84) debug_program: (c (q . 2) (c (c (q . 1) (q 16 (q . 42) (q . 42))) (c () ()))) - output: (q . 84) - debug_output: (a (q 16 (q . 42) (q . 42)) ()) + output: (1 . 84) + debug_output: (2 (1 16 (1 . 42) (1 . 42)) ()) runtime_cost: 20 byte_cost: 60000 total_cost: 60020 - name: two_captures program: (a (q 4 (q . 2) (c (c (q . 1) (q 16 (* 5 5) (* 2 2))) (c (c (q . 4) (c (c (q . 1) 6) (c (c (q . 4) (c (c (q . 1) 4) (c () ()))) ()))) ()))) (c (q 42 . 34) 1)) debug_program: (a (q 4 (q . 2) (c (c (q . 1) (q 16 (* 5 5) (* 2 2))) (c (c (q . 4) (c (c (q . 1) 6) (c (c (q . 4) (c (c (q . 1) 4) (c () ()))) ()))) ()))) (c (c (q . 42) (q . 34)) 1)) - output: (a (q 16 (* 5 5) (* 2 2)) (c (q . 34) (c (q . 42) ()))) + output: (2 (1 16 (18 5 5) (18 2 2)) (4 (1 . 34) (4 (1 . 42) ()))) runtime_cost: 1258 byte_cost: 1476000 total_cost: 1477258 - name: two_inline_captures program: (q 1 . 2920) debug_program: (c (q . 2) (c (c (q . 1) (q 16 (* (q . 42) (q . 42)) (* (q . 34) (q . 34)))) (c () ()))) - output: (q . 2920) - debug_output: (a (q 16 (* (q . 42) (q . 42)) (* (q . 34) (q . 34))) ()) + output: (1 . 2920) + debug_output: (2 (1 16 (18 (1 . 42) (1 . 42)) (18 (1 . 34) (1 . 34))) ()) runtime_cost: 20 byte_cost: 84000 total_cost: 84020 diff --git a/tests/types/functions.yaml b/tests/types/functions.yaml index 872b0174..7383b45a 100644 --- a/tests/types/functions.yaml +++ b/tests/types/functions.yaml @@ -2,24 +2,24 @@ tests: - name: direct_assignment program: (q 18 2 2) debug_program: (c (q . 2) (c (c (q . 1) (q 18 2 2)) (c (q . 1) ()))) - output: (* 2 2) - debug_output: (a (q 18 2 2) 1) + output: (18 2 2) + debug_output: (2 (1 18 2 2) 1) runtime_cost: 20 byte_cost: 108000 total_cost: 108020 - name: assign_to_union program: (q 18 2 2) debug_program: (c (q . 2) (c (c (q . 1) (q 18 2 2)) (c (q . 1) ()))) - output: (* 2 2) - debug_output: (a (q 18 2 2) 1) + output: (18 2 2) + debug_output: (2 (1 18 2 2) 1) runtime_cost: 20 byte_cost: 108000 total_cost: 108020 - name: assign_union_to_union program: (q 18 2 2) debug_program: (a (q . 2) (c (c (q . 2) (c (c (q . 1) (q 18 2 2)) (c (q . 1) ()))) 1)) - output: (* 2 2) - debug_output: (a (q 18 2 2) 1) + output: (18 2 2) + debug_output: (2 (1 18 2 2) 1) runtime_cost: 20 byte_cost: 108000 total_cost: 108020 diff --git a/tests/warnings/unused_types.yaml b/tests/warnings/unused_types.yaml index 544e4701..d43418ee 100644 --- a/tests/warnings/unused_types.yaml +++ b/tests/warnings/unused_types.yaml @@ -1,6 +1,6 @@ program: (q 34 . 42) debug_program: (c (q . 34) (q . 42)) -output: (all . 42) +output: (34 . 42) runtime_cost: 20 byte_cost: 60000 total_cost: 60020 diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index b2dbc817..3673b8b3 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-wasm" -version = "0.10.0" +version = "0.11.0" edition = "2024" publish = false license = "Apache-2.0" @@ -23,6 +23,6 @@ rue-compiler = { workspace = true } rue-options = { workspace = true } rue-diagnostic = { workspace = true } clvmr = { workspace = true } -chialisp = { workspace = true } +rue-clvm = { workspace = true } wasm-bindgen = { workspace = true } console_error_panic_hook = { workspace = true } diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index e8278ebc..f23441b5 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -1,7 +1,7 @@ use std::{path::Path, sync::Arc}; -use chialisp::classic::clvm_tools::binutils::disassemble; use clvmr::Allocator; +use rue_clvm::disassemble_program; use rue_compiler::{Compiler, File, FileTree}; use rue_diagnostic::{Source, SourceKind}; use rue_options::CompilerOptions; @@ -45,7 +45,7 @@ pub fn compile(source: String) -> Result { &kind, Path::new(".").to_path_buf(), )? - .map(|program| disassemble(&allocator, program, None)); + .map(|program| disassemble_program(&allocator, program)); let diagnostics = ctx .take_diagnostics()