BlockstreamResearch / rust-simplicity

Creative Commons Zero v1.0 Universal
58 stars 12 forks source link

Finalize human encoding #175

Closed uncomputable closed 1 year ago

uncomputable commented 1 year ago

This PR adds methods to convert a NamedCommitNode (parsed from text) into a WitnessNode with populated witness nodes and populated disconnected branches. This can be finalized into a RedeemNode for spending.

A hash map from names to values provides the witness data. This can be obtained from a JSON file.

The disconnected branches come from the forest of Simplicity expressions that are already parsed from the text file. The witness hash map covers the main program and (recursively) all its disconnected expressions. All expressions share a name space and must use unique node names.

uncomputable commented 1 year ago

I reordered and squashed the commits. Sorry for the large diff compared to the previous state. This PR was in bad shape.