BeanL1RecieverFacet#recieveL1Beans()
will never work due to the hardcoded value of EXTERNAL_L1_BEANS
as 0
which causes the attempt to claim these after the burning on L1 of the tokens to always get reverted here.
Take a look at https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/8c8710df547f7d7c5dd82c5381eb6b34532e4484/protocol/contracts/beanstalk/migration/BeanL1RecieverFacet.sol#L31-L44
This function is used when attempting to migrate any amount
of Beans to L2, i.e it's called in the instance below where the amount of beans are minted to the receiver, https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/8c8710df547f7d7c5dd82c5381eb6b34532e4484/protocol/contracts/beanstalk/migration/BeanL2MigrationFacet.sol#L43-L57
Issue however is the check require(EXTERNAL_L1_BEANS >= s.sys.migration.migratedL1Beans)
would always revert in recieveL1Beans()
because EXTERNAL_L1_BEANS
has been erroneously hardcoded to 0
, see https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/8c8710df547f7d7c5dd82c5381eb6b34532e4484/protocol/contracts/beanstalk/migration/BeanL1RecieverFacet.sol#L22
Which would then mean that for any valid amount
being passed to migrate the migration always fails with the "L2Migration: exceeds maximum migrated"
error since the maximum migrated is being set as 0
.
High, considering when migrating the tokens gets burnt from the user and then the message is sent to the L2Bridge with the amount of assets to give to the user, but since the attempt to claim these tokens always gets reverted here, users have lost their Beans.
Manual review
Consider attaching a valid value to EXTERNAL_L1_BEANS
, if users can still get more external tokens after the initial migration then this value should be updatable and a logic to update this can be attached to the message that gets sent when migration of Beans is to occur.
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.