Badger Citadel contest - Picodes's results

Bringing BTC to DeFi

General Information

Platform: Code4rena

Start Date: 14/04/2022

Pot Size: $75,000 USDC

Total HM: 8

Participants: 72

Period: 7 days

Judge: Jack the Pug

Total Solo HM: 2

Id: 110

League: ETH

BadgerDAO

Findings Distribution

Researcher Performance

Rank: 57/72

Findings: 1

Award: $91.39

🌟 Selected for report: 0

šŸš€ Solo Findings: 0

L-01 - Add constructor with initializer in upgradeable contracts

Description

All upgradeable contracts of the repo should implement a void constructor to call the initialized flag to true in the implementation.

Citing other audit reports: "As perĀ OpenZeppelin’s (OZ) recommendation, ā€œThe guidelines are now to make it impossible forĀ anyoneĀ to runĀ initializeĀ on an implementation contract, by adding an empty constructor with theĀ initializerĀ modifier. So the implementation contract gets initialized automatically upon deployment.ā€ Furthermore,Ā this thwarts any attempts to frontrun theĀ initialization tx of the implementation contract. Incorporating this change would require inheriting theĀ InitializableĀ contract instead of having an explicitĀ initializedĀ variable."

Recommended Mitigation Steps

Implementation contracts should inherit OZ’sĀ InitializableĀ contract and have the following constructor method:

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract A is 
    Initializable
    ...
{
    ...
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {
        // so that users won't accidentally send JPYC to the implementation contract
        blocklisted[address(this)] = true;
    }
}

L-02 - Useless variable in Global Access Control

Variable transferFromDisabled is not used in the code and should be removed from the contract.

https://github.com/code-423n4/2022-04-badger-citadel/blob/18f8c392b6fc303fe95602eba6303725023e53da/src/GlobalAccessControl.sol#L51

NC-01 - Token could implement EIP-2612

For integration purposes and UX experience, team should consider implementing https://eips.ethereum.org/EIPS/eip-2612 for its ERC-20 token, especially CitadelToken

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