Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-ast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
70 changes: 70 additions & 0 deletions crates/rue-compiler/src/std/merkle.rue
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// merkle.rue by yakuhito

import tree_hash::{tree_hash_atom, tree_hash_pair};

export struct MerkleProof {
path: Int,
...hashes: List<Bytes32>,
}

export fn calculate_merkle_root(
path: Int,
current_hash: Bytes32,
additional_steps: List<Bytes32>,
) -> 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)
}
12 changes: 12 additions & 0 deletions crates/rue-compiler/src/std/offer.rue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import conditions::types::Memos;

export struct NotarizedPayment {
nonce: Bytes32,
...payments: List<Payment>,
}

export struct Payment {
puzzle_hash: Bytes32,
amount: Int,
...memos: Memos | nil,
}
4 changes: 4 additions & 0 deletions crates/rue-compiler/src/std/prelude.rue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
18 changes: 18 additions & 0 deletions crates/rue-compiler/src/std/singleton.rue
Original file line number Diff line number Diff line change
@@ -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,
}
2 changes: 1 addition & 1 deletion crates/rue-diagnostic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-hir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-lexer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-lir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-lsp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-options/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rue-tests"
version = "0.8.1"
version = "0.8.2"
edition = "2024"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/rue-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
5 changes: 2 additions & 3 deletions examples/puzzles/cat.rue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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";
}
Expand Down
Loading