ethereum / solidity

Solidity, the Smart Contract Programming Language
https://soliditylang.org
GNU General Public License v3.0
22.64k stars 5.61k forks source link

Replace unnecessary validations with assertions #15185

Closed cameel closed 2 weeks ago

cameel commented 3 weeks ago

CompilerStack has a lot of checks for things that are never meant to happen and do not need a user-facing validation. We normally enforce such expectations with assertions, because violating them is a bug, not a compilation error.

This has been bothering me for a long time, but became especially annoying now when I was reviewing #15168 and needed to figure out what kinds of runtime exceptions we throw and when.

I also fixed two somewhat related things: