Popcorn contest - Dewaxindo's results

A multi-chain regenerative yield-optimizing protocol.

General Information

Platform: Code4rena

Start Date: 31/01/2023

Pot Size: $90,500 USDC

Total HM: 47

Participants: 169

Period: 7 days

Judge: LSDan

Total Solo HM: 9

Id: 211

League: ETH

Popcorn

Findings Distribution

Researcher Performance

Rank: 72/169

Findings: 2

Award: $105.30

QA:
grade-b
Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lack of Input Validation

For defense-in-depth purposes, it is recommended to perform additional validation against the amount the user is attempting to deposit, mint, withdraw and redeem to ensure that the submitted amount is valid.

OpenZeppelinTokenizedVault.sol#L95

1. Function deposit()

Vault.sol#L134-L158

 function deposit(uint256 assets, address receiver)
        public
        nonReentrant
        whenNotPaused
        syncFeeCheckpoint
        returns (uint256 shares)
    {
       require(assets <= maxDeposit(receiver), "deposit more than max");

2. Function mint()

Vault.sol#L170-L198

 function mint(uint256 shares, address receiver)
        public
        nonReentrant
        whenNotPaused
        syncFeeCheckpoint
        returns (uint256 assets)
    {
        require(shares <= maxMint(receiver), "mint more than max");

3. Function withdraw()

Vault.sol#L211-L240

 function withdraw(
        uint256 assets,
        address receiver,
        address owner
    ) public nonReentrant syncFeeCheckpoint returns (uint256 shares) {
        require(assets <= maxWithdraw(owner), "withdraw more than max");

4. Function redeem()

Vault.sol#L253-L278

function redeem(
        uint256 shares,
        address receiver,
        address owner
    ) public nonReentrant returns (uint256 assets) {
        require(shares <= maxRedeem(owner), "redeem more than max");

5. Function deposit()

AdapterBase.sol#L110-L122

 function deposit(uint256 assets, address receiver)
        public
        virtual
        override
        returns (uint256)
    {
       require(assets <= maxDeposit(receiver), "deposit more than max");

6. Function mint()

AdapterBase.sol#L129-L141

 function mint(uint256 shares, address receiver)
        public
        virtual
        override
        returns (uint256)
    {
        require(shares <= maxMint(receiver), "mint more than max");

7. Function withdraw()

AdapterBase.sol#L173-L185

function withdraw(
        uint256 assets,
        address receiver,
        address owner
    ) public virtual override returns (uint256) {
        require(assets <= maxWithdraw(owner), "withdraw more than max");

8. Function redeem()

AdapterBase.sol#L193-L204

function redeem(
        uint256 shares,
        address receiver,
        address owner
    ) public virtual override returns (uint256) {
        require(shares <= maxRedeem(owner), "redeem more than max");
<br>

Critical Address Changes Should Use Two-Step Procedure

Context

Vault.sol#L553-L559

function setFeeRecipient(address _feeRecipient) external onlyOwner {
        if (_feeRecipient == address(0)) revert InvalidFeeRecipient();

        emit FeeRecipientUpdated(feeRecipient, _feeRecipient);

        feeRecipient = _feeRecipient;
    }

Recommendation

Lack of two-step procedure for critical operations leaves them error-prone. Consider adding two step procedure on the critical functions.

<br>

USE OWNABLE2STEPUPGRADEABLE INSTEAD OF OWNABLEUPGRADEABLE CONTRACT

Context

Recommendation

acceptOwnership function is used to accept Ownership from OwnableUpgradeable.sol.

There is another Openzeppelin Ownable contract (Ownable2StepUpgradeable.sol) has acceptOwnership function , use it is more secure due to 2-stage ownership transfer.

Ownable2StepUpgradeable.sol

#0 - c4-judge

2023-02-28T14:59:25Z

dmvt marked the issue as grade-b

Awards

69.8247 USDC - $69.82

Labels

bug
G (Gas Optimization)
grade-b
G-15

External Links

#0 - c4-judge

2023-02-28T14:51:10Z

dmvt 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