@@ -43,6 +43,17 @@ contract CrossChainRegistry is
4343 _;
4444 }
4545
46+ /**
47+ * @dev Validates that the chainIDs array is not empty
48+ * @param chainIDs The array of chain IDs to validate
49+ */
50+ modifier nonEmptyChainIDsArray (
51+ uint32 [] calldata chainIDs
52+ ) {
53+ require (chainIDs.length > 0 , EmptyChainIDsArray ());
54+ _;
55+ }
56+
4657 /**
4758 *
4859 * INITIALIZING FUNCTIONS
@@ -183,6 +194,7 @@ contract CrossChainRegistry is
183194 onlyWhenNotPaused (PAUSED_TRANSPORT_DESTINATIONS)
184195 checkCanCall (operatorSet.avs)
185196 isValidOperatorSet (operatorSet)
197+ nonEmptyChainIDsArray (chainIDs)
186198 {
187199 bytes32 operatorSetKey = operatorSet.key ();
188200
@@ -205,6 +217,7 @@ contract CrossChainRegistry is
205217 onlyWhenNotPaused (PAUSED_TRANSPORT_DESTINATIONS)
206218 checkCanCall (operatorSet.avs)
207219 isValidOperatorSet (operatorSet)
220+ nonEmptyChainIDsArray (chainIDs)
208221 {
209222 bytes32 operatorSetKey = operatorSet.key ();
210223
@@ -222,33 +235,41 @@ contract CrossChainRegistry is
222235 }
223236
224237 /// @inheritdoc ICrossChainRegistry
225- function addChainIDToWhitelist (
226- uint32 chainID
227- ) external onlyOwner onlyWhenNotPaused (PAUSED_CHAIN_WHITELIST) {
228- // Validate chainID
229- require (chainID != 0 , InvalidChainId ());
230- // Check if already whitelisted
231- require (! _whitelistedChainIDs.contains (chainID), ChainIDAlreadyWhitelisted ());
238+ function addChainIDsToWhitelist (
239+ uint32 [] calldata chainIDs
240+ ) external onlyOwner onlyWhenNotPaused (PAUSED_CHAIN_WHITELIST) nonEmptyChainIDsArray (chainIDs) {
241+ for (uint256 i = 0 ; i < chainIDs.length ; i++ ) {
242+ uint32 chainID = chainIDs[i];
243+
244+ // Validate chainID
245+ require (chainID != 0 , InvalidChainId ());
246+ // Check if already whitelisted
247+ require (! _whitelistedChainIDs.contains (chainID), ChainIDAlreadyWhitelisted ());
232248
233- // Add to whitelist
234- _whitelistedChainIDs.add (chainID);
249+ // Add to whitelist
250+ _whitelistedChainIDs.add (chainID);
235251
236- emit ChainIDAddedToWhitelist (chainID);
252+ emit ChainIDAddedToWhitelist (chainID);
253+ }
237254 }
238255
239256 /// @inheritdoc ICrossChainRegistry
240- function removeChainIDFromWhitelist (
241- uint32 chainID
242- ) external onlyOwner onlyWhenNotPaused (PAUSED_CHAIN_WHITELIST) {
243- // Validate chainID
244- require (chainID != 0 , InvalidChainId ());
245- // Check if whitelisted
246- require (_whitelistedChainIDs.contains (chainID), ChainIDNotWhitelisted ());
257+ function removeChainIDsFromWhitelist (
258+ uint32 [] calldata chainIDs
259+ ) external onlyOwner onlyWhenNotPaused (PAUSED_CHAIN_WHITELIST) nonEmptyChainIDsArray (chainIDs) {
260+ for (uint256 i = 0 ; i < chainIDs.length ; i++ ) {
261+ uint32 chainID = chainIDs[i];
247262
248- // Remove from whitelist
249- _whitelistedChainIDs.remove (chainID);
263+ // Validate chainID
264+ require (chainID != 0 , InvalidChainId ());
265+ // Check if whitelisted
266+ require (_whitelistedChainIDs.contains (chainID), ChainIDNotWhitelisted ());
250267
251- emit ChainIDRemovedFromWhitelist (chainID);
268+ // Remove from whitelist
269+ _whitelistedChainIDs.remove (chainID);
270+
271+ emit ChainIDRemovedFromWhitelist (chainID);
272+ }
252273 }
253274
254275 /**
0 commit comments