Platform: Code4rena
Start Date: 23/02/2024
Pot Size: $36,500 USDC
Total HM: 2
Participants: 39
Period: 7 days
Judge: Dravee
Id: 338
League: ETH
Rank: 28/39
Findings: 1
Award: $53.72
🌟 Selected for report: 0
🚀 Solo Findings: 0
53.7155 USDC - $53.72
https://github.com/code-423n4/2024-02-spectra/blob/b35bbf78ad9d0e74e9c8450a0c5c6d35b68f7228/src/tokens/PrincipalToken.sol#L460-L462 https://github.com/code-423n4/2024-02-spectra/blob/b35bbf78ad9d0e74e9c8450a0c5c6d35b68f7228/src/tokens/PrincipalToken.sol#L483-L485
PrincipalToken.sol
does not comply with ERC5095 standard. This may DoS or return unexpected values for users that interact with the contract where users expect the contract to follow ERC5095 rules.
Two functions that do not comply with ERC5095 rules:
maxWithdraw(address)
functionfunction maxWithdraw(address owner) public view override whenNotPaused returns (uint256) { return convertToUnderlying(_maxBurnable(owner)); }
According to ERC5095
maxWithdraw
MUST factor in both global and user-specific limits, like if withdrawals are entirely disabled (even temporarily) it MUST return 0.
maxWithdraw
function in PrincipalToken
contract reverts when paused, but it has to return 0.
maxRedeem(address)
functionfunction maxRedeem(address owner) public view override returns (uint256) { return _maxBurnable(owner); }
According to ERC5095
maxRedeem
MUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.
maxRedeem
function in PrincipalToken
contract does not check if the contract is paused, but the function has to return 0 if the PrincipalToken
is paused
Manual Review
Make sure maxRedeem
and maxWithdraw
comply with ERC5095 rules.
Below are my suggestions to the maxWithdraw
and maxRedeem
functions
maxWithdraw
:
function maxWithdraw(address owner) public view override returns (uint256) { return paused() ? 0 : convertToUnderlying(_maxBurnable(owner)); }
maxRedeem
:
function maxRedeem(address owner) public view override returns (uint256) { return paused() ? 0 : _maxBurnable(owner); }
Other
#0 - c4-pre-sort
2024-03-03T09:20:22Z
gzeon-c4 marked the issue as duplicate of #33
#1 - c4-pre-sort
2024-03-03T09:20:25Z
gzeon-c4 marked the issue as sufficient quality report
#2 - c4-judge
2024-03-11T00:33:22Z
JustDravee marked the issue as partial-50
#3 - c4-judge
2024-03-11T00:33:26Z
JustDravee marked the issue as satisfactory
#4 - c4-judge
2024-03-14T06:18:42Z
JustDravee marked the issue as partial-50