Omniscia AllianceBlock Audit

AlwaysSameProviderSelector Code Style Findings

AlwaysSameProviderSelector Code Style Findings

ASP-01C: Generic Typographic Mistake

Description:

The referenced line contains a typographical mistake (i.e. private variable without an underscore prefix) or generic documentational error (i.e. copy-paste) that should be corrected.

Example:

contracts/AlwaysSameProviderSelector.sol
8address private currentProvider;

Recommendation:

We advise this to be done so to enhance the legibility of the codebase.

Alleviation (54fd570de24631ca65a7cea022aebe43225a08c7):

An underscore (_) prefix has been properly introduced to the referenced variable addressing this exhibit.

ASP-02C: Redundant Code Structure

Description:

The AlwaysSameProviderSelector::isValidProvider function contains an if clause and two separate return statements which is inefficient.

Example:

contracts/AlwaysSameProviderSelector.sol
45function isValidProvider(address provider) external view override returns (bool) {
46 if (currentProvider == provider) {
47 return true;
48 }
49 return false;
50}

Recommendation:

We advise the result of currentProvider == provider to be returned directly, optimizing the code's gas cost.

Alleviation (54fd570de24631ca65a7cea022aebe43225a08c7):

The redundant code structure has been optimized as advised, yielding the result of the conditional directly.