Omniscia Steer Protocol Audit

StrategyRegistry Code Style Findings

StrategyRegistry Code Style Findings

SRY-01C: Optimization of Pointer Data Location

TypeSeverityLocation
Gas OptimizationStrategyRegistry.sol:L303-L305, L308-L309, L312

Description:

The strategy local variable is declared as memory in the referenced instances, written two and then re-stored in the strategies entry it originated from.

Example:

contracts/StrategyRegistry.sol
302// Retrieve the current strategy details
303IStrategyRegistry.RegisteredStrategy memory strategy = strategies[
304 tokenIdToExecBundle[_tokenId]
305];
306
307// Set the gas parameters
308strategy.maxGasCost = _maxGasCost;
309strategy.maxGasPerAction = _maxGasPerAction;
310
311// Update the strategy details with the mutated struct
312strategies[tokenIdToExecBundle[_tokenId]] = strategy;

Recommendation:

We advise it to be set as storage instead rendering the re-assignment at the end redundant and optimizing the code's gas cost.

Alleviation (200f275c40cbd4798f4a416c044ea726755d4741):

The pointer was adjusted to storage with the final overwrite assignment being omitted, optimizing the gas cost of the setGasParameters function significantly.

SRY-02C: Suboptimal Struct Declaration Style

TypeSeverityLocation
Code StyleStrategyRegistry.sol:L126-L133

Description:

The linked declaration style of a struct is using index-based argument initialization.

Example:

contracts/StrategyRegistry.sol
126strategies[execBundle] = IStrategyRegistry.RegisteredStrategy(
127 newStrategyTokenId,
128 strategyName,
129 strategyCreator,
130 execBundle,
131 maxGasCost,
132 maxGasPerAction
133);

Recommendation:

We advise the key-value declaration format to be utilized instead, greatly increasing the legibility of the codebase.

Alleviation (200f275c40cbd4798f4a416c044ea726755d4741):

The key-value syntax is now properly utilized for the definition of the struct, greatly enhancing the readability of the creation statement.