Omniscia Mean Finance Audit

SwapPermit2Adapter Code Style Findings

SwapPermit2Adapter Code Style Findings

SPA-01C: Developer Code

TypeSeverityLocation
Gas OptimizationSwapPermit2Adapter.sol:L53-L61, L93-L101

Description:

The referenced functions should not be exposed by the contract as they relate to gas-inefficient test functionality.

Example:

src/base/SwapPermit2Adapter.sol
52/// @inheritdoc ISwapPermit2Adapter
53function sellOrderSwapWithGasMeasurement(SellOrderSwapParams calldata _params)
54 external
55 payable
56 returns (uint256 _amountIn, uint256 _amountOut, uint256 _gasSpent)
57{
58 uint256 _gasAtStart = gasleft();
59 (_amountIn, _amountOut) = sellOrderSwap(_params);
60 _gasSpent = _gasAtStart - gasleft();
61}

Recommendation:

We advise them to be omitted from the production-ready version of SwapPermit2Adapter.

Alleviation:

The Mean Finance team responded by stating that they intend those functions to be exposed on the mainnet as they wish to utilize them for off-chain purposes.

We would like to note that such "dry-run" functions that are not meant to be invoked on-chain should be protected against direct invocation by programming practices such as reverting deliberately with the arguments you wish to acquire. As such, we consider this exhibit acknowledged.