BlockstreamResearch / rust-simplicity

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

Reading / writing values from / to frames is broken #206

Open uncomputable opened 7 months ago

uncomputable commented 7 months ago

The representation of a left value left(a): A + B is [0] * [?]^padL(A,B) * representation(a, A). The representation of a right value right(b): A + B is [1] * [?]^padR(A,B) * representation(b, B).

Neither the read method nor the write method handle this.

I think this remained undetected because we never initialize the Bit Machine with input values, nor do we ever read output values from the final output frame.

apoelstra commented 7 months ago

To clarify, it's the read_value and write_value methods that are broken -- which indeed, are only used when providing programs with inputs or outputs.

I'm not terribly surprised these methods are broken. You're right that they've basically never been used and I guess there aren't very good tests since this predates all the ConstructNode/miniscript/text representation stuff. Sorry.