Skip to content

Commit 91ada6a

Browse files
committed
perf: move modifier logic to internal function
1 parent 447a396 commit 91ada6a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/BLSApkRegistry.sol

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
1212

1313
/// @notice when applied to a function, only allows the RegistryCoordinator to call it
1414
modifier onlyRegistryCoordinator() {
15-
require(
16-
msg.sender == address(registryCoordinator),
17-
"BLSApkRegistry.onlyRegistryCoordinator: caller is not the registry coordinator"
18-
);
15+
_checkRegistryCoordinator();
1916
_;
2017
}
2118

@@ -281,4 +278,11 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
281278
function getOperatorId(address operator) public view returns (bytes32) {
282279
return operatorToPubkeyHash[operator];
283280
}
281+
282+
function _checkRegistryCoordinator() internal view {
283+
require(
284+
msg.sender == address(registryCoordinator),
285+
"BLSApkRegistry.onlyRegistryCoordinator: caller is not the registry coordinator"
286+
);
287+
}
284288
}

0 commit comments

Comments
 (0)