Omniscia Sovryn Audit

Ownable Code Style Findings

Ownable Code Style Findings

OWN-01C: Bytecode Optimization

TypeSeverityLocation
Gas OptimizationInformationalOwnable.sol:L39-L42

Description:

The way modifier implementations work in Solidity is by inserting code on each function with a modifier each time. This leads to a significant increase in bytecode and deployment cost if the modifier contains complex statements, such as a require with a long error message.

Example:

contracts/helpers/Ownable.sol
39modifier onlyOwner() {
40 require(isOwner(), "Ownable: caller is not the owner");
41 _;
42}

Recommendation:

We strongly recommend an internal function to be created instead called _onlyOwner() that is in turn invoked by the onlyOwner modifier thus only inserting a jump instruction on each modifier-boasting function.

Alleviation:

The contract no longer exists in the codebase and this exhibit can be considered null.