DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: high
Valid

Internal balances are never actually migrated within `L2ContractMigrationFacet`

Summary

L2ContractMigrationFacet never migrates internal balances.

Vulnerability Details

L2ContractMigrationFacet#redeemDepositsAndInternalBalances should ideally migrate both user's deposits and internal balances. The user inputs both of them and they're used in the merkle leaf

function redeemDepositsAndInternalBalances(
address owner,
address reciever,
AccountDepositData[] calldata deposits,
AccountInternalBalance[] calldata internalBalances,
uint256 ownerRoots,
bytes32[] calldata proof,
uint256 deadline,
bytes calldata signature
) external payable fundsSafu noSupplyChange nonReentrant {
// verify deposits are valid.
// note: if the number of contracts that own deposits is small,
// deposits can be stored in bytecode rather than relying on a merkle tree.
verifyDepositsAndInternalBalances(owner, deposits, internalBalances, ownerRoots, proof);
// signature verification.
verifySignature(owner, reciever, deadline, signature);
// set deposits for `reciever`.
uint256 accountStalk;
for (uint256 i; i < deposits.length; i++) {
accountStalk += addMigratedDepositsToAccount(reciever, deposits[i]);
}
// set stalk for account.
setStalk(reciever, accountStalk, ownerRoots);
}

However, the internal balances are actually never credited.

Impact

Loss of internal balances

Tools Used

Manual review

Recommendations

Migrate the internal balances

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

deadrosesxyz Submitter
about 1 year ago
giovannidisiena Auditor
about 1 year ago
giovannidisiena Auditor
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Internal balances not migrated

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.