Skip to content

Commit 8f3ad9e

Browse files
committed
Merge #35: Nodes
637576b Rename Type::ty (Christian Lewe) 7649242 Remove #[allow(dead_code)] (Christian Lewe) 29cec70 Adapt policy compiler (Christian Lewe) bf875cf Adapt test programs (Christian Lewe) cec3081 Add decoding of programs (Christian Lewe) e0571aa Implement finalization (Christian Lewe) cd14fbc Adapt Bit Machine (Christian Lewe) ff8b92f Adapt decoding (Christian Lewe) 7fe81f1 Adapt inference (Christian Lewe) a97ba40 Adapt analysis (Christian Lewe) 2d8a66a Adapt DagIterable (Christian Lewe) f28d109 Add Node (Christian Lewe) 18410e2 Add CommitNode (Christian Lewe) 2f6412a Remove linear programs (Christian Lewe) 33e2a9c Temporarily remove fuzz tests (Christian Lewe) Pull request description: This PR removes linear programs entirely and replaces them with heap structures. # Philosophy Linear programs exist because of the (de)serialisation of Simplicity programs. However, besides that there is really no need for index bookkeeping in our code. On top of that, sharing and pruning can are transport-layer optimisations and should be done during serialisation. Therefore, let us use one of Rust's strengths instead, namely reference bookkeeping. # Immediate effects The code is more concise and readable. Children of left and right assertions are checked to be hidden nodes _(which already gave away a faulty program)_. Providing a witness during finalisation gives proper errors and never panics. Fuzz tests have been temporarily removed, because programs can no longer be encoded (future PR). # Future extensions By constructing programs inductively, we enable many useful features: We could locally check if the types of children nodes match the type of their parent as we construct it, and provide an error to the user if there is a mismatch. We could implement a program factory that keeps track of the sub-programs it has produced and that returns an `Rc::clone` whenever the same sub-program is produced twice. In general, freeing ourselves from indices allows for many runtime optimisations in Rust. ACKs for top commit: apoelstra: ACK 637576b Tree-SHA512: 935fc52052dfcf207b316e0a997e44254c3ab1ac26aa24a529c414882ca975f725d23fb62eec716c7baa563dc352ccc92d0624196db96f70314204ecb145eaa5
2 parents 3c12828 + 637576b commit 8f3ad9e

33 files changed

+1466
-2405
lines changed

fuzz/Cargo.toml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,3 @@ members = ["."]
2121
[[bin]]
2222
name = "rtt_natural"
2323
path = "fuzz_targets/rtt_natural.rs"
24-
25-
[[bin]]
26-
name = "rtt_program"
27-
path = "fuzz_targets/rtt_program.rs"
28-
29-
[[bin]]
30-
name = "rtt_witness"
31-
path = "fuzz_targets/rtt_witness.rs"
32-
33-
[[bin]]
34-
name = "rtt_program_witness"
35-
path = "fuzz_targets/rtt_program_witness.rs"
36-
37-
[[bin]]
38-
name = "rtt_dag"
39-
path = "fuzz_targets/rtt_dag.rs"

fuzz/fuzz_targets/rtt_dag.rs

Lines changed: 0 additions & 53 deletions
This file was deleted.

fuzz/fuzz_targets/rtt_program.rs

Lines changed: 0 additions & 93 deletions
This file was deleted.

fuzz/fuzz_targets/rtt_program_witness.rs

Lines changed: 0 additions & 66 deletions
This file was deleted.

fuzz/fuzz_targets/rtt_witness.rs

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)