Skip to content

Initial Audit Fixes#2

Merged
imrtlfarm merged 13 commits intomainfrom
feat/add-new-teller
Jul 2, 2025
Merged

Initial Audit Fixes#2
imrtlfarm merged 13 commits intomainfrom
feat/add-new-teller

Conversation

@imrtlfarm
Copy link
Contributor

@imrtlfarm imrtlfarm commented Jun 24, 2025

Fix audit findings other than G-1, G-2, and L-3. Update tests accordingly.

@imrtlfarm imrtlfarm marked this pull request as ready for review June 25, 2025 22:04
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Major refactoring of FluxManager and related contracts to address audit findings, focusing on gas optimization, type safety, and signature verification improvements.

  • Changed token amount types from uint256 to uint128 across UniswapV4FluxManager and test files to match Uniswap's expectations and prevent overflows
  • Removed performance review functionality from FluxManager.sol including lastPerformanceReview, performanceReviewFrequency, and related state variables
  • Added token0IsNative immutable flag in FluxManager.sol for efficient native token handling and gas optimization
  • Improved signature verification in IntentsTeller.sol with EIP-712 standards and separated user intent from execution details
  • Added new mainnet fork test file UniswapV4FluxManagerSorellaMainnet.t.sol for comprehensive Sorella-specific functionality testing

11 files reviewed, 4 comments
Edit PR Review Bot Settings | Greptile

Comment on lines 828 to +831
token1.approve(address(boringVault), type(uint256).max);
vm.stopPrank();

// Generate signature for user 0 to deposit 1e10 USDC to user 1
// Generate signature for user 0 to deposit 1e10 USDC to user 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Function comment is incorrect - generating signature for user 0, not user 1

Comment on lines +559 to +562
fluxManager.getRateSafe(
depositData.rate,
(depositData.intent.asset == token0 || token0IsNative && depositData.intent.asset == ERC20(nativeWrapper))
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider caching depositData.intent.asset == token0 || token0IsNative && depositData.intent.asset == ERC20(nativeWrapper) to avoid duplicate computation in deposits/withdrawals

Comment on lines +135 to +137
(uint256 token0Balance, uint256 token1Balance) = manager.totalAssets(price);
assertApproxEqRel(token1Balance, ethAmount, 0.02e18, "token0Balance should equate to original ethAmount");
assertApproxEqRel(token0Balance, usdcAmount, 0.02e18, "token1Balance should equate to original usdcAmount");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Assertion message tokens are reversed - token1Balance is compared against ethAmount but message says token0Balance

Suggested change
(uint256 token0Balance, uint256 token1Balance) = manager.totalAssets(price);
assertApproxEqRel(token1Balance, ethAmount, 0.02e18, "token0Balance should equate to original ethAmount");
assertApproxEqRel(token0Balance, usdcAmount, 0.02e18, "token1Balance should equate to original usdcAmount");
(uint256 token0Balance, uint256 token1Balance) = manager.totalAssets(price);
assertApproxEqRel(token1Balance, ethAmount, 0.02e18, "token1Balance should equate to original ethAmount");
assertApproxEqRel(token0Balance, usdcAmount, 0.02e18, "token0Balance should equate to original usdcAmount");

Comment on lines +31 to +34
address internal scriptOwner;
address internal owner;
address internal payout;
address internal strategist;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: These state variables (owner, payout, strategist) are declared but never initialized, which will cause role assignment to fail on line 95

@imrtlfarm imrtlfarm merged commit a5ed617 into main Jul 2, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant