Omniscia Boson Protocol Audit
DisputeBase Manual Review Findings
DisputeBase Manual Review Findings
DBE-01M: Potentially Misleading Validation Comments
Type | Severity | Location |
---|---|---|
Code Style | ![]() | DisputeBase.sol:L21 |
Description:
The linked comment states that the raiseDisputeInternal
function validates the state of the exchange is in a redeemed state, however, this type of validation is performed either directly or indirectly wherever the function is invoked.
Example:
contracts/protocol/bases/DisputeBase.sol
15/**16 * @dev Raise a dispute17 *18 * Reverts if:19 * - caller does not hold a voucher for the given exchange id20 * - exchange does not exist21 * - exchange is not in a redeemed state22 * - fulfillment period has elapsed already23 *24 * @param _exchange - the exchange25 * @param _voucher - the associated voucher26 * @param _sellerId - the seller id27 */28function raiseDisputeInternal(29 Exchange storage _exchange,30 Voucher storage _voucher,31 uint256 _sellerId32) internal {33 // Make sure the fulfillment period has elapsed34 uint256 elapsed = block.timestamp - _voucher.redeemedDate;35 require(elapsed < fetchOfferDurations(_exchange.offerId).fulfillmentPeriod, FULFILLMENT_PERIOD_HAS_ELAPSED);36
37 // Make sure the caller is buyer associated with the exchange38 checkBuyer(_exchange.buyerId);39
40 // Set the exchange state to disputed41 _exchange.state = ExchangeState.Disputed;42
43 // Fetch the dispute and dispute dates44 (, Dispute storage dispute, DisputeDates storage disputeDates) = fetchDispute(_exchange.id);45
46 // Set the initial values47 dispute.exchangeId = _exchange.id;48 dispute.state = DisputeState.Resolving;49
50 // Update the disputeDates51 disputeDates.disputed = block.timestamp;52 disputeDates.timeout = block.timestamp + fetchOfferDurations(_exchange.offerId).resolutionPeriod;53
54 // Notify watchers of state change55 emit DisputeRaised(_exchange.id, _exchange.buyerId, _sellerId, msgSender());56}
Recommendation:
We advise either the validation to be relocated to the function or the comment to be omitted as the validation statement is incorrect.
Alleviation (f62f5f26c278f8bbe55600c7bb344d5941da8787):
The incorrect comment was omitted in the latest iteration of the report as advised.