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

List limit is not applied on init and/or when encoding #26

Open
kdeme opened this issue Jan 19, 2022 · 0 comments
Open

List limit is not applied on init and/or when encoding #26

kdeme opened this issue Jan 19, 2022 · 0 comments

Comments

@kdeme
Copy link
Collaborator

kdeme commented Jan 19, 2022

An SSZ List has a limit and that limit is also checked when decoding and when adding items (https://github.com/status-im/nim-ssz-serialization/blob/master/ssz_serialization/types.nim#L168) to it.

However, it is not on init from a seq nor on the encoding step. Not sure if it should and how the API should ideally look, but right now it is rather confusing.

  var theList = List[byte, 5].init(@[byte 1, 2, 3, 4, 5, 6])

  let encoded = SSZ.encode(theList) # works
  let decoded = SSZ.decode(encoded, List[byte, 5]) # Fails only at decoding
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

1 participant