Paladin - Warden Pledges contest - delfin454000's results

A governance lending protocol transforming users voting power into a new money lego.

General Information

Platform: Code4rena

Start Date: 27/10/2022

Pot Size: $33,500 USDC

Total HM: 8

Participants: 96

Period: 3 days

Judge: kirk-baird

Total Solo HM: 1

Id: 176

League: ETH

Paladin

Findings Distribution

Researcher Performance

Rank: 58/96

Findings: 1

Award: $19.64

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

QA Report - low risk

Missing check for address(0x0) when assigning value to address state variable


Check for address(0x0) is missing for chestAddress:

WardenPledge.sol: L140

        chestAddress = _chestAddress;


QA Report - non-critical

Typos


WardenPledge.sol: L232

        // so it's override by the Pledge's endTimestamp

Change override to overridden


WardenPledge.sol: L236

        // Calculated the effective Pledge duration

Change Calculated to Calculate


WardenPledge.sol: L261

        // based on the Boost bias & the Boost duration, to take in account that the delegated amount decreases

Change in to into


WardenPledge.sol: L292

    * @param targetVotes Maximum taget of votes to have (own balacne + delegation) for the receiver

Change taget to target and balacne to balance


WardenPledge.sol: L295

    * @param maxTotalRewardAmount Maximum total reward amount allowed ot be pulled by this contract

Change ot to to

The same typo also occurs in the following lines:

WardenPledge.sol: L296

WardenPledge.sol: L365

WardenPledge.sol: L366

WardenPledge.sol: L411

WardenPledge.sol: L412


WardenPledge.sol: L339

        // Add the total reards as available for the Pledge & write Pledge parameters in storage

Change reards to rewards


WardenPledge.sol: L453

    * @param pledgeId ID fo the Pledge

Change fo to for

The same typo also occurs in the following line:

WardenPledge.sol: L485


WardenPledge.sol: L523

    * @param minRewardPerSecond Minmum amount of reward per vote per second for the token

Change Minmum to Minimum

The same typo also occurs in the following lines:

WardenPledge.sol: L539

WardenPledge.sol: L558

WardenPledge.sol: L568


WardenPledge.sol: L621

    * @notice Updates the Platfrom fees BPS ratio

Change Platfrom to Platform

The same typo also occurs in the next line:

WardenPledge.sol: L622


WardenPledge.sol: L650

    * @param token Address tof the EC2O token

Change tof to of



Incomplete @notice

Explanation for event trigger is missing

WardenPledge.sol: L84

    /** @notice Event emitted when xx */

Similarly for the following lines:

WardenPledge.sol: L93

WardenPledge.sol: L95

WardenPledge.sol: L97

WardenPledge.sol: L99

WardenPledge.sol: L101

WardenPledge.sol: L104

WardenPledge.sol: L107

WardenPledge.sol: L109

WardenPledge.sol: L111

WardenPledge.sol: L114

WardenPledge.sol: L118



Missing NatSpec


WardenPledge.sol: L125-136

    /**
    * @dev Creates the contract, set the given base parameters
    * @param _votingEscrow address of the voting token to delegate
    * @param _delegationBoost address of the contract handling delegation
    * @param _minTargetVotes min amount of veToken to target in a Pledge
    */
    constructor(
        address _votingEscrow,
        address _delegationBoost,
        address _chestAddress,
        uint256 _minTargetVotes
    ) {

Missing: @param _chestAddress


WardenPledge.sol: L663-668

    // Utils 

    function safe64(uint256 n) internal pure returns (uint64) {
        if(n > type(uint64).max) revert Errors.NumberExceed64Bits();
        return uint64(n);
    }

Missing @notice, @param n and @return



Duplicate information in @notice and @dev statements


WardenPledge.sol: L148-155

    /**
    * @notice Amount of Pledges listed in this contract
    * @dev Amount of Pledges listed in this contract
    * @return uint256: Amount of Pledges listed in this contract
    */
    function pledgesIndex() public view returns(uint256){
        return pledges.length;
    }

Recommendation: Remove @dev since it contains the same information as @notice.

Similarly for the other @dev and @notice pairs with identical information:

WardenPledge.sol: L158-159

WardenPledge.sol: L168-169

WardenPledge.sol: L189-190

WardenPledge.sol: L200-201

WardenPledge.sol: L288-289

WardenPledge.sol: L536-537

WardenPledge.sol: L565-566

WardenPledge.sol: L581-582

WardenPledge.sol: L595-596

WardenPledge.sol: L608-609

WardenPledge.sol: L621-622

WardenPledge.sol: L648-649


In some cases, the @dev statement contains additional information (i.e., appended to that in @notice):

WardenPledge.sol: L360-367

    /**
    * @notice Extends the Pledge duration
    * @dev Extends the Pledge duration & add rewards for that new duration
    * @param pledgeId ID of the Pledge
    * @param newEndTimestamp New end of the Pledge
    * @param maxTotalRewardAmount Maximum added total reward amount allowed ot be pulled by this contract
    * @param maxFeeAmount Maximum fee amount allowed ot be pulled by this contract
    */

Recommendation: Move the extra information in the @dev statement to the @notice, then remove the @dev, as follows:

    /**
    * @notice Extends the Pledge duration & add rewards for that new duration
    * @param pledgeId ID of the Pledge
    * @param newEndTimestamp New end of the Pledge
    * @param maxTotalRewardAmount Maximum added total reward amount allowed to be pulled by this contract
    * @param maxFeeAmount Maximum fee amount allowed to be pulled by this contract
    */

Similarly for the other @dev and @notice pairs with analogous configuration:

WardenPledge.sol: L407-408

WardenPledge.sol: L451-452

WardenPledge.sol: L483-484



Event is missing indexed fields

Each event should use three indexed fields if there are three or more fields. Below are events with missing indexed fields.


WardenPledge.sol: L85-92

    event NewPledge(
        address creator,
        address receiver,
        address rewardToken,
        uint256 targetVotes,
        uint256 rewardPerVote,
        uint256 endTimestamp
    );

Similarly for the following events:

WardenPledge.sol: L94

WardenPledge.sol: L96

WardenPledge.sol: L98

WardenPledge.sol: L102

WardenPledge.sol: L105



Update sensitive terms in both comments and code

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


WardenPledge.sol: L66

    // Also used to whitelist the tokens for rewards

Suggestion: Change whitelist to allowlist

Similarly for other instances of whitelist and its variants



#0 - c4-judge

2022-11-12T01:00:41Z

kirk-baird marked the issue as grade-b

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