Skip to content

Commit e8b7ad1

Browse files
committed
refactor: cleaner usage of operator set key
1 parent e6c0c5c commit e8b7ad1

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/multichain/CrossChainRegistry.sol

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,8 @@ contract CrossChainRegistry is
108108
checkCanCall(operatorSet.avs)
109109
isValidOperatorSet(operatorSet)
110110
{
111-
bytes32 operatorSetKey = operatorSet.key();
112-
113111
// Add to active generation reservations
114-
require(_activeGenerationReservations.add(operatorSetKey), GenerationReservationAlreadyExists());
112+
require(_activeGenerationReservations.add(operatorSet.key()), GenerationReservationAlreadyExists());
115113
emit GenerationReservationMade(operatorSet);
116114

117115
// Set the operator table calculator
@@ -129,10 +127,8 @@ contract CrossChainRegistry is
129127
checkCanCall(operatorSet.avs)
130128
isValidOperatorSet(operatorSet)
131129
{
132-
bytes32 operatorSetKey = operatorSet.key();
133-
134130
// Remove from active generation reservations
135-
require(_activeGenerationReservations.remove(operatorSetKey), GenerationReservationDoesNotExist());
131+
require(_activeGenerationReservations.remove(operatorSet.key()), GenerationReservationDoesNotExist());
136132
emit GenerationReservationRemoved(operatorSet);
137133

138134
// Remove the operator table calculator
@@ -151,10 +147,8 @@ contract CrossChainRegistry is
151147
checkCanCall(operatorSet.avs)
152148
isValidOperatorSet(operatorSet)
153149
{
154-
bytes32 operatorSetKey = operatorSet.key();
155-
156150
// Check if generation reservation exists
157-
require(_activeGenerationReservations.contains(operatorSetKey), GenerationReservationDoesNotExist());
151+
require(_activeGenerationReservations.contains(operatorSet.key()), GenerationReservationDoesNotExist());
158152

159153
// Set the operator table calculator
160154
_setOperatorTableCalculator(operatorSet, operatorTableCalculator, false);
@@ -170,10 +164,8 @@ contract CrossChainRegistry is
170164
checkCanCall(operatorSet.avs)
171165
isValidOperatorSet(operatorSet)
172166
{
173-
bytes32 operatorSetKey = operatorSet.key();
174-
175167
// Check if generation reservation exists
176-
require(_activeGenerationReservations.contains(operatorSetKey), GenerationReservationDoesNotExist());
168+
require(_activeGenerationReservations.contains(operatorSet.key()), GenerationReservationDoesNotExist());
177169

178170
// Set the operator set config
179171
_setOperatorSetConfig(operatorSet, config, false);
@@ -299,8 +291,7 @@ contract CrossChainRegistry is
299291
// Validate the operator table calculator
300292
require(address(operatorTableCalculator) != address(0), InvalidOperatorTableCalculator());
301293
}
302-
bytes32 operatorSetKey = operatorSet.key();
303-
_operatorTableCalculators[operatorSetKey] = operatorTableCalculator;
294+
_operatorTableCalculators[operatorSet.key()] = operatorTableCalculator;
304295
emit OperatorTableCalculatorSet(operatorSet, operatorTableCalculator);
305296
}
306297

@@ -320,8 +311,7 @@ contract CrossChainRegistry is
320311
require(config.owner != address(0), InputAddressZero());
321312
require(config.maxStalenessPeriod != 0, StalenessPeriodZero());
322313
}
323-
bytes32 operatorSetKey = operatorSet.key();
324-
_operatorSetConfigs[operatorSetKey] = config;
314+
_operatorSetConfigs[operatorSet.key()] = config;
325315
emit OperatorSetConfigSet(operatorSet, config);
326316
}
327317

0 commit comments

Comments
 (0)