From 447a396bd40da47f20b179f462228f842b2f6b39 Mon Sep 17 00:00:00 2001 From: steven Date: Thu, 6 Jun 2024 07:06:26 -0400 Subject: [PATCH 1/2] fix: deprecated struct field for earning receiver --- test/integration/CoreRegistration.t.sol | 2 +- test/integration/User.t.sol | 2 +- test/mocks/DelegationMock.sol | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/test/integration/CoreRegistration.t.sol b/test/integration/CoreRegistration.t.sol index 3c0561f3..5998025c 100644 --- a/test/integration/CoreRegistration.t.sol +++ b/test/integration/CoreRegistration.t.sol @@ -102,7 +102,7 @@ contract Test_CoreRegistration is MockAVSDeployer { cheats.prank(operator); delegationManager.registerAsOperator( IDelegationManager.OperatorDetails({ - earningsReceiver: operator, + __deprecated_earningsReceiver: operator, delegationApprover: address(0), stakerOptOutWindowBlocks: 0 }), diff --git a/test/integration/User.t.sol b/test/integration/User.t.sol index fbb55198..2f89ab1a 100644 --- a/test/integration/User.t.sol +++ b/test/integration/User.t.sol @@ -244,7 +244,7 @@ contract User is Test { _log("registerAsOperator (core)"); IDelegationManager.OperatorDetails memory details = IDelegationManager.OperatorDetails({ - earningsReceiver: address(this), + __deprecated_earningsReceiver: address(this), delegationApprover: address(0), stakerOptOutWindowBlocks: 0 }); diff --git a/test/mocks/DelegationMock.sol b/test/mocks/DelegationMock.sol index 02cb4634..88cd9d20 100644 --- a/test/mocks/DelegationMock.sol +++ b/test/mocks/DelegationMock.sol @@ -58,7 +58,7 @@ contract DelegationMock is IDelegationManager { function operatorDetails(address operator) external pure returns (OperatorDetails memory) { OperatorDetails memory returnValue = OperatorDetails({ - earningsReceiver: operator, + __deprecated_earningsReceiver: operator, delegationApprover: operator, stakerOptOutWindowBlocks: 0 }); @@ -171,8 +171,6 @@ contract DelegationMock is IDelegationManager { bool[] calldata receiveAsTokens ) external {} - function migrateQueuedWithdrawals(IStrategyManager.DeprecatedStruct_QueuedWithdrawal[] memory withdrawalsToQueue) external {} - // onlyDelegationManager functions in StrategyManager function addShares( IStrategyManager strategyManager, From 94929638e303dc8526c7de47902d2686b606a3c2 Mon Sep 17 00:00:00 2001 From: steven Date: Thu, 6 Jun 2024 07:41:26 -0400 Subject: [PATCH 2/2] perf: move modifier logic to internal function --- src/IndexRegistry.sol | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/IndexRegistry.sol b/src/IndexRegistry.sol index 4e63e78a..8df2c0a1 100644 --- a/src/IndexRegistry.sol +++ b/src/IndexRegistry.sol @@ -12,7 +12,7 @@ contract IndexRegistry is IndexRegistryStorage { /// @notice when applied to a function, only allows the RegistryCoordinator to call it modifier onlyRegistryCoordinator() { - require(msg.sender == address(registryCoordinator), "IndexRegistry.onlyRegistryCoordinator: caller is not the registry coordinator"); + _checkRegistryCoordinator(); _; } @@ -340,4 +340,8 @@ contract IndexRegistry is IndexRegistryStorage { function totalOperatorsForQuorum(uint8 quorumNumber) external view returns (uint32){ return _latestQuorumUpdate(quorumNumber).numOperators; } + + function _checkRegistryCoordinator() internal view { + require(msg.sender == address(registryCoordinator), "IndexRegistry.onlyRegistryCoordinator: caller is not the registry coordinator"); + } }