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

Upgrade pragma to at least 0.8.4 #189

Open
code423n4 opened this issue Dec 22, 2021 · 0 comments
Open

Upgrade pragma to at least 0.8.4 #189

code423n4 opened this issue Dec 22, 2021 · 0 comments
Labels
bug Something isn't working G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Handle

Dravee

Vulnerability details

Impact

Using newer compiler versions and the optimizer gives gas optimizations
and additional safety checks are available for free.

The advantages here are:

-   Low level inliner : from 0.8.2, leads to cheaper runtime gas. Especially relevant when the contract has small functions. For example, OpenZeppelin libraries typically have a lot of small helper functions and if they are not inlined, they cost an additional 20 to 40 gas because of 2 extra jump instructions and additional stack operations needed for function calls.
-   Optimizer improvements in packed structs: Before 0.8.3, storing packed structs, in some cases used an
additional storage read operation. After EIP-2929, if the slot was already cold, this means unnecessary stack operations and extra deploy time costs. However, if the slot was already warm, this means
additional cost of 100 gas alongside the same unnecessary stack operations and extra deploy time costs.
-   Custom errors from 0.8.4, leads to cheaper deploy time cost and run time cost. Note: the run time cost is only relevant when the revert condition is met. In short, replace revert strings by custom errors.

Proof of Concept

Instances include:

./interface/IAdminUpgradeabilityProxy.sol:3:pragma solidity ^0.8.0;
./interface/IERC165Upgradeable.sol:3:pragma solidity ^0.8.0; 
./interface/IERC3156Upgradeable.sol:3:pragma solidity ^0.8.0;
./interface/INFTXEligibility.sol:3:pragma solidity ^0.8.0;   
./interface/INFTXEligibilityManager.sol:3:pragma solidity ^0.8.0;
./interface/INFTXFeeDistributor.sol:3:pragma solidity ^0.8.0;
./interface/INFTXInventoryStaking.sol:3:pragma solidity ^0.8.0;
./interface/INFTXLPStaking.sol:3:pragma solidity ^0.8.0;
./interface/INFTXSimpleFeeDistributor.sol:3:pragma solidity ^0.8.0;
./interface/INFTXVault.sol:3:pragma solidity ^0.8.0;
./interface/INFTXVaultFactory.sol:3:pragma solidity ^0.8.0;
./interface/IPrevNftxContract.sol:3:pragma solidity ^0.8.0;
./interface/IRewardDistributionToken.sol:3:pragma solidity ^0.8.0;
./interface/ITimelockRewardDistributionToken.sol:3:pragma solidity ^0.8.0;
./interface/IUniswapV2Pair.sol:1:pragma solidity ^0.8.0;
./interface/IUniswapV2Router01.sol:3:pragma solidity ^0.8.0;
./interface/IVaultTokenUpgradeable.sol:3:pragma solidity ^0.8.0;
./NFTXEligibilityManager.sol:4:pragma solidity ^0.8.0;
./NFTXInventoryStaking.sol:3:pragma solidity ^0.8.0;
./NFTXLPStaking.sol:3:pragma solidity ^0.8.0;
./NFTXMarketplaceZap.sol:3:pragma solidity ^0.8.0;
./NFTXSimpleFeeDistributor.sol:3:pragma solidity ^0.8.0;
./NFTXStakingZap.sol:3:pragma solidity ^0.8.0;
./NFTXVaultFactoryUpgradeable.sol:3:pragma solidity ^0.8.0;
./NFTXVaultUpgradeable.sol:3:pragma solidity ^0.8.0;
./StakingTokenProvider.sol:3:pragma solidity ^0.8.0;
./token/TimelockRewardDistributionTokenImpl.sol:2:pragma solidity ^0.8.0;
./token/XTokenUpgradeable.sol:3:pragma solidity ^0.8.0;

Tools Used

VS Code

Recommended Mitigation Steps

Consider upgrading pragma to at least 0.8.4.

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Dec 22, 2021
code423n4 added a commit that referenced this issue Dec 22, 2021
@0xKiwi 0xKiwi added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Jan 4, 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) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

2 participants