From ce3aac535e4903d373d0c57c82d7bad39bf9a62d Mon Sep 17 00:00:00 2001 From: Yash Patil Date: Fri, 20 Dec 2024 15:13:36 -0500 Subject: [PATCH 1/2] fix: initialization params --- script/configs/mainnet.json | 5 +++-- script/utils/ExistingDeploymentParser.sol | 4 ++++ src/test/integration/IntegrationBase.t.sol | 5 ++++- src/test/integration/IntegrationDeployer.t.sol | 5 +++++ src/test/integration/tests/Deposit_Delegate_Allocate.t.sol | 1 - src/test/integration/users/User.t.sol | 1 - 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/script/configs/mainnet.json b/script/configs/mainnet.json index 01c0c60047..856dab36ea 100644 --- a/script/configs/mainnet.json +++ b/script/configs/mainnet.json @@ -2,7 +2,7 @@ "config": { "environment": { "chainid": 1, - "lastUpdated": "v0.4.2-mainnet-pepe", + "lastUpdated": "slashing-integration-testing", "name": "mainnet" }, "params": { @@ -16,7 +16,8 @@ "REWARDS_UPDATER_ADDRESS": "0x8f94F55fD8c9E090296283137C303fE97d32A9e2", "ACTIVATION_DELAY": 604800, "GLOBAL_OPERATOR_COMMISSION_BIPS": 1000, - "MIN_WITHDRAWAL_DELAY": 7200 + "MIN_WITHDRAWAL_DELAY_BLOCKS": 100800, + "ALLOCATION_CONFIGURATION_DELAY": 126000 } }, "deployment": { diff --git a/script/utils/ExistingDeploymentParser.sol b/script/utils/ExistingDeploymentParser.sol index 3d6deaddec..c80333ac35 100644 --- a/script/utils/ExistingDeploymentParser.sol +++ b/script/utils/ExistingDeploymentParser.sol @@ -683,5 +683,9 @@ contract ExistingDeploymentParser is Script, Logger { REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH = uint32(json.readUint(".config.params.MAX_RETROACTIVE_LENGTH")); REWARDS_COORDINATOR_MAX_FUTURE_LENGTH = uint32(json.readUint(".config.params.MAX_FUTURE_LENGTH")); REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP = uint32(json.readUint(".config.params.GENESIS_REWARDS_TIMESTAMP")); + + DEALLOCATION_DELAY = uint32(json.readUint(".config.params.MIN_WITHDRAWAL_DELAY_BLOCKS")); + ALLOCATION_CONFIGURATION_DELAY = uint32(json.readUint(".config.params.ALLOCATION_CONFIGURATION_DELAY")); + DELEGATION_MANAGER_MIN_WITHDRAWAL_DELAY_BLOCKS = uint32(json.readUint(".config.params.MIN_WITHDRAWAL_DELAY_BLOCKS")); } } diff --git a/src/test/integration/IntegrationBase.t.sol b/src/test/integration/IntegrationBase.t.sol index 0f1bce63c7..f891437688 100644 --- a/src/test/integration/IntegrationBase.t.sol +++ b/src/test/integration/IntegrationBase.t.sol @@ -101,7 +101,10 @@ abstract contract IntegrationBase is IntegrationDeployer { operator.registerAsOperator(); operator.depositIntoEigenlayer(strategies, tokenBalances); - } + + // Roll passed the allocation configuration delay + rollForward({blocks: block.number + ALLOCATION_CONFIGURATION_DELAY}); + } assert_Snap_Added_Staker_DepositShares(operator, strategies, addedShares, "_newRandomOperator: failed to add delegatable shares"); assert_Snap_Added_OperatorShares(operator, strategies, addedShares, "_newRandomOperator: failed to award shares to operator"); diff --git a/src/test/integration/IntegrationDeployer.t.sol b/src/test/integration/IntegrationDeployer.t.sol index 4575d0c438..4f5b07cd7b 100644 --- a/src/test/integration/IntegrationDeployer.t.sol +++ b/src/test/integration/IntegrationDeployer.t.sol @@ -166,6 +166,11 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser { EmptyContract emptyContract = new EmptyContract(); ethPOSDeposit = new ETHPOSDepositMock(); + // Matching parameters to testnet + DELEGATION_MANAGER_MIN_WITHDRAWAL_DELAY_BLOCKS = 50; + DEALLOCATION_DELAY = 50; + ALLOCATION_CONFIGURATION_DELAY = 75; + /** * First, deploy upgradeable proxy contracts that **will point** to the implementations. Since the implementation contracts are * not yet deployed, we give these proxies an empty contract as the initial implementation, to act as if they have no code. diff --git a/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol b/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol index 98208b5a05..4f2eaab932 100644 --- a/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol +++ b/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol @@ -69,7 +69,6 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { // Create an operator set and register an operator. OperatorSet memory operatorSet = avs.createOperatorSet(strategies); operator.registerForOperatorSet(operatorSet); - operator.setAllocationDelay(1); // 3. Allocate to operator set. IAllocationManagerTypes.AllocateParams memory allocateParams = diff --git a/src/test/integration/users/User.t.sol b/src/test/integration/users/User.t.sol index fb71bfc060..83e251eb4a 100644 --- a/src/test/integration/users/User.t.sol +++ b/src/test/integration/users/User.t.sol @@ -192,7 +192,6 @@ contract User is Logger, IDelegationManagerTypes, IAllocationManagerTypes { _tryPrankAppointee_AllocationManager(IAllocationManager.setAllocationDelay.selector); allocationManager().setAllocationDelay(address(this), delay); print.gasUsed(); - rollForward({blocks: allocationManager().ALLOCATION_CONFIGURATION_DELAY()}); } /// ----------------------------------------------------------------------- From ef5a3f4a33e88ec76877f20aec3e9c4507b6362f Mon Sep 17 00:00:00 2001 From: Yash Patil Date: Thu, 2 Jan 2025 14:00:37 -0500 Subject: [PATCH 2/2] fix: roll blocks usage --- src/test/integration/IntegrationBase.t.sol | 2 +- .../integration/tests/Deposit_Delegate_Allocate.t.sol | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/integration/IntegrationBase.t.sol b/src/test/integration/IntegrationBase.t.sol index f891437688..852352e910 100644 --- a/src/test/integration/IntegrationBase.t.sol +++ b/src/test/integration/IntegrationBase.t.sol @@ -103,7 +103,7 @@ abstract contract IntegrationBase is IntegrationDeployer { operator.depositIntoEigenlayer(strategies, tokenBalances); // Roll passed the allocation configuration delay - rollForward({blocks: block.number + ALLOCATION_CONFIGURATION_DELAY}); + rollForward({blocks: ALLOCATION_CONFIGURATION_DELAY}); } assert_Snap_Added_Staker_DepositShares(operator, strategies, addedShares, "_newRandomOperator: failed to add delegatable shares"); diff --git a/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol b/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol index 4f2eaab932..48cc93ff63 100644 --- a/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol +++ b/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol @@ -66,11 +66,15 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { _upgradeEigenLayerContracts(); // Upgrade contracts if forkType is not local (AVS avs,) = _newRandomAVS(); - // Create an operator set and register an operator. + // 3. Set allocation delay for operator + operator.setAllocationDelay(1); + rollForward({blocks: ALLOCATION_CONFIGURATION_DELAY}); + + // 4. Create an operator set and register an operator. OperatorSet memory operatorSet = avs.createOperatorSet(strategies); operator.registerForOperatorSet(operatorSet); - // 3. Allocate to operator set. + // 5. Allocate to operator set. IAllocationManagerTypes.AllocateParams memory allocateParams = operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); assert_Snap_Allocations_Modified(