Omniscia Boson Protocol Audit

ExchangeCommitBase Code Style Findings

ExchangeCommitBase Code Style Findings

ECB-01C: Unconditional Discard of Transient Queue

Description:

The meta-transaction authorization consumption queue introduced to support x402 payment gateways has resulted in a token transfer authorization queue being discarded on each offer preparation for a commit.

As a result, a redundant gas overhead is observed for all non-meta-transaction interactions that is currently inefficiently imposed.

Example:

contracts/protocol/bases/ExchangeCommitBase.sol
223} else {
224 // useDepositedFunds=true: offer-creator pull is bypassed entirely.
225 // Discard the queue slot reserved for it so the queue layout stays
226 // uniform across this flag.
227 TokenTransferAuthorizationLib.discardNext();
228}

Recommendation:

We advise the discard of the next authorization to be performed solely when a queue is detected, reducing the no-op gas cost path (which is assumed to be the most frequent one) by 100 gas due to reducing the TLOAD instructions from two to one.

Alleviation (8fccc2716047809e4bc7786c95d346e5c61b2896):

The Boson Protocol team opted to apply this optimization by updating the TokenTransferAuthorizationLib::discardNext function to check the length internally, optimizing the code's gas cost.