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

ReseedBean doesn't work because implementation addresses are not initialized

Summary

Here you can see that addresses are not initialized:

address internal constant AQUIFIER = address(0);
address internal constant CP2_U_BEAN_ETH_WELL_IMPLMENTATION = address(0);
address internal constant CP2_U_BEAN_WSTETH_WELL_IMPLMENTATION = address(0);
address internal constant SS_U_BEAN_STABLE_WELL_IMPLMENTATION = address(0);

Therefore using them as implementation will result in revert during ERC1967Proxy deploy because of codesize check:

function deployBeanEthWell(
BeanstalkERC20 bean,
WellAmountData calldata beanEth
) internal returns (IWell) {
address beanEthWell = address(
new ERC1967Proxy{salt: BEAN_ETH_SALT}(
@> CP2_U_BEAN_ETH_WELL_IMPLMENTATION,
abi.encodeCall(IWellUpgradeable.init, (BEAN_ETH_NAME, BEAN_ETH_SYMBOL, OWNER))
)
);
...
}
function _setImplementation(address newImplementation) private {
@> if (newImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(newImplementation);
}
StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
}

Impact

ReseedBean always reverts during migration

Tools Used

Manual Review

Recommendations

Deploy implementation during reseed instead of setting zero address.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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