Omniscia Boson Protocol Audit

ProtocolInitializationHandlerFacet Code Style Findings

ProtocolInitializationHandlerFacet Code Style Findings

PIH-01C: Inexistent Support for Sequential Upgrade

Description:

The ProtocolInitializationHandlerFacet::initialize function does not support upgrading a protocol from deployment directly to the latest version and instead executes the initialization of only one version.

Example:

contracts/protocol/facets/ProtocolInitializationHandlerFacet.sol
94if (_isUpgrade) {
95 if (_version == bytes32("2.2.0")) {
96 initV2_2_0(_initializationData);
97 } else if (_version == bytes32("2.2.1")) {
98 initV2_2_1();
99 } else if (_version == bytes32("2.3.0")) {
100 initV2_3_0(_initializationData);
101 }
102}

Recommendation:

We advise the code to support sequential initialization of versions by executing each version-suffixed initializer in sequence.

Alleviation (2b9f60b6c3323fd234b570089ceff924cdb5851c):

The Boson Protocol team evaluated this exhibit and has opted for a simpler approach instead of a sequential upgrade-path as the processing of the _initializationData would become more complex during sequential upgrades.

As such, we consider this exhibit as nullified given that we agree with the Boson Protocol team's assessment.

PIH-02C: Loop Iterator Optimization

Description:

The linked for loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X).

Example:

contracts/protocol/facets/ProtocolInitializationHandlerFacet.sol
172for (uint256 i = 0; i < sellerIds.length; i++) {

Recommendation:

We advise the increment / decrement operation to be performed in an unchecked code block as the last statement within the for loop to optimize its execution cost.

Alleviation (2b9f60b6c3323fd234b570089ceff924cdb5851c):

The referenced iterator is no longer present in the codebase, rendering this exhibit nullified.