From 96311bba51ec332274336dd026693016d9b8d619 Mon Sep 17 00:00:00 2001 From: ChaoticWalrus <93558947+ChaoticWalrus@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:00:46 -0800 Subject: [PATCH] chore: shorten variable name that is quite clear from context `pubkeyRegistrationParams` => `params` see discussion here: https://github.com/Layr-Labs/eigenlayer-middleware/pull/100#discussion_r1424469756 --- src/BLSApkRegistry.sol | 26 +++++++++++++------------- src/RegistryCoordinator.sol | 18 +++++++++--------- src/interfaces/IBLSApkRegistry.sol | 4 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/BLSApkRegistry.sol b/src/BLSApkRegistry.sol index 1dd52d2b..060de2d0 100644 --- a/src/BLSApkRegistry.sol +++ b/src/BLSApkRegistry.sol @@ -96,13 +96,13 @@ contract BLSApkRegistry is BLSApkRegistryStorage { /** * @notice Called by the RegistryCoordinator register an operator as the owner of a BLS public key. * @param operator is the operator for whom the key is being registered - * @param pubkeyRegistrationParams contains the G1 & G2 public keys of the operator, and a signature proving their ownership + * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership */ function registerBLSPublicKey( address operator, - PubkeyRegistrationParams calldata pubkeyRegistrationParams + PubkeyRegistrationParams calldata params ) external onlyRegistryCoordinator returns (bytes32 operatorId) { - bytes32 pubkeyHash = BN254.hashG1Point(pubkeyRegistrationParams.pubkeyG1); + bytes32 pubkeyHash = BN254.hashG1Point(params.pubkeyG1); require( pubkeyHash != ZERO_PK_HASH, "BLSApkRegistry.registerBLSPublicKey: cannot register zero pubkey" ); @@ -120,29 +120,29 @@ contract BLSApkRegistry is BLSApkRegistryStorage { // gamma = h(sigma, P, P', H(m)) uint256 gamma = uint256(keccak256(abi.encodePacked( - pubkeyRegistrationParams.pubkeyRegistrationSignature.X, - pubkeyRegistrationParams.pubkeyRegistrationSignature.Y, - pubkeyRegistrationParams.pubkeyG1.X, - pubkeyRegistrationParams.pubkeyG1.Y, - pubkeyRegistrationParams.pubkeyG2.X, - pubkeyRegistrationParams.pubkeyG2.Y, + params.pubkeyRegistrationSignature.X, + params.pubkeyRegistrationSignature.Y, + params.pubkeyG1.X, + params.pubkeyG1.Y, + params.pubkeyG2.X, + params.pubkeyG2.Y, messageHash.X, messageHash.Y ))) % BN254.FR_MODULUS; // e(sigma + P * gamma, [-1]_2) = e(H(m) + [1]_1 * gamma, P') require(BN254.pairing( - pubkeyRegistrationParams.pubkeyRegistrationSignature.plus(pubkeyRegistrationParams.pubkeyG1.scalar_mul(gamma)), + params.pubkeyRegistrationSignature.plus(params.pubkeyG1.scalar_mul(gamma)), BN254.negGeneratorG2(), messageHash.plus(BN254.generatorG1().scalar_mul(gamma)), - pubkeyRegistrationParams.pubkeyG2 + params.pubkeyG2 ), "BLSApkRegistry.registerBLSPublicKey: either the G1 signature is wrong, or G1 and G2 private key do not match"); - operatorToPubkey[operator] = pubkeyRegistrationParams.pubkeyG1; + operatorToPubkey[operator] = params.pubkeyG1; operatorToPubkeyHash[operator] = pubkeyHash; pubkeyHashToOperator[pubkeyHash] = operator; - emit NewPubkeyRegistration(operator, pubkeyRegistrationParams.pubkeyG1, pubkeyRegistrationParams.pubkeyG2); + emit NewPubkeyRegistration(operator, params.pubkeyG1, params.pubkeyG2); return pubkeyHash; } diff --git a/src/RegistryCoordinator.sol b/src/RegistryCoordinator.sol index f4c4184e..0eef3632 100644 --- a/src/RegistryCoordinator.sol +++ b/src/RegistryCoordinator.sol @@ -147,21 +147,21 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo * @notice Registers msg.sender as an operator for one or more quorums. If any quorum reaches its maximum * operator capacity, this method will fail. * @param quorumNumbers is an ordered byte array containing the quorum numbers being registered for - * @param pubkeyRegistrationParams contains the G1 & G2 public keys of the operator, and a signature proving their ownership - * @dev the `pubkeyRegistrationParams` input param is ignored if the caller has previously registered a public key + * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership + * @dev the `params` input param is ignored if the caller has previously registered a public key */ function registerOperator( bytes calldata quorumNumbers, string calldata socket, - IBLSApkRegistry.PubkeyRegistrationParams calldata pubkeyRegistrationParams + IBLSApkRegistry.PubkeyRegistrationParams calldata params ) external onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR) { /** * IF the operator has never registered a pubkey before, THEN register their pubkey - * OTHERWISE, simply ignore the provided `pubkeyRegistrationParams` + * OTHERWISE, simply ignore the provided `params` */ bytes32 operatorId = blsApkRegistry.getOperatorId(msg.sender); if (operatorId == 0) { - operatorId = blsApkRegistry.registerBLSPublicKey(msg.sender, pubkeyRegistrationParams); + operatorId = blsApkRegistry.registerBLSPublicKey(msg.sender, params); } // Register the operator in each of the registry contracts @@ -192,16 +192,16 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo * @notice Registers msg.sender as an operator for one or more quorums. If any quorum reaches its maximum operator * capacity, `operatorKickParams` is used to replace an old operator with the new one. * @param quorumNumbers is an ordered byte array containing the quorum numbers being registered for - * @param pubkeyRegistrationParams contains the G1 & G2 public keys of the operator, and a signature proving their ownership + * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership * @param operatorKickParams are used to determine which operator is removed to maintain quorum capacity as the * operator registers for quorums. * @param churnApproverSignature is the signature of the churnApprover on the operator kick params - * @dev the `pubkeyRegistrationParams` input param is ignored if the caller has previously registered a public key + * @dev the `params` input param is ignored if the caller has previously registered a public key */ function registerOperatorWithChurn( bytes calldata quorumNumbers, string calldata socket, - IBLSApkRegistry.PubkeyRegistrationParams calldata pubkeyRegistrationParams, + IBLSApkRegistry.PubkeyRegistrationParams calldata params, OperatorKickParam[] calldata operatorKickParams, SignatureWithSaltAndExpiry memory churnApproverSignature ) external onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR) { @@ -213,7 +213,7 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo */ bytes32 operatorId = blsApkRegistry.getOperatorId(msg.sender); if (operatorId == 0) { - operatorId = blsApkRegistry.registerBLSPublicKey(msg.sender, pubkeyRegistrationParams); + operatorId = blsApkRegistry.registerBLSPublicKey(msg.sender, params); } // Verify the churn approver's signature for the registering operator and kick params diff --git a/src/interfaces/IBLSApkRegistry.sol b/src/interfaces/IBLSApkRegistry.sol index 47a9dd47..b35b45fe 100644 --- a/src/interfaces/IBLSApkRegistry.sol +++ b/src/interfaces/IBLSApkRegistry.sol @@ -98,11 +98,11 @@ interface IBLSApkRegistry is IRegistry { /** * @notice Called by the RegistryCoordinator register an operator as the owner of a BLS public key. * @param operator is the operator for whom the key is being registered - * @param pubkeyRegistrationParams contains the G1 & G2 public keys of the operator, and a signature proving their ownership + * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership */ function registerBLSPublicKey( address operator, - PubkeyRegistrationParams calldata pubkeyRegistrationParams + PubkeyRegistrationParams calldata params ) external returns (bytes32 operatorId); /**