From a1c49b5c7946dc442c853bda84d068425b9cd37c Mon Sep 17 00:00:00 2001 From: Rigidity Date: Sun, 1 Feb 2026 22:48:40 -0500 Subject: [PATCH] Add some more stdlib utils and bump to 0.8.2 --- Cargo.lock | 26 ++++----- Cargo.toml | 18 +++--- crates/rue-ast/Cargo.toml | 2 +- crates/rue-cli/Cargo.toml | 2 +- crates/rue-compiler/Cargo.toml | 2 +- crates/rue-compiler/src/std/merkle.rue | 70 +++++++++++++++++++++++ crates/rue-compiler/src/std/offer.rue | 12 ++++ crates/rue-compiler/src/std/prelude.rue | 4 ++ crates/rue-compiler/src/std/singleton.rue | 18 ++++++ crates/rue-diagnostic/Cargo.toml | 2 +- crates/rue-hir/Cargo.toml | 2 +- crates/rue-lexer/Cargo.toml | 2 +- crates/rue-lir/Cargo.toml | 2 +- crates/rue-lsp/Cargo.toml | 2 +- crates/rue-options/Cargo.toml | 2 +- crates/rue-parser/Cargo.toml | 2 +- crates/rue-tests/Cargo.toml | 2 +- crates/rue-types/Cargo.toml | 2 +- examples/puzzles/cat.rue | 5 +- examples/puzzles/cat.yaml | 8 +-- wasm/Cargo.toml | 2 +- 21 files changed, 145 insertions(+), 42 deletions(-) create mode 100644 crates/rue-compiler/src/std/merkle.rue create mode 100644 crates/rue-compiler/src/std/offer.rue create mode 100644 crates/rue-compiler/src/std/singleton.rue diff --git a/Cargo.lock b/Cargo.lock index 0318fe95..f5136a8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1712,7 +1712,7 @@ dependencies = [ [[package]] name = "rue-ast" -version = "0.8.1" +version = "0.8.2" dependencies = [ "paste", "rue-parser", @@ -1720,7 +1720,7 @@ dependencies = [ [[package]] name = "rue-cli" -version = "0.8.1" +version = "0.8.2" dependencies = [ "anyhow", "chialisp", @@ -1738,7 +1738,7 @@ dependencies = [ [[package]] name = "rue-compiler" -version = "0.8.1" +version = "0.8.2" dependencies = [ "clvmr", "expect-test", @@ -1763,14 +1763,14 @@ dependencies = [ [[package]] name = "rue-diagnostic" -version = "0.8.1" +version = "0.8.2" dependencies = [ "thiserror 2.0.14", ] [[package]] name = "rue-hir" -version = "0.8.1" +version = "0.8.2" dependencies = [ "derive_more", "expect-test", @@ -1787,14 +1787,14 @@ dependencies = [ [[package]] name = "rue-lexer" -version = "0.8.1" +version = "0.8.2" dependencies = [ "expect-test", ] [[package]] name = "rue-lir" -version = "0.8.1" +version = "0.8.2" dependencies = [ "chialisp", "clvm-traits", @@ -1811,7 +1811,7 @@ dependencies = [ [[package]] name = "rue-lsp" -version = "0.8.1" +version = "0.8.2" dependencies = [ "indexmap", "rowan", @@ -1827,7 +1827,7 @@ dependencies = [ [[package]] name = "rue-options" -version = "0.8.1" +version = "0.8.2" dependencies = [ "serde", "thiserror 2.0.14", @@ -1836,7 +1836,7 @@ dependencies = [ [[package]] name = "rue-parser" -version = "0.8.1" +version = "0.8.2" dependencies = [ "derive_more", "expect-test", @@ -1851,7 +1851,7 @@ dependencies = [ [[package]] name = "rue-tests" -version = "0.8.1" +version = "0.8.2" dependencies = [ "anyhow", "chialisp", @@ -1868,7 +1868,7 @@ dependencies = [ [[package]] name = "rue-types" -version = "0.8.1" +version = "0.8.2" dependencies = [ "clvmr", "derive_more", @@ -1883,7 +1883,7 @@ dependencies = [ [[package]] name = "rue-wasm" -version = "0.8.1" +version = "0.8.2" dependencies = [ "chialisp", "clvmr", diff --git a/Cargo.toml b/Cargo.toml index d34230bf..f4f73d13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,15 +42,15 @@ cast_possible_truncation = "allow" case_sensitive_file_extension_comparisons = "allow" [workspace.dependencies] -rue-lexer = { path = "crates/rue-lexer", version = "0.8.1" } -rue-parser = { path = "crates/rue-parser", version = "0.8.1" } -rue-diagnostic = { path = "crates/rue-diagnostic", version = "0.8.1" } -rue-ast = { path = "crates/rue-ast", version = "0.8.1" } -rue-compiler = { path = "crates/rue-compiler", version = "0.8.1" } -rue-options = { path = "crates/rue-options", version = "0.8.1" } -rue-lir = { path = "crates/rue-lir", version = "0.8.1" } -rue-hir = { path = "crates/rue-hir", version = "0.8.1" } -rue-types = { path = "crates/rue-types", version = "0.8.1" } +rue-lexer = { path = "crates/rue-lexer", version = "0.8.2" } +rue-parser = { path = "crates/rue-parser", version = "0.8.2" } +rue-diagnostic = { path = "crates/rue-diagnostic", version = "0.8.2" } +rue-ast = { path = "crates/rue-ast", version = "0.8.2" } +rue-compiler = { path = "crates/rue-compiler", version = "0.8.2" } +rue-options = { path = "crates/rue-options", version = "0.8.2" } +rue-lir = { path = "crates/rue-lir", version = "0.8.2" } +rue-hir = { path = "crates/rue-hir", version = "0.8.2" } +rue-types = { path = "crates/rue-types", version = "0.8.2" } anyhow = "1.0.98" clvm-traits = "0.28.1" clvm-utils = "0.28.1" diff --git a/crates/rue-ast/Cargo.toml b/crates/rue-ast/Cargo.toml index 46be2989..c42a58d1 100644 --- a/crates/rue-ast/Cargo.toml +++ b/crates/rue-ast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-ast" -version = "0.8.1" +version = "0.8.2" 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 a8d6f9f2..db55cfca 100644 --- a/crates/rue-cli/Cargo.toml +++ b/crates/rue-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-cli" -version = "0.8.1" +version = "0.8.2" edition = "2024" license = "Apache-2.0" description = "A CLI tool for invoking the Rue compiler." diff --git a/crates/rue-compiler/Cargo.toml b/crates/rue-compiler/Cargo.toml index dc5b8a20..49cd3a57 100644 --- a/crates/rue-compiler/Cargo.toml +++ b/crates/rue-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-compiler" -version = "0.8.1" +version = "0.8.2" edition = "2024" license = "Apache-2.0" description = "A compiler for the Rue programming language." diff --git a/crates/rue-compiler/src/std/merkle.rue b/crates/rue-compiler/src/std/merkle.rue new file mode 100644 index 00000000..1414f431 --- /dev/null +++ b/crates/rue-compiler/src/std/merkle.rue @@ -0,0 +1,70 @@ +// merkle.rue by yakuhito + +import tree_hash::{tree_hash_atom, tree_hash_pair}; + +export struct MerkleProof { + path: Int, + ...hashes: List, +} + +export fn calculate_merkle_root( + path: Int, + current_hash: Bytes32, + additional_steps: List, +) -> Bytes32 { + if additional_steps is nil { + return current_hash; + } + + calculate_merkle_root( + path >>> 1, + tree_hash_pair( + inline if path & 1 != 0 { + additional_steps.first + } else { + current_hash + }, + inline if path & 1 != 0 { + current_hash + } else { + additional_steps.first + } + ), + additional_steps.rest + ) +} + +fn simplify_merkle_proof_after_leaf( + leaf_hash: Bytes32, + proof: MerkleProof, +) -> Bytes32 { + if proof.hashes is nil { + return leaf_hash; + } + + simplify_merkle_proof_after_leaf( + tree_hash_pair( + inline if proof.path & 1 != 0 { + proof.hashes.first + } else { + leaf_hash + }, + inline if proof.path & 1 != 0 { + leaf_hash + } else { + proof.hashes.first + } + ), + MerkleProof { + path: proof.path >>> 1, + hashes: proof.hashes.rest + } + ) +} + +export inline fn simplify_merkle_proof( + leaf: Bytes32, + proof: MerkleProof, +) -> Bytes32 { + simplify_merkle_proof_after_leaf(tree_hash_atom(leaf), proof) +} diff --git a/crates/rue-compiler/src/std/offer.rue b/crates/rue-compiler/src/std/offer.rue new file mode 100644 index 00000000..ba3028cb --- /dev/null +++ b/crates/rue-compiler/src/std/offer.rue @@ -0,0 +1,12 @@ +import conditions::types::Memos; + +export struct NotarizedPayment { + nonce: Bytes32, + ...payments: List, +} + +export struct Payment { + puzzle_hash: Bytes32, + amount: Int, + ...memos: Memos | nil, +} diff --git a/crates/rue-compiler/src/std/prelude.rue b/crates/rue-compiler/src/std/prelude.rue index f0d74d5c..3328546a 100644 --- a/crates/rue-compiler/src/std/prelude.rue +++ b/crates/rue-compiler/src/std/prelude.rue @@ -4,10 +4,14 @@ export curry_tree_hash::*; export conditions::message_flags::*; export conditions::opcodes::*; export conditions::types::*; +export merkle::*; export mod std { export conditions; export curry_tree_hash; export tree_hash; export utils; + export merkle; + export offer; + export singleton; } diff --git a/crates/rue-compiler/src/std/singleton.rue b/crates/rue-compiler/src/std/singleton.rue new file mode 100644 index 00000000..c6ef14aa --- /dev/null +++ b/crates/rue-compiler/src/std/singleton.rue @@ -0,0 +1,18 @@ +export struct SingletonStruct { + mod_hash: Bytes32, + launcher_id: Bytes32, + ...launcher_puzzle_hash: Bytes32, +} + +export type Proof = LineageProof | EveProof; + +export struct LineageProof { + parent_parent_coin_info: Bytes32, + parent_inner_puzzle_hash: Bytes32, + parent_amount: Int, +} + +export struct EveProof { + parent_parent_coin_info: Bytes32, + parent_amount: Int, +} diff --git a/crates/rue-diagnostic/Cargo.toml b/crates/rue-diagnostic/Cargo.toml index 054d4607..0460a172 100644 --- a/crates/rue-diagnostic/Cargo.toml +++ b/crates/rue-diagnostic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-diagnostic" -version = "0.8.1" +version = "0.8.2" edition = "2024" license = "Apache-2.0" description = "All of the potential diagnostics that can be emitted by the Rue compiler." diff --git a/crates/rue-hir/Cargo.toml b/crates/rue-hir/Cargo.toml index 1c6ed100..8dad6c7c 100644 --- a/crates/rue-hir/Cargo.toml +++ b/crates/rue-hir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-hir" -version = "0.8.1" +version = "0.8.2" edition = "2024" license = "Apache-2.0" description = "Provides a high-level intermediate representation of the Rue programming language." diff --git a/crates/rue-lexer/Cargo.toml b/crates/rue-lexer/Cargo.toml index e58b85fd..0ad6cd11 100644 --- a/crates/rue-lexer/Cargo.toml +++ b/crates/rue-lexer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-lexer" -version = "0.8.1" +version = "0.8.2" edition = "2024" license = "Apache-2.0" description = "A lexer for the Rue programming language." diff --git a/crates/rue-lir/Cargo.toml b/crates/rue-lir/Cargo.toml index 39681e58..8c1fd017 100644 --- a/crates/rue-lir/Cargo.toml +++ b/crates/rue-lir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-lir" -version = "0.8.1" +version = "0.8.2" edition = "2024" license = "Apache-2.0" description = "Provides a low-level intermediate representation that compiles to CLVM." diff --git a/crates/rue-lsp/Cargo.toml b/crates/rue-lsp/Cargo.toml index 2156cc08..a51fab54 100644 --- a/crates/rue-lsp/Cargo.toml +++ b/crates/rue-lsp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-lsp" -version = "0.8.1" +version = "0.8.2" 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 1c7d540a..40b46a89 100644 --- a/crates/rue-options/Cargo.toml +++ b/crates/rue-options/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-options" -version = "0.8.1" +version = "0.8.2" 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 5912bc4a..36a51d7a 100644 --- a/crates/rue-parser/Cargo.toml +++ b/crates/rue-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-parser" -version = "0.8.1" +version = "0.8.2" 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 7bc7222f..efd7a9a6 100644 --- a/crates/rue-tests/Cargo.toml +++ b/crates/rue-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-tests" -version = "0.8.1" +version = "0.8.2" edition = "2024" publish = false license = "Apache-2.0" diff --git a/crates/rue-types/Cargo.toml b/crates/rue-types/Cargo.toml index 7ae91553..6d7df07f 100644 --- a/crates/rue-types/Cargo.toml +++ b/crates/rue-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-types" -version = "0.8.1" +version = "0.8.2" edition = "2024" license = "Apache-2.0" description = "A type system for the Rue programming language." diff --git a/examples/puzzles/cat.rue b/examples/puzzles/cat.rue index fbacf535..9b5b645e 100644 --- a/examples/puzzles/cat.rue +++ b/examples/puzzles/cat.rue @@ -168,7 +168,7 @@ fn main( } else { // If there's no TAIL, make sure the extra delta is zero. // It must have a parent that is also a CAT. - assert parent_is_cat && extra_delta == 0; + assert parent_is_cat & (extra_delta == 0); // Output the conditions as they are. conditions @@ -237,8 +237,7 @@ fn morph_conditions( // If the condition is a coin announcement, // make sure it's not pretending to be part of the ring. if condition is CreateCoinAnnouncement - && condition.message.length == 33 - && substr(condition.message, 0, 1) == RING_MORPH_BYTE + && ((condition.message.length == 33) & (substr(condition.message, 0, 1) == RING_MORPH_BYTE)) { raise "Created coin announcements must not have the ring morph byte"; } diff --git a/examples/puzzles/cat.yaml b/examples/puzzles/cat.yaml index d7e7ce33..448f6241 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 (a (i 13 (q 2 (i 24575 (q) (q 1 . 1)) 1) (q)) 1) (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 (a (i (= 17 (q . 60)) (q 2 (i (= (strlen 41) (q . 33)) (q 1 . 1) (q)) 1) (q)) 1) (q 2 (i (= (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:153:9"))) 1) (q 2 (i (a (i 87 (q 2 (i (= 0x017fff ()) (q 1 . 1) (q)) 1) (q)) 1) (q . 2) (q 8 (q . "assertion failed at cat.rue:171: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 (a (i (= (f (f 5)) (q . 60)) (q 2 (i (= (strlen (f (r (f 5)))) (q . 33)) (q 1 . 1) (q)) 1) (q)) 1) (q 2 (i (= (substr (f (r (f 5))) () (q . 1)) (q . -53)) (q 1 . 1) (q)) 1) (q)) 1) (q 8 (q . "raise called at cat.rue:243: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)) +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:153:9"))) 1) (q 2 (i (all 87 (= 0x017fff ())) (q . 2) (q 8 (q . "assertion failed at cat.rue:171: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:242: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))) runtime_cost: 297861 -byte_cost: 18192000 -total_cost: 18489861 +byte_cost: 17472000 +total_cost: 17769861 diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 807db646..38b81839 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rue-wasm" -version = "0.8.1" +version = "0.8.2" edition = "2024" publish = false license = "Apache-2.0"