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

replace i32 by u32 #19

Merged
merged 3 commits into from
Feb 17, 2022
Merged

replace i32 by u32 #19

merged 3 commits into from
Feb 17, 2022

Conversation

philsippl
Copy link
Contributor

This is replacing i32 by u32 in various places when interacting with the wasm. Quote from the wasmer docs:

In Wasm integers are sign-agnostic, i.e. this can either be signed or unsigned.

However, this can create overflows, for example right in to_array32 (I've introduced the bug in my other PR #14):
0x100000000 - 1 obviously doesn't fit in i32 and let's the unwrap() fail.

This is not visible in the current test cases, but happens as soon as you feed in large numbers as signals like hashes, we could also add a test case to catch this in the future.

@gakonst
Copy link
Collaborator

gakonst commented Feb 1, 2022

This looks good - could we add a test case?

@albttx albttx mentioned this pull request Feb 8, 2022
@philsippl
Copy link
Contributor Author

@gakonst Sorry I was off for some time and missed the notification :/
This test case should cover it and sets an input, which does not fit in i32.

@gakonst gakonst merged commit e81fd92 into arkworks-rs:master Feb 17, 2022
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

Successfully merging this pull request may close these issues.

2 participants