Omniscia vfat Audit

VelodromeGaugeRegistry Code Style Findings

VelodromeGaugeRegistry Code Style Findings

VGR-01C: Inexistent Combination of Conditionals

Description:

The referenced if conditionals will result in the same statement being executed.

Example:

contracts/connectors/velodrome/VelodromeGaugeRegistry.sol
49if (
50 address(deprecatedSlipstreamPairFactory) != address(0)
51 && deprecatedSlipstreamPairFactory.isPair(pair)
52) {
53 return address(slipstreamGaugeConnector);
54}
55if (slipstreamPairFactory.isPair(pair)) {
56 return address(slipstreamGaugeConnector);
57}

Recommendation:

We advise them to be combined into a single if clause, optimizing the code's bytecode size.

Alleviation (6ab7af3bb4):

The referenced conditionals have been connected albeit in an incorrect way as the && conditional portion should be wrapped in a parenthesis block to ensure that the slipstreamPairFactory.isPair(pair) value by itself can trigger the if block.

Alleviation (986c6b0a71):

The vfat team clarified that this particular issue we outlined in our follow-up alleviation has been fixed in the main branch of the repository (commit 636b966d435472590dbca52a8b2f44b8886abecf at the time this alleviation was written).

The code does not appear to be fixed as advised, rendering this exhibit to remain in its partially addressed state.

Alleviation (73206ba3b5):

After discussing with the vfat team, we concluded that Solidity's built-in logic comparator precedence would treat a && b || c identically to (a && b) || c.

In any case, we advised the vfat team to introduce explicit precedence in the code so as to increase its legibility which they proceeded to do so, alleviating this exhibit in full.