From 64bb4b727b83849a043edd770aef7d1fd5638e2a Mon Sep 17 00:00:00 2001 From: Maurelian Date: Tue, 31 Dec 2024 14:06:49 -0500 Subject: [PATCH] prank delegatecall bug demo --- .../contracts-bedrock/test/setup/ForkLive.s.sol | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/contracts-bedrock/test/setup/ForkLive.s.sol b/packages/contracts-bedrock/test/setup/ForkLive.s.sol index a0e47b364d7f0..3751af9bed82d 100644 --- a/packages/contracts-bedrock/test/setup/ForkLive.s.sol +++ b/packages/contracts-bedrock/test/setup/ForkLive.s.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import { console } from "forge-std/console.sol"; // Testing import { stdJson } from "forge-std/StdJson.sol"; @@ -132,6 +133,7 @@ contract ForkLive is Deployer { IProxyAdmin proxyAdmin = IProxyAdmin(EIP1967Helper.getAdmin(address(systemConfig))); address upgrader = proxyAdmin.owner(); + vm.label(upgrader, "ProxyAdmin Owner"); ISystemConfig[] memory systemConfigs = new ISystemConfig[](1); systemConfigs[0] = systemConfig; @@ -139,10 +141,17 @@ contract ForkLive is Deployer { proxyAdmins[0] = proxyAdmin; // TODO: Add support for this prank() call to forge-std - (bool success,) = address(vm).call(abi.encodeWithSignature("prank(address,bool)", upgrader, true)); + console.log("delegatecall with prank"); + (bool success,) = address(vm).call(abi.encodeWithSignature("prank(address,bool)", address(this), true)); require(success, "ForkLive: Failed to prank"); - (success,) = address(opcm).delegatecall(abi.encodeCall(OPContractsManager.upgrade, (systemConfigs, proxyAdmins))); + (success,) = + address(opcm).delegatecall(abi.encodeCall(OPContractsManager.upgrade, (systemConfigs, proxyAdmins))); + require(success, "ForkLive: Upgrade failed"); + + console.log("delegatecall without prank"); + (success,) = + address(opcm).delegatecall(abi.encodeCall(OPContractsManager.upgrade, (systemConfigs, proxyAdmins))); require(success, "ForkLive: Upgrade failed"); }