Omniscia Boson Protocol Audit

OfferBase Code Style Findings

OfferBase Code Style Findings

OBE-01C: Suboptimal Struct Declaration Style

TypeSeverityLocation
Code StyleOfferBase.sol:L173-L178

Description:

The linked declaration style of a struct is using index-based argument initialization.

Example:

contracts/protocol/bases/OfferBase.sol
173disputeResolutionTerms = DisputeResolutionTerms(
174 _disputeResolverId,
175 disputeResolver.escalationResponsePeriod,
176 feeAmount,
177 (feeAmount * pl.buyerEscalationDepositPercentage) / 10000
178);

Recommendation:

We advise the key-value declaration format to be utilized instead, greatly increasing the legibility of the codebase.

Alleviation (44009967e4):

The DisputeResolutionTerms struct creation has instead been adjusted to four separate assignment statements which we consider sub-optimal. We advised the usage of the key-value declaration style (i.e. Funds(a, b, c) would become Funds({tokenAddress:a,tokenName:b,availableAmount:c})) to optimize the code's legibility.

Alleviation (6dae5d2602):

The Boson Protocol team stated that they wish to retain the newly introduced per-key assignment format to ensure consistency across the codebase and to also permit instantiation of structs with members that are otherwise impossible to copy by memory (i.e. in-memory arrays). Given that the usage of the per-key style is a valid case for types that cannot be assigned in a direct struct instantiation statement, we consider this exhibit adequately dealt with as the ambiguity portion of the exhibit has been sufficiently dealt with.