Settling and Updating Vault will fail if one market breaks
Summary
Settling and Updating Vault will fail if one market breaks
Vulnerability Detail
Updating and settling of a vault requires all the markets in use by the vault to be updated.
This can be seen in the function Vault::_settleUnderlying:
/// @notice Handles settling the vault's underlying markets
function _settleUnderlying() private {
for (uint256 marketId; marketId < totalMarkets; marketId++)
_registrations[marketId].read().market.update(
address(this),
UFixed6Lib.MAX,
UFixed6Lib.ZERO,
UFixed6Lib.ZERO,
Fixed6Lib.ZERO,
false
);
}
This function is called by both the Vault::settle and Vault::update functions.
If one of the markets is broken, this would lead to a revert therefore breaking these functions.
One possible way a single market would cause this revert is if the Market::update function was paused:
According to the contest readme, market owners should not be able to adversely affect other markets or the overall protocol.
In this case a malicious owner could break the functionality of a vault.
Impact
Updating and Settling a vault are its core functions which would be broken translating into fund lockup and potential fund losses due to inability to call these functions.
ck
medium
Settling and Updating Vault will fail if one market breaks
Summary
Settling and Updating Vault will fail if one market breaks
Vulnerability Detail
Updating and settling of a vault requires all the markets in use by the vault to be updated. This can be seen in the function
Vault::_settleUnderlying
:This function is called by both the
Vault::settle
andVault::update
functions. If one of the markets is broken, this would lead to a revert therefore breaking these functions.One possible way a single market would cause this revert is if the
Market::update
function was paused:According to the contest readme, market owners should not be able to adversely affect other markets or the overall protocol. In this case a malicious owner could break the functionality of a vault.
Impact
Updating and Settling a vault are its core functions which would be broken translating into fund lockup and potential fund losses due to inability to call these functions.
Code Snippet
https://github.com/sherlock-audit/2023-07-perennial/blob/main/perennial-v2/packages/perennial-vault/contracts/Vault.sol#L299-L310
https://github.com/sherlock-audit/2023-07-perennial/blob/main/perennial-v2/packages/perennial/contracts/Market.sol#L76-L88
Tool used
Manual Review
Recommendation
Provide a way to exclude broken markets in critical functionality such as the vault update process.