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

VariableList should implement TryFrom<Vec> instead of truncating #12

Open
benluelo opened this issue Jun 29, 2023 · 2 comments
Open

VariableList should implement TryFrom<Vec> instead of truncating #12

benluelo opened this issue Jun 29, 2023 · 2 comments

Comments

@benluelo
Copy link

I was quite surprised to see that VariableList implements From<Vec> - this should be a TryFrom implementation instead. As per the docs on From:

Note: This trait must not fail. The From trait is intended for perfect conversions. If the conversion can fail or is not perfect, use TryFrom.

@michaelsproul
Copy link
Member

I agree this would be a nice change to make. We can add it to ssz_types first in a new v0.6 release, then integrate it into Lighthouse at a later date.

Lighthouse is also moving towards milhouse types instead of the ones in this crate. Our tree-states branch already removes usage of From<Vec<_>> because milhouse doesn't support it: https://github.com/sigp/milhouse/blob/e30719aaf1e4b46e3ff1962f7370965e68fa548b/src/list.rs#L45-L47.

@michaelsproul
Copy link
Member

Sorry, missed this for 0.6 and 0.7. Will try to get it in for 0.8

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

2 participants