From b1f706bde90fc8d0851a9ec4bcae29cc0abc948e Mon Sep 17 00:00:00 2001 From: steven <12021290+stevennevins@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:18:02 -0400 Subject: [PATCH] perf: refactor apk modifiers to use internal functions (#268) * fix: deprecated struct field for earning receiver * perf: move modifier logic to internal function --- src/BLSApkRegistry.sol | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/BLSApkRegistry.sol b/src/BLSApkRegistry.sol index 4fd0e2fb..2bad724b 100644 --- a/src/BLSApkRegistry.sol +++ b/src/BLSApkRegistry.sol @@ -12,10 +12,7 @@ contract BLSApkRegistry is BLSApkRegistryStorage { /// @notice when applied to a function, only allows the RegistryCoordinator to call it modifier onlyRegistryCoordinator() { - require( - msg.sender == address(registryCoordinator), - "BLSApkRegistry.onlyRegistryCoordinator: caller is not the registry coordinator" - ); + _checkRegistryCoordinator(); _; } @@ -281,4 +278,11 @@ contract BLSApkRegistry is BLSApkRegistryStorage { function getOperatorId(address operator) public view returns (bytes32) { return operatorToPubkeyHash[operator]; } + + function _checkRegistryCoordinator() internal view { + require( + msg.sender == address(registryCoordinator), + "BLSApkRegistry.onlyRegistryCoordinator: caller is not the registry coordinator" + ); + } }