Omniscia Morpho Labs Audit

SupplyHarvestVault Static Analysis Findings

SupplyHarvestVault Static Analysis Findings

SRC-01S: Illegible Numeric Value Representations

Description:

The linked representations of numeric literals are sub-optimally represented decreasing the legibility of the codebase.

Example:

src/compound/SupplyHarvestVault.sol
60uint16 public constant MAX_BASIS_POINTS = 10_000; // 100% in basis points.

Recommendation:

To properly illustrate each value's purpose, we advise the following guidelines to be followed. For values meant to depict fractions with a base of 1e18, we advise fractions to be utilized directly (i.e. 1e17 becomes 0.1e18) as they are supported. For values meant to represent a percentage base, we advise each value to utilize the underscore (_) separator to discern the percentage decimal (i.e. 10000 becomes 100_00, 300 becomes 3_00 and so on). Finally, for large numeric values we simply advise the underscore character to be utilized again to represent them (i.e. 1000000 becomes 1_000_000).

Alleviation:

The underscore characters have been relocated according to the specification we shared with the Morpho Labs team thus alleviating this exhibit.

SRC-02S: Inexistent Sanitization of Input Address

Description:

The linked function accepts an address argument yet does not properly sanitize it.

Impact:

The presence of zero-value addresses, especially in constructor implementations, can cause the contract to be permanently inoperable. These checks are advised as zero-value inputs are a common side-effect of off-chain software related bugs.

Example:

src/compound/SupplyHarvestVault.sol
79function initialize(
80 address _morpho,
81 address _poolToken,
82 string calldata _name,
83 string calldata _symbol,
84 uint256 _initialDeposit,
85 HarvestConfig calldata _harvestConfig,
86 address _cComp
87) external initializer {
88 (isEth, wEth) = __SupplyVaultUpgradeable_init(
89 _morpho,
90 _poolToken,
91 _name,
92 _symbol,
93 _initialDeposit
94 );
95
96 harvestConfig = _harvestConfig;
97
98 cComp = _cComp;
99
100 comp.safeApprove(address(SWAP_ROUTER), type(uint256).max);
101}

Recommendation:

We advise some basic sanitization to be put in place by ensuring that the address specified is non-zero.

Alleviation:

The cComp member along with its corresponding input argument is no longer present in the codebase as part of a style exhibit thus rendering this exhibit no longer relevant.