The redeemDepositsAndInternalBalances
function in the L2ContractMigrationFacet
contract is designed to facilitate the migration of deposits and internal balances from an L1 address to an L2 address. However, the function has an issue with incorrect state updates in the addMigratedDepositsToAccount
function, leading to potential inaccuracies in the system's accounting of deposited amounts.
The addMigratedDepositsToAccount
function is responsible for adding migrated deposits to a user's account and updating the global state. The function updates the global state variables s.sys.silo.balances[depositData.token].deposited
and s.sys.silo.balances[depositData.token].depositedBdv
outside the loop that processes each deposit. However, the values of totalDeposited
and totalDepositedBdv
are not correctly aggregated within the loop (just declared before the loop), resulting in incorrect state updates.
See the following code:
Incorrect aggregation of totalDeposited
and totalDepositedBdv` within the loop can lead to inaccurate accounting of the total deposited amounts. This discrepancy can affect the integrity of the overall system and lead to potential financial inaccuracies, undermining the reliability and trustworthiness of the migration process.
Manual Review
To address the issue of incorrect state updates, the function should correctly aggregate the values of totalDeposited
and totalDepositedBdv
within the loop that processes each deposit. This ensures accurate accounting of the deposited amounts.
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.