A vault can have duplicates of the same bridge leading to possible incorrect yield calculations.
The createBridge function in OwnerFacet.sol does not check if a bridge has already been added to a vault allowing duplicates in the vault's vaultBridges array.
In LibVault.sol, the getZethTotal gets the total amount of zeth from all bridges for a vault. The function loops over the vaultBridges array for the vault and adds the zeth value from each bridge to the zethTotal amount.
If the vaultBridges array contains duplicates of the same bridge then the returned amount of getZethTotal could be incorrect if the bridge has any zeth. Since updateYield relies on the zethTotal amount, the yield would be more than it should affecting the TAPP's ethEscrowed, vault's zethYieldRate and zethCollateralRewards values.
Additionaly, the getZethTotal function is also used in the _ethConversion function in BridgeRouterFacet.sol which, if the yield was not updated, could return incorrect amounts to the withdraw, unstakeEth and withdrawTapp function leading to users getting more than they should.
When trying to delete a bridge that is duplicated, only the first occurence is removed and no other duplicates can be removed since the vault corresponding the the bridge address is deleted after removing the first duplicate. The deleteBridge function does not allow removal of a bridge with no vault linked to it.
If the owner manages to push a duplicate bridge to a vault, the protocol would suffer major accounting issues which could lead to loss of funds and potentially break the functionality of the protocol since the bridge cannot be removed from the vault.
Manual review
Do not allow duplicates in the vaultBridges array for a vault by checking the bridges vault address is 0.
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.