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

Single element array members are treated as multiple #121

Open
rooooooooob opened this issue Dec 13, 2022 · 1 comment
Open

Single element array members are treated as multiple #121

rooooooooob opened this issue Dec 13, 2022 · 1 comment
Labels
bug Something isn't working CDDL feature Feature that is required for proper parsing of CDDL files

Comments

@rooooooooob
Copy link
Collaborator

foo = [
   single: [uint]
]

is treated as:

foo = [
   single: [* uint]
]

As per the CDDL RFC:

If no occurrence indicator is specified, the group entry is to occur
exactly once (as if 1*1 were specified)

You can work around this by doing:

single_uint = [uint]
foo = [
   single: single_uint
]

but it's not ideal. Ideally the fix would make this totally invisible to end-users and have Foo::single be of type uint directly with the array part just being a serialization detail.

@rooooooooob rooooooooob added the bug Something isn't working label Dec 13, 2022
@SebastienGllmt SebastienGllmt added the CDDL feature Feature that is required for proper parsing of CDDL files label Feb 7, 2023
rooooooooob added a commit that referenced this issue Dec 26, 2023
Specifically tests for support for #121 for plain groups.

For multi arrays covered by #120
For single ones covered by #210

We are keeping #121 open for now as the case for single non-plain-groups
e.g. `[uint]` is not covered. We've yet to see this used anywhere in
Cardano so it's low priority to fix.
@rooooooooob
Copy link
Collaborator Author

#210 addresses this for basic groups but the issue remains for other types e.g. [uint]. This is lower priority because the only time we've seen single element arrays like this in Cardano was for basic groups.

rooooooooob added a commit that referenced this issue Dec 27, 2023
Specifically tests for support for #121 for plain groups.

For multi arrays covered by #120
For single ones covered by #210

We are keeping #121 open for now as the case for single non-plain-groups
e.g. `[uint]` is not covered. We've yet to see this used anywhere in
Cardano so it's low priority to fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CDDL feature Feature that is required for proper parsing of CDDL files
Projects
None yet
Development

No branches or pull requests

2 participants