Omniscia Moby Audit

Controller Manual Review Findings

Controller Manual Review Findings

CRE-01M: Inexistent Validation of Long Threshold

Description:

The Controller::getVaultIndexAndAddressByTimeGap function will yield the correct vault type (short, mid-term, or long) based on the time that will elapse until the expiry of the option, however, it does not perform a bound check for the long position vault.

Impact:

It is presently possible to open an option for the long vault that does not necessarily abide by its Vault::thresholdDays configuration.

Example:

contracts/Controller.sol
194function getVaultIndexAndAddressByTimeGap(uint40 _standardTime, uint40 _expiry) public view override returns (uint8, address) {
195 require(_expiry > _standardTime, "Controller: invalid expiry");
196
197 uint40 diff = _expiry - _standardTime;
198 uint40 sVaultThresholdDays = IVault(vaults[0]).thresholdDays();
199 uint40 mVaultThresholdDays = IVault(vaults[1]).thresholdDays();
200
201 if (diff <= sVaultThresholdDays) {
202 return (0, vaults[0]);
203 } else if (diff > sVaultThresholdDays && diff <= mVaultThresholdDays) {
204 return (1, vaults[1]);
205 }
206
207 return (2, vaults[2]);
208}

Recommendation:

We advise the Vault::thresholdDays value of the long position vault (vaults[2]) to be validated as well via a require check, preventing options with expiries that are too far in the future from being considered valid and opened in the long vault.

Alleviation (b02fae335f62cc1f5f4236fb4d982ad16a32bd26):

A threshold for the maximum long position is now properly imposed as well, alleviating this exhibit in full.