BlockstreamResearch / rust-simplicity

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

Policy asm fragment #171

Closed uncomputable closed 1 year ago

uncomputable commented 1 year ago

This commit adds the assembly (asm) fragment to Policy, which allows us to include arbitrary Simplicity programs. The Policy includes just the CMR. It is the Satisfier's responsibility to provide a matching satisfied program at spending time.

One of the challenges is that Policy with asm fragments does not have a serialization at commitment time. This why we introduce separate getters for the CMR and the program commitment.

apoelstra commented 1 year ago

Nice! As you noticed, the Constructible trait has different sigantures than the existing CMR constructors. (More importantly than the reference stuff is that the trait methods return Result in a bunch of places where the CMR constructors do not.)

apoelstra commented 1 year ago

concept ACK. Will really ACK shortly. I'm not certain this is the right approach but it makes sense and will let us move forward, and aligns with my original idea for how Constructible could be used.