From d716d155e31aa85ff9242c0ee08d28d6b9becd3e Mon Sep 17 00:00:00 2001 From: Kartik Chopra Date: Tue, 10 Dec 2024 08:36:22 -0500 Subject: [PATCH 1/2] feat: restrict resetting of BLS keys --- contracts/contracts/core/ProviderRegistry.sol | 1 + contracts/contracts/interfaces/IProviderRegistry.sol | 1 + 2 files changed, 2 insertions(+) diff --git a/contracts/contracts/core/ProviderRegistry.sol b/contracts/contracts/core/ProviderRegistry.sol index 3d5c63770..dbea39cd5 100644 --- a/contracts/contracts/core/ProviderRegistry.sol +++ b/contracts/contracts/core/ProviderRegistry.sol @@ -310,6 +310,7 @@ contract ProviderRegistry is for (uint256 i = 0; i < numKeys; ++i) { bytes memory key = blsPublicKeys[i]; require(key.length == 48, InvalidBLSPublicKeyLength(key.length, 48)); + require(!blockBuilderBLSKeyToAddress[key], BLSKeyAlreadyRegistered(key)); blockBuilderBLSKeyToAddress[key] = provider; } eoaToBlsPubkeys[provider] = blsPublicKeys; diff --git a/contracts/contracts/interfaces/IProviderRegistry.sol b/contracts/contracts/interfaces/IProviderRegistry.sol index 089060927..694f38342 100644 --- a/contracts/contracts/interfaces/IProviderRegistry.sol +++ b/contracts/contracts/interfaces/IProviderRegistry.sol @@ -60,6 +60,7 @@ interface IProviderRegistry { error ProviderCommitmentsPending(address sender, uint256 numPending); error StakeTransferFailed(address sender, uint256 amount); error ProviderAlreadyRegistered(address sender); + error BLSKeyAlreadyRegistered(bytes blsKey); error InsufficientStake(uint256 stake, uint256 minStake); error InvalidBLSPublicKeyLength(uint256 length, uint256 expectedLength); error ProviderNotRegistered(address sender); From 48dd2ee908caaa1df7c7c1325db4b274b3c47ec2 Mon Sep 17 00:00:00 2001 From: Kartik Chopra Date: Tue, 10 Dec 2024 08:50:32 -0500 Subject: [PATCH 2/2] chore: fixes guard --- contracts/contracts/core/ProviderRegistry.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/contracts/core/ProviderRegistry.sol b/contracts/contracts/core/ProviderRegistry.sol index dbea39cd5..57e63a81e 100644 --- a/contracts/contracts/core/ProviderRegistry.sol +++ b/contracts/contracts/core/ProviderRegistry.sol @@ -310,7 +310,7 @@ contract ProviderRegistry is for (uint256 i = 0; i < numKeys; ++i) { bytes memory key = blsPublicKeys[i]; require(key.length == 48, InvalidBLSPublicKeyLength(key.length, 48)); - require(!blockBuilderBLSKeyToAddress[key], BLSKeyAlreadyRegistered(key)); + require(blockBuilderBLSKeyToAddress[key] == address(0), BLSKeyAlreadyRegistered(key)); blockBuilderBLSKeyToAddress[key] = provider; } eoaToBlsPubkeys[provider] = blsPublicKeys;