JPEG'd contest - Funen's results

Bridging the gap between DeFi and NFTs.

General Information

Platform: Code4rena

Start Date: 07/04/2022

Pot Size: $100,000 USDC

Total HM: 20

Participants: 62

Period: 7 days

Judge: LSDan

Total Solo HM: 11

Id: 107

League: ETH

JPEG'd

Findings Distribution

Researcher Performance

Rank: 28/62

Findings: 2

Award: $262.15

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

152.5804 USDC - $152.58

Labels

bug
QA (Quality Assurance)
sponsor acknowledged

External Links

Awards

109.5676 USDC - $109.57

Labels

bug
G (Gas Optimization)
sponsor disputed

External Links

  1. Change using > instead of!= for saving more gas

https://github.com/code-423n4/2022-04-jpegd/blob/e72861a9ccb707ced9015166fbded5c97c6991b6/contracts/farming/LPFarming.sol#L193

using > can be saving more gas

##Tool Used Remix

##Recommendation Mitigation Change it into !=

  1. Unnecessary code

https://github.com/code-423n4/2022-04-jpegd/blob/e72861a9ccb707ced9015166fbded5c97c6991b6/contracts/staking/JPEGStaking.sol#L50

this can be deleted to saving more gas since it unnecessary and it can be bug if can be burn amount more than msg.sender had.

##Tool Used Manual Review & Remix

  1. using ++i than i++ for saving more gas

Using i++ instead ++i for all the loops, the variable i is incremented using i++. It is known that implementation by using ++i costs less gas per iteration than i++.

Tools Used

Remix

Occurances

main/contracts/farming/LPFarming.sol#L348 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L145 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L231 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L319
  1. change uint256 i = 0 into uint i for saving more gas

this implementation can saving more gas for each loops.

##Tool Used Manual Review & Remix

##Recommended Mitigation Change it

Occurances

main/contracts/farming/LPFarming.sol#L348 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L145 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L231 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L319
  1. Caching array length can saving more gas

this implementation can be saving more gas, since if caching the array length is more gas efficient. This is because access to a local variable in solidity is more efficient.

##Tool Used Manual Review

##Occurances

main/contracts/farming/LPFarming.sol#L348 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L145 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L231 main/contracts/vaults/yVault/strategies/StrategyPUSDConvex.sol#L319
  1. Saving gas by removing = 0

If a variable was not set/initialized, it is assumed to have default value to 0 this implementation was used for saving more gas by removing = 0

##POC https://blog.polymath.network/solidity-tips-and-tricks-to-save-gas-and-reduce-bytecode-size-c44580b218e6

##TOOLS USED Remix, Manual Review

##Mitigation Step Remove = 0

##Occurances

contracts/farming/LPFarming.sol#L340 contracts/farming/LPFarming.sol#L357
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