As the fee decreases, the yield to the protocol decreases. Although this value is small, if it is accumulated, the amount will become very large.
Proof of Concept
When user deposit underlying assets, he calls PricipalToken.sol#deposit function.
The PricipalToken.sol#deposit function calls the PricipalToken.sol#_depositIBT function.
Also the PricipalToken.sol#_depositIBT function calls PrincipalTokenUtil.sol#_computeTokenizationFee function.
Rounding error occurs in the PrincipalTokenUtil.sol#_computeTokenizationFee function.
PrincipalTokenUtil.sol#_computeTokenizationFee function is as follows.
Finally PrincipalToken.sol#claimYield function uses accumulated uclaimedFeesInIBT and this protocol gains yield.
PrincipalToken.sol#claimYield function is as follows.
function claimYield(address _receiver) public override returns (uint256 yieldInAsset) {
uint256 yieldInIBT = _claimYield();
if (yieldInIBT != 0) {
yieldInAsset = IERC4626(ibt).redeem(yieldInIBT, _receiver, address(this));
}
}
Therefore the smaller tokenizationFee, the smaller the yield to the protocol.
Tools Used
Manual Review
Recommended Mitigation Steps
PrincipalTokenUtil.sol#_computeTokenizationFee function is as follows.
Lines of code
https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L176-L185 https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L750-L769 https://github.com/code-423n4/2024-02-spectra/blob/main/src/libraries/PrincipalTokenUtil.sol#L157-L170
Vulnerability details
Impact
As the fee decreases, the yield to the protocol decreases. Although this value is small, if it is accumulated, the amount will become very large.
Proof of Concept
When user deposit underlying assets, he calls
PricipalToken.sol#deposit
function. ThePricipalToken.sol#deposit
function calls thePricipalToken.sol#_depositIBT
function. Also thePricipalToken.sol#_depositIBT
function callsPrincipalTokenUtil.sol#_computeTokenizationFee
function. Rounding error occurs in thePrincipalTokenUtil.sol#_computeTokenizationFee
function.PrincipalTokenUtil.sol#_computeTokenizationFee
function is as follows.And
PricipalToken.sol#_depositIBT
function is as follows.Also
Pricipaltoken.sol#_updateFees
function is as follows.Finally
PrincipalToken.sol#claimYield
function uses accumulateduclaimedFeesInIBT
and this protocol gains yield.PrincipalToken.sol#claimYield
function is as follows.Therefore the smaller
tokenizationFee
, the smaller the yield to the protocol.Tools Used
Manual Review
Recommended Mitigation Steps
PrincipalTokenUtil.sol#_computeTokenizationFee
function is as follows.This function Modifies as follows.
Assessed type
Math