diff --git a/deployments/ynETH-17000.json b/deployments/ynETH-17000.json index 5d17373c0..758ec78ca 100644 --- a/deployments/ynETH-17000.json +++ b/deployments/ynETH-17000.json @@ -11,8 +11,8 @@ "STAKING_NODES_OPERATOR": "0x9Dd8F69b62ddFd990241530F47dcEd0Dad7f7d39", "STAKING_NODE_CREATOR": "0x9Dd8F69b62ddFd990241530F47dcEd0Dad7f7d39", "VALIDATOR_MANAGER": "0x9Dd8F69b62ddFd990241530F47dcEd0Dad7f7d39", - "implementation-stakingNodesManager": "0x104f0c5156BC0D9Cbda3f30d1B74F42b5610A2dF", - "implementation-ynETH": "0x0E60A5db38c545ced3d3480B6768811cc603649A", + "implementation-stakingNodesManager": "0xC9cf6740282617f3B392f900De0449E687Ce05e3", + "implementation-ynETH": "0x090D67d3C97712f6C17a037515CbB8502561EE57", "implementation-executionLayerReceiver": "0x1fbedf3773418f20b9dfeafcd9d263030eb0e42f", "implementation-consensusLayerReceiver": "0xe7acc0533c650ad0cc11f57f81c38fa19634b1d7", "implementation-rewardsDistributor": "0xb6ec4d9f71e437c672147c576f1c70ba5da8d159", diff --git a/script/DeployYieldNest.s.sol b/script/DeployYieldNest.s.sol index 24cee7c87..43b155faa 100644 --- a/script/DeployYieldNest.s.sol +++ b/script/DeployYieldNest.s.sol @@ -162,14 +162,13 @@ contract DeployYieldNest is BaseYnETHScript { vm.stopBroadcast(); - Deployment memory deployment = Deployment({ - ynETH: yneth, - stakingNodesManager: stakingNodesManager, - executionLayerReceiver: executionLayerReceiver, - consensusLayerReceiver: consensusLayerReceiver, // Adding consensusLayerReceiver to the deployment - rewardsDistributor: rewardsDistributor, - stakingNodeImplementation: stakingNodeImplementation - }); + Deployment memory deployment; + deployment.ynETH = yneth; + deployment.stakingNodesManager = stakingNodesManager; + deployment.executionLayerReceiver = executionLayerReceiver; + deployment.consensusLayerReceiver = consensusLayerReceiver; // Adding consensusLayerReceiver to the deployment + deployment.rewardsDistributor = rewardsDistributor; + deployment.stakingNodeImplementation = stakingNodeImplementation; saveDeployment(deployment); diff --git a/script/VerifyYnETH.s.sol b/script/VerifyYnETH.s.sol index 059823f66..e81999c73 100644 --- a/script/VerifyYnETH.s.sol +++ b/script/VerifyYnETH.s.sol @@ -25,47 +25,72 @@ contract Verify is BaseYnETHScript { deployment = loadDeployment(); actors = getActors(); - verifyProxyAdminOwners(); + verifyProxies(); verifyRoles(); verifySystemParameters(); verifyContractDependencies(); } - function verifyProxyAdminOwners() internal view { - address ynETHAdmin = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.ynETH))).owner(); + function verifyProxyContract( + address contractAddress, + string memory contractName, + ProxyAddresses memory proxyAddresses + ) internal view { + // Verify PROXY_ADMIN_OWNER + address proxyAdminAddress = Utils.getTransparentUpgradeableProxyAdminAddress(contractAddress); + address proxyAdminOwner = ProxyAdmin(proxyAdminAddress).owner(); require( - ynETHAdmin == actors.admin.PROXY_ADMIN_OWNER, - string.concat("ynETH: PROXY_ADMIN_OWNER INVALID, expected: ", vm.toString(actors.admin.PROXY_ADMIN_OWNER), ", got: ", vm.toString(ynETHAdmin)) + proxyAdminOwner == actors.admin.PROXY_ADMIN_OWNER, + string.concat(contractName, ": PROXY_ADMIN_OWNER mismatch, expected: ", vm.toString(actors.admin.PROXY_ADMIN_OWNER), ", got: ", vm.toString(proxyAdminOwner)) ); - console.log("\u2705 ynETH: PROXY_ADMIN_OWNER - ", vm.toString(ynETHAdmin)); + console.log(string.concat("\u2705 ", contractName, ": PROXY_ADMIN_OWNER - ", vm.toString(proxyAdminOwner))); - address rewardsDistributorAdmin = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.rewardsDistributor))).owner(); + // Verify ProxyAdmin address require( - rewardsDistributorAdmin == actors.admin.PROXY_ADMIN_OWNER, - string.concat("rewardsDistributor: PROXY_ADMIN_OWNER INVALID, expected: ", vm.toString(actors.admin.PROXY_ADMIN_OWNER), ", got: ", vm.toString(rewardsDistributorAdmin)) + proxyAdminAddress == address(proxyAddresses.proxyAdmin), + string.concat(contractName, ": ProxyAdmin address mismatch, expected: ", vm.toString(address(proxyAddresses.proxyAdmin)), ", got: ", vm.toString(proxyAdminAddress)) ); - console.log("\u2705 rewardsDistributor: PROXY_ADMIN_OWNER - ", vm.toString(rewardsDistributorAdmin)); + console.log(string.concat("\u2705 ", contractName, ": ProxyAdmin address - ", vm.toString(proxyAdminAddress))); - address stakingNodesManagerAdmin = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.stakingNodesManager))).owner(); + // Verify Implementation address + address implementationAddress = Utils.getTransparentUpgradeableProxyImplementationAddress(contractAddress); require( - stakingNodesManagerAdmin == actors.admin.PROXY_ADMIN_OWNER, - string.concat("stakingNodesManager: PROXY_ADMIN_OWNER INVALID, expected: ", vm.toString(actors.admin.PROXY_ADMIN_OWNER), ", got: ", vm.toString(stakingNodesManagerAdmin)) + implementationAddress == proxyAddresses.implementation, + string.concat(contractName, ": Implementation address mismatch, expected: ", vm.toString(proxyAddresses.implementation), ", got: ", vm.toString(implementationAddress)) ); - console.log("\u2705 stakingNodesManager: PROXY_ADMIN_OWNER - ", vm.toString(stakingNodesManagerAdmin)); + console.log(string.concat("\u2705 ", contractName, ": Implementation address - ", vm.toString(implementationAddress))); + } - address consensusLayerReceiverAdmin = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.consensusLayerReceiver))).owner(); - require( - consensusLayerReceiverAdmin == actors.admin.PROXY_ADMIN_OWNER, - string.concat("consensusLayerReceiver: PROXY_ADMIN_OWNER INVALID, expected: ", vm.toString(actors.admin.PROXY_ADMIN_OWNER), ", got: ", vm.toString(consensusLayerReceiverAdmin)) + function verifyProxies() internal view { + verifyProxyContract( + address(deployment.ynETH), + "ynETH", + deployment.proxies.ynETH ); - console.log("\u2705 consensusLayerReceiver: PROXY_ADMIN_OWNER - ", vm.toString(consensusLayerReceiverAdmin)); - address executionLayerReceiverAdmin = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.executionLayerReceiver))).owner(); - require( - executionLayerReceiverAdmin == actors.admin.PROXY_ADMIN_OWNER, - string.concat("executionLayerReceiver: PROXY_ADMIN_OWNER INVALID, expected: ", vm.toString(actors.admin.PROXY_ADMIN_OWNER), ", got: ", vm.toString(executionLayerReceiverAdmin)) + verifyProxyContract( + address(deployment.rewardsDistributor), + "rewardsDistributor", + deployment.proxies.rewardsDistributor + ); + + verifyProxyContract( + address(deployment.stakingNodesManager), + "stakingNodesManager", + deployment.proxies.stakingNodesManager + ); + + verifyProxyContract( + address(deployment.consensusLayerReceiver), + "consensusLayerReceiver", + deployment.proxies.consensusLayerReceiver + ); + + verifyProxyContract( + address(deployment.executionLayerReceiver), + "executionLayerReceiver", + deployment.proxies.executionLayerReceiver ); - console.log("\u2705 executionLayerReceiver: PROXY_ADMIN_OWNER - ", vm.toString(executionLayerReceiverAdmin)); } function verifyRoles() internal view { @@ -386,48 +411,6 @@ contract Verify is BaseYnETHScript { console.log("\u2705 StakingNodesManager dependencies verified"); } - // function verifyImplementations() { - // // Verify ynETH implementation - // address ynETHImpl = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.ynETH))).getProxyImplementation(address(deployment.ynETH)); - // require( - // ynETHImpl == deployment.ynETHImplementation, - // string.concat("ynETH: implementation mismatch, expected: ", vm.toString(deployment.ynETHImplementation), ", got: ", vm.toString(ynETHImpl)) - // ); - // console.log("\u2705 ynETH implementation verified"); - - // // Verify rewardsDistributor implementation - // address rewardsDistributorImpl = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.rewardsDistributor))).getProxyImplementation(address(deployment.rewardsDistributor)); - // require( - // rewardsDistributorImpl == deployment.rewardsDistributorImplementation, - // string.concat("rewardsDistributor: implementation mismatch, expected: ", vm.toString(deployment.rewardsDistributorImplementation), ", got: ", vm.toString(rewardsDistributorImpl)) - // ); - // console.log("\u2705 rewardsDistributor implementation verified"); - - // // Verify stakingNodesManager implementation - // address stakingNodesManagerImpl = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.stakingNodesManager))).getProxyImplementation(address(deployment.stakingNodesManager)); - // require( - // stakingNodesManagerImpl == deployment.stakingNodesManagerImplementation, - // string.concat("stakingNodesManager: implementation mismatch, expected: ", vm.toString(deployment.stakingNodesManagerImplementation), ", got: ", vm.toString(stakingNodesManagerImpl)) - // ); - // console.log("\u2705 stakingNodesManager implementation verified"); - - // // Verify consensusLayerReceiver implementation - // address consensusLayerReceiverImpl = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.consensusLayerReceiver))).getProxyImplementation(address(deployment.consensusLayerReceiver)); - // require( - // consensusLayerReceiverImpl == deployment.consensusLayerReceiverImplementation, - // string.concat("consensusLayerReceiver: implementation mismatch, expected: ", vm.toString(deployment.consensusLayerReceiverImplementation), ", got: ", vm.toString(consensusLayerReceiverImpl)) - // ); - // console.log("\u2705 consensusLayerReceiver implementation verified"); - - // // Verify executionLayerReceiver implementation - // address executionLayerReceiverImpl = ProxyAdmin(Utils.getTransparentUpgradeableProxyAdminAddress(address(deployment.executionLayerReceiver))).getProxyImplementation(address(deployment.executionLayerReceiver)); - // require( - // executionLayerReceiverImpl == deployment.executionLayerReceiverImplementation, - // string.concat("executionLayerReceiver: implementation mismatch, expected: ", vm.toString(deployment.executionLayerReceiverImplementation), ", got: ", vm.toString(executionLayerReceiverImpl)) - // ); - // console.log("\u2705 executionLayerReceiver implementation verified"); - // } - function verifyAllStakingNodeDependencies() internal view { IStakingNode[] memory stakingNodes = deployment.stakingNodesManager.getAllNodes(); for (uint256 i = 0; i < stakingNodes.length; i++) {