Skip to content

Commit 91a4ede

Browse files
committed
fix: remove mutable tos
1 parent dda8978 commit 91a4ede

File tree

3 files changed

+14
-71
lines changed

3 files changed

+14
-71
lines changed

src/contracts/cloud/ComputeRegistry.sol

Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pragma solidity ^0.8.27;
33

44
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
5-
import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
65

76
import "../mixins/PermissionControllerMixin.sol";
87
import "../mixins/SignatureUtilsMixin.sol";
@@ -15,13 +14,7 @@ import "./ComputeRegistryStorage.sol";
1514
* @notice This contract handles permissionless (de)registration of AVS operator sets to the EigenCompute Operator.
1615
* It enables AVSs to easily access managed operator infrastructure as part of EigenCloud for quick bootstrapping.
1716
*/
18-
contract ComputeRegistry is
19-
Initializable,
20-
OwnableUpgradeable,
21-
ComputeRegistryStorage,
22-
PermissionControllerMixin,
23-
SignatureUtilsMixin
24-
{
17+
contract ComputeRegistry is Initializable, ComputeRegistryStorage, PermissionControllerMixin, SignatureUtilsMixin {
2518
using OperatorSetLib for OperatorSet;
2619

2720
/**
@@ -52,32 +45,23 @@ contract ComputeRegistry is
5245
* @param _releaseManager The ReleaseManager contract address
5346
* @param _allocationManager The AllocationManager contract address
5447
* @param _permissionController The PermissionController contract address
48+
* @param _tosHash The immutable hash of the Terms of Service
5549
* @param _version The semantic version of the contract
5650
*/
5751
constructor(
5852
IReleaseManager _releaseManager,
5953
IAllocationManager _allocationManager,
6054
IPermissionController _permissionController,
55+
bytes32 _tosHash,
6156
string memory _version
6257
)
63-
ComputeRegistryStorage(_releaseManager, _allocationManager)
58+
ComputeRegistryStorage(_releaseManager, _allocationManager, _tosHash)
6459
PermissionControllerMixin(_permissionController)
6560
SignatureUtilsMixin(_version)
6661
{
6762
_disableInitializers();
6863
}
6964

70-
/**
71-
* @notice Initializes the contract
72-
* @param _owner The owner of the contract
73-
* @param _tosHash The hash of the Terms of Service that AVS operators must sign
74-
*/
75-
function initialize(address _owner, bytes32 _tosHash) external initializer {
76-
__Ownable_init();
77-
transferOwnership(_owner);
78-
_setTosHash(_tosHash);
79-
}
80-
8165
/**
8266
*
8367
* EXTERNAL FUNCTIONS
@@ -110,9 +94,9 @@ contract ComputeRegistry is
11094
// Register the operator set
11195
isOperatorSetRegistered[operatorSetKey] = true;
11296
_operatorSetTosSignature[operatorSetKey] =
113-
TOSSignature({signer: msg.sender, tosHash: tosHash, signature: signature});
97+
TOSSignature({signer: msg.sender, tosHash: TOS_HASH, signature: signature});
11498

115-
emit OperatorSetRegistered(operatorSet, msg.sender, tosHash, signature);
99+
emit OperatorSetRegistered(operatorSet, msg.sender, TOS_HASH, signature);
116100
}
117101

118102
/**
@@ -130,38 +114,9 @@ contract ComputeRegistry is
130114
emit OperatorSetDeregistered(operatorSet);
131115
}
132116

133-
/**
134-
* @notice Updates the Terms of Service hash
135-
* @param _tosHash The new Terms of Service hash
136-
* @dev Only callable by the contract owner
137-
*/
138-
function setTosHash(
139-
bytes32 _tosHash
140-
) external onlyOwner {
141-
_setTosHash(_tosHash);
142-
}
143-
144-
/**
145-
*
146-
* INTERNAL FUNCTIONS
147-
*
148-
*/
149-
150-
/**
151-
* @dev Internal function to set the Terms of Service hash
152-
* @param _tosHash The new Terms of Service hash
153-
*/
154-
function _setTosHash(
155-
bytes32 _tosHash
156-
) internal {
157-
tosHash = _tosHash;
158-
emit TosHashSet(_tosHash);
159-
}
160-
161117
/**
162118
*
163119
* VIEW FUNCTIONS
164-
*
165120
*/
166121

167122
/**
@@ -188,7 +143,7 @@ contract ComputeRegistry is
188143
keccak256(
189144
abi.encode(
190145
TOS_AGREEMENT_TYPEHASH,
191-
tosHash,
146+
TOS_HASH,
192147
operatorSet.avs,
193148
operatorSet.id,
194149
signer,

src/contracts/cloud/ComputeRegistryStorage.sol

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ abstract contract ComputeRegistryStorage is IComputeRegistry {
2222
/// @notice The AllocationManager contract
2323
IAllocationManager public immutable ALLOCATION_MANAGER;
2424

25-
// Storage
26-
2725
/// @notice The hash of the Terms of Service that AVS operators must sign
28-
bytes32 public tosHash;
26+
bytes32 public immutable TOS_HASH;
27+
28+
// Storage
2929

3030
/// @notice Mapping to track if an operator set is registered for compute
3131
/// @dev operatorSetKey => isRegistered
@@ -40,10 +40,11 @@ abstract contract ComputeRegistryStorage is IComputeRegistry {
4040
* variables without shifting down storage in the inheritance chain.
4141
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
4242
*/
43-
uint256[47] private __gap;
43+
uint256[48] private __gap;
4444

45-
constructor(IReleaseManager _releaseManager, IAllocationManager _allocationManager) {
45+
constructor(IReleaseManager _releaseManager, IAllocationManager _allocationManager, bytes32 _tosHash) {
4646
RELEASE_MANAGER = _releaseManager;
4747
ALLOCATION_MANAGER = _allocationManager;
48+
TOS_HASH = _tosHash;
4849
}
4950
}

src/contracts/interfaces/IComputeRegistry.sol

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ interface IComputeRegistryEvents {
4141
/// @notice Emitted when an operator set is deregistered from compute
4242
/// @param operatorSet The operator set that was deregistered
4343
event OperatorSetDeregistered(OperatorSet indexed operatorSet);
44-
45-
/// @notice Emitted when the Terms of Service hash is updated
46-
/// @param tosHash The new Terms of Service hash
47-
event TosHashSet(bytes32 tosHash);
4844
}
4945

5046
interface IComputeRegistry is IComputeRegistryErrors, IComputeRegistryEvents, IComputeRegistryTypes {
@@ -74,15 +70,6 @@ interface IComputeRegistry is IComputeRegistryErrors, IComputeRegistryEvents, IC
7470
OperatorSet calldata operatorSet
7571
) external;
7672

77-
/**
78-
* @notice Updates the Terms of Service hash
79-
* @param tosHash The new Terms of Service hash
80-
* @dev Only callable by the contract owner
81-
*/
82-
function setTosHash(
83-
bytes32 tosHash
84-
) external;
85-
8673
/**
8774
*
8875
* VIEW FUNCTIONS
@@ -117,7 +104,7 @@ interface IComputeRegistry is IComputeRegistryErrors, IComputeRegistryEvents, IC
117104
* @notice Returns the hash of the Terms of Service
118105
* @return The hash of the Terms of Service that must be signed
119106
*/
120-
function tosHash() external view returns (bytes32);
107+
function TOS_HASH() external view returns (bytes32);
121108

122109
/**
123110
* @notice Checks if an operator set is registered for compute

0 commit comments

Comments
 (0)