ethereum / remix-project

Remix is a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions.
https://remix-ide.readthedocs.io
MIT License
2.46k stars 950 forks source link

Static analyzer - warn when using control-flow modifiers in assembly #165

Open axic opened 6 years ago

axic commented 6 years ago

From https://github.com/ethereum/solidity/issues/3258.

Depends on ethereum/remix-ide#921.

It would be nice to warn if using assembly instructions which modify the control flow (e.g. they abort execution). All of them are available in the higher level language and in many cases using them there makes more sense.

Assembly instructions to highlight: invalid, return, revert, selfdestruct

cc @soad003, you might be interested

3esmit commented 6 years ago

The use of revert and selfdestruct it's not really important, because it have the same behavior of revert and selfdestruct on non assembly.

However for return(p,s) the behavior is completly different, while in non assembly return; ends the internal call and return the value for that internal call, return(p,s) ends the external call and returns for the external call.

soad003 commented 6 years ago

@axic do you know if the AST created contains the "AST" of the inline assembly aswell? I think a last time i checked (March/April) that i only got assembly nodes in the AST but without content.

axic commented 6 years ago

Double checked and the new AST format has it in a source code format :(

The old one probably didn't have it.

axic commented 6 years ago

There is an issue for it: https://github.com/ethereum/solidity/issues/2419

LianaHus commented 4 years ago

@Aniket-Engg