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
Rank: 45/54
Findings: 1
Award: $5.43
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: thekmj
Also found by: 0x3b, 33BYTEZZZ, Bauchibred, Chom, Dravee, J4X, Limbooo, Maroutis, MiloTruck, MrPotatoMagic, SBSecurity, Sathish9098, Tadev, ZanyBonzy, adam-idarrha, adriro, btk, hyh, lukejohn, nmirchev8, peakbolt, radev_sw, rvierdiiev
5.4311 USDC - $5.43
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.
Low: Funds sent directly to the proxy contract will be stuck and used only for voting.
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
using Address for address
Address library from OZ util package is not used, so it could be removedMath.min()
could save gas._getBalanceForDelegate()
) to clearly distinguish them from externally accessible functions.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.low is dup of https://github.com/code-423n4/2023-10-ens-findings/issues/62
#2 - c4-judge
2023-10-24T16:09:54Z
hansfriese marked the issue as grade-b