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: 26/54
Findings: 1
Award: $55.85
🌟 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
55.8454 USDC - $55.85
assert
Function Misuseassert
is intended to validate invariants.Utilizing assert
in Solidity, especially versions prior to 0.8.0, can lead to unintended consequences regarding gas usage. In versions before 0.8.0, a failed assert
consumes all remaining gas in a transaction. From 0.8.0 onwards, while it doesn’t consume all remaining gas, it does consume a specific amount, designed to discourage its use. The Solidity documentation underscores that a failed assert
typically indicates a contract bug, as it should not be triggered during normal operation or through external inputs.
There is 1 instance of this issue: https://github.com/code-423n4/2023-10-ens/blob/ed25379c06e42c8218eb1e80e141412496950685/contracts/ERC20MultiDelegate.sol#L131
The Solidity assert() function is meant to assert invariants. Properly functioning code should never reach a failing assert statement. However, it is clear that in this case, a simple user input mistake can lead to a failing assert.
require
instead of assert
for checks that aren’t validating invariants, and ensure to provide clear error messages to facilitate debugging.delegateMulti
function gets permanently stuckThe proxy contract is designed to work with ERC20Votes
tokens sent using the delegateMulti
, but it doesn’t prevent any additionnal tokens or any other types of tokens from being sent to it. If a user mistakenly sends tokens to the contract, they could become stuck with no mechanism in place to retrieve them.
Example: If a user mistakenly sends standard tokens to the contract, they might expect similar functionality or the ability to retrieve them, which is not supported in the current implementation.
ERC20MultiDelegate
contract owner to retrieve any additional tokens sent to the proxies contracts mistakenly. The additionnal tokens are easily identifiable since they do not have a ERC1155 counterparty. The owner can then transfer the additionnal tokens to the corresponding owners.false
instead of reverting on failure, can lead to unexpected contract behavior if calls to transferFrom
are not properly checked. Equivalent tokens that implement the ERC20Votes can have the exact behaviors.false
return value could expose the contract to logical errors between the value of ERC1155 tokens minted and the actual tokens sent to the proxy.transferFrom
function of a token that returns false
on failure (e.g., ZRX, EURS).transferFrom
, assuming it will revert on failure.transferFrom
and revert or handle failure as needed in https://github.com/code-423n4/2023-10-ens/blob/ed25379c06e42c8218eb1e80e141412496950685/contracts/ERC20MultiDelegate.sol#L148SafeERC20
library, which converts return values to reverts to ensure consistency.ERC20ProxyDelegator
contract is expecting the maximum approved value to be reflected in the allowances mapping.approve
or transfer
with a value larger than uint96
on tokens like UNI or COMP.This is more of a specific issue. A user wishes to create a proxy contract without sending any tokens. He wants to send tokens later on.
#0 - 141345
2023-10-13T13:14:39Z
Any token sent without using the delegateMulti function gets permanently stuck is dup of https://github.com/code-423n4/2023-10-ens-findings/issues/62
Tokens Not Reverting on Failure is dup of https://github.com/code-423n4/2023-10-ens-findings/issues/91
Revert on Large Approvals & Transfers is dup of https://github.com/code-423n4/2023-10-ens-findings/issues/239
#1 - c4-pre-sort
2023-10-13T13:15:57Z
141345 marked the issue as sufficient quality report
#2 - c4-judge
2023-10-24T15:46:43Z
hansfriese marked the issue as grade-a