ENS - nmirchev8's results

Decentralized naming for wallets, websites, & more.

General Information

Platform: Code4rena

Start Date: 05/10/2023

Pot Size: $33,050 USDC

Total HM: 1

Participants: 54

Period: 6 days

Judge: hansfriese

Id: 294

League: ETH

ENS

Findings Distribution

Researcher Performance

Rank: 45/54

Findings: 1

Award: $5.43

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

5.4311 USDC - $5.43

Labels

bug
grade-b
QA (Quality Assurance)
sufficient quality report
edited-by-warden
Q-05

External Links

QA Analysis

Low Vulnerabilities

  1. Low: The emit DelegationProcessed(source, target, amount) event could be spammed if the provided amount is set to 0. Consider implementing a threshold or additional checks to prevent spamming.

  2. Low: Funds sent directly to the proxy contract will be stuck and used only for voting.

  3. Low: Best practices suggest checking addresses for address(0) as the current implementation allows delegating funds to/from address(0)(if inside the target array there are address(0)s), which will only lock delegators' funds and lead to useless ERC1155 accounting, as the result of balances[address(0)][delegator] may arrise, but address votesOf(address(0)) will remain 0

Analysis

  • using Address for address Address library from OZ util package is not used, so it could be removed
  • Caching Math.min() could save gas.
  • Consider marking private/internal functions with a prefix like "_" (e.g., _getBalanceForDelegate()) to clearly distinguish them from externally accessible functions.

Test File Feedback

  • Optimization: The code for delegate multi-calls could be extracted into a fixture as it is used in multiple tests to avoid redundancy and improve code maintainability. Example:

    const delegatorTokenAmount = await token.balanceOf(deployer);
    const delegates = [deployer, alice];
    const amounts = delegates.map(() => delegatorTokenAmount.div(delegates.length));
    
    // ... rest of the code ...
  • Inaccurate Test Name: The test named it('should be able to delegate to already delegated delegates') doesn't perform the behavior described. Only deployer has funds to delegate and all other tests of different delegators are irrelevant to real world scenarios. To simulate the intended behavior, assets should be transferred to the secondDelegator in the beforeEach section:

    const [dep, second] = await ethers.getSigners();
    const halfBalance = mintAmount.div(2);
    await token.transfer(second.address, halfBalance);

#0 - c4-pre-sort

2023-10-13T12:47:21Z

141345 marked the issue as sufficient quality report

#1 - 141345

2023-10-13T12:47:50Z

#2 - c4-judge

2023-10-24T16:09:54Z

hansfriese 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