diff --git a/bolt-contracts/config/holesky/operator.json b/bolt-contracts/config/holesky/operators/eigenlayer/registerIntoBoltAVS.json similarity index 99% rename from bolt-contracts/config/holesky/operator.json rename to bolt-contracts/config/holesky/operators/eigenlayer/registerIntoBoltAVS.json index 7e1d43c10..ee763fe83 100644 --- a/bolt-contracts/config/holesky/operator.json +++ b/bolt-contracts/config/holesky/operators/eigenlayer/registerIntoBoltAVS.json @@ -3,4 +3,3 @@ "salt": "0x0000000000000000000_salt_value_0000000000000000000000000000000000", "expiry": "0x00000000000000000_expiry_value_0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" } - diff --git a/bolt-contracts/script/holesky/operators/RegisterEigenLayerOperator.s.sol b/bolt-contracts/script/holesky/operators/RegisterEigenLayerOperator.s.sol index 109f70c73..d7ef3c409 100644 --- a/bolt-contracts/script/holesky/operators/RegisterEigenLayerOperator.s.sol +++ b/bolt-contracts/script/holesky/operators/RegisterEigenLayerOperator.s.sol @@ -25,7 +25,9 @@ contract RegisterEigenLayerOperator is Script { IStrategyManager strategyManager = _readStrategyManager(); - string memory json = vm.readFile("config/holesky/operators/eigenlayer/depositIntoStrategy.json"); + string memory json = vm.readFile( + "config/holesky/operators/eigenlayer/depositIntoStrategy.json" + ); IStrategy strategy = IStrategy(vm.parseJsonAddress(json, ".strategy")); IERC20 token = IERC20(vm.parseJsonAddress(json, ".token")); @@ -45,24 +47,32 @@ contract RegisterEigenLayerOperator is Script { BoltEigenLayerMiddlewareV1 middleware = _readMiddleware(); IAVSDirectory avsDirectory = _readAvsDirectory(); - OperatorConfig memory config = _readConfig("config/holesky/operator.json"); + OperatorConfig memory config = _readConfig( + "config/holesky/operators/eigenlayer/registerIntoBoltAVS.json" + ); console.log("Registering EigenLayer operator"); console.log("Operator address:", operator); console.log("Operator RPC:", config.rpc); - bytes32 digest = avsDirectory.calculateOperatorAVSRegistrationDigestHash({ - operator: operator, - avs: address(middleware), - salt: config.salt, - expiry: config.expiry - }); + bytes32 digest = avsDirectory + .calculateOperatorAVSRegistrationDigestHash({ + operator: operator, + avs: address(middleware), + salt: config.salt, + expiry: config.expiry + }); (uint8 v, bytes32 r, bytes32 s) = vm.sign(operatorSk, digest); bytes memory rawSignature = abi.encodePacked(r, s, v); - ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature = - ISignatureUtils.SignatureWithSaltAndExpiry(rawSignature, config.salt, config.expiry); + ISignatureUtils.SignatureWithSaltAndExpiry + memory operatorSignature = ISignatureUtils + .SignatureWithSaltAndExpiry( + rawSignature, + config.salt, + config.expiry + ); vm.startBroadcast(operatorSk); @@ -74,7 +84,10 @@ contract RegisterEigenLayerOperator is Script { function S03_checkOperatorRegistration() public view { address operatorPublicKey = vm.envAddress("OPERATOR_PK"); - console.log("Checking operator registration for address", operatorPublicKey); + console.log( + "Checking operator registration for address", + operatorPublicKey + ); IBoltManagerV1 boltManager = _readBoltManager(); bool isRegistered = boltManager.isOperator(operatorPublicKey); @@ -82,40 +95,71 @@ contract RegisterEigenLayerOperator is Script { require(isRegistered, "Operator is not registered"); } - function _readMiddleware() public view returns (BoltEigenLayerMiddlewareV1) { + function _readMiddleware() + public + view + returns (BoltEigenLayerMiddlewareV1) + { string memory root = vm.projectRoot(); - string memory path = string.concat(root, "/config/holesky/deployments.json"); + string memory path = string.concat( + root, + "/config/holesky/deployments.json" + ); string memory json = vm.readFile(path); - return BoltEigenLayerMiddlewareV1(vm.parseJsonAddress(json, ".eigenLayer.middleware")); + return + BoltEigenLayerMiddlewareV1( + vm.parseJsonAddress(json, ".eigenLayer.middleware") + ); } function _readAvsDirectory() public view returns (IAVSDirectory) { string memory root = vm.projectRoot(); - string memory path = string.concat(root, "/config/holesky/deployments.json"); + string memory path = string.concat( + root, + "/config/holesky/deployments.json" + ); string memory json = vm.readFile(path); - return IAVSDirectory(vm.parseJsonAddress(json, ".eigenLayer.avsDirectory")); + return + IAVSDirectory( + vm.parseJsonAddress(json, ".eigenLayer.avsDirectory") + ); } function _readDelegationManager() public view returns (IDelegationManager) { string memory root = vm.projectRoot(); - string memory path = string.concat(root, "/config/holesky/deployments.json"); + string memory path = string.concat( + root, + "/config/holesky/deployments.json" + ); string memory json = vm.readFile(path); - return IDelegationManager(vm.parseJsonAddress(json, ".eigenLayer.delegationManager")); + return + IDelegationManager( + vm.parseJsonAddress(json, ".eigenLayer.delegationManager") + ); } function _readStrategyManager() public view returns (IStrategyManager) { string memory root = vm.projectRoot(); - string memory path = string.concat(root, "/config/holesky/deployments.json"); + string memory path = string.concat( + root, + "/config/holesky/deployments.json" + ); string memory json = vm.readFile(path); - return IStrategyManager(vm.parseJsonAddress(json, ".eigenLayer.strategyManager")); + return + IStrategyManager( + vm.parseJsonAddress(json, ".eigenLayer.strategyManager") + ); } function _readBoltManager() public view returns (IBoltManagerV1) { string memory root = vm.projectRoot(); - string memory path = string.concat(root, "/config/holesky/deployments.json"); + string memory path = string.concat( + root, + "/config/holesky/deployments.json" + ); string memory json = vm.readFile(path); return IBoltManagerV1(vm.parseJsonAddress(json, ".bolt.manager")); } @@ -140,6 +184,11 @@ contract RegisterEigenLayerOperator is Script { console.log("No expiry found in config, using UINT256_MAX"); } - return OperatorConfig({rpc: vm.parseJsonString(json, ".rpc"), salt: salt, expiry: expiry}); + return + OperatorConfig({ + rpc: vm.parseJsonString(json, ".rpc"), + salt: salt, + expiry: expiry + }); } } diff --git a/testnets/holesky/README.md b/testnets/holesky/README.md index 6089342c1..524d64335 100644 --- a/testnets/holesky/README.md +++ b/testnets/holesky/README.md @@ -563,9 +563,36 @@ forge script script/holesky/operators/RegisterEigenLayerOperator.s.sol \ After having deposited collateral into a strategy you need to register into the Bolt AVS. We've provided a script to facilitate the procedure. If you want to -use it, please set the operator private key to an `OPERATOR_SK` environment -variable, and then run the following Forge script from the `bolt-contracts` -directory: +use it, please set follow these steps: + +1. configure the operator details in this JSON file + + ```bash + $EDITOR ./config/holesky/operators/eigenlayer/registerIntoBoltAVS.json + ``` + + In there you'll need to set the the following fields: + + - `rpc` -- the RPC URL of your operator which supports the Commitments API + - `salt` -- an unique 32 bytes value to avoid replay attacks. To generate it on + both Linux and MacOS you can run: + + ```bash + echo -n "0x"; head -c 32 /dev/urandom | hexdump -e '32/1 "%02x" "\n"' + ``` + + - `expiry` -- the timestamp of the signature expiry in seconds. To generate it + on both Linux and MacOS run the following command, replacing + `` with the desired timestamp: + + ```bash + echo -n "0x"; printf "%064x\n" + ``` + +2. set the operator private key to an `OPERATOR_SK` environment + variable; +3. run the following Forge script from the `bolt-contracts` + directory: ```bash forge script script/holesky/operators/RegisterEigenLayerOperator.s.sol \