@@ -9,6 +9,16 @@ import "../shared/Structs.sol";
9
9
* Both user decryption and public decryption are handled.
10
10
*/
11
11
interface IDecryption {
12
+ /**
13
+ * @notice A struct that specifies information about the contracts to be used in the decryption.
14
+ */
15
+ struct ContractsInfo {
16
+ /// @notice The chain ID of the contracts to be used in the decryption
17
+ uint256 chainId;
18
+ /// @notice The list of contract addresses to be used in the decryption
19
+ address [] addresses;
20
+ }
21
+
12
22
/**
13
23
* @notice A struct that specifies the validity period of a request, starting at "startTimestamp"
14
24
* and remaining valid for "durationDays".
@@ -27,38 +37,57 @@ interface IDecryption {
27
37
* @notice Emitted when an public decryption request is made.
28
38
* @param decryptionId The decryption request ID.
29
39
* @param snsCtMaterials The handles, key IDs and SNS ciphertexts to decrypt.
40
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
30
41
*/
31
- event PublicDecryptionRequest (uint256 indexed decryptionId , SnsCiphertextMaterial[] snsCtMaterials );
42
+ event PublicDecryptionRequest (
43
+ uint256 indexed decryptionId ,
44
+ SnsCiphertextMaterial[] snsCtMaterials ,
45
+ bytes extraData
46
+ );
32
47
33
48
/**
34
49
* @notice Emitted when an public decryption response is made.
35
50
* @param decryptionId The decryption request ID associated with the response.
36
51
* @param decryptedResult The decrypted result.
37
52
* @param signatures The signatures of all the KMS connectors that responded.
53
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
38
54
*/
39
- event PublicDecryptionResponse (uint256 indexed decryptionId , bytes decryptedResult , bytes [] signatures );
55
+ event PublicDecryptionResponse (
56
+ uint256 indexed decryptionId ,
57
+ bytes decryptedResult ,
58
+ bytes [] signatures ,
59
+ bytes extraData
60
+ );
40
61
41
62
/**
42
63
* @notice Emitted when a user decryption request is made.
43
64
* @param decryptionId The decryption request ID.
44
65
* @param snsCtMaterials The handles, key IDs and SNS ciphertexts to decrypt.
45
66
* @param userAddress The user's address.
46
67
* @param publicKey The user's public key for used reencryption.
68
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
47
69
*/
48
70
event UserDecryptionRequest (
49
71
uint256 indexed decryptionId ,
50
72
SnsCiphertextMaterial[] snsCtMaterials ,
51
73
address userAddress ,
52
- bytes publicKey
74
+ bytes publicKey ,
75
+ bytes extraData
53
76
);
54
77
55
78
/**
56
79
* @notice Emitted when an public decryption response is made.
57
80
* @param decryptionId The decryption request ID associated with the response.
58
81
* @param userDecryptedShares The list of decryption shares reencrypted with the user's public key.
59
82
* @param signatures The signatures of all the KMS connectors that responded.
83
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
60
84
*/
61
- event UserDecryptionResponse (uint256 indexed decryptionId , bytes [] userDecryptedShares , bytes [] signatures );
85
+ event UserDecryptionResponse (
86
+ uint256 indexed decryptionId ,
87
+ bytes [] userDecryptedShares ,
88
+ bytes [] signatures ,
89
+ bytes extraData
90
+ );
62
91
63
92
/// @notice Error indicating that the input list of handles is empty.
64
93
error EmptyCtHandles ();
@@ -172,87 +201,95 @@ interface IDecryption {
172
201
/**
173
202
* @notice Requests a public decryption.
174
203
* @param ctHandles The handles of the ciphertexts to decrypt.
204
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
175
205
*/
176
- function publicDecryptionRequest (bytes32 [] calldata ctHandles ) external ;
206
+ function publicDecryptionRequest (bytes32 [] calldata ctHandles , bytes calldata extraData ) external ;
177
207
178
208
/**
179
209
* @notice Responds to a public decryption request.
180
210
* @param decryptionId The decryption request ID associated with the response.
181
211
* @param decryptedResult The decrypted result.
182
212
* @param signature The signature of the KMS connector that responded.
213
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
183
214
*/
184
215
function publicDecryptionResponse (
185
216
uint256 decryptionId ,
186
217
bytes calldata decryptedResult ,
187
- bytes calldata signature
218
+ bytes calldata signature ,
219
+ bytes calldata extraData
188
220
) external ;
189
221
190
222
/**
191
223
* @notice Requests a user decryption.
192
224
* @param ctHandleContractPairs The ciphertexts to decrypt for associated contracts.
193
225
* @param requestValidity The validity period of the user decryption request.
194
- * @param contractsChainId The chain ID of the given contract addresses figuring in the signed EIP-712 message.
195
- * @param contractAddresses The contract addresses figuring in the signed EIP-712 message.
226
+ * @param contractsInfo The chain ID and contract addresses to be used in the decryption.
196
227
* @param userAddress The user's address.
197
228
* @param publicKey The user's public key to reencrypt the decryption shares.
198
229
* @param signature The EIP712 signature to verify.
230
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
199
231
*/
200
232
function userDecryptionRequest (
201
233
CtHandleContractPair[] calldata ctHandleContractPairs ,
202
234
RequestValidity calldata requestValidity ,
203
- uint256 contractsChainId ,
204
- address [] calldata contractAddresses ,
235
+ ContractsInfo calldata contractsInfo ,
205
236
address userAddress ,
206
237
bytes calldata publicKey ,
207
- bytes calldata signature
238
+ bytes calldata signature ,
239
+ bytes calldata extraData
208
240
) external ;
209
241
210
242
/**
211
243
* @notice Requests a delegated user decryption.
212
244
* @param ctHandleContractPairs The ciphertexts to decrypt for associated contracts.
213
245
* @param requestValidity The validity period of the user decryption request.
214
246
* @param delegationAccounts The user's address and the delegated account address for the user decryption.
215
- * @param contractsChainId The chain ID of the given contract addresses figuring in the signed EIP-712 message.
216
- * @param contractAddresses The contract addresses figuring in the signed EIP-712 message.
247
+ * @param contractsInfo The chain ID and contract addresses to be used in the decryption.
217
248
* @param publicKey The user's public key to reencrypt the decryption shares.
218
249
* @param signature The EIP712 signature to verify.
250
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
219
251
*/
220
252
function delegatedUserDecryptionRequest (
221
253
CtHandleContractPair[] calldata ctHandleContractPairs ,
222
254
RequestValidity calldata requestValidity ,
223
255
DelegationAccounts calldata delegationAccounts ,
224
- uint256 contractsChainId ,
225
- address [] calldata contractAddresses ,
256
+ ContractsInfo calldata contractsInfo ,
226
257
bytes calldata publicKey ,
227
- bytes calldata signature
258
+ bytes calldata signature ,
259
+ bytes calldata extraData
228
260
) external ;
229
261
230
262
/**
231
263
* @notice Responds to a user decryption request.
232
264
* @param decryptionId The decryption request ID associated with the response.
233
265
* @param userDecryptedShare The partial decryption share reencrypted with the user's public key.
234
266
* @param signature The signature of the KMS connector that responded.
267
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
235
268
*/
236
269
function userDecryptionResponse (
237
270
uint256 decryptionId ,
238
271
bytes calldata userDecryptedShare ,
239
- bytes calldata signature
272
+ bytes calldata signature ,
273
+ bytes calldata extraData
240
274
) external ;
241
275
242
276
/**
243
277
* @notice Checks if handles are ready to be decrypted publicly.
244
278
* @param ctHandles The ciphertext handles.
279
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
245
280
*/
246
- function checkPublicDecryptionReady (bytes32 [] calldata ctHandles ) external view ;
281
+ function checkPublicDecryptionReady (bytes32 [] calldata ctHandles , bytes calldata extraData ) external view ;
247
282
248
283
/**
249
284
* @notice Checks if handles are ready to be decrypted by a user.
250
285
* @param userAddress The user's address.
251
286
* @param ctHandleContractPairs The ciphertext handles with associated contract addresses.
287
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
252
288
*/
253
289
function checkUserDecryptionReady (
254
290
address userAddress ,
255
- CtHandleContractPair[] calldata ctHandleContractPairs
291
+ CtHandleContractPair[] calldata ctHandleContractPairs ,
292
+ bytes calldata extraData
256
293
) external view ;
257
294
258
295
/**
@@ -261,12 +298,14 @@ interface IDecryption {
261
298
* @param delegationAccounts The delegator and delegated address.
262
299
* @param ctHandleContractPairs The ciphertext handles with associated contract addresses.
263
300
* @param contractAddresses The contract addresses.
301
+ * @param extraData Generic bytes metadata for versioned payloads. First byte is for the version.
264
302
*/
265
303
function checkDelegatedUserDecryptionReady (
266
304
uint256 contractsChainId ,
267
305
DelegationAccounts calldata delegationAccounts ,
268
306
CtHandleContractPair[] calldata ctHandleContractPairs ,
269
- address [] calldata contractAddresses
307
+ address [] calldata contractAddresses ,
308
+ bytes calldata extraData
270
309
) external view ;
271
310
272
311
/**
0 commit comments