Backd Tokenomics contest - delfin454000's results

Maximize the power of your assets and start earning yield

General Information

Platform: Code4rena

Start Date: 27/05/2022

Pot Size: $75,000 USDC

Total HM: 20

Participants: 58

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 15

Id: 131

League: ETH

Backd

Findings Distribution

Researcher Performance

Rank: 34/58

Findings: 2

Award: $171.81

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

113.8755 USDC - $113.88

Labels

bug
QA (Quality Assurance)
resolved
sponsor confirmed

External Links

Typos

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/AddressProvider.sol#L237

     * @param key Key to feeze

Change feeze to freeze

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/BkdLocker.sol#L173

     * @dev This does not invlude the gov. tokens queued for withdrawal.

Change invlude to include

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/FeeBurner.sol#L29

    event Burned(address targetLpToken, uint256 amountBurned); // Emmited after a successfull burn to target lp token

Change Emmited to Emitted

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/FeeBurner.sol#L35

    receive() external payable {} // Recieve function for withdrawing from Backd ETH Pool

Change Recieve to Receive

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/FeeBurner.sol#L84

        // Transfering LP tokens back to sender

Change Transfering to Transferring

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L532

    //TOOD: See if this is still needed somewhere

Change TOOD to TODO

Issue: Require error message typo

Explanation: Messages should provide clear information for users to understand reason for failure

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/utils/Preparable.sol#L29

        require(_annualInflationDecayAmm < ScaledMath.ONE, Error.INVALID_PARAMETER_VALUE);

Change the referenced error message from delay be at least 3 days to delay must be at least 3 days

Issue: Sensitive terms in both the comments and the code should be updated

Explanation: Terms incorporating "white," "black," "master" or "slave" are potentially problematic. Substituting more neutral terminology is becoming common practice

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L336

     * @param strategyPool The pool of the strategy to register (avoids blacklisting other addresses).

Suggestion: Change blacklisting to denylisting

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/AddressProvider.sol#L64

        require(!_whiteListedFeeHandlers.contains(feeHandler), Error.ADDRESS_WHITELISTED);

Suggestion: Change 'whitelisted' to 'allowlisted' in each case

Similarly for the following instances of 'whitelist' and its variations:

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/AddressProvider.sol#L36

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/AddressProvider.sol#L65

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/AddressProvider.sol#L71-L72

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/AddressProvider.sol#L302

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/Controller.sol#L51

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L181

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L452

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/KeeperGauge.sol#L79-L80

Issue: TODOs that have not been addressed Explanation: Open TODOs should be worked through and removed

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L532

    //TOOD: See if this is still needed somewhere

#0 - GalloDaSballo

2022-06-20T15:55:59Z

Thorough review of typos much appreciated

Awards

57.93 USDC - $57.93

Labels

bug
G (Gas Optimization)
resolved
sponsor confirmed

External Links

Issue: Require message is too long Explanation: The require revert strings referenced below can be shortened to 32 characters or fewer (as shown) to save gas

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/AddressProvider.sol#L296

        require(!_stakerVaults.contains(token), Error.STAKER_VAULT_EXISTS);

Change the referenced error message from a staker vault already exists for the token to token already has staker vault

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/BkdLocker.sol#L59

        require(currentUInts256[_START_BOOST] == 0, Error.CONTRACT_INITIALIZED);

Change the referenced error message from contract can only be initialized once to contract already initialized

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L60

        require(_minter != address(0), Error.INVALID_MINTER);

Change the referenced error message from the minter address of the LP token and the pool address do not match to minter and pool address mismatch

The same error message occurs in the lines referenced below:

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L72

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L73

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L74

Example:

        require(_annualInflationDecayAmm < ScaledMath.ONE, Error.INVALID_PARAMETER_VALUE);

Change the referenced error message from invalid parameter value attempted to invalid parameter value attempt

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L150-L153

        require(
            issuedNonInflationSupply + amount <= nonInflationDistribution,
            "Maximum non-inflation amount exceeded."
        );

Change error message to Max non-inflation amt exceeded

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/utils/Preparable.sol#L110

        require(block.timestamp >= deadline, Error.DEADLINE_NOT_REACHED);

Change the referenced error message from deadline has not been reached yet to deadline not yet reached

Issue: Should use != 0 instead of > 0 in a require statement if variable is an unsigned integer (uint)

Explanation: != 0 should be used where possible since > 0 costs more gas

The same require occurs in all three lines below:

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/BkdLocker.sol#L91

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/AmmGauge.sol#L104

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/AmmGauge.sol#L125

        require(amount > 0, Error.INVALID_AMOUNT);

Change amount > 0 to amount != 0 in each case

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/BkdLocker.sol#L92

        require(totalLockedBoosted > 0, Error.NOT_ENOUGH_FUNDS);

Change totalLockedBoosted > 0 to totalLockedBoosted != 0

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/BkdLocker.sol#L137

        require(length > 0, "No entries");

Change length > 0 to length != 0

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/KeeperGauge.sol#L140

        require(totalClaimable > 0, Error.ZERO_TRANSFER_NOT_ALLOWED);

Change totalClaimable > 0 to totalClaimable != 0

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/VestedEscrow.sol#L84

        require(unallocatedSupply > 0, "No reward tokens in contract");

Change unallocatedSupply > 0 to unallocatedSupply != 0

Issue: Variables should not be initialized to their default values

Explanation: For example, initialization of booleans to their default value of false is unnecessary and costs gas

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L412

        bool keeperGaugeExists = false;

Change to bool keeperGaugeExists;

Issue: Array length should not be looked up in every iteration of a for loop

Explanation: Calculating the array length costs gas

Recommendation: Read the length of the array from memory before executing the loop

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/access/RoleManager.sol#L82

        for (uint256 i; i < roles.length; i = i.uncheckedInc()) {

Recommendation:

        uint256 totalRolesLength = roles.length; 
        for (uint256 i; i < totalRolesLength; i = i.uncheckedInc()) {

Similarly for the seven for loops referenced below:

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/RewardHandler.sol#L42

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/StakerVault.sol#L259

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/FeeBurner.sol#L56

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L116

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/VestedEscrow.sol#L94

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/zaps/PoolMigrationZap.sol#L22

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/zaps/PoolMigrationZap.sol#L39

#0 - GalloDaSballo

2022-06-18T19:27:00Z

Issue: Require message is too long

6 * 6 = 36

Issue: Should use != 0 instead of > 0 in a require statement if variable is an unsigned integer (uint)

Saves 3 gas per instance 7 * 3 = 21

Issue: Variables should not be initialized to their default values

3

Issue: Array length should not be looked up in every iteration of a for loop

3 per instance 8 * 3 = 24

Total Gas Saved 84

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