-
Notifications
You must be signed in to change notification settings - Fork 110
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
scale: array of strings in struct not decoding #394
Comments
Hi, I am trying to figure what is wrong with the code, but I am having few issues with the examples: The first test wont compile as The second test will fail with
Please let me know the correct test you are expecting to work, so I can try to debug :) |
Hi, thanks for pointing this out! These should work as expected:
The first test (string) fails, and the second (byte array) passes. |
Right, the thing is that the decode will not work because the encode is failing in the first place:
Result:
Just a quick question, why are we implementing a custom encode/decode, could we use something like ETH RLP to get this done ? |
Question (to confirm if I'm understanding SCALE spec), encoding this struct:
When encode should be:
Please let me know if I am understanding SCALE correctly? |
Currently, trying to use scale to decode structs where fields slices/arrays of strings doesn't work.
eg. if we run this from the codec package:
This will not work, the resulting
A
field will be empty:Fail: got &{} expected &{noot noot2}
A workaround right now is to cast all string arrays in a struct to
[][]byte
then use scale, which works fine.for example, this works:
The text was updated successfully, but these errors were encountered: