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

Safe maths are not correctly applied in compiled contracts #226

Closed
Robbepop opened this issue Nov 10, 2019 · 1 comment
Closed

Safe maths are not correctly applied in compiled contracts #226

Robbepop opened this issue Nov 10, 2019 · 1 comment
Assignees
Labels
A-ink_lang [ink_lang] Work item C-bug Something isn't working

Comments

@Robbepop
Copy link
Collaborator

Robbepop commented Nov 10, 2019

For asserting that overflow checks are enabled in Rust compiled smart contracts we include the following lines into Cargo.toml files:

[profile.release]
overflow-checks = true

However, when inspecting the compiled Incrementer example found here we can clearly see that it deterministically underflows and overflows when given certain values. E.g. when the current value of a deployed Incrementer contract is -42 and we decrease it by 2^32-1 we receive -41 as result but instead we expect it to trap.

Thanks to @TriplEight for reporting this bug. 🎉

@Robbepop Robbepop added A-ink_lang [ink_lang] Work item C-bug Something isn't working labels Nov 10, 2019
@SkymanOne
Copy link
Contributor

Overflow checks have been disabled in #1831

ERROR: Overflow checks must be disabled. Cargo contract makes sure that no unchecked arithmetic is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ink_lang [ink_lang] Work item C-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants