Omniscia Steer Protocol Audit
BinCounterHook Code Style Findings
BinCounterHook Code Style Findings
BCH-01C: Ineffectual Usage of Safe Arithmetics
| Type | Severity | Location |
|---|---|---|
| Language Specific | ![]() | BinCounterHook.sol: • I-1: L49 • I-2: L60 • I-3: L69 • I-4: L78 |
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.
Example:
49beforeMintCount[key.toId()]++;Recommendation:
Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statements to be wrapped in unchecked code blocks thereby optimizing their execution cost.
Alleviation (5dd8944ae71b382923f6971e9985eb7f427147ec):
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
BCH-02C: Potentially Ineffective Hook Tracking
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | BinCounterHook.sol: • I-1: L44-L62 • I-2: L64-L80 |
Description:
The referenced function pairs are ineffective as whenever a before hook is invoked its after hook is guaranteed to be invoked.
Example:
44function _beforeMint(address, PoolKey calldata key, IBinPoolManager.MintParams calldata, bytes calldata)45 internal46 override47 returns (bytes4, uint24)48{49 beforeMintCount[key.toId()]++;50 return (this.beforeMint.selector, 0);51}52
53function _afterMint(54 address,55 PoolKey calldata key,56 IBinPoolManager.MintParams calldata,57 BalanceDelta,58 bytes calldata59) internal override returns (bytes4, BalanceDelta) {60 afterMintCount[key.toId()]++;61 return (this.afterMint.selector, BalanceDeltaLibrary.ZERO_DELTA);62}Recommendation:
We advise only one of the two to be tracked, optimizing the gas cost involved in mint and swap operations that utilize the BinCounterHook.
Alleviation (5dd8944ae71b382923f6971e9985eb7f427147ec):
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
