Skip to content

Commit

Permalink
Testnet Rewards Coordinator Upgrade Script (#742)
Browse files Browse the repository at this point in the history
* feat: testnet rc upgrade

* test: add hopper validation

* feat: dep script with sanity check

* chore: update RC implementation
  • Loading branch information
ypatil12 authored Sep 13, 2024
1 parent decf99c commit 4e9b422
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 62 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"lastUpdated": "v0.4.3-rewards-incentives",
"addresses": {
"avsDirectory": "0x055733000064333CaDDbC92763c58BF0192fFeBf",
"avsDirectoryImplementation": "0xEF5BA995Bc7722fd1e163edF8Dc09375de3d3e3a",
Expand All @@ -16,7 +17,7 @@
"eigenPodManagerImplementation": "0x91A6525a4a843F5a5B633905300c33F79413CCc5",
"emptyContract": "0x9690d52B1Ce155DB2ec5eCbF5a262ccCc7B3A6D2",
"rewardsCoordinator": "0xAcc1fb458a1317E886dB376Fc8141540537E68fE",
"rewardsCoordinatorImplementation": "0xe54625095656206AC1B42819875343453c447f97",
"rewardsCoordinatorImplementation": "0x1131D88143a35011E35263b43eC66cDd27025584",
"slasher": "0xcAe751b75833ef09627549868A04E32679386e7C",
"slasherImplementation": "0x99715D255E34a39bE9943b82F281CA734bcF345A",
"numStrategiesDeployed": 10,
Expand Down
57 changes: 57 additions & 0 deletions script/configs/holesky/eigenlayer_testnet.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"lastUpdated": "v0.4.3-rewards-incentives",
"chainInfo": {
"chainId": 17000
},
"multisig_addresses": {
"pauserMultisig": "0x53410249ec7d3a3F9F1ba3912D50D6A3Df6d10A7",
"communityMultisig": "0xCb8d2f9e55Bc7B1FA9d089f9aC80C583D2BDD5F7",
"operationsMultisig": "0xfaEF7338b7490b9E272d80A1a39f4657cAf2b97d",
"executorMultisig": "0x28Ade60640fdBDb2609D8d8734D1b5cBeFc0C348",
"timelock": "0xcF19CE0561052a7A7Ff21156730285997B350A7D"
},
"strategies": {
"numStrategies": 0,
"MAX_PER_DEPOSIT": 115792089237316195423570985008687907853269984665640564039457584007913129639935,
"MAX_TOTAL_DEPOSITS": 115792089237316195423570985008687907853269984665640564039457584007913129639935,
"strategiesToDeploy": []
},
"strategyManager": {
"init_strategy_whitelister": "0x28Ade60640fdBDb2609D8d8734D1b5cBeFc0C348",
"init_paused_status": 0
},
"delegationManager": {
"init_paused_status": 0,
"init_minWithdrawalDelayBlocks": 10
},
"rewardsCoordinator": {
"init_paused_status": 0,
"CALCULATION_INTERVAL_SECONDS": 604800,
"MAX_REWARDS_DURATION": 6048000,
"MAX_RETROACTIVE_LENGTH": 7776000,
"MAX_FUTURE_LENGTH": 2592000,
"GENESIS_REWARDS_TIMESTAMP": 1710979200,
"rewards_updater_address": "0x18a0f92Ad9645385E8A8f3db7d0f6CF7aBBb0aD4",
"activation_delay": 7200,
"calculation_interval_seconds": 604800,
"global_operator_commission_bips": 1000
},
"avsDirectory": {
"init_paused_status": 0
},
"slasher": {
"init_paused_status": 0
},
"eigenPod": {
"MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR": 32000000000,
"GENESIS_TIME": 1695902400
},
"eigenPodManager": {
"init_paused_status": 0
},
"delayedWithdrawalRouter": {
"init_paused_status": 0,
"init_withdrawalDelayBlocks": 10
},
"ethPOSDepositAddress": "0x4242424242424242424242424242424242424242"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import "./Deploy_Test_RewardsCoordinator.s.sol";
*/
contract Deploy_Preprod_RewardsCoordinator is Deploy_Test_RewardsCoordinator {
function run(string memory deployArg) external virtual {
_parseInitialDeploymentParams("script/configs/holesky/Deploy_RewardsCoordinator.holesky.config.json");
_parseInitialDeploymentParams("script/configs/holesky/eigenlayer_preprod.config.json");
_parseDeployedContracts("script/output/holesky/M2_deploy_preprod.output.json");

// Overwrite testAddress and multisigs to be EOAowner
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/holesky/Deploy_Test_RewardsCoordinator.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract Deploy_Test_RewardsCoordinator is ExistingDeploymentParser {
address initOwner = 0xDA29BB71669f46F2a779b4b62f03644A84eE3479;

function run() external virtual {
_parseInitialDeploymentParams("script/configs/holesky/Deploy_RewardsCoordinator.holesky.config.json");
_parseInitialDeploymentParams("script/configs/holesky/eigenlayer_testnet.config.json");
_parseDeployedContracts("script/configs/holesky/eigenlayer_addresses.config.json");

// START RECORDING TRANSACTIONS FOR DEPLOYMENT
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/holesky/v040-holesky-pepe.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract PEPE_Deploy_Preprod is ExistingDeploymentParser {

function run() external virtual {
_parseInitialDeploymentParams(
"script/configs/holesky/Deploy_RewardsCoordinator.holesky.config.json"
"script/configs/holesky/eigenlayer_preprod.config.json"
);
_parseDeployedContracts(
"script/configs/holesky/eigenlayer_addresses.config.json"
Expand Down
117 changes: 117 additions & 0 deletions script/deploy/holesky/v042-upgrade_testnet_rewardsCoordinator.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import "./Deploy_Test_RewardsCoordinator.s.sol";
import "script/utils/TimelockEncoding.sol";

/**
* @notice Script used for the first deployment of EigenLayer core contracts to Holesky
* anvil --fork-url $RPC_HOLESKY
*
* Holesky testnet: Deploy/Upgrade RewardsCoordinator
* forge script script/deploy/holesky/v042-upgrade_testnet_rewardsCoordinator.s.sol --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast -vvvv --verify --etherscan-api-key $ETHERSCAN_API_KEY
*
*/
contract Upgrade_Testnet_RewardsCoordinator is Deploy_Test_RewardsCoordinator, TimelockEncoding {
function run() external virtual override {
_parseInitialDeploymentParams("script/configs/holesky/eigenlayer_testnet.config.json");
_parseDeployedContracts("script/configs/holesky/eigenlayer_addresses_testnet.config.json");

RewardsCoordinator oldRewardsCoordinator = rewardsCoordinatorImplementation;

// Deploy Rewards Coordinator
vm.startBroadcast();
rewardsCoordinatorImplementation = new RewardsCoordinator(
delegationManager,
strategyManager,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
);
vm.stopBroadcast();

_sanityCheckImplementations(oldRewardsCoordinator, rewardsCoordinatorImplementation);

emit log_named_address("Rewards Coordinator Implementation", address(rewardsCoordinatorImplementation));

// Create Upgrade Tx via Community Multisig
bytes memory calldata_to_proxy_admin = abi.encodeWithSelector(
ProxyAdmin.upgrade.selector,
TransparentUpgradeableProxy(payable(address(rewardsCoordinator))),
rewardsCoordinatorImplementation
);

bytes memory final_calldata_to_executor_multisig = encodeForExecutor(
communityMultisig, //from
address(eigenLayerProxyAdmin), //to
0, // value
calldata_to_proxy_admin, // data
ISafe.Operation.Call // operation
);

// Simulate Transaction
vm.prank(communityMultisig);
(bool success, ) = address(executorMultisig).call(final_calldata_to_executor_multisig);
require(success, "Transaction failed");

// Sanity Checks
_verifyContractPointers();
_verifyImplementations();
_verifyContractsInitialized();
_verifyInitializationParams();
}

function _sanityCheckImplementations(RewardsCoordinator oldRc, RewardsCoordinator newRc) internal {
// Verify configs between both rewardsCoordinatorImplementations
assertEq(
address(oldRc.delegationManager()),
address(newRc.delegationManager()),
"DM mismatch"
);
assertEq(
address(oldRc.strategyManager()),
address(newRc.strategyManager()),
"SM mismatch"
);
assertEq(
oldRc.CALCULATION_INTERVAL_SECONDS(),
newRc.CALCULATION_INTERVAL_SECONDS(),
"CALCULATION_INTERVAL_SECONDS mismatch"
);
assertEq(
oldRc.MAX_REWARDS_DURATION(),
newRc.MAX_REWARDS_DURATION(),
"MAX_REWARDS_DURATION mismatch"
);
assertEq(
oldRc.MAX_RETROACTIVE_LENGTH(),
newRc.MAX_RETROACTIVE_LENGTH(),
"MAX_RETROACTIVE_LENGTH mismatch"
);
assertEq(
oldRc.MAX_FUTURE_LENGTH(),
newRc.MAX_FUTURE_LENGTH(),
"MAX_FUTURE_LENGTH mismatch"
);
assertEq(
oldRc.GENESIS_REWARDS_TIMESTAMP(),
newRc.GENESIS_REWARDS_TIMESTAMP(),
"GENESIS_REWARDS_TIMESTAMP mismatch"
);
}

function setRewardForAllSubmitter() external {
address hopper;

require(hopper != address(0), "Hopper address is not set");

// Set reward for all submitters
vm.startBroadcast();
rewardsCoordinator.setRewardsForAllSubmitter(hopper, true);
vm.stopBroadcast();

require(rewardsCoordinator.isRewardsForAllSubmitter(hopper), "Hopper is not set as rewards for all submitter");
}
}

0 comments on commit 4e9b422

Please sign in to comment.