Omniscia Olive Audit
Staking Static Analysis Findings
Staking Static Analysis Findings
STA-01S: Inefficient Usage of EnumerableSet
Type | Severity | Location |
---|---|---|
Gas Optimization | Staking.sol:L130, L132 |
Description:
The add
and remove
instructions of the EnumerableSet
yield a bool
variable signaling whether the operation was executed successfully which can be utilized in place of the contains
checks.
Example:
contracts/staking/Staking.sol
129function removeSchedule(uint256 scheduleIndex) external override onlyOwner {130 require(scheduleIdxs.contains(scheduleIndex), "INVALID_SCHEDULE");131
132 scheduleIdxs.remove(scheduleIndex);133 delete schedules[scheduleIndex];134
135 emit ScheduleRemoved(scheduleIndex);136}
Recommendation:
We advise this to be done so to optimize the codebase's gas cost.
Alleviation:
The file is no longer present in the codebase thereby nullifying this exhibit.
STA-02S: Redundant Zero Value Writes
Type | Severity | Location |
---|---|---|
Gas Optimization | Staking.sol:L148, L176, L384 |
Description:
The linked zero value writes are redundant as thats the default value of the variable they are assigned to.
Example:
contracts/staking/Staking.sol
148value = 0;
Recommendation:
We advise them to be omitted in favor of reduced gas costs.
Alleviation:
The file is no longer present in the codebase thereby nullifying this exhibit.