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 #60

Open
code423n4 opened this issue Feb 22, 2022 · 2 comments
Open

Gas Optimizations #60

code423n4 opened this issue Feb 22, 2022 · 2 comments
Labels
bug Something isn't working G (Gas Optimization) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Using memory copies of storage variables when repeated access is required uses less gas

credit should be copied

        if (credit > 0) {
            uint toBurn = Math.min(vusd.balanceOf(address(this)), credit);
            credit -= toBurn;

https://github.com/code-423n4/2022-02-hubble/blob/ed1d885d5dbc2eae24e43c3ecbf291a0f5a52765/contracts/MarginAccount.sol#L574-L576

Functions not called by the contract itself should be external rather than public

function getUnderlyingTwapPrice(uint256 _intervalInSeconds) public view returns (int256) {        

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/AMM.sol#L387

function liquidateMaker(address maker) override public whenNotPaused {         

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L148

function liquidateTaker(address trader) override public whenNotPaused {         

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L153

function syncDeps(IRegistry _registry) public onlyGovernance {          

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/InsuranceFund.sol#L116

function getNormalizedMargin(address trader) override public view returns(int256 weighted) {       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L509

function syncDeps(address _registry, uint _liquidationIncentive) public onlyGovernance {        

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L599

require() strings longer than 32 bytes cost extra gas

require(baseAssetQuantity > 0, "VAMM._longbaseAssetQuantity is <= 0");                 

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/AMM.sol#L487

require(baseAssetQuantity < 0, "VAMM._shortbaseAssetQuantity is >= 0");                 

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/AMM.sol#L511

require(margin[VUSD_IDX][trader] >= 0, "Cannot remove margin when vusd balance is negative");             

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L174

require(notionalPosition == 0, "Liquidate positions before settling bad debt");               

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L354

require(repay <= maxRepay, "Need to repay more to seize that much");             

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L453

require(reserve >= withdrawals[start].amount, 'Cannot process withdrawals at this timeNot enough balance');             

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/VUSD.sol#L55

require(isAboveMinAllowableMargin(trader), "CHBelow Minimum Allowable Margin");                   

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L84

require(isAboveMinAllowableMargin(maker), "CHBelow Minimum Allowable Margin");                   

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L101

require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "HubbleErc20.allowTransfers.noAuth");                     

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/ERC20Mintable.sol#L32

require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "HubbleErc20.allowTransfers.noAuth");                     

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/ERC20Mintable.sol#L60

require(prices[underlying] != 0, "underlying price has not been set as yet");             

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/TestOracle.sol#L20

require(twapPrices[underlying] != 0, "underlying twap price has not been set as yet");            

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/TestOracle.sol#L33

Using > 0 costs more gas than != 0 when used in on uints in a require() statement

require(amount > 0, "Add non-zero margin");          

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L150

require(_round > 0, "Not enough history");          

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/Oracle.sol#L153

Splitting require() statements that use && saves gas

See this issue for an example

require(idx > VUSD_IDX && idx < supportedCollateral.length, "collateral not seizable");      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol

It costs more gas to initialize variables to zero than to let the default of zero be applied

uint constant VUSD_IDX = 0;           

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L31

for (uint i = 0; i < idxs.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L331

for (uint i = 0; i < assets.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L521

for (uint i = 0; i < _collaterals.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L552

uint constant VUSD_IDX = 0;           

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccountHelper.sol#L13

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L122

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L130

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L170

for (uint i = 0; i < amms.length; i++) { // liquidate all positions  

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L194

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L251

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L263

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L277

uint shares = 0;            

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/InsuranceFund.sol#L52

uint constant VUSD_IDX = 0;           

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L15

for (uint i = 0; i < len; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L52

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L65

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L78

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L95

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L120

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L137

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L9

uint256 total = 0;            

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L17

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L18

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L21

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L27

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L32

for (uint i = 0; i < numTraders; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Leaderboard.sol#L43

for (uint j = 0; j < l; j++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Leaderboard.sol#L45

for (uint i = 0; i < targets.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Executor.sol#L19

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L25

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L31

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L37

<array>.length should not be looked up in every loop of a for-loop

Even memory arrays incur the overhead of bit tests and bit shifts to calculate the array length

for (uint i = 0; i < idxs.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L331

for (uint i = 1 /* skip vusd */; i < assets.length; i++) {  

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L373

for (uint i = 0; i < assets.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L521

for (uint i = 0; i < _collaterals.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L552

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L122

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L130

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L170

for (uint i = 0; i < amms.length; i++) { // liquidate all positions  

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L194

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L251

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L263

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L277

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L65

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L78

for (uint i = 1; i < length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L367

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L9

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L18

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L21

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L27

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L32

for (uint i = 0; i < targets.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Executor.sol#L19

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L25

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L31

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L37

++i/i++ should be unchecked{++i}/unchecked{++i} when it is not possible for them to overflow, as is the case when used in for- and while-loops

for (uint i = 0; i < idxs.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L331

for (uint i = 1 /* skip vusd */; i < assets.length; i++) {  

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L373

for (uint i = 0; i < assets.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L521

for (uint i = 0; i < _collaterals.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L552

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L122

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L130

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L170

for (uint i = 0; i < amms.length; i++) { // liquidate all positions  

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L194

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L251

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L263

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L277

for (uint i = 0; i < len; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L52

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L65

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L78

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L95

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L120

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L137

for (uint i = 1; i < length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L367

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L9

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L18

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L21

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L27

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L32

for (uint i = 0; i < numTraders; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Leaderboard.sol#L43

for (uint j = 0; j < l; j++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Leaderboard.sol#L45

for (uint i = 0; i < targets.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Executor.sol#L19

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L25

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L31

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L37

++i costs less gas than ++i, especially when it's used in for-loops (--i/i-- too)

for (uint i = 0; i < idxs.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L331

for (uint i = 1 /* skip vusd */; i < assets.length; i++) {  

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L373

for (uint i = 0; i < assets.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L521

for (uint i = 0; i < _collaterals.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/MarginAccount.sol#L552

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L122

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L130

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L170

for (uint i = 0; i < amms.length; i++) { // liquidate all positions  

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L194

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L251

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L263

for (uint i = 0; i < amms.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/ClearingHouse.sol#L277

for (uint i = 0; i < len; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L52

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L65

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L78

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L95

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L120

for (uint i = 0; i < l; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L137

for (uint i = 1; i < length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/HubbleViewer.sol#L367

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L9

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L18

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L21

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L27

for (uint256 i = 0; i < recipients.length; i++)       

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Disperse.sol#L32

for (uint i = 0; i < numTraders; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Leaderboard.sol#L43

for (uint j = 0; j < l; j++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Leaderboard.sol#L45

for (uint i = 0; i < targets.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/Executor.sol#L19

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L25

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L31

for (uint i = 0; i < traders.length; i++) {      

https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/tests/BatchLiquidator.sol#L37

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Feb 22, 2022
code423n4 added a commit that referenced this issue Feb 22, 2022
@atvanguard
Copy link
Collaborator

Good report

@atvanguard atvanguard added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Feb 26, 2022
@moose-code
Copy link
Collaborator

Really nice format.

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 confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants