|
| 1 | +// SPDX-License-Identifier: BUSL-1.1 |
| 2 | +pragma solidity ^0.8.27; |
| 3 | + |
| 4 | +import "src/contracts/libraries/OperatorSetLib.sol"; |
| 5 | + |
| 6 | +import "src/contracts/interfaces/IECDSATableCalculator.sol"; |
| 7 | +import "src/contracts/interfaces/IBN254TableCalculator.sol"; |
| 8 | +import "src/contracts/interfaces/ICertificateVerifier.sol"; |
| 9 | + |
| 10 | +interface IOperatorTableUpdaterErrors { |
| 11 | + /// @notice Thrown when the GlobalTableRoot update fails |
| 12 | + error GlobalTableRootUpdateFailed(); |
| 13 | +} |
| 14 | + |
| 15 | +interface IOperatorTableUpdaterEvents { |
| 16 | + /** |
| 17 | + * @notice Emitted when a new global table root is set |
| 18 | + * @param referenceTimestamp the timestamp of the global table root |
| 19 | + * @param globalTableRoot the root of the global table |
| 20 | + */ |
| 21 | + event NewglobalTableRoot(uint32 referenceTimestamp, bytes32 globalTableRoot); |
| 22 | +} |
| 23 | + |
| 24 | +interface IOperatorTableUpdater is |
| 25 | + IOperatorTableUpdaterErrors, |
| 26 | + IOperatorTableUpdaterEvents, |
| 27 | + ICertificateVerifierTypes |
| 28 | +{ |
| 29 | + /** |
| 30 | + * @notice Confirms Global operator table root |
| 31 | + * @param globalTableRootCert certificate of the root |
| 32 | + * @param globalTableRoot merkle root of all operatorSet tables |
| 33 | + * @param referenceTimestamp timestamp of the root |
| 34 | + * @dev Any entity can submit with a valid certificate signed off by the `globalRootConfirmerSet` |
| 35 | + * @dev The `msgHash` in the `globalOperatorTableRootCert` is the hash of the `globalOperatorTableRoot` |
| 36 | + */ |
| 37 | + function confirmGlobalTableRoot( |
| 38 | + BN254Certificate calldata globalTableRootCert, |
| 39 | + bytes32 globalTableRoot, |
| 40 | + uint32 referenceTimestamp |
| 41 | + ) external; |
| 42 | + |
| 43 | + /** |
| 44 | + * @notice Set the operatorSet which certifies against global roots |
| 45 | + * @param operatorSet the operatorSet which certifies against global roots |
| 46 | + * @dev The `operatorSet` is used to verify the certificate of the global table root |
| 47 | + * @dev Only callable by the owner of the contract |
| 48 | + */ |
| 49 | + function setGlobalRootConfirmerSet( |
| 50 | + OperatorSet calldata operatorSet |
| 51 | + ) external; |
| 52 | + |
| 53 | + /** |
| 54 | + * @notice The threshold, in bps, for a global root to be signed off on and updated |
| 55 | + * @dev Only callable by the owner of the contract |
| 56 | + */ |
| 57 | + function setGlobalRootConfirmationThreshold( |
| 58 | + uint16 bps |
| 59 | + ) external; |
| 60 | + |
| 61 | + /** |
| 62 | + * @notice update a BN254 operator table in the CertificateVerifier |
| 63 | + * @param referenceTimestamp the reference block number of the globalTableRoot |
| 64 | + * @param globalTableRoot the new globalTableRoot |
| 65 | + * @param operatorSetIndex the index of the given operatorSet being updated |
| 66 | + * @param proof the proof of the leaf at index against the globalTableRoot |
| 67 | + * @param operatorSet the operatorSet being proven |
| 68 | + * @param operatorSetInfo the operatorSetInfo of the operator table |
| 69 | + * @param config the configuration of the operatorSet |
| 70 | + * @dev globalTableRoot must be confirmed majority certified by globalTableRootSet |
| 71 | + */ |
| 72 | + function updateBN254OperatorTable( |
| 73 | + uint32 referenceTimestamp, |
| 74 | + bytes32 globalTableRoot, |
| 75 | + uint32 operatorSetIndex, |
| 76 | + bytes calldata proof, |
| 77 | + OperatorSet calldata operatorSet, |
| 78 | + BN254OperatorSetInfo calldata operatorSetInfo, |
| 79 | + OperatorSetConfig calldata config |
| 80 | + ) external; |
| 81 | + |
| 82 | + /** |
| 83 | + * @notice updates an ECDSA operator table in the CertificateVerifier |
| 84 | + * @param referenceTimestamp the reference block number of the globalTableRoot |
| 85 | + * @param globalTableRoot the new globalTableRoot |
| 86 | + * @param operatorSetIndex the index of the given operatorSet being updated |
| 87 | + * @param proof the proof of the leaf at index against the globalTableRoot |
| 88 | + * @param operatorSet the operatorSet being proven |
| 89 | + * @param operatorInfos the operatorInfos of the operator table |
| 90 | + * @param config the configuration of the operatorSet |
| 91 | + * @dev globalTableRoot must be confirmed majority certified by globalTableRootSet |
| 92 | + */ |
| 93 | + function updateECDSAOperatorTable( |
| 94 | + uint32 referenceTimestamp, |
| 95 | + bytes32 globalTableRoot, |
| 96 | + uint32 operatorSetIndex, |
| 97 | + bytes calldata proof, |
| 98 | + OperatorSet calldata operatorSet, |
| 99 | + ECDSAOperatorInfo[] calldata operatorInfos, |
| 100 | + OperatorSetConfig calldata config |
| 101 | + ) external; |
| 102 | + |
| 103 | + /** |
| 104 | + * @notice Get the current global table root |
| 105 | + * @return globalTableRoot the current global table root |
| 106 | + */ |
| 107 | + function getCurrentGlobalTableRoot() external view returns (bytes32 globalTableRoot); |
| 108 | + |
| 109 | + /** |
| 110 | + * @notice Get the table root by timestamp |
| 111 | + * @param referenceTimestamp the timestamp of the table root |
| 112 | + * @return tableRoot the table root at the given timestamp |
| 113 | + */ |
| 114 | + function getTableRootByTimestamp( |
| 115 | + uint32 referenceTimestamp |
| 116 | + ) external view returns (bytes32 tableRoot); |
| 117 | +} |
0 commit comments