From 7a526a157ecb6a29cf11d58a6f5163b4806a642f Mon Sep 17 00:00:00 2001 From: QUAQ Date: Mon, 16 Dec 2024 14:12:13 -0600 Subject: [PATCH 1/3] bump middleware rewardsV2 --- contracts/lib/eigenlayer-middleware | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/lib/eigenlayer-middleware b/contracts/lib/eigenlayer-middleware index b42aa0b7ae..91400d9776 160000 --- a/contracts/lib/eigenlayer-middleware +++ b/contracts/lib/eigenlayer-middleware @@ -1 +1 @@ -Subproject commit b42aa0b7aefb5b30721c3f4b9ad7ab02e8215648 +Subproject commit 91400d9776d4f7276a2807a53559f49f7edf5378 From 9e49bd5b22bb6eb1bcb1ab4ed2c3709e90961ffe Mon Sep 17 00:00:00 2001 From: QUAQ Date: Mon, 16 Dec 2024 16:02:51 -0600 Subject: [PATCH 2/3] trim bytecode --- contracts/script/AAA.s.sol | 75 +++++++++++++++++++ contracts/src/core/EigenDAServiceManager.sol | 12 +-- .../test/unit/EigenDAServiceManagerUnit.t.sol | 12 +-- 3 files changed, 87 insertions(+), 12 deletions(-) create mode 100644 contracts/script/AAA.s.sol diff --git a/contracts/script/AAA.s.sol b/contracts/script/AAA.s.sol new file mode 100644 index 0000000000..db375d72f7 --- /dev/null +++ b/contracts/script/AAA.s.sol @@ -0,0 +1,75 @@ +pragma solidity =0.8.12; + +import {PauserRegistry} from "eigenlayer-core/contracts/permissions/PauserRegistry.sol"; +import {EmptyContract} from "eigenlayer-core/test/mocks/EmptyContract.sol"; +import {BLSApkRegistry} from "eigenlayer-middleware/BLSApkRegistry.sol"; +import {RegistryCoordinator} from "eigenlayer-middleware/RegistryCoordinator.sol"; +import {OperatorStateRetriever} from "eigenlayer-middleware/OperatorStateRetriever.sol"; +import {IRegistryCoordinator} from "eigenlayer-middleware/interfaces/IRegistryCoordinator.sol"; +import {IndexRegistry} from "eigenlayer-middleware/IndexRegistry.sol"; +import {IIndexRegistry} from "eigenlayer-middleware/interfaces/IIndexRegistry.sol"; +import {StakeRegistry, IStrategy} from "eigenlayer-middleware/StakeRegistry.sol"; +import {IStakeRegistry, IDelegationManager} from "eigenlayer-middleware/interfaces/IStakeRegistry.sol"; +import {IServiceManager} from "eigenlayer-middleware/interfaces/IServiceManager.sol"; +import {IBLSApkRegistry} from "eigenlayer-middleware/interfaces/IBLSApkRegistry.sol"; +import {EigenDAServiceManager, IAVSDirectory, IRewardsCoordinator} from "../src/core/EigenDAServiceManager.sol"; +import {EigenDAHasher} from "../src/libraries/EigenDAHasher.sol"; +import {EigenDAThresholdRegistry} from "../src/core/EigenDAThresholdRegistry.sol"; +import {EigenDABlobVerifier} from "../src/core/EigenDABlobVerifier.sol"; +import {IEigenDAThresholdRegistry} from "../src/interfaces/IEigenDAThresholdRegistry.sol"; +import {IEigenDABatchMetadataStorage} from "../src/interfaces/IEigenDABatchMetadataStorage.sol"; +import {IEigenDASignatureVerifier} from "../src/interfaces/IEigenDASignatureVerifier.sol"; +import {IEigenDARelayRegistry} from "../src/interfaces/IEigenDARelayRegistry.sol"; +import {EigenDARelayRegistry} from "../src/core/EigenDARelayRegistry.sol"; +import {ISocketRegistry, SocketRegistry} from "eigenlayer-middleware/SocketRegistry.sol"; +import {DeployOpenEigenLayer, ProxyAdmin, ERC20PresetFixedSupply, TransparentUpgradeableProxy, IPauserRegistry} from "./DeployOpenEigenLayer.s.sol"; +import "forge-std/Test.sol"; +import "forge-std/Script.sol"; +import "forge-std/StdJson.sol"; +import "../src/interfaces/IEigenDAStructs.sol"; +import {PaymentVault} from "../src/payments/PaymentVault.sol"; +import {IPaymentVault} from "../src/interfaces/IPaymentVault.sol"; + +//forge script script/AAA.s.sol:AAA --rpc-url $HOL --private-key $DATN -vvvv --etherscan-api-key D6ZFHU3MWZXE4Z17ICWBA1IR8A4JEPK1ZJ --verify +contract AAA is Script, Test { + + address proxyAdmin = 0x9Fd7E279f5bD692Dc04792151E14Ad814FC60eC1; + + address eigenDAServiceManager = 0x54A03db2784E3D0aCC08344D05385d0b62d4F432; + address eigenDAServiceManagerImplementation; + + address avsDirectory = 0x141d6995556135D4997b2ff72EB443Be300353bC; + address rewardsCoordinator = 0xb22Ef643e1E067c994019A4C19e403253C05c2B0; + address registryCoordinator = 0x2c61EA360D6500b58E7f481541A36B443Bc858c6; + address stakeRegistry = 0x53668EBf2e28180e38B122c641BC51Ca81088871; + address eigenDAThresholdRegistry = 0x41AEE4A23770045e9977CC9f964d3380D6Ff9e4E; + address eigenDARelayRegistry = 0xca1ca181fCb3c4192D320569c6eB4b5161B80328; + address paymentVault = 0x46E024ca6e5E1172100930c28DCCcF49BE5462C9; + + + function run() external { + vm.startBroadcast(); + + eigenDAServiceManagerImplementation = address(new EigenDAServiceManager( + IAVSDirectory(avsDirectory), + IRewardsCoordinator(rewardsCoordinator), + IRegistryCoordinator(registryCoordinator), + IStakeRegistry(stakeRegistry), + IEigenDAThresholdRegistry(eigenDAThresholdRegistry), + IEigenDARelayRegistry(eigenDARelayRegistry), + IPaymentVault(paymentVault) + )); + + ProxyAdmin(proxyAdmin).upgrade( + TransparentUpgradeableProxy(payable(address(eigenDAServiceManager))), + address(eigenDAServiceManagerImplementation) + ); + + vm.stopBroadcast(); + + console.log("Deployed new EigenDAServiceManagerImplementation at address: ", eigenDAServiceManagerImplementation); + } +} + + + diff --git a/contracts/src/core/EigenDAServiceManager.sol b/contracts/src/core/EigenDAServiceManager.sol index 029785eb7c..fab05d0501 100644 --- a/contracts/src/core/EigenDAServiceManager.sol +++ b/contracts/src/core/EigenDAServiceManager.sol @@ -31,7 +31,7 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa /// @notice when applied to a function, ensures that the function is only callable by the `batchConfirmer`. modifier onlyBatchConfirmer() { - require(isBatchConfirmer[msg.sender], "onlyBatchConfirmer: not from batch confirmer"); + require(isBatchConfirmer[msg.sender]); _; } @@ -80,21 +80,21 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa NonSignerStakesAndSignature memory nonSignerStakesAndSignature ) external onlyWhenNotPaused(PAUSED_CONFIRM_BATCH) onlyBatchConfirmer() { // make sure the information needed to derive the non-signers and batch is in calldata to avoid emitting events - require(tx.origin == msg.sender, "EigenDAServiceManager.confirmBatch: header and nonsigner data must be in calldata"); + require(tx.origin == msg.sender, "header and nonsigner data must be in calldata"); // make sure the stakes against which the Batch is being confirmed are not stale require( - batchHeader.referenceBlockNumber < block.number, "EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is in future" + batchHeader.referenceBlockNumber < block.number, "specified referenceBlockNumber is in future" ); require( (batchHeader.referenceBlockNumber + BLOCK_STALE_MEASURE) >= uint32(block.number), - "EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past" + "specified referenceBlockNumber is too far in past" ); //make sure that the quorumNumbers and signedStakeForQuorums are of the same length require( batchHeader.quorumNumbers.length == batchHeader.signedStakeForQuorums.length, - "EigenDAServiceManager.confirmBatch: quorumNumbers and signedStakeForQuorums must be of the same length" + "quorumNumbers and signedStakeForQuorums must be same length" ); // calculate reducedBatchHeaderHash which nodes signed @@ -118,7 +118,7 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa require( quorumStakeTotals.signedStakeForQuorum[i] * THRESHOLD_DENOMINATOR >= quorumStakeTotals.totalStakeForQuorum[i] * uint8(batchHeader.signedStakeForQuorums[i]), - "EigenDAServiceManager.confirmBatch: signatories do not own at least threshold percentage of a quorum" + "signatories do not own threshold percentage of a quorum" ); } diff --git a/contracts/test/unit/EigenDAServiceManagerUnit.t.sol b/contracts/test/unit/EigenDAServiceManagerUnit.t.sol index f550889bcb..b476494d5c 100644 --- a/contracts/test/unit/EigenDAServiceManagerUnit.t.sol +++ b/contracts/test/unit/EigenDAServiceManagerUnit.t.sol @@ -158,7 +158,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { (BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature) = _getHeaderandNonSigners(0, pseudoRandomNumber, 100); - cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: header and nonsigner data must be in calldata")); + cheats.expectRevert(bytes("header and nonsigner data must be in calldata")); cheats.prank(confirmer, notConfirmer); eigenDAServiceManager.confirmBatch( batchHeader, @@ -170,7 +170,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { (BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature) = _getHeaderandNonSigners(0, pseudoRandomNumber, 100); - cheats.expectRevert(bytes("onlyBatchConfirmer: not from batch confirmer")); + cheats.expectRevert(); cheats.prank(notConfirmer, notConfirmer); eigenDAServiceManager.confirmBatch( batchHeader, @@ -192,7 +192,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { bytes32 batchHeaderHash = batchHeader.hashBatchHeaderMemory(); nonSignerStakesAndSignature.sigma = BN254.hashToG1(batchHeaderHash).scalar_mul(aggSignerPrivKey); - cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is in future")); + cheats.expectRevert(bytes("specified referenceBlockNumber is in future")); cheats.prank(confirmer, confirmer); eigenDAServiceManager.confirmBatch( batchHeader, @@ -205,7 +205,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { = _getHeaderandNonSigners(0, pseudoRandomNumber, 100); cheats.roll(block.number + eigenDAServiceManager.BLOCK_STALE_MEASURE()); - cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past")); + cheats.expectRevert(bytes("specified referenceBlockNumber is too far in past")); cheats.prank(confirmer, confirmer); eigenDAServiceManager.confirmBatch( batchHeader, @@ -217,7 +217,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { (BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature) = _getHeaderandNonSigners(1, pseudoRandomNumber, 100); - cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: signatories do not own at least threshold percentage of a quorum")); + cheats.expectRevert(bytes("signatories do not own threshold percentage of a quorum")); cheats.prank(confirmer, confirmer); eigenDAServiceManager.confirmBatch( batchHeader, @@ -251,7 +251,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { = _getHeaderandNonSigners(0, pseudoRandomNumber, 100); batchHeader.signedStakeForQuorums = new bytes(0); - cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: quorumNumbers and signedStakeForQuorums must be of the same length")); + cheats.expectRevert(bytes("quorumNumbers and signedStakeForQuorums must be same length")); cheats.prank(confirmer, confirmer); eigenDAServiceManager.confirmBatch( batchHeader, From 2b0020cdd0990c6b983be60ce9e59a0623fadf4f Mon Sep 17 00:00:00 2001 From: QUAQ Date: Mon, 16 Dec 2024 16:22:09 -0600 Subject: [PATCH 3/3] nit --- contracts/script/AAA.s.sol | 75 -------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 contracts/script/AAA.s.sol diff --git a/contracts/script/AAA.s.sol b/contracts/script/AAA.s.sol deleted file mode 100644 index db375d72f7..0000000000 --- a/contracts/script/AAA.s.sol +++ /dev/null @@ -1,75 +0,0 @@ -pragma solidity =0.8.12; - -import {PauserRegistry} from "eigenlayer-core/contracts/permissions/PauserRegistry.sol"; -import {EmptyContract} from "eigenlayer-core/test/mocks/EmptyContract.sol"; -import {BLSApkRegistry} from "eigenlayer-middleware/BLSApkRegistry.sol"; -import {RegistryCoordinator} from "eigenlayer-middleware/RegistryCoordinator.sol"; -import {OperatorStateRetriever} from "eigenlayer-middleware/OperatorStateRetriever.sol"; -import {IRegistryCoordinator} from "eigenlayer-middleware/interfaces/IRegistryCoordinator.sol"; -import {IndexRegistry} from "eigenlayer-middleware/IndexRegistry.sol"; -import {IIndexRegistry} from "eigenlayer-middleware/interfaces/IIndexRegistry.sol"; -import {StakeRegistry, IStrategy} from "eigenlayer-middleware/StakeRegistry.sol"; -import {IStakeRegistry, IDelegationManager} from "eigenlayer-middleware/interfaces/IStakeRegistry.sol"; -import {IServiceManager} from "eigenlayer-middleware/interfaces/IServiceManager.sol"; -import {IBLSApkRegistry} from "eigenlayer-middleware/interfaces/IBLSApkRegistry.sol"; -import {EigenDAServiceManager, IAVSDirectory, IRewardsCoordinator} from "../src/core/EigenDAServiceManager.sol"; -import {EigenDAHasher} from "../src/libraries/EigenDAHasher.sol"; -import {EigenDAThresholdRegistry} from "../src/core/EigenDAThresholdRegistry.sol"; -import {EigenDABlobVerifier} from "../src/core/EigenDABlobVerifier.sol"; -import {IEigenDAThresholdRegistry} from "../src/interfaces/IEigenDAThresholdRegistry.sol"; -import {IEigenDABatchMetadataStorage} from "../src/interfaces/IEigenDABatchMetadataStorage.sol"; -import {IEigenDASignatureVerifier} from "../src/interfaces/IEigenDASignatureVerifier.sol"; -import {IEigenDARelayRegistry} from "../src/interfaces/IEigenDARelayRegistry.sol"; -import {EigenDARelayRegistry} from "../src/core/EigenDARelayRegistry.sol"; -import {ISocketRegistry, SocketRegistry} from "eigenlayer-middleware/SocketRegistry.sol"; -import {DeployOpenEigenLayer, ProxyAdmin, ERC20PresetFixedSupply, TransparentUpgradeableProxy, IPauserRegistry} from "./DeployOpenEigenLayer.s.sol"; -import "forge-std/Test.sol"; -import "forge-std/Script.sol"; -import "forge-std/StdJson.sol"; -import "../src/interfaces/IEigenDAStructs.sol"; -import {PaymentVault} from "../src/payments/PaymentVault.sol"; -import {IPaymentVault} from "../src/interfaces/IPaymentVault.sol"; - -//forge script script/AAA.s.sol:AAA --rpc-url $HOL --private-key $DATN -vvvv --etherscan-api-key D6ZFHU3MWZXE4Z17ICWBA1IR8A4JEPK1ZJ --verify -contract AAA is Script, Test { - - address proxyAdmin = 0x9Fd7E279f5bD692Dc04792151E14Ad814FC60eC1; - - address eigenDAServiceManager = 0x54A03db2784E3D0aCC08344D05385d0b62d4F432; - address eigenDAServiceManagerImplementation; - - address avsDirectory = 0x141d6995556135D4997b2ff72EB443Be300353bC; - address rewardsCoordinator = 0xb22Ef643e1E067c994019A4C19e403253C05c2B0; - address registryCoordinator = 0x2c61EA360D6500b58E7f481541A36B443Bc858c6; - address stakeRegistry = 0x53668EBf2e28180e38B122c641BC51Ca81088871; - address eigenDAThresholdRegistry = 0x41AEE4A23770045e9977CC9f964d3380D6Ff9e4E; - address eigenDARelayRegistry = 0xca1ca181fCb3c4192D320569c6eB4b5161B80328; - address paymentVault = 0x46E024ca6e5E1172100930c28DCCcF49BE5462C9; - - - function run() external { - vm.startBroadcast(); - - eigenDAServiceManagerImplementation = address(new EigenDAServiceManager( - IAVSDirectory(avsDirectory), - IRewardsCoordinator(rewardsCoordinator), - IRegistryCoordinator(registryCoordinator), - IStakeRegistry(stakeRegistry), - IEigenDAThresholdRegistry(eigenDAThresholdRegistry), - IEigenDARelayRegistry(eigenDARelayRegistry), - IPaymentVault(paymentVault) - )); - - ProxyAdmin(proxyAdmin).upgrade( - TransparentUpgradeableProxy(payable(address(eigenDAServiceManager))), - address(eigenDAServiceManagerImplementation) - ); - - vm.stopBroadcast(); - - console.log("Deployed new EigenDAServiceManagerImplementation at address: ", eigenDAServiceManagerImplementation); - } -} - - -