Omniscia Tokemak Network Audit
Manager Code Style Findings
Manager Code Style Findings
MAN-01C: Redundant Access Control
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | Manager.sol:L158 |
Description:
The _completeRollover
function is set as private
and invoked twice. In those two functions, the onlyOwner
modifier is already applied.
Example:
contracts/manager/Manager.sol
158function _completeRollover(string calldata rewardsIpfsHash) private onlyOwner {159 require(block.number > (currentCycle.add(cycleDuration)), "PREMATURE_EXECUTION");160 currentCycle = block.number;161 cycleRewardsHashes[currentCycleIndex] = rewardsIpfsHash;162 currentCycleIndex = currentCycleIndex.add(1);163 rolloverStarted = false;164 emit CycleRolloverComplete(block.number);165}
Recommendation:
We advise the onlyOwner
modifier to be removed from the private
function to ensure no redundant statements are executed.
Alleviation:
The onlyOwner
modifier was safely omitted from the private
function.
MAN-02C: Relocation of Sanitization
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | Manager.sol:L101-L103, L159 |
Description:
The require
statement within _completeRollover
is evaluated twice when execute
is executed and once when completeRollover
is executed.
Example:
contracts/manager/Manager.sol
158function _completeRollover(string calldata rewardsIpfsHash) private onlyOwner {159 require(block.number > (currentCycle.add(cycleDuration)), "PREMATURE_EXECUTION");160 currentCycle = block.number;161 cycleRewardsHashes[currentCycleIndex] = rewardsIpfsHash;162 currentCycleIndex = currentCycleIndex.add(1);163 rolloverStarted = false;164 emit CycleRolloverComplete(block.number);165}
Recommendation:
We advise it to be relocated to completeRollover
given that execute
already evaluates this check.
Alleviation:
The sanitization check was relocated to the external
function counterpart, optimizing the codebase.