-
Notifications
You must be signed in to change notification settings - Fork 49
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
Empty uint64 array will unmarshal to nil if struct is not initialized #96
Comments
Can you share the generated go file? |
I found the issue, it is not on the generated code but on this function that extends the uint64 array. It should be easy to fix. |
Could you try the fix in #97 and see if it resolves the issue? |
Yes, but I won't be able to today. On a day trip away from my workstation. Thank you for the quick fix! |
@ferranbt Yes, it resolves the issue. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there. Noticed something that I believe is a bug in sszgen.
Given a structure with a
uint64
array field, the field will unmarshal to anil
value if (1) the array is empty and (2) the variable that callsUnmarshalSSZ
is not initialized. And if you swapuint64
forbyte
it works as expected.See the following program:
When executed, this will output:
On the other hand, if
dec.Bar
is initialized with anything (even an empty array), it will behave as expected:When executed, this will output:
Fixes: flashbots/go-boost-utils#23
The text was updated successfully, but these errors were encountered: