Skip to content

Commit 3e12aa2

Browse files
Add Tr-compiler write-up and doc-comment
This write-up is aimed to reason about how the private-compilation (as defined in doc) is also cost-efficient.
1 parent a5dc195 commit 3e12aa2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

doc/Tr Compiler.pdf

96.5 KB
Binary file not shown.

src/policy/concrete.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,14 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
244244
/// The policy tree constructed by root-level disjunctions over [`Or`][`Policy::Or`] and
245245
/// [`Thresh`][`Policy::Threshold`](1, ..) which is flattened into a vector (with respective
246246
/// probabilities derived from odds) of policies.
247-
/// For example, the policy `thresh(1,or(pk(A),pk(B)),and(or(pk(C),pk(D)),pk(E)))` gives the vector
248-
/// `[pk(A),pk(B),and(or(pk(C),pk(D)),pk(E)))]`. Each policy in the vector is compiled into
249-
/// the respective miniscripts. A Huffman Tree is created from this vector which optimizes over
250-
/// the probabilitity of satisfaction for the respective branch in the TapTree.
247+
/// For example, the policy `thresh(1,or(pk(A),pk(B)),and(or(pk(C),pk(D)),pk(E)))` gives the
248+
/// vector `[pk(A),pk(B),and(or(pk(C),pk(D)),pk(E)))]`. Each policy in the vector is compiled
249+
/// into the respective miniscripts. A Huffman Tree is created from this vector which optimizes
250+
/// over the probabilitity of satisfaction for the respective branch in the TapTree.
251+
///
252+
/// Refer to [this link](https://gist.github.com/SarcasticNastik/9e70b2b43375aab3e78c51e09c288c89)
253+
/// or [doc/Tr compiler.pdf] in the root of the repository to understand why such compilation
254+
/// is also *cost-efficient*.
251255
// TODO: We might require other compile errors for Taproot.
252256
#[cfg(feature = "compiler")]
253257
pub fn compile_tr(&self, unspendable_key: Option<Pk>) -> Result<Descriptor<Pk>, Error> {

0 commit comments

Comments
 (0)