-
Notifications
You must be signed in to change notification settings - Fork 70
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
Change offset
parameter from u32
to i32
#522
Conversation
Thanks. While it is true that Wasm itself does not directly support unsigned integers, it's still important for the implementation to interpret it as an unsigned integer. I think we should convert the function definition to Btw, @FlorianFranzen this might be a good idea for your testsuite: what happens when you use |
- WASM does not support `u32`, see https://www.w3.org/TR/wasm-core-1/#value-types%E2%91%A0 - Affects `ext_default_child_storage_read_version_1` - Affects `ext_storage_read_version_1`
Rebased the branch, and changed it to |
I would keep it as u32 because that is how you need to interpret the bits. |
That makes sense, what I'm trying to do is highlight the need to NOT take it as i32. |
IMO sounds to me like you didn't read the spec 🙈 Maybe we can add in some kind of initial description that unsigned values are possible. |
It still think the type in the signature should be i32 due to wasm, but it should be mentioned in the description it should be interpreted as u32. I would also rather have a local description (in those two functions affected) than a global one somewhere at the top, which might be overlooked. If this would affect a lot of host functions, however this could make more sense too. I understand from a validity standpoint the spec is valid, but from a human reader/implementer perspective that would help 😉 |
I will not do the call here on what is right, however what should be considered is that we have a lot of |
Good point, I forgot about If we have this setup in the test suite for max u32 values, that would do it as well and we might not need to change the spec at all, since this would automatically enforce correct behavior right. |
I think this is fine, thx! |
My bad I forgot those for some reason. 👍 |
u32
, seehttps://www.w3.org/TR/wasm-core-1/#value-types%E2%91%A0
ext_default_child_storage_read_version_1
ext_storage_read_version_1
❓ Although it this offset is meant to be
u32
, this is a bit problematic since in our implementation it's really cut down to the max i32 (due to the function signature) which is lower than max u32. Should we document to treat the 32 bits asuint32
within the function body? 🤔