Backd contest - MaratCerby's results

Maximize the power of your assets and start earning yield

General Information

Platform: Code4rena

Start Date: 21/04/2022

Pot Size: $100,000 USDC

Total HM: 18

Participants: 60

Period: 7 days

Judge: gzeon

Total Solo HM: 10

Id: 112

League: ETH

Backd

Findings Distribution

Researcher Performance

Rank: 47/60

Findings: 2

Award: $155.04

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Labels

bug
duplicate
2 (Med Risk)
reviewed

Awards

70.085 USDC - $70.08

External Links

Lines of code

https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/EthPool.sol#L29-L31

Vulnerability details

Impact

It is recommended to use safe ETH transfer to avoid malicious execution on transferring ETH to contracts.

Proof of Concept

https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol

Tools Used

Recommended code: error SafeTransferNativeFailed(); ... function _doTransferOut(address payable to, uint256 amount) internal override { (bool success, ) = to.call{value: amount}(new bytes(0));

// we allow only successful calls if (!success) { revert SafeTransferNativeFailed(); }

}

#0 - chase-manning

2022-04-28T11:38:59Z

Duplicate of #52

Awards

84.957 USDC - $84.96

Labels

bug
G (Gas Optimization)
resolved
reviewed

External Links

Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L64

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_WHITELISTED(); .. if (_whiteListedFeeHandlers.contains(feeHandler)) { revert Error_ADDRESS_WHITELISTED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L70

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_NOT_WHITELISTED(); .. if (!_whiteListedFeeHandlers.contains(feeHandler)) { revert Error_ADDRESS_NOT_WHITELISTED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L96

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (pool == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L100

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (poolToken == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L170

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_DOES_NOT_EXIST(); .. if (!_addressKeyMetas.contains(key)) { revert Error_ADDRESS_DOES_NOT_EXIST(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L179

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_DOES_NOT_EXIST(); .. if (!(!checkExists || _addressKeyMetas.contains(key))) { revert Error_ADDRESS_DOES_NOT_EXIST(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L188

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_DOES_NOT_EXIST(); .. if (!exists) { revert Error_ADDRESS_DOES_NOT_EXIST(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L230

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_DOES_NOT_EXIST(); .. if (meta.frozen) { revert Error_ADDRESS_DOES_NOT_EXIST(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L231

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_ARGUMENT(); .. if (!meta.freezable) { revert Error_INVALID_ARGUMENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L249

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_FROZEN(); .. if (meta.frozen) { revert Error_ADDRESS_FROZEN(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L259

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_FROZEN(); .. if (meta.frozen) { revert Error_ADDRESS_FROZEN(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L284

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (token == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L285

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_STAKER_VAULT_EXISTS(); .. if (_stakerVaults.contains(token)) { revert Error_STAKER_VAULT_EXISTS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L314

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_NOT_FOUND(); .. if (!exists) { revert Error_ADDRESS_NOT_FOUND(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L417

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_ARGUMENT(); .. if (_addressKeyMetas.contains(key)) { revert Error_INVALID_ARGUMENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L423

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_ARGUMENT(); .. if (!_addressKeyMetas.set(key, meta.toUInt())) { revert Error_INVALID_ARGUMENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/Controller.sol#L32

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_ALREADY_SET(); .. if (address(inflationManager) != address(0)) { revert Error_ADDRESS_ALREADY_SET(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/Controller.sol#L33

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_ARGUMENT(); .. if (_inflationManager == address(0)) { revert Error_INVALID_ARGUMENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/Controller.sol#L80

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (addressProvider.getBKDLocker() == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/CvxCrvRewardsLocker.sol#L83-L86

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_EXCEEDS_MAX_BOOST(); .. if (_spendRatio > ICvxLocker(CVX_LOCKER).maximumBoostPayment()) { revert Error_EXCEEDS_MAX_BOOST(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/CvxCrvRewardsLocker.sol#L135

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_PREPARED_WITHDRAWAL(); .. if (prepareWithdrawal) { revert Error_PREPARED_WITHDRAWAL(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/GasBank.sol#L42-L45

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!(msg.sender == account || addressProvider.isAction(msg.sender))) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/GasBank.sol#L68

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (currentBalance < amount) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/GasBank.sol#L69-L72

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!(msg.sender == account || addressProvider.isAction(msg.sender))) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/GasBank.sol#L76

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NOT_ENOUGH_FUNDS(); .. if (currentBalance - amount < ethRequired) { revert Error_NOT_ENOUGH_FUNDS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/GasBank.sol#L91

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_FAILED_TRANSFER(); .. if (!success) { revert Error_FAILED_TRANSFER(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/LpToken.sol#L22

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (msg.sender != minter) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/LpToken.sol#L34

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (_minter == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L61

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (address(_controller) == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L70

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ROLE_EXISTS(); .. if (currentAddresses[_LP_GAUGE] != address(0)) { revert Error_ROLE_EXISTS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L93

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (msg.sender != address(controller.inflationManager())) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L106

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_SELF_TRANSFER_NOT_ALLOWED(); .. if (msg.sender == account) { revert Error_SELF_TRANSFER_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L107

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (balances[msg.sender] < amount) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L139

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_SAME_ADDRESS_NOT_ALLOWED(); .. if (src == dst) { revert Error_SAME_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L150

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (startingAllowance < amount) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L153

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (srcTokens < amount) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L203

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!controller.addressProvider().isAction(msg.sender)) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L224

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!controller.addressProvider().isAction(msg.sender)) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L324

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (IERC20(token).balanceOf(msg.sender) < amount) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L340

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (staked != amount) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L367-L370

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (!(src == msg.sender || allowance_ >= amount || address(pool) == msg.sender)) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L371

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (balances[src] < amount) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/access/AuthorizationBase.sol#L17

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!_roleManager().hasRole(role, msg.sender)) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/access/AuthorizationBase.sol#L25

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!_roleManager().hasRole(Roles.GOVERNANCE, msg.sender)) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/access/AuthorizationBase.sol#L33

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!_roleManager().hasAnyRole(role1, role2, msg.sender)) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/access/AuthorizationBase.sol#L45-L48

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!_roleManager().hasAnyRole(role1, role2, role3, msg.sender)) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/access/RoleManager.sol#L26

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!hasRole(Roles.GOVERNANCE, msg.sender)) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/access/RoleManager.sol#L44

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_CANNOT_REVOKE_ROLE(); .. if (getRoleMemberCount(Roles.GOVERNANCE) <= 1) { revert Error_CANNOT_REVOKE_ROLE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/access/RoleManager.sol#L110

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_CANNOT_REVOKE_ROLE(); .. if (role == Roles.GOVERNANCE) { revert Error_CANNOT_REVOKE_ROLE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/access/RoleManager.sol#L111

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_ARGUMENT(); .. if (!hasRole(role, account)) { revert Error_INVALID_ARGUMENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L67

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_UPDATE_BALANCE(); .. if (amountLeft != 0) { revert Error_INSUFFICIENT_UPDATE_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L98

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_UPDATE_BALANCE(); .. if (swapper == address(0)) { revert Error_INSUFFICIENT_UPDATE_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L185

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_ARGUMENT(); .. if (protocols.length != handlers.length) { revert Error_INVALID_ARGUMENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L209

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_PROTOCOL_NOT_FOUND(); .. if (!_supportedProtocols.contains(protocol)) { revert Error_PROTOCOL_NOT_FOUND(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L210

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (record.singleTopUpAmount <= 0) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L211

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (record.threshold <= ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L212

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (record.singleTopUpAmount > record.totalTopUpAmount) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L213-L216

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_POSITION_ALREADY_EXISTS(); .. if (_positions[msg.sender][account][protocol].threshold != 0) { revert Error_POSITION_ALREADY_EXISTS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L217

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_SWAP_PATH_NOT_FOUND(); .. if (!_isSwappable(record.depositToken, record.actionToken)) { revert Error_SWAP_PATH_NOT_FOUND(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L218

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_TOKEN_NOT_USABLE(); .. if (!isUsable(record.depositToken)) { revert Error_TOKEN_NOT_USABLE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L224

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_VALUE_TOO_LOW_FOR_GAS(); .. if (msg.value < gasDeposit) { revert Error_VALUE_TOO_LOW_FOR_GAS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L282

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NO_POSITION_EXISTS(); .. if (position.threshold == 0) { revert Error_NO_POSITION_EXISTS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L328

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (newActionFee > _MAX_ACTION_FEE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L359-L363

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (!(newSwapperSlippage >= _MIN_SWAPPER_SLIPPAGE && newSwapperSlippage <= _MAX_SWAPPER_SLIPPAGE)) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L546

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NOT_ENOUGH_BKD_STAKED(); .. if (!controller.canKeeperExecuteAction(msg.sender)) { revert Error_NOT_ENOUGH_BKD_STAKED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L553

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NO_POSITION_EXISTS(); .. if (position.threshold == 0) { revert Error_NO_POSITION_EXISTS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L554

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (position.totalTopUpAmount == 0) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L560

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_THRESHOLD(); .. if (vars.userFactor >= position.threshold) { revert Error_INSUFFICIENT_THRESHOLD(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L575-L579

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ESTIMATED_GAS_TOO_HIGH(); .. if (vars.estimatedRequiredWeiForGas > vars.estimatedRequiredGas * vars.userGasPrice + maxWeiForGas) { revert Error_ESTIMATED_GAS_TOO_HIGH(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L583-L586

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_GAS_BANK_BALANCE_TOO_LOW(); .. if (vars.gasBankBalance + maxWeiForGas < vars.estimatedRequiredWeiForGas) { revert Error_GAS_BANK_BALANCE_TOO_LOW(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L676

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_TOP_UP_FAILED(); .. if (!(vars.success && abi.decode(vars.topupResult, (bool)))) { revert Error_TOP_UP_FAILED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L723-L726

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_GAS_TOO_HIGH(); .. if (vars.reimbursedWeiForGas + maxWeiForGas < vars.requiredWeiForGas) { revert Error_GAS_TOO_HIGH(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L928

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_PROTOCOL_NOT_FOUND(); .. if (!(!ensureExists || handler != address(0))) { revert Error_PROTOCOL_NOT_FOUND(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L54

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (keeperFee + treasuryFee > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L67

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (getKeeperGauge(lpToken) != address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L68

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (_keeperGauge == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L87

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (msg.sender != actionContract) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L123

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NOTHING_TO_CLAIM(); .. if (totalClaimable <= 0) { revert Error_NOTHING_TO_CLAIM(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L151

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (newKeeperFee > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L161-L166

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (pendingUInts256[_TREASURY_FEE_FRACTION_KEY] + pendingUInts256[_KEEPER_FEE_FRACTION_KEY] > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L196

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (newTreasuryFee > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L206-L211

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (pendingUInts256[_TREASURY_FEE_FRACTION_KEY] + pendingUInts256[_KEEPER_FEE_FRACTION_KEY] > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/handlers/AaveHandler.sol#L51

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNDERLYING_NOT_SUPPORTED(); .. if (reserve.aTokenAddress == address(0)) { revert Error_UNDERLYING_NOT_SUPPORTED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/handlers/CompoundHandler.sol#L74

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_FAILED_MINT(); .. if (err != 0) { revert Error_FAILED_MINT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/handlers/CompoundHandler.sol#L80

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_FAILED_TRANSFER(); .. if (!success) { revert Error_FAILED_TRANSFER(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/handlers/CompoundHandler.sol#L123

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_FAILED_REPAY_BORROW(); .. if (err != 0) { revert Error_FAILED_REPAY_BORROW(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/handlers/CompoundHandler.sol#L141

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_FAILED_METHOD_CALL(); .. if (oErr != 0) { revert Error_FAILED_METHOD_CALL(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/handlers/CompoundHandler.sol#L148

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_FAILED_METHOD_CALL(); .. if (vars.oraclePriceMantissa == 0) { revert Error_FAILED_METHOD_CALL(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/oracles/ChainlinkOracleProvider.sol#L31

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_ARGUMENT(); .. if (feed == previousFeed) { revert Error_INVALID_ARGUMENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/oracles/ChainlinkOracleProvider.sol#L41

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_ARGUMENT(); .. if (stalePriceDelay_ < 1 hours) { revert Error_INVALID_ARGUMENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/oracles/ChainlinkOracleProvider.sol#L53

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ASSET_NOT_SUPPORTED(); .. if (feed == address(0)) { revert Error_ASSET_NOT_SUPPORTED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/oracles/ChainlinkOracleProvider.sol#L57

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_STALE_PRICE(); .. if (block.timestamp > updatedAt + stalePriceDelay) { revert Error_STALE_PRICE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/oracles/ChainlinkOracleProvider.sol#L58

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NEGATIVE_PRICE(); .. if (answer < 0) { revert Error_NEGATIVE_PRICE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/Erc20Pool.sol#L20

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (underlying_ == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/Erc20Pool.sol#L30

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_VALUE(); .. if (msg.value != 0) { revert Error_INVALID_VALUE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/EthPool.sol#L25

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_SENDER(); .. if (msg.sender != from) { revert Error_INVALID_SENDER(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/EthPool.sol#L26

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (msg.value != amount) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L76

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (address(_controller) == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L136

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_ALREADY_SET(); .. if (address(lpToken) != address(0)) { revert Error_ADDRESS_ALREADY_SET(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L137

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_MINTER(); .. if (ILpToken(_lpToken).minter() != address(this)) { revert Error_INVALID_MINTER(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L155-L158

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!(msg.sender == address(lpToken) || msg.sender == address(staker))) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L179

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (_newRatio > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L208

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (newRatio > (ScaledMath.DECIMAL_SCALE * 50) / 100) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L331

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_ALREADY_SET(); .. if (address(staker) != address(0)) { revert Error_ADDRESS_ALREADY_SET(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L333

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (stakerVault == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L387

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NOT_CAPPED(); .. if (!isCapped()) { revert Error_NOT_CAPPED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L399

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NOT_CAPPED(); .. if (!isCapped()) { revert Error_NOT_CAPPED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L400

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_SAME_AS_CURRENT(); .. if (depositCap == _depositCap) { revert Error_SAME_AS_CURRENT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L401

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (_depositCap == 0) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L441-L444

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (lpBalance_ + staker.balanceOf(msg.sender) < redeemLpTokens) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L471

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (underlyingAmount == 0) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L473

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (lpToken_.balanceOf(account) == 0) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L517-L520

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_EXCEEDS_DEPOSIT_CAP(); .. if (currentUnderlyingBalance + depositAmount > depositCap) { revert Error_EXCEEDS_DEPOSIT_CAP(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L525

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (mintedLp < minTokenAmount) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L549

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (redeemLpTokens == 0) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L551

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (lpToken_.balanceOf(msg.sender) < redeemLpTokens) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L562

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NOT_ENOUGH_FUNDS_WITHDRAWN(); .. if (redeemUnderlying < minRedeemAmount) { revert Error_NOT_ENOUGH_FUNDS_WITHDRAWN(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L811

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (maxFee < minFee) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L812

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (maxFee > _MAX_WITHDRAWAL_FEE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L159

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_POOL_IMPLEMENTATION(); .. if (vars.poolImplementation == address(0)) { revert Error_INVALID_POOL_IMPLEMENTATION(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L162

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_LP_TOKEN_IMPLEMENTATION(); .. if (vars.lpTokenImplementation == address(0)) { revert Error_INVALID_LP_TOKEN_IMPLEMENTATION(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L165

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_VAULT_IMPLEMENTATION(); .. if (vars.vaultImplementation == address(0)) { revert Error_INVALID_VAULT_IMPLEMENTATION(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L170-L173

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_NVALID_STAKER_VAULT_IMPLEMENTATION(); .. if (vars.stakerVaultImplementation == address(0)) { revert Error_NVALID_STAKER_VAULT_IMPLEMENTATION(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L180-L183

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_POOL_IMPLEMENTATION(); .. if (ILiquidityPool(vars.poolImplementation).getUnderlying() != address(0)) { revert Error_INVALID_POOL_IMPLEMENTATION(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L184

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_DECIMALS(); .. if (lpTokenArgs.decimals != 18) { revert Error_INVALID_DECIMALS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/BkdTriHopCvx.sol#L133

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_DEPOSIT_FAILED(); .. if (!_deposit()) { revert Error_DEPOSIT_FAILED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/BkdTriHopCvx.sol#L147

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_VALUE(); .. if (msg.value != 0) { revert Error_INVALID_VALUE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L76

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (msg.sender != vault) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L117

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_STRATEGY_SHUT_DOWN(); .. if (isShutdown) { revert Error_STRATEGY_SHUT_DOWN(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L144-L147

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!(msg.sender == vault || _roleManager().hasRole(Roles.GOVERNANCE, msg.sender))) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L197

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (crvCommunityReserveShare_ > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L198

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_CommunityReserveMustBeSet(); .. if (communityReserve == address(0)) { revert Error_CommunityReserveMustBeSet(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L214

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (cvxCommunityReserveShare_ > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L215

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_CommunityReserveMustBeSet(); .. if (communityReserve == address(0)) { revert Error_CommunityReserveMustBeSet(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L260

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (msg.sender != _strategist) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L273-L276

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_TOKEN_TO_ADD(); .. if (!(token_ != address(CVX) && token != address(underlying) && token_ != address(_CRV))) { revert Error_INVALID_TOKEN_TO_ADD(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/StrategySwapper.sol#L69

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_FailedToSendEth(); .. if (!sent) { revert Error_FailedToSendEth(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/StrategySwapper.sol#L110

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_SLIPPAGE_TOLERANCE(); .. if (slippageTolerance_ > ScaledMath.ONE) { revert Error_INVALID_SLIPPAGE_TOLERANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/StrategySwapper.sol#L111

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_SLIPPAGE_TOLERANCE(); .. if (slippageTolerance_ <= 0.8e18) { revert Error_INVALID_SLIPPAGE_TOLERANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/StrategySwapper.sol#L123

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (token_ == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/StrategySwapper.sol#L124

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_SAME_ADDRESS_NOT_ALLOWED(); .. if (curvePool_ == address(curvePools[token_])) { revert Error_SAME_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/StrategySwapper.sol#L139

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (token_ == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/utils/Pausable.sol#L10

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_CONTRACT_PAUSED(); .. if (isPaused) { revert Error_CONTRACT_PAUSED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/utils/Pausable.sol#L15

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_PAUSE(); .. if (!_isAuthorizedToPause(msg.sender)) { revert Error_UNAUTHORIZED_PAUSE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/utils/Preparable.sol#L28

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_DEADLINE_NOT_ZERO(); .. if (deadlines[key] != 0) { revert Error_DEADLINE_NOT_ZERO(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/utils/Preparable.sol#L29

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_DELAY_TOO_SHORT(); .. if (delay < _MIN_DELAY) { revert Error_DELAY_TOO_SHORT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/utils/Preparable.sol#L86

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_DEADLINE_NOT_ZERO(); .. if (deadlines[key] == 0) { revert Error_DEADLINE_NOT_ZERO(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/utils/Preparable.sol#L98

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_DEADLINE_NOT_ZERO(); .. if (deadlines[key] == 0) { revert Error_DEADLINE_NOT_ZERO(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/utils/Preparable.sol#L110

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_DEADLINE_NOT_ZERO(); .. if (block.timestamp < deadline) { revert Error_DEADLINE_NOT_ZERO(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/utils/Preparable.sol#L111

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_DEADLINE_NOT_SET(); .. if (deadline == 0) { revert Error_DEADLINE_NOT_SET(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Erc20Vault.sol#L20

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (underlying_ == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L53

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (msg.sender != pool) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L58-L61

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!(msg.sender == pool || _roleManager().hasRole(Roles.GOVERNANCE, msg.sender))) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L66-L69

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!(msg.sender == pool || _roleManager().hasRole(Roles.MAINTENANCE, msg.sender))) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L88

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (_debtLimit > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L89

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (_targetAllocation > ScaledMath.ONE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L90

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (_bound > MAX_DEVIATION_BOUND) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L164

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (amount <= 0) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L165

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_POOL_NOT_PAUSED(); .. if (!IPausable(pool).isPaused()) { revert Error_POOL_NOT_PAUSED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L167

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (amount > reserveBalance_) { revert Error_INSUFFICIENT_BALANCE(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L194

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ADDRESS_ALREADY_SET(); .. if (currentAddresses[_STRATEGY_KEY] != address(0)) { revert Error_ADDRESS_ALREADY_SET(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L195

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (strategy_ == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L198

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_ZERO_ADDRESS_NOT_ALLOWED(); .. if (IStrategy(strategy_).strategist() == address(0)) { revert Error_ZERO_ADDRESS_NOT_ALLOWED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L264

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (newPerformanceFee > MAX_PERFORMANCE_FEE) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L392

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (newBound > MAX_DEVIATION_BOUND) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L429

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_STRATEGY_DOES_NOT_EXIST(); .. if (!exists) { revert Error_STRATEGY_DOES_NOT_EXIST(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L762-L765

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_Sum_Of_Strategist_Fee_And_Reserve_Fee_Should_Be_Below_One(); .. if (reserveFee + strategistFee > ScaledMath.ONE) { revert Error_Sum_Of_Strategist_Fee_And_Reserve_Fee_Should_Be_Below_One(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/VaultReserve.sol#L28

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_UNAUTHORIZED_ACCESS(); .. if (!_roleManager().hasRole(Roles.VAULT, msg.sender)) { revert Error_UNAUTHORIZED_ACCESS(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/VaultReserve.sol#L51

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (msg.value != amount) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/VaultReserve.sol#L59

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INVALID_AMOUNT(); .. if (received < amount) { revert Error_INVALID_AMOUNT(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/VaultReserve.sol#L73

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_RESERVE_ACCESS_EXCEEDED(); .. if (!canWithdraw(msg.sender)) { revert Error_RESERVE_ACCESS_EXCEEDED(); }


Impact

As per 0.8.4 solidity version it supports new custom errors. Recommending to replace all require(something) to error LongErrorNameWithParameters(uint256 param1, uint256 param2); if (!something) { revert LongErrorNameWithParameters(param1, param2); }

Pros:

  • spends 30 gas less when the revert condition is not met and 250 gas otherwise.
  • reduces deployment costs
  • by removing string constant from contract, reduces contract size
  • improves readability by having a descriptive name of the error

Affected code: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/VaultReserve.sol#L75

Proof of Concept

https://blog.soliditylang.org/2021/04/21/custom-errors/

Tools Used

Recommended code: error Error_INSUFFICIENT_BALANCE(); .. if (accountBalance < amount) { revert Error_INSUFFICIENT_BALANCE(); }

#0 - liveactionllama

2022-04-27T17:46:25Z

Warden created this issue as a placeholder, because their submission was too large for the contest form. They then emailed their md file to our team. I've updated this issue with their md file content.

#1 - gzeoneth

2022-05-08T20:54:13Z

This report is a 100x replicate of the "use custom error" suggestion, the warden should submit 1 entry and list all occurrence instead.

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