Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gas Optimizations #57

Open
code423n4 opened this issue May 16, 2022 · 0 comments
Open

Gas Optimizations #57

code423n4 opened this issue May 16, 2022 · 0 comments
Labels
bug Something isn't working G (Gas Optimization)

Comments

@code423n4
Copy link
Contributor

Zero check is missing in various functions:
To avoid opening multiple gas reports, I have consolidated them all in one.

Description:
The below functions lack zero checks for the address parameters. If a valid address is not checked, the ownership can be easily transferred or hacked.
AuraToken.constructor(address,string,string)._proxy (Aura.sol#46) lacks a zero-check on :
- vecrvProxy = _proxy (Aura.sol#51)
AuraBalRewardPool.constructor(address,address,address,address,address,uint256)._rewardManager (AuraBalRewardPool.sol#65) lacks a zero-check on :
- rewardManager = _rewardManager (AuraBalRewardPool.sol#72)
AuraBalRewardPool.constructor(address,address,address,address,address,uint256)._penaltyForwarder (AuraBalRewardPool.sol#67) lacks a zero-check on :
- penaltyForwarder = _penaltyForwarder (AuraBalRewardPool.sol#74)
AuraClaimZap.constructor(address,address,address,address,address,address)._crv (AuraClaimZap.sol#69) lacks a zero-check on :
- crv = _crv (AuraClaimZap.sol#76)
AuraClaimZap.constructor(address,address,address,address,address,address)._cvx (AuraClaimZap.sol#70) lacks a zero-check on :
- cvx = _cvx (AuraClaimZap.sol#77)
AuraClaimZap.constructor(address,address,address,address,address,address)._cvxCrv (AuraClaimZap.sol#71) lacks a zero-check on :
- cvxCrv = _cvxCrv (AuraClaimZap.sol#78)
AuraClaimZap.constructor(address,address,address,address,address,address)._crvDepositWrapper (AuraClaimZap.sol#72) lacks a zero-check
on :
- crvDepositWrapper = _crvDepositWrapper (AuraClaimZap.sol#79)
AuraClaimZap.constructor(address,address,address,address,address,address)._cvxCrvRewards (AuraClaimZap.sol#73) lacks a zero-check on : - cvxCrvRewards = _cvxCrvRewards (AuraClaimZap.sol#80)
AuraClaimZap.constructor(address,address,address,address,address,address)._locker (AuraClaimZap.sol#74) lacks a zero-check on :
- locker = _locker (AuraClaimZap.sol#81)
AuraLocker.constructor(string,string,address,address,address)._cvxCrv (AuraLocker.sol#151) lacks a zero-check on :
- cvxCrv = _cvxCrv (AuraLocker.sol#159)
AuraLocker.constructor(string,string,address,address,address)._cvxCrvStaking (AuraLocker.sol#152) lacks a zero-check on :
- cvxcrvStaking = _cvxCrvStaking (AuraLocker.sol#160)
AuraMerkleDrop.constructor(address,bytes32,address,address,address,uint256,uint256)._dao (AuraMerkleDrop.sol#54) lacks a zero-check on :
- dao = _dao (AuraMerkleDrop.sol#62)
AuraMerkleDrop.constructor(address,bytes32,address,address,address,uint256,uint256)._penaltyForwarder (AuraMerkleDrop.sol#58) lacks a
zero-check on :
- penaltyForwarder = _penaltyForwarder (AuraMerkleDrop.sol#66)
AuraMerkleDrop.setDao(address)._newDao (AuraMerkleDrop.sol#77) lacks a zero-check on :
- dao = _newDao (AuraMerkleDrop.sol#79)
AuraStakingProxy.constructor(address,address,address,address,address,uint256)._rewards (AuraStakingProxy.sol#67) lacks a zero-check on :
- rewards = _rewards (AuraStakingProxy.sol#74)
AuraStakingProxy.constructor(address,address,address,address,address,uint256)._crv (AuraStakingProxy.sol#68) lacks a zero-check on :
- crv = _crv (AuraStakingProxy.sol#76)
AuraStakingProxy.constructor(address,address,address,address,address,uint256)._cvx (AuraStakingProxy.sol#69) lacks a zero-check on :
- cvx = _cvx (AuraStakingProxy.sol#77)
AuraStakingProxy.constructor(address,address,address,address,address,uint256)._cvxCrv (AuraStakingProxy.sol#70) lacks a zero-check on
:
- cvxCrv = _cvxCrv (AuraStakingProxy.sol#78)
AuraStakingProxy.constructor(address,address,address,address,address,uint256)._crvDepositorWrapper (AuraStakingProxy.sol#71) lacks a zero-check on :
- crvDepositorWrapper = _crvDepositorWrapper (AuraStakingProxy.sol#79)
AuraStakingProxy.setCrvDepositorWrapper(address,uint256)._crvDepositorWrapper (AuraStakingProxy.sol#88) lacks a zero-check on :
- crvDepositorWrapper = _crvDepositorWrapper (AuraStakingProxy.sol#92)
AuraStakingProxy.setKeeper(address)._keeper (AuraStakingProxy.sol#99) lacks a zero-check on :
- keeper = _keeper (AuraStakingProxy.sol#101)
AuraStakingProxy.setPendingOwner(address)._po (AuraStakingProxy.sol#107) lacks a zero-check on :
- pendingOwner = _po (AuraStakingProxy.sol#109)
AuraStakingProxy.setRewards(address).rewards (AuraStakingProxy.sol#137) lacks a zero-check on :
- rewards = rewards (AuraStakingProxy.sol#139)
AuraVestedEscrow.constructor(address,address,address,uint256,uint256).admin
(AuraVestedEscrow.sol#51) lacks a zero-check on :
- admin = admin
(AuraVestedEscrow.sol#60)
AuraVestedEscrow.setAdmin(address)._admin (AuraVestedEscrow.sol#77) lacks a zero-check on :
- admin = _admin (AuraVestedEscrow.sol#79)
BalLiquidityProvider.constructor(address,address,uint256,address,address)._dao (BalLiquidityProvider.sol#31) lacks a zero-check on :
- dao = _dao (BalLiquidityProvider.sol#38)
ClaimFeesHelper.constructor(address,address,address)._voterProxy (ClaimFeesHelper.sol#32) lacks a zero-check on :
- voterProxy = _voterProxy (ClaimFeesHelper.sol#36)
CrvDepositorWrapper.constructor(address,IVault,address,address,bytes32)._crvDeposit (CrvDepositorWrapper.sol#108) lacks a zero-check on :
- crvDeposit = _crvDeposit (CrvDepositorWrapper.sol#114)

Mitigation:
Always check for valid incomin address.

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels May 16, 2022
code423n4 added a commit that referenced this issue May 16, 2022
@0xMaharishi 0xMaharishi added the duplicate This issue or pull request already exists label May 25, 2022
@dmvt dmvt removed the duplicate This issue or pull request already exists label Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization)
Projects
None yet
Development

No branches or pull requests

3 participants