-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add upgradability to IndexRegistry and PubkeyRegistry (#216)
* init * fix storage gap
- Loading branch information
Showing
7 changed files
with
83 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity =0.8.12; | ||
|
||
import "../interfaces/IBLSPubkeyRegistry.sol"; | ||
import "../interfaces/IRegistryCoordinator.sol"; | ||
import "../interfaces/IBLSPublicKeyCompendium.sol"; | ||
|
||
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol"; | ||
|
||
abstract contract BLSPubkeyRegistryStorage is Initializable, IBLSPubkeyRegistry { | ||
/// @notice the hash of the zero pubkey aka BN254.G1Point(0,0) | ||
bytes32 internal constant ZERO_PK_HASH = hex"ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5"; | ||
/// @notice the registry coordinator contract | ||
IRegistryCoordinator public immutable registryCoordinator; | ||
/// @notice the BLSPublicKeyCompendium contract against which pubkey ownership is checked | ||
IBLSPublicKeyCompendium public immutable pubkeyCompendium; | ||
|
||
/// @notice mapping of quorumNumber => ApkUpdate[], tracking the aggregate pubkey updates of every quorum | ||
mapping(uint8 => ApkUpdate[]) public quorumApkUpdates; | ||
/// @notice mapping of quorumNumber => current aggregate pubkey of quorum | ||
mapping(uint8 => BN254.G1Point) public quorumApk; | ||
|
||
constructor(IRegistryCoordinator _registryCoordinator, IBLSPublicKeyCompendium _pubkeyCompendium) { | ||
registryCoordinator = _registryCoordinator; | ||
pubkeyCompendium = _pubkeyCompendium; | ||
// disable initializers so that the implementation contract cannot be initialized | ||
_disableInitializers(); | ||
} | ||
|
||
// storage gap for upgradeability | ||
uint256[48] private __GAP; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity =0.8.12; | ||
|
||
import "../interfaces/IIndexRegistry.sol"; | ||
import "../interfaces/IRegistryCoordinator.sol"; | ||
|
||
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol"; | ||
|
||
abstract contract IndexRegistryStorage is Initializable, IIndexRegistry { | ||
|
||
/// @notice The value that indices of deregistered operators are set to | ||
uint32 public constant OPERATOR_DEREGISTERED_INDEX = type(uint32).max; | ||
|
||
/// @notice The RegistryCoordinator contract for this middleware | ||
IRegistryCoordinator public immutable registryCoordinator; | ||
|
||
/// @notice list of all operators ever registered, may include duplicates. used to avoid running an indexer on nodes | ||
bytes32[] public globalOperatorList; | ||
|
||
/// @notice mapping of operatorId => quorumNumber => index history of that operator | ||
mapping(bytes32 => mapping(uint8 => OperatorIndexUpdate[])) internal _operatorIdToIndexHistory; | ||
/// @notice mapping of quorumNumber => history of numbers of unique registered operators | ||
mapping(uint8 => OperatorIndexUpdate[]) internal _totalOperatorsHistory; | ||
|
||
constructor( | ||
IRegistryCoordinator _registryCoordinator | ||
){ | ||
registryCoordinator = _registryCoordinator; | ||
// disable initializers so that the implementation contract cannot be initialized | ||
_disableInitializers(); | ||
} | ||
|
||
// storage gap for upgradeability | ||
uint256[47] private __GAP; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters