Mimo August 2022 contest - bearonbike's results

Bridging the chasm between the DeFi world and the world of regulated financial institutions.

General Information

Platform: Code4rena

Start Date: 02/08/2022

Pot Size: $50,000 USDC

Total HM: 12

Participants: 69

Period: 5 days

Judge: gzeon

Total Solo HM: 5

Id: 150

League: ETH

Mimo DeFi

Findings Distribution

Researcher Performance

Rank: 69/69

Findings: 1

Award: $39.03

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

39.0334 USDC - $39.03

Labels

bug
G (Gas Optimization)
edited-by-warden

External Links

ABI.ENCODE() IS LESS EFFICIENT THAN ABI.ENCODEPACKED()

There are 4 instances of this issue:

bytes memory params = abi.encode(msg.sender, vaultId, swapData);

https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/actions/MIMOEmptyVault.sol#L49

bytes memory params = abi.encode(msg.sender, rbData, swapData);

https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/actions/MIMORebalance.sol#L49

_takeFlashLoan(flData, abi.encode(vaultOwner, autoFee, rbData, swapData));

https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/actions/automated/MIMOAutoRebalance.sol#L73

_takeFlashLoan(flData, abi.encode(vaultsData.vaultOwner(rbData.vaultId), managerFee, rbData, swapData));

https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/actions/managed/MIMOManagedRebalance.sol#L65

Redundant check

Variable owner_ has already been assigned as owner, no need to check later.

address owner_ = owner; // Reserve some gas to ensure that the function has enough to finish the execution. uint256 stipend = gasleft() - minGasReserve; // Delegate call to the target contract. bool success; (success, response) = target.delegatecall{ gas: stipend }(data); // Check that the owner has not been changed. if (owner_ != owner) { revert CustomErrors.OWNER_CHANGED(owner_, owner); }

https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxy.sol#L72-L84

Recommended Mitigation Steps: Delete the check(L81-L84) to save some gas.

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter