DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: low
Invalid

migrateL2Beans always fails because the msg.value as gas is not forwarded to Base bridge

Line of code

https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/df2dd129a878d16d4adc75049179ac0029d9a96b/protocol/contracts/beanstalk/migration/BeanL2MigrationFacet.sol#L52

Summary

migrateL2Beans will always fail because there is no value forwarded to the base bridge to pay the fee.

Vulnerability Details

When bridging to base we must sent a small amount of ether with the transaction in order to pay for the fee of bridging to L2.
The problem occurs because currently migrateL2Beans does not allow the user to pay the fee because it is not payable and will not forward the msg.value

function migrateL2Beans(
address reciever,
address L2Beanstalk,
uint256 amount,
uint32 gasLimit
) external nonReentrant {
C.bean().burnFrom(msg.sender, amount);
// send data to
IL2Bridge(BRIDGE).sendMessage(
L2Beanstalk,
abi.encodeCall(IBeanL1RecieverFacet(L2Beanstalk).recieveL1Beans, (reciever, amount)),
gasLimit
);
}

as we can see from the snippet above, there is currently no value being sent when calling sendMessage this will cause the fee to not be paid, and ultimately will fail.

Impact

The bridging of beans will not be possible as the call to the bridge will fail because it does not forward along any eth to pay the fee. It will not be possible to migrate beans, the functionality of the protocol is dosed.

Tools Used

Manual review

Recommendations

Make the function payable and forward along the msg.value in order for the fee to be paid.

IL2Bridge(BRIDGE).sendMessage{value: msg.value}(
L2Beanstalk,
abi.encodeCall(IBeanL1RecieverFacet(L2Beanstalk).recieveL1Beans, (reciever, amount)),
gasLimit
);
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Beans migration is not possible due to missing gas fee

Support

FAQs

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