diff --git a/src/test/inspector/Inspector.t.sol b/src/test/inspector/Inspector.t.sol index 4c52c28d3a..4298b79ac8 100644 --- a/src/test/inspector/Inspector.t.sol +++ b/src/test/inspector/Inspector.t.sol @@ -20,7 +20,7 @@ contract Inspector is ExistingDeploymentParser, PrintUtils, ITargetDeployer { Vm cheats = Vm(HEVM_ADDRESS); - bool isUpgraded = false; + bool public isUpgraded = false; uint targetNonce; @@ -64,6 +64,28 @@ contract Inspector is ExistingDeploymentParser, PrintUtils, ITargetDeployer { inspect(t); } + function test_MigrateEigenPod() public { + // Some dude from etherscan hehe + Target t = _target(0xf151FeC20505fAf3E6a7E6AA1654e53e23b42CEE); + inspect(t); + + // Deploy a pod for the user + if (!t.hasEigenPod()) { + t.deployEigenPod(); + inspect(t); + } + + // Send a little ETH to the pod + _fundPod(t.pod()); + inspect(t); + + // Upgrade to m2 + _upgradeMainnet(); + + t.activateRestaking(); + inspect(t); + } + /// Base inspect methods function inspect(address a) internal returns (Target) { @@ -202,6 +224,13 @@ contract Inspector is ExistingDeploymentParser, PrintUtils, ITargetDeployer { _log(""); } + function _fundPod(IEigenPod pod) internal { + address _pod = address(pod); + _log("Minting 1 eth to pod", _pod); + cheats.deal(_pod, 1 ether); + _log(""); + } + function _isEOA(address a) internal view returns (bool b) { assembly { b := iszero(extcodesize(a)) } } diff --git a/src/test/inspector/PrintUtils.t.sol b/src/test/inspector/PrintUtils.t.sol index 1f89842b0a..ae1d9a5f74 100644 --- a/src/test/inspector/PrintUtils.t.sol +++ b/src/test/inspector/PrintUtils.t.sol @@ -38,6 +38,16 @@ contract PrintUtils is Test { )); } + function _logSection(string memory name, address a) internal { + emit log(string.concat( + SECTION_DELIMITER, + name.cyan(), + ": ", + a.yellow().dim(), + SECTION_DELIMITER + )); + } + function _logAction(string memory name, string memory action) internal { emit log_named_string( name.cyan(), diff --git a/src/test/inspector/Target.t.sol b/src/test/inspector/Target.t.sol index fe98ecd56d..771900dde4 100644 --- a/src/test/inspector/Target.t.sol +++ b/src/test/inspector/Target.t.sol @@ -18,6 +18,7 @@ import "src/test/inspector/PrintUtils.t.sol"; interface ITargetDeployer { function whitelistedStrategies() external view returns (StrategyBase[] memory); + function isUpgraded() external view returns (bool); } struct HeldAsset { @@ -81,6 +82,18 @@ contract Target is Test, PrintUtils { } } + function deployEigenPod() public action("deployEigenPod") { + // M2 expects an address return value, M1 does not + // So we call the method directly and don't parse the return + bytes4 selector = eigenPodManager.createPod.selector; + + address(eigenPodManager).call(abi.encodeWithSelector(selector, "")); + } + + function activateRestaking() public action("activateRestaking") { + pod.activateRestaking(); + } + function queueWithdrawals_M1() public action("queueWithdrawals_M1") { for (uint i = 0; i < assets.length; i++) { HeldAsset memory asset = assets[i]; @@ -159,14 +172,16 @@ contract Target is Test, PrintUtils { function logBasicInfo() public { _logHeader(name, address(this)); - address _pod = address(pod); - _logEth("ETH balance", address(this).balance); - // Basic info - EigenPod + // EigenPod info + address _pod = address(pod); + _log("Has EigenPod", _pod != address(0)); if (_pod != address(0)) { - _log("- pod", _pod); + _logSection("EigenPod", _pod); + _logEth("Pod ETH balance", _pod.balance); + _log("Has Restaked", pod.hasRestaked()); } // LST strategy shares and underlying tokens @@ -195,7 +210,7 @@ contract Target is Test, PrintUtils { IStrategyManager.DeprecatedStruct_QueuedWithdrawal memory qw = queuedWithdrawals_M1[i]; bytes32 withdrawalRoot = strategyManager.calculateWithdrawalRoot(qw); - _log("- withdrawalRoot", withdrawalRoot); + _log("withdrawalRoot", withdrawalRoot); _log("- pending", strategyManager.withdrawalRootPending(withdrawalRoot)); _log("- strategy", _stratName(qw.strategies[0])); _log("- shares", qw.shares[0]); @@ -212,7 +227,7 @@ contract Target is Test, PrintUtils { IDelegationManager.Withdrawal memory qw = queuedWithdrawals[i]; bytes32 withdrawalRoot = delegationManager.calculateWithdrawalRoot(qw); - _log("- withdrawalRoot", withdrawalRoot); + _log("withdrawalRoot", withdrawalRoot); _log("- pending", delegationManager.pendingWithdrawals(withdrawalRoot)); _log("- strategy", _stratName(qw.strategies[0])); _log("- shares", qw.shares[0]); @@ -225,9 +240,16 @@ contract Target is Test, PrintUtils { } } + function hasEigenPod() public view returns (bool) { + return address(pod) != address(0); + } + function _updateAssets() internal { - delete assets; + if (eigenPodManager.hasPod(address(this))) { + pod = eigenPodManager.getPod(address(this)); + } + delete assets; for (uint i = 0; i < whitelistedStrategies.length; i++) { StrategyBase strat = whitelistedStrategies[i]; IERC20 underlying = strat.underlyingToken();