Omniscia Boson Protocol Audit
ProtocolBase Code Style Findings
ProtocolBase Code Style Findings
PBE-01C: Redundant Conditional Validation
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | ProtocolBase.sol:L552 |
Description:
The referenced conditional will redundantly evaluate whether the OfferCreator enum of the Offer structure is a Buyer even though the enum supports two states and one of the two has already been excluded.
Example:
contracts/protocol/bases/ProtocolBase.sol
547if (offer.creator == OfferCreator.Seller) {548 // For seller-created offers, check that caller is the seller's assistant549 (, Seller storage seller, ) = fetchSeller(offer.sellerId);550 if (seller.assistant != _msgSender()) revert NotAssistant();551 creatorId = offer.sellerId;552} else if (offer.creator == OfferCreator.Buyer) {Recommendation:
We advise the referenced conditional to be set to an else clause, optimizing its gas cost.
Alleviation (efd5d1a8f23c3bca7c25273ea4c912a367250119):
The Boson Protocol team evaluated this exhibit and opted to retain the code as is as they consider it to be more legible and future-proof.
