Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve description of SIMPLICITY_ERR_HIDDEN #205

Open
uncomputable opened this issue Nov 20, 2023 · 3 comments
Open

Improve description of SIMPLICITY_ERR_HIDDEN #205

uncomputable opened this issue Nov 20, 2023 · 3 comments

Comments

@uncomputable
Copy link
Collaborator

* Returns 'SIMPLICITY_ERR_HIDDEN' if the decoded node has illegal HIDDEN children.

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.

@apoelstra
Copy link
Contributor

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

Agreed, this text should be improved.

@roconnor-blockstream
Copy link
Collaborator

roconnor-blockstream commented Jan 9, 2024

illegal HIDDEN children is formally defined in

simplicity/C/dag.h

Lines 308 to 314 in 5e79763

* and for all 'i', 0 <= 'i' < 'len',
*
* if dag[dag[i].child[0]].tag == HIDDEN then dag[i].tag == ASSERTR
*
* and
*
* if dag[dag[i].child[1]].tag == HIDDEN then dag[i].tag == ASSERTL
(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.

@uncomputable
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants