When a user deposits an amount significantly larger than 32 ETH, the system still only deducts the fee equivalent to what would be deducted for 32 ETH. This creates an imbalance where the system may not be collecting sufficient fees proportional to the amount being processed. This could potentially lead to revenue loss for the system if the cost of handling larger transactions (like security, operational costs) scales with the transaction size.
Lets recalculate the fee using the correct bridgeFeeShare of 0.05% for a 1000 ETH deposit, based on your specifications:
Lets assume,
sweepBatchSize = 32 ETH
bridgeFeeShare = 5 (which equates to 0.05% fee since FEE_BASIS is 10000)
FEE_BASIS = 10000
_amountIn = 1000 ETH
As per implementation
Fee = (32 ETH * 5) / 10000 = 160 / 10000 = 0.016 ETH - > 0.0016%
As per original deposit
Fee = (1000 ETH * 5) / 10000 = 5000 / 10000 = 0.5 ETH - > 0.05%
Loss to Protocol = Fee using proportional mechanism - Fee using current mechanism
Loss to Protocol = 0.5 ETH - 0.016 ETH = 0.484 ETH
Its very huge lose to protocol and This breaks the 0.05% fee invariants.
https://github.com/code-423n4/2024-04-renzo/blob/519e518f2d8dec9acf6482b84a181e403070d22d/contracts/Bridge/L2/xRenzoDeposit.sol#L273C4-L284
Implement the 0.05% percent invariant for all deposits.
