Skip to content

Single element array members are treated as multiple #121

Open

Description

@rooooooooob
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.

Activity

  1. added a commit that references this issue on Dec 26, 2023
  2. rooooooooob commented on Dec 26, 2023

    @rooooooooob
    ContributorAuthor

    #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CDDL featureFeature that is required for proper parsing of CDDL filesbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions