In my contract, I have the following:
try
PluginUUPSUpgradeable(_proxy).upgradeToAndCall(_implementation, _initData)
{} catch Error(string memory reason) {
revert(reason);
} catch (
bytes memory /*lowLevelData*/
) {
revert PluginProxyUpgradeFailed({
proxy: _proxy,
implementation: _implementation,
initData: _initData
});
}
Problem with the above is if on the _proxy
, fallback function exists, but not upgradeToAndCall
, this will still succeed and I will be left with the wrong state. I wanted to hear OZ's idea how you approach this ?
Do I need to make implementation
function public in the proxy
and then after try catch, maybe I should check:
require(_proxy.implementation() == _newimplementation);
Thoughts?