Skip to content

Commit

Permalink
refactor: rename -> IECDSAStakeRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
0xClandestine committed Jan 23, 2025
1 parent f0e8889 commit 970089d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Quorum {
StrategyParams[] strategies; // An array of strategy parameters to define the quorum
}

interface ECDSAStakeRegistryEventsAndErrors {
interface IECDSAStakeRegistry {
/// @notice Emitted when the system registers an operator
/// @param _operator The address of the registered operator
/// @param _avs The address of the associated AVS
Expand Down
2 changes: 1 addition & 1 deletion src/unaudited/ECDSAServiceManagerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy
import {IStakeRegistry} from "../interfaces/IStakeRegistry.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {Quorum} from "../interfaces/IECDSAStakeRegistryEventsAndErrors.sol";
import {Quorum} from "../interfaces/IECDSAStakeRegistry.sol";
import {ECDSAStakeRegistry} from "../unaudited/ECDSAStakeRegistry.sol";
import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol";
import {IAllocationManager} from
Expand Down
6 changes: 3 additions & 3 deletions src/unaudited/ECDSAStakeRegistryStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {IDelegationManager} from
import {CheckpointsUpgradeable} from
"@openzeppelin-upgrades/contracts/utils/CheckpointsUpgradeable.sol";
import {
ECDSAStakeRegistryEventsAndErrors,
IECDSAStakeRegistry,
Quorum,
StrategyParams
} from "../interfaces/IECDSAStakeRegistryEventsAndErrors.sol";
} from "../interfaces/IECDSAStakeRegistry.sol";

abstract contract ECDSAStakeRegistryStorage is ECDSAStakeRegistryEventsAndErrors {
abstract contract ECDSAStakeRegistryStorage is IECDSAStakeRegistry {
/// @notice Manages staking delegations through the DelegationManager interface
IDelegationManager internal immutable DELEGATION_MANAGER;

Expand Down
2 changes: 1 addition & 1 deletion test/unit/ECDSAServiceManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// import {ECDSAServiceManagerMock} from "../mocks/ECDSAServiceManagerMock.sol";
// import {ECDSAStakeRegistryMock} from "../mocks/ECDSAStakeRegistryMock.sol";
// import {Quorum, StrategyParams} from "../../src/interfaces/IECDSAStakeRegistryEventsAndErrors.sol";
// import {Quorum, StrategyParams} from "../../src/interfaces/IECDSAStakeRegistry.sol";

// contract MockDelegationManager {
// function operatorShares(address, address) external pure returns (uint256) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/ECDSAStakeRegistryEqualWeightUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {IDelegationManager} from
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";

import {
ECDSAStakeRegistryEventsAndErrors,
IECDSAStakeRegistry,
Quorum,
StrategyParams
} from "../../src/interfaces/IECDSAStakeRegistryEventsAndErrors.sol";
} from "../../src/interfaces/IECDSAStakeRegistry.sol";
import {ECDSAStakeRegistrySetup} from "./ECDSAStakeRegistryUnit.t.sol";
import {ECDSAStakeRegistryEqualWeight} from
"../../src/unaudited/examples/ECDSAStakeRegistryEqualWeight.sol";
Expand Down
4 changes: 2 additions & 2 deletions test/unit/ECDSAStakeRegistryPermissionedUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {IDelegationManager} from
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";

import {
ECDSAStakeRegistryEventsAndErrors,
IECDSAStakeRegistry,
Quorum,
StrategyParams
} from "../../src/interfaces/IECDSAStakeRegistryEventsAndErrors.sol";
} from "../../src/interfaces/IECDSAStakeRegistry.sol";
import {ECDSAStakeRegistrySetup} from "./ECDSAStakeRegistryUnit.t.sol";
import {ECDSAStakeRegistryPermissioned} from
"../../src/unaudited/examples/ECDSAStakeRegistryPermissioned.sol";
Expand Down
38 changes: 19 additions & 19 deletions test/unit/ECDSAStakeRegistryUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy

import {ECDSAStakeRegistry} from "../../src/unaudited/ECDSAStakeRegistry.sol";
import {
ECDSAStakeRegistryEventsAndErrors,
IECDSAStakeRegistry,
Quorum,
StrategyParams
} from "../../src/interfaces/IECDSAStakeRegistryEventsAndErrors.sol";
} from "../../src/interfaces/IECDSAStakeRegistry.sol";

contract MockServiceManager {
// solhint-disable-next-line
Expand Down Expand Up @@ -44,7 +44,7 @@ contract MockDelegationManager {
}
}

contract ECDSAStakeRegistrySetup is Test, ECDSAStakeRegistryEventsAndErrors {
contract ECDSAStakeRegistrySetup is Test, IECDSAStakeRegistry {
MockDelegationManager public mockDelegationManager;
MockServiceManager public mockServiceManager;
ECDSAStakeRegistry public registry;
Expand Down Expand Up @@ -105,7 +105,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
operators[0] = operator1;
operators[1] = operator2;

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.InvalidQuorum.selector);
vm.expectRevert(IECDSAStakeRegistry.InvalidQuorum.selector);
registry.updateQuorumConfig(invalidQuorum, operators);
}

Expand Down Expand Up @@ -145,7 +145,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {

invalidQuorum.strategies[1] =
StrategyParams({strategy: IStrategy(address(420)), multiplier: 5000});
vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.NotSorted.selector);
vm.expectRevert(IECDSAStakeRegistry.NotSorted.selector);
registry.updateQuorumConfig(invalidQuorum, operators);
}

Expand All @@ -159,7 +159,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {

invalidQuorum.strategies[1] =
StrategyParams({strategy: IStrategy(address(419)), multiplier: 5000});
vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.NotSorted.selector);
vm.expectRevert(IECDSAStakeRegistry.NotSorted.selector);
registry.updateQuorumConfig(invalidQuorum, operators);
}

Expand All @@ -171,7 +171,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
operators[0] = operator1;
operators[1] = operator2;

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.InvalidQuorum.selector);
vm.expectRevert(IECDSAStakeRegistry.InvalidQuorum.selector);
registry.updateQuorumConfig(invalidQuorum, operators);
}

Expand All @@ -189,7 +189,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
assertEq(registry.getLastCheckpointTotalWeight(), 2000);

ISignatureUtils.SignatureWithSaltAndExpiry memory signature;
vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.OperatorAlreadyRegistered.selector);
vm.expectRevert(IECDSAStakeRegistry.OperatorAlreadyRegistered.selector);
vm.prank(operator1);
registry.registerOperatorWithSignature(signature, operator1);
}
Expand Down Expand Up @@ -225,7 +225,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
function test_RevertsWhen_NotOperator_DeregisterOperator() public {
address notOperator = address(0x2);
vm.prank(notOperator);
vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.OperatorNotRegistered.selector);
vm.expectRevert(IECDSAStakeRegistry.OperatorNotRegistered.selector);
registry.deregisterOperator();
}

Expand Down Expand Up @@ -421,7 +421,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
(uint8 v, bytes32 r, bytes32 s) = vm.sign(operator1Pk, msgHash);
signatures[0] = abi.encode(v, r, s);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.LengthMismatch.selector);
vm.expectRevert(IECDSAStakeRegistry.LengthMismatch.selector);
registry.isValidSignature(msgHash, abi.encode(signers, signatures, block.number - 1));
}

Expand All @@ -430,7 +430,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
address[] memory signers = new address[](0);
bytes[] memory signatures = new bytes[](0);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.InvalidLength.selector);
vm.expectRevert(IECDSAStakeRegistry.InvalidLength.selector);
registry.isValidSignature(dataHash, abi.encode(signers, signatures, block.number - 1));
}

Expand All @@ -445,7 +445,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
(v, r, s) = vm.sign(operator2Pk, msgHash);
signatures[0] = abi.encodePacked(r, s, v);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.NotSorted.selector);
vm.expectRevert(IECDSAStakeRegistry.NotSorted.selector);
registry.isValidSignature(msgHash, abi.encode(signers, signatures, block.number - 1));
}

Expand All @@ -463,7 +463,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
signatures[0] = abi.encodePacked(r, s, v);
signatures[1] = abi.encodePacked(r, s, v);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.NotSorted.selector);
vm.expectRevert(IECDSAStakeRegistry.NotSorted.selector);
registry.isValidSignature(msgHash, abi.encode(signers, signatures, block.number - 1));
}

Expand All @@ -474,7 +474,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
bytes[] memory signatures = new bytes[](1);
signatures[0] = "invalid-signature";

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.InvalidSignature.selector);
vm.expectRevert(IECDSAStakeRegistry.InvalidSignature.selector);
registry.isValidSignature(dataHash, abi.encode(signers, signatures, block.number - 1));
}

Expand Down Expand Up @@ -502,7 +502,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
abi.encode(50)
);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.InsufficientSignedStake.selector);
vm.expectRevert(IECDSAStakeRegistry.InsufficientSignedStake.selector);
registry.isValidSignature(msgHash, abi.encode(signers, signatures, block.number - 1));
}

Expand All @@ -514,7 +514,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
signers[1] = operator2;
bytes[] memory signatures = new bytes[](1);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.LengthMismatch.selector);
vm.expectRevert(IECDSAStakeRegistry.LengthMismatch.selector);
registry.isValidSignature(dataHash, abi.encode(signers, signatures, referenceBlock));
}

Expand All @@ -524,7 +524,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
address[] memory signers = new address[](0);
bytes[] memory signatures = new bytes[](0);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.InvalidLength.selector);
vm.expectRevert(IECDSAStakeRegistry.InvalidLength.selector);
registry.isValidSignature(dataHash, abi.encode(signers, signatures, referenceBlock));
}

Expand All @@ -541,7 +541,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
(v, r, s) = vm.sign(operator2Pk, msgHash);
signatures[0] = abi.encodePacked(r, s, v);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.NotSorted.selector);
vm.expectRevert(IECDSAStakeRegistry.NotSorted.selector);
registry.isValidSignature(msgHash, abi.encode(signers, signatures, referenceBlock));
}

Expand Down Expand Up @@ -570,7 +570,7 @@ contract ECDSAStakeRegistryTest is ECDSAStakeRegistrySetup {
abi.encode(50)
);

vm.expectRevert(ECDSAStakeRegistryEventsAndErrors.InsufficientSignedStake.selector);
vm.expectRevert(IECDSAStakeRegistry.InsufficientSignedStake.selector);
registry.isValidSignature(msgHash, abi.encode(signers, signatures, referenceBlock));
}

Expand Down

0 comments on commit 970089d

Please sign in to comment.