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

Investigate feasibility of overflow checks #8467

Closed
chriseth opened this issue Mar 10, 2020 · 6 comments
Closed

Investigate feasibility of overflow checks #8467

chriseth opened this issue Mar 10, 2020 · 6 comments

Comments

@chriseth
Copy link
Contributor

Me might want to add forced overflow checks for 0.7.0 leading to an invalid opcode. We should check if it is possible to implement common contracts with require checks such that the invalid opcode is not reachable.

@chriseth
Copy link
Contributor Author

What we also have to consider: Do we want checks for truncation during type conversion? Is unchecked { ... } too much of a burden for these? Does it happen a lot?

@leonardoalt
Copy link
Member

I think it would be interesting to force checks there as well. If someone wants to safely convert to a smaller type, they'd need to properly adjust the value first.

@chriseth
Copy link
Contributor Author

It seems we currently do not check overflow for explicit type conversion when compiling via yul.

@chriseth
Copy link
Contributor Author

chriseth commented Jun 3, 2020

Community feedback call: #9054

@chriseth
Copy link
Contributor Author

Outcome of community call:

  • slight preference towards checks by default, to be disabled via unchecked { ... }.
  • as a compromise between invalid() and revert() we could use a special error signature in revert.
  • ** can only be used inside unchecked { ... } unless the types and constants do not allow any overflow
  • overflow checks on type conversions probably still need some investigation.

@axic
Copy link
Member

axic commented Oct 30, 2020

@chriseth can we close this after #9465 ?

@cameel cameel changed the title Investigate feasibilitiy of overflow checks Investigate feasibility of overflow checks Nov 2, 2020
@chriseth chriseth closed this as completed Nov 2, 2020
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

No branches or pull requests

3 participants