code-423n4 / 2021-11-yaxis-findings

0 stars 0 forks source link

Assigned operations to constant variables #111

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

Assigned operations to constant variables are re-evalueted every time.

    bytes32 public constant ADMIN_ROLE = keccak256('ADMIN');
    bytes32 public constant SENTINEL_ROLE = keccak256('SENTINEL');

See https://github.com/ethereum/solidity/issues/9232

Change from 'constant' to 'immutable'.

Xuefeng-Zhu commented 2 years ago

change to immutable will result in compile error

0xleastwood commented 2 years ago

Marking this as a valid finding.

0xleastwood commented 2 years ago

Tested this in remix, doesn't seem to cause compiler errors.