1
1
// SPDX-License-Identifier: BUSL-1.1
2
2
pragma solidity >= 0.5.0 ;
3
3
4
+ import {OperatorSet} from "../libraries/OperatorSetLib.sol " ;
5
+ import {BN254} from "../libraries/BN254.sol " ;
6
+ import "./ISemVerMixin.sol " ;
7
+
8
+ interface IKeyRegistrarErrors {
9
+ /// Key Management
10
+ error KeyAlreadyRegistered ();
11
+ error InvalidKeyFormat ();
12
+ error ZeroAddress ();
13
+ error ZeroPubkey ();
14
+ error InvalidCurveType ();
15
+ error InvalidKeypair ();
16
+ error ConfigurationAlreadySet ();
17
+ error OperatorSetNotConfigured ();
18
+ error KeyNotFound (OperatorSet operatorSet , address operator );
19
+ }
20
+
4
21
interface IKeyRegistrarTypes {
5
22
/// @dev Enum defining supported curve types
6
23
enum CurveType {
@@ -15,3 +32,119 @@ interface IKeyRegistrarTypes {
15
32
bytes keyData; // Flexible storage for different curve types
16
33
}
17
34
}
35
+
36
+ interface IKeyRegistrarEvents is IKeyRegistrarTypes {
37
+ event KeyRegistered (OperatorSet operatorSet , address indexed operator , CurveType curveType , bytes pubkey );
38
+ event KeyDeregistered (OperatorSet operatorSet , address indexed operator , CurveType curveType );
39
+ event AggregateBN254KeyUpdated (OperatorSet operatorSet , BN254.G1Point newAggregateKey );
40
+ event OperatorSetConfigured (OperatorSet operatorSet , CurveType curveType );
41
+ }
42
+
43
+ interface IKeyRegistrar is IKeyRegistrarErrors , IKeyRegistrarEvents , ISemVerMixin {
44
+ /**
45
+ * @notice Configures an operator set with curve type
46
+ * @param operatorSet The operator set to configure
47
+ * @param curveType Type of curve (ECDSA, BN254)
48
+ * @dev Only authorized callers for the AVS can configure operator sets
49
+ */
50
+ function configureOperatorSet (OperatorSet memory operatorSet , CurveType curveType ) external ;
51
+
52
+ /**
53
+ * @notice Registers a cryptographic key for an operator with a specific operator set
54
+ * @param operator Address of the operator to register key for
55
+ * @param operatorSet The operator set to register the key for
56
+ * @param pubkey Public key bytes
57
+ * @param signature Signature proving ownership (only needed for BN254 keys)
58
+ * @dev Can be called by operator directly or by addresses they've authorized via PermissionController
59
+ * @dev Reverts if key is already registered
60
+ */
61
+ function registerKey (
62
+ address operator ,
63
+ OperatorSet memory operatorSet ,
64
+ bytes calldata pubkey ,
65
+ bytes calldata signature
66
+ ) external ;
67
+
68
+ /**
69
+ * @notice Deregisters a cryptographic key for an operator with a specific operator set
70
+ * @param operator Address of the operator to deregister key for
71
+ * @param operatorSet The operator set to deregister the key from
72
+ * @dev Can be called by avs directly or by addresses they've authorized via PermissionController
73
+ * @dev Reverts if key was not registered
74
+ * @dev Keys remain in global key registry to prevent reuse
75
+ */
76
+ function deregisterKey (address operator , OperatorSet memory operatorSet ) external ;
77
+
78
+ /**
79
+ * @notice Checks if an operator has a registered key
80
+ * @param operatorSet The operator set to check and update
81
+ * @param operator Address of the operator
82
+ * @return whether the operator has a registered key
83
+ * @dev This function is called by the AVSRegistrar when an operator registers for an AVS
84
+ * @dev Only authorized callers for the AVS can call this function
85
+ * @dev Reverts if operator doesn't have a registered key for this operator set
86
+ */
87
+ function checkKey (OperatorSet memory operatorSet , address operator ) external view returns (bool );
88
+
89
+ /**
90
+ * @notice Checks if a key is registered for an operator with a specific operator set
91
+ * @param operatorSet The operator set to check
92
+ * @param operator Address of the operator
93
+ * @return True if the key is registered
94
+ */
95
+ function isRegistered (OperatorSet memory operatorSet , address operator ) external view returns (bool );
96
+
97
+ /**
98
+ * @notice Gets the configuration for an operator set
99
+ * @param operatorSet The operator set to get configuration for
100
+ * @return The operator set configuration
101
+ */
102
+ function getOperatorSetCurveType (
103
+ OperatorSet memory operatorSet
104
+ ) external view returns (CurveType);
105
+
106
+ /**
107
+ * @notice Gets the BN254 public key for an operator with a specific operator set
108
+ * @param operatorSet The operator set to get the key for
109
+ * @param operator Address of the operator
110
+ * @return g1Point The BN254 G1 public key
111
+ * @return g2Point The BN254 G2 public key
112
+ */
113
+ function getBN254Key (
114
+ OperatorSet memory operatorSet ,
115
+ address operator
116
+ ) external view returns (BN254.G1Point memory g1Point , BN254.G2Point memory g2Point );
117
+
118
+ /**
119
+ * @notice Gets the ECDSA public key for an operator with a specific operator set as bytes
120
+ * @param operatorSet The operator set to get the key for
121
+ * @param operator Address of the operator
122
+ * @return pubkey The ECDSA public key
123
+ */
124
+ function getECDSAKey (OperatorSet memory operatorSet , address operator ) external view returns (bytes memory );
125
+
126
+ /**
127
+ * @notice Gets the ECDSA public key for an operator with a specific operator set
128
+ * @param operatorSet The operator set to get the key for
129
+ * @param operator Address of the operator
130
+ * @return pubkey The ECDSA public key
131
+ */
132
+ function getECDSAAddress (OperatorSet memory operatorSet , address operator ) external view returns (address );
133
+
134
+ /**
135
+ * @notice Checks if a key hash is globally registered
136
+ * @param keyHash Hash of the key
137
+ * @return True if the key is globally registered
138
+ */
139
+ function isKeyGloballyRegistered (
140
+ bytes32 keyHash
141
+ ) external view returns (bool );
142
+
143
+ /**
144
+ * @notice Gets the key hash for an operator with a specific operator set
145
+ * @param operatorSet The operator set to get the key hash for
146
+ * @param operator Address of the operator
147
+ * @return keyHash The key hash
148
+ */
149
+ function getKeyHash (OperatorSet memory operatorSet , address operator ) external view returns (bytes32 );
150
+ }
0 commit comments