I am trying to spend from a branched Simplicity program, but I don't wanna supply the signatures in the untaken branch, so I am trying to prune the program by hand. I have verified that I can take the
commitmentRoot of a checkSig with the signature set to
To make a valid spend, I think I need to construct a pruned program that has the same
CommitmentRoot that the full program has. So I boiled by program down to a single case expression:
u :: CommitmentRoot () () u = unit full :: CommitmentRoot (Bit, ()) () full = cond u unit pruned :: CommitmentRoot (Bit, ()) () pruned = assertr (commitmentRoot u) unit
CommitmentRoots do not have the same hash:
*Main> (encode.fromShort.hash256.commitmentRoot) pruned "7b4082aaae5e289f29855ede047b2b6598805b153324aa3a5fd4fec5b1a86053" *Main> (encode.fromShort.hash256.commitmentRoot) full "dded2b0938bb9f58f20324ab1f699e7006ffd8e9251b3ddd0f551de1d66fe119"
What gives? Is my understanding that I need a matching
CommitmentRoot incorrect? If it is not correct, how do I prune a case expression correctly?
Furthermore, section "220.127.116.11 Pruning Unused case Branches" of the Simplicity Technical Report claims that "We can effectively replace any unused branch in a case expression with its commitment Merkle root." But if I do that, I cannot run the Simplicity program with
runKleisli. So how is this supposed to work?