28613 - [SC - Medium] User will lose funds
Previous28612 - [SC - Insight] EigenLayers share rate can be massively inflate...Next28623 - [SC - Low] Timelock transaction that consume more then _ g...
Last updated
Was this helpful?
Was this helpful?
for (uint256 i = 0; i < amounts.length; ++i) {
lockedAmount += amounts[i];
}
$.lidoLockedETH += lockedAmount; uint256 ethWithDiscount = _calculateClaimableEther(request, _requestId, _hint);
// because of the stETH rounding issue
// (issue: https://github.com/lidofinance/lido-dao/issues/442 )
// some dust (1-2 wei per request) will be accumulated upon claiming
_setLockedEtherAmount(getLockedEtherAmount() - ethWithDiscount);
_sendValue(_recipient, ethWithDiscount);receive() external payable virtual {
// If we don't use this pattern, somebody can create a Lido withdrawal, claim it to this contract
// Making `$.lidoLockedETH -= msg.value` revert
VaultStorage storage $ = _getPufferVaultStorage();
if ($.isLidoWithdrawal) {
$.lidoLockedETH -= msg.value;
}
}Original:
1000*1000/1000=1000
Expected:
1000*1000/900= 1111function test_poc() public {
stETHMock(address(stETH)).mint(address(this), 2000);
stETH.approve(address(pufferVault), type(uint256).max);
assertEq(pufferVault.deposit(1000, address(this)), 1000, "deposit");
uint256[] memory arr=new uint256[](1);
arr[0]=1000;
// Removed restricted modifier for simplicity
pufferVault.initiateETHWithdrawalsFromLido(arr);
// Lets say due to slashing Lido claim gave 0 amount
// $.lidoLockedETH still remains 1000 wei causing below issue
// Fails since totalAssets still gives 2000 wei (mock lido request withdrawal does not actually transfer steth) even though they were lost due to slashing
// Below gave 500 shares instead of 1000
assertEq(pufferVault.deposit(1000, address(this)), 1000, "deposit");
}