Within the LibVault#removeZeth()
, the fee
would not be subtracted from the s.vault[vault].zethTotal
.
This lead to misaccounting of the s.vault[vault].zethTotal
.
When a user withdraw their LST (stETH or rETH), the user call the BridgeRouterFacet#withdraw()
. At that time, the user have to pay the withdrawal fee.
Within the BridgeRouterFacet#withdraw()
, the LibVault#removeZeth()
would be called with the fee
like this:
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/BridgeRouterFacet.sol#L111
Within the LibVault#removeZeth()
,
amount + fee
would be subtracted from the s.vaultUser[vault][msg.sender].ethEscrowed
amount
would be subtracted from the s.vault[vault].zethTotal
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/libraries/LibVault.sol#L28-L29
However, within the LibVault#removeZeth()
above, the fee
would not be subtracted from the s.vault[vault].zethTotal
.
This lead to misaccounting of the s.vault[vault].zethTotal
.
Due to lack of subtraction of the fee
, s.vault[vault].zethTotal
would be misaccounted.
Foundry
Within the LibVault#removeZeth()
, consider subtracting amount + fee
from the s.vault[vault].zethTotal
like this:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.