Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: low
Invalid

No success check in livemarkets.sol in pause unpause functionality

marketmakingengineconfigurationbranch.sol has 2 functions

  • unpauseMarket

  • pauseMarket

/// @notice Unpauses a specific market by adding its ID from the list of live markets.
/// @param marketId The ID of the market to be unpaused.
/// @return success A boolean indicating whether the operation was successful.
function unpauseMarket(uint128 marketId) external onlyOwner returns (bool success) {
success = LiveMarkets.load().addMarket(marketId);
if (success) emit LogMarketUnpaused(marketId);
}
/// @notice Pauses a specific market by removing its ID from the list of live markets.
/// @param marketId The ID of the market to be paused.
/// @return success A boolean indicating whether the operation was successful.
function pauseMarket(uint128 marketId) external onlyOwner returns (bool success) {
success = LiveMarkets.load().removeMarket(marketId);
if (success) emit LogMarketPaused(marketId);
}

both of them exist in 2 different contracts:

  • livemarkets.sol

  • perpsengineconfiguration.sol

while perpsengineconfiguration checks if the calls were successful

/// @notice Reverts if the provided `marketId` is disabled.
/// @param self The perps engine configuration storage pointer.
/// @param marketId The id of the market to check.
function checkMarketIsEnabled(Data storage self, uint128 marketId) internal view {
if (!self.enabledMarketsIds.contains(marketId)) {
revert Errors.PerpMarketDisabled(marketId);
}
}
/// @notice Adds a new perps market to the enabled markets set.
/// @param self The perps engine configuration storage pointer.
/// @param marketId The id of the market to add.
function addMarket(Data storage self, uint128 marketId) internal {
bool added = self.enabledMarketsIds.add(uint256(marketId));
if (!added) {
revert Errors.PerpMarketAlreadyEnabled(marketId);
}
}

livemarkets does not

/// @notice Adds a market to the set of live market IDs.
/// @param self The storage pointer to the market data.
/// @param marketId The ID of the market to be added.
function addMarket(Data storage self, uint128 marketId) internal returns (bool) {
return self.liveMarketIds.add(uint256(marketId));
}
/// @notice Removes a market from the set of live market IDs.
/// @param self The storage pointer to the market data.
/// @param marketId The ID of the market to be removed.
function removeMarket(Data storage self, uint128 marketId) internal returns (bool) {
return self.liveMarketIds.remove(uint256(marketId));
}

which indicates that there’s a possibility of silent fail. Necessary checks should be added to functions in livemarkets also

Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.