code-423n4 / 2022-01-sherlock-findings

0 stars 0 forks source link

`block.chainid` should be stored in a constant variable for more configuration visibility at deployment #199

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

Dravee

Vulnerability details

Impact

Redeploying the contract because here exists a need to remember to go change a value in a function before deployment. This is risk prone, whereas a constant variable is a lot more visible and frequently used for configuration

Proof of Concept

https://github.com/code-423n4/2022-01-sherlock/blob/main/contracts/managers/Manager.sol#L35

Tools Used

VS Code

Recommended Mitigation Steps

Instead of the block.chainid != 31337 check, store 31337 in a private uint256 constant (CHAIN_ID sounds good) and compare block.chainid to it at line 35. At the same line, msg.sender is compared to a DEPLOYER address constant, this is the same principle.