Skip to content

Commit 9ff21a7

Browse files
committed
Make pubkey uniqueness per megapool
1 parent 10f2750 commit 9ff21a7

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

contracts/contract/megapool/RocketMegapoolManager.sol

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ contract RocketMegapoolManager is RocketBase, RocketMegapoolManagerInterface {
3232
return getUint(setCountKey);
3333
}
3434

35-
/// @notice Get a megapool address by validator pubkey
36-
/// @param _pubkey The pubkey to query
37-
function getMegapoolByPubkey(bytes calldata _pubkey) override external view returns (address) {
38-
return getAddress(keccak256(abi.encodePacked("validator.megapool", _pubkey)));
39-
}
40-
4135
/// @notice Adds a validator record to the global megapool validator set
4236
/// @param _megapoolAddress Address of the megapool which manages this validator
4337
/// @param _validatorId Internal validator ID of the new validator
@@ -47,7 +41,7 @@ contract RocketMegapoolManager is RocketBase, RocketMegapoolManagerInterface {
4741
uint256 encoded = (uint256(uint160(_megapoolAddress)) << 96) | _validatorId;
4842
setUint(keccak256(abi.encodePacked("megapool.validator.set", index)), encoded);
4943
// Add pubkey => megapool mapping and ensure uniqueness
50-
bytes32 key = keccak256(abi.encodePacked("validator.megapool", _pubkey));
44+
bytes32 key = keccak256(abi.encodePacked("validator.megapool", _megapoolAddress, _pubkey));
5145
require(getAddress(key) == address(0x0), "Pubkey in use");
5246
setAddress(key, _megapoolAddress);
5347
}

contracts/interface/megapool/RocketMegapoolManagerInterface.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ interface RocketMegapoolManagerInterface {
1212
}
1313

1414
function getValidatorCount() external view returns (uint256);
15-
function getMegapoolByPubkey(bytes calldata _pubkey) external view returns (address);
1615
function addValidator(address _megapoolAddress, uint32 _validatorId, bytes calldata _pubkey) external;
1716
function getLastChallenger() external view returns (address);
1817
function getValidatorInfo(uint256 _index) external view returns (bytes memory pubkey, RocketMegapoolStorageLayout.ValidatorInfo memory validatorInfo, address megapool, uint32 validatorId);

0 commit comments

Comments
 (0)