-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Extend the interpreter so that it reverts a transaction whenever a state variable with mutability declared as constant is assigned.
For example, consider the contract:
contract C {
int constant N=1;
int x;
function f(int n) external { if (n>0) x+=1; else N=0; }
}A call to f(0) should revert, since it would trigger an assignment to the constant N.
State variables declared as immutable can be assigned, but only in the constructor. For example, in the contract:
contract C {
int immutable x;
constructor(int n) { x = n; }
function f(int n) external { if (n==0) x=0; }
}The assignment in the constructor does not revert, but a call to f(0) should revert, since it would trigger an assignment to the immutable variable x.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request