feat: AVS upgrade for correct reporting on Eigenlayer UI (#4152)

### Description

- upgraded the AVS on holesky - now working splendidly!
- included the function call for upgrading the AVS on mainnet
`upgradeHsm4090`
- encoded calldata to `0x9e3045a8Feb10F05f4d1268Ef8E303b655e8F562` is
`0x99a88ec4000000000000000000000000e8e59c6c8b56f2c178f63bcfc4ce5e5e2359c8fc0000000000000000000000009e3045a8feb10f05f4d1268ef8e303b655e8f562
`
- make the call `forge script script/avs/DeployAVS.s.sol:DeployAVS --sig
"upgradeHsm4090(string memory,address,address)" "ethereum"
0xe8E59c6C8B56F2c178f63BCFC4ce5e5e2359c8fc
0x272CF0BB70D3B4f79414E0823B426d2EaFd48910 --rpc-url
https://rpc.ankr.com/eth -vvvv --sender
0x3965AC3D295641E452E0ea896a086A9cD7C6C5b6` to repro
    

### Drive-by changes

Found two issues with forge scripting 
- upgrade call wasn't working with a pranked sender but the equivalent
low-level call worked
- once you call `vm.expectRevert()` the script terminates.

### Related issues

- fixes https://github.com/hyperlane-xyz/issues/issues/1297

### Backward compatibility

Yes

### Testing

Fork run of upgrade

---------

Co-authored-by: Yorke Rhodes <yorke@hyperlane.xyz>
pull/4219/head
Kunal Arora 4 months ago committed by GitHub
parent b643fba90a
commit 968160f4e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 58
      solidity/script/avs/DeployAVS.s.sol

@ -10,6 +10,7 @@ import {IDelegationManager} from "../../contracts/interfaces/avs/vendored/IDeleg
import {ProxyAdmin} from "../../contracts/upgrade/ProxyAdmin.sol";
import {TransparentUpgradeableProxy} from "../../contracts/upgrade/TransparentUpgradeableProxy.sol";
import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {ECDSAStakeRegistry} from "../../contracts/avs/ECDSAStakeRegistry.sol";
import {Quorum, StrategyParams} from "../../contracts/interfaces/avs/vendored/IECDSAStakeRegistryEventsAndErrors.sol";
import {ECDSAServiceManagerBase} from "../../contracts/avs/ECDSAServiceManagerBase.sol";
@ -35,6 +36,8 @@ contract DeployAVS is Script {
Quorum quorum;
uint256 thresholdWeight = 6667;
address KILN_OPERATOR_ADDRESS = 0x1f8C8b1d78d01bCc42ebdd34Fae60181bD697662;
function _loadEigenlayerAddresses(string memory targetEnv) internal {
string memory root = vm.projectRoot();
string memory path = string.concat(
@ -168,4 +171,59 @@ contract DeployAVS is Script {
vm.stopBroadcast();
}
// upgrade for https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/4090
function upgradeHsm4090(
string memory network,
address hsmProxy,
address stakeRegistryProxy
) external {
deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
_loadEigenlayerAddresses(network);
vm.startBroadcast(deployerPrivateKey);
// check original behavior
HyperlaneServiceManager hsm = HyperlaneServiceManager(hsmProxy);
address[] memory strategies = hsm.getOperatorRestakedStrategies(
KILN_OPERATOR_ADDRESS
);
require(strategies.length > 0, "No strategies found for operator"); // actual length is 13
// for (uint256 i = 0; i < strategies.length; i++) {
// vm.expectRevert(); // all strategies are expected to be 0x0..0
// require(strategies[i] != address(0), "Strategy address is 0");
// }
HyperlaneServiceManager strategyManagerImpl = new HyperlaneServiceManager(
address(avsDirectory),
stakeRegistryProxy,
address(paymentCoordinator),
address(delegationManager)
);
console.log("Deployed new impl at", address(strategyManagerImpl));
bytes memory encodedUpgradeCalldata = abi.encodeCall(
ProxyAdmin.upgrade,
(
ITransparentUpgradeableProxy(payable(hsmProxy)),
address(strategyManagerImpl)
)
);
console.log("Encoded upgrade call: ");
console.logBytes(encodedUpgradeCalldata);
vm.stopBroadcast();
// only meant for simulating the call on mainnet as the actual caller needs to the gnosis safe
address(proxyAdmin).call(encodedUpgradeCalldata);
// check upgraded behavior
strategies = hsm.getOperatorRestakedStrategies(KILN_OPERATOR_ADDRESS);
require(strategies.length > 0, "No strategies found for operator"); // actual length is 13
for (uint256 i = 0; i < strategies.length; i++) {
require(strategies[i] != address(0), "Strategy address is 0");
}
}
}

Loading…
Cancel
Save