3.16 State Modification
Contract state modifications made in functions whose mutability is declared as view
or pure
will revert in contracts compiled with Solidity
version greater than or equal to 0.5.0
.
This is because this compiler version started using the STATICCALL
opcode for such functions, this instruction leads to a revert, if that particular function modifies the contract state.
So when analyzing the security aspects of contracts it's good to pay attention to the mutability of the functions to see, if they are view
or pure
, but they actually modify the contract state in which case they would lead to reverts at runtime.
Last updated