simplicity icon indicating copy to clipboard operation
simplicity copied to clipboard

Improve description of SIMPLICITY_ERR_HIDDEN

Open uncomputable opened this issue 2 years ago • 3 comments

https://github.com/BlockstreamResearch/simplicity/blob/5e7976326156ac9db9b5f8695dd597e8e370e130/C/deserialize.c#L46

It is unclear what illegal children are.

Non-case nodes may not have hidden children, so these children are illegal. However, a case node may not have two hidden children, so these children are also illegal. SIMPLICITY_ERR_HIDDEN is returned in both cases.

uncomputable avatar Nov 20 '23 18:11 uncomputable

HIDDEN children are illegal if they don't occur as part of an assertion.

Agreed, this text should be improved.

apoelstra avatar Nov 20 '23 19:11 apoelstra

illegal HIDDEN children is formally defined in https://github.com/BlockstreamResearch/simplicity/blob/5e7976326156ac9db9b5f8695dd597e8e370e130/C/dag.h#L308-L314 (technically that defines legal HIDDEN children).

I suppose I can break the various conditions of well-formedness into their own names. But I'm not going to copy the entire formal definition into the error message.

Let me see what I can do.

roconnor-blockstream avatar Jan 09 '24 22:01 roconnor-blockstream

Maybe "The parent of a hidden node is not an assertion." Assertions are defined to be case nodes with one left or right hidden child.

uncomputable avatar Jan 14 '24 09:01 uncomputable